Browse Source

fox:水闸统计

master_tdsql
“lyd” 2 months ago
parent
commit
82107b79d4
  1. 9
      shuili-system/src/main/java/com/kms/yxgh/df/dto/DfYhCharHiddenDangerDto.java
  2. 10
      shuili-system/src/main/java/com/kms/yxgh/df/dto/DfYhHiddenDangerQueDto.java
  3. 9
      shuili-system/src/main/java/com/kms/yxgh/df/dto/SzCharItemDto.java
  4. 153
      shuili-system/src/main/java/com/kms/yxgh/df/mapper/DfRecordMapper.java
  5. 55
      shuili-system/src/main/java/com/kms/yxgh/df/service/DfRecordService.java
  6. 4
      shuili-system/src/main/java/com/kms/yxgh/model/DfYhHiddenDangerModel.java
  7. 7
      shuili-system/src/main/java/com/kms/yxgh/sz/dto/SzCharInfoItemQueDto.java
  8. 91
      shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzRecordMapper.java
  9. 6
      shuili-system/src/main/java/com/kms/yxgh/sz/model/SzHiddenDangerModel.java
  10. 59
      shuili-system/src/main/java/com/kms/yxgh/sz/service/SzRecordService.java

9
shuili-system/src/main/java/com/kms/yxgh/df/dto/DfYhCharHiddenDangerDto.java

@ -18,13 +18,10 @@ public class DfYhCharHiddenDangerDto {
@ApiModelProperty(value = "堤防数量") @ApiModelProperty(value = "堤防数量")
private int dfNumber; private int dfNumber;
@ApiModelProperty(value = "一般隐患数量") @ApiModelProperty(value = "隐患数量")
private int ybNumber; private int yhNumber;
@ApiModelProperty(value = "重大隐患数量") @ApiModelProperty(value = "处置数量")
private int zdNumber;
@ApiModelProperty(value = "处置状态数量")
private int czNumber; private int czNumber;

10
shuili-system/src/main/java/com/kms/yxgh/df/dto/DfYhHiddenDangerQueDto.java

@ -22,11 +22,11 @@ public class DfYhHiddenDangerQueDto implements IAdcd {
private String patrolStart; private String patrolStart;
@ApiModelProperty("查询结束时间") @ApiModelProperty("查询结束时间")
private String patrolEnd; private String patrolEnd;
@ApiModelProperty("隐患类型 无:0、一般隐患:1、较大至重大:2、重大隐患:3 ") @ApiModelProperty("省市地区code")
private String problem;
@ApiModelProperty("地区code")
private String adcd; private String adcd;
@ApiModelProperty("处置状态")
private String handleStatus; @ApiModelProperty("区级标识 1是 0否")
private String districtLevelFlag;
} }

9
shuili-system/src/main/java/com/kms/yxgh/df/dto/SzCharItemDto.java

