Browse Source

事件管理_新增

dev
sunyuchao 3 years ago
parent
commit
b6e8ec88b5
  1. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java
  2. 9
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  3. 8
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
  4. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java
  5. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventDTO.java
  6. 23
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventOperationLogDTO.java
  7. 112
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcDemandFormDTO.java
  8. 107
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventAddEditFormDTO.java
  9. 14
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java
  10. 12
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventAttachmentEntity.java
  11. 5
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java
  12. 23
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventOperationLogEntity.java
  13. 4
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java
  14. 257
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java

@ -24,7 +24,7 @@ public enum DictTypeEnum {
GRID_TYPE("grid_type", "网格类型", 12), GRID_TYPE("grid_type", "网格类型", 12),
ITEM_TYPE_QUERY("item_type_query","居民信息组件查询方式",14), ITEM_TYPE_QUERY("item_type_query","居民信息组件查询方式",14),
SELF_ORG_CATEGORY("self_org_category","社区自组织分类",15), SELF_ORG_CATEGORY("self_org_category","社区自组织分类",15),
IC_EVENT("ic_event","事件管理",19), IC_EVENT_SOURCE_TYPE("ic_event_source_type","事件管理",19),
; ;
private final String code; private final String code;

9
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java

@ -7,7 +7,9 @@ import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.AutoEvaluateDemandFormDTO;
import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.IcDemandFormDTO;
import com.epmet.dto.form.PartyUnitListFormDTO; import com.epmet.dto.form.PartyUnitListFormDTO;
import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.PartyUnitListResultDTO; import com.epmet.dto.result.PartyUnitListResultDTO;
@ -21,7 +23,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 本服务对外开放的API,其他服务通过引用此client调用该服务 * 本服务对外开放的API,其他服务通过引用此client调用该服务
@ -119,4 +120,10 @@ public interface EpmetHeartOpenFeignClient {
*/ */
@PostMapping("/heart/icpartyunit/getPartyUnitList") @PostMapping("/heart/icpartyunit/getPartyUnitList")
Result<List<PartyUnitListResultDTO>> getPartyUnitList(@RequestBody PartyUnitListFormDTO formDTO); Result<List<PartyUnitListResultDTO>> getPartyUnitList(@RequestBody PartyUnitListFormDTO formDTO);
/**
* @description 事件管理-转需求
**/
@PostMapping("/heart/residemand/iceventtodemand")
Result<DemandRecId> icEventToDemand(@RequestBody IcDemandFormDTO formDTO);
} }

8
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java

@ -8,7 +8,9 @@ import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.AutoEvaluateDemandFormDTO;
import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.IcDemandFormDTO;
import com.epmet.dto.form.PartyUnitListFormDTO; import com.epmet.dto.form.PartyUnitListFormDTO;
import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.PartyUnitListResultDTO; import com.epmet.dto.result.PartyUnitListResultDTO;
@ -17,7 +19,6 @@ import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.feign.EpmetHeartOpenFeignClient; import com.epmet.feign.EpmetHeartOpenFeignClient;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 本服务对外开放的API,其他服务通过引用此client调用该服务 * 本服务对外开放的API,其他服务通过引用此client调用该服务
@ -116,4 +117,9 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli
public Result<List<PartyUnitListResultDTO>> getPartyUnitList(PartyUnitListFormDTO formDTO) { public Result<List<PartyUnitListResultDTO>> getPartyUnitList(PartyUnitListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getPartyUnitList", formDTO); return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getPartyUnitList", formDTO);
} }
@Override
public Result<DemandRecId> queryUserVolunteerInfo(IcDemandFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "icEventToDemand", formDTO);
}
} }

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java

@ -11,11 +11,14 @@ import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg;
import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.SystemMessageType; import com.epmet.constant.SystemMessageType;
import com.epmet.constant.UserDemandConstant; import com.epmet.constant.UserDemandConstant;
import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.AutoEvaluateDemandFormDTO;
import com.epmet.dto.form.IcDemandFormDTO;
import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.form.demand.*; import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.demand.*; import com.epmet.dto.result.demand.*;
@ -267,4 +270,16 @@ public class ResiDemandController {
demandSatisfactionService.evaluateDemandAuto(formDTO); demandSatisfactionService.evaluateDemandAuto(formDTO);
return new Result(); return new Result();
} }
/**
* 事件管理-转需求
*
* @return
*/
@PostMapping("iceventtodemand")
public Result<DemandRecId> icEventToDemand(@RequestBody IcDemandFormDTO formDTO) {
ReportDemandFormDTO dto = ConvertUtils.sourceToTarget(formDTO, ReportDemandFormDTO.class);
return new Result<DemandRecId>().ok(icUserDemandRecService.saveOrUpdateDemand(dto));
}
} }

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

