Commit 944d8c92 authored by yf's avatar yf

大屏相关接口修改

parent 02cd9be3
......@@ -10,9 +10,12 @@ import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.RiskLevelProportion;
import com.ruoyi.system.service.IRiskLevelProportionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
......@@ -24,6 +27,8 @@ import java.util.stream.Collectors;
@RequestMapping("/system/bigScreen")
public class BigScreenController extends BaseController {
@Autowired
private IRiskLevelProportionService riskLevelProportionService;
@Autowired
ILedgerProjectService ledgerProjectService;
@Autowired
......@@ -45,7 +50,7 @@ public class BigScreenController extends BaseController {
@GetMapping("/selectLedgerProjectList")
public R<TableDataInfo> selectLedgerProjectList(String name) {
startPage();
List<LedgerProject> list = ledgerProjectService.getLedgerProjectList(name, null);
List<LedgerProject> list = ledgerProjectService.getLedgerProjectList(name, null, null);
return R.ok(getDataTable(list));
}
......@@ -53,11 +58,14 @@ public class BigScreenController extends BaseController {
* 项目,楼宇,楼层统计
*/
@GetMapping("/evaluationDataStatistics")
public R<EvaluationDataDto> evaluationDataStatistics(String areaName) {
public R<EvaluationDataDto> evaluationDataStatistics(Integer level, String areaName) {
if (areaName != null && areaName.contains("北京") || areaName.contains("重庆") || areaName.contains("上海") || areaName.contains("天津")) {
level += 1;
}
EvaluationDataDto result = new EvaluationDataDto();
Long projectNum = ledgerProjectService.getProjectCount(areaName);
Long buildingNum = ledgerProjectService.getBuildingCount(areaName, null);
Long floorNum = ledgerProjectService.getFloorCount(areaName, null);
Long projectNum = ledgerProjectService.getProjectCount(level, areaName);
Long buildingNum = ledgerProjectService.getBuildingCount(level, areaName, null);
Long floorNum = ledgerProjectService.getFloorCount(level, areaName, null);
result.setProjectNum(projectNum);
result.setBuildingNum(buildingNum);
result.setFloorNum(floorNum);
......@@ -68,14 +76,17 @@ public class BigScreenController extends BaseController {
* 全国风险,年度新增
*/
@GetMapping("/nationalRiskStatistics")
public R<NationalRiskStatisticsDto> nationalRiskStatistics(String areaName, Integer type) {
public R<NationalRiskStatisticsDto> nationalRiskStatistics(Integer level, String areaName, Integer type) {
if (areaName != null && areaName.contains("北京") || areaName.contains("重庆") || areaName.contains("上海") || areaName.contains("天津")) {
level += 1;
}
NationalRiskStatisticsDto result = new NationalRiskStatisticsDto();
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH, Calendar.JANUARY);
calendar.set(Calendar.DAY_OF_MONTH, 1);
Date beginTime = calendar.getTime();
Long nationalRiskNum = riskPlanExistingListService.getNationalRiskNum(areaName, null, null);
Long newRiskNum = riskPlanExistingListService.getNationalRiskNum(areaName, beginTime, null);
Long nationalRiskNum = riskPlanExistingListService.getNationalRiskNum(level, areaName, null, null);
Long newRiskNum = riskPlanExistingListService.getNationalRiskNum(level, areaName, beginTime, null);
result.setNationalRiskNum(nationalRiskNum);
result.setNewRiskNum(newRiskNum);
return R.ok(result);
......@@ -85,9 +96,12 @@ public class BigScreenController extends BaseController {
* 总体风险指数排名
*/
@GetMapping("/riskIndexRanking")
public R<List<RiskIndexRankingDto>> riskIndexRanking(String areaName, Integer type) {
public R<List<RiskIndexRankingDto>> riskIndexRanking(Integer level, String areaName, Integer type) {
if (areaName != null && areaName.contains("北京") || areaName.contains("重庆") || areaName.contains("上海") || areaName.contains("天津")) {
level += 1;
}
startPage();
List<RiskIndexRankingDto> result = riskPlanExistingListService.getRiskIndexRanking(areaName);
List<RiskIndexRankingDto> result = riskPlanExistingListService.getRiskIndexRanking(level, areaName);
return R.ok(result);
}
......@@ -95,8 +109,11 @@ public class BigScreenController extends BaseController {
* 年度风险数量统计
*/
@GetMapping("/annualRiskStatistics")
public R<LinkedHashMap<String, Long>> annualRiskStatistics(String areaName, Integer type) {
LinkedHashMap<String, Long> result = riskPlanExistingListService.getAnnualRiskStatistics(areaName);
public R<LinkedHashMap<String, Long>> annualRiskStatistics(Integer level, String areaName, Integer type) {
if (areaName != null && areaName.contains("北京") || areaName.contains("重庆") || areaName.contains("上海") || areaName.contains("天津")) {
level += 1;
}
LinkedHashMap<String, Long> result = riskPlanExistingListService.getAnnualRiskStatistics(level, areaName);
return R.ok(result);
}
......@@ -104,8 +121,11 @@ public class BigScreenController extends BaseController {
* 风险级别统计
*/
@GetMapping("/riskLevelStatistics")
public R<List<RiskLevelStatisticsDto>> riskLevelStatistics(String areaName, Integer type) {
List<RiskLevelStatisticsDto> result = riskPlanExistingListService.getRiskLevelStatistics(areaName, null);
public R<List<RiskLevelStatisticsDto>> riskLevelStatistics(Integer level, String areaName, Integer type) {
if (areaName != null && areaName.contains("北京") || areaName.contains("重庆") || areaName.contains("上海") || areaName.contains("天津")) {
level += 1;
}
List<RiskLevelStatisticsDto> result = riskPlanExistingListService.getRiskLevelStatistics(level, areaName, null);
return R.ok(result);
}
......@@ -113,8 +133,11 @@ public class BigScreenController extends BaseController {
* 事故类型统计
*/
@GetMapping("/accidentTypeStatistics")
public R<List<AccidentTypeStatisticsDto>> accidentTypeStatistics(String areaName, Integer type) {
List<AccidentTypeStatisticsDto> result = riskPlanExistingListService.getAccidentTypeStatistics(areaName);
public R<List<AccidentTypeStatisticsDto>> accidentTypeStatistics(Integer level, String areaName, Integer type) {
if (areaName != null && areaName.contains("北京") || areaName.contains("重庆") || areaName.contains("上海") || areaName.contains("天津")) {
level += 1;
}
List<AccidentTypeStatisticsDto> result = riskPlanExistingListService.getAccidentTypeStatistics(level, areaName);
return R.ok(result);
}
......@@ -127,8 +150,11 @@ public class BigScreenController extends BaseController {
* @return
*/
@GetMapping("/riskProjectRanking")
public R<List<RiskProjectRankingDto>> riskProjectRanking(String areaName, String level, Integer type) {
List<RiskProjectRankingDto> result = riskPlanExistingListService.getRiskProjectRanking(areaName, level);
public R<List<RiskProjectRankingDto>> riskProjectRanking(Integer level, String areaName, Integer type) {
if (areaName != null && areaName.contains("北京") || areaName.contains("重庆") || areaName.contains("上海") || areaName.contains("天津")) {
level += 1;
}
List<RiskProjectRankingDto> result = riskPlanExistingListService.getRiskProjectRanking(level, areaName);
return R.ok(result);
}
......@@ -140,26 +166,35 @@ public class BigScreenController extends BaseController {
*/
@GetMapping("/getRiskMapStatistics")
public R<List<RiskMapStatisticsDto>> getRiskMapStatistics(MapStatisticsQueryDto queryDto) {
if (queryDto.getAreaName() != null && queryDto.getAreaName().contains("北京") || queryDto.getAreaName().contains("重庆") || queryDto.getAreaName().contains("上海") || queryDto.getAreaName().contains("天津")) {
queryDto.setLevel(queryDto.getLevel() + 1);
}
//查询风险等级占比
List<RiskLevelProportion> levelProportions = riskLevelProportionService.list();
List<RiskMapStatisticsDto> list = riskPlanExistingListService.getRiskMapStatistics(queryDto);
if (queryDto.getLevel().equals(3) || queryDto.getLevelName().equals("district")) {
List<LedgerProject> projects = ledgerProjectService.getLedgerProjectList(null, queryDto.getAreaName());
for (RiskMapStatisticsDto r : list) {
if(r.getAreaName()!=null){
List<MapLedgerProjectDto> projectList = projects.stream().filter(s -> s.getDistrict() != null &&
s.getDistrict().contains(r.getAreaName())
).map(s->{
MapLedgerProjectDto projectDto=new MapLedgerProjectDto();
projectDto.setProjectId(s.getId());
projectDto.setProjectName(s.getName());
projectDto.setExistingNum(10L);
projectDto.setInherentNum(10L);
projectDto.setRiskSumNum(20L);
projectDto.setLat(s.getLat());
projectDto.setLng(s.getLng());
return projectDto;
}).collect(Collectors.toList());
r.setProjectList(projectList);
List<MapLedgerProjectDto> projects = ledgerProjectService.getProjectListAndCount(queryDto.getLevel(), queryDto.getAreaName());
for (RiskMapStatisticsDto r : list) {
if (r.getAreaName() != null) {
List<MapLedgerProjectDto> projectList = projects.stream().filter(s ->
(queryDto.getLevel().equals(0) && s.getProvince() != null && s.getProvince().contains(r.getAreaName()))
|| (queryDto.getLevel().equals(1) && s.getCity() != null && s.getCity().contains(r.getAreaName()))
|| (queryDto.getLevel().equals(2) && s.getDistrict() != null && s.getDistrict().contains(r.getAreaName()))).collect(Collectors.toList());
if (projectList != null && projectList.size() > 0) {
BigDecimal projectRiskIndex = projectList.stream().map(f -> f.getRiskIndex() == null ? BigDecimal.ZERO : f.getRiskIndex()).reduce(BigDecimal.ZERO, BigDecimal::add)
.divide(BigDecimal.valueOf(projectList.size()), 2, BigDecimal.ROUND_HALF_UP);
for (RiskLevelProportion item : levelProportions) {
if (projectRiskIndex.compareTo(item.getLevelValMin()) > -1 && projectRiskIndex.compareTo(item.getLevelValMax()) == -1) {
r.setAreaColor(item.getRiskColor());
}
}
if (queryDto.getLevel().equals(2))
r.setProjectList(projectList);
}
else{
}
}
}
......@@ -180,27 +215,27 @@ public class BigScreenController extends BaseController {
List<RiskPlan> lastRiskPlan = riskPlanServices.list(Wrappers.<RiskPlan>query().lambda().eq(RiskPlan::getProjectId, projectId).orderByDesc(RiskPlan::getCreateTime));
result.setEvaluationTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, lastRiskPlan.get(0).getCreateTime()));
//评估数据
Long buildingNum = ledgerProjectService.getBuildingCount(null, projectId);
Long floorNum = ledgerProjectService.getFloorCount(null, projectId);
Long buildingNum = ledgerProjectService.getBuildingCount(null, null, projectId);
Long floorNum = ledgerProjectService.getFloorCount(null, null, projectId);
EvaluationDataDto evaluationDataDto = new EvaluationDataDto();
evaluationDataDto.setProjectNum(1L);
evaluationDataDto.setBuildingNum(buildingNum);
evaluationDataDto.setFloorNum(floorNum);
result.setEvaluationData(evaluationDataDto);
//固有风险数量
Long inherentNum = riskPlanInherentListService.getNationalRiskNum(null, null, projectId);
Long inherentNum = riskPlanInherentListService.getNationalRiskNum(null, null, null, projectId);
result.setInherentNum(inherentNum);
//现状风险数量
Long existingNum = riskPlanExistingListService.getNationalRiskNum(null, null, projectId);
Long existingNum = riskPlanExistingListService.getNationalRiskNum(null, null, null, projectId);
result.setExistingNum(existingNum);
//风险总数量
Long sumNum = inherentNum + existingNum;
result.setRiskSumNum(sumNum);
//风险等级-固有
List<RiskLevelStatisticsDto> inherentLevelStatics = riskPlanInherentListService.getRiskLevelStatistics(null, projectId);
List<RiskLevelStatisticsDto> inherentLevelStatics = riskPlanInherentListService.getRiskLevelStatistics(null, null, projectId);
result.setInherentLevelStatics(inherentLevelStatics);
//风险等级-现状
List<RiskLevelStatisticsDto> existingLevelStatics = riskPlanExistingListService.getRiskLevelStatistics(null, projectId);
List<RiskLevelStatisticsDto> existingLevelStatics = riskPlanExistingListService.getRiskLevelStatistics(null, null, projectId);
result.setExistingLevelStatics(existingLevelStatics);
return R.ok(result);
}
......
......@@ -191,7 +191,7 @@ public class RiskPlanAppController extends BaseController {
*/
@DeleteMapping("/{id}")
public R<Integer> deleteById(@PathVariable Long id) {
return R.ok(riskPlanService.revokeByPlanId(id,getUserId()));
return R.ok(riskPlanService.revokeByPlanId(id, getUserId()));
}
/**
......@@ -201,7 +201,7 @@ public class RiskPlanAppController extends BaseController {
* @real_return {@link R<List<RiskPlanAppListDto>>}
*/
@GetMapping("/create/list")
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByCreateUser(String status,String name) {
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByCreateUser(String status, String name) {
List<RiskPlanStatusType> statusList = new ArrayList<>();
String state = "";
if ("wait".equals(status)) {
......@@ -215,7 +215,7 @@ public class RiskPlanAppController extends BaseController {
, RiskPlanStatusType.PROJECT_REPORT, RiskPlanStatusType.FINISH);
state = "已执行";
}
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, getUserId(), null, null,name);
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, getUserId(), null, null, name);
String finalState = state;
list.forEach(dto -> {
dto.setState(finalState);
......@@ -230,7 +230,7 @@ public class RiskPlanAppController extends BaseController {
* @real_return {@link R<List<RiskPlanAppListDto>>}
*/
@GetMapping("/allocation/list")
public R<List<RiskPlanAppListDto>> getAllocationRiskPlanAppListDtoListByCreateUser(String status,String name) {
public R<List<RiskPlanAppListDto>> getAllocationRiskPlanAppListDtoListByCreateUser(String status, String name) {
List<RiskPlanStatusType> statusList = new ArrayList<>();
String state = "";
if ("wait".equals(status)) {
......@@ -244,7 +244,7 @@ public class RiskPlanAppController extends BaseController {
, RiskPlanStatusType.PROJECT_REPORT, RiskPlanStatusType.FINISH);
state = "已完成";
}
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, null, getUserId(), null,name);
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, null, getUserId(), null, name);
String finalState = state;
list.forEach(dto -> {
Long finishNumber = riskPlanUserBuildingService.countStatusByPlanIdAndStatus(dto.getId(), "finish");
......@@ -273,7 +273,7 @@ public class RiskPlanAppController extends BaseController {
* @real_return {@link R<List<RiskPlanAppListDto>>}
*/
@GetMapping("/task/list")
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByLeaderUser(String status,String name) {
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByLeaderUser(String status, String name) {
List<RiskPlanStatusType> statusList = new ArrayList<>();
String state = "";
if ("running".equals(status)) {
......@@ -288,7 +288,7 @@ public class RiskPlanAppController extends BaseController {
state = "已退回";
}
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, null, null, getUserId(),name);
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, null, null, getUserId(), name);
String finalState = state;
list.forEach(dto -> {
Long finishNumber = riskPlanUserBuildingService.countStatusByPlanIdAndStatus(dto.getId(), "finish");
......@@ -470,7 +470,7 @@ public class RiskPlanAppController extends BaseController {
RiskPlanInherentList riskPlanInherentList = new RiskPlanInherentList();
riskPlanInherentList.setId(inherentId);
riskPlanInherentList.setDelFlag("1");
return R.ok(riskPlanInherentListService.updateRiskPlanInherentList(riskPlanInherentList)>0);
return R.ok(riskPlanInherentListService.updateRiskPlanInherentList(riskPlanInherentList) > 0);
}
/**
......@@ -559,7 +559,9 @@ public class RiskPlanAppController extends BaseController {
}
saveDto.setMeasuresEmergencyFileIds(measuresEmergencyFileIds);
}
Map<String, String> mapResult = riskPlanExistingListService.getRiskLevelByScoreAndUpd(saveDto.getBuildingId(), saveDto.getLevelScore());
saveDto.setLevel(mapResult.get("level"));
saveDto.setRiskColor(mapResult.get("riskColor"));
return R.ok(riskPlanExistingListService.saveRiskExistingListSaveDto(saveDto));
}
......@@ -696,7 +698,7 @@ public class RiskPlanAppController extends BaseController {
@GetMapping("/details/list")
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByCreateUserDeptId(String name) {
Long deptId = getLoginUser().getDeptId();
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoListByCreateUserDeptId(deptId,name);
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoListByCreateUserDeptId(deptId, name);
list.forEach(dto -> {
dto.setState(RiskPlanStatusType.getTitleByStatus(dto.getStatus()).getTitle());
});
......@@ -704,46 +706,46 @@ public class RiskPlanAppController extends BaseController {
}
/**
*返回责单位列表
* 返回责单位列表
*/
@GetMapping("/inherent/getResponsibilityUnits")
public R<List<RiskPlanInherentList>> getResponsibilityUnits(String unitName,String projectId) {
public R<List<RiskPlanInherentList>> getResponsibilityUnits(String unitName, String projectId) {
List<RiskPlanInherentList> list=new ArrayList<>();
List<RiskPlanInherentList> list = new ArrayList<>();
QueryWrapper<RiskPlan> query = new QueryWrapper<>();
query.eq("project_id",projectId);
List<RiskPlan> listPlan=riskPlanService.list(query);
if (listPlan!=null&&listPlan.size() > 0) {
List<Long> listPlanIds=new ArrayList<>();
query.eq("project_id", projectId);
List<RiskPlan> listPlan = riskPlanService.list(query);
if (listPlan != null && listPlan.size() > 0) {
List<Long> listPlanIds = new ArrayList<>();
for (RiskPlan riskPlan : listPlan) {
listPlanIds.add(riskPlan.getId());
}
QueryWrapper<RiskPlanInherentList> queryWrapper = new QueryWrapper<>();
queryWrapper.select("measures_dept_name").in("plan_id",listPlanIds).like("measures_dept_name",unitName).isNotNull("measures_dept_name").groupBy("measures_dept_name");
list=riskPlanInherentListService.list(queryWrapper);
queryWrapper.select("measures_dept_name").in("plan_id", listPlanIds).like("measures_dept_name", unitName).isNotNull("measures_dept_name").groupBy("measures_dept_name");
list = riskPlanInherentListService.list(queryWrapper);
}
return R.ok(list);
}
/**
*返回责单位列表
* 返回责单位列表
*/
@GetMapping("/inherent/getResponsibilityPersons")
public R<List<RiskPlanInherentList>> getResponsibilityPersons(String personName,String projectId) {
public R<List<RiskPlanInherentList>> getResponsibilityPersons(String personName, String projectId) {
List<RiskPlanInherentList> list=new ArrayList<>();
List<RiskPlanInherentList> list = new ArrayList<>();
QueryWrapper<RiskPlan> query = new QueryWrapper<>();
query.eq("project_id",projectId);
List<RiskPlan> listPlan=riskPlanService.list(query);
if (listPlan!=null&&listPlan.size() > 0) {
List<Long> listPlanIds=new ArrayList<>();
query.eq("project_id", projectId);
List<RiskPlan> listPlan = riskPlanService.list(query);
if (listPlan != null && listPlan.size() > 0) {
List<Long> listPlanIds = new ArrayList<>();
for (RiskPlan riskPlan : listPlan) {
listPlanIds.add(riskPlan.getId());
}
QueryWrapper<RiskPlanInherentList> queryWrapper = new QueryWrapper<>();
queryWrapper.select("measures_user_name","measures_user_phone").in("plan_id",listPlanIds).like("measures_user_name",personName).isNotNull("measures_user_name").groupBy("measures_user_name");
list=riskPlanInherentListService.list(queryWrapper);
QueryWrapper<RiskPlanInherentList> queryWrapper = new QueryWrapper<>();
queryWrapper.select("measures_user_name", "measures_user_phone").in("plan_id", listPlanIds).like("measures_user_name", personName).isNotNull("measures_user_name").groupBy("measures_user_name");
list = riskPlanInherentListService.list(queryWrapper);
}
return R.ok(list);
}
......@@ -753,8 +755,7 @@ public class RiskPlanAppController extends BaseController {
*/
@Log(title = "app端新建项目数据", businessType = BusinessType.INSERT)
@PostMapping("/project")
public AjaxResult addProject(@RequestBody LedgerProject ledgerProject)
{
public AjaxResult addProject(@RequestBody LedgerProject ledgerProject) {
ledgerProject.setCreateBy(getUsername());
ledgerProjectService.insertLedgerProject(ledgerProject);
return AjaxResult.success(ledgerProject.getId());
......@@ -765,26 +766,25 @@ public class RiskPlanAppController extends BaseController {
*/
@Log(title = "app端新建楼宇数据", businessType = BusinessType.INSERT)
@PostMapping("/building")
public AjaxResult addBuilding(@RequestBody LedgerBuilding ledgerBuilding)
{
public AjaxResult addBuilding(@RequestBody LedgerBuilding ledgerBuilding) {
ledgerBuilding.setCreateBy(getUsername());
ledgerBuilding.setFloor(ledgerBuilding.getGroundFloor()+ledgerBuilding.getUndergroundFloor()+"");
ledgerBuilding.setFloor(ledgerBuilding.getGroundFloor() + ledgerBuilding.getUndergroundFloor() + "");
int result = ledgerBuildingService.insertLedgerBuilding(ledgerBuilding);
//导入楼层信息
if (ledgerBuilding.getGroundFloor()!=0){
if (ledgerBuilding.getGroundFloor() != 0) {
for (int i = 1; i <= ledgerBuilding.getGroundFloor(); i++) {
LedgerFloor ledgerFloor = new LedgerFloor();
ledgerFloor.setBuildingId(ledgerBuilding.getId());
ledgerFloor.setName(i+"层");
ledgerFloor.setName(i + "层");
ledgerFloor.setType("地上");
ledgerFloorService.insertLedgerFloor(ledgerFloor);
}
}
if (ledgerBuilding.getUndergroundFloor()!=0){
if (ledgerBuilding.getUndergroundFloor() != 0) {
for (int i = 1; i <= ledgerBuilding.getUndergroundFloor(); i++) {
LedgerFloor ledgerFloor = new LedgerFloor();
ledgerFloor.setBuildingId(ledgerBuilding.getId());
ledgerFloor.setName(-i+"层");
ledgerFloor.setName(-i + "层");
ledgerFloor.setType("地下");
ledgerFloorService.insertLedgerFloor(ledgerFloor);
}
......@@ -793,7 +793,8 @@ public class RiskPlanAppController extends BaseController {
}
/**
* 根据人机料法环获取
* 根据人机料法环获取
*
* @param factorNames 影响因素
* @return
*/
......@@ -806,27 +807,27 @@ public class RiskPlanAppController extends BaseController {
* 3.获取影响因子选项
*/
List<FactorListDto> list_rs=new ArrayList<>();
List<FactorItemListDto> list_items=new ArrayList<>();
List<FactorListDto> list_rs = new ArrayList<>();
List<FactorItemListDto> list_items = new ArrayList<>();
FactorListDto factorListDto = new FactorListDto();
FactorItemListDto factorItemListDto=new FactorItemListDto();
if(factorNames != null && !factorNames.trim().equals("")){
FactorItemListDto factorItemListDto = new FactorItemListDto();
if (factorNames != null && !factorNames.trim().equals("")) {
List<String> list_factors=Arrays.asList(factorNames.split(","));
List<String> list_factors = Arrays.asList(factorNames.split(","));
for (int i = 0; i < list_factors.size(); i++) {
factorListDto=new FactorListDto();
list_items=new ArrayList<>();
String factorName=list_factors.get(i);
QueryWrapper<EvaluationModelInfo> queryModel=new QueryWrapper<>();
queryModel.lambda().eq(EvaluationModelInfo ::getInfluenceFactor,factorName);
List<EvaluationModelInfo> list_models=evaluationModelInfoService.list(queryModel);
if (list_models.size()>0) {
factorListDto = new FactorListDto();
list_items = new ArrayList<>();
String factorName = list_factors.get(i);
QueryWrapper<EvaluationModelInfo> queryModel = new QueryWrapper<>();
queryModel.lambda().eq(EvaluationModelInfo::getInfluenceFactor, factorName);
List<EvaluationModelInfo> list_models = evaluationModelInfoService.list(queryModel);
if (list_models.size() > 0) {
for (EvaluationModelInfo modelInfo : list_models) {
factorItemListDto=new FactorItemListDto();
factorItemListDto = new FactorItemListDto();
QueryWrapper<EvaluationFactorItems> queryItem = new QueryWrapper<>();
queryItem.lambda().eq(EvaluationFactorItems ::getFactorId,modelInfo.getId() );
List<EvaluationFactorItems> itemsList=evaluationFactorItemsService.list(queryItem);
queryItem.lambda().eq(EvaluationFactorItems::getFactorId, modelInfo.getId());
List<EvaluationFactorItems> itemsList = evaluationFactorItemsService.list(queryItem);
factorItemListDto.setFactorSubName(modelInfo.getInfluenceSubFactor());
factorItemListDto.setRemark(modelInfo.getRemark());
factorItemListDto.setFactorItemsList(itemsList);
......@@ -853,8 +854,7 @@ public class RiskPlanAppController extends BaseController {
*/
@Log(title = "app端新建楼层数据", businessType = BusinessType.INSERT)
@PostMapping("/floor")
public AjaxResult addFloor(@RequestBody LedgerFloor ledgerFloor)
{
public AjaxResult addFloor(@RequestBody LedgerFloor ledgerFloor) {
ledgerFloor.setCreateBy(getUsername());
ledgerFloorService.insertLedgerFloor(ledgerFloor);
return AjaxResult.success(ledgerFloor.getId());
......@@ -866,30 +866,34 @@ public class RiskPlanAppController extends BaseController {
@Log(title = "app端复制楼层下全部数据", businessType = BusinessType.INSERT)
@PostMapping("/copy/floor/{planId}/{sourceFloorId}/{targetFloorId}")
public AjaxResult copyFloor(@PathVariable Long planId
,@PathVariable Long sourceFloorId,@PathVariable Long targetFloorId)
{
, @PathVariable Long sourceFloorId, @PathVariable Long targetFloorId) {
return AjaxResult.success(ledgerFloorService.copyFloor(sourceFloorId,targetFloorId,planId,getLoginUser()));
return AjaxResult.success(ledgerFloorService.copyFloor(sourceFloorId, targetFloorId, planId, getLoginUser()));
}
/**
* 根据分数获取风险等级,并计算楼栋风险值
*
* @param buildingId
* @param score
* @return
*/
@GetMapping("/existing/matrix/score")
public R<Map<String, String>> getRiskLevelByScore(Long buildingId, BigDecimal score) {
return R.ok(riskPlanExistingListService.getRiskLevelByScore(buildingId,score));
// List<LedgerBuilding> list = ledgerBuildingService.list();
// for (LedgerBuilding item : list) {
// riskPlanExistingListService.getRiskLevelByScore(item.getId(), new BigDecimal("4.5"));
//
// }
return R.ok(riskPlanExistingListService.getRiskLevelByScore(buildingId, score));
}
/**
* 获取固有风险模版列表
*/
@GetMapping("/inherent/template/list")
public TableDataInfo list(RiskInherentList riskInherentList)
{
public TableDataInfo list(RiskInherentList riskInherentList) {
startPage();
return getDataTable(riskInherentListService.selectRiskInherentListList(riskInherentList));
}
......@@ -900,9 +904,8 @@ public class RiskPlanAppController extends BaseController {
*/
@Log(title = "app端复制房间", businessType = BusinessType.INSERT)
@PostMapping("/copy/room/{planId}")
public AjaxResult copyRoom(@RequestBody LedgerRoom ledgerRoom,@PathVariable Long planId)
{
return AjaxResult.success(ledgerRoomService.copyRoom(ledgerRoom,getLoginUser(),planId));
public AjaxResult copyRoom(@RequestBody LedgerRoom ledgerRoom, @PathVariable Long planId) {
return AjaxResult.success(ledgerRoomService.copyRoom(ledgerRoom, getLoginUser(), planId));
}
......@@ -912,17 +915,16 @@ public class RiskPlanAppController extends BaseController {
@Log(title = "提交签到签退记录", businessType = BusinessType.INSERT)
@PostMapping("/sign")
public AjaxResult saveSign(RiskSignRecord riskSignRecord
, @RequestParam(value = "file[]", required = false) MultipartFile[] file)
{
, @RequestParam(value = "file[]", required = false) MultipartFile[] file) {
//判断当前人、当前项目今天是否加班
if(!riskSignRecordService.checkByUserIdAndProjectIdDate(riskSignRecord.getUserId(),riskSignRecord.getProjectId()
,riskSignRecord.getType(),new Date())){
return AjaxResult.error("当前项目今天您已提交"+(riskSignRecord.getType()?"签到":"签退")+"记录!");
if (!riskSignRecordService.checkByUserIdAndProjectIdDate(riskSignRecord.getUserId(), riskSignRecord.getProjectId()
, riskSignRecord.getType(), new Date())) {
return AjaxResult.error("当前项目今天您已提交" + (riskSignRecord.getType() ? "签到" : "签退") + "记录!");
}
riskSignRecord.setCreateBy(getLoginUser().getUsername());
riskSignRecord.setCreateTime(new Date());
if (file != null) {
String userId = getUserId()+"";
String userId = getUserId() + "";
String pictureFileIds = Arrays.stream(file)
.filter(multipartFile -> !multipartFile.isEmpty())
.map(multipartFile -> uploadFileService.upload(multipartFile, RuoYiConfig.getUploadPath(), userId, serverAddress).toString())
......@@ -937,8 +939,7 @@ public class RiskPlanAppController extends BaseController {
* 获取固有风险模版列表
*/
@GetMapping("/sign/list")
public TableDataInfo getSignList(RiskSignRecord riskSignRecord)
{
public TableDataInfo getSignList(RiskSignRecord riskSignRecord) {
startPage();
riskSignRecord.setUserId(getUserId());
List<RiskSignRecord> signList = riskSignRecordService.getSignList(riskSignRecord);
......
......@@ -93,6 +93,8 @@ public class LedgerBuilding extends BaseEntityClean
* 楼栋风险指数
*/
private BigDecimal riskIndex;
private String riskLevel;
private String riskColor;
......
......@@ -5,6 +5,8 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntityClean;
import lombok.Data;
import java.math.BigDecimal;
/**
* 基础数据-项目对象 ledger_project
*
......@@ -92,7 +94,12 @@ public class LedgerProject extends BaseEntityClean
@TableField(exist = false)
private String num;
/**
* 楼栋风险指数
*/
private BigDecimal riskIndex;
private String riskLevel;
private String riskColor;
}
......@@ -17,6 +17,8 @@ import java.math.BigDecimal;
@Data
public class RiskExistingListSaveDto {
@TableField(exist = false)
private Long buildingId;
/**
* id
*/
......@@ -61,6 +63,7 @@ public class RiskExistingListSaveDto {
* 风险等级
*/
private String level;
private String riskColor;
/**
* 风险等级
......
......@@ -3,25 +3,23 @@ package com.censoft.censoftrongtong.domain.dto.statistics;
import jdk.nashorn.internal.ir.annotations.Ignore;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Random;
@Data
public class MapLedgerProjectDto {
private static final long serialVersionUID = 1L;
@Ignore
String[] color = new String[]{"red", "green", "yellow", "blue"};
private Long projectId;
private String projectName;
private BigDecimal riskIndex;
private String lat;
private String lng;
private String riskColor;
public String getRiskColor() {
Random r = new Random();
return color[r.nextInt(4)];
}
private String riskLevel;
private String province;
private String city;
private String district;
/**
* 风险总数量
*/
......
......@@ -25,19 +25,16 @@ public class MapStatisticsQueryDto {
if (this.level == null)
return levelName;
switch (this.level) {
case 1:
case 0:
levelName = "province";
break;
case 2:
if (this.getAreaName().contains("北京") || this.getAreaName().contains("重庆") || this.getAreaName().contains("上海") || this.getAreaName().contains("天津"))
levelName = "district";
else
levelName = "city";
case 1:
levelName = "city";
break;
case 3:
case 2:
levelName = "district";
break;
case 4:
case 3:
levelName = "street";
break;
......@@ -50,16 +47,16 @@ public class MapStatisticsQueryDto {
if (this.level == null)
return levelName;
switch (this.level) {
case 2:
case 1:
if (this.getAreaName().contains("北京") || this.getAreaName().contains("重庆") || this.getAreaName().contains("上海") || this.getAreaName().contains("天津"))
levelName = "city";
else
levelName = "province";
break;
case 3:
case 2:
levelName = "city";
break;
case 4:
case 3:
levelName = "district";
break;
}
......
......@@ -9,8 +9,6 @@ import java.util.Random;
@Data
public class RiskMapStatisticsDto {
@Ignore
String[] color = new String[]{"red", "green", "yellow", "blue"};
/**
* 地区名称
*/
......@@ -26,10 +24,5 @@ public class RiskMapStatisticsDto {
*/
private String areaColor;
public String getAreaColor() {
Random r = new Random();
return color[r.nextInt(4)];
}
private List<MapLedgerProjectDto> projectList;
}
package com.censoft.censoftrongtong.mapper;
import com.censoft.censoftrongtong.domain.LedgerProject;
import com.censoft.censoftrongtong.domain.dto.statistics.MapLedgerProjectDto;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
......@@ -30,10 +31,13 @@ public interface LedgerProjectMapper extends MPJBaseMapper<LedgerProject>
* @return 基础数据-项目集合
*/
public List<LedgerProject> selectLedgerProjectList(LedgerProject ledgerProject);
public List<LedgerProject> getLedgerProjectList(@Param("name")String name,@Param("areaName") String areaName);
public Long getProjectCount(@Param("areaName") String areaName);
public Long getBuildingCount(@Param("areaName") String areaName,@Param("projectId") Long projectId);
public Long getFloorCount(@Param("areaName") String areaName,@Param("projectId") Long projectId);
public List<LedgerProject> getLedgerProjectList(@Param("name")String name,@Param("level") Integer level,@Param("areaName") String areaName);
public List<MapLedgerProjectDto> getProjectListAndCount( @Param("level") Integer level, @Param("areaName") String areaName);
public Long getProjectCount(@Param("level") Integer level,@Param("areaName") String areaName);
public Long getBuildingCount(@Param("level") Integer level,@Param("areaName") String areaName,@Param("projectId") Long projectId);
public Long getFloorCount(@Param("level") Integer level,@Param("areaName") String areaName,@Param("projectId") Long projectId);
/**
......
......@@ -24,7 +24,7 @@ public interface RiskPlanExistingListMapper extends MPJBaseMapper<RiskPlanExisti
* @param beginTime
* @return
*/
public Long getNationalRiskNum(@Param("areaName") String areaName, @Param("beginTime") Date beginTime,@Param("projectId")Long projectId);
public Long getNationalRiskNum(@Param("level")Integer level,@Param("areaName") String areaName, @Param("beginTime") Date beginTime,@Param("projectId")Long projectId);
/**
* 总体风险指数排名
......@@ -32,7 +32,7 @@ public interface RiskPlanExistingListMapper extends MPJBaseMapper<RiskPlanExisti
* @param areaName
* @return
*/
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName);
public List<RiskIndexRankingDto> getRiskIndexRanking(@Param("level")Integer level,@Param("areaName")String areaName);
/**
* 年度风险数量统计
......@@ -40,13 +40,13 @@ public interface RiskPlanExistingListMapper extends MPJBaseMapper<RiskPlanExisti
* @param areaName
* @return
*/
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName);
public LinkedHashMap<String, Long> getAnnualRiskStatistics(@Param("level")Integer level,@Param("areaName")String areaName);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(@Param("areaName") String areaName,@Param("projectId")Long projectId);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(@Param("level")Integer level,@Param("areaName") String areaName,@Param("projectId")Long projectId);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(@Param("level")Integer level,@Param("areaName")String areaName);
public List<RiskProjectRankingDto> getRiskProjectRanking(@Param("areaName") String areaName, @Param("level") String level);
public List<RiskProjectRankingDto> getRiskProjectRanking(@Param("level")Integer level,@Param("areaName") String areaName);
public List<RiskMapStatisticsDto> getRiskMapStatistics(MapStatisticsQueryDto queryDto);
......
......@@ -24,7 +24,7 @@ public interface RiskPlanInherentListMapper extends MPJBaseMapper<RiskPlanInhere
* @param beginTime
* @return
*/
public Long getNationalRiskNum(@Param("areaName") String areaName, @Param("beginTime") Date beginTime, @Param("projectId") Long projectId);
public Long getNationalRiskNum(@Param("level") Integer level,@Param("areaName") String areaName, @Param("beginTime") Date beginTime, @Param("projectId") Long projectId);
/**
......@@ -33,7 +33,7 @@ public interface RiskPlanInherentListMapper extends MPJBaseMapper<RiskPlanInhere
* @param areaName
* @return
*/
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName);
public List<RiskIndexRankingDto> getRiskIndexRanking(@Param("level") Integer level,@Param("areaName") String areaName);
/**
* 年度风险数量统计
......@@ -41,13 +41,13 @@ public interface RiskPlanInherentListMapper extends MPJBaseMapper<RiskPlanInhere
* @param areaName
* @return
*/
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName);
public LinkedHashMap<String, Long> getAnnualRiskStatistics(@Param("level") Integer level,@Param("areaName") String areaName);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(@Param("areaName") String areaName, @Param("projectId") Long projectId);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(@Param("level") Integer level,@Param("areaName") String areaName, @Param("projectId") Long projectId);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics( @Param("level") Integer level,@Param("areaName") String areaName);
public List<RiskProjectRankingDto> getRiskProjectRanking(@Param("areaName") String areaName, @Param("level") String level);
public List<RiskProjectRankingDto> getRiskProjectRanking( @Param("level") Integer level,@Param("areaName") String areaName);
public List<ProjectRiskInfoDto> getProjectRiskInfo(@Param("projectId") Long projectId, @Param("buildingId") Long buildingId, @Param("floorId") Long floorId,@Param("level")String level);
......
package com.censoft.censoftrongtong.service;
import com.censoft.censoftrongtong.domain.LedgerProject;
import com.censoft.censoftrongtong.domain.dto.statistics.MapLedgerProjectDto;
import com.github.yulichang.base.MPJBaseService;
import com.ruoyi.common.core.domain.entity.SysUser;
......@@ -29,11 +30,12 @@ public interface ILedgerProjectService extends MPJBaseService<LedgerProject>
* @return 基础数据-项目集合
*/
public List<LedgerProject> selectLedgerProjectList(LedgerProject ledgerProject);
public List<LedgerProject> getLedgerProjectList(String name,String areaName);
public List<LedgerProject> getLedgerProjectList(String name,Integer level,String areaName);
public List<MapLedgerProjectDto> getProjectListAndCount( Integer level, String areaName);
public Long getProjectCount(String areaName);
public Long getBuildingCount(String areaName,Long projectId);
public Long getFloorCount(String areaName,Long projectId);
public Long getProjectCount(Integer level,String areaName);
public Long getBuildingCount(Integer level,String areaName,Long projectId);
public Long getFloorCount(Integer level,String areaName,Long projectId);
/**
* 新增基础数据-项目
......
......@@ -26,7 +26,7 @@ public interface IRiskPlanExistingListService extends MPJBaseService<RiskPlanExi
* @param beginTime
* @return
*/
public Long getNationalRiskNum(String areaName, Date beginTime,Long peojectId);
public Long getNationalRiskNum(Integer level,String areaName, Date beginTime,Long peojectId);
/**
* 总体风险指数排名
......@@ -34,14 +34,14 @@ public interface IRiskPlanExistingListService extends MPJBaseService<RiskPlanExi
* @param areaName
* @return
*/
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName);
public List<RiskIndexRankingDto> getRiskIndexRanking(Integer level,String areaName);
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName);
public LinkedHashMap<String, Long> getAnnualRiskStatistics(Integer level,String areaName);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(String areaName,Long projectId);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(Integer level,String areaName,Long projectId);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName);
public List<RiskProjectRankingDto> getRiskProjectRanking(String areaName,String level);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(Integer level,String areaName);
public List<RiskProjectRankingDto> getRiskProjectRanking(Integer level,String areaName);
public List<RiskMapStatisticsDto> getRiskMapStatistics(MapStatisticsQueryDto queryDto);
......@@ -110,6 +110,7 @@ public interface IRiskPlanExistingListService extends MPJBaseService<RiskPlanExi
* @return
*/
Map<String, String> getRiskLevelByScore(Long buildingId, BigDecimal score);
Map<String, String> getRiskLevelByScoreAndUpd(Long buildingId, BigDecimal score);
/**
......
......@@ -27,7 +27,7 @@ public interface IRiskPlanInherentListService extends MPJBaseService<RiskPlanInh
* @param beginTime
* @return
*/
public Long getNationalRiskNum(String areaName, Date beginTime, Long peojectId);
public Long getNationalRiskNum(Integer level,String areaName, Date beginTime, Long peojectId);
/**
* 总体风险指数排名
......@@ -35,14 +35,14 @@ public interface IRiskPlanInherentListService extends MPJBaseService<RiskPlanInh
* @param areaName
* @return
*/
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName);
public List<RiskIndexRankingDto> getRiskIndexRanking(Integer level,String areaName);
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName);
public LinkedHashMap<String, Long> getAnnualRiskStatistics(Integer level,String areaName);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(String areaName,Long projectId);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(Integer level,String areaName,Long projectId);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName);
public List<RiskProjectRankingDto> getRiskProjectRanking(String areaName, String level);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(Integer level,String areaName);
public List<RiskProjectRankingDto> getRiskProjectRanking(Integer level,String areaName);
public List<ProjectRiskInfoDto> getProjectRiskInfo(Long projectId, Long buildingId, Long floorId,String level);
......
package com.censoft.censoftrongtong.service.impl;
import com.censoft.censoftrongtong.domain.LedgerProject;
import com.censoft.censoftrongtong.domain.dto.statistics.MapLedgerProjectDto;
import com.censoft.censoftrongtong.mapper.LedgerProjectMapper;
import com.censoft.censoftrongtong.service.ILedgerProjectService;
import com.github.yulichang.base.MPJBaseServiceImpl;
......@@ -58,25 +59,31 @@ public class LedgerProjectServiceImpl extends MPJBaseServiceImpl<LedgerProjectMa
* @return 基础数据-项目
*/
@Override
public List<LedgerProject> getLedgerProjectList(String name,String areaName)
public List<LedgerProject> getLedgerProjectList(String name, Integer level, String areaName)
{
return ledgerProjectMapper.getLedgerProjectList(name,areaName);
return ledgerProjectMapper.getLedgerProjectList(name,level,areaName);
}
@Override
public Long getBuildingCount(String areaName,Long projectId)
public List<MapLedgerProjectDto> getProjectListAndCount( Integer level, String areaName)
{
return ledgerProjectMapper.getBuildingCount(areaName,projectId);
return ledgerProjectMapper.getProjectListAndCount(level,areaName);
}
@Override
public Long getBuildingCount(Integer level,String areaName,Long projectId)
{
return ledgerProjectMapper.getBuildingCount(level,areaName,projectId);
}
@Override
public Long getProjectCount(String areaName)
public Long getProjectCount(Integer level,String areaName)
{
return ledgerProjectMapper.getProjectCount(areaName);
return ledgerProjectMapper.getProjectCount(level,areaName);
}
@Override
public Long getFloorCount(String areaName,Long projectId)
public Long getFloorCount(Integer level,String areaName,Long projectId)
{
return ledgerProjectMapper.getFloorCount(areaName,projectId);
return ledgerProjectMapper.getFloorCount(level,areaName,projectId);
}
/**
......
......@@ -2,15 +2,14 @@ package com.censoft.censoftrongtong.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.censoft.censoftrongtong.domain.LedgerBuilding;
import com.censoft.censoftrongtong.domain.RiskAssessmentMatrixLevel;
import com.censoft.censoftrongtong.domain.RiskPlanExistingList;
import com.censoft.censoftrongtong.domain.*;
import com.censoft.censoftrongtong.domain.dto.RiskExistingListSaveDto;
import com.censoft.censoftrongtong.domain.dto.RiskInherentListExportDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDetailsDto;
import com.censoft.censoftrongtong.domain.dto.statistics.*;
import com.censoft.censoftrongtong.mapper.RiskPlanExistingListMapper;
import com.censoft.censoftrongtong.service.ILedgerBuildingService;
import com.censoft.censoftrongtong.service.ILedgerProjectService;
import com.censoft.censoftrongtong.service.IRiskPlanExistingListService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.ruoyi.common.utils.DateUtils;
......@@ -27,6 +26,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
......@@ -45,6 +45,8 @@ public class RiskPlanExistingListServiceImpl
@Autowired
private ILedgerBuildingService ledgerBuildingService;
@Autowired
private ILedgerProjectService projectService;
@Autowired
private IRiskLevelProportionService riskLevelProportionService;
@Autowired
private IRiskNumIndexService riskNumIndexService;
......@@ -53,36 +55,36 @@ public class RiskPlanExistingListServiceImpl
@Override
public Long getNationalRiskNum(String areaName, Date beginTime, Long peojectId) {
public Long getNationalRiskNum(Integer level, String areaName, Date beginTime, Long peojectId) {
return riskPlanExistingListMapper.getNationalRiskNum(areaName, beginTime, peojectId);
return riskPlanExistingListMapper.getNationalRiskNum(level, areaName, beginTime, peojectId);
}
@Override
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName) {
public List<RiskIndexRankingDto> getRiskIndexRanking(Integer level, String areaName) {
return riskPlanExistingListMapper.getRiskIndexRanking(areaName);
return riskPlanExistingListMapper.getRiskIndexRanking(level, areaName);
}
@Override
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName) {
public LinkedHashMap<String, Long> getAnnualRiskStatistics(Integer level, String areaName) {
return riskPlanExistingListMapper.getAnnualRiskStatistics(areaName);
return riskPlanExistingListMapper.getAnnualRiskStatistics(level, areaName);
}
@Override
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(String areaName, Long projectId) {
return riskPlanExistingListMapper.getRiskLevelStatistics(areaName, projectId);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(Integer level, String areaName, Long projectId) {
return riskPlanExistingListMapper.getRiskLevelStatistics(level, areaName, projectId);
}
@Override
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName) {
return riskPlanExistingListMapper.getAccidentTypeStatistics(areaName);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(Integer level, String areaName) {
return riskPlanExistingListMapper.getAccidentTypeStatistics(level, areaName);
}
@Override
public List<RiskProjectRankingDto> getRiskProjectRanking(String areaName, String level) {
return riskPlanExistingListMapper.getRiskProjectRanking(areaName, level);
public List<RiskProjectRankingDto> getRiskProjectRanking(Integer level, String areaName) {
return riskPlanExistingListMapper.getRiskProjectRanking(level, areaName);
}
@Override
......@@ -225,23 +227,84 @@ public class RiskPlanExistingListServiceImpl
public Map<String, String> getRiskLevelByScore(Long buildingId, BigDecimal score) {
Map<String, String> result = new HashMap<>();
//查询当前楼栋现状风险列表
List<RiskPlanExistingList> existingList = this.list(Wrappers.<RiskPlanExistingList>query().lambda().eq(RiskPlanExistingList::getBuildingId, buildingId.toString()).orderByDesc(RiskPlanExistingList::getLevelScore));
RiskPlanExistingList query = new RiskPlanExistingList();
query.setBuildingId(buildingId.toString());
List<RiskPlanExistingList> existingList = this.selectRiskPlanExistingListList(query);
if (existingList == null) {
existingList = new ArrayList<>();
RiskPlanExistingList riskPlan = new RiskPlanExistingList();
riskPlan.setLevelScore(score);
riskPlan.setId(null);
existingList.add(riskPlan);
}
RiskPlanExistingList riskPlan = new RiskPlanExistingList();
riskPlan.setLevelScore(score);
riskPlan.setId(null);
riskPlan.setBuildingId(buildingId.toString());
existingList.add(riskPlan);
existingList = existingList.stream().sorted(Comparator.comparing(RiskPlanExistingList::getLevelScore).reversed()).collect(Collectors.toList());
//查询风险等级占比
List<RiskLevelProportion> levelProportions = riskLevelProportionService.list();
if (existingList.size() <= 0)
return result;
for (RiskLevelProportion item : levelProportions) {
BigDecimal s = new BigDecimal(existingList.size());
long min = s.multiply(item.getLevelScaleMin()).setScale(0, RoundingMode.UP).longValue();
long max = s.multiply(item.getLevelScaleMax()).setScale(0, RoundingMode.UP).longValue();
if (min == max && max == 1)
continue;
//风险列表排序后按照顺序设置风险等级
List<RiskPlanExistingList> riskList = existingList.stream().skip(min).limit((max - min)).collect(Collectors.toList());
for (RiskPlanExistingList risk : riskList) {
if (risk.getId() == null) {
result.put("level", item.getRiskName());
result.put("levelScore", score.toString());
result.put("riskColor", item.getRiskColor());
}
}
}
return result;
}
/**
* 计算房间风险等级
* 计算规则 :
* 当前楼的所有现状风险
* 0%-4% 重大
* 4%-20% 较大
* 20%-50% 一般
* 50%-100% 低
*
* @param score
* @return
*/
@Override
public Map<String, String> getRiskLevelByScoreAndUpd(Long buildingId, BigDecimal score) {
Map<String, String> result = new HashMap<>();
//查询当前楼栋现状风险列表
RiskPlanExistingList query = new RiskPlanExistingList();
query.setBuildingId(buildingId.toString());
List<RiskPlanExistingList> existingList = this.selectRiskPlanExistingListList(query);
if (existingList == null) {
existingList = new ArrayList<>();
}
RiskPlanExistingList riskPlan = new RiskPlanExistingList();
riskPlan.setLevelScore(score);
riskPlan.setId(null);
riskPlan.setBuildingId(buildingId.toString());
existingList.add(riskPlan);
existingList = existingList.stream().sorted(Comparator.comparing(RiskPlanExistingList::getLevelScore).reversed()).collect(Collectors.toList());
//查询风险等级占比
List<RiskLevelProportion> levelProportions = riskLevelProportionService.list();
if (existingList.size() <= 0)
return result;
BigDecimal riskIndex = BigDecimal.ZERO;
Map<String, List<RiskPlanExistingList>> map = new HashMap<>();
for (RiskLevelProportion item : levelProportions) {
BigDecimal s = new BigDecimal(existingList.size());
long min = s.multiply(item.getLevelScaleMin()).longValue();
long max = s.multiply(item.getLevelScaleMax()).longValue();
long min = s.multiply(item.getLevelScaleMin()).setScale(0, RoundingMode.UP).longValue();
long max = s.multiply(item.getLevelScaleMax()).setScale(0, RoundingMode.UP).longValue();
if (min == max && max == 1)
continue;
//风险列表排序后按照顺序设置风险等级
List<RiskPlanExistingList> riskList = existingList.stream().skip(min).limit((max - min)).collect(Collectors.toList());
for (RiskPlanExistingList risk : riskList) {
......@@ -257,26 +320,48 @@ public class RiskPlanExistingListServiceImpl
}
}
//计算每个类型的平均值及对应的风险指数
BigDecimal riskAvg = riskList.stream().map(f -> f == null ? BigDecimal.ZERO : f.getLevelScore()).reduce(BigDecimal.ZERO, BigDecimal::add)
BigDecimal riskAvg = riskList.stream().map(f -> f.getLevelScore() == null ? BigDecimal.ZERO : f.getLevelScore()).reduce(BigDecimal.ZERO, BigDecimal::add)
.divide(BigDecimal.valueOf(riskList.size()), 2, BigDecimal.ROUND_HALF_UP);
//计算各等级风险指数
BigDecimal thisRiskIndex = riskAvg.multiply(item.getLevelScaleMax()).multiply(item.getRiskGradeIndex());
//求和计算总体风险指数
riskIndex = riskIndex.add(thisRiskIndex);
}
LedgerBuilding building = ledgerBuildingService.getById(buildingId);
//查询风险数量系数inherentList
List<RiskNumIndex> riskNumIndexList = riskNumIndexService.list();
for (RiskNumIndex numIndex : riskNumIndexList) {
if (existingList.size() >= numIndex.getRiskNumIndexMin() && existingList.size() < numIndex.getRiskNumIndexMax()) {
BigDecimal buildingIndex = numIndex.getRiskVal().multiply(riskIndex);
LedgerBuilding building = ledgerBuildingService.getById(buildingId);
building.setRiskIndex(buildingIndex);
for (RiskLevelProportion item : levelProportions) {
if (buildingIndex.compareTo(item.getLevelValMin()) > -1 && buildingIndex.compareTo(item.getLevelValMax()) == -1) {
building.setRiskColor(item.getRiskColor());
building.setRiskLevel(item.getRiskName());
}
}
ledgerBuildingService.updateById(building);
}
}
//计算楼栋的平均风险指数(=项目风险指数)
List<LedgerBuilding> buildingList = ledgerBuildingService.list(Wrappers.<LedgerBuilding>query().lambda().eq(LedgerBuilding::getProjectId, building.getProjectId()));
BigDecimal projectRiskIndex = buildingList.stream().map(f -> f.getRiskIndex() == null ? BigDecimal.ZERO : f.getRiskIndex()).reduce(BigDecimal.ZERO, BigDecimal::add)
.divide(BigDecimal.valueOf(buildingList.size()), 2, BigDecimal.ROUND_HALF_UP);
//计算当前项目的风险指数及等级
LedgerProject project = projectService.getById(building.getProjectId());
project.setRiskIndex(projectRiskIndex);
for (RiskLevelProportion item : levelProportions) {
if (projectRiskIndex.compareTo(item.getLevelValMin()) > -1 && projectRiskIndex.compareTo(item.getLevelValMax()) == -1) {
project.setRiskColor(item.getRiskColor());
project.setRiskLevel(item.getRiskName());
}
}
projectService.updateById(project);
return result;
}
@Override
public List<RiskInherentListExportDto> getPlanExistingList(RiskInherentListExportDto riskInherentListExportDto) {
return riskPlanExistingListMapper.getPlanExistingList(riskInherentListExportDto);
......
......@@ -60,35 +60,35 @@ public class RiskPlanInherentListServiceImpl
@Override
public Long getNationalRiskNum(String areaName, Date beginTime,Long peojectId) {
public Long getNationalRiskNum(Integer level,String areaName, Date beginTime,Long peojectId) {
return riskPlanInherentListMapper.getNationalRiskNum(areaName, beginTime,peojectId);
return riskPlanInherentListMapper.getNationalRiskNum(level,areaName, beginTime,peojectId);
}
@Override
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName) {
public List<RiskIndexRankingDto> getRiskIndexRanking(Integer level,String areaName) {
return riskPlanInherentListMapper.getRiskIndexRanking(areaName);
return riskPlanInherentListMapper.getRiskIndexRanking(level,areaName);
}
@Override
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName) {
public LinkedHashMap<String, Long> getAnnualRiskStatistics(Integer level,String areaName) {
return riskPlanInherentListMapper.getAnnualRiskStatistics(areaName);
return riskPlanInherentListMapper.getAnnualRiskStatistics(level,areaName);
}
@Override
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(String areaName,Long projectId) {
return riskPlanInherentListMapper.getRiskLevelStatistics(areaName,projectId);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(Integer level,String areaName,Long projectId) {
return riskPlanInherentListMapper.getRiskLevelStatistics(level,areaName,projectId);
}
@Override
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName) {
return riskPlanInherentListMapper.getAccidentTypeStatistics(areaName);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(Integer level,String areaName) {
return riskPlanInherentListMapper.getAccidentTypeStatistics(level,areaName);
}
@Override
public List<RiskProjectRankingDto> getRiskProjectRanking(String areaName, String level) {
return riskPlanInherentListMapper.getRiskProjectRanking(areaName,level);
public List<RiskProjectRankingDto> getRiskProjectRanking(Integer level,String areaName) {
return riskPlanInherentListMapper.getRiskProjectRanking(level,areaName);
}
@Override
public List<ProjectRiskInfoDto> getProjectRiskInfo( Long projectId, Long buildingId, Long floorId,String level) {
......
......@@ -35,6 +35,14 @@ public class RiskLevelProportion extends BaseEntity
@Excel(name = "风险等级占比", readConverterExp = "大=")
private BigDecimal levelScaleMax;
/** 风险等级取值范围(小) */
@Excel(name = "风险等级取值范围", readConverterExp = "小=")
private BigDecimal levelValMin;
/** 风险等级取值范围(大) */
@Excel(name = "风险等级取值范围", readConverterExp = "大=")
private BigDecimal levelValMax;
/** 风险等级系数 */
@Excel(name = "风险等级系数")
private BigDecimal riskGradeIndex;
......
......@@ -61,11 +61,9 @@
<where>
AND del_flag = '0' and status =0
<if test="areaName != null and areaName != ''">
and (
province = #{areaName}
or city = #{areaName}
or district = #{areaName}
)
<if test="level != null and level == 1 ">and province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and district like concat('%', #{areaName}, '%')</if>
</if>
</where>
</select>
......@@ -76,11 +74,9 @@
<where>
AND b.del_flag = '0' and b.status =0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
<if test="projectId != null">
and p.id=#{projectId}
......@@ -95,11 +91,9 @@
<where>
AND f.del_flag = '0' and f.status =0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
<if test="projectId != null">
and p.id=#{projectId}
......@@ -142,14 +136,46 @@
)
</if>
<if test="areaName != null and areaName != ''">
and (
p.province like concat('%', #{areaName}, '%')
or p.city like concat('%', #{areaName}, '%')
or p.district like concat('%', #{areaName}, '%')
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
AND p.del_flag = '0'
</where>
</select>
<select id="getProjectListAndCount" resultType="com.censoft.censoftrongtong.domain.dto.statistics.MapLedgerProjectDto">
SELECT
p.id projectId,
p.NAME projectName,
p.lat,
p.lng,
p.province,
p.city,
p.district,
p.risk_index riskIndex,
p.risk_level riskLevel,
p.risk_color riskColor,
count( rpil.id ) existingNum,
count( rpel.id ) inherentNum,
count( rpil.id )+ count( rpel.id ) riskSumNum
FROM
ledger_project p
LEFT JOIN ledger_building lb ON p.id = lb.project_id
LEFT JOIN ledger_floor lf ON lb.id = lf.building_id
LEFT JOIN ledger_room lr ON lf.id = lr.floor_id
LEFT JOIN risk_plan_existing_list rpel ON lr.id = rpel.room_id
LEFT JOIN risk_plan_inherent_list rpil ON lr.id = rpil.room_id
<where>
<if test="areaName != null and areaName != ''">
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
AND p.del_flag = '0'
</where>
GROUP BY p.id
</select>
......
......@@ -14,6 +14,7 @@
<result property="factor" column="factor"/>
<result property="type" column="type"/>
<result property="level" column="level"/>
<result property="levelScore" column="level_score"/>
<result property="presenceLocation" column="presence_location"/>
<result property="pictureFileIds" column="picture_file_ids"/>
<result property="measuresProject" column="measures_project"/>
......@@ -91,11 +92,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
</where>
</select>
......@@ -110,11 +109,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
</where>
group by p.id,p.name ORDER BY RiskScore desc
......@@ -134,11 +131,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
</where>
GROUP BY dict_label
......@@ -156,11 +151,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
<if test="projectId != null">
and p.id=#{projectId}
......@@ -179,11 +172,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
</where>
group by p.id,p.name ORDER BY RiskNum desc
......@@ -198,11 +189,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
<if test="beginTime != null">
and (
......@@ -245,19 +234,12 @@
resultType="com.censoft.censoftrongtong.domain.dto.statistics.RiskMapStatisticsDto">
SELECT p.${levelName} areaName,
COUNT(1) riskNum
FROM risk_plan_existing_list rpil
INNER JOIN ledger_room lr ON lr.id = rpil.room_id
INNER JOIN ledger_floor lf ON lf.id = floor_id
INNER JOIN ledger_building lb ON lb.id = lf.building_id
INNER JOIN ledger_project p ON p.id = lb.project_id
FROM ledger_project p
LEFT JOIN ledger_building lb ON p.id = lb.project_id AND lb.del_flag = '0' AND lb.`status` = '0'
LEFT JOIN ledger_floor lf ON lb.id = lf.building_id AND lf.del_flag = '0' AND lf.`status` = '0'
LEFT JOIN ledger_room lr ON lf.id = lr.floor_id AND lr.del_flag = '0' AND lr.`status` = '0'
LEFT JOIN risk_plan_existing_list rpel ON lr.id = rpel.room_id AND rpel.del_flag = '0'
<where>
AND rpil.del_flag = '0'
AND lr.del_flag = '0'
AND lr.`status` = '0'
AND lf.del_flag = '0'
AND lf.`status` = '0'
AND lb.del_flag = '0'
AND lb.`status` = '0'
<if test="areaName != null and areaName != '' and level != 1">
AND p.${parentLevel} like concat('%', #{areaName}, '%')
</if>
......@@ -286,6 +268,7 @@
rpil.factor,
rpil.type,
rpil.LEVEL,
rpil.level_score,
rpil.presence_location,
rpil.picture_file_ids,
rpil.measures_project,
......@@ -317,6 +300,7 @@
<where>
<if test="userId != null ">and rpil.user_id = #{userId}</if>
<if test="roomId != null ">and rpil.room_id = #{roomId}</if>
<if test="buildingId != null and buildingId != ''">and lb.id = #{buildingId}</if>
<if test="inherentId != null ">and rpil.inherent_id = #{inherentId}</if>
<if test="planId != null ">and rpil.plan_id = #{planId}</if>
<if test="name != null and name != ''">and rpil.name like concat('%', #{name}, '%')</if>
......
......@@ -102,11 +102,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
</where>
</select>
......@@ -121,11 +119,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
</where>
group by p.id,p.name ORDER BY RiskScore desc
......@@ -145,11 +141,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
</where>
GROUP BY dict_label
......@@ -167,11 +161,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
<if test="projectId != null">
and p.id=#{projectId}
......@@ -190,11 +182,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
</where>
group by p.id,p.name ORDER BY RiskNum desc
......@@ -209,11 +199,9 @@
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
<if test="level != null and level == 1 ">and p.province like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 2 ">and p.city like concat('%', #{areaName}, '%')</if>
<if test="level != null and level == 3 ">and p.district like concat('%', #{areaName}, '%')</if>
</if>
<if test="beginTime != null">
and (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment