Browse Source

Merge branch 'lingshan_master' into dev

master
wxz 2 years ago
parent
commit
a33ecc2968
  1. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingShanAgentServiceServiceImpl.java
  2. 35
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventAnalysisResultDTO.java
  3. 49
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventRateResultDTO.java
  4. 20
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java
  5. 59
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventDao.java
  6. 35
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java
  7. 249
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  8. 88
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml

25
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingShanAgentServiceServiceImpl.java

@ -569,8 +569,7 @@ public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceServ
List<LingShanScreenServiceRstDTO.ProcessNode> processNodes = rd.getProcessNodes();
// 创建起始节点
LingShanScreenServiceRstDTO.ProcessNode nc = createProcessNode(LingShanAgentServiceProcessStatusEnum.WAIT_ACCEPT, serviceRecord.getApplicantName(), null, serviceRecord.getCreatedTime(), new ArrayList<>());
processNodes.add(nc);
LingShanScreenServiceRstDTO.ProcessNode waitAcceptNode = createProcessNode(LingShanAgentServiceProcessStatusEnum.WAIT_ACCEPT, serviceRecord.getApplicantName(), null, serviceRecord.getCreatedTime(), new ArrayList<>());
// 根据最新状态拼接后续处理节点
int processStatus = serviceRecord.getProcessStatus().intValue();
@ -578,28 +577,30 @@ public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceServ
if (LingShanAgentServiceProcessStatusEnum.WITHDRAW.getStatusCode() == processStatus) {
// 已撤回
LingShanScreenServiceRstDTO.ProcessNode nd = createProcessNode(processStatusEnum, serviceRecord.getApplicantName(), null, serviceRecord.getProcessTime(), new ArrayList<>());
processNodes.add(nd);
LingShanScreenServiceRstDTO.ProcessNode withdrawNode = createProcessNode(processStatusEnum, serviceRecord.getApplicantName(), null, serviceRecord.getProcessTime(), new ArrayList<>());
processNodes.add(withdrawNode);
} else {
// 正常处理流程
if (processStatus == LingShanAgentServiceProcessStatusEnum.ACCEPTED.getStatusCode()) {
// 受理 0 1
LingShanScreenServiceRstDTO.ProcessNode np = createProcessNode(processStatusEnum, serviceRecord.getAgentName(), serviceRecord.getProcessDesc(), serviceRecord.getProcessTime(), new ArrayList<>());
processNodes.add(np);
LingShanScreenServiceRstDTO.ProcessNode acceptedNode = createProcessNode(processStatusEnum, serviceRecord.getAgentName(), serviceRecord.getProcessDesc(), serviceRecord.getProcessTime(), new ArrayList<>());
processNodes.add(acceptedNode);
} else if (processStatus == LingShanAgentServiceProcessStatusEnum.REJECTED.getStatusCode()) {
// 驳回 0 2
LingShanScreenServiceRstDTO.ProcessNode np = createProcessNode(processStatusEnum, serviceRecord.getAgentName(), serviceRecord.getProcessDesc(), serviceRecord.getProcessTime(), new ArrayList<>());
processNodes.add(np);
LingShanScreenServiceRstDTO.ProcessNode rejectedNode = createProcessNode(processStatusEnum, serviceRecord.getAgentName(), serviceRecord.getProcessDesc(), serviceRecord.getProcessTime(), new ArrayList<>());
processNodes.add(rejectedNode);
} else {
// 办结 0 1 3
LingShanScreenServiceRstDTO.ProcessNode na = createProcessNode(LingShanAgentServiceProcessStatusEnum.ACCEPTED, serviceRecord.getAgentName(), serviceRecord.getProcessDesc(), serviceRecord.getProcessTime(), new ArrayList<>());
LingShanScreenServiceRstDTO.ProcessNode ncc = createProcessNode(LingShanAgentServiceProcessStatusEnum.CLOSED, serviceRecord.getAgentName(), serviceRecord.getCloseDesc(), serviceRecord.getCloseTime(), JSON.parseArray(serviceRecord.getProcessAttachments(), String.class));
processNodes.add(na);
processNodes.add(ncc);
LingShanScreenServiceRstDTO.ProcessNode acceptedNode = createProcessNode(LingShanAgentServiceProcessStatusEnum.ACCEPTED, serviceRecord.getAgentName(), serviceRecord.getProcessDesc(), serviceRecord.getProcessTime(), new ArrayList<>());
LingShanScreenServiceRstDTO.ProcessNode closedNode = createProcessNode(LingShanAgentServiceProcessStatusEnum.CLOSED, serviceRecord.getAgentName(), serviceRecord.getCloseDesc(), serviceRecord.getCloseTime(), JSON.parseArray(serviceRecord.getProcessAttachments(), String.class));
processNodes.add(closedNode);
processNodes.add(acceptedNode);
}
}
processNodes.add(waitAcceptNode);
return rd;
}

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

@ -0,0 +1,35 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Map;
/**
* @author yan Lu
* @description 事件分析数量和分类统计数量
* @create 2023/5/17 15:15
*/
@Data
public class EventAnalysisResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 即诉即办数量
*/
private Integer jiSuJiBan;
/**
* 直通联办数量
*/
private Integer zhiTongLianBan;
/**
* 网格化平台数量
*/
private Integer wangGeHua;
/**
* 分类统计数量
*/
private Map<String, Integer> categoryCount;
}

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

@ -0,0 +1,49 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author yan Lu
* @description 事件量和占比率
* @create 2023/5/17 14:50
*/
@Data
public class EventRateResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 总量
*/
private Integer total;
/**
* 红灯数量
*/
private Integer hongDeng;
/**
* 红灯占比
*/
private Double hongDengRate;
/**
* 黄灯数量
*/
private Integer huangDeng;
/**
* 黄灯占比
*/
private Double huangDengRate;
/**
* 蓝灯数量
*/
private Integer lanDeng;
/**
* 蓝灯占比
*/
private Double lanDengRate;
}

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

@ -559,4 +559,24 @@ public class IcEventController {
return new Result<List<IcEventDTO>>().ok(icEventService.batchSelectById(icEventIds));
}
/**
* @description 获取事件数量和占比率
* @param * @param null
* @return Result
* @throws
* @author yan Lu
* @date 2023/5/17 14:49
*/
@GetMapping("getEventRate")
public Result<EventRateResultDTO> getEventRate(@RequestParam("orgId") String orgId,
@RequestParam("orgType") String orgType){
return new Result<EventRateResultDTO>().ok(icEventService.getEventRate(orgId,orgType));
}
@GetMapping("getEventAnalysis")
public Result<EventAnalysisResultDTO> getEventAnalysis(@RequestParam("orgId") String orgId,
@RequestParam("orgType") String orgType){
return new Result<EventAnalysisResultDTO>().ok(icEventService.getEventAnalysis(orgId,orgType));
}
}

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

