Commit 944d8c92 authored by yf's avatar yf

大屏相关接口修改

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