Browse Source

大屏相关接口修改

feature/dangjian
zhaoqifeng 3 years ago
parent
commit
4c6748eb09
  1. 4
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/screen/form/EventStatisticsFormDTO.java
  2. 2
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/screen/result/EfficiencyEvaluationResultDTO.java
  3. 2
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/screen/result/EventStatisticsResultDTO.java
  4. 2
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/controller/ScreenController.java
  5. 9
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/dao/ScreenDeptEventEfficiencyDao.java
  6. 31
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenDeptEventEfficiencyServiceImpl.java
  7. 15
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenDeptEventStatServiceImpl.java
  8. 48
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/screen/ScreenDeptEventEfficiencyDao.xml
  9. 2
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/screen/ScreenDeptEventStatDao.xml

4
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/screen/form/EventStatisticsFormDTO.java

@ -24,5 +24,7 @@ public class EventStatisticsFormDTO implements Serializable {
private String startDate;
private String endDate;
private String type;
private String peopleFlag;
private String peopleFlag = "";
private String sort = "";
private String sortType = "desc";
}

2
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/screen/result/EfficiencyEvaluationResultDTO.java

@ -21,7 +21,7 @@ public class EfficiencyEvaluationResultDTO implements Serializable {
* 部门名称
*/
private String deptName;
private String deptLevel;
/**
* 事件总数
*/

2
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/screen/result/EventStatisticsResultDTO.java

@ -22,7 +22,7 @@ public class EventStatisticsResultDTO implements Serializable {
* 部门名称
*/
private String deptName;
private String deptLevel;
/**
* 事件总数
*/

2
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/controller/ScreenController.java

@ -61,7 +61,7 @@ public class ScreenController {
*/
@PostMapping("getEventBar")
public Result<BarCategoryResultDTO> getEventBar(@RequestBody EventStatisticsFormDTO formDTO) {
return new Result<BarCategoryResultDTO>().ok(screenDeptEventStatService.getEventBar(formDTO));
return new Result<BarCategoryResultDTO>().ok(screenDeptEventEfficiencyService.getEventBar(formDTO));
}
/**

9
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/dao/ScreenDeptEventEfficiencyDao.java

@ -80,4 +80,13 @@ public interface ScreenDeptEventEfficiencyDao extends BaseDao<ScreenDeptEventEff
List<EfficiencyEvaluationResultDTO> getScreenDataByInterval(EventStatisticsFormDTO formDTO);
void deleteData(@Param("statDate") String statDate);
/**
* 柱状图
* @Param formDTO
* @Return {@link List< EfficiencyEvaluationResultDTO>}
* @Author zhaoqifeng
* @Date 2022/10/18 10:06
*/
List<EfficiencyEvaluationResultDTO> getEventBar(EventStatisticsFormDTO formDTO);
}

31
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenDeptEventEfficiencyServiceImpl.java

@ -232,6 +232,11 @@ public class ScreenDeptEventEfficiencyServiceImpl extends BaseServiceImpl<Screen
List<EfficiencyEvaluationResultDTO> list = baseDao.getScreenDataByInterval(formDTO);
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(item -> {
if ("grid_party".equals(item.getDeptLevel())) {
if (item.getDeptName().contains("社区")) {
item.setDeptName(StringUtils.substringAfter(item.getDeptName(), "社区"));
}
}
//计算结案率,响应率,满意率
if (item.getEventCount() != NumConstant.ZERO) {
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED);
@ -258,8 +263,17 @@ public class ScreenDeptEventEfficiencyServiceImpl extends BaseServiceImpl<Screen
}
return list;
}
return baseDao.getScreenData(formDTO);
List<EfficiencyEvaluationResultDTO> list = baseDao.getScreenData(formDTO);
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(item -> {
if ("grid_party".equals(item.getDeptLevel())) {
if (item.getDeptName().contains("社区")) {
item.setDeptName(StringUtils.substringAfter(item.getDeptName(), "社区"));
}
}
});
}
return list;
}
/**
@ -293,18 +307,19 @@ public class ScreenDeptEventEfficiencyServiceImpl extends BaseServiceImpl<Screen
} else if (NumConstant.THREE_STR.equals(formDTO.getStatType())) {
//日期为本年
formDTO.setStatDate(DateUtils.format(new Date(), DateUtils.DATE_PATTERN).substring(0, 4));
} else {
//自定义区间
List<EfficiencyEvaluationResultDTO> list = baseDao.getScreenDataByInterval(formDTO);
return getBarCategoryResultDTO(result, list);
}
List<EfficiencyEvaluationResultDTO> list = baseDao.getScreenData(formDTO);
List<EfficiencyEvaluationResultDTO> list = baseDao.getEventBar(formDTO);
return getBarCategoryResultDTO(result, list);
}
private BarCategoryResultDTO getBarCategoryResultDTO(BarCategoryResultDTO result, List<EfficiencyEvaluationResultDTO> list) {
if (CollectionUtils.isNotEmpty(list)) {
List<BarCategoryDTO> barList = list.stream().map(item -> {
if ("grid_party".equals(item.getDeptLevel())) {
if (item.getDeptName().contains("社区")) {
item.setDeptName(StringUtils.substringAfter(item.getDeptName(), "社区"));
}
}
BarCategoryDTO dto = new BarCategoryDTO();
dto.setCategoryCode(item.getDeptId());
dto.setCategoryName(item.getDeptName());
@ -315,7 +330,7 @@ public class ScreenDeptEventEfficiencyServiceImpl extends BaseServiceImpl<Screen
detail.add(eventDetail);
BarCategoryDetail closedDetail = new BarCategoryDetail();
closedDetail.setLegendName("结案数");
closedDetail.setCount(item.getEventCount());
closedDetail.setCount(item.getClosedCount());
detail.add(closedDetail);
dto.setDetail(detail);
return dto;

15
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenDeptEventStatServiceImpl.java

@ -153,6 +153,16 @@ public class ScreenDeptEventStatServiceImpl extends BaseServiceImpl<ScreenDeptEv
result = baseDao.getEventStatByOther(formDTO);
}
if (CollectionUtils.isNotEmpty(result)) {
result.forEach(item -> {
if ("grid_party".equals(item.getDeptLevel())) {
if (item.getDeptName().contains("社区")) {
item.setDeptName(StringUtils.substringAfter(item.getDeptName(), "社区"));
}
}
});
}
return result;
}
@ -203,6 +213,11 @@ public class ScreenDeptEventStatServiceImpl extends BaseServiceImpl<ScreenDeptEv
private BarCategoryResultDTO getBarCategoryResultDTO(BarCategoryResultDTO result, List<EventStatisticsResultDTO> list, String peopleFlag) {
if (CollectionUtils.isNotEmpty(list)) {
List<BarCategoryDTO> barList = list.stream().map(item -> {
if ("grid_party".equals(item.getDeptLevel())) {
if (item.getDeptName().contains("社区")) {
item.setDeptName(StringUtils.substringAfter(item.getDeptName(), "社区"));
}
}
BarCategoryDTO dto = new BarCategoryDTO();
dto.setCategoryCode(item.getDeptId());
dto.setCategoryName(item.getDeptName());

48
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/screen/ScreenDeptEventEfficiencyDao.xml

@ -352,7 +352,8 @@
<select id="getScreenData" resultType="com.elink.esua.epdc.dto.screen.result.EfficiencyEvaluationResultDTO">
SELECT DEPT_ID,
DEPT_NAME,
<if test="peopleFlag != null and peopleFlag != ''">
DEPT_LEVEL,
<if test="peopleFlag == null or peopleFlag == ''">
EVENT_COUNT,
CLOSED_COUNT,
RESPONSE_COUNT,
@ -431,6 +432,7 @@
<select id="getScreenDataByInterval" resultType="com.elink.esua.epdc.dto.screen.result.EfficiencyEvaluationResultDTO">
SELECT a.id AS deptId,
a.`name` AS deptName,
a.type_key AS deptLevel,
IFNULL(SUM(b.eventCount), 0) AS eventCount,
IFNULL(SUM(b.closedCount), 0) AS closedCount,
IFNULL(SUM(b.responseCount), 0) AS responseCount,
@ -531,4 +533,48 @@
ORDER BY a.sort,
CONVERT(a.`name` USING gbk) ASC
</select>
<select id="getEventBar" resultType="com.elink.esua.epdc.dto.screen.result.EfficiencyEvaluationResultDTO">
SELECT a.id AS deptId,
a.`name` AS deptName,
a.type_key AS deptLevel,
IFNULL(SUM(b.eventCount), 0) AS eventCount,
IFNULL(SUM(b.closedCount), 0) AS closedCount
FROM meta_sys_dept a
LEFT JOIN (
SELECT ALL_DEPT_IDS,
COUNT(ID) AS eventCount,
COUNT(CASE WHEN ITEM_STATE = '10' THEN ID END) AS closedCount
FROM epdc_item
WHERE DEL_FLAG = '0'
AND PEOPLE_FLAG IS NOT NULL
AND IS_PEOPLE = '1'
AND EVENT_ID IS NULL
AND ISSUE_ID IS NULL
<if test="peopleFlag != null and peopleFlag != ''">
AND PEOPLE_FLAG = #{peopleFlag}
</if>
<if test='statType == "1"'>
AND DATE_FORMAT(CREATED_TIME, '%Y-%m-%d') &lt;= #{statDate}
</if>
<if test='statType == "2"'>
AND DATE_FORMAT(CREATED_TIME, '%Y-%m') = #{statDate}
</if>
<if test='statType == "3"'>
AND DATE_FORMAT(CREATED_TIME, '%Y') = #{statDate}
</if>
<if test='statType == "4"'>
AND DATE_FORMAT(CREATED_TIME, '%Y-%m-%d') &gt;= #{startDate}
AND DATE_FORMAT(CREATED_TIME, '%Y-%m-%d') &lt;= #{endDate}
</if>
GROUP BY ALL_DEPT_IDS
) b ON b.ALL_DEPT_IDS LIKE CONCAT('%', a.id, '%')
WHERE a.del_flag = '0'
AND a.type_key != 'street_dept'
AND a.type_key != 'district_dept'
AND a.PID = #{deptId}
GROUP BY a.id
ORDER BY a.sort,
CONVERT(a.`name` USING gbk) ASC
</select>
</mapper>

2
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/screen/ScreenDeptEventStatDao.xml

@ -58,6 +58,7 @@
<select id="getEventStatByDay" resultType="com.elink.esua.epdc.dto.screen.result.EventStatisticsResultDTO">
SELECT DEPT_ID,
DEPT_NAME,
DEPT_LEVEL,
EVENT_COUNT,
LIVELIHOOD_COUNT,
DEVELOP_COUNT,
@ -78,6 +79,7 @@
<select id="getEventStatByOther" resultType="com.elink.esua.epdc.dto.screen.result.EventStatisticsResultDTO">
SELECT DEPT_ID,
DEPT_NAME,
DEPT_LEVEL,
SUM(EVENT_INCR) EVENT_COUNT,
SUM(LIVELIHOOD_INCR) LIVELIHOOD_COUNT,
SUM(DEVELOP_INCR) DEVELOP_COUNT,

Loading…
Cancel
Save