@ -29,6 +29,7 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
/**
* 查询事件处理状态比例
*
* @param gridPids
* @param queryStartTime
* @param queryEndTime
@ -37,33 +38,35 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
@MapKey("status")
List<Map<String, Long>> getProcessStatusRatio(@Param("customerId") String customerId,
@Param("orgType") String orgType,
@Param("orgId") String orgId,
@Param("gridPids") String gridPids,
@Param("queryStartTime") Date queryStartTime,
@Param("queryEndTime") Date queryEndTime);
@Param("orgId") String orgId,
@Param("gridPids") String gridPids,
@Param("queryStartTime") Date queryStartTime,
@Param("queryEndTime") Date queryEndTime);
/**
* 事件处理分析-时间列表
*
* @param customerId
* @param gridPids
* @param categoryCode
* @param processStatus
* @param queryStartTime 包含
* @param queryEndTime 包含
* @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,
@Param("biz") String biz);
@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,
@Param("biz") String biz);
/**
* 月度事件数统计查询
*
* @param orgType
* @param orgId
* @param gridPids
@ -72,14 +75,15 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
* @return
*/
List<IcEventMonthlyCountResultDTO> listMonthlyEventCount(
@Param("orgType") String orgType,
@Param("orgId") String orgId,
@Param("gridPids") String gridPids,
@Param("queryStartTime") Date queryStartTime,
@Param("queryEndTime") Date queryEndTime);
@Param("orgType") String orgType,
@Param("orgId") String orgId,
@Param("gridPids") String gridPids,
@Param("queryStartTime") Date queryStartTime,
@Param("queryEndTime") Date queryEndTime);
/**
* 按父级分类查询组织下的事件列表
*
* @param orgId
* @param orgType
* @param categoryPids
@ -91,7 +95,6 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
@Param("categoryPids") String categoryPids);
/**
*
* @param formDTO
* @return
*/
@ -99,24 +102,25 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
/**
* Desc: 查询客户下可以自动评价事件的ID
*
* @param customerId
* @param no
* @param size
* @author zxc
* @date 2022/5/18 17:20
*/
List<String> getAutoEvaluationIds(@Param("customerId") String customerId,@Param("no")Integer no,@Param("size")Integer size);
List<String> getAutoEvaluationIds(@Param("customerId") String customerId, @Param("no") Integer no, @Param("size") Integer size);
/**
* Desc: 更新评价默认 perfect
*
* @param ids
* @author zxc
* @date 2022/5/18 17:26
*/
void updateAutoEvaluation(@Param("ids")List<String> ids);
void updateAutoEvaluation(@Param("ids") List<String> ids);
/**
*
* @param formDTO
* @return
*/
@ -130,10 +134,11 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
*/
List<MyReportIcEvResDTO> selectMyReport(MyReportIcEvFormDTO formDTO);
int updateRedDot(@Param("userId") String userId, @Param("icEventId")String icEventId);
int updateRedDot(@Param("userId") String userId, @Param("icEventId") String icEventId);
/**
* 查询居民上报的时间数量
*
* @param reportorIdCard 上报人的身份证号
* @return
*/
@ -143,4 +148,12 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
List<PageUserReportEventResDTO> selectUserReported(PageUserReportEventFormDTO formDTO);
EventRateResultDTO getEventRate(@Param("orgIdPath") String orgIdPath);
EventAnalysisResultDTO getEventAnalysis(@Param("orgIdPath") String orgPath);
@MapKey("code")
List<Map<String,Integer>> getAnalysis(@Param("orgIdPath") String orgPath);
IcEventEntity selectByEventId(String icEventId);
}

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

@ -73,6 +73,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/**
* 事件列表
*
* @param orgId
* @param orgType
* @param categoryCode
@ -84,10 +85,11 @@ public interface IcEventService extends BaseService<IcEventEntity> {
* @return
*/
PageData<IcEventResultDTO> listProcessAnalysisEvents(String orgId, String orgType, String categoryCode, String processStatus, Date queryStartTime,
Date queryEndTime, Integer pageNo, Integer pageSize, String biz);
Date queryEndTime, Integer pageNo, Integer pageSize, String biz);
/**
* 月度增量查询
*
* @param orgType
* @param orgId
* @param queryStartTime
@ -98,6 +100,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/**
* 研判分析查询
*
* @param eventId
* @return
*/
@ -105,6 +108,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/**
* 同类事件列表
*
* @param categoryPids
* @param pageNo
* @param pageSize
@ -132,6 +136,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/**
* 事件分类分析-一级分类下事件数量
*
* @param formDTO
* @return
*/
@ -145,6 +150,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/**
* Desc: 定时任务自动评价
*
* @param formDTO
* @author zxc
* @date 2022/5/18 16:35
@ -162,8 +168,10 @@ public interface IcEventService extends BaseService<IcEventEntity> {
* @Description 事件管理-处理进展
**/
LinkedList<IcEventProcessListResultDTO> process(IcEventReplyFormDTO formDTO);
/**
* 事件分类分析- 饼图2直属下级 事件数量
*
* @param formDTO
* @return
*/
@ -171,13 +179,14 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/**
* @Author sun
* @Description 需求完成/项目结案时 修改事件数据
* @Description 需求完成/项目结案时 修改事件数据
* 议题关闭时如果议题来源于事件也会调用此方法
**/
void closeProjectOrDemand(ColseProjectOrDemandFormDTO formDTO);
/**
* Desc: 新增随手拍
*
* @param formDTO
* @author zxc
* @date 2022/5/19 13:38
@ -206,19 +215,21 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/**
* 居民端我上报的事件-回复
*
* @param formDTO
*/
void resiReply(ResiReplyIcEventFormDTO formDTO);
/**
* 居民端我上报的事件 消息列表跳转详情
*
* @param formDTO
* @return
*/
MyReportIcEvResDTO myReportDetail(MyReportIcEvFormDTO formDTO);
/**
* @Description 工作端事件红点消除
* @Description 工作端事件红点消除
**/
void govRedDot(String icEventId);
@ -228,14 +239,32 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/**
* 事件转议题
*
* @param formDTO
*/
void icEventToIssue(IcEventToIssueFormDTO formDTO);
/**
* 批量查询事件信息
*
* @param icEventIds
* @return
*/
List<IcEventDTO> batchSelectById(List<String> icEventIds);
/**
* 获取事件数量和占比
*
* @return
*/
EventRateResultDTO getEventRate(String orgId, String orgType);
/**
* 事件分析数据获取
*
* @param orgId
* @param orgType
* @return
*/
EventAnalysisResultDTO getEventAnalysis(String orgId, String orgType);
}

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

