diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java index dd332d4b13..a813af8152 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java +++ b/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), ITEM_TYPE_QUERY("item_type_query","居民信息组件查询方式",14), 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; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index 29a60588a9..a444c32e5b 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/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.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.CommonCustomerFormDTO; +import com.epmet.dto.form.IcDemandFormDTO; 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.resi.VolunteerCommonFormDTO; 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 java.util.List; -import java.util.Map; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -119,4 +120,10 @@ public interface EpmetHeartOpenFeignClient { */ @PostMapping("/heart/icpartyunit/getPartyUnitList") Result> getPartyUnitList(@RequestBody PartyUnitListFormDTO formDTO); + + /** + * @description 事件管理-转需求 + **/ + @PostMapping("/heart/residemand/iceventtodemand") + Result icEventToDemand(@RequestBody IcDemandFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index df9f67f0ff..4ffce2041b 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/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.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.CommonCustomerFormDTO; +import com.epmet.dto.form.IcDemandFormDTO; 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.resi.VolunteerCommonFormDTO; import com.epmet.dto.result.PartyUnitListResultDTO; @@ -17,7 +19,6 @@ import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; import com.epmet.feign.EpmetHeartOpenFeignClient; import java.util.List; -import java.util.Map; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -116,4 +117,9 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli public Result> getPartyUnitList(PartyUnitListFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getPartyUnitList", formDTO); } + + @Override + public Result queryUserVolunteerInfo(IcDemandFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "icEventToDemand", formDTO); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java index b798d0fe0c..f152dd140f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java +++ b/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.enums.EventEnum; 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.validator.ValidatorUtils; import com.epmet.constant.SystemMessageType; import com.epmet.constant.UserDemandConstant; +import com.epmet.dto.IcUserDemandRecDTO; import com.epmet.dto.form.AutoEvaluateDemandFormDTO; +import com.epmet.dto.form.IcDemandFormDTO; import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.demand.*; import com.epmet.dto.result.demand.*; @@ -267,4 +270,16 @@ public class ResiDemandController { demandSatisfactionService.evaluateDemandAuto(formDTO); return new Result(); } + + /** + * 事件管理-转需求 + * + * @return + */ + @PostMapping("iceventtodemand") + public Result icEventToDemand(@RequestBody IcDemandFormDTO formDTO) { + ReportDemandFormDTO dto = ConvertUtils.sourceToTarget(formDTO, ReportDemandFormDTO.class); + return new Result().ok(icUserDemandRecService.saveOrUpdateDemand(dto)); + } + } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventDTO.java index 7233e80a75..fb86222967 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventDTO.java +++ b/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 Date happenTime; + /** * 事件内容 */ diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventOperationLogDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventOperationLogDTO.java index db707294fc..ebe242b7ff 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/IcEventOperationLogDTO.java +++ b/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 - 2、复:reply; -3、立项:shift_project; -4、转需求:shift_demand -5、办结:close_case; - - + * 2、复:reply; + * 3、立项:shift_project; + * 4、转需求:shift_demand + * 5、办结:close_case; */ private String actionCode; /** * 1、发布事件:publish; -2、撤回事件:recall; -3、复:reply; -4、立项:shift_project; -5、办结:close_case; -6、选择是否已解决:choose_resolve; -7、首次查看阅读事件:read_first:人大代表未读=>已读;工作人员待处理=>处理中; + * 2、撤回事件:recall; + * 3、复:reply; + * 4、立项:shift_project; + * 5、转需求: shift_demand; + * 6、办结:close_case; + * 7、选择是否已解决:choose_resolve; + * 8、首次查看阅读事件:read_first:人大代表未读=>已读;工作人员待处理=>处理中; */ private String actionDesc; diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcDemandFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcDemandFormDTO.java new file mode 100644 index 0000000000..657bea778f --- /dev/null +++ b/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; + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventAddEditFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventAddEditFormDTO.java new file mode 100644 index 0000000000..b3fd086a1c --- /dev/null +++ b/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 imageList; + /** + * 二类分类Id + */ + private List 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; + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java index 9d94d20e38..e1bdaca91a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java +++ b/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.dto.IcEventDTO; import com.epmet.dto.form.EventProcessAnalysisCommonFormDTO; +import com.epmet.dto.form.IcEventAddEditFormDTO; import com.epmet.dto.form.IcEventListFormDTO; import com.epmet.dto.form.ProcessAnalysisEventListFormDTO; import com.epmet.dto.result.IcEventListResultDTO; @@ -51,11 +52,14 @@ public class IcEventController { } @NoRepeatSubmit - @PostMapping("save") - public Result save(@RequestBody IcEventDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - icEventService.save(dto); + @PostMapping("add") + public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcEventAddEditFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AddGroup.class, DefaultGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setApp(tokenDto.getApp()); + formDTO.setClient(tokenDto.getClient()); + icEventService.save(formDTO); return new Result(); } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventAttachmentEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventAttachmentEntity.java index 3f9534982f..a5efd1f853 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventAttachmentEntity.java +++ b/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; -auto_passed: 自动通过; -review:结果不确定,需要人工审核; -block: 结果违规; -rejected:人工审核驳回; -approved:人工审核通过) -现在图片是同步审核的,所以图片只有auto_passed一种状态 + auto_passed: 自动通过; + review:结果不确定,需要人工审核; + block: 结果违规; + rejected:人工审核驳回; + approved:人工审核通过) + 现在图片是同步审核的,所以图片只有auto_passed一种状态 */ private String status; diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java index 58dd68e144..e33765e233 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java +++ b/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 Date happenTime; + /** * 事件内容 */ diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventOperationLogEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventOperationLogEntity.java index a3cdf53b51..c9c08f1951 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventOperationLogEntity.java +++ b/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 - 2、复:reply; -3、立项:shift_project; -4、转需求:shift_demand -5、办结:close_case; - - + * 2、复:reply; + * 3、立项:shift_project; + * 4、转需求:shift_demand + * 5、办结:close_case; */ private String actionCode; /** * 1、发布事件:publish; -2、撤回事件:recall; -3、复:reply; -4、立项:shift_project; -5、办结:close_case; -6、选择是否已解决:choose_resolve; -7、首次查看阅读事件:read_first:人大代表未读=>已读;工作人员待处理=>处理中; + * 2、撤回事件:recall; + * 3、复:reply; + * 4、立项:shift_project; + * 5、转需求: shift_demand; + * 6、办结:close_case; + * 7、选择是否已解决:choose_resolve; + * 8、首次查看阅读事件:read_first:人大代表未读=>已读;工作人员待处理=>处理中; */ private String actionDesc; diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java index e3ad6ba353..ae4550c76e 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java +++ b/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.tools.page.PageData; import com.epmet.dto.IcEventDTO; +import com.epmet.dto.form.IcEventAddEditFormDTO; import com.epmet.dto.form.IcEventListFormDTO; import com.epmet.dto.result.IcEventListResultDTO; import com.epmet.dto.result.IcEventResultDTO; @@ -10,7 +11,6 @@ import com.epmet.dto.result.ProcessStatusRatioResultDTO; import com.epmet.entity.IcEventEntity; import java.util.Date; -import java.util.Map; /** * 事件管理表 @@ -48,7 +48,7 @@ public interface IcEventService extends BaseService { * @author generator * @date 2022-05-17 */ - void save(IcEventDTO dto); + void save(IcEventAddEditFormDTO dto); /** * 默认更新 diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java index d081e4322e..9f28ccdded 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java +++ b/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.tools.constant.AppClientConstant; 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.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; 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.dto.form.FileCommonDTO; -import com.epmet.commons.tools.enums.DictTypeEnum; 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.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.EpmetRequestHolder; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.dao.IcEventDao; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.IcEventDTO; -import com.epmet.dto.form.AgencyInfoFormDTO; -import com.epmet.dto.form.IcEventListFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.form.demand.DemandRecId; import com.epmet.dto.result.*; -import com.epmet.dto.result.AllGridsByUserIdResultDTO; -import com.epmet.dto.result.IcEventListResultDTO; -import com.epmet.dto.result.IcMoveInListResultDTO; -import com.epmet.entity.IcEventEntity; +import com.epmet.entity.*; import com.epmet.enums.EcEventProcessStatusEnum; import com.epmet.feign.EpmetAdminOpenFeignClient; +import com.epmet.feign.EpmetHeartOpenFeignClient; +import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.feign.EpmetAdminOpenFeignClient; -import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.service.IcEventService; +import com.epmet.resi.group.constant.TopicConstant; +import com.epmet.service.*; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; 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.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; /** @@ -58,11 +63,31 @@ import java.util.stream.Collectors; @Service public class IcEventServiceImpl extends BaseServiceImpl 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 private GovOrgOpenFeignClient govOrgOpenFeignClient; - @Autowired 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 public PageData list(IcEventListFormDTO formDTO) { @@ -77,7 +102,7 @@ public class IcEventServiceImpl extends BaseServiceImpl gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName, (key1, key2) -> key2)); //与户主关系字典表数据 - Result> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_EVENT.getCode()); + Result> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_EVENT_SOURCE_TYPE.getCode()); Map statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); //封装数据 @@ -105,8 +130,8 @@ public class IcEventServiceImpl extends BaseServiceImpl(list, pageInfo.getTotal()); } - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -122,9 +147,193 @@ public class IcEventServiceImpl extends BaseServiceImpl 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 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 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); + //3-2.附件数据保存 + List 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 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 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 categoryIdList) { + CategoryTagListFormDTO categoryTag = new CategoryTagListFormDTO(); + categoryTag.setCustomerId(customerId); + categoryTag.setCategoryIdList(categoryIdList); + Result 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 @@ -143,6 +352,7 @@ public class IcEventServiceImpl extends BaseServiceImpl list = baseDao.listProcessAnalysisEvents( EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID), orgType, orgId, gridPids, categoryCode, processStatus, queryStartTime - ,queryEndTime); + , queryEndTime); // 3.补充数据 for (IcEventResultDTO event : list) {