Browse Source

Merge remote-tracking branch 'origin/master'

main
sjh 1 year ago
parent
commit
b81684c207
  1. 15
      pom.xml
  2. 4
      src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java
  3. 50
      src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java
  4. 14
      src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java
  5. 58
      src/main/java/com/biutag/supervision/controller/work/AlarmNotificationController.java
  6. 14
      src/main/java/com/biutag/supervision/mapper/AlarmNotificationMapper.java
  7. 23
      src/main/java/com/biutag/supervision/mapper/BusinessDepartMapper.java
  8. 15
      src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java
  9. 99
      src/main/java/com/biutag/supervision/mapper/NegativeMapper.java
  10. 100
      src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java
  11. 5
      src/main/java/com/biutag/supervision/mapper/SupDepartMapper.java
  12. 131
      src/main/java/com/biutag/supervision/pojo/entity/AlarmNotification.java
  13. 62
      src/main/java/com/biutag/supervision/pojo/param/AlarmParam.java
  14. 30
      src/main/java/com/biutag/supervision/pojo/vo/BlamePerson.java
  15. 3
      src/main/java/com/biutag/supervision/pojo/vo/GobalMapIconVo.java
  16. 35
      src/main/java/com/biutag/supervision/pojo/vo/ProblemSourceStatisticsVo.java
  17. 31
      src/main/java/com/biutag/supervision/pojo/vo/ProblemSourceVo.java
  18. 2
      src/main/java/com/biutag/supervision/pojo/vo/RankVo.java
  19. 42
      src/main/java/com/biutag/supervision/service/AlarmNotificationService.java
  20. 85
      src/main/java/com/biutag/supervision/service/DataGobalService.java
  21. 42
      src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java
  22. 215
      src/main/java/com/biutag/supervision/service/ProblemSourceService.java
  23. 13
      src/main/java/com/biutag/supervision/util/CompletableUtils/CompletableFutureMine.java
  24. 13
      src/main/java/com/biutag/supervision/util/CompletableUtils/CompletableFutureResult.java
  25. 13
      src/main/java/com/biutag/supervision/util/CompletableUtils/CompletableFutureType.java
  26. 164
      src/main/java/com/biutag/supervision/util/CompletableUtils/CompletableFutureUtil.java
  27. 62
      src/main/resources/logback-spring.xml
  28. 7
      src/main/resources/mapper/AlarmNotificationMapper.xml

15
pom.xml

@ -166,6 +166,11 @@
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.3.140</version>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>4.9</version>
</dependency>
</dependencies>
@ -183,7 +188,17 @@
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<!--打包跳过测试-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>

4
src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java