@ -66,6 +66,11 @@ public class IcEventDTO implements Serializable {
*/ */
private String sourceType; private String sourceType;
/**
* 发生时间
*/
private Date happenTime;
/** /**
* 事件内容 * 事件内容
*/ */

23
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventOperationLogDTO.java

@ -43,23 +43,22 @@ public class IcEventOperationLogDTO implements Serializable {
/** /**
* 1发布事件add * 1发布事件add
2reply * 2reply
3立项shift_project * 3立项shift_project
4转需求shift_demand * 4转需求shift_demand
5办结close_case; * 5办结close_case;
*/ */
private String actionCode; private String actionCode;
/** /**
* 1发布事件publish * 1发布事件publish
2撤回事件recall * 2撤回事件recall
3reply * 3reply
4立项shift_project * 4立项shift_project
5办结close_case; * 5转需求: shift_demand
6选择是否已解决choose_resolve; * 6办结close_case;
7首次查看阅读事件read_first人大代表未读=>已读工作人员待处理=>处理中 * 7选择是否已解决choose_resolve;
* 8首次查看阅读事件read_first人大代表未读=>已读工作人员待处理=>处理中
*/ */
private String actionDesc; private String actionDesc;

112
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcDemandFormDTO.java

@ -0,0 +1,112 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* 居民端-上报需求或者修改需求
*/
@Data
public class IcDemandFormDTO implements Serializable {
private static final long serialVersionUID = -2931148629441558468L;
public interface Add extends CustomerClientShowGroup {
}
public interface AddInternalGroup {
}
public interface Update extends CustomerClientShowGroup {
}
public interface UpdateInternalGroup {
}
@NotBlank(message = "需求id不能为空",groups = UpdateInternalGroup.class)
private String demandRecId;
@NotBlank(message = "customerId不能为空", groups = {AddInternalGroup.class, UpdateInternalGroup.class})
private String customerId;
/**
* 网格id
*/
@NotBlank(message = "所属网格不能为空",groups = {AddInternalGroup.class})
private String gridId;
/**
* 需求内容1000字
*/
@NotBlank(message = "需求内容不能为空", groups = {Add.class, Update.class})
@Length(max = 1000, message = "需求内容至多输入1000字", groups = {Add.class, Update.class})
private String content;
/**
* 二级需求分类编码
*/
@NotBlank(message = "需求类别不能为空",groups = Add.class)
private String categoryCode;
/**
* 父级需求分类编码
*/
@NotBlank(message = "父级分类不能为空",groups = Add.class)
private String parentCode;
/**
* 希望服务时间
*/
@NotNull(message = "服务时间不能为空",groups = {Add.class, Update.class})
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date wantServiceTime;
/**
* 需求人user.id或者ic_resi_user.id
*/
@NotBlank(message = "需求人不能为空",groups ={AddInternalGroup.class, UpdateInternalGroup.class})
private String demandUserId;
/**
* 需求人联系姓名
*/
@NotBlank(message = "联系人不能为空",groups = {Add.class, Update.class})
private String demandUserName;
/**
* 需求人联系电话
*/
@NotBlank(message = "联系电话不能为空",groups = {Add.class, Update.class})
private String demandUserMobile;
/**
* 服务地点工作端指派默认居民居住房屋地址居民端地图选择
*/
@NotBlank(message = "服务地点不能为空",groups = {Add.class, Update.class})
private String serviceLocation;
/**
* 门牌号详细地址
*/
@Length(max = 200, message = "门牌号至多输入200字", groups = {Add.class, Update.class})
private String locationDetail;
/**
* 经度,需求人是ic的居民时取所住楼栋的中心点位
*/
private String longitude;
/**
* 纬度,需求人是ic的居民时取所住楼栋的中心点位
*/
private String latitude;
}

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

@ -0,0 +1,107 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.AddGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @Description 事件管理新增
* @Author sun
*/
@Data
public class IcEventAddEditFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 网格ID
*/
@NotBlank(message = "网格ID不能为空", groups = {AddGroup.class})
private String gridId;
/**
* 报事人Id
*/
private String reportUserId;
/**
* 报事人姓名
*/
@NotBlank(message = "报事人不能为空", groups = {AddGroup.class})
private String name;
/**
* 手机号
*/
@Length(max = 11, message = "手机号位数不能超过11位", groups = AddGroup.class)
private String mobile;
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空", groups = {AddGroup.class})
@Length(min = 15, max = 18, message = "身份证号位数不正确", groups = AddGroup.class)
private String idCard;
/**
* 反映渠道
*/
@NotBlank(message = "反映渠道不能为空", groups = {AddGroup.class})
private String sourceType;
/**
* 事件内容
*/
@NotBlank(message = "事件内容不能为空", groups = {AddGroup.class})
private String eventContent;
/**
* 图片集合
*/
private List<String> imageList;
/**
* 二类分类Id
*/
private List<String> categoryList;
/**
* 事件地址
*/
//@NotBlank(message = "事件地址不能为空", groups = {AddGroup.class})
private String address;
/**
* 经度
*/
private String latitude;
/**
* 维度
*/
private String longitude;
/**
* 处理方式[0:已回复 1:已转项目 1:已转需求]
*/
private String operationType;
/**
* 项目需求ID
*/
private String operationId;
/**
* 回复内容
*/
private String content;
/**
* 处理中processing已办结closed_case
*/
private String status;
/**
* 立项接口入参对象
*/
private EventToProjectFormDTO project;
/**
* 转需求接口入参对象
*/
private IcDemandFormDTO demand;
private String customerId;
private String userId;
private String app;
private String client;
}

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

@ -12,6 +12,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; 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.IcEventAddEditFormDTO;
import com.epmet.dto.form.IcEventListFormDTO; import com.epmet.dto.form.IcEventListFormDTO;
import com.epmet.dto.form.ProcessAnalysisEventListFormDTO; import com.epmet.dto.form.ProcessAnalysisEventListFormDTO;
import com.epmet.dto.result.IcEventListResultDTO; import com.epmet.dto.result.IcEventListResultDTO;
@ -51,11 +52,14 @@ public class IcEventController {
} }
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("save") @PostMapping("add")
public Result save(@RequestBody IcEventDTO dto){ public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcEventAddEditFormDTO formDTO){
//效验数据 ValidatorUtils.validateEntity(formDTO, AddGroup.class, DefaultGroup.class);
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); formDTO.setCustomerId(tokenDto.getCustomerId());
icEventService.save(dto); formDTO.setUserId(tokenDto.getUserId());
formDTO.setApp(tokenDto.getApp());
formDTO.setClient(tokenDto.getClient());
icEventService.save(formDTO);
return new Result(); return new Result();
} }

