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. 155
      shuili-system/src/main/java/com/kms/yxgh/df/mapper/DfRecordMapper.java
  5. 57
      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. 93
      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. 61
      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 = "堤防数量")
private int dfNumber;
@ApiModelProperty(value = "一般隐患数量")
private int ybNumber;
@ApiModelProperty(value = "隐患数量")
private int yhNumber;
@ApiModelProperty(value = "重大隐患数量")
private int zdNumber;
@ApiModelProperty(value = "处置状态数量")
@ApiModelProperty(value = "处置数量")
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;
@ApiModelProperty("查询结束时间")
private String patrolEnd;
@ApiModelProperty("隐患类型 无:0、一般隐患:1、较大至重大:2、重大隐患:3 ")
private String problem;
@ApiModelProperty("地区code")
@ApiModelProperty("省市地区code")
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 = "堤防数量")
private int dfNumber;
@ApiModelProperty(value = "一般隐患数量")
private int ybNumber;
@ApiModelProperty(value = "隐患数量")
private int yhNumber;
@ApiModelProperty(value = "重大隐患数量")
private int zdNumber;
@ApiModelProperty(value = "处置状态数量")
@ApiModelProperty(value = "处置数量")
private int czNumber;

155
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);
@Select("<script>" +
"select count(*) from bs_sgc_df_xsjhjlz where RECORD_ID " +
"in ( "+
"select jl.id from bs_sgc_df_xsjhjl as jl "+
"SELECT count(DISTINCT(jl.DIKE_CODE)) " +
"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 "+
") "+
"WHERE jl.id IN ( "+
"SELECT RECORD_ID "+
"FROM bs_sgc_df_xsjhjlz "+
"<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')) "+
"</if> " +
"<if test='dto.problem != null and dto.problem != \"\"'> " +
"AND status=#{dto.problem} "+
"and base.adcd is not null "+
"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> " +
"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>")
int countNumber(@Param("dto") DfYhHiddenDangerQueDto dto);
int clCountNumber(@Param("dto") DfYhHiddenDangerQueDto dto);
@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 att_dike_base base on base.dike_code=hj.dike_code "+
"<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') &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 "+
"and base.adcd is not null "+
"and (lz.PROBLEM is null or lz.PROBLEM = '') "+
"group by base.adcd "+
"</script>")
List<DfYhHiddenDangerModel> yhNumberData(@Param("dto") DfYhHiddenDangerQueDto dto);
@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 "+
"<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>"+
"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 "+
"and base.adcd is not null "+
"and (lz.HANDLE_TIME is null ) "+
"group by base.adcd "+
"</script>")
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 " +
"r.id, " +