@ -23,6 +23,10 @@ public enum ProblemSourcesEnum {
XF_QT("其他", "25"),
SJJD("审计监督", "26"),
ZFTZSJ("政府投资审计", "27"),
ZFSACFSS("执法涉案财务审计", "28"),
JJZRSJ("经济责任审计", "29"),
ZXSJ("专项审计", "30"),
JWDC("警务评议", "2"),
JYDC("警意调查", "3"),

50
src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.vo.*;
import com.biutag.supervision.service.DataGobalService;
import com.biutag.supervision.service.DataSupervisionNotifyServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.activation.DataHandler;
@ -35,6 +36,7 @@ public class DataGobalController {
private final DataGobalService dataGobalService;
/**
* 获取数据大屏概览
* @param beginTime
@ -55,45 +57,18 @@ public class DataGobalController {
// 业务类型占比
List<EchartsVo> ywzblist = dataGobalService.getBusinessRate(beginTime, endTime);
// 突出问题排名
List<StrongProblemRank> tcwtlist = dataGobalService.getStrongProblemRank(beginTime, endTime);
// 问题类型占比
List<EchartsVo> wtlxlist = dataGobalService.getProblemRate(beginTime, endTime);
// 突出问题排名
List<StrongProblemRank> tcwtlist = dataGobalService.getStrongProblemRank(beginTime, endTime);
// 地图数据
List<GobalMapIconVo> gobalTempMapVoList = dataGobalService.getMapIconInfo(beginTime, endTime);
if ( gobalTempMapVoList==null || gobalTempMapVoList.size() == 0) {
gobalTempMapVoList = new ArrayList<>();
}
// 地图显示结果
List<GobalMapIconVo> gobalMapVoList = new ArrayList<>();
fxsjlist.forEach(item -> {
// 添加总数
GobalMapIconVo gobalMapVo = new GobalMapIconVo();
gobalMapVo.setName(item.getLabel());
gobalMapVo.setTotalPro(Integer.parseInt(item.getValue()));
gobalMapVoList.add(gobalMapVo);
});
// 市县分局的督察问题
List<CommonVo> superviseProList = dataGobalService.getSuperviseProTotal(beginTime, endTime);
List<CommonVo> caseVerifyProList = dataGobalService.getCaseVerifyProTotal(beginTime, endTime);
List<CommonVo> mailProList = dataGobalService.getMailProTotal(beginTime, endTime);
List<CommonVo> policeProList = dataGobalService.getPoliceProTotal(beginTime, endTime);
List<CommonVo> reviewProList = dataGobalService.getReviewProTotal(beginTime, endTime);
List<GobalMapIconVo> gobalTempMapVoList = new ArrayList<>();
if (!gobalMapVoList.isEmpty()) {
updateProList(superviseProList, gobalMapVoList, GobalMapIconVo::setSupervisePro);
updateProList(caseVerifyProList, gobalMapVoList, GobalMapIconVo::setCaseVerifyPro);
updateProList(mailProList, gobalMapVoList, GobalMapIconVo::setMailPro);
updateProList(policeProList, gobalMapVoList, GobalMapIconVo::setPolicePro);
updateProList(reviewProList, gobalMapVoList, GobalMapIconVo::setReviewPro);
}else {
// gobalTempMapVoList.add(new GobalMapIconVo("芙蓉分局", 1,11,11,11,11,11));
// gobalTempMapVoList.add(new GobalMapIconVo("天心分局", 2,22,22,22,22,22));
// gobalTempMapVoList.add(new GobalMapIconVo("岳麓分局", 3,33,33,33,33,33));
// gobalTempMapVoList.add(new GobalMapIconVo("开福分局", 4,44,44,44,44,44));
// gobalTempMapVoList.add(new GobalMapIconVo("雨花分局", 5,55,55,55,55,55));
// gobalTempMapVoList.add(new GobalMapIconVo("长沙县局", 6,66,66,66,66,66));
// gobalTempMapVoList.add(new GobalMapIconVo("望城分局", 7,77,77,77,77,77));
// gobalTempMapVoList.add(new GobalMapIconVo("宁乡市局", 8,88,88,88,88,88));
// gobalTempMapVoList.add(new GobalMapIconVo("浏阳市局", 9,99,99,99,99,99));
}
JSONObject data = new JSONObject().fluentPut("overview", overview)
.fluentPut("fxsjlist", fxsjlist)
@ -101,8 +76,8 @@ public class DataGobalController {
.fluentPut("ywzblist", ywzblist)
.fluentPut("wtlxlist", wtlxlist)
.fluentPut("tcwtlist", tcwtlist)
.fluentPut("gobalMapVoList", gobalMapVoList)
.fluentPut("gobalTempMapVoList", gobalTempMapVoList);
return Result.success(data);
}
@ -165,4 +140,7 @@ public class DataGobalController {
return Result.success(jsonObject);
}
}

14
src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java

@ -3,6 +3,7 @@ package com.biutag.supervision.controller.datav;
import com.alibaba.fastjson.JSONObject;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.dto.CaseVerifDepart;
import com.biutag.supervision.pojo.vo.EchartsVo;
import com.biutag.supervision.pojo.vo.RankVo;
import com.biutag.supervision.service.DataSupervisionNotifyServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
@ -33,7 +34,7 @@ public class SupervisionNotifyController {
private final DataSupervisionNotifyServiceImpl dataSupervisionNotifyService;
/**
* 获取所有现场督察钟中央总数数量
* 获取现场督察大屏数据
*
* @return
*/
@ -43,14 +44,18 @@ public class SupervisionNotifyController {
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
JSONObject overview = dataSupervisionNotifyService.getAllSupervisionNotifyCount(beginTime, endTime);
JSONObject data = new JSONObject().fluentPut("overview", overview);
//问题类型占比
List<EchartsVo> wtlxList = dataSupervisionNotifyService.getProblemTypeRatio(beginTime, endTime);
//
return Result.success(data);
}
/**
* 获取日常督察排行
*
* @param groupType 分组类型 1: 分县市局 2: 局属单位
* @param groupType 分组类型 1: 分县市局 2: 局属单位
* @return
*/
@Operation(summary = "获取日常督察数量概览和整改率排名")
@ -67,5 +72,8 @@ public class SupervisionNotifyController {
}
}

58
src/main/java/com/biutag/supervision/controller/work/AlarmNotificationController.java

@ -0,0 +1,58 @@
package com.biutag.supervision.controller.work;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.entity.AlarmNotification;
import com.biutag.supervision.pojo.param.AlarmParam;
import com.biutag.supervision.service.AlarmNotificationService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author kami on 2024-11-16 11:30:34
* @version 0.0.1
* @since 1.8
*/
@Slf4j
@RestController
@RequestMapping("/alarm/notification")
@AllArgsConstructor
public class AlarmNotificationController {
private final AlarmNotificationService notificationService;
/**
* 预警通知分页查询
* @param param 请求参数
* @return 预警通知分页数据
*/
@PostMapping("/pages")
public Result<Page<AlarmNotification>> pages(@RequestBody AlarmParam param) {
return Result.success(notificationService.pages(param));
}
/**
* 回复内容
* @param data 数据
* @return 响应
*/
@PostMapping("/reply")
public Result<Void> alarmNotificationReply(@RequestBody AlarmNotification data) {
AlarmNotification notification = new AlarmNotification();
if(data.getId() == null) {
return Result.failed(5000, "未找到对用数据");
}
notification.setId(data.getId());
notification.setReplyResultContent(data.getReplyResultContent());
notification.setReplyState(1);
boolean res = notificationService.updateById(notification);
if(!res) {
return Result.failed(5000, "修改失败");
}
return Result.success();
}
}

14
src/main/java/com/biutag/supervision/mapper/AlarmNotificationMapper.java

@ -0,0 +1,14 @@
package com.biutag.supervision.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.entity.AlarmNotification;
/**
* @author kami on 2024-11-16 11:05:28
* @version 0.0.1
* @since 1.8
*/
@DS("master")
public interface AlarmNotificationMapper extends BaseMapper<AlarmNotification> {
}

23
src/main/java/com/biutag/supervision/mapper/BusinessDepartMapper.java

@ -6,9 +6,32 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.entity.BusinessDepart;
import com.biutag.supervision.pojo.model.BusinessPoliceModel;
import com.biutag.supervision.pojo.vo.ProblemSourceVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface BusinessDepartMapper extends BaseMapper<BusinessDepart> {
Page<BusinessPoliceModel> queryPage(@Param("page") Page<BusinessPoliceModel> page, @Param(Constants.WRAPPER) QueryWrapper<BusinessPoliceModel> queryWrapper);
@Select(" <script> " +
" select depart_id as id,depart_name as name,sum(number) as number from business_depart " +
" where date >= #{time} and business_type in (" +
" <foreach collection='list' separator=',' item='item'> " +
" #{item} " +
" </foreach> " +
" ) group by depart_id "+
" </script> ")
List<ProblemSourceVo> problemStatistics(@Param("list") List<Integer> list, @Param("time") String time);
@Select(" <script> " +
" select sum(number) from business_depart " +
" where date >= #{time} and business_type in (" +
" <foreach collection='list' separator=',' item='item'> " +
" #{item} " +
" </foreach> " +
" ) "+
" </script> ")
Integer problemSum(@Param("list") List<Integer> list, @Param("time") String time);
}

15
src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java

@ -2,6 +2,7 @@ package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.entity.NegativeBlame;
import com.biutag.supervision.pojo.vo.BlamePerson;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDateTime;
@ -26,4 +27,18 @@ public interface NegativeBlameMapper extends BaseMapper<NegativeBlame> {
List<NegativeBlame> selectVerifyTrue();
@Select(" SELECT blameIdCode, blameName, count(1) as number FROM `negative_blame` " +
" where blameIdCode is not null and LENGTH(blameIdCode) > 0 and ivPersonTypeCode = 1 " +
" GROUP BY blameIdCode order by number desc limit 10")
List<BlamePerson> statisticsBlame();
@Select(" SELECT blameIdCode, blameName, count(1) as number FROM `negative_blame` " +
" where blameIdCode is not null and LENGTH(blameIdCode) > 0 and ivPersonTypeCode != 1 " +
" GROUP BY blameIdCode order by number desc limit 10")
List<BlamePerson> statisticsBlame2();
@Select(" SELECT leadIdCode as blameIdCode, leadName as blameName, count(1) as number FROM `negative_blame` " +
" where leadIdCode is not null and LENGTH(leadIdCode) > 0 " +
" GROUP BY leadIdCode order by number desc limit 10")
List<BlamePerson> statisticsBlame3();
}

99
src/main/java/com/biutag/supervision/mapper/NegativeMapper.java

@ -45,6 +45,63 @@ public interface NegativeMapper extends BaseMapper<Negative> {
"GROUP BY monthTime " +
"order BY monthTime asc")
List<RecentTrendByMonthVo> selectRecentTrendByMonth(String year);
@Select("SELECT count(*) FROM negative ng INNER JOIN " +
" (" +
" SELECT sd.id, sd.pid, sd.name, sd1.short_name FROM sup_depart sd " +
" INNER join sup_depart sd1 on sd.pid=sd1.id " +
" and sd1.LEVEL=2 AND sd1.statistics_group_id=3" +
" ) " +
"as temp on ng.involveDepartId=temp.id " +
"AND ng.checkStatus<>3 AND problemSourcesCode in (13, 15, 16) " +
"AND temp.pid=#{departId} AND discoveryTime BETWEEN #{beginTime} AND #{endTime}")
Integer seleGobalMapIconInfoDc(Date beginTime, Date endTime, Integer departId);
@Select("SELECT count(*) FROM negative ng INNER JOIN " +
" (" +
" SELECT sd.id, sd.pid, sd.name, sd1.short_name FROM sup_depart sd " +
" INNER join sup_depart sd1 on sd.pid=sd1.id " +
" and sd1.LEVEL=2 AND sd1.statistics_group_id=3" +
" ) " +
"as temp on ng.involveDepartId=temp.id " +
"AND ng.checkStatus<>3 AND problemSourcesCode=11 " +
"AND temp.pid=#{departId} AND discoveryTime BETWEEN #{beginTime} AND #{endTime}")
Integer seleGobalMapIconInfoAjhc(Date beginTime, Date endTime, Integer departId);
@Select("SELECT count(*) FROM negative ng INNER JOIN " +
" (" +
" SELECT sd.id, sd.pid, sd.name, sd1.short_name FROM sup_depart sd " +
" INNER join sup_depart sd1 on sd.pid=sd1.id " +
" and sd1.LEVEL=2 AND sd1.statistics_group_id =3 " +
" ) " +
"as temp on ng.involveDepartId=temp.id " +
"AND ng.checkStatus<>3 AND problemSourcesCode in (21, 22, 23, 24, 25) " +
"AND temp.pid=#{departId} AND discoveryTime BETWEEN #{beginTime} AND #{endTime}")
Integer seleGobalMapIconInfoXf(Date beginTime, Date endTime, Integer departId);
@Select("SELECT count(*) FROM negative ng INNER JOIN " +
" (" +
" SELECT sd.id, sd.pid, sd.name, sd1.short_name FROM sup_depart sd " +
" INNER join sup_depart sd1 on sd.pid=sd1.id " +
" and sd1.LEVEL=2 AND sd1.statistics_group_id =3 " +
" ) " +
"as temp on ng.involveDepartId=temp.id " +
"AND ng.checkStatus<>3 AND problemSourcesCode=2 " +
"AND temp.pid=#{departId} AND discoveryTime BETWEEN #{beginTime} AND #{endTime}")
Integer seleGobalMapIconInfoJwpy(Date beginTime, Date endTime, Integer departId);
@Select("SELECT count(*) FROM negative ng INNER JOIN " +
" (" +
" SELECT sd.id, sd.pid, sd.name, sd1.short_name FROM sup_depart sd " +
" INNER join sup_depart sd1 on sd.pid=sd1.id " +
" and sd1.LEVEL=2 AND sd1.statistics_group_id =3 " +
" ) " +
"as temp on ng.involveDepartId=temp.id " +
"AND ng.checkStatus<>3 AND problemSourcesCode=26 " +
"AND temp.pid=#{departId} AND discoveryTime BETWEEN #{beginTime} AND #{endTime}")
Integer seleGobalMapIconInfoSjdc(Date beginTime, Date endTime, Integer departId);
// endregion
@ -92,18 +149,12 @@ public interface NegativeMapper extends BaseMapper<Negative> {
Long selectRelationOrgCount(Date beginTime, Date endTime, String checkStatus);
@Select("SELECT COUNT(*) FROM negative n " +
"INNER JOIN ( " +
" SELECT DISTINCT sd.id " +
" FROM sup_depart sd " +
" INNER JOIN sup_depart sd1 ON sd.pid = sd1.id " +
" WHERE sd1.statistics_group_id = #{groupType}" +
") AS filtered_sd ON n.involveDepartId = filtered_sd.id " +
"WHERE n.checkStatus = 1 " +
"AND n.problemSourcesCode = 15;")
Long getCountByGroupType(Integer groupType, Date beginTime, Date endTime);
/**
* 获取现场督察按二级机构分组和整改状态划分的的问题数
*/
@Select("SELECT COUNT(*) FROM negative n " +
"INNER JOIN ( " +
" SELECT DISTINCT sd.id " +
@ -112,12 +163,38 @@ public interface NegativeMapper extends BaseMapper<Negative> {
" WHERE sd1.statistics_group_id = #{groupType}" +
") AS filtered_sd ON n.involveDepartId = filtered_sd.id " +
"WHERE n.checkStatus = 1 " +
"AND n.problemSourcesCode = 15 " +
"AND n.problemSourcesCode = 13 " +
"AND n.isRectifyCode=#{isRectify} " +
"AND n.discoveryTime BETWEEN #{beginTime} AND #{endTime}")
Long getChangCountByGroupType(Integer groupType, Date beginTime, Date endTime, Integer isRectify);
@Select("SELECT count(*) FROM negative ng INNER JOIN " +
"(SELECT sd.id, sd.pid, sd.`name`, sd1.short_name FROM sup_depart sd INNER JOIN sup_depart sd1 " +
"ON sd.pid = sd1.id AND sd1.`level`=2 AND sd1.statistics_group_id=3) as temp " +
"ON ng.involveDepartId=temp.id " +
"AND pid=#{departId} " +
"AND problemSourcesCode= 13 " +
"AND checkStatus <> 3 " +
"AND isRectifyCode =1 " +
"AND discoveryTime BETWEEN #{beginTime} AND #{endTime}")
Long getChangedCountByGroupType(Date beginTime, Date endTime, String departId);
@Select("SELECT count(*) FROM negative ng INNER JOIN " +
"(SELECT sd.id, sd.pid, sd.`name`, sd1.short_name FROM sup_depart sd INNER JOIN sup_depart sd1 " +
"ON sd.pid = sd1.id AND sd1.`level`=2 AND sd1.statistics_group_id=3) as temp\n" +
"ON ng.involveDepartId=temp.id " +
"AND pid=#{departId} " +
"AND problemSourcesCode= 13 " +
"AND isRectifyCode =1 " +
"AND discoveryTime BETWEEN #{beginTime} AND #{endTime}")
Long getCountByGroupType(Date beginTime, Date endTime, String departId);
// endregion
}

100
src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java

@ -13,77 +13,41 @@ import java.util.List;
public interface NegativeProblemRelationMapper extends BaseMapper<NegativeProblemRelation> {
@Select("SELECT npr.oneLevelContent as name, count(*) value " +
"FROM negative_problem_relation npr " +
"WHERE npr.oneLevelContent is not NULL " +
"GROUP BY `name` ")
/**
* 首页大屏问题类型占比
* @param beginTime
* @param endTime
* @return
*/
@Select("SELECT npr.oneLevelContent as name, count(*) `value` FROM negative_problem_relation npr INNER JOIN " +
" ( " +
" SELECT id FROM negative ng " +
" WHERE checkStatus <>3 " +
" AND discoveryTime BETWEEN #{beginTime} AND #{endTime} " +
" ) as temp " +
"on npr.negativeId=temp.id " +
"AND npr.oneLevelContent is not NULL " +
"GROUP BY npr.oneLevelContent " +
"ORDER BY `value` desc")
List<EchartsVo> selectProblemRate(Date beginTime, Date endTime);
@Select("SELECT threeLevelContent as label, count(*) as `value` " +
"FROM negative_problem_relation " +
"WHERE negativeId " +
"in ( SELECT id FROM negative WHERE discoveryTime BETWEEN #{beginTime} AND #{endTime}) " +
"GROUP BY threeLevelContent " +
"ORDER BY VALUE DESC ")
/**
* 首页大屏突出问题排名
* @param beginTime
* @param endTime
* @return
*/
@Select("SELECT npr.threeLevelContent as label, count(*) `value` FROM negative_problem_relation npr INNER JOIN " +
" ( " +
" SELECT id FROM negative ng " +
" WHERE checkStatus <>3 " +
" AND discoveryTime BETWEEN #{beginTime} AND #{endTime} " +
" ) as temp " +
"on npr.negativeId=temp.id " +
"AND npr.threeLevelContent is not NULL " +
"GROUP BY npr.threeLevelContent " +
"ORDER BY `value` desc")
List<StrongProblemRank> selectStrongProblemRank(Date beginTime, Date endTime);
@Select("SELECT sd1.short_name, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 " +
"AND checkStatus=1 AND problemSourcesCode in(13, 14, 15, 16) " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=3\n" +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC;")
List<CommonVo> selectSuperviseProTotal(Date beginTime, Date endTime);
@Select("SELECT sd1.short_name, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 " +
"AND checkStatus=1 AND problemSourcesCode in(17, 18, 19, 20) " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=3\n" +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC;")
List<CommonVo> selectCaseVerifyProTotal(Date beginTime, Date endTime);
@Select("SELECT sd1.short_name, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 " +
"AND checkStatus=1 AND problemSourcesCode in(21, 22, 23, 24, 25) " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=3\n" +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC;")
List<CommonVo> selectMailProTotal(Date beginTime, Date endTime);
@Select("SELECT sd1.short_name, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 " +
"AND checkStatus=1 AND problemSourcesCode in(2) " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=3\n" +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC;")
List<CommonVo> selectPoliceProTotal(Date beginTime, Date endTime);
@Select("SELECT sd1.short_name, count(*) value " +
"FROM negative ng " +
"INNER JOIN sup_depart sd " +
"on ng.involveDepartId=sd.id AND sd.`level`=3 " +
"AND checkStatus=1 AND problemSourcesCode in(26) " +
"AND ng.discoveryTime BETWEEN #{beginTime} and #{endTime}" +
"INNER JOIN sup_depart sd1 " +
"on sd.pid=sd1.id and sd1.statistics_group_id=3\n" +
"GROUP BY sd1.id " +
"ORDER BY `value` DESC;")
List<CommonVo> selectReviewProTotal(Date beginTime, Date endTime);
}

5
src/main/java/com/biutag/supervision/mapper/SupDepartMapper.java

@ -32,6 +32,11 @@ public interface SupDepartMapper extends BaseMapper<SupDepart> {
List<Map<String, Object>> getIdsByCode(List<String> departIds);
/**
* 按分组查询单位
* @param groupType
* @return
*/
@Select("select * from sup_depart where statistics_group_id = #{groupType} ")
List<SupDepart> selectDepartsByGroupType(Integer groupType);
}

131
src/main/java/com/biutag/supervision/pojo/entity/AlarmNotification.java

@ -0,0 +1,131 @@
package com.biutag.supervision.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 预警通知
* @author kami on 2024-11-16 10:51:18
* @version 0.0.1
* @since 1.8
*/
@Data
@TableName("`alarm_notification`")
public class AlarmNotification implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private String id;
/**
* 预警时间
*/
@TableField("`alarm_time`")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
LocalDateTime alarmTime;
@TableField("`alarm_type_id`")
Long alarmTypeId;
/**
* 预警类型
*/
@TableField("`alarm_type`")
String alarmType;
/**
* 被通知单位机构代码
*/
@TableField("`notification_depart_code`")
String notificationDepartCode;
/**
* 被通知单位机构名称
*/
@TableField("`notification_depart_name`")
String notificationDepartName;
/**
* 通知内容
*/
@TableField("`alarm_content`")
String alarmContent;
/**
* 回复状态0未回复1已回复
*/
@TableField("`reply_state`")
Integer replyState;
/**
* 回复情况内容
*/
@TableField("`reply_result_content`")
String replyResultContent;
/**
* 创建时间
*/
@TableField("`crt_time`")
LocalDateTime crtTime;
/**
* 创建用户
*/
@TableField("`crt_user`")
String crtUser;
/**
* 创建单位
*/
@TableField("`crt_depart_id`")
String crtDepartId;
/**
* 创建人名称
*/
@TableField("`crt_name`")
String crtName;
/**
* 创建ip
*/
@TableField("`crt_host`")
String crtHost;
/**
* 创建用户
*/
@TableField("`upd_user`")
String updUser;
/**
* 创建单位
*/
@TableField("`upd_depart_id`")
String updDepartId;
/**
* 创建人名称
*/
@TableField("`upd_name`")
String updName;
/**
* 创建ip
*/
@TableField("`upd_host`")
String updHost;
/**
* 修改时间
*/
@TableField("`upd_time`")
LocalDateTime updTime;
}

62
src/main/java/com/biutag/supervision/pojo/param/AlarmParam.java

@ -0,0 +1,62 @@
package com.biutag.supervision.pojo.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author kami on 2024-11-16 11:12:34
* @version 0.0.1
* @since 1.8
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class AlarmParam extends BasePage implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 预警类型id
*/
Long alarmTypeId;
/**
* 预警开始时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
LocalDateTime startTime;
/**
* 预警开始时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
LocalDateTime endTime;
/**
* 回复情况0-未回复 1-已回复
*/
Integer replyState;
/**
* 被通知单位机构编码
*/
String notificationDepartCode;
/**
* 回复情况
*/
String alarmContent;
}