@ -20,13 +20,10 @@ public class SzCharItemDto {
@ApiModelProperty(value = "堤防数量") @ApiModelProperty(value = "堤防数量")
private int dfNumber; private int dfNumber;
@ApiModelProperty(value = "一般隐患数量") @ApiModelProperty(value = "隐患数量")
private int ybNumber; private int yhNumber;
@ApiModelProperty(value = "重大隐患数量") @ApiModelProperty(value = "处置数量")
private int zdNumber;
@ApiModelProperty(value = "处置状态数量")
private int czNumber; private int czNumber;

153
shuili-system/src/main/java/com/kms/yxgh/df/mapper/DfRecordMapper.java

@ -27,32 +27,63 @@ public interface DfRecordMapper extends BaseMapper<DfRecord> {
Date getLastInsertTimeByDikeCode(@Param("dikeCode") String dikeCode); Date getLastInsertTimeByDikeCode(@Param("dikeCode") String dikeCode);
@Select("<script>" + @Select("<script>" +
"select count(*) from bs_sgc_df_xsjhjlz where RECORD_ID " + "SELECT count(DISTINCT(jl.DIKE_CODE)) " +
"in ( "+ "FROM bs_sgc_df_xsjhjl as jl "+
"select jl.id from bs_sgc_df_xsjhjl as jl "+
"left join att_dike_base base on base.dike_code=jl.dike_code "+ "left join att_dike_base base on base.dike_code=jl.dike_code "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+ "<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
" and base.adcd like concat(#{dto.adcdQx}, '%') "+ " and base.adcd like concat(#{dto.adcdQx}, '%') "+
"</if> "+ "</if> "+
"<if test='dto.handleStatus != null and dto.handleStatus != \"\"'> " + "WHERE jl.id IN ( "+
"where jl.handle_status=#{dto.handleStatus} "+ "SELECT RECORD_ID "+
"</if> " + "FROM bs_sgc_df_xsjhjlz "+
"group by jl.DIKE_CODE,jl.id "+
") "+
"<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+ "<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
"AND (DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+ "where (DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
"AND DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+ "AND DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
"</if> " + "</if> " +
"<if test='dto.problem != null and dto.problem != \"\"'> " + "and base.adcd is not null "+
"AND status=#{dto.problem} "+ "group by RECORD_ID "+
") "+
"</script>")
int paragraphCountNumber(@Param("dto") DfYhHiddenDangerQueDto dto);
@Select("<script>" +
"select count(1) from bs_sgc_df_xsjhjlz as lz "+
"left join bs_sgc_df_xsjhjl hj on hj.id=lz.RECORD_ID "+
"left join att_dike_base base on base.dike_code=hj.dike_code "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
"AND base.adcd like concat(#{dto.adcdQx}, '%') "+
"</if> "+
"where 1=1 "+
"<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
"AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
"AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
"</if> " + "</if> " +
"and base.adcd is not null "+
"and (lz.PROBLEM is null or lz.PROBLEM = '') "+
"</script>")
int yhCountNumber(@Param("dto") DfYhHiddenDangerQueDto dto);
@Select("<script>" +
"select count(1) from bs_sgc_df_xsjhjlz as lz "+
"left join bs_sgc_df_xsjhjl hj on hj.id=lz.RECORD_ID "+
"left join att_dike_base base on base.dike_code=hj.dike_code "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
"AND base.adcd like concat(#{dto.adcdQx}, '%') "+
"</if> "+
"where 1=1 "+
"<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
"AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
"AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
"</if> " +
"and base.adcd is not null "+
"and (lz.HANDLE_TIME is null ) "+
"</script>") "</script>")
int countNumber(@Param("dto") DfYhHiddenDangerQueDto dto); int clCountNumber(@Param("dto") DfYhHiddenDangerQueDto dto);
@Select("<script>" + @Select("<script>" +
"select base.adcd,lz.status as problem,count(1) as count from bs_sgc_df_xsjhjlz as lz "+ "select base.adcd,'1' as problem,count(1) as count from bs_sgc_df_xsjhjlz as lz "+
"left join bs_sgc_df_xsjhjl hj on hj.id=lz.RECORD_ID "+ "left join bs_sgc_df_xsjhjl hj on hj.id=lz.RECORD_ID "+
"left join att_dike_base base on base.dike_code=hj.dike_code "+ "left join att_dike_base base on base.dike_code=hj.dike_code "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+ "<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
@ -63,35 +94,105 @@ public interface DfRecordMapper extends BaseMapper<DfRecord> {
"AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+ "AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
"AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+ "AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
"</if> " + "</if> " +
"<if test='dto.problem != null and dto.problem != \"\"'> " + "and base.adcd is not null "+
"AND lz.status=#{dto.problem} "+ "and (lz.PROBLEM is null or lz.PROBLEM = '') "+
"</if> " + "group by base.adcd "+
"group by base.adcd ,lz.status "+
"</script>") "</script>")
List<DfYhHiddenDangerModel> yhNumberData(@Param("dto") DfYhHiddenDangerQueDto dto); List<DfYhHiddenDangerModel> yhNumberData(@Param("dto") DfYhHiddenDangerQueDto dto);
@Select("<script>" + @Select("<script>" +
"select base.adcd,hj.handle_status,count(1) as count from bs_sgc_df_xsjhjlz as lz "+ "select base.adcd,'1' as problem,count(1) as count from bs_sgc_df_xsjhjlz as lz "+
"left join bs_sgc_df_xsjhjl hj on hj.id=lz.RECORD_ID "+ "left join bs_sgc_df_xsjhjl hj on hj.id=lz.RECORD_ID "+
"<if test='dto.handleStatus != null and dto.handleStatus != \"\"'> " +
"AND hj.handle_status=#{dto.handleStatus} "+
"</if> " +
"left join att_dike_base base on base.dike_code=hj.dike_code "+ "left join att_dike_base base on base.dike_code=hj.dike_code "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+ "<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
" and base.adcd like concat(#{dto.adcdQx}, '%') "+ "AND base.adcd like concat(#{dto.adcdQx}, '%') "+
"</if> "+ "</if> "+
"where 1=1 "+ "where 1=1 "+
"<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+ "<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
"AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+ "AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
"AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+ "AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
"</if> " + "</if> " +
"<if test='dto.problem != null and dto.problem != \"\"'> "+ "and base.adcd is not null "+
"AND lz.status=#{dto.problem} "+ "and (lz.HANDLE_TIME is null ) "+
"</if> " + "group by base.adcd "+
"group by base.adcd ,hj.handle_status "+
"</script>") "</script>")
List<DfYhHiddenDangerModel> clfNumberData(@Param("dto") DfYhHiddenDangerQueDto dto); List<DfYhHiddenDangerModel> clfNumberData(@Param("dto") DfYhHiddenDangerQueDto dto);
// @Select("<script>" +
// "select base.adcd,lz.status as problem,count(1) as count from bs_sgc_df_xsjhjlz as lz "+
// "left join bs_sgc_df_xsjhjl hj on hj.id=lz.RECORD_ID "+
// "left join att_dike_base base on base.dike_code=hj.dike_code "+
// "<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
// "AND base.adcd like concat(#{dto.adcdQx}, '%') "+
// "</if> "+
// "where 1=1 "+
// "<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
// "AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
// "AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
// "</if> " +
// "<if test='dto.problem != null and dto.problem != \"\"'> " +
// "AND lz.status=#{dto.problem} "+
// "</if> " +
// "group by base.adcd ,lz.status "+
// "</script>")
// List<DfYhHiddenDangerModel> yhNumberData(@Param("dto") DfYhHiddenDangerQueDto dto);
// @Select("<script>" +
// "select count(*) from bs_sgc_df_xsjhjlz where RECORD_ID " +
// "in ( "+
// "select jl.id from bs_sgc_df_xsjhjl as jl "+
// "left join att_dike_base base on base.dike_code=jl.dike_code "+
// "<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
// " and base.adcd like concat(#{dto.adcdQx}, '%') "+
// "</if> "+
// "<if test='dto.handleStatus != null and dto.handleStatus != \"\"'> " +
// "where jl.handle_status=#{dto.handleStatus} "+
// "</if> " +
// "group by jl.DIKE_CODE,jl.id "+
// ") "+
// "<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
// "AND (DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
// "AND DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
// "</if> " +
// "<if test='dto.problem != null and dto.problem != \"\"'> " +
// "AND status=#{dto.problem} "+
// "</if> " +
//
// "</script>")
// int countNumber(@Param("dto") DfYhHiddenDangerQueDto dto);
// @Select("<script>" +
// "select base.adcd,hj.handle_status,count(1) as count from bs_sgc_df_xsjhjlz as lz "+
// "left join bs_sgc_df_xsjhjl hj on hj.id=lz.RECORD_ID "+
// "<if test='dto.handleStatus != null and dto.handleStatus != \"\"'> " +
// "AND hj.handle_status=#{dto.handleStatus} "+
// "</if> " +
// "left join att_dike_base base on base.dike_code=hj.dike_code "+
// "<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
// " and base.adcd like concat(#{dto.adcdQx}, '%') "+
// "</if>"+
// "where 1=1 "+
// "<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
// "AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
// "AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
// "</if> " +
// "<if test='dto.problem != null and dto.problem != \"\"'> "+
// "AND lz.status=#{dto.problem} "+
// "</if> " +
// "group by base.adcd ,hj.handle_status "+
// "</script>")
// List<DfYhHiddenDangerModel> clfNumberData(@Param("dto") DfYhHiddenDangerQueDto dto);
@Select("<script>" + @Select("<script>" +
"SELECT " + "SELECT " +
"r.id, " + "r.id, " +

55
shuili-system/src/main/java/com/kms/yxgh/df/service/DfRecordService.java

@ -67,60 +67,56 @@ public class DfRecordService extends BaseService<DfRecordMapper, DfRecord> {
public DfYhCharHiddenDangerDto hiddenDanger(DfYhHiddenDangerQueDto dto) { public DfYhCharHiddenDangerDto hiddenDanger(DfYhHiddenDangerQueDto dto) {
DfYhCharHiddenDangerDto dfYhCharHiddenDangerDto=new DfYhCharHiddenDangerDto(); DfYhCharHiddenDangerDto dfYhCharHiddenDangerDto=new DfYhCharHiddenDangerDto();
// 堤防段数
dfYhCharHiddenDangerDto.setDfNumber(baseMapper.paragraphCountNumber(dto));
// 设置堤防、一般隐患、重大隐患、处置数量 // 隐患数
dfYhCharHiddenDangerDto.setDfNumber(baseMapper.countNumber(dto)); dfYhCharHiddenDangerDto.setYhNumber(baseMapper.yhCountNumber(dto));
// 处置数
dto.setProblem(DfEnum.GENERAL_HAZARDS.getValue()); dfYhCharHiddenDangerDto.setCzNumber(baseMapper.clCountNumber(dto));
dfYhCharHiddenDangerDto.setYbNumber(baseMapper.countNumber(dto));
dto.setProblem(DfEnum.SIGNIFICANT_YH.getValue());
dfYhCharHiddenDangerDto.setZdNumber(baseMapper.countNumber(dto));
dto.setHandleStatus(DfEnum.HANDLED.getValue());
dfYhCharHiddenDangerDto.setCzNumber(baseMapper.countNumber(dto));
List<DfYhHiddenDangerModel> list =new ArrayList<>(); List<DfYhHiddenDangerModel> list =new ArrayList<>();
// 隐患数量数据 // 隐患数量数据
dto.setProblem(DfEnum.GENERAL_HAZARDS.getValue());
List<DfYhHiddenDangerModel> yhModel = baseMapper.yhNumberData(dto); List<DfYhHiddenDangerModel> yhModel = baseMapper.yhNumberData(dto);
if (!CollectionUtil.isEmpty(yhModel)) { if (!CollectionUtil.isEmpty(yhModel)) {
list.addAll(yhModel); list.addAll(yhModel);
} }
dto.setProblem(DfEnum.LARGE_TO_SIGNIFICANT.getValue());
List<DfYhHiddenDangerModel> jdModel = baseMapper.yhNumberData(dto);
if (!CollectionUtil.isEmpty(jdModel)) {
list.addAll(jdModel);
}
dto.setProblem(DfEnum.SIGNIFICANT_YH.getValue());
List<DfYhHiddenDangerModel> zdModel = baseMapper.yhNumberData(dto);
if (!CollectionUtil.isEmpty(zdModel)) {
list.addAll(zdModel);
}
// 处理数量数据 // 处理数量数据
dto.setHandleStatus(DfEnum.HANDLED.getValue());
List<DfYhHiddenDangerModel> clModel = baseMapper.clfNumberData(dto); List<DfYhHiddenDangerModel> clModel = baseMapper.clfNumberData(dto);
if (CollectionUtil.isEmpty(clModel)) { if (CollectionUtil.isEmpty(list)) {
return dfYhCharHiddenDangerDto; return dfYhCharHiddenDangerDto;
} }
list.addAll(clModel); list.addAll(clModel);
Map<String, List<DfYhHiddenDangerModel>> groupingByList = list.stream() Map<String, List<DfYhHiddenDangerModel>> groupingByList = list.stream()
.filter(s -> !StringUtils.isEmpty(s.getAdcd())) // 过滤掉空字符串 .filter(s -> !StringUtils.isEmpty(s.getAdcd())) // 过滤掉空字符串
.collect(Collectors.groupingBy(DfYhHiddenDangerModel::getAdcd)); .collect(Collectors.groupingBy(DfYhHiddenDangerModel::getAdcd));
if (!CollectionUtil.isEmpty(groupingByList)) { if (!CollectionUtil.isEmpty(groupingByList)) {
List<String> xList =new ArrayList<>(); List<String> xList =new ArrayList<>();
List<DfYhCharHiddenDangerDto.YAxis>yAxisList=new ArrayList<>(); List<DfYhCharHiddenDangerDto.YAxis>yAxisList=new ArrayList<>();
// 是否查询区级
boolean flag = org.springframework.util.StringUtils.isEmpty(dto.getDistrictLevelFlag())
|| Objects.equals("0", dto.getDistrictLevelFlag());
if (!flag) {
SysXzqh xzqhdm = sysXzqhService.getOne(new QueryWrapper<SysXzqh>().eq("XZQHDM", dto.getAdcd()).last(" limit 1"));
if (null != xzqhdm) {
xList.add(xzqhdm.getName());
}
}
for (Map.Entry<String, List<DfYhHiddenDangerModel>> entry : groupingByList.entrySet()) { for (Map.Entry<String, List<DfYhHiddenDangerModel>> entry : groupingByList.entrySet()) {
// 设置 x轴 // 设置 x轴
// 转换名称 // 转换名称
if (flag) {
SysXzqh xzqhdm = sysXzqhService.getOne(new QueryWrapper<SysXzqh>().likeRight("XZQHDM", entry.getKey())); SysXzqh xzqhdm = sysXzqhService.getOne(new QueryWrapper<SysXzqh>().likeRight("XZQHDM", entry.getKey()));
if (null!=xzqhdm) { if (null!=xzqhdm) {
xList.add(xzqhdm.getName()); xList.add(xzqhdm.getName());
} }
}
DfYhCharHiddenDangerDto.YAxis yAxisInfo = getyAxis(entry); DfYhCharHiddenDangerDto.YAxis yAxisInfo = getyAxis(entry);
yAxisList.add(yAxisInfo); yAxisList.add(yAxisInfo);
} }
@ -136,10 +132,7 @@ public class DfRecordService extends BaseService<DfRecordMapper, DfRecord> {
for (DfYhHiddenDangerModel it : entry.getValue()) { for (DfYhHiddenDangerModel it : entry.getValue()) {
DfYhCharHiddenDangerDto.Series series=new DfYhCharHiddenDangerDto.Series(); DfYhCharHiddenDangerDto.Series series=new DfYhCharHiddenDangerDto.Series();
series.setCount(it.getCount()); series.setCount(it.getCount());
if (it != null) { series.setType(it.getProblem());
// 如果非处置状态即全部为隐患状态
series.setType(Objects.equals(it.getHandleStatus(),2)?2:1);
}
seriesList.add(series); seriesList.add(series);
} }
// 设置 y轴 // 设置 y轴

4
shuili-system/src/main/java/com/kms/yxgh/model/DfYhHiddenDangerModel.java

@ -21,10 +21,10 @@ public class DfYhHiddenDangerModel {
private String adcd; private String adcd;
@ApiModelProperty("隐患类型") @ApiModelProperty("隐患类型")
private String problem; private int problem;
@ApiModelProperty("数量") @ApiModelProperty("数量")
private Integer count; private int count;
@ApiModelProperty("处置状态") @ApiModelProperty("处置状态")
private Integer handleStatus; private Integer handleStatus;

7
shuili-system/src/main/java/com/kms/yxgh/sz/dto/SzCharInfoItemQueDto.java

@ -21,10 +21,9 @@ public class SzCharInfoItemQueDto implements IAdcd {
private String patrolStart; private String patrolStart;
@ApiModelProperty("查询结束时间") @ApiModelProperty("查询结束时间")
private String patrolEnd; private String patrolEnd;
@ApiModelProperty("隐患类型 无:0、一般隐患:1、较大至重大:2、重大隐患:3 ")
private String problem;
@ApiModelProperty("地区code") @ApiModelProperty("地区code")
private String adcd; private String adcd;
@ApiModelProperty("处置状态") @ApiModelProperty("区级标识 1是 0否")
private String handleStatus; private String districtLevelFlag;
} }

91
shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzRecordMapper.java

@ -32,8 +32,8 @@ public interface SzRecordMapper extends BaseMapper<SzRecord> {
Date getLastInsertTimeByWagaCodeAndPlanId(@Param("wagaCode") String wagaCode, @Param("planId") String planId); Date getLastInsertTimeByWagaCodeAndPlanId(@Param("wagaCode") String wagaCode, @Param("planId") String planId);
@Select("<script>" + @Select("<script>" +
"select adb.adcd,bsdx.duty_holder_type,count(1) as count from bs_sgc_sz_xsjhjl sz "+ "select adb.adcd,sz.duty_holder_type,count(1) as count from bs_sgc_sz_xsjhjl sz "+
"left join att_dike_base adb on adb.dike_CODE = sz.DIKE_CODE "+ "left join att_dike_base adb on adb.dike_CODE = sz.WAGA_CODE "+
" where 1=1 "+ " where 1=1 "+
"<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+ "<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
"AND (DATE_FORMAT(sz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+ "AND (DATE_FORMAT(sz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
@ -48,32 +48,46 @@ public interface SzRecordMapper extends BaseMapper<SzRecord> {
@Select("<script>" + @Select("<script>" +
"select count(*) from bs_sgc_sz_xsjhjlz where RECORD_ID " + "SELECT count(DISTINCT(jl.WAGA_CODE)) " +
"in ( "+ "FROM bs_sgc_sz_xsjhjl as jl "+
"select jl.id from bs_sgc_sz_xsjhjl as jl "+ "left join att_dike_base base on base.dike_code=jl.WAGA_CODE "+
"left join att_dike_base base on base.dike_code=jl.dike_code "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+ "<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
" and base.adcd like concat(#{dto.adcdQx}, '%') "+ " and base.adcd like concat(#{dto.adcdQx}, '%') "+
"</if> "+ "</if> "+
"<if test='dto.handleStatus != null and dto.handleStatus != \"\"'> " + "WHERE jl.id IN ( "+
"where jl.handle_status=#{dto.handleStatus} "+ "SELECT RECORD_ID "+
"</if> " + "FROM bs_sgc_sz_xsjhjlz "+
"group by jl.DIKE_CODE,jl.id "+
") "+
"<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+ "<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
"AND (DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+ "where (DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
"AND DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+ "AND DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
"</if> " + "</if> " +
"<if test='dto.problem != null and dto.problem != \"\"'> " + "and base.adcd is not null "+
"AND status=#{dto.problem} "+ "group by RECORD_ID "+
") "+
"</script>")
int paragraphCountNumber(@Param("dto") SzCharInfoItemQueDto dto);
@Select("<script>" +
"select count(1) from bs_sgc_sz_xsjhjlz as lz "+
"left join bs_sgc_sz_xsjhjl hj on hj.id=lz.RECORD_ID "+
"left join att_dike_base base on base.dike_code=hj.WAGA_CODE "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
"AND base.adcd like concat(#{dto.adcdQx}, '%') "+
"</if> "+
"where 1=1 "+
"<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
"AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
"AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
"</if> " + "</if> " +
"and base.adcd is not null "+
"and (lz.PROBLEM is null or lz.PROBLEM = '') "+
"</script>") "</script>")
int countNumber(@Param("dto") SzCharInfoItemQueDto dto); int yhCountNumber(@Param("dto") SzCharInfoItemQueDto dto);
@Select("<script>" + @Select("<script>" +
"select base.adcd,lz.status as problem,count(1) as count from bs_sgc_sz_xsjhjlz as lz "+ "select count(1) from bs_sgc_sz_xsjhjlz as lz "+
"left join bs_sgc_sz_xsjhjl hj on hj.id=lz.RECORD_ID "+ "left join bs_sgc_sz_xsjhjl hj on hj.id=lz.RECORD_ID "+
"left join att_dike_base base on base.dike_code=hj.dike_code "+ "left join att_dike_base base on base.dike_code=hj.WAGA_CODE "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+ "<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
"AND base.adcd like concat(#{dto.adcdQx}, '%') "+ "AND base.adcd like concat(#{dto.adcdQx}, '%') "+
"</if> "+ "</if> "+
@ -82,35 +96,52 @@ public interface SzRecordMapper extends BaseMapper<SzRecord> {
"AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+ "AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
"AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+ "AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
"</if> " + "</if> " +
"<if test='dto.problem != null and dto.problem != \"\"'> " + "and base.adcd is not null "+
"AND lz.status=#{dto.problem} "+ "and (lz.HANDLE_TIME is null ) "+
"</script>")
int clCountNumber(@Param("dto") SzCharInfoItemQueDto dto);
@Select("<script>" +
"select base.adcd,'1' as problem,count(1) as count from bs_sgc_sz_xsjhjlz as lz "+
"left join bs_sgc_sz_xsjhjl hj on hj.id=lz.RECORD_ID "+
"left join att_dike_base base on base.dike_code=hj.WAGA_CODE "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
"AND base.adcd like concat(#{dto.adcdQx}, '%') "+
"</if> "+
"where 1=1 "+
"<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
"AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
"AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
"</if> " + "</if> " +
"group by base.adcd ,lz.status "+ "and base.adcd is not null "+
"and (lz.PROBLEM is null or lz.PROBLEM = '') "+
"group by base.adcd "+
"</script>") "</script>")
List<SzHiddenDangerModel> yhNumberData(@Param("dto") SzCharInfoItemQueDto dto); List<SzHiddenDangerModel> yhNumberData(@Param("dto") SzCharInfoItemQueDto dto);
@Select("<script>" + @Select("<script>" +
"select base.adcd,hj.handle_status,count(1) as count from bs_sgc_sz_xsjhjlz as lz "+ "select base.adcd,'1' as problem,count(1) as count from bs_sgc_sz_xsjhjlz as lz "+
"left join bs_sgc_sz_xsjhjl hj on hj.id=lz.RECORD_ID "+ "left join bs_sgc_sz_xsjhjl hj on hj.id=lz.RECORD_ID "+
"<if test='dto.handleStatus != null and dto.handleStatus != \"\"'> " + "left join att_dike_base base on base.dike_code=hj.WAGA_CODE "+
"AND hj.handle_status=#{dto.handleStatus} "+
"</if> " +
"left join att_dike_base base on base.dike_code=hj.dike_code "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+ "<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
" and base.adcd like concat(#{dto.adcdQx}, '%') "+ "AND base.adcd like concat(#{dto.adcdQx}, '%') "+
"</if> "+ "</if> "+
"where 1=1 "+ "where 1=1 "+
"<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+ "<if test='dto.patrolStart != null and dto.patrolEnd != \"\"'> "+
"AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+ "AND (DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{dto.patrolStart} , '%Y-%m-%d %H:%i:%s') "+
"AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+ "AND DATE_FORMAT(lz.create_time, '%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{dto.patrolEnd} , '%Y-%m-%d %H:%i:%s')) "+
"</if> " + "</if> " +
"<if test='dto.problem != null and dto.problem != \"\"'> "+ "and base.adcd is not null "+
"AND lz.status=#{dto.problem} "+ "and (lz.HANDLE_TIME is null ) "+
"</if> " + "group by base.adcd "+
"group by base.adcd ,hj.handle_status "+
"</script>") "</script>")
List<SzHiddenDangerModel> clfNumberData(@Param("dto") SzCharInfoItemQueDto dto); List<SzHiddenDangerModel> clfNumberData(@Param("dto") SzCharInfoItemQueDto dto);
@Select("<script>" + @Select("<script>" +
"SELECT " + "SELECT " +
"r.id, " + "r.id, " +

6
shuili-system/src/main/java/com/kms/yxgh/sz/model/SzHiddenDangerModel.java

@ -21,13 +21,13 @@ public class SzHiddenDangerModel {
private String adcd; private String adcd;
@ApiModelProperty("隐患类型") @ApiModelProperty("隐患类型")
private String problem; private int problem;
@ApiModelProperty("数量") @ApiModelProperty("数量")
private Integer count; private int count;
@ApiModelProperty("处置状态") @ApiModelProperty("处置状态")
private Integer handleStatus; private int handleStatus;

59
shuili-system/src/main/java/com/kms/yxgh/sz/service/SzRecordService.java

@ -34,19 +34,15 @@ import com.kms.yxgh.util.StreamUtils;
import com.shuili.common.core.domain.AjaxResult; import com.shuili.common.core.domain.AjaxResult;
import com.shuili.common.core.domain.SearchParam; import com.shuili.common.core.domain.SearchParam;
import com.shuili.common.core.service.BaseService; import com.shuili.common.core.service.BaseService;
import com.shuili.common.enums.DfEnum;
import com.shuili.common.utils.StringUtils; import com.shuili.common.utils.StringUtils;
import com.shuili.common.utils.poi.ExcelUtil; import com.shuili.common.utils.poi.ExcelUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.kms.yxgh.sz.service.SzCheckingService.PART_SEPARATOR; import static com.kms.yxgh.sz.service.SzCheckingService.PART_SEPARATOR;
/** /**
* 水闸巡视检查记录Service接口 * 水闸巡视检查记录Service接口
* *
@ -91,7 +87,7 @@ public class SzRecordService extends BaseService<SzRecordMapper, SzRecord> {
} }
dtoInfo.setYAxis(yAxisList); dtoInfo.setYAxis(yAxisList);
dtoInfo.setXAxis(xList); dtoInfo.setXAxis(xList);
return null; return dtoInfo;
} }
private SzCharInfoDto.YAxis getSzStatisticsyAxis(Map.Entry<String, List<SzStatisticsModelDto>> entry) { private SzCharInfoDto.YAxis getSzStatisticsyAxis(Map.Entry<String, List<SzStatisticsModelDto>> entry) {
@ -119,26 +115,13 @@ public class SzRecordService extends BaseService<SzRecordMapper, SzRecord> {
List<SzHiddenDangerModel> list =new ArrayList<>(); List<SzHiddenDangerModel> list =new ArrayList<>();
// 隐患数量数据 // 隐患数量数据
dto.setProblem(DfEnum.GENERAL_HAZARDS.getValue());
List<SzHiddenDangerModel> yhModel = baseMapper.yhNumberData(dto); List<SzHiddenDangerModel> yhModel = baseMapper.yhNumberData(dto);
if (!CollectionUtil.isEmpty(yhModel)) { if (!CollectionUtil.isEmpty(yhModel)) {
list.addAll(yhModel); list.addAll(yhModel);
} }
dto.setProblem(DfEnum.LARGE_TO_SIGNIFICANT.getValue());
List<SzHiddenDangerModel> jdModel = baseMapper.yhNumberData(dto);
if (!CollectionUtil.isEmpty(jdModel)) {
list.addAll(jdModel);
}
dto.setProblem(DfEnum.SIGNIFICANT_YH.getValue());
List<SzHiddenDangerModel> zdModel = baseMapper.yhNumberData(dto);
if (!CollectionUtil.isEmpty(zdModel)) {
list.addAll(zdModel);
}
// 处理数量数据 // 处理数量数据
dto.setHandleStatus(DfEnum.HANDLED.getValue());
List<SzHiddenDangerModel> clModel = baseMapper.clfNumberData(dto); List<SzHiddenDangerModel> clModel = baseMapper.clfNumberData(dto);
if (CollectionUtil.isEmpty(clModel)) { if (CollectionUtil.isEmpty(list)) {
return dfYhCharHiddenDangerDto; return dfYhCharHiddenDangerDto;
} }
list.addAll(clModel); list.addAll(clModel);
@ -149,14 +132,24 @@ public class SzRecordService extends BaseService<SzRecordMapper, SzRecord> {
if (!CollectionUtil.isEmpty(groupingByList)) { if (!CollectionUtil.isEmpty(groupingByList)) {
List<String> xList =new ArrayList<>(); List<String> xList =new ArrayList<>();
List<SzCharItemDto.YAxis>yAxisList=new ArrayList<>(); List<SzCharItemDto.YAxis>yAxisList=new ArrayList<>();
// 是否查询区级
boolean flag = org.springframework.util.StringUtils.isEmpty(dto.getDistrictLevelFlag())
|| Objects.equals("0", dto.getDistrictLevelFlag());
if (!flag) {
SysXzqh xzqhdm = sysXzqhService.getOne(new QueryWrapper<SysXzqh>().eq("XZQHDM", dto.getAdcd()).last(" limit 1"));
if (null != xzqhdm) {
xList.add(xzqhdm.getName());
}
}
for (Map.Entry<String, List<SzHiddenDangerModel>> entry : groupingByList.entrySet()) { for (Map.Entry<String, List<SzHiddenDangerModel>> entry : groupingByList.entrySet()) {
// 设置 x轴 // 设置 x轴
// 转换名称 // 转换名称
if (flag) {
SysXzqh xzqhdm = sysXzqhService.getOne(new QueryWrapper<SysXzqh>().likeRight("XZQHDM", entry.getKey())); SysXzqh xzqhdm = sysXzqhService.getOne(new QueryWrapper<SysXzqh>().likeRight("XZQHDM", entry.getKey()));
if (null!=xzqhdm) { if (null!=xzqhdm) {
xList.add(xzqhdm.getName()); xList.add(xzqhdm.getName());
} }
}
SzCharItemDto.YAxis yAxisInfo = getSzHiddenDangeryAxis(entry); SzCharItemDto.YAxis yAxisInfo = getSzHiddenDangeryAxis(entry);
yAxisList.add(yAxisInfo); yAxisList.add(yAxisInfo);
} }
@ -166,24 +159,21 @@ public class SzRecordService extends BaseService<SzRecordMapper, SzRecord> {
return dfYhCharHiddenDangerDto; return dfYhCharHiddenDangerDto;
} }
public static String getXZQHName(String code) {
return "";
}
private void numberHandle (SzCharInfoItemQueDto dto,SzCharItemDto itemDto) { private void numberHandle (SzCharInfoItemQueDto dto,SzCharItemDto itemDto) {
// 堤防数量 // 堤防数量
int dfNumber = this.baseMapper.countNumber(dto); int dfNumber = this.baseMapper.paragraphCountNumber(dto);
// 一般隐患数量 // 一般隐患数量
dto.setProblem(DfEnum.GENERAL_HAZARDS.getValue()); int yhNumber = this.baseMapper.yhCountNumber(dto);
int ybNumber = this.baseMapper.countNumber(dto);
// 重大隐患数量
dto.setProblem(DfEnum.SIGNIFICANT_YH.getValue());
int zdNumber = this.baseMapper.countNumber(dto);
// 处置数量 // 处置数量
dto.setHandleStatus(DfEnum.HANDLED.getValue()); int czNumber = this.baseMapper.clCountNumber(dto);
int czNumber = this.baseMapper.countNumber(dto);
itemDto.setDfNumber(dfNumber); itemDto.setDfNumber(dfNumber);
itemDto.setYbNumber(ybNumber); itemDto.setYhNumber(yhNumber);
itemDto.setZdNumber(zdNumber);
itemDto.setCzNumber(czNumber); itemDto.setCzNumber(czNumber);
} }
@ -192,10 +182,7 @@ public class SzRecordService extends BaseService<SzRecordMapper, SzRecord> {
for (SzHiddenDangerModel it : entry.getValue()) { for (SzHiddenDangerModel it : entry.getValue()) {
SzCharItemDto.Series series=new SzCharItemDto.Series(); SzCharItemDto.Series series=new SzCharItemDto.Series();
series.setCount(it.getCount()); series.setCount(it.getCount());
if (it != null) { series.setType(it.getProblem());
// 如果非处置状态即全部为隐患状态
series.setType(Objects.equals(it.getHandleStatus(),2)?2:1);
}
seriesList.add(series); seriesList.add(series);
} }
// 设置 y轴 // 设置 y轴

Loading…
Cancel
Save