Browse Source

重构事件统计分析;

master
luyan 2 years ago
parent
commit
15a544e856
  1. 10
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventDTO.java
  2. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventAddEditFormDTO.java
  3. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventAnalysisResultDTO.java
  4. 24
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventRateResultDTO.java
  5. 4
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventListResultDTO.java
  6. 23
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java
  7. 54
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventDao.java
  8. 5
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java
  9. 7
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java
  10. 98
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  11. 92
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml

10
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventDTO.java

@ -159,11 +159,11 @@ public class IcEventDTO implements Serializable {
/** /**
* 事件审核状态[涉及附件审核需要加的状态]审核中auditing * 事件审核状态[涉及附件审核需要加的状态]审核中auditing
auto_passed: 自动通过 * auto_passed: 自动通过
review结果不确定需要人工审核 * review结果不确定需要人工审核
block: 结果违规 * block: 结果违规
rejected人工审核驳回; * rejected人工审核驳回;
approved人工审核通过 * approved人工审核通过
*/ */
private String auditStatus; private String auditStatus;

5
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventAddEditFormDTO.java

@ -51,6 +51,11 @@ public class IcEventAddEditFormDTO implements Serializable {
*/ */
@NotBlank(message = "反映渠道不能为空", groups = {AddGroup.class}) @NotBlank(message = "反映渠道不能为空", groups = {AddGroup.class})
private String sourceType; private String sourceType;
/**
* 事件类型1红灯事件 2黄灯事件 3蓝灯事件
*/
private String eventType;
/** /**
* 发生时间 * 发生时间
*/ */

5
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventAnalysisResultDTO.java

@ -25,6 +25,11 @@ public class EventAnalysisResultDTO implements Serializable {
* 网格化平台数量 * 网格化平台数量
*/ */
private Integer wangGeHua; private Integer wangGeHua;
/**
* 0上报 1阅收 3完结 4审核 5事件评价 6结案归档
*/
/** /**
* 待处理 * 待处理
*/ */

24
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventRateResultDTO.java

@ -36,30 +36,6 @@ public class EventRateResultDTO implements Serializable {
*/ */
private Integer lanDeng; private Integer lanDeng;
/**
* 归档数量
*/
private Integer guiDang;
/**
* 未响应占比
*/
private Double hongDengRate;
/**
* 处理中占比
*/
private Double huangDengRate;
/**
* 已完成占比
*/
private Double lanDengRate;
/**
* 归档占比
*/
private Double guiDangRate;
/** /**
* 分类统计数量 * 分类统计数量
*/ */

4
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventListResultDTO.java

@ -77,6 +77,10 @@ public class IcEventListResultDTO implements Serializable {
* 上报渠道[字典表] * 上报渠道[字典表]
*/ */
private String sourceType; private String sourceType;
/**
* 事件类型 1红灯事件 2黄灯事件 3蓝灯事件
*/
private String eventType;
/** /**
* 发生时间 * 发生时间
*/ */

23
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java

@ -583,7 +583,7 @@ public class IcEventController {
* @param * @param null * @param * @param null
* @return Result * @return Result
* @throws * @throws
* @description 获取事件数量和分类数量 * @description 获取事件数量和占比
* @author yan Lu * @author yan Lu
* @date 2023/5/17 14:49 * @date 2023/5/17 14:49
*/ */
@ -594,6 +594,14 @@ public class IcEventController {
return new Result<EventRateResultDTO>().ok(icEventService.getEventRate(orgId, orgType, eventType)); return new Result<EventRateResultDTO>().ok(icEventService.getEventRate(orgId, orgType, eventType));
} }
/**
* @param
* @return Result<EventAnalysisResultDTO>
* @throws
* @description 按事件分类统计
* @author yan Lu
* @date 2023/5/18 17:53
*/
@GetMapping("getEventAnalysis") @GetMapping("getEventAnalysis")
public Result<EventAnalysisResultDTO> getEventAnalysis(@RequestParam("orgId") String orgId, public Result<EventAnalysisResultDTO> getEventAnalysis(@RequestParam("orgId") String orgId,
@RequestParam("orgType") String orgType, @RequestParam("orgType") String orgType,
@ -601,4 +609,17 @@ public class IcEventController {
return new Result<EventAnalysisResultDTO>().ok(icEventService.getEventAnalysis(orgId, orgType, eventType)); return new Result<EventAnalysisResultDTO>().ok(icEventService.getEventAnalysis(orgId, orgType, eventType));
} }
/**
* @param * @param null null
* @return null
* @throws
* @description 根据组织ID获取事件办理统计情况
* @author yan Lu
* @date 2023/5/19 09:28
*/
@GetMapping("getEventRateByAgencyId")
public Result<List<GridOrVillageEventRateResultDTO>> getEventRateByAgencyId(@RequestParam("agencyId") String agencyId) {
return new Result<List<GridOrVillageEventRateResultDTO>>().ok(icEventService.getEventRateByAgencyId(agencyId));
}
} }

54
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventDao.java

@ -148,12 +148,66 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
List<PageUserReportEventResDTO> selectUserReported(PageUserReportEventFormDTO formDTO); List<PageUserReportEventResDTO> selectUserReported(PageUserReportEventFormDTO formDTO);
/**
* 按响应级别统计数量
*
* @param orgIdPath
* @return
*/
EventRateResultDTO getEventCount(@Param("orgIdPath") String orgIdPath);
/**
* 获取事件处理进度占比
*
* @param orgIdPath
* @param eventType
* @return
*/
EventRateResultDTO getEventRate(@Param("orgIdPath") String orgIdPath, @Param("eventType") String eventType); EventRateResultDTO getEventRate(@Param("orgIdPath") String orgIdPath, @Param("eventType") String eventType);
/**
* 分类统计事件来源数量
*
* @param orgPath
* @param eventType
* @return
*/
EventAnalysisResultDTO getEventAnalysis(@Param("orgIdPath") String orgPath, @Param("eventType") String eventType); EventAnalysisResultDTO getEventAnalysis(@Param("orgIdPath") String orgPath, @Param("eventType") String eventType);
/**
* 根据事件类型统计各类型的数量
*
* @param orgPath
* @return
*/
@MapKey("code") @MapKey("code")
List<Map<String, Integer>> getAnalysis(@Param("orgIdPath") String orgPath); List<Map<String, Integer>> getAnalysis(@Param("orgIdPath") String orgPath);
/**
* 根据ID查询事件
*
* @param icEventId
* @return
*/
IcEventEntity selectByEventId(String icEventId); IcEventEntity selectByEventId(String icEventId);
/**
* 根据事件来源获取数量
*
* @param orgPath 1即诉即办 2直通联办 3网格化平台
* @return
*/
EventAnalysisResultDTO getEventBySourceTypeCount(@Param("orgIdPath") String orgPath);
/**
* 根据 事件来源获取 完成进度占比
* 待响应 没有任何回复数据或者只有上报数据
* 处理中 只要包含一条阅收数据即为处理中
* 已结案 只要包含一条完结数据即为已结案
* 已归档 只要包含一条归档数据即为已归档
* manageType: 0上报 1阅收 3完结 4审核 5事件评价 6结案归档
*/
Integer getEventByReplyTypeCount(@Param("orgIdPath") String orgPath,
@Param("sourceType") String sourceType,
@Param("manageType") String manageType);
} }

5
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java

@ -71,6 +71,11 @@ public class IcEventEntity extends BaseEpmetEntity {
*/ */
private String sourceType; private String sourceType;
/**
* 事件类型1红灯事件 2黄灯事件 3蓝灯事件
*/
private String eventType;
/** /**
* 发生时间 * 发生时间
*/ */

7
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java

@ -267,4 +267,11 @@ public interface IcEventService extends BaseService<IcEventEntity> {
* @return * @return
*/ */
EventAnalysisResultDTO getEventAnalysis(String orgId, String orgType, String eventType); EventAnalysisResultDTO getEventAnalysis(String orgId, String orgType, String eventType);
/**
* 根据组织ID获取下一级组织事件不完结率和完结数量
* @return
*/
List<GridOrVillageEventRateResultDTO> getEventRateByAgencyId(String agencyId);
} }

98
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java

@ -322,6 +322,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
entity.setAgencyId(gridInfo.getPid()); entity.setAgencyId(gridInfo.getPid());
entity.setGridPids(gridInfo.getPids()); entity.setGridPids(gridInfo.getPids());
entity.setLatestOperatedTime(nowTime); entity.setLatestOperatedTime(nowTime);
entity.setEventType(formDTO.getEventType());
entity.setAuditStatus(TopicConstant.AUTO_PASSED); entity.setAuditStatus(TopicConstant.AUTO_PASSED);
if ("closed_case".equals(formDTO.getStatus())) { if ("closed_case".equals(formDTO.getStatus())) {
entity.setCloseCaseTime(new Date()); entity.setCloseCaseTime(new Date());
@ -1925,7 +1926,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Override @Override
public EventRateResultDTO getEventRate(String orgId, String orgType, String eventType) { public EventRateResultDTO getEventRate(String orgId, String orgType, String eventType) {
EventRateResultDTO erDto = baseDao.getEventRate(getOrgPath(orgId, orgType), eventType);//事件总量和灯数量,占比 EventRateResultDTO erDto = baseDao.getEventCount(getOrgPath(orgId, orgType));//事件总量和灯数量,占比
List<Map<String, Integer>> dataMap = baseDao.getAnalysis(getOrgPath(orgId, orgType));//按分类获取数量 List<Map<String, Integer>> dataMap = baseDao.getAnalysis(getOrgPath(orgId, orgType));//按分类获取数量
Map<String, Integer> temp = new HashMap<>(); Map<String, Integer> temp = new HashMap<>();
if (null != dataMap && dataMap.size() > 0) { if (null != dataMap && dataMap.size() > 0) {
@ -1958,19 +1959,71 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Override @Override
public EventAnalysisResultDTO getEventAnalysis(String orgId, String orgType, String eventType) { public EventAnalysisResultDTO getEventAnalysis(String orgId, String orgType, String eventType) {
String orgPath = getOrgPath(orgId, orgType); String orgPath = getOrgPath(orgId, orgType);
EventRateResultDTO erDto = baseDao.getEventRate(orgPath, eventType);//事件总量和灯数量,占比 EventAnalysisResultDTO dto = baseDao.getEventBySourceTypeCount(orgPath);//根据事件来源获取事件数量
EventAnalysisResultDTO dto = baseDao.getEventAnalysis(orgPath, eventType); Integer total;
dto.setDaiChuLi(erDto.getHongDeng()); if (StringUtils.isEmpty(eventType)) {
dto.setChuLiZhong(erDto.getHuangDeng()); total = dto.getJiSuJiBan() + dto.getZhiTongLianBan() + dto.getWangGeHua();
dto.setYiJieAn(erDto.getLanDeng()); } else {
dto.setGuiDang(erDto.getGuiDang()); total = eventType.equals("0") ? dto.getJiSuJiBan() : eventType.equals("1") ?
dto.setDaiChuLiRate(erDto.getHongDengRate() == null ? 0 : erDto.getHongDengRate()); dto.getZhiTongLianBan() : dto.getWangGeHua();
dto.setChuLiZhongRate(erDto.getHuangDengRate() == null ? 0 : erDto.getHuangDengRate()); }
dto.setYiJieAnRate(erDto.getLanDengRate() == null ? 0 : erDto.getLanDengRate()); return biuldData(dto, orgPath, eventType, total);
dto.setGuiDangRate(erDto.getGuiDangRate() == null ? 0 : erDto.getGuiDangRate()); }
private EventAnalysisResultDTO biuldData(EventAnalysisResultDTO dto, String orgPath, String eventType, Integer total) {
/**
* eventType 0 即诉即办 1 直通联办 2 网格化平台
* 待响应 没有任何回复数据或者只有上报数据(可能包含多条)
* 处理中 只要包含一条阅收数据即为处理中(可能包含多条)
* 已结案 只要包含一条完结数据即为已结案(应该只有一条)
* 已归档 只要包含一条归档数据即为已归档(应该只有一条)
* 0上报 1阅收 3完结 6结案归档
*/
for (int i = 0; i < 5; i++) {
Integer temp;
if (i == 0) {
temp = baseDao.getEventByReplyTypeCount(orgPath, eventType, String.valueOf(i));
dto.setDaiChuLi(temp);
dto.setDaiChuLiRate(new BigDecimal((double) temp / total).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
if (i == 1) {
temp = baseDao.getEventByReplyTypeCount(orgPath, eventType, String.valueOf(i));
dto.setChuLiZhong(temp);
dto.setChuLiZhongRate(new BigDecimal((double) temp / total).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
if (i == 2) {
i = i + 1;
temp = baseDao.getEventByReplyTypeCount(orgPath, eventType, String.valueOf(i));
dto.setYiJieAn(temp);
dto.setYiJieAnRate(new BigDecimal((double) temp / total).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
if (i == 4) {
i = i + 2;
temp = baseDao.getEventByReplyTypeCount(orgPath, eventType, String.valueOf(i));
dto.setGuiDang(temp);
dto.setGuiDangRate(new BigDecimal((double) temp / total).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
}
return dto; return dto;
} }
@Override
public List<GridOrVillageEventRateResultDTO> getEventRateByAgencyId(String agencyId) {
if (StringUtils.isNotEmpty(agencyId)) {
List<IcEventAnalysisOrgResDTO> orgs = getSubOrgs(agencyId);
if (null != orgs && orgs.size() > 0) {
}
}
return null;
}
/**
* @param orgId
* @param orgType
* @return
* @deprecationg 获取orgPath
*/
private String getOrgPath(String orgId, String orgType) { private String getOrgPath(String orgId, String orgType) {
if (OrgInfoConstant.AGENCY.equals(orgType)) { // 行政组织 if (OrgInfoConstant.AGENCY.equals(orgType)) { // 行政组织
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
@ -1981,4 +2034,27 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
} }
} }
/**
* @param agencyId
* @return
* @deprecation 获取当前组织的所有下级组织
*/
private List<IcEventAnalysisOrgResDTO> getSubOrgs(String agencyId) {
List<IcEventAnalysisOrgResDTO> orgList = new ArrayList<>();
Result<List<SubOrgResDTO>> orgs = govOrgOpenFeignClient.subOrgList(agencyId);
if (!orgs.success() || CollectionUtils.isEmpty(orgs.getData())) {
return orgList;
}
for (SubOrgResDTO org : orgs.getData()) {
IcEventAnalysisOrgResDTO resultDto = ConvertUtils.sourceToTarget(org, IcEventAnalysisOrgResDTO.class);
if ("agency".equals(org.getOrgType())) {
resultDto.setOrgName(org.getOrgName());
resultDto.setOrgType(org.getOrgType());
resultDto.setOrgId(org.getOrgId());
orgList.add(resultDto);
}
}
return orgList;
}
} }

92
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml

@ -440,13 +440,23 @@
ORDER BY re.created_time desc ORDER BY re.created_time desc
</select> </select>
<select id="getEventCount" resultType="com.epmet.dto.result.EventRateResultDTO">
SELECT
count(e.id) as total,
SUM(CASE WHEN e.EVENT_TYPE = 1 THEN 1 ELSE 0 END) as hongDeng,
SUM(CASE WHEN e.EVENT_TYPE = 2 THEN 1 ELSE 0 END) as huangDeng,
SUM(CASE WHEN e.EVENT_TYPE = 3 THEN 1 ELSE 0 END) as lanDeng
FROM ic_event e
<where>
e.DEL_FLAG = 0
<if test="null != orgIdPath and orgIdPath != ''">
and e.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
</where>
</select>
<select id="getEventRate" resultType="com.epmet.dto.result.EventRateResultDTO"> <select id="getEventRate" resultType="com.epmet.dto.result.EventRateResultDTO">
SELECT SELECT
ea.countAll AS total,
eb.hong AS hongDeng,
ec.huang AS huangDeng,
ed.lan as lanDeng,
ee.dang as guiDang,
ROUND( eb.hong / ea.countAll, 2 ) AS hongDengRate, ROUND( eb.hong / ea.countAll, 2 ) AS hongDengRate,
ROUND( ec.huang / ea.countAll, 2 ) AS huangDengRate, ROUND( ec.huang / ea.countAll, 2 ) AS huangDengRate,
ROUND( ed.lan / ea.countAll, 2 ) as lanDengRate, ROUND( ed.lan / ea.countAll, 2 ) as lanDengRate,
@ -467,36 +477,24 @@
<if test="null != orgIdPath and orgIdPath != ''"> <if test="null != orgIdPath and orgIdPath != ''">
and b.GRID_PIDS like concat(#{orgIdPath},'%') and b.GRID_PIDS like concat(#{orgIdPath},'%')
</if> </if>
<if test="null != eventType and eventType !=''">
AND b.SOURCE_TYPE = #{eventType}
</if>
) eb, ) eb,
( SELECT SUM( CASE WHEN c.OPERATION_TYPE = 0 THEN 1 ELSE 0 END ) AS huang ( SELECT SUM( CASE WHEN c.OPERATION_TYPE = 0 THEN 1 ELSE 0 END ) AS huang
FROM ic_event c WHERE c.DEL_FLAG = 0 and c.STATUS = 'processing' FROM ic_event c WHERE c.DEL_FLAG = 0 and c.STATUS = 'processing'
<if test="null != orgIdPath and orgIdPath != ''"> <if test="null != orgIdPath and orgIdPath != ''">
and c.GRID_PIDS like concat(#{orgIdPath},'%') and c.GRID_PIDS like concat(#{orgIdPath},'%')
</if> </if>
<if test="null != eventType and eventType !=''">
AND c.SOURCE_TYPE = #{eventType}
</if>
) ec, ) ec,
( SELECT SUM( CASE WHEN d.OPERATION_TYPE = 0 THEN 1 ELSE 0 END ) as lan ( SELECT SUM( CASE WHEN d.OPERATION_TYPE = 0 THEN 1 ELSE 0 END ) as lan
FROM ic_event d WHERE d.DEL_FLAG = 0 and d.STATUS = 'closed_case' FROM ic_event d WHERE d.DEL_FLAG = 0 and d.STATUS = 'closed_case'
<if test="null != orgIdPath and orgIdPath != ''"> <if test="null != orgIdPath and orgIdPath != ''">
and d.GRID_PIDS like concat(#{orgIdPath},'%') and d.GRID_PIDS like concat(#{orgIdPath},'%')
</if> </if>
<if test="null != eventType and eventType !=''">
AND d.SOURCE_TYPE = #{eventType}
</if>
) ed, ) ed,
( SELECT SUM( CASE WHEN d.DIFFICULT_POINT = 1 THEN 1 ELSE 0 END) as dang ( SELECT SUM( CASE WHEN d.DIFFICULT_POINT = 1 and d.OPERATION_TYPE = 0 THEN 1 ELSE 0 END) as dang
FROM ic_event d WHERE d.DEL_FLAG = 0 FROM ic_event d WHERE d.DEL_FLAG = 0
<if test="null != orgIdPath and orgIdPath != ''"> <if test="null != orgIdPath and orgIdPath != ''">
and d.GRID_PIDS like concat(#{orgIdPath},'%') and d.GRID_PIDS like concat(#{orgIdPath},'%')
</if> </if>
<if test="null != eventType and eventType !=''">
AND d.SOURCE_TYPE = #{eventType}
</if>
) ee ) ee
</select> </select>
@ -540,6 +538,64 @@
</select> </select>
<select id="getEventByReplyTypeCount" resultType="java.lang.Integer">
SELECT
count( ra.eventId )
FROM
(
SELECT
r.IC_EVENT_ID AS eventId
FROM
ic_event_reply r
<where>
r.DEL_FLAG = 0
AND r.MANAGE_STATUS = #{manageType}
AND r.IC_EVENT_ID IN (
SELECT e.id FROM ic_event e
<where>
e.DEL_FLAG = 0
<if test="null != sourceType and sourceType != ''">
AND e.SOURCE_TYPE = #{sourceType}
</if>
<if test="null != orgIdPath and orgIdPath != ''">
AND e.GRID_PIDS LIKE concat(#{orgIdPath},'%')
</if>
</where>
)
</where>
GROUP BY r.IC_EVENT_ID
) ra
</select>
<select id="getEventBySourceTypeCount" resultType="com.epmet.dto.result.EventAnalysisResultDTO">
SELECT
ea.jisujiban as jiSuJiBan,
eb.zhitonglianban as zhiTongLianBan,
ec.wanggehua as wangGeHua
from
(
SELECT count(e.id) as jisujiban from ic_event e
WHERE e.DEL_FLAG = 0 and e.SOURCE_TYPE = 0
<if test="null != orgIdPath and orgIdPath != ''">
and e.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
)ea,
(
SELECT count(e.id) as zhitonglianban from ic_event e
WHERE e.DEL_FLAG = 0 and e.SOURCE_TYPE = 1
<if test="null != orgIdPath and orgIdPath != ''">
and e.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
)eb,
(
SELECT count(e.id) as wanggehua from ic_event e
WHERE e.DEL_FLAG = 0 and e.SOURCE_TYPE = 2
<if test="null != orgIdPath and orgIdPath != ''">
and e.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
)ec
</select>
<select id="getAnalysis" resultType="java.util.Map"> <select id="getAnalysis" resultType="java.util.Map">
SELECT SELECT
c.CATEGORY_ID as code, c.CATEGORY_ID as code,

Loading…
Cancel
Save