Browse Source

新增:事件处理分析-事件列表

修改:时间处理分析-事件饼图
dev
wangxianzhang 3 years ago
parent
commit
7ea5371a5b
  1. 47
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProcessAnalysisEventListFormDTO.java
  2. 18
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java
  3. 40
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/enums/EcEventProcessStatusEnum.java
  4. 5
      epmet-module/gov-project/gov-project-server/pom.xml
  5. 24
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java
  6. 22
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventDao.java
  7. 4
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java
  8. 128
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  9. 40
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml

47
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProcessAnalysisEventListFormDTO.java

@ -0,0 +1,47 @@
package com.epmet.dto.form;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
public class ProcessAnalysisEventListFormDTO {
/**
* 组织id
*/
@NotBlank(message = "组织ID为必填项")
private String orgId;
/**
* 组织类型grid,agency
*/
@NotBlank(message = "组织类型为必填项")
private String orgType;
/**
* 查询起始时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@NotNull(message = "查询时间为必填项")
private Date queryStartTime;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@NotNull(message = "查询时间为必填项")
private Date queryEndTime;
/**
* 处理状态processing, closed_case
*/
private String processStatus;
/**
* 事件分类code
*/
private String categoryCode;
private Integer pageNo;
private Integer pageSize;
}

18
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java

@ -0,0 +1,18 @@
package com.epmet.dto.result;
import lombok.Data;
@Data
public class IcEventResultDTO {
private String eventId;
private String eventContent;
private String gridId;
private String gridName;
private String sourceType;
private String sourceTypeName;
private String processStatus;
private String processStatusName;
private String reportUserId;
private String reportUserName;
private String mobile;
}

40
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/enums/EcEventProcessStatusEnum.java

@ -0,0 +1,40 @@
package com.epmet.enums;
/**
* ic事件状态枚举
*/
public enum EcEventProcessStatusEnum {
PROCESSING("processing", "处理中"),
CLOSED_CASE("closed_case", "已完成");
private String processStatus;
private String processStatusName;
EcEventProcessStatusEnum(String processStatus, String processStatusName) {
this.processStatus = processStatus;
this.processStatusName = processStatusName;
}
/**
* 根据sourceType查询对应的枚举对象
* @param processStatus
* @return
*/
public static EcEventProcessStatusEnum getObjectBySourceType(String processStatus) {
for (EcEventProcessStatusEnum e : EcEventProcessStatusEnum.values()) {
if (e.getProcessStatus().equals(processStatus)) {
return e;
}
}
return null;
}
public String getProcessStatus() {
return processStatus;
}
public String getProcessStatusName() {
return processStatusName;
}
}

5
epmet-module/gov-project/gov-project-server/pom.xml

@ -137,6 +137,11 @@
<version>2.0.0</version> <version>2.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-admin-client</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

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

@ -13,7 +13,9 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcEventDTO; import com.epmet.dto.IcEventDTO;
import com.epmet.dto.form.EventProcessAnalysisCommonFormDTO; import com.epmet.dto.form.EventProcessAnalysisCommonFormDTO;
import com.epmet.dto.form.IcEventListFormDTO; import com.epmet.dto.form.IcEventListFormDTO;
import com.epmet.dto.form.ProcessAnalysisEventListFormDTO;
import com.epmet.dto.result.IcEventListResultDTO; import com.epmet.dto.result.IcEventListResultDTO;
import com.epmet.dto.result.IcEventResultDTO;
import com.epmet.dto.result.ProcessStatusRatioResultDTO; import com.epmet.dto.result.ProcessStatusRatioResultDTO;
import com.epmet.service.IcEventService; import com.epmet.service.IcEventService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -75,7 +77,7 @@ public class IcEventController {
} }
/** /**
* 处理状态比例查询 * 事件分类分析-处理状态比例查询
* @param formDTO * @param formDTO
* @return * @return
*/ */
@ -92,6 +94,26 @@ public class IcEventController {
return new Result<ProcessStatusRatioResultDTO>().ok(r); return new Result<ProcessStatusRatioResultDTO>().ok(r);
} }
/**
* 事件分类分析-事件列表
* @param input
* @return
*/
@PostMapping("processAnalysis/eventList")
public Result<PageData<IcEventResultDTO>> listProcessAnalysisEvents(@RequestBody ProcessAnalysisEventListFormDTO input) {
ValidatorUtils.validateEntity(input);
String orgId = input.getOrgId();
String orgType = input.getOrgType();
String categoryCode = input.getCategoryCode();
Date queryStartTime = input.getQueryStartTime();
Date queryEndTime = input.getQueryEndTime();
Integer pageNo = input.getPageNo();
Integer pageSize = input.getPageSize();
String processStatus = input.getProcessStatus();
PageData<IcEventResultDTO> page = icEventService.listProcessAnalysisEvents(orgId, orgType, categoryCode, processStatus, queryStartTime, queryEndTime, pageNo, pageSize);
return new Result<PageData<IcEventResultDTO>>().ok(page);
}

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

