Browse Source

fix: 完善单位问题画像、个人问题画像

main
wxc 1 year ago
parent
commit
af720368cc
  1. 15
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java
  2. 13
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java
  3. 4
      src/main/java/com/biutag/supervision/mapper/ProfileDepartMapper.java
  4. 2
      src/main/java/com/biutag/supervision/mapper/ProfilePoliceMapper.java
  5. 12
      src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java
  6. 4
      src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java
  7. 65
      src/main/resources/mapper/ProfileDepartMapper.xml
  8. 19
      src/main/resources/mapper/ProfilePoliceMapper.xml

15
src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java

@ -114,6 +114,21 @@ public class ProfileDepartController {
// 个人问题排名
List<BarItem> policeBarList = profileDepartMapper.selectPoliceTop10(departId, beginTime, endTime);
profileDepart.setPoliceBarList(policeBarList);
// 风险问题构成 雷达图
List<BarItem> problemTypeBarList = profileDepartMapper.selectProblemType(departId, beginTime, endTime);
int max = problemTypeBarList.stream().mapToInt(BarItem::getValue).max().getAsInt();
List<ProfileDepart.RadarIndicatorItem> problemTypeRadarIndicator = problemTypeBarList.stream().map(item -> {
ProfileDepart.RadarIndicatorItem radarIndicatorItem = new ProfileDepart.RadarIndicatorItem();
radarIndicatorItem.setMax(max);
radarIndicatorItem.setName(item.getLabel());
return radarIndicatorItem;
}).toList();
List<Integer> problemTypeRadarData = problemTypeBarList.stream().map(BarItem::getValue).toList();
profileDepart.setProblemTypeRadarIndicator(problemTypeRadarIndicator);
profileDepart.setProblemTypeRadarData(problemTypeRadarData);
// 突出问题排名
profileDepart.setProblemTypeBarList(problemTypeBarList);
return Result.success(profileDepart);
}

13
src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java

@ -11,6 +11,7 @@ import com.biutag.supervision.mapper.ProfilePoliceMapper;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.domain.ProfileDepart;
import com.biutag.supervision.pojo.domain.ProfilePolice;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.BusinessDepart;
import com.biutag.supervision.pojo.entity.BusinessPolice;
@ -110,6 +111,18 @@ public class ProfilePoliceController {
Map<String, List<Negative>> businessTypeGroup = list.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode));
List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(BusinessTypeEnum.get(key).getLabel(), businessTypeGroup.get(key).size())).toList();
profilePolice.setBusinessTypeList(businessTypeList);
// 风险问题构成 雷达图
List<BarItem> problemTypeBarList = profilePoliceMapper.selectProblemType(idCode, beginTime, endTime);
int max = problemTypeBarList.stream().mapToInt(BarItem::getValue).max().getAsInt();
List<ProfileDepart.RadarIndicatorItem> problemTypeRadarIndicator = problemTypeBarList.stream().map(item -> {
ProfileDepart.RadarIndicatorItem radarIndicatorItem = new ProfileDepart.RadarIndicatorItem();
radarIndicatorItem.setMax(max);
radarIndicatorItem.setName(item.getLabel());
return radarIndicatorItem;
}).toList();
List<Integer> problemTypeRadarData = problemTypeBarList.stream().map(BarItem::getValue).toList();
profilePolice.setProblemTypeRadarIndicator(problemTypeRadarIndicator);
profilePolice.setProblemTypeRadarData(problemTypeRadarData);
return Result.success(profilePolice);
}

4
src/main/java/com/biutag/supervision/mapper/ProfileDepartMapper.java

@ -2,6 +2,7 @@ package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.model.DepartNegativeModel;
import java.util.Date;
@ -15,7 +16,8 @@ public interface ProfileDepartMapper {
Page<DepartNegativeModel> queryDepartNegative(Page<DepartNegativeModel> page, Date beginTime, Date endTime, String departName, String departId);
int getNegativePoliceSize(List<String> idCodes);
List<BarItem> selectPoliceTop10(String departId, Date beginTime, Date endTime);
List<BarItem> selectProblemType(String departId, Date beginTime, Date endTime);
}

2
src/main/java/com/biutag/supervision/mapper/ProfilePoliceMapper.java

@ -1,6 +1,7 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.model.DepartNegativeModel;
import com.biutag.supervision.pojo.model.PoliceNegativeModel;
@ -15,5 +16,6 @@ public interface ProfilePoliceMapper {
Page<PoliceNegativeModel> queryPoliceNegative(Page<PoliceNegativeModel> page, Date beginTime, Date endTime, String name, String empNo, String departId);
List<BarItem> selectProblemType(String idCode, Date beginTime, Date endTime);
}

12
src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java

