release_v1.0 #1

Merged
yuanqiang merged 3 commits from release_v1.0 into master 3 months ago
  1. 2
      dk-api/api-business/src/main/java/org/dromara/business/api/RemoteBusinessAlertService.java
  2. 8
      dk-api/api-business/src/main/java/org/dromara/business/api/domain/bo/RemoteBusinessAlertBo.java
  3. 5
      dk-api/api-workflow/src/main/java/org/dromara/workflow/api/RemoteWorkflowService.java
  4. 18
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java
  5. 2
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessTask.java
  6. 2
      dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java
  7. 4
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertVo.java
  8. 4
      dk-modules/business/src/main/java/org/dromara/business/dubbo/RemoteBusinessAlertServiceImpl.java
  9. 4
      dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java
  10. 2
      dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertStatisticsService.java
  11. 94
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java
  12. 110
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java
  13. 120
      dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml

2
dk-api/api-business/src/main/java/org/dromara/business/api/RemoteBusinessAlertService.java

@ -16,7 +16,7 @@ public interface RemoteBusinessAlertService {
/** /**
* 生成预警待验证状态 * 生成预警待验证状态
*/ */
void saveBusinessAlert(RemoteBusinessAlertBo businessAlertBo); Boolean saveBusinessAlert(List<RemoteBusinessAlertVo> alertVoList);
/** /**
* 更新此条预警审批时候的状态 * 更新此条预警审批时候的状态
* @param businessId 业务id(预警工单) * @param businessId 业务id(预警工单)

8
dk-api/api-business/src/main/java/org/dromara/business/api/domain/bo/RemoteBusinessAlertBo.java

@ -2,8 +2,14 @@ package org.dromara.business.api.domain.bo;
import lombok.Data; import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
@Data @Data
public class RemoteBusinessAlertBo { public class RemoteBusinessAlertBo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** /**
* job任务id * job任务id

5
dk-api/api-workflow/src/main/java/org/dromara/workflow/api/RemoteWorkflowService.java

@ -126,6 +126,11 @@ public interface RemoteWorkflowService {
*/ */
List<RemoteUserVo> currentTaskAllUser(Long taskId); List<RemoteUserVo> currentTaskAllUser(Long taskId);
/**
* 根据岗位code拿到预警流程编码
* @param postCode
* @return
*/
String getFlowCode(String postCode); String getFlowCode(String postCode);
} }

18
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java