@ -1,6 +1,7 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.IcEventResultDTO;
import com.epmet.dto.result.ProcessStatusRatioResultDTO; import com.epmet.dto.result.ProcessStatusRatioResultDTO;
import com.epmet.entity.IcEventEntity; import com.epmet.entity.IcEventEntity;
import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.MapKey;
@ -29,7 +30,28 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
*/ */
@MapKey("status") @MapKey("status")
List<Map<String, Long>> getProcessStatusRatio(@Param("customerId") String customerId, List<Map<String, Long>> getProcessStatusRatio(@Param("customerId") String customerId,
@Param("orgType") String orgType,
@Param("orgId") String orgId,
@Param("gridPids") String gridPids, @Param("gridPids") String gridPids,
@Param("queryStartTime") Date queryStartTime, @Param("queryStartTime") Date queryStartTime,
@Param("queryEndTime") Date queryEndTime); @Param("queryEndTime") Date queryEndTime);
/**
* 事件处理分析-时间列表
* @param customerId
* @param gridPids
* @param categoryCode
* @param processStatus
* @param queryStartTime 包含
* @param queryEndTime 包含
* @return
*/
List<IcEventResultDTO> listProcessAnalysisEvents(@Param("customerId") String customerId,
@Param("orgType") String orgType,
@Param("orgId") String orgId,
@Param("gridPids") String gridPids,
@Param("categoryCode") String categoryCode,
@Param("processStatus") String processStatus,
@Param("queryStartTime") Date queryStartTime,
@Param("queryEndTime") Date queryEndTime);
} }

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

@ -5,6 +5,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcEventDTO; import com.epmet.dto.IcEventDTO;
import com.epmet.dto.form.IcEventListFormDTO; import com.epmet.dto.form.IcEventListFormDTO;
import com.epmet.dto.result.IcEventListResultDTO; import com.epmet.dto.result.IcEventListResultDTO;
import com.epmet.dto.result.IcEventResultDTO;
import com.epmet.dto.result.ProcessStatusRatioResultDTO; import com.epmet.dto.result.ProcessStatusRatioResultDTO;
import com.epmet.entity.IcEventEntity; import com.epmet.entity.IcEventEntity;
@ -70,4 +71,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
void delete(String[] ids); void delete(String[] ids);
ProcessStatusRatioResultDTO getProcessStatusRatio(String orgId, String orgType, Date queryStartTime, Date queryEndTime); ProcessStatusRatioResultDTO getProcessStatusRatio(String orgId, String orgType, Date queryStartTime, Date queryEndTime);
PageData<IcEventResultDTO> listProcessAnalysisEvents(String orgId, String orgType, String categoryCode, String processStatus, Date queryStartTime,
Date queryEndTime, Integer pageNo, Integer pageSize);
} }

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

