Browse Source

fit:现场专项地图sql拆分、定时任务优化

master
pengwei 1 month ago
parent
commit
445cc98889
  1. 13
      src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java
  2. 27
      src/main/java/com/biutag/supervision/job/Job.java
  3. 48
      src/main/java/com/biutag/supervision/mapper/NegativeMapper.java

13
src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java

@ -198,8 +198,17 @@ public class DataVSupervisionNotifyController {
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
endTime = DateUtil.endOfDay(endTime);
//地图数据
List<SuperviseMapIconVo> superviseTempMapVoList = negativeMapper.getSupervisionMapIconInfo(beginTime, endTime);
List<SuperviseMapIconVo> superviseTempMapVoList = negativeMapper.getSupervisionMapIconData(beginTime, endTime);
//数据补充
Date finalEndTime = endTime;
superviseTempMapVoList.forEach(s->{
String relationOrg =negativeMapper.getSupervisionMapStringData(beginTime, finalEndTime,"department",s.getDepartId()) ;
String personNum =negativeMapper.getSupervisionMapStringData(beginTime, finalEndTime,"personal",s.getDepartId()) ;;
String completedRate = negativeMapper.getSupervisionMapCompletedRate(beginTime, finalEndTime,s.getDepartId());
s.setCompletedRate(completedRate);
s.setPersonNum(personNum);
s.setRelationOrg(relationOrg);
});
JSONObject data = new JSONObject().fluentPut("superviseTempMapVoList", superviseTempMapVoList);
return Result.success(data);
}

27
src/main/java/com/biutag/supervision/job/Job.java

@ -155,7 +155,12 @@ public class Job {
DwdRyZfbaBaryxx dwdRyZfbaBaryxx = dwdRyZfbaBaryxxService.selectDataById(ajjbxx.getBar1id());
if(ObjectUtil.isNotEmpty(dwdRyZfbaBaryxx)){
SupPolice policeData = policeService.getByIdCode(dwdRyZfbaBaryxx.getZjhm());
rpcApply.setInputEmpNo(policeData.getEmpNo());
if(ObjectUtil.isNotEmpty(policeData)){
rpcApply.setInputEmpNo(policeData.getEmpNo());
}else{
log.info("身份证:"+dwdRyZfbaBaryxx.getZjhm()+"未找到");
}
}
}
@ -179,9 +184,16 @@ public class Job {
//判断是否为非长沙市公安局
if(!unitName.contains("长沙市公安局")){
//非长沙市公安局
String[] depts = ajjbxx.getBadwidmc().split("局")[0].split("省");
if(depts.length > 0){
StatisticsGroupName="湖南省长沙市公安局" + depts[1]+"局";
String[] deptsData = ajjbxx.getBadwidmc().split("局");
if(deptsData.length > 0){
String[] depts =deptsData[0].split("省");
if(depts.length > 0){
StatisticsGroupName="湖南省长沙市公安局" + depts[1]+"局";
}else{
log.info("无法分割‘省’");
}
}else{
log.info("无法分割‘局’");
}
}else{
@ -189,9 +201,6 @@ public class Job {
StatisticsGroupName ="长沙市公安局";
}
SupDepart groupDept= supDepartMapper.selectOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getName,StatisticsGroupName));
if(ObjectUtil.isNotEmpty(groupDept)){
rpcApply.setSecondDepartId(groupDept.getId());
@ -222,7 +231,9 @@ public class Job {
RpcApplyPerson rpcApplyPerson= new RpcApplyPerson();
rpcApplyPerson.setType(RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue());
//受伤程度屏蔽
// rpcApplyPerson.setInjurySeverity(item.getShcdmc());
if(StrUtil.isNotBlank(item.getShcdmc())){
rpcApplyPerson.setInjurySeverity(item.getShcdmc());
}
rpcApplyPerson.setCreatTime(LocalDateTime.now());
rpcApplyPerson.setUdpTime(LocalDateTime.now());
rpcApplyPerson.setId(IdUtil.fastSimpleUUID());

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

@ -234,6 +234,54 @@ public interface NegativeMapper extends BaseMapper<Negative> {
List<SuperviseMapIconVo> getSupervisionMapIconInfo(Date beginTime, Date endTime);
@Select("select " +
"sd.short_name AS `name`," +
"sd.id AS departId, " +
"COUNT( DISTINCT ng.id ) AS totalPro, " +
"COUNT( DISTINCT IF(ng.problemSourcesCode=13, ng.id, NULL) ) AS xc, " +
"COUNT( DISTINCT IF(ng.problemSourcesCode=15, ng.id, NULL) ) AS zx, " +
"COUNT( DISTINCT IF(ng.processing_status in ('signing', 'processing', 'approval'), ng.id, NULL) ) AS processingNumber, " +
"COUNT( DISTINCT IF(ng.processing_status='completed', ng.id, NULL) ) AS completedNumber " +
"from sup_depart sd " +
"LEFT JOIN negative ng ON ng.second_involve_depart_id=sd.id AND ng.problemSourcesCode IN (13,14, 15) " +
"AND crtTime BETWEEN #{beginTime} AND #{endTime} " +
"WHERE sd.statistics_group_id=3 " +
"GROUP BY sd.short_name " +
"ORDER BY totalPro DESC;"
)
List<SuperviseMapIconVo> getSupervisionMapIconData(Date beginTime, Date endTime);
//获取personNum、relationOrg
@Select(
"select count(*) FROM sup_depart sd " +
"LEFT JOIN negative ng ON ng.second_involve_depart_id=sd.id AND ng.problemSourcesCode IN (13,14, 15) " +
"AND crtTime BETWEEN #{beginTime} AND #{endTime} " +
"LEFT JOIN negative_blame nb ON ng.id=nb.negativeId " +
"WHERE nb.handleResultName != '' and nb.handleResultName IS NOT NULL and nb.handleResultName != '不予追责' " +
"and nb.type = #{code} and sd.id =#{departId}"
)
String getSupervisionMapStringData(Date beginTime, Date endTime,String code,String departId);
//获取completedRate
@Select(
"select " +
"IFNULL( ROUND( COUNT( DISTINCT IF(ng.processing_status='completed', ng.id, NULL) )/COUNT( DISTINCT ng.id )*100, 1), 0) " +
"FROM sup_depart sd" +
"LEFT JOIN negative ng ON ng.second_involve_depart_id=sd.id AND ng.problemSourcesCode IN (13,14, 15)" +
"AND crtTime BETWEEN #{beginTime} AND #{endTime}" +
"LEFT JOIN negative_blame nb ON ng.id=nb.negativeId " +
"where sd.id =#{departId}"
)
String getSupervisionMapCompletedRate(Date beginTime, Date endTime,String departId);
@Select("SELECT " +
"COUNT(DISTINCT ng.id) AS proTotal, " +
"COUNT( DISTINCT IF(ng.processing_status in ('signing', 'processing', 'approval'), ng.id, NULL) ) AS processingNumber, " +

Loading…
Cancel
Save