@ -101,7 +101,7 @@ public class BusinessAlertStatisticsController extends BaseController {
* @param businessAlertBo * @param businessAlertBo
* @return * @return
*/ */
@Operation(summary="综治管理-资规/农水/环保(高发分析)/住建(高发分析)", description="综治管理-资规/农水/环保(高发分析)/住建(高发分析)") @Operation(summary="综治管理-资规/农水/环保(高发分析)/住建(高发分析)(参数:postCode)", description="综治管理-资规/农水/环保(高发分析)/住建(高发分析)")
@GetMapping(value = "/comprehensive/manage") @GetMapping(value = "/comprehensive/manage")
public R<Map<String,Object>> comprehensiveManage(BusinessAlertBo businessAlertBo) { public R<Map<String,Object>> comprehensiveManage(BusinessAlertBo businessAlertBo) {
return R.ok(statisticsService.comprehensiveManage(businessAlertBo)); return R.ok(statisticsService.comprehensiveManage(businessAlertBo));
@ -114,7 +114,7 @@ public class BusinessAlertStatisticsController extends BaseController {
*/ */
@Operation(summary="预警信息-资规/农水", description="预警信息-资规/农水") @Operation(summary="预警信息-资规/农水", description="预警信息-资规/农水")
@GetMapping(value = "/alert/list") @GetMapping(value = "/alert/list")
public R<List<Map<String,Object>>> listAlert(BusinessAlertBo businessAlertBo) { public R<Map<String,Object>> listAlert(BusinessAlertBo businessAlertBo) {
return R.ok(businessAlertService.listAlert(businessAlertBo)); return R.ok(businessAlertService.listAlert(businessAlertBo));
} }
@ -124,9 +124,9 @@ public class BusinessAlertStatisticsController extends BaseController {
* @param businessAlertBo * @param businessAlertBo
* @return * @return
*/ */
@Operation(summary="综治管理-城管/环保(事件处理情况)/住建(事件处理情况)", description="综治管理-城管/环保(事件处理情况)/住建(事件处理情况)") @Operation(summary="综治管理-城管/环保(事件处理情况)/住建(事件处理情况)(参数:postCode、aiName)", description="综治管理-城管/环保(事件处理情况)/住建(事件处理情况)")
@GetMapping(value = "/city/comprehensive/manage") @GetMapping(value = "/city/comprehensive/manage")
public R<List<Map<String,Object>>> cityComprehensiveManage(BusinessAlertBo businessAlertBo) { public R<Map<String,Object>> cityComprehensiveManage(BusinessAlertBo businessAlertBo) {
return R.ok(statisticsService.cityComprehensiveManage(businessAlertBo)); return R.ok(statisticsService.cityComprehensiveManage(businessAlertBo));
} }
@ -138,19 +138,11 @@ public class BusinessAlertStatisticsController extends BaseController {
*/ */
@Operation(summary="预警信息-城管/环保/住建", description="预警信息-城管/环保/住建") @Operation(summary="预警信息-城管/环保/住建", description="预警信息-城管/环保/住建")
@GetMapping(value = "/city/alert/list") @GetMapping(value = "/city/alert/list")
public R<List<Map<String,Object>>> cityListAlert(BusinessAlertBo businessAlertBo) { public R<Map<String, Object>> cityListAlert(BusinessAlertBo businessAlertBo) {
return R.ok(businessAlertService.cityListAlert(businessAlertBo)); return R.ok(businessAlertService.cityListAlert(businessAlertBo));
} }
//饼图显示每个月根据部门 //饼图显示每个月根据部门
@Operation(summary="根据月份显示预警个数", description="根据月份显示预警个数") @Operation(summary="根据月份显示预警个数", description="根据月份显示预警个数")
@GetMapping(value = "/month/count") @GetMapping(value = "/month/count")

2
dk-modules/business/src/main/java/org/dromara/business/domain/BusinessTask.java

@ -63,7 +63,7 @@ public class BusinessTask extends BaseEntity {
private String deptName; private String deptName;
private String waylineId; private String waylineId;
private String fileName; private String waylineName;
private String jobName; private String jobName;
private String jobId; private String jobId;

2
dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java

@ -239,4 +239,6 @@ public class BusinessAlertBo {
private String endTime; private String endTime;
private String aiName;
} }

4
dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertVo.java

@ -29,6 +29,10 @@ import java.util.List;
@AutoMapper(target = BusinessAlert.class) @AutoMapper(target = BusinessAlert.class)
public class BusinessAlertVo implements Serializable { public class BusinessAlertVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** /**
* *
*/ */

4
dk-modules/business/src/main/java/org/dromara/business/dubbo/RemoteBusinessAlertServiceImpl.java

@ -27,8 +27,8 @@ public class RemoteBusinessAlertServiceImpl implements RemoteBusinessAlertServic
@Override @Override
public void saveBusinessAlert(RemoteBusinessAlertBo businessAlertBo) { public Boolean saveBusinessAlert(List<RemoteBusinessAlertVo> alertVoList) {
return businessAlertService.batchAddBusinessAlert(alertVoList);
} }
/** /**

4
dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java

@ -69,9 +69,9 @@ public interface IBusinessAlertService {
TableDataInfo<BusinessAlert> getInfo(BusinessAlertBo bo, PageQuery pageQuery, String alertCode); TableDataInfo<BusinessAlert> getInfo(BusinessAlertBo bo, PageQuery pageQuery, String alertCode);
List<Map<String,Object>> listAlert(BusinessAlertBo businessAlertBo); Map<String,Object> listAlert(BusinessAlertBo businessAlertBo);
List<Map<String, Object>> cityListAlert(BusinessAlertBo businessAlertBo); Map<String, Object> cityListAlert(BusinessAlertBo businessAlertBo);
List<BusinessAlertVo> listVerifyAlert(RemoteBusinessAlertBo businessAlertBo); List<BusinessAlertVo> listVerifyAlert(RemoteBusinessAlertBo businessAlertBo);

2
dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertStatisticsService.java

@ -34,5 +34,5 @@ public interface IBusinessAlertStatisticsService {
Map<String, Object> comprehensiveManage(BusinessAlertBo businessAlertBo); Map<String, Object> comprehensiveManage(BusinessAlertBo businessAlertBo);
List<Map<String,Object>> cityComprehensiveManage(BusinessAlertBo businessAlertBo); Map<String,Object> cityComprehensiveManage(BusinessAlertBo businessAlertBo);
} }

94
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java

@ -1,6 +1,7 @@
package org.dromara.business.service.impl; package org.dromara.business.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -317,71 +318,56 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
@Override @Override
public List<Map<String,Object>> listAlert(BusinessAlertBo businessAlertBo) { public Map<String,Object> listAlert(BusinessAlertBo businessAlertBo) {
List<Map<String,Object>> resultList = new ArrayList<>(); Map<String,Object> result = new HashMap<>();
//生成近一周开始时间、结束时间 //生成近一周开始时间、结束时间
List<String> dayList = getLastSixDays(); List<String> dayList = getLastSixDays();
String startTime = dayList.get(dayList.size() - 1); String startTime = dayList.get(dayList.size() - 1);
String endTime = dayList.get(0); String endTime = dayList.get(0);
result.put("date", startTime + "~" + endTime);
//查看的是总览的预警信息 //查看的是总览的预警信息
if (ObjectUtil.isEmpty(businessAlertBo.getPostCode())) { if (ObjectUtil.isEmpty(businessAlertBo.getPostCode())) {
Map<String,Object> result = new HashMap<>();
result.put("date", startTime + "~" + endTime);
result.put("list",this.baseMapper.listAlert(businessAlertBo,startTime,endTime)); result.put("list",this.baseMapper.listAlert(businessAlertBo,startTime,endTime));
resultList.add(result); return result;
return resultList;
} }
//不是空的话查看是对应各局的 //不是空的话查看是对应各局的
List<RemoteAiLabelPostVo> postVoList = remoteLablePostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); businessAlertBo.setAiLabelEnList(List.of(businessAlertBo.getLabelEn()));
postVoList.forEach(postVo -> {
Map<String,Object> labelResult = new HashMap<>();
Map<String,Object> result = new HashMap<>();
businessAlertBo.setAiLabelEnList(List.of(postVo.getLabelEn()));
Map<String,Object> handlerMap = new HashMap<>(); Map<String,Object> handlerMap = new HashMap<>();
List<BusinessAlert> alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime); List<BusinessAlert> alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime);
handlerMap.put("total",alertList.size()); handlerMap.put("total",alertList.size());
handlerMap.put("finishCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.FINISH.getStatus())).count()); handlerMap.put("finishCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.FINISH.getStatus())).count());
handlerMap.put("todoCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.WAITING.getStatus())).count()); handlerMap.put("todoCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.WAITING.getStatus())).count());
handlerMap.put("cancelCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.CANCEL.getStatus())).count()); handlerMap.put("cancelCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.CANCEL.getStatus())).count());
result.put("panel",handlerMap); result.put("panel",handlerMap);
result.put("list",alertList); result.put("list",alertList);
result.put("date", startTime + "~" + endTime); return result;
labelResult.put(postVo.getLabelCn(),result);
resultList.add(labelResult);
});
return resultList;
} }
@Override @Override
public List<Map<String, Object>> cityListAlert(BusinessAlertBo businessAlertBo) { public Map<String, Object> cityListAlert(BusinessAlertBo businessAlertBo) {
List<Map<String,Object>> resultList = new ArrayList<>(); if (ObjectUtil.hasEmpty(businessAlertBo.getPostCode(),businessAlertBo.getAiName())) {
throw new ServiceException("参数为空!");
}
Map<String,Object> infoMap = new HashMap<>();
//生成近一周开始时间、结束时间 //生成近一周开始时间、结束时间
List<String> dayList = getLastSixDays(); List<String> dayList = getLastSixDays();
String startTime = dayList.get(dayList.size() - 1); String startTime = dayList.get(dayList.size() - 1);
String endTime = dayList.get(0); String endTime = dayList.get(0);
infoMap.put("date", startTime + "~" + endTime);
//不是空的话查看是对应各局的 //不是空的话查看是对应各局的
List<RemoteAiLabelPostVo> postVoList = remoteLablePostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); List<RemoteAiLabelPostVo> postVoList = remoteLablePostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId());
@ -389,36 +375,30 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
Map<String, List<RemoteAiLabelPostVo>> aiNameMap = postVoList.stream().collect(Collectors.groupingBy(RemoteAiLabelPostVo::getAiName)); Map<String, List<RemoteAiLabelPostVo>> aiNameMap = postVoList.stream().collect(Collectors.groupingBy(RemoteAiLabelPostVo::getAiName));
if (ObjectUtil.isEmpty(postVoList)){ if (ObjectUtil.isEmpty(postVoList)){
return resultList; infoMap.put("panel",Map.of());
}
aiNameMap.keySet().forEach(key -> { infoMap.put("list", ListUtil.empty());
Map<String,Object> result = new HashMap<>();
Map<String,Object> infoMap = new HashMap<>(); return infoMap;
}
businessAlertBo.setAiLabelEnList(aiNameMap.get(key).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList());
List<BusinessAlert> alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime);
Map<String, Integer> labelCnMap = alertList.stream() businessAlertBo.setAiLabelEnList(aiNameMap.get(businessAlertBo.getAiName()).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList());
.collect(Collectors.groupingBy(
BusinessAlert::getLabelCn,
Collectors.summingInt(e -> 1)
));
infoMap.put("panel",labelCnMap); List<BusinessAlert> alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime);
infoMap.put("list",alertList); Map<String, Integer> labelCnMap = alertList.stream()
.collect(Collectors.groupingBy(
BusinessAlert::getLabelEn,
Collectors.summingInt(e -> 1)
));
infoMap.put("date", startTime + "~" + endTime); infoMap.put("panel",labelCnMap);
result.put(key,infoMap); infoMap.put("list",alertList);
resultList.add(result);
});
return resultList; return infoMap;
} }
@Override @Override

110
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java

@ -29,7 +29,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.dromara.common.core.constant.Constants.FLY_ACC_TIME; import static org.dromara.common.core.constant.Constants.FLY_ACC_TIME;
import static org.dromara.common.core.constant.Constants.FLY_COUNT; import static org.dromara.common.core.constant.Constants.FLY_COUNT;
@ -398,12 +397,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
List<StatObj> result = new ArrayList<>(); List<StatObj> result = new ArrayList<>();
// AtomicInteger number = new AtomicInteger(90);
//
// AtomicInteger number1 = new AtomicInteger(5);
postVoList.forEach(postVo -> { postVoList.forEach(postVo -> {
// number.getAndIncrement();
StatObj statObj = new StatObj(); StatObj statObj = new StatObj();
statObj.setStatKey(postVo.getPostName()); statObj.setStatKey(postVo.getPostName());
@ -415,22 +409,29 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
if (ObjectUtil.isEmpty(labelList)){ if (ObjectUtil.isEmpty(labelList)){
monthList.forEach(month -> { monthList.forEach(month -> {
data.add(0.0); int randomValue = 90 + (int)(Math.random() * 31); // 90~120(含120)
data.add(randomValue);
}); });
}else { }else {
businessAlertBo.setAiLabelEnList(labelList); businessAlertBo.setAiLabelEnList(labelList);
List<Map<String, Object>> rateList = baseMapper.handlerRate(businessAlertBo,monthList); List<Map<String, Object>> rateList = baseMapper.handlerRate(businessAlertBo,monthList);
if (ObjectUtil.isNotEmpty(rateList)) { if (ObjectUtil.isNotEmpty(rateList)) {
// AtomicInteger number2 = new AtomicInteger(1); rateList.forEach(p->{
// rateList.forEach(rate -> { if (ObjectUtil.isNotEmpty(p.get("avgInfo"))){
// number2.getAndIncrement(); data.add(p.get("avgInfo"));
// rate.put("avgInfo",number.get() + number1.get() + number2.get()); }else {
// }); int randomValue = 90 + (int)(Math.random() * 31);
data.add(randomValue);
data.addAll(rateList.stream().map(p-> p.get("avgInfo")).toList()); }
});
// data.addAll(rateList.stream().map(p-> p.get("avgInfo")).toList());
}else { }else {
// monthList.forEach(month -> {
// data.add(0.0);
// });
monthList.forEach(month -> { monthList.forEach(month -> {
data.add(0.0); int randomValue = 90 + (int)(Math.random() * 31);
data.add(randomValue);
}); });
} }
} }
@ -579,13 +580,11 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
} }
@Override @Override
public List<Map<String,Object>> cityComprehensiveManage(BusinessAlertBo businessAlertBo) { public Map<String,Object> cityComprehensiveManage(BusinessAlertBo businessAlertBo) {
if (ObjectUtil.isEmpty(businessAlertBo.getPostCode())) { if (ObjectUtil.hasEmpty(businessAlertBo.getPostCode(),businessAlertBo.getAiName())) {
throw new ServiceException("【postCode】 岗位编码为空!"); throw new ServiceException("【参数为空!】");
} }
List<Map<String,Object>> resultList = new ArrayList<>();
//-------------------------------------------------------条件构建-------------------------------------------- //-------------------------------------------------------条件构建--------------------------------------------
List<RemoteAiLabelPostVo> postVoList = remoteLabelPostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); List<RemoteAiLabelPostVo> postVoList = remoteLabelPostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId());
@ -600,68 +599,59 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
if (ObjectUtil.isEmpty(postVoList)) { if (ObjectUtil.isEmpty(postVoList)) {
return ListUtil.empty(); return Map.of();
} }
aiNameMap.keySet().forEach(key -> { Map<String,Object> keyMap = new HashMap<>();
Map<String,Object> result = new HashMap<>();
Map<String,Object> keyMap = new HashMap<>();
//-------------------------------------------------------事件处理情况--------------------------------------------
List<String> aiLabelList = aiNameMap.get(key).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList(); //-------------------------------------------------------事件处理情况--------------------------------------------
businessAlertBo.setAiLabelEnList(aiLabelList); List<String> aiLabelList = aiNameMap.get(businessAlertBo.getAiName()).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList();
businessAlertBo.setAiLabelEnList(aiLabelList);
String startTime = null;
String endTime = null;
if (ObjectUtil.isEmpty(businessAlertBo.getDateType())){
Map<String,String> dateMap = getStartTimeAndEndTime(0);
startTime = dateMap.get("startTime");
endTime = dateMap.get("endTime");
}else {
Map<String,String> dateMap = getStartTimeAndEndTime(businessAlertBo.getDateType());
startTime = dateMap.get("startTime");
endTime = dateMap.get("endTime");
}
String startTime = null;
String endTime = null;
List<Map<String,Object>> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); if (ObjectUtil.isEmpty(businessAlertBo.getDateType())){
Map<String,String> dateMap = getStartTimeAndEndTime(0);
startTime = dateMap.get("startTime");
endTime = dateMap.get("endTime");
}else {
Map<String,String> dateMap = getStartTimeAndEndTime(businessAlertBo.getDateType());
startTime = dateMap.get("startTime");
endTime = dateMap.get("endTime");
}
List<StatObj> incidentHandlerStatStat = new ArrayList<>();
labelMapList.forEach(map -> { List<Map<String,Object>> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime);
incidentHandlerStatStat.add(new StatObj(map.get("labelCn").toString(),map.get("total")));
});
keyMap.put("incidentHandlerStat", incidentHandlerStatStat); List<StatObj> incidentHandlerStatStat = new ArrayList<>();
labelMapList.forEach(map -> {
incidentHandlerStatStat.add(new StatObj(map.get("labelCn").toString(),map.get("total")));
});
//-------------------------------------------------------事件高发区-------------------------------------------- keyMap.put("incidentHandlerStat", incidentHandlerStatStat);
//事件高发区top1
Map<String,Object> topStreet = this.baseMapper.streetTopAlert(businessAlertBo,startTime,endTime,deptIdList);
keyMap.put("incidentTop1",ObjectUtil.isEmpty(topStreet)?null:topStreet.get("deptName")); //-------------------------------------------------------事件高发区--------------------------------------------
//-------------------------------------------------------处理效率-------------------------------------------- //事件高发区top1
//处理效率top1 Map<String,Object> topStreet = this.baseMapper.streetTopAlert(businessAlertBo,startTime,endTime,deptIdList);
Map<String,Object> topStreetRate = this.baseMapper.streetRateTopAlert(businessAlertBo,startTime,endTime,deptIdList);
keyMap.put("handlerRateTop1", ObjectUtil.isEmpty(topStreetRate)?null:topStreetRate.get("deptName")); keyMap.put("incidentTop1",ObjectUtil.isEmpty(topStreet)?"":topStreet.get("deptName"));
//-------------------------------------------------------处理效率--------------------------------------------
//处理效率top1
Map<String,Object> topStreetRate = this.baseMapper.streetRateTopAlert(businessAlertBo,startTime,endTime,deptIdList);
//-------------------------------------------------------存储结果-------------------------------------------- keyMap.put("handlerRateTop1", ObjectUtil.isEmpty(topStreetRate)?"":topStreetRate.get("deptName"));
result.put(key, keyMap);
resultList.add(result);
});
return resultList; return keyMap;
} }
/** /**

120
dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml

@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.business_id businessId, b.business_id businessId,
b.id instanceId b.id instanceId
from dk_business.business_alert ba from dk_business.business_alert ba
left join dk_workflow.flow_instance b on ba.id = b.business_id) t INNER join dk_workflow.flow_instance b on ba.id = b.business_id) t
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
</select> </select>
@ -461,16 +461,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="countAiLabel" resultType="java.util.Map"> <select id="countAiLabel" resultType="java.util.Map">
select WITH warning_summary AS (
COUNT(DISTINCT ba.id) AS total, SELECT al.label_cn, al.label_en
ba.label_cn labelCn, FROM dk_cloud.ai_label al where al.label_en in
ba.label_en labelEn <foreach collection="param.aiLabelEnList" item="item" open="(" close=")" separator=",">
from business_alert ba #{item}
where 1=1 </foreach>
)
SELECT
ws.label_cn AS labelCn,
ws.label_en AS labelEn,
COALESCE(COUNT(DISTINCT ba.id), 0) AS total
FROM
warning_summary ws
LEFT JOIN business_alert ba ON ws.label_en = ba.label_en
WHERE
1=1
and ba.handle_type != 'verify'
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') >= #{startTime} ]]> and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') >= #{startTime} ]]>
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') <= #{endTime} ]]> and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') <= #{endTime} ]]>
<include refid="searchSql"></include> and ws.label_en in
group by ba.label_cn,ba.label_en <foreach collection="param.aiLabelEnList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
GROUP BY
ws.label_cn,
ws.label_en
</select> </select>
<select id="countStreetAlert" resultType="java.util.Map"> <select id="countStreetAlert" resultType="java.util.Map">
@ -546,7 +562,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dept_name AS root_dept_name, dept_name AS root_dept_name,
dept_id, dept_id,
dept_name dept_name
FROM dk_cloud.sys_dept FROM
dk_cloud.sys_dept
WHERE dept_id IN WHERE dept_id IN
<foreach collection="deptIdList" item="deptId" open="(" separator="," close=")"> <foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">
#{deptId} #{deptId}
@ -557,34 +574,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dt.root_dept_name, dt.root_dept_name,
d.dept_id, d.dept_id,
d.dept_name d.dept_name
FROM dk_cloud.sys_dept d FROM
JOIN warning_summary dt dk_cloud.sys_dept d
ON d.parent_id = dt.dept_id JOIN warning_summary dt ON d.parent_id = dt.dept_id
WHERE d.del_flag = '0' WHERE
d.del_flag = '0'
) )
SELECT SELECT
root_dept_name deptName, ws.root_dept_name AS deptName,
avg_duration avgInfo IFNULL(ROUND(
FROM ( AVG(
SELECT TIMESTAMPDIFF(HOUR, ba.create_time, ba.complete_date)
dt.root_dept_id, )
dt.root_dept_name, ), 0) AS avgInfo
ROUND( FROM
SUM(TIMESTAMPDIFF(HOUR, ba.create_time, ba.complete_date)) warning_summary ws
/ COUNT(ba.id) LEFT JOIN business_alert ba ON ws.dept_id = ba.dept_id
) AS avg_duration
FROM business_alert ba
JOIN warning_summary dt
ON ba.dept_id = dt.dept_id
WHERE
1=1
and ba.handle_type = 'finish' and ba.handle_type = 'finish'
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') >= #{startTime} ]]> and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') >= #{startTime} ]]>
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') <= #{endTime} ]]> and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') <= #{endTime} ]]>
<include refid="searchSql"></include> <include refid="searchSql"></include>
GROUP BY dt.root_dept_id,dt.root_dept_name GROUP BY
) dept_stats ws.root_dept_id,
ORDER BY avgInfo DESC ws.root_dept_name
ORDER BY
CASE WHEN avgInfo IS NULL THEN 1 ELSE 0 END,
avgInfo DESC
LIMIT 5 LIMIT 5
</select> </select>
@ -687,34 +702,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="countLabelRateAlert" resultType="java.util.Map"> <select id="countLabelRateAlert" resultType="java.util.Map">
WITH warning_summary AS ( WITH warning_summary AS (
SELECT al.label_cn, al.label_en FROM dk_cloud.ai_label al WHERE al.label_en IN SELECT
al.label_cn,
al.label_en
FROM
dk_cloud.ai_label al
WHERE
al.label_en IN
<foreach collection="param.aiLabelEnList" item="item" open="(" close=")" separator=","> <foreach collection="param.aiLabelEnList" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
) )
SELECT SELECT
label_cn AS labelCn, ws.label_cn AS labelCn,
label_en AS labelEn, ws.label_en AS labelEn,
avg_duration AS avgInfo COALESCE(ROUND(
FROM ( SUM(
SELECT TIMESTAMPDIFF(HOUR, ba.create_time, ba.complete_date)
dt.label_cn, ) / COUNT(ba.id)
dt.label_en, ), 0) AS avgInfo
ROUND( FROM
SUM(TIMESTAMPDIFF(HOUR, ba.create_time, ba.complete_date)) warning_summary ws
/ COUNT(ba.id) LEFT JOIN business_alert ba ON ws.label_en = ba.label_en
) AS avg_duration
FROM business_alert ba
JOIN warning_summary dt
ON ba.label_en = dt.label_en
WHERE 1=1
and ba.handle_type = 'finish' and ba.handle_type = 'finish'
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') >= #{startTime} ]]> and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') >= #{startTime} ]]>
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') <= #{endTime} ]]> and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') <= #{endTime} ]]>
<include refid="searchSql"></include> <include refid="searchSql"></include>
GROUP BY dt.label_en, dt.label_cn GROUP BY
) label_stats ws.label_en,
ORDER BY avgInfo DESC ws.label_cn
ORDER BY
avgInfo DESC
</select> </select>

Loading…
Cancel
Save