@ -9,20 +9,19 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcEventDao; import com.epmet.dao.IcEventDao;
import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.IcEventDTO; import com.epmet.dto.IcEventDTO;
import com.epmet.dto.form.AgencyInfoFormDTO; import com.epmet.dto.form.AgencyInfoFormDTO;
import com.epmet.dto.form.IcEventListFormDTO; import com.epmet.dto.form.IcEventListFormDTO;
import com.epmet.dto.result.AgencyInfoResultDTO; import com.epmet.dto.result.*;
import com.epmet.dto.result.GridInfoResultDTO;
import com.epmet.dto.result.IcEventListResultDTO;
import com.epmet.dto.result.ProcessStatusRatioResultDTO;
import com.epmet.entity.IcEventEntity; import com.epmet.entity.IcEventEntity;
import com.epmet.feign.GovOrgFeignClient; import com.epmet.enums.EcEventProcessStatusEnum;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.IcEventService; import com.epmet.service.IcEventService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -51,6 +50,9 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Autowired @Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient; private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private EpmetAdminOpenFeignClient adminOpenFeignClient;
@Override @Override
public PageData<IcEventListResultDTO> list(IcEventListFormDTO formDTO) { public PageData<IcEventListResultDTO> list(IcEventListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
@ -96,53 +98,51 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
baseDao.deleteBatchIds(Arrays.asList(ids)); baseDao.deleteBatchIds(Arrays.asList(ids));
} }
/**
* 查询时间的grid_pids
* @param agencyId
* @return
*/
public String getEventGridPids(String agencyId) {
String gridPids;
String errorMsg = "查询组织信息失败";
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(agencyId),
ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(),
errorMsg,
errorMsg);
if (agencyInfo == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "组织信息未找到", "网格信息未找到");
}
String purePids = agencyInfo.getPids();
if ("0".equals(purePids) || StringUtils.isBlank(purePids)) {
gridPids = agencyInfo.getId();
} else {
gridPids = purePids.concat(":").concat(agencyInfo.getId());
}
return gridPids;
}
@Override @Override
public ProcessStatusRatioResultDTO getProcessStatusRatio(String orgId, String orgType, Date queryStartTime, Date queryEndTime) { public ProcessStatusRatioResultDTO getProcessStatusRatio(String orgId, String orgType, Date queryStartTime, Date queryEndTime) {
String gridPids;
AgencyInfoFormDTO form = new AgencyInfoFormDTO(); AgencyInfoFormDTO form = new AgencyInfoFormDTO();
form.setOrgId(orgId); form.setOrgId(orgId);
form.setOrgType(orgType); form.setOrgType(orgType);
String gridPids = null;
if ("agency".equals(orgType)) { if ("agency".equals(orgType)) {
String errorMsg = "查询组织信息失败"; gridPids = getEventGridPids(orgId);
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(orgId),
ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(),
errorMsg,
errorMsg);
if (agencyInfo == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "组织信息未找到", "网格信息未找到");
}
String purePids = agencyInfo.getPids();
if ("0".equals(purePids) || StringUtils.isBlank(purePids)) {
gridPids = agencyInfo.getId();
} else {
gridPids = purePids.concat(":").concat(agencyInfo.getId());
}
} else if ("grid".equals(orgType)) {
String errorMsg = "查询agency信息失败";
GridInfoResultDTO gridInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.queryGridInfo(orgId),
ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(),
errorMsg,
errorMsg);
if (gridInfo == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "网格信息未找到", "网格信息未找到");
}
gridPids = gridInfo.getPids();
} else {
String errorMsg= "组织类型参数错误";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg);
} }
List<Map<String, Long>> m = baseDao.getProcessStatusRatio(EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID), gridPids, queryStartTime, queryEndTime); List<Map<String, Long>> m = baseDao.getProcessStatusRatio(
EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID), orgType, orgId, gridPids, queryStartTime, queryEndTime);
ProcessStatusRatioResultDTO r = new ProcessStatusRatioResultDTO(); ProcessStatusRatioResultDTO r = new ProcessStatusRatioResultDTO();
BigDecimal processingCount = null; BigDecimal processingCount = new BigDecimal(0);
BigDecimal closedCount = null; BigDecimal closedCount = new BigDecimal(0);;
BigDecimal processingRatio = null; BigDecimal processingRatio = null;
BigDecimal closedRatio = null; BigDecimal closedRatio = null;
@ -166,4 +166,52 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
return r; return r;
} }
@Override
public PageData<IcEventResultDTO> listProcessAnalysisEvents(String orgId, String orgType, String categoryCode, String processStatus,
Date queryStartTime, Date queryEndTime, Integer pageNo,
Integer pageSize) {
// 1.分类字典
Map<String, String> eventSourceTypeDict = getResultDataOrThrowsException(adminOpenFeignClient.dictMap("ic_event_source_type"),
ServiceConstant.EPMET_ADMIN_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(),
"【IC事件分析】查询上报渠道字典失败",
"【IC事件分析】查询上报渠道字典失败");
String gridPids = null;
if ("agency".equals(orgType)) {
gridPids = getEventGridPids(orgId);
}
// 2.分页查询
PageHelper.startPage(pageNo, pageSize);
List<IcEventResultDTO> list = baseDao.listProcessAnalysisEvents(
EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID), orgType, orgId, gridPids, categoryCode, processStatus, queryStartTime
,queryEndTime);
// 3.补充数据
for (IcEventResultDTO event : list) {
// 网格信息
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(event.getGridId());
if (gridInfo != null) {
event.setGridName(gridInfo.getGridName());
} else {
logger.error("【IC事件分析】网格ID[{}]查询网格信息失败", event.getGridId());
}
// 上报渠道
event.setSourceTypeName(eventSourceTypeDict.get(event.getSourceType()));
// 状态
EcEventProcessStatusEnum sourceTypeEnum = EcEventProcessStatusEnum.getObjectBySourceType(event.getProcessStatus());
if (sourceTypeEnum != null) {
event.setProcessStatusName(sourceTypeEnum.getProcessStatusName());
}
}
PageInfo<IcEventResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
} }

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