57
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) {
DfYhCharHiddenDangerDto dfYhCharHiddenDangerDto=new DfYhCharHiddenDangerDto();
// 设置堤防、一般隐患、重大隐患、处置数量
dfYhCharHiddenDangerDto.setDfNumber(baseMapper.countNumber(dto));
dto.setProblem(DfEnum.GENERAL_HAZARDS.getValue());
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));
// 堤防段数
dfYhCharHiddenDangerDto.setDfNumber(baseMapper.paragraphCountNumber(dto));
// 隐患数
dfYhCharHiddenDangerDto.setYhNumber(baseMapper.yhCountNumber(dto));
// 处置数
dfYhCharHiddenDangerDto.setCzNumber(baseMapper.clCountNumber(dto));
List<DfYhHiddenDangerModel> list =new ArrayList<>();
// 隐患数量数据
dto.setProblem(DfEnum.GENERAL_HAZARDS.getValue());
List<DfYhHiddenDangerModel> yhModel = baseMapper.yhNumberData(dto);
if (!CollectionUtil.isEmpty(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);
if (CollectionUtil.isEmpty(clModel)) {
if (CollectionUtil.isEmpty(list)) {
return dfYhCharHiddenDangerDto;
}
list.addAll(clModel);
Map<String, List<DfYhHiddenDangerModel>> groupingByList = list.stream()
.filter(s -> !StringUtils.isEmpty(s.getAdcd())) // 过滤掉空字符串
.collect(Collectors.groupingBy(DfYhHiddenDangerModel::getAdcd));
if (!CollectionUtil.isEmpty(groupingByList)) {
List<String> xList =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()) {
// 设置 x轴
// 转换名称
if (flag) {
SysXzqh xzqhdm = sysXzqhService.getOne(new QueryWrapper<SysXzqh>().likeRight("XZQHDM", entry.getKey()));
if (null != xzqhdm) {
if (null!=xzqhdm) {
xList.add(xzqhdm.getName());
}
}
DfYhCharHiddenDangerDto.YAxis yAxisInfo = getyAxis(entry);
yAxisList.add(yAxisInfo);
}
@ -136,10 +132,7 @@ public class DfRecordService extends BaseService<DfRecordMapper, DfRecord> {
for (DfYhHiddenDangerModel it : entry.getValue()) {
DfYhCharHiddenDangerDto.Series series=new DfYhCharHiddenDangerDto.Series();
series.setCount(it.getCount());
if (it != null) {
// 如果非处置状态即全部为隐患状态
series.setType(Objects.equals(it.getHandleStatus(),2)?2:1);
}
series.setType(it.getProblem());
seriesList.add(series);
}
// 设置 y轴

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

@ -21,10 +21,10 @@ public class DfYhHiddenDangerModel {
private String adcd;
@ApiModelProperty("隐患类型")
private String problem;
private int problem;
@ApiModelProperty("数量")
private Integer count;
private int count;
@ApiModelProperty("处置状态")
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;
@ApiModelProperty("查询结束时间")
private String patrolEnd;
@ApiModelProperty("隐患类型 无:0、一般隐患:1、较大至重大:2、重大隐患:3 ")
private String problem;
@ApiModelProperty("地区code")
private String adcd;
@ApiModelProperty("处置状态")
private String handleStatus;
@ApiModelProperty("区级标识 1是 0否")
private String districtLevelFlag;
}

93
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);
@Select("<script>" +
"select adb.adcd,bsdx.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 "+
"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.WAGA_CODE "+
" where 1=1 "+
"<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') "+
@ -48,32 +48,46 @@ public interface SzRecordMapper extends BaseMapper<SzRecord> {
@Select("<script>" +
"select count(*) from bs_sgc_sz_xsjhjlz where RECORD_ID " +
"in ( "+
"select jl.id from bs_sgc_sz_xsjhjl as jl "+
"left join att_dike_base base on base.dike_code=jl.dike_code "+
"SELECT count(DISTINCT(jl.WAGA_CODE)) " +
"FROM bs_sgc_sz_xsjhjl as jl "+
"left join att_dike_base base on base.dike_code=jl.WAGA_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 "+
") "+
"WHERE jl.id IN ( "+
"SELECT RECORD_ID "+
"FROM bs_sgc_sz_xsjhjlz "+
"<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')) "+
"</if> " +
"<if test='dto.problem != null and dto.problem != \"\"'> " +
"AND status=#{dto.problem} "+
"and base.adcd is not null "+
"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> " +
"and base.adcd is not null "+
"and (lz.PROBLEM is null or lz.PROBLEM = '') "+
"</script>")
int countNumber(@Param("dto") SzCharInfoItemQueDto dto);
int yhCountNumber(@Param("dto") SzCharInfoItemQueDto dto);
@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 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 != \"\"'> "+
"AND base.adcd like concat(#{dto.adcdQx}, '%') "+
"</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') &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} "+
"and base.adcd is not null "+
"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> " +
"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>")
List<SzHiddenDangerModel> yhNumberData(@Param("dto") SzCharInfoItemQueDto dto);
@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 "+
"<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.WAGA_CODE "+
"<if test='dto.adcdQx != null and dto.adcdQx != \"\"'> "+
" and base.adcd like concat(#{dto.adcdQx}, '%') "+
"</if>"+
"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 "+
"and base.adcd is not null "+
"and (lz.HANDLE_TIME is null ) "+
"group by base.adcd "+
"</script>")
List<SzHiddenDangerModel> clfNumberData(@Param("dto") SzCharInfoItemQueDto dto);
@Select("<script>" +
"SELECT " +
"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;
@ApiModelProperty("隐患类型")
private String problem;
private int problem;
@ApiModelProperty("数量")
private Integer count;
private int count;
@ApiModelProperty("处置状态")
private Integer handleStatus;
private int handleStatus;

61
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.SearchParam;
import com.shuili.common.core.service.BaseService;
import com.shuili.common.enums.DfEnum;
import com.shuili.common.utils.StringUtils;
import com.shuili.common.utils.poi.ExcelUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.kms.yxgh.sz.service.SzCheckingService.PART_SEPARATOR;
/**
* 水闸巡视检查记录Service接口
*
@ -91,7 +87,7 @@ public class SzRecordService extends BaseService<SzRecordMapper, SzRecord> {
}
dtoInfo.setYAxis(yAxisList);
dtoInfo.setXAxis(xList);
return null;
return dtoInfo;
}
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<>();
// 隐患数量数据
dto.setProblem(DfEnum.GENERAL_HAZARDS.getValue());
List<SzHiddenDangerModel> yhModel = baseMapper.yhNumberData(dto);
if (!CollectionUtil.isEmpty(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);
if (CollectionUtil.isEmpty(clModel)) {
if (CollectionUtil.isEmpty(list)) {
return dfYhCharHiddenDangerDto;
}
list.addAll(clModel);
@ -149,14 +132,24 @@ public class SzRecordService extends BaseService<SzRecordMapper, SzRecord> {
if (!CollectionUtil.isEmpty(groupingByList)) {
List<String> xList =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()) {
// 设置 x轴
// 转换名称
if (flag) {
SysXzqh xzqhdm = sysXzqhService.getOne(new QueryWrapper<SysXzqh>().likeRight("XZQHDM", entry.getKey()));
if (null != xzqhdm) {
if (null!=xzqhdm) {
xList.add(xzqhdm.getName());
}
}
SzCharItemDto.YAxis yAxisInfo = getSzHiddenDangeryAxis(entry);
yAxisList.add(yAxisInfo);
}
@ -166,24 +159,21 @@ public class SzRecordService extends BaseService<SzRecordMapper, SzRecord> {
return dfYhCharHiddenDangerDto;
}
public static String getXZQHName(String code) {
return "";
}
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 ybNumber = this.baseMapper.countNumber(dto);
// 重大隐患数量
dto.setProblem(DfEnum.SIGNIFICANT_YH.getValue());
int zdNumber = this.baseMapper.countNumber(dto);
int yhNumber = this.baseMapper.yhCountNumber(dto);
// 处置数量
dto.setHandleStatus(DfEnum.HANDLED.getValue());
int czNumber = this.baseMapper.countNumber(dto);
int czNumber = this.baseMapper.clCountNumber(dto);
itemDto.setDfNumber(dfNumber);
itemDto.setYbNumber(ybNumber);
itemDto.setZdNumber(zdNumber);
itemDto.setYhNumber(yhNumber);
itemDto.setCzNumber(czNumber);
}
@ -192,10 +182,7 @@ public class SzRecordService extends BaseService<SzRecordMapper, SzRecord> {
for (SzHiddenDangerModel it : entry.getValue()) {
SzCharItemDto.Series series=new SzCharItemDto.Series();
series.setCount(it.getCount());
if (it != null) {
// 如果非处置状态即全部为隐患状态
series.setType(Objects.equals(it.getHandleStatus(),2)?2:1);
}
series.setType(it.getProblem());
seriesList.add(series);
}
// 设置 y轴

Loading…
Cancel
Save