12
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventAttachmentEntity.java

@ -58,12 +58,12 @@ public class IcEventAttachmentEntity extends BaseEpmetEntity {
/** /**
* 附件状态审核中auditing * 附件状态审核中auditing
auto_passed: 自动通过 auto_passed: 自动通过
review结果不确定需要人工审核 review结果不确定需要人工审核
block: 结果违规 block: 结果违规
rejected人工审核驳回; rejected人工审核驳回;
approved人工审核通过 approved人工审核通过
现在图片是同步审核的所以图片只有auto_passed一种状态 现在图片是同步审核的所以图片只有auto_passed一种状态
*/ */
private String status; private String status;

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

@ -66,6 +66,11 @@ public class IcEventEntity extends BaseEpmetEntity {
*/ */
private String sourceType; private String sourceType;
/**
* 发生时间
*/
private Date happenTime;
/** /**
* 事件内容 * 事件内容
*/ */

23
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventOperationLogEntity.java

@ -43,23 +43,22 @@ public class IcEventOperationLogEntity extends BaseEpmetEntity {
/** /**
* 1发布事件add * 1发布事件add
2reply * 2reply
3立项shift_project * 3立项shift_project
4转需求shift_demand * 4转需求shift_demand
5办结close_case; * 5办结close_case;
*/ */
private String actionCode; private String actionCode;
/** /**
* 1发布事件publish * 1发布事件publish
2撤回事件recall * 2撤回事件recall
3reply * 3reply
4立项shift_project * 4立项shift_project
5办结close_case; * 5转需求: shift_demand
6选择是否已解决choose_resolve; * 6办结close_case;
7首次查看阅读事件read_first人大代表未读=>已读工作人员待处理=>处理中 * 7选择是否已解决choose_resolve;
* 8首次查看阅读事件read_first人大代表未读=>已读工作人员待处理=>处理中
*/ */
private String actionDesc; private String actionDesc;

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

@ -3,6 +3,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcEventDTO; import com.epmet.dto.IcEventDTO;
import com.epmet.dto.form.IcEventAddEditFormDTO;
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.IcEventResultDTO;
@ -10,7 +11,6 @@ import com.epmet.dto.result.ProcessStatusRatioResultDTO;
import com.epmet.entity.IcEventEntity; import com.epmet.entity.IcEventEntity;
import java.util.Date; import java.util.Date;
import java.util.Map;
/** /**
* 事件管理表 * 事件管理表
@ -48,7 +48,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
* @author generator * @author generator
* @date 2022-05-17 * @date 2022-05-17
*/ */
void save(IcEventDTO dto); void save(IcEventAddEditFormDTO dto);
/** /**
* 默认更新 * 默认更新

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

@ -4,49 +4,54 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; 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.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.dto.form.FileCommonDTO;
import com.epmet.commons.tools.enums.DictTypeEnum;
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.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; 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;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
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.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
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.*;
import com.epmet.dto.form.IcEventListFormDTO; import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.dto.result.AllGridsByUserIdResultDTO; import com.epmet.entity.*;
import com.epmet.dto.result.IcEventListResultDTO;
import com.epmet.dto.result.IcMoveInListResultDTO;
import com.epmet.entity.IcEventEntity;
import com.epmet.enums.EcEventProcessStatusEnum; import com.epmet.enums.EcEventProcessStatusEnum;
import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetHeartOpenFeignClient;
import com.epmet.feign.GovIssueOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.resi.group.constant.TopicConstant;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.*;
import com.epmet.service.IcEventService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -58,11 +63,31 @@ import java.util.stream.Collectors;
@Service @Service
public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntity> implements IcEventService, ResultDataResolver { public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntity> implements IcEventService, ResultDataResolver {
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
@Autowired @Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient; private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired @Autowired
private EpmetAdminOpenFeignClient adminOpenFeignClient; private EpmetAdminOpenFeignClient adminOpenFeignClient;
@Autowired
private ProjectTraceService projectTraceService;
@Autowired
private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient;
@Autowired
private GovIssueOpenFeignClient govIssueOpenFeignClient;
@Autowired
private IcEventAttachmentService icEventAttachmentService;
@Autowired
private IcEventCategoryService icEventCategoryService;
@Autowired
private IcEventReplyService icEventReplyService;
@Autowired
private IcEventOperationLogService icEventOperationLogService;
@Override @Override
public PageData<IcEventListResultDTO> list(IcEventListFormDTO formDTO) { public PageData<IcEventListResultDTO> list(IcEventListFormDTO formDTO) {
@ -77,7 +102,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
Map<String, String> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName, (key1, key2) -> key2)); Map<String, String> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName, (key1, key2) -> key2));
//与户主关系字典表数据 //与户主关系字典表数据
Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_EVENT.getCode()); Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_EVENT_SOURCE_TYPE.getCode());
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>();
//封装数据 //封装数据
@ -105,8 +130,8 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
return new PageData<>(list, pageInfo.getTotal()); return new PageData<>(list, pageInfo.getTotal());
} }
private QueryWrapper<IcEventEntity> getWrapper(Map<String, Object> params){ private QueryWrapper<IcEventEntity> getWrapper(Map<String, Object> params) {
String id = (String)params.get(FieldConstant.ID_HUMP); String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<IcEventEntity> wrapper = new QueryWrapper<>(); QueryWrapper<IcEventEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -122,9 +147,193 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(IcEventDTO dto) { public void save(IcEventAddEditFormDTO formDTO) {
IcEventEntity entity = ConvertUtils.sourceToTarget(dto, IcEventEntity.class); //获取当前工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId()));
}
//获取网格缓存信息
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId());
if (null == gridInfo) {
throw new EpmetException(String.format("未查询到网格{%s}信息", formDTO.getGridId()));
}
//1.参数校验,安全校验
//1-1.判断是否勾选处理方式,勾选了则分类不能为空
if (StringUtils.isNotBlank(formDTO.getOperationType()) && CollectionUtils.isEmpty(formDTO.getCategoryList())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件分类不能为空");
}
//1-2.判断勾选已完成则处理方式不能选择立项或转需求
if (StringUtils.isNotBlank(formDTO.getOperationType()) && "closed_case".equals(formDTO.getStatus())
&& StringUtils.isNotBlank(formDTO.getOperationType()) && ("1".equals(formDTO.getOperationType()) || "2".equals(formDTO.getOperationType()))) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件勾选已完成则不允许立项或转需求");
}
//1-3.安全校验事件内容、图片内容
//事件内容
if (StringUtils.isNotBlank(formDTO.getEventContent())) {
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
taskDTO.setContent(formDTO.getEventContent());
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
}
//图片内容
if (!CollectionUtils.isEmpty(formDTO.getImageList())) {
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
formDTO.getImageList().forEach(imgUrl -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(imgUrl);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg());
}
}
}
//2.判断是否立项或转需求
//2-1.项目立项
if (StringUtils.isNotBlank(formDTO.getOperationType()) && "1".equals(formDTO.getOperationType())) {
EventToProjectResultDTO project = projectTraceService.eventToProject(formDTO.getProject());
formDTO.setOperationId(project.getProjectId());
}
//2-2.转需求
if (StringUtils.isNotBlank(formDTO.getOperationType()) && "2".equals(formDTO.getOperationType())) {
IcDemandFormDTO dto = formDTO.getDemand();
//需求人默认是当前用户id
dto.setDemandUserId(formDTO.getUserId());
dto.setCustomerId(formDTO.getCustomerId());
Result<DemandRecId> recIdResult = epmetHeartOpenFeignClient.icEventToDemand(dto);
if (!recIdResult.success() || recIdResult.getData() == null) {
throw new RenException(recIdResult.getCode(), recIdResult.getMsg());
}
formDTO.setOperationId(recIdResult.getData().getDemandRecId());
}
//3.新增事件数据、附件数据、分类数据、回复数据、操作记录数据
//3-1.事件数据保存
IcEventEntity entity = ConvertUtils.sourceToTarget(formDTO, IcEventEntity.class);
entity.setAgencyId(gridInfo.getPid());
entity.setGridPids(gridInfo.getPids());
insert(entity); insert(entity);
//3-2.附件数据保存
List<IcEventAttachmentEntity> imageEntityList = new ArrayList<>();
if (!CollectionUtils.isEmpty(formDTO.getImageList())) {
int sort = 0;
for (String url : formDTO.getImageList()) {
IcEventAttachmentEntity attachment = new IcEventAttachmentEntity();
attachment.setCustomerId(formDTO.getCustomerId());
attachment.setAttachmentUrl(url);
attachment.setIcEventId(entity.getId());
attachment.setCreatedBy(formDTO.getUserId());
attachment.setAttachmentFormat(url.substring(url.lastIndexOf(".") + NumConstant.ONE).toLowerCase());
attachment.setSort(sort++);
attachment.setAttachmentType("image");
attachment.setStatus(TopicConstant.AUTO_PASSED);
imageEntityList.add(attachment);
}
icEventAttachmentService.insertBatch(imageEntityList);
}
//3-3.分类数据保存
if (!CollectionUtils.isEmpty(formDTO.getCategoryList())) {
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), formDTO.getCategoryList());
AtomicReference<IcEventCategoryEntity> categoryEntity = null;
category.getCategoryList().forEach(ca -> {
if (ca.getId().equals(formDTO.getCategoryList().get(0))) {
categoryEntity.set(new IcEventCategoryEntity());
categoryEntity.get().setCustomerId(formDTO.getCustomerId());
categoryEntity.get().setIcEventId(entity.getId());
categoryEntity.get().setCategoryId(ca.getId());
categoryEntity.get().setCategoryPids(ca.getPids());
categoryEntity.get().setCategoryCode(ca.getCategoryCode());
}
});
if (categoryEntity.get() != null) {
icEventCategoryService.insert(categoryEntity.get());
}
}
//3-4.操作记录数据保存
List<IcEventOperationLogEntity> logList = new ArrayList<>();
logList.add(logEntity(formDTO.getCustomerId(), entity.getId(), formDTO.getUserId(), new Date(), "add", "publish"));
Date date = new Date();
//3-5.回复数据保存
if (StringUtils.isNotBlank(formDTO.getContent())) {
IcEventReplyEntity replyEntity = new IcEventReplyEntity();
replyEntity.setCustomerId(formDTO.getCustomerId());
replyEntity.setIcEventId(entity.getId());
replyEntity.setFromUserId(formDTO.getUserId());
replyEntity.setContent(formDTO.getContent());
replyEntity.setUserShowName(staffInfo.getAgencyName() + "-" + staffInfo.getRealName());
icEventReplyService.insert(replyEntity);
//回复对应的操作记录
date.setTime(date.getTime() + 6000 * 1);
logList.add(logEntity(formDTO.getCustomerId(), entity.getId(), formDTO.getUserId(), date, "reply", "reply"));
}
//立项对应的操作记录
if (StringUtils.isNotBlank(formDTO.getOperationType()) && "1".equals(formDTO.getOperationType())) {
date.setTime(date.getTime() + 6000 * 1);
logList.add(logEntity(formDTO.getCustomerId(), entity.getId(), formDTO.getUserId(), date, "shift_project", "shift_project"));
}
//转需求对应的操作记录
if (StringUtils.isNotBlank(formDTO.getOperationType()) && "2".equals(formDTO.getOperationType())) {
date.setTime(date.getTime() + 6000 * 1);
logList.add(logEntity(formDTO.getCustomerId(), entity.getId(), formDTO.getUserId(), date, "shift_demand", "shift_demand"));
}
//选择了已完成
if (StringUtils.isNotBlank(formDTO.getOperationType()) && "closed_case".equals(formDTO.getStatus())) {
date.setTime(date.getTime() + 6000 * 1);
logList.add(logEntity(formDTO.getCustomerId(), entity.getId(), formDTO.getUserId(), date, "close_case", "close_case"));
}
icEventOperationLogService.insertBatch(logList);
}
/**
* 根据分类Id集合查询对应数据信息
*
* @return
*/
private CategoryTagResultDTO queryCategory(String customerId, List<String> categoryIdList) {
CategoryTagListFormDTO categoryTag = new CategoryTagListFormDTO();
categoryTag.setCustomerId(customerId);
categoryTag.setCategoryIdList(categoryIdList);
Result<CategoryTagResultDTO> resultDTOResult = govIssueOpenFeignClient.getCategoryTagList(categoryTag);
if (!resultDTOResult.success()) {
throw new RenException("项目立项,调用issue服务查询分类、标签基础信息失败");
}
return resultDTOResult.getData();
}
/**
* 事件管理操作日志记录
*
* @return
*/
private IcEventOperationLogEntity logEntity(String customerId, String icEventId, String userId, Date date, String actionCode, String actionDesc) {
IcEventOperationLogEntity logEntity = new IcEventOperationLogEntity();
logEntity.setCustomerId(customerId);
logEntity.setIcEventId(icEventId);
logEntity.setUserId(userId);
logEntity.setUserIdentity("staff");
logEntity.setActionCode(actionCode);
logEntity.setActionDesc(actionDesc);
logEntity.setOperateTime(date);
return logEntity;
} }
@Override @Override
@ -143,6 +352,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/** /**
* 查询时间的grid_pids * 查询时间的grid_pids
*
* @param agencyId * @param agencyId
* @return * @return
*/ */
@ -185,7 +395,8 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
ProcessStatusRatioResultDTO r = new ProcessStatusRatioResultDTO(); ProcessStatusRatioResultDTO r = new ProcessStatusRatioResultDTO();
BigDecimal processingCount = new BigDecimal(0); BigDecimal processingCount = new BigDecimal(0);
BigDecimal closedCount = new BigDecimal(0);; BigDecimal closedCount = new BigDecimal(0);
;
BigDecimal processingRatio = null; BigDecimal processingRatio = null;
BigDecimal closedRatio = null; BigDecimal closedRatio = null;
@ -231,7 +442,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
PageHelper.startPage(pageNo, pageSize); PageHelper.startPage(pageNo, pageSize);
List<IcEventResultDTO> list = baseDao.listProcessAnalysisEvents( List<IcEventResultDTO> list = baseDao.listProcessAnalysisEvents(
EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID), orgType, orgId, gridPids, categoryCode, processStatus, queryStartTime EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID), orgType, orgId, gridPids, categoryCode, processStatus, queryStartTime
,queryEndTime); , queryEndTime);
// 3.补充数据 // 3.补充数据
for (IcEventResultDTO event : list) { for (IcEventResultDTO event : list) {

Loading…
Cancel
Save