@ -42,13 +42,49 @@
<select id="getProcessStatusRatio" resultType="java.util.Map"> <select id="getProcessStatusRatio" resultType="java.util.Map">
select STATUS status, count(1) eventCount select STATUS status, count(1) eventCount
from ic_event e from ic_event e
where <where>
e.GRID_PIDS like CONCAT(#{gridPids},'%') <if test="orgType == 'agency'">
and e.GRID_PIDS like CONCAT(#{gridPids},'%')
</if>
<if test="orgType == 'grid'">
and e.GRID_ID=#{orgId}
</if>
and CUSTOMER_ID = #{customerId} and CUSTOMER_ID = #{customerId}
and CREATED_TIME >= #{queryStartTime} and CREATED_TIME >= #{queryStartTime}
and CREATED_TIME <![CDATA[<=]]> #{queryEndTime} and CREATED_TIME <![CDATA[<=]]> #{queryEndTime}
</where>
group by STATUS group by STATUS
</select> </select>
<select id="listProcessAnalysisEvents" resultType="com.epmet.dto.result.IcEventResultDTO">
select e.ID eventId,
e.GRID_ID gridId,
e.EVENT_CONTENT eventContent,
e.SOURCE_TYPE sourceType,
e.REPORT_USER_ID reportUserId,
e.NAME reportUserName,
e.MOBILE mobile,
e.STATUS processStatus
from ic_event e
inner join ic_event_category c on (e.ID = c.IC_EVENT_ID)
<where>
e.CUSTOMER_ID = #{customerId}
and e.CREATED_TIME >= #{queryStartTime}
and e.CREATED_TIME <![CDATA[<=]]> #{queryEndTime}
<if test="orgType == 'agency'">
and e.GRID_PIDS like CONCAT(#{gridPids},'%')
</if>
<if test="orgType == 'grid'">
and e.GRID_ID=#{orgId}
</if>
<if test="processStatus != null and processStatus != ''">
and e.STATUS = #{processStatus}
</if>
<if test="categoryCode != null and categoryCode != ''">
and c.CATEGORY_CODE = #{categoryCode}
</if>
</where>
</select>
</mapper> </mapper>
Loading…
Cancel
Save