Browse Source

[feat]

1、修复预警统计图展示如果没有下一级则展示当前级
pull/4/head
杨威 2 months ago
parent
commit
f2ddd94e5e
  1. 3
      dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java
  2. 42
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java
  3. 31
      dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml
  4. 5
      dk-modules/sample/src/main/java/org/dromara/sample/wayline/service/impl/AiCompareServiceImpl.java

3
dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java

@ -104,4 +104,7 @@ public interface BusinessAlertMapper extends BaseMapperPlus<BusinessAlert, Busin
List<BusinessAlert> listHandleHistory(@Param("lng") String lng, @Param("lat") String lat,@Param("createTime") String createTime);
List<Map<String, Object>> listOneDepartAlert(@Param("param") BusinessAlertBo businessAlertBo);
List<Map<String, Object>> listOneDepartAlertStatus(@Param("param") BusinessAlertBo businessAlertBo);
}

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

@ -100,8 +100,21 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
businessAlertBo.setDeptId(String.valueOf(LoginHelper.getDeptId()));
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()));
List<Map<String, Object>> mapList = baseMapper.listDepartAlert(businessAlertBo);
//判断是否存在下级
Long deptId = LoginHelper.getDeptId();
List<RemoteDeptVo> remoteDeptVoList = Optional.ofNullable(remoteDeptService.selectListByParentId(String.valueOf(deptId)))
.orElse(Collections.emptyList())
.stream()
.filter(p -> !p.getDeptId().equals(deptId))
.collect(Collectors.toList());
//排除自己如果没有下级则默认使用下边的逻辑查询
if (ObjectUtil.isEmpty(remoteDeptVoList)) {
List<Map<String, Object>> mapList = baseMapper.listOneDepartAlert(businessAlertBo);
return mapList.stream().map(data -> new StatObj(data.get("deptName") + "", Long.parseLong(data.get("total") + ""),"deptId",data.get("deptId"))).collect(Collectors.toList());
}
//如果有则使用这个查询
List<Map<String, Object>> mapList = baseMapper.listDepartAlert(businessAlertBo);
return mapList.stream().map(data -> new StatObj(data.get("deptName") + "", Long.parseLong(data.get("total") + ""),"deptId",data.get("deptId"))).collect(Collectors.toList());
}
@ -134,6 +147,33 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
businessAlertBo.setDeptId(String.valueOf(LoginHelper.getDeptId()));
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()));
//判断是否存在下级
Long deptId = LoginHelper.getDeptId();
List<RemoteDeptVo> remoteDeptVoList = Optional.ofNullable(remoteDeptService.selectListByParentId(String.valueOf(deptId)))
.orElse(Collections.emptyList())
.stream()
.filter(p -> !p.getDeptId().equals(deptId))
.collect(Collectors.toList());
//排除自己如果没有下级则默认使用下边的逻辑查询
if (ObjectUtil.isEmpty(remoteDeptVoList)) {
List<Map<String, Object>> mapList = baseMapper.listOneDepartAlertStatus(businessAlertBo);
return mapList.stream()
.map(map -> new StatObj(
Objects.toString(map.get("deptName")),
List.of(
new StatObj("total", map.get("total")),
new StatObj("todoCount", map.get("todoCount")),
new StatObj("finishCount", map.get("finishCount")),
new StatObj("cancelCount", map.get("cancelCount"))
),"deptId",map.get("deptId")
))
.collect(Collectors.toList());
}
//如果有下级则使用下方方法
List<Map<String, Object>> mapList = baseMapper.listDepartAlertStatus(businessAlertBo);
return mapList.stream()

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

@ -844,4 +844,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY create_time desc
</select>
<select id="listOneDepartAlert" resultType="java.util.Map">
SELECT
dc.dept_id AS deptId,
dc.dept_name AS deptName,
COALESCE(COUNT(ba.id), 0) AS total
FROM
(select dept_id,dept_name from dk_cloud.sys_dept sd where sd.dept_id = #{param.deptId}) dc
LEFT JOIN business_alert ba ON ba.dept_id = dc.dept_id
<include refid="searchSql"></include>
GROUP BY
dc.dept_id,dc.dept_name
</select>
<select id="listOneDepartAlertStatus" resultType="java.util.Map">
SELECT
dc.dept_id AS deptId,
dc.dept_name AS deptName,
COALESCE(COUNT(ba.id), 0) AS total,
IFNULL(SUM(ba.handle_type = 'waiting'), 0) AS todoCount,
IFNULL(SUM(ba.handle_type = 'finish'), 0) AS finishCount,
IFNULL(SUM(ba.handle_type = 'cancel'), 0) AS cancelCount
FROM
(select dept_id,dept_name from dk_cloud.sys_dept sd where sd.dept_id = #{param.deptId}) dc
LEFT JOIN business_alert ba ON ba.dept_id = dc.dept_id
<include refid="searchSql"></include>
GROUP BY
dc.dept_id,dc.dept_name
</select>
</mapper>

5
dk-modules/sample/src/main/java/org/dromara/sample/wayline/service/impl/AiCompareServiceImpl.java

@ -189,12 +189,11 @@ public class AiCompareServiceImpl implements IAiCompareService {
@Override
public Boolean updateStatus(Long id) {
AiCompareEntity aiCompareEntity = aiCompareMapper.selectById(id);
Boolean falg=false;
if(aiCompareEntity!=null&& ObjectUtil.equals(aiCompareEntity.getStatus(),AiCompareStatusConstants.COMPARE_STATUS_2)){
aiCompareEntity.setStatus(AiCompareStatusConstants.COMPARE_STATUS_4);
falg= aiCompareMapper.updateById(aiCompareEntity)>0;
return aiCompareMapper.updateById(aiCompareEntity)>0;
}
return falg;
return true;
}
@Override

Loading…
Cancel
Save