30
src/main/java/com/biutag/supervision/pojo/vo/BlamePerson.java

@ -0,0 +1,30 @@
package com.biutag.supervision.pojo.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
/**
* @author kami on 2024-11-16 17:28:03
* @version 0.0.1
* @since 1.8
*/
@Data
@Builder
@Slf4j
@AllArgsConstructor
@NoArgsConstructor(force = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BlamePerson implements Serializable {
String blameIdCode;
String blameName;
Integer number;
}

3
src/main/java/com/biutag/supervision/pojo/vo/GobalMapIconVo.java

@ -1,6 +1,7 @@
package com.biutag.supervision.pojo.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -12,6 +13,7 @@ import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GobalMapIconVo {
private String name; // 分县市局名称
@ -21,6 +23,7 @@ public class GobalMapIconVo {
private Integer mailPro; // 信访投诉问题
private Integer policePro; // 警务评议问题
private Integer reviewPro; // 审计监督问题
private Integer departId; // 分县市局ID
}

35
src/main/java/com/biutag/supervision/pojo/vo/ProblemSourceStatisticsVo.java

@ -0,0 +1,35 @@
package com.biutag.supervision.pojo.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
/**
* @author kami on 2024-11-16 15:06:25
* @version 0.0.1
* @since 1.8
*/
@Data
@Builder
@Slf4j
@AllArgsConstructor
@NoArgsConstructor(force = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ProblemSourceStatisticsVo implements Serializable {
Integer aTotal;
Integer caseTotal;
Integer negativeTotal;
Integer peopleCount;
Double avgPeople;
}

31
src/main/java/com/biutag/supervision/pojo/vo/ProblemSourceVo.java

@ -0,0 +1,31 @@
package com.biutag.supervision.pojo.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
/**
* @author kami on 2024-11-16 15:06:25
* @version 0.0.1
* @since 1.8
*/
@Data
@Builder
@Slf4j
@AllArgsConstructor
@NoArgsConstructor(force = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ProblemSourceVo implements Serializable {
String name;
String id;
Integer number;
}

2
src/main/java/com/biutag/supervision/pojo/vo/RankVo.java

@ -12,7 +12,7 @@ public class RankVo {
private String label; // 部门名称
private String departId; // 部门id
private Integer value; // 数量
private Double value; // 整改率
private Double rate; // 整改率
private String numerator; // 分子 已整改
private String denominator; // 分母 问题数

42
src/main/java/com/biutag/supervision/service/AlarmNotificationService.java

@ -0,0 +1,42 @@
package com.biutag.supervision.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.mapper.AlarmNotificationMapper;
import com.biutag.supervision.pojo.entity.AlarmNotification;
import com.biutag.supervision.pojo.entity.BaseUser;
import com.biutag.supervision.pojo.model.UserModel;
import com.biutag.supervision.pojo.param.AlarmParam;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
/**
* @author kami on 2024-11-16 11:07:43
* @version 0.0.1
* @since 1.8
*/
@Service
public class AlarmNotificationService extends ServiceImpl<AlarmNotificationMapper, AlarmNotification> {
public Page<AlarmNotification> pages(AlarmParam param) {
LambdaQueryWrapper<AlarmNotification> query = new LambdaQueryWrapper<AlarmNotification>();
if(param.getAlarmTypeId() != null && param.getAlarmTypeId() != -1) {
query.eq(AlarmNotification::getAlarmTypeId, param.getAlarmTypeId());
}
if(param.getStartTime() != null) {
query.between(AlarmNotification::getAlarmTime, param.getStartTime(), param.getEndTime());
}
if(param.getReplyState() != null && param.getReplyState() != -1) {
query.eq(AlarmNotification::getReplyState, param.getReplyState());
}
if(param.getNotificationDepartCode() != null) {
query.eq(AlarmNotification::getNotificationDepartCode, param.getNotificationDepartCode());
}
if(param.getAlarmContent() != null) {
query.like(AlarmNotification::getAlarmContent, param.getAlarmContent());
}
return page(Page.of(param.getCurrent(), param.getSize()), query.orderByDesc(AlarmNotification::getAlarmTime));
}
}

85
src/main/java/com/biutag/supervision/service/DataGobalService.java

@ -3,18 +3,17 @@ package com.biutag.supervision.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.biutag.supervision.constants.enums.InspectCaseEnum;
import com.biutag.supervision.mapper.DataCaseVerifMapper;
import com.biutag.supervision.mapper.DataSupervisionNotifyMapper;
import com.biutag.supervision.mapper.NegativeMapper;
import com.biutag.supervision.mapper.NegativeProblemRelationMapper;
import com.biutag.supervision.mapper.*;
import com.biutag.supervision.pojo.dto.CaseVerifDepart;
import com.biutag.supervision.pojo.entity.DataCaseVerif;
import com.biutag.supervision.pojo.entity.DataSupervisionNotify;
import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.pojo.vo.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -31,6 +30,7 @@ public class DataGobalService {
private final NegativeMapper negativeMapper;
private final NegativeProblemRelationMapper negativeProblemRelationMapper;
private final SupDepartMapper supDepartMapper;
/**
* 获取所有大屏统计数据
@ -43,36 +43,36 @@ public class DataGobalService {
// 督察问题数量(查实版本)
Long supervisionPro = getCountByConditions(
Integer.parseInt(InspectCaseEnum.TRUE.getValue()),
Integer.parseInt(InspectCaseEnum.FALSE.getValue()),
beginTime, endTime,
13, 15, 16);
// 获取案件核查问题数量(查实版本)
Long caseVerificationPro = getCountByConditions(
Integer.parseInt(InspectCaseEnum.TRUE.getValue()),
Integer.parseInt(InspectCaseEnum.FALSE.getValue()),
beginTime, endTime,
17, 18, 19, 20);
// 信访投诉问题数量(查实版本)
Long complaintPro = getCountByConditions(
Integer.parseInt(InspectCaseEnum.TRUE.getValue()),
Integer.parseInt(InspectCaseEnum.FALSE.getValue()),
beginTime, endTime,
21, 22, 23, 24, 25);
// 警务评议问题数量(查实版本)
Long reviewPro = getCountByConditions(
Integer.parseInt(InspectCaseEnum.TRUE.getValue()),
Long talkPro = getCountByConditions(
Integer.parseInt(InspectCaseEnum.FALSE.getValue()),
beginTime, endTime,
2);
// 审计监督问题数量(查实版本)
Long auditPro = getCountByConditions(
Integer.parseInt(InspectCaseEnum.TRUE.getValue()),
Integer.parseInt(InspectCaseEnum.FALSE.getValue()),
beginTime, endTime,
26);
Long totalPro = caseVerificationPro + supervisionPro + complaintPro + reviewPro + auditPro;
Long totalPro = caseVerificationPro + supervisionPro + complaintPro + talkPro + auditPro;
JSONObject overview = new JSONObject();
overview.fluentPut("totalPro", totalPro)
.fluentPut("caseVerificationPro", caseVerificationPro)
.fluentPut("supervisionPro", supervisionPro)
.fluentPut("caseVerificationPro", caseVerificationPro)
.fluentPut("complaintPro", complaintPro)
.fluentPut("reviewPro", reviewPro)
.fluentPut("talkPro", talkPro)
.fluentPut("auditPro", auditPro);
return overview;
}
@ -80,6 +80,7 @@ public class DataGobalService {
/**
* 查询核查属实的公共方法
*
* @param checkStatus 检查状态
* @param startTime 开始时间
* @param endTime 结束时间
@ -88,7 +89,7 @@ public class DataGobalService {
*/
public Long getCountByConditions(Integer checkStatus, Date startTime, Date endTime, Integer... problemSourcesCodes) {
QueryWrapper<Negative> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("checkStatus", checkStatus)
queryWrapper.ne("checkStatus", checkStatus)
.between("discoveryTime", startTime, endTime)
.and(wrapper -> {
for (int i = 0; i < problemSourcesCodes.length; i++) {
@ -107,24 +108,25 @@ public class DataGobalService {
return res;
}
public List<EchartsVo> getBusinessRate(Date beginTime,Date endTime) {
List<EchartsVo> res= negativeMapper.selectBusinessRate(beginTime, endTime);
public List<EchartsVo> getBusinessRate(Date beginTime, Date endTime) {
List<EchartsVo> res = negativeMapper.selectBusinessRate(beginTime, endTime);
return res;
}
public List<RecentTrendByMonthVo> getGobalRecentlyTrendByMonth(String year) {
List<RecentTrendByMonthVo> res = negativeMapper.selectRecentTrendByMonth(year);
List<RecentTrendByMonthVo> res = negativeMapper.selectRecentTrendByMonth(year);
return res;
}
/**
* 获取问题类型占比
*
* @param beginTime
* @param endTime
* @return
*/
public List<EchartsVo> getProblemRate(Date beginTime, Date endTime) {
List<EchartsVo> res = negativeProblemRelationMapper.selectProblemRate(beginTime, endTime);
List<EchartsVo> res = negativeProblemRelationMapper.selectProblemRate(beginTime, endTime);
return res;
}
@ -134,36 +136,39 @@ public class DataGobalService {
*/
public List<StrongProblemRank> getStrongProblemRank(Date beginTime, Date endTime) {
// 1.获取这段时间的negative id
List<StrongProblemRank> res= negativeProblemRelationMapper.selectStrongProblemRank(beginTime, endTime);
List<StrongProblemRank> res = negativeProblemRelationMapper.selectStrongProblemRank(beginTime, endTime);
for (int i = 1; i <= res.size(); i++) {
res.get(i - 1).setSort(i);
}
return res;
}
public List<CommonVo> getSuperviseProTotal(Date beginTime, Date endTime) {
List<CommonVo> res= negativeProblemRelationMapper.selectSuperviseProTotal(beginTime, endTime);
return res;
}
public List<CommonVo> getCaseVerifyProTotal(Date beginTime, Date endTime) {
List<CommonVo> res= negativeProblemRelationMapper.selectCaseVerifyProTotal(beginTime, endTime);
return res;
}
public List<CommonVo> getMailProTotal(Date beginTime, Date endTime) {
List<CommonVo> res= negativeProblemRelationMapper.selectMailProTotal(beginTime, endTime);
return res;
}
public List<CommonVo> getPoliceProTotal(Date beginTime, Date endTime) {
List<CommonVo> res= negativeProblemRelationMapper.selectPoliceProTotal(beginTime, endTime);
return res;
}
public List<CommonVo> getReviewProTotal(Date beginTime, Date endTime) {
List<CommonVo> res= negativeProblemRelationMapper.selectReviewProTotal(beginTime, endTime);
public List<GobalMapIconVo> getMapIconInfo(Date beginTime, Date endTime) {
List<GobalMapIconVo> res = new ArrayList<>();
List<SupDepart> supDeparts = supDepartMapper.selectDepartsByGroupType(3);
for (SupDepart supDepart : supDeparts) {
GobalMapIconVo mapIconVo = new GobalMapIconVo();
mapIconVo.setName(supDepart.getShortName());
mapIconVo.setDepartId(Integer.parseInt(supDepart.getId()));
res.add(mapIconVo);
}
for (GobalMapIconVo re : res) {
Integer departId = re.getDepartId();
Integer supervisePro = negativeMapper.seleGobalMapIconInfoDc(beginTime, endTime, departId);
Integer caseVerifyPro = negativeMapper.seleGobalMapIconInfoAjhc(beginTime, endTime, departId);
Integer mailPro = negativeMapper.seleGobalMapIconInfoXf(beginTime, endTime, departId);
Integer policePro = negativeMapper.seleGobalMapIconInfoJwpy(beginTime, endTime, departId);
Integer reviewPro = negativeMapper.seleGobalMapIconInfoSjdc(beginTime, endTime, departId);
Integer totalPro = supervisePro + caseVerifyPro + mailPro + policePro + reviewPro;
re.setTotalPro(totalPro != null ? totalPro : 0);
re.setSupervisePro(supervisePro != null ? supervisePro : 0);
re.setCaseVerifyPro(caseVerifyPro != null ? caseVerifyPro : 0);
re.setMailPro(mailPro != null ? mailPro : 0);
re.setPolicePro(policePro != null ? policePro : 0);
re.setReviewPro(reviewPro != null ? reviewPro : 0);
}
return res;
}
}

42
src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java

@ -16,6 +16,7 @@ import com.biutag.supervision.pojo.entity.DataSupervisionNotify;
import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.entity.NegativeBlame;
import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.pojo.vo.EchartsVo;
import com.biutag.supervision.pojo.vo.RankVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@ -23,6 +24,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author 舒云
@ -69,7 +71,7 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
* 2查出集合在blame中的涉及人数
*/
QueryWrapper<Negative> preQueryWrapper = new QueryWrapper<>();
preQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue());
preQueryWrapper.in("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue(), ProblemSourcesEnum.ZXDC.getValue());
List<Negative> negatives = negativeMapper.selectList(preQueryWrapper);
Long supervisionNotifyPreTotal = 0L;
@ -81,8 +83,6 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
}
// 整改率
double correctionRate = supervisionNotifyTotal != 0 ? (supervisionNotifyChangedTotal * 1.0 / supervisionNotifyTotal) * 100 : 0;
JSONObject jsonObject = new JSONObject();
jsonObject.fluentPut("supervisionNotifyTotal", supervisionNotifyTotal)
.fluentPut("supervisionNotifyOrgTotal", supervisionNotifyOrgTotal)
@ -103,10 +103,9 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
* @return
*/
public JSONObject getDailySupervisionCount(Integer groupType, Date beginTime, Date endTime) {
Long proTotal = negativeMapper.getCountByGroupType(groupType, beginTime, endTime);
Long changing = negativeMapper.getChangCountByGroupType(groupType, beginTime, endTime, 0);
Long changed = negativeMapper.getChangCountByGroupType(groupType, beginTime, endTime, 1);
Long proTotal = changed + changing;
// 整改率
double correctionRate = proTotal != 0 ? (changed * 1.0 / proTotal) * 100 : 0;
JSONObject res = new JSONObject()
@ -126,10 +125,39 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl<DataSupervisio
* @return
*/
public List<RankVo> getChangedRateRank(Integer groupType, Date beginTime, Date endTime) {
List<RankVo> rankVos = new ArrayList<>();
List<RankVo> rankVoRes = new ArrayList<>();
// 所有分局部门
List<SupDepart> departs = supDepartMapper.selectDepartsByGroupType(groupType);
// negativeMapper.select
for (SupDepart depart : departs) {
RankVo rankVo = new RankVo();
rankVo.setLabel(depart.getShortName());
rankVo.setDepartId(depart.getId());
rankVoRes.add(rankVo);
}
for (RankVo rankVoRe : rankVoRes) {
String departId = rankVoRe.getDepartId();
Long changed = negativeMapper.getChangedCountByGroupType(beginTime, endTime, departId);
Long totalPro = negativeMapper.getCountByGroupType(beginTime, endTime, departId);
totalPro = totalPro == null ? 0L : totalPro;
changed = changed == null ? 0L : changed;
rankVoRe.setDenominator(totalPro.toString());
rankVoRe.setNumerator(changed.toString());
Double rate = totalPro != 0 ? (changed * 1.0 / totalPro) * 100 : 0;
int intRate = (int) Math.ceil(rate);
rankVoRe.setRate((double) intRate);
rankVoRe.setDenominator(totalPro.toString());
rankVoRe.setNumerator(changed.toString());
rankVoRe.setRate(rate);
rankVoRe.setValue(rate);
}
// 使用 Stream API 进行排序
rankVoRes = rankVoRes.stream().sorted((o1, o2) -> o2.getRate().compareTo(o1.getRate())).collect(Collectors.toList());
// 排序
return rankVoRes;
}
public List<EchartsVo> getProblemTypeRatio(Date beginTime, Date endTime) {
List<EchartsVo> echartsVos = new ArrayList<>();
return null;
}

215
src/main/java/com/biutag/supervision/service/ProblemSourceService.java

@ -0,0 +1,215 @@
package com.biutag.supervision.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.biutag.supervision.mapper.*;
import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.vo.BlamePerson;
import com.biutag.supervision.pojo.vo.ProblemSourceStatisticsVo;
import com.biutag.supervision.pojo.vo.ProblemSourceVo;
import com.biutag.supervision.util.CompletableUtils.CompletableFutureUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 灵敏感知大屏
*
* @author kami on 2024-11-16 15:04:16
* @version 0.0.1
* @since 1.8
*/
@Slf4j
@Service
@AllArgsConstructor
public class ProblemSourceService {
private final BusinessDepartMapper businessDepartMapper;
private final NegativeMapper negativeMapper;
private final NegativeBlameMapper blameMapper;
/**
* 数量统计
*
* @return 统计结构
*/
public ProblemSourceStatisticsVo totalStatistics() {
ProblemSourceStatisticsVo.ProblemSourceStatisticsVoBuilder build = ProblemSourceStatisticsVo.builder();
CompletableFuture.allOf(
CompletableFutureUtil.runSyncObject(() -> build.aTotal(businessDepartMapper.problemSum(List.of(1, 2), "2024-01-01 00:00:00"))),
CompletableFutureUtil.runSyncObject(() -> build.caseTotal(businessDepartMapper.problemSum(List.of(4, 5, 6), "2024-01-01 00:00:00"))),
CompletableFutureUtil.runSyncObject(() -> build.negativeTotal(negativeMapper.selectCount(new LambdaQueryWrapper<Negative>().in(Negative::getCheckStatus, List.of(1, 2))).intValue()))
).join();
List<NegativeBlame> list = blameMapper.selectList(new LambdaQueryWrapper<NegativeBlame>().select(NegativeBlame::getBlameIdCode));
Long count = list.stream().map(NegativeBlame::getBlameIdCode).distinct().count();
build.peopleCount(count.intValue());
ProblemSourceStatisticsVo vo = build.build();
vo.setAvgPeople(new BigDecimal(vo.getNegativeTotal().toString()).divide(new BigDecimal(vo.getPeopleCount().toString()), 2, RoundingMode.UP).doubleValue());
return vo;
}
private final SupDepartMapper supDepartMapper;
/**
* @param type 类型 1- 风险值 2- 问题数 3-问题发生率
* @param businessType
*/
public void rankStatistics(Integer type, Integer businessType) {
List<SupDepart> departs = supDepartMapper.selectList(new LambdaQueryWrapper<SupDepart>()
.select(SupDepart::getId, SupDepart::getPid, SupDepart::getName, SupDepart::getLevel));
Map<String, SupDepart> departMap = departs.stream().collect(Collectors.toMap(SupDepart::getId, Function.identity(), (oldValue, newValue) -> newValue));
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>()
.in(Negative::getCheckStatus, List.of(1, 2)));
Map<String, Integer> mapLevel3 = new HashMap<>();
Map<String, Integer> mapLevel2 = new HashMap<>();
for (Negative negative : negatives) {
SupDepart depart = departMap.get(negative.getInvolveDepartId());
if (depart == null) {
continue;
}
if (depart.getLevel() == 3) {
Integer count = Optional.ofNullable(mapLevel3.get(negative.getInvolveDepartId())).orElse(0);
count++;
mapLevel3.put(negative.getInvolveDepartId(), count);
depart = departMap.get(depart.getPid());
}
if (depart.getLevel() == 2) {
Integer count = Optional.ofNullable(mapLevel2.get(negative.getInvolveDepartId())).orElse(0);
count++;
mapLevel2.put(negative.getInvolveDepartId(), count);
}
}
}
private final StatisticsGroupMapper statisticsGroupMapper;
private final StatisticsDepartMapper departMapper;
public void statisticsGroupRank() {
StatisticsGroup group = statisticsGroupMapper.selectOne(new LambdaQueryWrapper<StatisticsGroup>()
.eq(StatisticsGroup::getName, "交警大队").last("limit 1"));
List<StatisticsDepart> list = departMapper.selectList(new LambdaQueryWrapper<StatisticsDepart>()
.eq(StatisticsDepart::getLevel, 3)
.eq(StatisticsDepart::getGroupId, group.getGroupId()));
Map<String, StatisticsDepart> departMap = list.stream().collect(Collectors.toMap(StatisticsDepart::getDepartId, Function.identity(), (oldValue, newValue) -> newValue));
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>()
.in(Negative::getCheckStatus, List.of(1, 2)));
Map<String, Integer> mapLevel3 = new HashMap<>();
for (Negative negative : negatives) {
if (departMap.get(negative.getInvolveDepartId()) == null) {
continue;
}
Integer count = Optional.ofNullable(mapLevel3.get(negative.getInvolveDepartId())).orElse(0);
count++;
mapLevel3.put(negative.getInvolveDepartId(), count);
}
for (Map.Entry<String, Integer> entry : mapLevel3.entrySet()) {
log.info("机构:{} | {}", departMap.get(entry.getKey()).getName(), entry.getValue());
}
}
/**
* 派出所
*/
public void statisticsGroupRank2() {
StatisticsGroup group = statisticsGroupMapper.selectOne(new LambdaQueryWrapper<StatisticsGroup>()
.eq(StatisticsGroup::getName, "派出所").last("limit 1"));
List<StatisticsDepart> list = departMapper.selectList(new LambdaQueryWrapper<StatisticsDepart>()
.eq(StatisticsDepart::getLevel, 3)
.eq(StatisticsDepart::getGroupId, group.getGroupId()));
Map<String, StatisticsDepart> departMap = list.stream().collect(Collectors.toMap(StatisticsDepart::getDepartId, Function.identity(), (oldValue, newValue) -> newValue));
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>()
.in(Negative::getCheckStatus, List.of(1, 2)));
Map<String, Integer> mapLevel3 = new HashMap<>();
for (Negative negative : negatives) {
if (departMap.get(negative.getInvolveDepartId()) == null) {
continue;
}
Integer count = Optional.ofNullable(mapLevel3.get(negative.getInvolveDepartId())).orElse(0);
count++;
mapLevel3.put(negative.getInvolveDepartId(), count);
}
for (Map.Entry<String, Integer> entry : mapLevel3.entrySet()) {
log.info("机构:{} | {}", departMap.get(entry.getKey()).getName(), entry.getValue());
}
}
// 分县
public void statisticsGroupRank3() {
StatisticsGroup group = statisticsGroupMapper.selectOne(new LambdaQueryWrapper<StatisticsGroup>()
.eq(StatisticsGroup::getName, "派出所").last("limit 1"));
List<StatisticsDepart> list = departMapper.selectList(new LambdaQueryWrapper<StatisticsDepart>()
.eq(StatisticsDepart::getLevel, 3)
.eq(StatisticsDepart::getGroupId, group.getGroupId()));
Map<String, StatisticsDepart> departMap = list.stream().collect(Collectors.toMap(StatisticsDepart::getDepartId, Function.identity(), (oldValue, newValue) -> newValue));
List<SupDepart> departs = supDepartMapper.selectList(new LambdaQueryWrapper<SupDepart>()
.eq(SupDepart::getLevel, 2)
.select(SupDepart::getId, SupDepart::getPid, SupDepart::getName, SupDepart::getLevel));
Map<String, SupDepart> areaMap = departs.stream().collect(Collectors.toMap(SupDepart::getId, Function.identity(), (oldValue, newValue) -> newValue));
List<Negative> negatives = negativeMapper.selectList(new LambdaQueryWrapper<Negative>()
.in(Negative::getCheckStatus, List.of(1, 2)));
Map<String, Integer> mapLevel3 = new HashMap<>();
for (Negative negative : negatives) {
StatisticsDepart depart = departMap.get(negative.getInvolveDepartId());
if (depart == null) {
continue;
}
SupDepart area = areaMap.get(depart.getPid());
if (area == null) {
continue;
}
Integer count = Optional.ofNullable(mapLevel3.get(area.getId())).orElse(0);
count++;
mapLevel3.put(negative.getInvolveDepartId(), count);
}
for (Map.Entry<String, Integer> entry : mapLevel3.entrySet()) {
log.info("机构:{} | {}", areaMap.get(entry.getKey()).getName(), entry.getValue());
}
}
/**
* 民警辅警
*/
public void personStatistics() {
List<BlamePerson> list = blameMapper.statisticsBlame();
List<BlamePerson> list2 = blameMapper.statisticsBlame2();
List<BlamePerson> list3 = blameMapper.statisticsBlame3();
for (BlamePerson blamePerson : list) {
log.info("民警:{} | {}", blamePerson.getBlameName(), blamePerson.getNumber());
}
for (BlamePerson blamePerson : list2) {
log.info("辅警:{} | {}", blamePerson.getBlameName(), blamePerson.getNumber());
}
for (BlamePerson blamePerson : list3) {
log.info("领导:{} | {}", blamePerson.getBlameName(), blamePerson.getNumber());
}
}
}

13
src/main/java/com/biutag/supervision/util/CompletableUtils/CompletableFutureMine.java

@ -0,0 +1,13 @@
package com.biutag.supervision.util.CompletableUtils;
/**
* @author kami
* @version 1.0
* @since 2021/11/22 17:37
*/
@FunctionalInterface
public interface CompletableFutureMine {
void run();
}

13
src/main/java/com/biutag/supervision/util/CompletableUtils/CompletableFutureResult.java

@ -0,0 +1,13 @@
package com.biutag.supervision.util.CompletableUtils;
/**
* @author kami
* @version 1.0
* @since 2021/11/22 17:37
*/
@FunctionalInterface
public interface CompletableFutureResult {
Boolean run();
}

13
src/main/java/com/biutag/supervision/util/CompletableUtils/CompletableFutureType.java

@ -0,0 +1,13 @@
package com.biutag.supervision.util.CompletableUtils;
/**
* @author kami
* @version 1.0
* @since 2021/11/22 17:37
*/
@FunctionalInterface
public interface CompletableFutureType<T> {
T run();
}

164
src/main/java/com/biutag/supervision/util/CompletableUtils/CompletableFutureUtil.java

@ -0,0 +1,164 @@
package com.biutag.supervision.util.CompletableUtils;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
* @author kami
* @version 1.0
* @since 2021/11/22 17:39
*/
@Slf4j
public class CompletableFutureUtil {
private CompletableFutureUtil(){}
public static final String TRACE_ID = "trace_id";
private static void run(CompletableFutureMine completableFutureMine, Map<String, String> previous) {
if (previous == null) {
MDC.clear();
} else {
MDC.setContextMap(previous);
}
if (MDC.get(TRACE_ID) == null || MDC.get(TRACE_ID).isEmpty()) {
MDC.put(TRACE_ID, System.nanoTime() + "");
}
completableFutureMine.run();
MDC.clear();
}
private static Boolean runResult(CompletableFutureResult result, Map<String, String> previous) {
if (previous == null) {
MDC.clear();
} else {
MDC.setContextMap(previous);
}
if (MDC.get(TRACE_ID) == null || MDC.get(TRACE_ID).isEmpty()) {
MDC.put(TRACE_ID, System.nanoTime() + "");
}
Boolean rs = result.run();
MDC.clear();
return rs;
}
public static void runSync(CompletableFutureMine completableFutureMine) {
Map<String, String> previous = MDC.getCopyOfContextMap();
CompletableFuture.runAsync(() -> run(completableFutureMine, previous)).exceptionally(e -> {
log.error("",e);
MDC.clear();
return null;
});
}
public static CompletableFuture runSyncObject(CompletableFutureMine completableFutureMine) {
Map<String, String> previous = MDC.getCopyOfContextMap();
return CompletableFuture.runAsync(() -> {
if (previous == null) {
MDC.clear();
} else {
MDC.setContextMap(previous);
}
if (MDC.get(TRACE_ID) == null || MDC.get(TRACE_ID).isEmpty()) {
MDC.put(TRACE_ID, System.nanoTime() + "");
}
run(completableFutureMine, previous);
MDC.clear();
}).exceptionally(e -> {
log.error("",e);
MDC.clear();
return null;
});
}
public static void run(CompletableFutureMine completableFutureMine) {
Map<String, String> previous = MDC.getCopyOfContextMap();
CompletableFuture.runAsync(() -> run(completableFutureMine, previous)).exceptionally(e -> {
log.error("",e);
MDC.clear();
return null;
}).join();
}
public static void runSyncEach(CompletableFutureResult result, Long time) {
Map<String, String> previous = MDC.getCopyOfContextMap();
CompletableFuture.runAsync(() -> {
Boolean goOn = true;
while (Boolean.TRUE.equals(goOn)) {
try {
TimeUnit.SECONDS.sleep(time);
} catch (InterruptedException e) {
log.error("",e);
Thread.currentThread().interrupt();
}
goOn = runResult(result, previous);
}
}).exceptionally(e -> {
log.error("",e);
MDC.clear();
return null;
});
}
public static void runSyncEach(CompletableFutureResult result, Executor ex, Long time) {
Map<String, String> previous = MDC.getCopyOfContextMap();
CompletableFuture.runAsync(() -> {
Boolean goOn = true;
while (goOn) {
try {
TimeUnit.SECONDS.sleep(time);
} catch (InterruptedException e) {
log.error("",e);
Thread.currentThread().interrupt();
}
goOn = runResult(result, previous);
}
}, ex).exceptionally(e -> {
log.error("",e);
MDC.clear();
return null;
});
}
public static void runSync(CompletableFutureMine completableFutureMine, Executor ex) {
Map<String, String> previous = MDC.getCopyOfContextMap();
CompletableFuture.runAsync(() -> run(completableFutureMine, previous), ex).exceptionally(e -> {
log.error("", e);
MDC.clear();
return null;
});
}
public static void runSyncAssert(Boolean assets, CompletableFutureMine completableFutureMine) {
if(Boolean.TRUE.equals(assets)) {
CompletableFuture.runAsync(completableFutureMine::run).exceptionally(e -> {
log.error("",e);
return null;
});
}
}
public static <T> CompletableFuture<T> createRunner(CompletableFutureType<T> completableFutureType) {
Map<String, String> previous = MDC.getCopyOfContextMap();
return CompletableFuture.supplyAsync(() -> {
if (previous == null) {
MDC.clear();
} else {
MDC.setContextMap(previous);
}
if (MDC.get(TRACE_ID) == null || MDC.get(TRACE_ID).isEmpty()) {
MDC.put(TRACE_ID, System.nanoTime() + "");
}
T t = completableFutureType.run();
MDC.clear();
return t;
});
}
}

62
src/main/resources/logback-spring.xml

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<contextName>logs</contextName>
<!-- 日志位置 -->
<property name="log.path" value="/work/log"/>
<!-- 日志保留时长 -->
<property name="log.maxHistory" value="7"/>
<!-- 控制台格式化及颜色 -->
<property name="log.colorPattern"
value="%magenta([%X{trace_id}][%d{yyyy-MM-dd'T'HH:mm:ss.SSS}]) %highlight(%-5level) %red(%thread) %green(%logger) %msg%n"/>
<property name="log.pattern" value="[%X{trace_id}][%d{yyyy-MM-dd'T'HH:mm:ss.SSS}] %-5level %thread %logger %msg%n"/>
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.colorPattern}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!--输出到文件-->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/info/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<MaxHistory>${log.maxHistory}</MaxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<MaxHistory>${log.maxHistory}</MaxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<logger name="com.biutag.supervision" level="INFO"/>
<!-- 日志类型为debug时,输出到控制台 -->
<root level="debug">
<appender-ref ref="console"/>
</root>
<!-- 日志类型为info时,输出到配置好的文件 -->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

7
src/main/resources/mapper/AlarmNotificationMapper.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.biutag.supervision.mapper.AlarmNotificationMapper">
</mapper>
Loading…
Cancel
Save