@ -22,6 +22,18 @@ public class ProfileDepart {
private List<PieItem> problemSourcesList = new ArrayList<>();
private List<PieItem> businessTypeList = new ArrayList<>();
private List<BarItem> policeBarList = new ArrayList<>();
// 雷达图
private List<RadarIndicatorItem> problemTypeRadarIndicator = new ArrayList<>();
private List<Integer> problemTypeRadarData = new ArrayList<>();
private List<BarItem> problemTypeBarList = new ArrayList<>();
@Setter
@Getter
@Accessors(chain = true)
public static class RadarIndicatorItem {
private Integer max;
private String name;
}
@Setter
@Getter

4
src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java

@ -20,4 +20,8 @@ public class ProfilePolice {
private NegativeInfo negativeInfo = new NegativeInfo();
private List<PieItem> problemSourcesList = new ArrayList<>();
private List<PieItem> businessTypeList = new ArrayList<>();
// 雷达图
private List<ProfileDepart.RadarIndicatorItem> problemTypeRadarIndicator = new ArrayList<>();
private List<Integer> problemTypeRadarData = new ArrayList<>();
}

65
src/main/resources/mapper/ProfileDepartMapper.xml

@ -6,23 +6,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryDepartNegative" resultType="com.biutag.supervision.pojo.model.DepartNegativeModel">
SELECT
d.*,
count( DISTINCT nb.blameIdCode ) verify_police_size,
count( n.id ) verify_size
FROM
(
SELECT
d.id depart_id,
d1.short_name parent_depart_name,
d.short_name depart_name,
sum( CASE WHEN p.person_type = '1' THEN 1 ELSE 0 END ) police_size,
sum( CASE WHEN p.person_type = '3' OR p.person_type = '5' THEN 1 ELSE 0 END ) aux_size,
count( DISTINCT nb.blameIdCode ) verify_police_size,
count( n.id ) verify_size
FROM
sum( CASE WHEN p.person_type = '3' OR p.person_type = '5' THEN 1 ELSE 0 END ) aux_size
FROM
sup_depart d
LEFT JOIN sup_depart d1 ON d.pid = d1.id
LEFT JOIN sup_police p ON p.org_id = d.id
LEFT JOIN negative n ON n.involveDepartId = d.id
AND n.checkStatus IN ( '1', '2' )
AND n.crtTime BETWEEN #{beginTime} AND #{endTime}
LEFT JOIN negative_blame nb ON n.id = nb.negativeId
WHERE
LEFT JOIN sup_depart d1 ON d.pid = d1.id
LEFT JOIN sup_police p ON p.org_id = d.id
WHERE
d.LEVEL = 3
GROUP BY
d.id,
d1.short_name,
d.short_name
) d
LEFT JOIN negative n ON n.involveDepartId = d.depart_id
AND n.checkStatus IN ( '1', '2' )
AND n.crtTime BETWEEN #{beginTime} AND #{endTime}
LEFT JOIN negative_blame nb ON n.id = nb.negativeId
WHERE
1 = 1
<if test="departName != null and departName != ''">
AND d.short_name like concat('%', #{departName}, '%')
</if>
@ -30,14 +41,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND d.id = #{departId}
</if>
GROUP BY
d1.short_name,
d.short_name
d.depart_id,
d.parent_depart_name,
d.depart_name
ORDER BY
verify_police_size desc, d1.order_no
</select>
<select id="getNegativePoliceSize" >
verify_size DESC
</select>
<select id="selectPoliceTop10" resultType="com.biutag.supervision.pojo.dto.common.BarItem">
@ -59,4 +67,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 10
</select>
<select id="selectProblemType" resultType="com.biutag.supervision.pojo.dto.common.BarItem">
SELECT
pt.`name` name,
pt.id,
count( DISTINCT n.id ) value
FROM
sup_dict_problem_type pt
LEFT JOIN negative_problem_relation pr ON pt.id = pr.oneLevelCode
LEFT JOIN negative_blame nb ON pr.blameId = nb.blameId
LEFT JOIN negative n ON n.id = nb.negativeId
AND n.checkStatus IN ( '1', '2' )
AND n.involveDepartId = #{departId}
AND n.crtTime BETWEEN #{beginTime} AND #{endTime}
WHERE
pt.`level` = 1
GROUP BY
pt.`name`,
pt.id
order by value desc
</select>
</mapper>

19
src/main/resources/mapper/ProfilePoliceMapper.xml

@ -47,5 +47,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
verify_size DESC
</select>
<select id="selectProblemType" resultType="com.biutag.supervision.pojo.dto.common.BarItem">
SELECT
pt.`name` name,
pt.id,
count( DISTINCT n.id ) value
FROM
sup_dict_problem_type pt
LEFT JOIN negative_problem_relation pr ON pt.id = pr.oneLevelCode
LEFT JOIN negative_blame nb ON pr.blameId = nb.blameId AND nb.blameIdCode = #{idCode}
LEFT JOIN negative n ON n.id = nb.negativeId
AND n.checkStatus IN ( '1', '2' )
AND n.crtTime BETWEEN #{beginTime} AND #{endTime}
WHERE
pt.`level` = 1
GROUP BY
pt.`name`,
pt.id
order by value desc
</select>
</mapper>
Loading…
Cancel
Save