@ -15,6 +15,7 @@ import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
@ -102,7 +103,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
private LoginUserUtil loginUserUtil;
public CustomerStaffInfoCacheResult getStaffInfo(String customerId,String staffId){
public CustomerStaffInfoCacheResult getStaffInfo(String customerId, String staffId) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, staffId);
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", staffId));
@ -112,7 +113,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Override
public PageData<IcEventListResultDTO> list(IcEventListFormDTO formDTO) {
if(StringUtils.isBlank(formDTO.getAgencyId())){
if (StringUtils.isBlank(formDTO.getAgencyId())) {
//获取当前工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
@ -159,10 +160,10 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
}
}
//每个事件对应的图片数据
if(!CollectionUtils.isEmpty(dto.getAttachmentList())){
if (!CollectionUtils.isEmpty(dto.getAttachmentList())) {
List<String> imageList = new ArrayList<>();
List<IcEventListResultDTO.Attachment> voiceList = new ArrayList<>();
for(IcEventListResultDTO.Attachment file: dto.getAttachmentList()){
for (IcEventListResultDTO.Attachment file : dto.getAttachmentList()) {
if ("image".equals(file.getType())) {
imageList.add(file.getUrl());
} else if ("voice".equals(file.getType())) {
@ -187,6 +188,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/**
* 事件管理-新增
*
* @param formDTO
*/
@Override
@ -203,7 +205,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
//1-1.判断是否勾选处理方式,勾选了则分类不能为空
//勾选了立项或转需求或已完成时分类必须传
if (((StringUtils.isNotBlank(formDTO.getOperationType()) && "1".equals(formDTO.getOperationType()))
|| (StringUtils.isNotBlank(formDTO.getStatus()) && "closed_case".equals(formDTO.getStatus()))) && CollectionUtils.isEmpty(formDTO.getCategoryList())) {
|| (StringUtils.isNotBlank(formDTO.getStatus()) && "closed_case".equals(formDTO.getStatus()))) && CollectionUtils.isEmpty(formDTO.getCategoryList())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件分类不能为空");
}
//1-2.判断勾选已完成则处理方式不能选择立项或转需求
@ -249,7 +251,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
//事件Id
String icEventId = IdWorker.getIdStr();
Date nowTime=new Date();
Date nowTime = new Date();
//事件表红点,回复、立项、转服务、办结展示红点【0不展示 1展示】
int redDot = NumConstant.ZERO;
String operationType = "";
@ -284,10 +286,10 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
formDTO.setOperationId(recIdResult.getData().getDemandRecId());
}
//2-3.转议题
if(StringUtils.isNotBlank(formDTO.getOperationType()) && NumConstant.THREE_STR.equals(formDTO.getOperationType())){
if (StringUtils.isNotBlank(formDTO.getOperationType()) && NumConstant.THREE_STR.equals(formDTO.getOperationType())) {
operationType = NumConstant.THREE_STR;
//调用issue服务转议题
PublishIssueFormDTO issueFormDTO=new PublishIssueFormDTO();
PublishIssueFormDTO issueFormDTO = new PublishIssueFormDTO();
issueFormDTO.setIssueStatus("voting");
issueFormDTO.setAddress(formDTO.getAddress());
issueFormDTO.setLatitude(formDTO.getLatitude());
@ -306,7 +308,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
issueFormDTO.setUpdatedTime(nowTime);
issueFormDTO.setDecidedTime(nowTime);
issueFormDTO.setEventReportUserName(formDTO.getName());
Result<IssueDTO> issueRes=govIssueOpenFeignClient.publishIssue(issueFormDTO);
Result<IssueDTO> issueRes = govIssueOpenFeignClient.publishIssue(issueFormDTO);
if (!issueRes.success() || null == issueRes.getData()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件转议题异常,返参:" + JSON.toJSONString(issueRes), "事件转议题异常");
}
@ -321,7 +323,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
entity.setGridPids(gridInfo.getPids());
entity.setLatestOperatedTime(nowTime);
entity.setAuditStatus(TopicConstant.AUTO_PASSED);
if("closed_case".equals(formDTO.getStatus())){
if ("closed_case".equals(formDTO.getStatus())) {
entity.setCloseCaseTime(new Date());
}
//insert(entity);
@ -348,7 +350,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
if (!CollectionUtils.isEmpty(formDTO.getCategoryList())) {
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), formDTO.getCategoryList());
IcEventCategoryEntity categoryEntity = null;
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()) {
if (ca.getId().equals(formDTO.getCategoryList().get(NumConstant.ZERO))) {
categoryEntity = new IcEventCategoryEntity();
categoryEntity.setCustomerId(formDTO.getCustomerId());
@ -369,7 +371,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
Date date = new Date();
//3-5.回复数据保存
if (StringUtils.isNotBlank(formDTO.getContent())) {
if(StringUtils.isEmpty(operationType)){
if (StringUtils.isEmpty(operationType)) {
operationType = NumConstant.ZERO_STR;
}
redDot = NumConstant.ONE;
@ -456,6 +458,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/**
* 事件管理-批量删除事件
*
* @param ids
*/
@Override
@ -463,38 +466,38 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
public void delete(String[] ids) {
//已立项、已转服务的事件删除时,同时删除关联的服务和项目
for (String id : ids) {
IcEventEntity entity = baseDao.selectById(id);
if (null == entity){
IcEventEntity entity = baseDao.selectByEventId(id);
if (null == entity) {
// throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"数据不存在","数据不存在");
continue;
}
//1:已转项目 2:已转需求
if (NumConstant.ONE_STR.equals(entity.getOperationType())){
if (NumConstant.ONE_STR.equals(entity.getOperationType())) {
ProjectService projectService = SpringContextUtils.getBean(ProjectService.class);
Integer effectRow = projectService.deleteByOriginId(entity.getId(), ProjectOriginEnum.IC_EVENT.getCode());
log.info("delete project effectRow:{},eventId:{}", effectRow, id);
} else if (NumConstant.TWO_STR.equals(entity.getOperationType())){
} else if (NumConstant.TWO_STR.equals(entity.getOperationType())) {
Result<Integer> effectRow = epmetHeartOpenFeignClient.deleteUserDemandByOriginId(entity.getId(), ProjectOriginEnum.IC_EVENT.getCode());
// log.info("delete userDemand result:{},eventId:{}", effectRow, id);
} else if(NumConstant.THREE_STR.equals(entity.getOperationType())){
} else if (NumConstant.THREE_STR.equals(entity.getOperationType())) {
DelIssueFormDTO delIssueFormDTO = new DelIssueFormDTO();
delIssueFormDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId());
delIssueFormDTO.setUserId(loginUserUtil.getLoginUserId());
delIssueFormDTO.setIssueIds(Arrays.asList(entity.getOperationId()));
// 删除议题, 议题转了项目的,再单独去删除项目
Result<List<String>> delIssueRes = govIssueOpenFeignClient.deleteIssueInternal(delIssueFormDTO);
if(delIssueRes.success()&&!CollectionUtils.isEmpty(delIssueRes.getData())){
if (delIssueRes.success() && !CollectionUtils.isEmpty(delIssueRes.getData())) {
// 议题被转了项目,需要删除项目
SpringContextUtils.getBean(ProjectService.class).deleteByOriginId(delIssueRes.getData().get(0), ProjectOriginEnum.ISSUE.getCode());
}
}
LambdaUpdateWrapper<IcEventEntity> wrapper = new LambdaUpdateWrapper();
wrapper.eq(IcEventEntity::getId,id).set(IcEventEntity::getUpdatedTime,new Date())
.set(IcEventEntity::getUpdatedBy,loginUserUtil.getLoginUserId())
.set(IcEventEntity::getDelFlag,NumConstant.ONE_STR);
baseDao.update(null,wrapper);
wrapper.eq(IcEventEntity::getId, id).set(IcEventEntity::getUpdatedTime, new Date())
.set(IcEventEntity::getUpdatedBy, loginUserUtil.getLoginUserId())
.set(IcEventEntity::getDelFlag, NumConstant.ONE_STR);
baseDao.update(null, wrapper);
//把事件分类ic_event_category也删除了吧,以免后面数据分析用到这个表
icEventCategoryService.delInsert(id,null);
icEventCategoryService.delInsert(id, null);
}
}
@ -731,6 +734,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/**
* 查询家属
*
* @param idCard
* @return
*/
@ -779,12 +783,12 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Transactional(rollbackFor = Exception.class)
public void reply(IcEventReplyFormDTO formDTO) {
//1.查询事件数据 判断是否允许回复
IcEventEntity entity = baseDao.selectById(formDTO.getIcEventId());
IcEventEntity entity = baseDao.selectByEventId(formDTO.getIcEventId());
if (null == entity || "1".equals(entity.getOperationType()) || "2".equals(entity.getOperationType())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前事件不允许回复");
}
//2.修改事件数据
if (StringUtils.isNotBlank(formDTO.getOperationType()) && StringUtils.isNotBlank(formDTO.getStatus()) && "closed_case".equals(formDTO.getStatus())){
if (StringUtils.isNotBlank(formDTO.getOperationType()) && StringUtils.isNotBlank(formDTO.getStatus()) && "closed_case".equals(formDTO.getStatus())) {
entity.setStatus(formDTO.getStatus());
entity.setCloseCaseTime(new Date());
entity.setDifficultPoint("0");
@ -817,7 +821,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
categoryList.add(formDTO.getCategoryId());
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList);
IcEventCategoryEntity categoryEntity = null;
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()) {
if (ca.getId().equals(formDTO.getCategoryId())) {
categoryEntity = new IcEventCategoryEntity();
categoryEntity.setCustomerId(formDTO.getCustomerId());
@ -903,7 +907,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
categoryList.add(categoryId);
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList);
IcEventCategoryEntity categoryEntity = null;
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()) {
if (ca.getId().equals(categoryId)) {
categoryEntity = new IcEventCategoryEntity();
categoryEntity.setCustomerId(formDTO.getCustomerId());
@ -986,7 +990,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
categoryList.add(formDTO.getCategoryId());
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList);
IcEventCategoryEntity categoryEntity = null;
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()) {
if (ca.getId().equals(formDTO.getCategoryId())) {
categoryEntity = new IcEventCategoryEntity();
categoryEntity.setCustomerId(formDTO.getCustomerId());
@ -1115,8 +1119,8 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
IcEventListResultDTO resultDTO = new IcEventListResultDTO();
//1.获取事件基本信息
List<IcEventListResultDTO> list = baseDao.icEventList(formDTO);
if(CollectionUtils.isEmpty(list)){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"事件不存在","事件已删除");
if (CollectionUtils.isEmpty(list)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件不存在", "事件已删除");
}
resultDTO = list.get(0);
//查询网格名称(组织-网格)
@ -1137,7 +1141,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
resultDTO.setSourceTypeName(statusMap.get(resultDTO.getSourceType()));
}
//每个事件对应的图片数据
if(!CollectionUtils.isEmpty(resultDTO.getAttachmentList())){
if (!CollectionUtils.isEmpty(resultDTO.getAttachmentList())) {
List<String> imageList = new ArrayList<>();
List<IcEventListResultDTO.Attachment> voiceList = new ArrayList<>();
resultDTO.getAttachmentList().forEach(file -> {
@ -1152,11 +1156,11 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
}
//分类信息
if(StringUtils.isNotBlank(resultDTO.getCategoryId())){
if (StringUtils.isNotBlank(resultDTO.getCategoryId())) {
List<String> categoryList = new ArrayList<>();
categoryList.add(resultDTO.getCategoryId());
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList);
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()) {
if (ca.getId().equals(resultDTO.getCategoryId())) {
resultDTO.setParentCategoryId(ca.getPid());
resultDTO.setCategoryId(ca.getId());
@ -1184,7 +1188,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
if (null == gridInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "网格信息查询异常");
}
IcEventAnalysisOrgResDTO grid = ConvertUtils.sourceToTarget(formDTO,IcEventAnalysisOrgResDTO.class);
IcEventAnalysisOrgResDTO grid = ConvertUtils.sourceToTarget(formDTO, IcEventAnalysisOrgResDTO.class);
grid.setOrgName(gridInfoCache.getGridName());
grid.setTotal(baseDao.selectOrgTotal(formDTO));
list.add(grid);
@ -1198,7 +1202,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
IcEventAnalysisOrgResDTO resultDto = ConvertUtils.sourceToTarget(org, IcEventAnalysisOrgResDTO.class);
formDTO.setOrgId(org.getOrgId());
formDTO.setOrgType(org.getOrgType());
if("agency".equals(org.getOrgType())){
if ("agency".equals(org.getOrgType())) {
String purePids = org.getPids();
if ("0".equals(purePids) || StringUtils.isBlank(purePids)) {
formDTO.setGridPids(org.getOrgId());
@ -1214,6 +1218,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/**
* Desc: 定时任务自动评价
*
* @param formDTO
* @author zxc
* @date 2022/5/18 16:35
@ -1221,14 +1226,14 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Override
public void autoEvaluation(AutoEvaluationFormDTO formDTO) {
List<String> customerIds = new ArrayList<>();
if (StringUtils.isBlank(formDTO.getCustomerId())){
if (StringUtils.isBlank(formDTO.getCustomerId())) {
Result<List<CustomerDTO>> allCustomerList = crmOpenFeignClient.getAllCustomerList();
if (!allCustomerList.success()){
if (!allCustomerList.success()) {
throw new EpmetException("查询所有客户失败");
}
List<CustomerDTO> data = allCustomerList.getData();
customerIds.addAll(data.stream().map(m -> m.getId()).collect(Collectors.toList()));
}else {
} else {
customerIds.add(formDTO.getCustomerId());
}
customerIds.forEach(c -> {
@ -1238,24 +1243,25 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/**
* Desc: 处理未评价的icEvent
*
* @param customerId
* @author zxc
* @date 2022/5/18 16:52
*/
@Transactional(rollbackFor = Exception.class)
public void autoEvaluationDispose(String customerId){
public void autoEvaluationDispose(String customerId) {
Integer no = NumConstant.ONE;
Integer size = NumConstant.ONE_HUNDRED;
List<String> ids = new ArrayList<>();
do {
int start = (no - NumConstant.ONE) * size;
ids = baseDao.getAutoEvaluationIds(customerId,start,size);
ids = baseDao.getAutoEvaluationIds(customerId, start, size);
// 批量更新
if (!CollectionUtils.isEmpty(ids)){
if (!CollectionUtils.isEmpty(ids)) {
baseDao.updateAutoEvaluation(ids);
}
no++;
}while (ids.size() == size);
} while (ids.size() == size);
}
/**
@ -1266,9 +1272,9 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
public LinkedList<IcEventProcessListResultDTO> process(IcEventReplyFormDTO formDTO) {
LinkedList<IcEventProcessListResultDTO> resultList = new LinkedList<IcEventProcessListResultDTO>();
//1.查询事件基础信息
IcEventEntity entity = baseDao.selectById(formDTO.getIcEventId());
IcEventEntity entity = baseDao.selectByEventId(formDTO.getIcEventId());
if (null == entity) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件不存在","事件不存在");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件不存在", "事件不存在");
}
// operationType 0:已回复 1:已转项目 2:已转需求3:转议题
//2.判断查询事件项目进展或需求进展信息或者议题进展
@ -1289,15 +1295,15 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
IssueIdFormDTO issueIdFormDTO = new IssueIdFormDTO();
issueIdFormDTO.setIssueId(entity.getOperationId());
Result<IssueAdvanceResDTO> issueProcessRes = govIssueOpenFeignClient.queryIssueProcess(issueIdFormDTO);
if(!issueProcessRes.success()||CollectionUtils.isEmpty(issueProcessRes.getData().getProcessList())){
if (!issueProcessRes.success() || CollectionUtils.isEmpty(issueProcessRes.getData().getProcessList())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件已转议题,议题处理进展查询异常", "事件已转议题,议题处理进展查询异常");
}
IssueAdvanceResDTO issueAdvanceResDTO=issueProcessRes.getData();
IssueAdvanceResDTO issueAdvanceResDTO = issueProcessRes.getData();
//如果议题已转项目,先放项目的处理进展
if("shift_project".equals(issueAdvanceResDTO.getIssueStatus())){
if ("shift_project".equals(issueAdvanceResDTO.getIssueStatus())) {
//根据议题id查询项目
List<ProjectEntity> projectEntityList=SpringContextUtils.getBean(ProjectService.class).getByOriginId(issueAdvanceResDTO.getIssueId());
if(!CollectionUtils.isEmpty(projectEntityList)){
List<ProjectEntity> projectEntityList = SpringContextUtils.getBean(ProjectService.class).getByOriginId(issueAdvanceResDTO.getIssueId());
if (!CollectionUtils.isEmpty(projectEntityList)) {
// 项目进展
ProcessListV2FormDTO processListV2FormDTO = new ProcessListV2FormDTO();
processListV2FormDTO.setProjectId(projectEntityList.get(0).getId());
@ -1307,8 +1313,8 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
resultList.addAll(projectList);
}
}
for(ProcessListResultDTOBak issueProcess:issueAdvanceResDTO.getProcessList()){
IcEventProcessListResultDTO eventProcess=new IcEventProcessListResultDTO();
for (ProcessListResultDTOBak issueProcess : issueAdvanceResDTO.getProcessList()) {
IcEventProcessListResultDTO eventProcess = new IcEventProcessListResultDTO();
eventProcess.setDepartmentName(issueProcess.getDepartmentName());
eventProcess.setProcessId(issueProcess.getProcessId());
eventProcess.setProcessName(issueProcess.getProcessName());
@ -1328,7 +1334,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/**
* @Author sun
* @Description 需求完成/项目结案时 修改事件数据
* @Description 需求完成/项目结案时 修改事件数据
* 议题关闭时如果议题来源于事件也会调用此方法
**/
@Override
@ -1360,7 +1366,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
logEntity.setServiceParty(formDTO.getServiceParty());
logEntity.setActualServiceTime(formDTO.getActualServiceTime());
icEventOperationLogService.insert(logEntity);
}else if("project".equals(formDTO.getType())){
} else if ("project".equals(formDTO.getType())) {
IcEventOperationLogEntity logEntity = new IcEventOperationLogEntity();
logEntity.setIcEventId(formDTO.getIcEventId());
logEntity.setCustomerId(formDTO.getCustomerId());
@ -1372,7 +1378,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
logEntity.setServiceParty(formDTO.getServiceParty());
logEntity.setActualServiceTime(formDTO.getActualServiceTime());
icEventOperationLogService.insert(logEntity);
}else if("issue".equals(formDTO.getType())){
} else if ("issue".equals(formDTO.getType())) {
IcEventOperationLogEntity logEntity = new IcEventOperationLogEntity();
logEntity.setIcEventId(formDTO.getIcEventId());
logEntity.setCustomerId(formDTO.getCustomerId());
@ -1387,7 +1393,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
}
//4.判断来源居民端的事件,需求、项目结案时给居民推送站内信
if("0".equals(entity.getSourceType())){
if ("0".equals(entity.getSourceType())) {
List<UserMessageFormDTO> msgList = new ArrayList<>();
UserMessageFormDTO messageFormDTO = new UserMessageFormDTO();
messageFormDTO.setCustomerId(formDTO.getCustomerId());
@ -1410,6 +1416,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/**
* Desc: 新增随手拍
*
* @param formDTO
* @author zxc
* @date 2022/5/19 13:38
@ -1419,13 +1426,13 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
public void addEventFromResi(AddEventFromResiFormDTO formDTO) {
// 判断是否注册居民
Result<Boolean> isResiFlag = userOpenFeignClient.getIsResiFlag(formDTO.getUserId());
if (!isResiFlag.success()){
if (!isResiFlag.success()) {
throw new EpmetException("查询是否注册居民失败...");
}
if (!isResiFlag.getData()){
if (!isResiFlag.getData()) {
throw new EpmetException(EpmetErrorCode.NOT_REGEIST_RESI.getCode());
}
if(StringUtils.isBlank(formDTO.getContent()) && CollectionUtils.isEmpty(formDTO.getVoiceList())) {
if (StringUtils.isBlank(formDTO.getContent()) && CollectionUtils.isEmpty(formDTO.getVoiceList())) {
//话题内容和语音不能同时为空
log.error("事件内容和语音不能同时为空");
throw new RenException(EpmetErrorCode.RESI_EVENT_SUBMIT.getCode(), EpmetErrorCode.RESI_EVENT_SUBMIT.getMsg());
@ -1435,20 +1442,20 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
}
resiEventService.scanContent(formDTO.getContent(), formDTO.getAttachmentList());
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId());
if (null == gridInfo){
throw new EpmetException("未查询到此网格信息"+formDTO.getGridId());
if (null == gridInfo) {
throw new EpmetException("未查询到此网格信息" + formDTO.getGridId());
}
IcEventEntity entity = ConvertUtils.sourceToTarget(formDTO,IcEventEntity.class);
IcEventEntity entity = ConvertUtils.sourceToTarget(formDTO, IcEventEntity.class);
entity.setAgencyId(gridInfo.getPid());
entity.setGridPids(gridInfo.getPids());
Result<List<UserBaseInfoResultDTO>> userResult = userOpenFeignClient.queryUserBaseInfo(Arrays.asList(formDTO.getUserId()));
if (!userResult.success() && CollectionUtils.isEmpty(userResult.getData())){
throw new EpmetException("查询用户信息失败"+formDTO.getUserId());
if (!userResult.success() && CollectionUtils.isEmpty(userResult.getData())) {
throw new EpmetException("查询用户信息失败" + formDTO.getUserId());
}
entity.setReportUserId(formDTO.getUserId());
AtomicReference<String> userShowName = new AtomicReference<>("");
userResult.getData().forEach(u -> {
if (u.getUserId().equals(formDTO.getUserId())){
if (u.getUserId().equals(formDTO.getUserId())) {
entity.setName(u.getRealName());
entity.setMobile(u.getMobile());
entity.setIdCard(u.getIdNum());
@ -1471,12 +1478,12 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
//3-2.附件数据保存
List<IcEventAttachmentEntity> attachmentEntityList = new ArrayList<>();
if (!CollectionUtils.isEmpty(formDTO.getAttachmentList())) {
disposeAttachment(formDTO.getAttachmentList(), attachmentEntityList,entity.getId(),formDTO.getCustomerId(),formDTO.getUserId());
disposeAttachment(formDTO.getAttachmentList(), attachmentEntityList, entity.getId(), formDTO.getCustomerId(), formDTO.getUserId());
}
if (!CollectionUtils.isEmpty(formDTO.getVoiceList())) {
disposeAttachment(formDTO.getVoiceList(), attachmentEntityList,entity.getId(),formDTO.getCustomerId(),formDTO.getUserId());
disposeAttachment(formDTO.getVoiceList(), attachmentEntityList, entity.getId(), formDTO.getCustomerId(), formDTO.getUserId());
}
if (!CollectionUtils.isEmpty(attachmentEntityList)){
if (!CollectionUtils.isEmpty(attachmentEntityList)) {
icEventAttachmentService.insertBatch(attachmentEntityList);
}
// 站内信发送给社区每个工作人员
@ -1485,6 +1492,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/**
* Desc: 给工作人员发送站内信
*
* @param agencyId
* @param customerId
* @param showName
@ -1492,15 +1500,15 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
* @author zxc
* @date 2022/5/20 10:22
*/
public void disposeMessage(String agencyId,String customerId,String showName,String icEventId){
public void disposeMessage(String agencyId, String customerId, String showName, String icEventId) {
// 查询组织下的所有工作人员
AgencyIdFormDTO formDTO = new AgencyIdFormDTO();
formDTO.setAgencyId(agencyId);
Result<List<String>> agencyStaffsResult = govOrgOpenFeignClient.getAgencyStaffs(formDTO);
if (!agencyStaffsResult.success()){
if (!agencyStaffsResult.success()) {
throw new EpmetException("查询组织下工作人员失败...");
}
if (!CollectionUtils.isEmpty(agencyStaffsResult.getData())){
if (!CollectionUtils.isEmpty(agencyStaffsResult.getData())) {
List<UserMessageFormDTO> msgList = new ArrayList<>();
agencyStaffsResult.getData().forEach(u -> {
UserMessageFormDTO msg = new UserMessageFormDTO();
@ -1512,7 +1520,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
msg.setMessageType(UserMessageTypeConstant.IC_EVENT);
msg.setReadFlag(ReadFlagConstant.UN_READ);
msg.setTitle("您有一条事件消息");
msg.setMessageContent(showName+"上报一条事件,请查看。");
msg.setMessageContent(showName + "上报一条事件,请查看。");
msgList.add(msg);
});
messageOpenFeignClient.saveUserMessageList(msgList);
@ -1521,6 +1529,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/**
* Desc: 附件处理
*
* @param list
* @param attachmentEntityList
* @param id
@ -1529,7 +1538,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
* @author zxc
* @date 2022/5/20 09:50
*/
public void disposeAttachment(List<FileCommonDTO> list,List<IcEventAttachmentEntity> attachmentEntityList,String id,String customerId,String userId){
public void disposeAttachment(List<FileCommonDTO> list, List<IcEventAttachmentEntity> attachmentEntityList, String id, String customerId, String userId) {
int sort = NumConstant.ZERO;
for (FileCommonDTO a : list) {
IcEventAttachmentEntity attachment = new IcEventAttachmentEntity();
@ -1579,16 +1588,16 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
}
//分类信息
if(StringUtils.isNotBlank(dto.getCategoryId())){
if (StringUtils.isNotBlank(dto.getCategoryId())) {
List<String> categoryList = new ArrayList<>();
categoryList.add(dto.getCategoryId());
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList);
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()) {
if (ca.getId().equals(dto.getCategoryId())) {
if(StringUtils.isNotBlank(ca.getParentCategoryName())){
if (StringUtils.isNotBlank(ca.getParentCategoryName())) {
//大类-子类
dto.setCategoryName(ca.getParentCategoryName().concat(StrConstant.HYPHEN).concat(ca.getCategoryName()));
}else{
} else {
dto.setCategoryName(ca.getCategoryName());
}
}
@ -1610,7 +1619,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
*/
@Override
public void removeRed(String userId, String icEventId) {
baseDao.updateRedDot(userId,icEventId);
baseDao.updateRedDot(userId, icEventId);
}
/**
@ -1621,7 +1630,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Override
public void resiReply(ResiReplyIcEventFormDTO formDTO) {
//1.查询事件数据 判断是否允许回复
IcEventEntity entity=checkReply(formDTO.getIcEventId());
IcEventEntity entity = checkReply(formDTO.getIcEventId());
entity.setLatestOperatedTime(new Date());
//居民端的红点置为不显示
entity.setRedDot(NumConstant.ZERO);
@ -1636,9 +1645,9 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
replyEntity.setFromUserId(formDTO.getUserId());
replyEntity.setContent(formDTO.getContent());
// 查询当前用户的显示昵称 应该是xxx街道-姓/女士or先生 如果没有街道和姓,显示的微信昵称
List<String> userIdList =new ArrayList<>();
List<String> userIdList = new ArrayList<>();
userIdList.add(formDTO.getUserId());
Result<List<UserBaseInfoResultDTO>> userResult=userOpenFeignClient.queryUserBaseInfo(userIdList);
Result<List<UserBaseInfoResultDTO>> userResult = userOpenFeignClient.queryUserBaseInfo(userIdList);
if (!userResult.success() || CollectionUtils.isEmpty(userResult.getData())) {
throw new RenException("查询当前用户信息异常");
}
@ -1646,25 +1655,25 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
icEventReplyService.insert(replyEntity);
//3.新增操作记录数据
IcEventOperationLogEntity logEntity =ConvertUtils.sourceToTarget(formDTO,IcEventOperationLogEntity.class);
IcEventOperationLogEntity logEntity = ConvertUtils.sourceToTarget(formDTO, IcEventOperationLogEntity.class);
logEntity.setUserIdentity(EventConstant.RESI_USER);
logEntity.setActionCode(ResiEventAction.REPLY.getCode());
logEntity.setActionDesc(ResiEventAction.REPLY.getDesc());
logEntity.setOperateTime(new Date());
icEventOperationLogService.insert(logEntity);
// 4.给工作端社区的人发送消息:山东路168号-张先生对事件进行了新的回复,请查看
noticeStaffResiReply(entity.getAgencyId(),entity.getCustomerId(),replyEntity.getUserShowName(),entity.getId());
noticeStaffResiReply(entity.getAgencyId(), entity.getCustomerId(), replyEntity.getUserShowName(), entity.getId());
}
public void noticeStaffResiReply(String agencyId,String customerId,String showName,String icEventId){
public void noticeStaffResiReply(String agencyId, String customerId, String showName, String icEventId) {
// 查询组织下的所有工作人员
AgencyIdFormDTO formDTO = new AgencyIdFormDTO();
formDTO.setAgencyId(agencyId);
Result<List<String>> agencyStaffsResult = govOrgOpenFeignClient.getAgencyStaffs(formDTO);
if (!agencyStaffsResult.success()){
if (!agencyStaffsResult.success()) {
throw new EpmetException("查询组织下工作人员失败...");
}
if (!CollectionUtils.isEmpty(agencyStaffsResult.getData())){
if (!CollectionUtils.isEmpty(agencyStaffsResult.getData())) {
List<UserMessageFormDTO> msgList = new ArrayList<>();
agencyStaffsResult.getData().forEach(u -> {
UserMessageFormDTO msg = new UserMessageFormDTO();
@ -1676,7 +1685,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
msg.setMessageType(UserMessageTypeConstant.IC_EVENT);
msg.setReadFlag(ReadFlagConstant.UN_READ);
msg.setTitle("您有一条事件消息");
msg.setMessageContent(showName+"对事件进行了新的回复,请查看。");
msg.setMessageContent(showName + "对事件进行了新的回复,请查看。");
msgList.add(msg);
});
messageOpenFeignClient.saveUserMessageList(msgList);
@ -1695,8 +1704,8 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
// <if test="userId != null and userId != '' ">
// AND ie.REPORT_USER_ID = #{userId}
// </if>
List<MyReportIcEvResDTO> list=baseDao.selectMyReport(formDTO);
if(CollectionUtils.isEmpty(list)){
List<MyReportIcEvResDTO> list = baseDao.selectMyReport(formDTO);
if (CollectionUtils.isEmpty(list)) {
return null;
}
if (!CollectionUtils.isEmpty(list)) {
@ -1718,16 +1727,16 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
}
//分类信息
if(StringUtils.isNotBlank(dto.getCategoryId())){
if (StringUtils.isNotBlank(dto.getCategoryId())) {
List<String> categoryList = new ArrayList<>();
categoryList.add(dto.getCategoryId());
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList);
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()) {
if (ca.getId().equals(dto.getCategoryId())) {
if(StringUtils.isNotBlank(ca.getParentCategoryName())){
if (StringUtils.isNotBlank(ca.getParentCategoryName())) {
//大类-子类
dto.setCategoryName(ca.getParentCategoryName().concat(StrConstant.HYPHEN).concat(ca.getCategoryName()));
}else{
} else {
dto.setCategoryName(ca.getCategoryName());
}
}
@ -1791,9 +1800,9 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
// if (org.apache.commons.collections4.CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())) {
// return new PageData<PageUserReportEventResDTO>(new ArrayList<>(), NumConstant.ZERO);
// }
List<String> epmetUserIdList=new ArrayList<>();
List<String> epmetUserIdList = new ArrayList<>();
epmetUserIdList.add(formDTO.getUserId());
if(!CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){
if (!CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())) {
epmetUserIdList.addAll(formDTO.getEpmetUserIdList());
}
formDTO.setEpmetUserIdList(epmetUserIdList);
@ -1811,9 +1820,9 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Override
public void icEventToIssue(IcEventToIssueFormDTO formDTO) {
//校验下数据
IcEventEntity icEventEntity=baseDao.selectById(formDTO.getIcEventId());
IcEventEntity icEventEntity = baseDao.selectById(formDTO.getIcEventId());
if (null == icEventEntity || !"processing".equals(icEventEntity.getStatus())) {
log.error(String.format("事件不存在icEventId:%s",formDTO.getIcEventId()));
log.error(String.format("事件不存在icEventId:%s", formDTO.getIcEventId()));
return;
}
//查询分类信息
@ -1821,7 +1830,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryIdList);
Date nowTime = new Date();
//调用issue服务转议题
PublishIssueFormDTO issueFormDTO=new PublishIssueFormDTO();
PublishIssueFormDTO issueFormDTO = new PublishIssueFormDTO();
issueFormDTO.setIssueStatus("voting");
issueFormDTO.setAddress(icEventEntity.getAddress());
issueFormDTO.setLatitude(icEventEntity.getLatitude());
@ -1840,7 +1849,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
issueFormDTO.setUpdatedTime(nowTime);
issueFormDTO.setDecidedTime(nowTime);
issueFormDTO.setEventReportUserName(icEventEntity.getName());
Result<IssueDTO> issueRes=govIssueOpenFeignClient.publishIssue(issueFormDTO);
Result<IssueDTO> issueRes = govIssueOpenFeignClient.publishIssue(issueFormDTO);
if (!issueRes.success() || null == issueRes.getData()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件转议题异常,返参:" + JSON.toJSONString(issueRes), "事件转议题异常");
}
@ -1848,7 +1857,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
//1、修改事件相关信息
icEventEntity.setOperationType(formDTO.getOperationType());
icEventEntity.setOperationId(issueRes.getData().getIssueId());
if("0".equals(icEventEntity.getSourceType())){
if ("0".equals(icEventEntity.getSourceType())) {
//来源于随手拍的,居民端需要显示红点
icEventEntity.setRedDot(NumConstant.ONE);
}
@ -1857,9 +1866,9 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
baseDao.updateById(icEventEntity);
//2、插入事件分类表 ic_event_category
//分类全删全增吧
List<IcEventCategoryEntity> categoryEntities=new ArrayList<>();
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){
IcEventCategoryEntity icEventCategoryEntity=new IcEventCategoryEntity();
List<IcEventCategoryEntity> categoryEntities = new ArrayList<>();
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()) {
IcEventCategoryEntity icEventCategoryEntity = new IcEventCategoryEntity();
icEventCategoryEntity.setCustomerId(formDTO.getCustomerId());
icEventCategoryEntity.setIcEventId(formDTO.getIcEventId());
icEventCategoryEntity.setCategoryId(ca.getId());
@ -1867,7 +1876,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
icEventCategoryEntity.setCategoryCode(ca.getCategoryCode());
categoryEntities.add(icEventCategoryEntity);
}
icEventCategoryService.delInsert(formDTO.getIcEventId(),categoryEntities);
icEventCategoryService.delInsert(formDTO.getIcEventId(), categoryEntities);
//3、插入操作日志表 ic_event_operation_log
IcEventOperationLogEntity logEntity = new IcEventOperationLogEntity();
logEntity.setCustomerId(formDTO.getCustomerId());
@ -1910,8 +1919,38 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
*/
@Override
public List<IcEventDTO> batchSelectById(List<String> icEventIds) {
List<IcEventEntity>list=baseDao.selectBatchIds(icEventIds);
return ConvertUtils.sourceToTarget(list,IcEventDTO.class);
List<IcEventEntity> list = baseDao.selectBatchIds(icEventIds);
return ConvertUtils.sourceToTarget(list, IcEventDTO.class);
}
@Override
public EventRateResultDTO getEventRate(String orgId, String orgType) {
return baseDao.getEventRate(getOrgPath(orgId, orgType));
}
@Override
public EventAnalysisResultDTO getEventAnalysis(String orgId, String orgType) {
EventAnalysisResultDTO dto = baseDao.getEventAnalysis(getOrgPath(orgId,orgType));
Result<Map<String, String>> categoryMap = govIssueOpenFeignClient.getCategoryMap(EpmetRequestHolder.getLoginUserCustomerId());
if (null != categoryMap && categoryMap.getData().size() > 0) {
List<Map<String,Integer>> dataMap = baseDao.getAnalysis(getOrgPath(orgId,orgType));
if (null != dataMap && dataMap.size() > 0) {
Map<String, Integer> merged = new HashMap<>();
dataMap.forEach(merged::putAll);
dto.setCategoryCount(merged);
}
}
return dto;
}
private String getOrgPath(String orgId, String orgType) {
if (OrgInfoConstant.AGENCY.equals(orgType)) { // 行政组织
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
return PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids());
} else {// 网格
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(orgId);
return PidUtils.convertPid2OrgIdPath(gridInfo.getId(), gridInfo.getPids());
}
}
}

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

@ -440,5 +440,93 @@
ORDER BY re.created_time desc
</select>
<select id="getEventRate" resultType="com.epmet.dto.result.EventRateResultDTO">
SELECT
ea.countAll AS total,
eb.hong AS hongDeng,
ec.huang AS huangDeng,
ed.lan as lanDeng,
ROUND( eb.hong / ea.countAll, 2 ) AS hongDengRate,
ROUND( ec.huang / ea.countAll, 2 ) AS huangDengRate,
ROUND( ed.lan / ea.countAll, 2 ) as lanDengRate
FROM
( SELECT
SUM( CASE WHEN a.OPERATION_TYPE IS NULL OR a.OPERATION_TYPE = 0 THEN 1 ELSE 0 END ) AS countAll
FROM
ic_event a
WHERE
a.DEL_FLAG = 0
<if test="null != orgIdPath and orgIdPath != ''">
and a.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
) ea,
( SELECT SUM( CASE WHEN b.OPERATION_TYPE IS NULL THEN 1 ELSE 0 END ) AS hong
FROM ic_event b WHERE b.DEL_FLAG = 0 and b.STATUS = 'processing'
<if test="null != orgIdPath and orgIdPath != ''">
and b.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
) eb,
( 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'
<if test="null != orgIdPath and orgIdPath != ''">
and c.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
) ec,
( 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'
<if test="null != orgIdPath and orgIdPath != ''">
and d.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
) ed
</select>
<select id="getEventAnalysis" resultType="com.epmet.dto.result.EventAnalysisResultDTO">
SELECT
ea.total AS jiSuJiBan,
eb.total AS zhiTongLianBan,
ec.total AS wangGeHua
FROM
(
SELECT COUNT( e.id ) AS total FROM ic_event e
WHERE e.DEL_FLAG = 0 AND e.SOURCE_TYPE = 0 AND ( e.OPERATION_TYPE = 0 OR e.OPERATION_TYPE IS NULL )
<if test="null != orgIdPath and orgIdPath != ''">
and e.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
) ea,
(
SELECT COUNT( e.id ) AS total FROM ic_event e
WHERE e.DEL_FLAG = 0 AND e.SOURCE_TYPE = 1 AND ( e.OPERATION_TYPE = 0 OR e.OPERATION_TYPE IS NULL )
<if test="null != orgIdPath and orgIdPath != ''">
and e.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
) eb,
(
SELECT COUNT( e.id ) AS total FROM ic_event e
WHERE e.DEL_FLAG = 0 AND e.SOURCE_TYPE = 2 AND ( e.OPERATION_TYPE = 0 OR e.OPERATION_TYPE IS NULL )
<if test="null != orgIdPath and orgIdPath != ''">
and e.GRID_PIDS like concat(#{orgIdPath},'%')
</if>
) ec
</select>
<select id="getAnalysis" resultType="java.util.Map">
SELECT
c.CATEGORY_ID as code,
COUNT(c.CATEGORY_ID) as total
FROM ic_event_category c
<where>
c.IC_EVENT_ID in (
SELECT ic.id as ids from ic_event ic WHERE ic.DEL_FLAG = 0
<if test="null != orgIdPath and orgIdPath != ''">
and ic.GRID_PIDS LIKE concat(#{orgIdPath},'%')
</if>
)
</where>
GROUP BY c.CATEGORY_ID
</select>
<select id="selectByEventId" resultType="com.epmet.entity.IcEventEntity">
select e.* from ic_event e where e.id = #{icEventId}
</select>
</mapper>

Loading…
Cancel
Save