diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 1a29d62e54..3966217c18 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -99,6 +99,7 @@ public enum EpmetErrorCode { RESI_EVENT_NOT_MY_REPORTED(8604,"当前事件不是您发布的,无权操作"), CAN_NOT_REPLY_RESI_EVENT_GOV(8605,"办结、立项处理后不可回复"), CAN_NOT_REPLY_RESI_EVENT_SELF(8606,"当前事件待处理,不可回复"), + RESI_EVENT_CAN_NOT_CLOSE_CASE(8607,"事件尚未处理,请处理完成后进行办结"), // 爱心互助 居民端 NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"), diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/CloseResiEventFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/CloseResiEventFormDTO.java new file mode 100644 index 0000000000..bf3cdcc62c --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/CloseResiEventFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 报事-办结 入参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2021/8/5 10:44 + */ +@Data +public class CloseResiEventFormDTO implements Serializable { + private static final long serialVersionUID = -3621650590714057648L; + + public interface AddUserInternalGroup { + } + @NotBlank(message = "eventId不能为空", groups = AddUserInternalGroup.class) + private String eventId; + + //以下参数从token中获取 + /** + * 当前用户id + */ + @NotBlank(message = "userId不能为空", groups = AddUserInternalGroup.class) + private String userId; +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java index c76a1ea63c..d984456930 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java @@ -43,34 +43,35 @@ import java.util.List; @RestController @RequestMapping("resievent") public class ResiEventController { - + @Autowired private ResiEventService resiEventService; /** - * @Description 报事详情-两端通用 + * @Description 报事详情-两端通用 * @Param formDTO * @author zxc * @date 2021/8/3 1:47 下午 */ @PostMapping("eventdetail") - public Result eventDetail(@LoginUser TokenDto tokenDto ,@RequestBody EventDetailFormDTO formDTO){ + public Result eventDetail(@LoginUser TokenDto tokenDto, @RequestBody EventDetailFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); - return new Result().ok(resiEventService.eventDetail(formDTO,tokenDto)); + return new Result().ok(resiEventService.eventDetail(formDTO, tokenDto)); } + /** * 我要报事-提交(尹) * * @param formDTO - * @return com.epmet.commons.tools.utils.Result + * @return com.epmet.commons.tools.utils.Result * @author yinzuomei * @date 2021/8/3 10:46 */ @PostMapping("report") - public Result report(@LoginUser TokenDto tokenDto, @RequestBody ResiEventFormDTO formDTO){ + public Result report(@LoginUser TokenDto tokenDto, @RequestBody ResiEventFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); - ValidatorUtils.validateEntity(formDTO,ResiEventFormDTO.AddUserShowGroup.class,ResiEventFormDTO.AddUserInternalGroup.class); + ValidatorUtils.validateEntity(formDTO, ResiEventFormDTO.AddUserShowGroup.class, ResiEventFormDTO.AddUserInternalGroup.class); return new Result().ok(resiEventService.report(formDTO)); } @@ -78,15 +79,15 @@ public class ResiEventController { * 我要报事-撤回(尹) * * @param formDTO - * @return com.epmet.commons.tools.utils.Result + * @return com.epmet.commons.tools.utils.Result * @author yinzuomei * @date 2021/8/3 10:54 */ @PostMapping("recall") - public Result recall(@LoginUser TokenDto tokenDto,@RequestBody ReCallEventFormDTO formDTO){ + public Result recall(@LoginUser TokenDto tokenDto, @RequestBody ReCallEventFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); - ValidatorUtils.validateEntity(formDTO,ResiEventIdDTO.ResiEventIdGroup.class,ReCallEventFormDTO.AddUserInternalGroup.class); + ValidatorUtils.validateEntity(formDTO, ResiEventIdDTO.ResiEventIdGroup.class, ReCallEventFormDTO.AddUserInternalGroup.class); resiEventService.reCall(formDTO); return new Result(); } @@ -96,15 +97,15 @@ public class ResiEventController { * * @param tokenDto * @param formDTO - * @return com.epmet.commons.tools.utils.Result + * @return com.epmet.commons.tools.utils.Result * @author yinzuomei * @date 2021/8/3 13:57 */ @PostMapping("chooseresolve") - public Result chooseResolve(@LoginUser TokenDto tokenDto,@RequestBody ChooseResolveFormDTO formDTO){ + public Result chooseResolve(@LoginUser TokenDto tokenDto, @RequestBody ChooseResolveFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); - ValidatorUtils.validateEntity(formDTO,ResiEventIdDTO.ResiEventIdGroup.class,ChooseResolveFormDTO.AddUserInternalGroup.class); + ValidatorUtils.validateEntity(formDTO, ResiEventIdDTO.ResiEventIdGroup.class, ChooseResolveFormDTO.AddUserInternalGroup.class); resiEventService.chooseResolve(formDTO); return new Result(); } @@ -115,43 +116,43 @@ public class ResiEventController { * * @param tokenDto * @param formDTO - * @return com.epmet.commons.tools.utils.Result> + * @return com.epmet.commons.tools.utils.Result> * @author yinzuomei * @date 2021/8/3 14:27 */ @PostMapping("myreported") - public Result> queryMyReported(@LoginUser TokenDto tokenDto, @RequestBody MyReportedFormDTO formDTO){ + public Result> queryMyReported(@LoginUser TokenDto tokenDto, @RequestBody MyReportedFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); - ValidatorUtils.validateEntity(formDTO,MyReportedFormDTO.AddUserInternalGroup.class); + ValidatorUtils.validateEntity(formDTO, MyReportedFormDTO.AddUserInternalGroup.class); return new Result>().ok(resiEventService.queryMyReported(formDTO)); } /** - * @Description 群众直报(待处理、处理中、已办结)列表 + * @Description 群众直报(待处理、处理中、已办结)列表 * @Param formDTO * @author zxc * @date 2021/8/3 10:53 上午 */ @PostMapping("eventlist") - public Result> eventList(@RequestBody EventListFormDTO formDTO){ + public Result> eventList(@RequestBody EventListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, EventListFormDTO.EventListForm.class); return new Result>().ok(resiEventService.eventList(formDTO)); } /** - * @Description 报事-首次查看事件-两端通用 + * @Description 报事-首次查看事件-两端通用 * @Param formDTO * @author zxc * @date 2021/8/3 11:01 上午 */ @PostMapping("updateviewtime") - public Result updateViewTime(@LoginUser TokenDto tokenDto,@RequestBody UpdateViewTimeFormDTO formDTO){ + public Result updateViewTime(@LoginUser TokenDto tokenDto, @RequestBody UpdateViewTimeFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); formDTO.setCustomerId(tokenDto.getCustomerId()); - ValidatorUtils.validateEntity(formDTO,UpdateViewTimeFormDTO.AddUserInternalGroup.class); - if(EventConstant.STAFF.equals(formDTO.getViewType())){ - ValidatorUtils.validateEntity(formDTO,UpdateViewTimeFormDTO.GovInternalGroup.class); + ValidatorUtils.validateEntity(formDTO, UpdateViewTimeFormDTO.AddUserInternalGroup.class); + if (EventConstant.STAFF.equals(formDTO.getViewType())) { + ValidatorUtils.validateEntity(formDTO, UpdateViewTimeFormDTO.GovInternalGroup.class); } resiEventService.updateViewTime(formDTO); return new Result(); @@ -162,27 +163,43 @@ public class ResiEventController { * * @param tokenDto * @param formDTO - * @return com.epmet.commons.tools.utils.Result> + * @return com.epmet.commons.tools.utils.Result> * @author yinzuomei * @date 2021/8/4 9:40 */ @PostMapping("mentionlist") - public Result> mentionList(@LoginUser TokenDto tokenDto, @RequestBody UserMentionFormDTO formDTO){ + public Result> mentionList(@LoginUser TokenDto tokenDto, @RequestBody UserMentionFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); - ValidatorUtils.validateEntity(formDTO,UserMentionFormDTO.AddUserInternalGroup.class); + ValidatorUtils.validateEntity(formDTO, UserMentionFormDTO.AddUserInternalGroup.class); return new Result>().ok(resiEventService.mentionList(formDTO)); } /** - * @Description 最新直报 + * @Description 最新直报 * @Param userId * @author zxc * @date 2021/8/5 9:55 上午 */ @PostMapping("newevents") - public Result> newEvents(@LoginUser TokenDto tokenDto){ + public Result> newEvents(@LoginUser TokenDto tokenDto) { return new Result>().ok(resiEventService.newEvents(tokenDto.getUserId())); } + /** + * 报事办结 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/5 10:47 + */ + @PostMapping("close") + public Result closeResiEvent(@LoginUser TokenDto tokenDto, @RequestBody CloseResiEventFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, CloseResiEventFormDTO.AddUserInternalGroup.class); + resiEventService.closeResiEvent(formDTO); + return new Result(); + } } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventService.java index 236ebe765e..64a6c5e6a7 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventService.java @@ -97,4 +97,15 @@ public interface ResiEventService extends BaseService { * @date 2021/8/5 9:55 上午 */ List newEvents(String userId); + + /** + * 报事办结 + * + * @param formDTO + * @return void + * @author yinzuomei + * @date 2021/8/5 10:48 + */ + void closeResiEvent(CloseResiEventFormDTO formDTO); + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java index 5f1d1ddaee..7d1116c60c 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java @@ -136,8 +136,10 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl(); } + /** + * 报事办结:没有回复或立项不可办结 + * + * @param formDTO + * @return void + * @author yinzuomei + * @date 2021/8/5 10:48 + */ + @Override + public void closeResiEvent(CloseResiEventFormDTO formDTO) { + ResiEventEntity resiEventEntity=baseDao.selectById(formDTO.getEventId()); + if(null==resiEventEntity){ + throw new RenException(String.format("根据事件id没有找到记录",formDTO.getEventId())); + } + List replyList=resiEventReplyDao.selectReplyList(formDTO.getEventId()); + //如果未转项目,也没有回复,不允许办结 + if(!resiEventEntity.getShiftProject()&&CollectionUtils.isEmpty(replyList)){ + throw new RenException(EpmetErrorCode.RESI_EVENT_CAN_NOT_CLOSE_CASE.getCode(),EpmetErrorCode.RESI_EVENT_CAN_NOT_CLOSE_CASE.getMsg()); + } + // 1、修改事件状态 + resiEventEntity.setRedDot(true); + resiEventEntity.setStatus(EventConstant.EVENT_STATUS_CLOSED_CASE); + resiEventEntity.setCloseCaseTime(new Date()); + resiEventEntity.setLatestOperatedTime(resiEventEntity.getCloseCaseTime()); + baseDao.updateById(resiEventEntity); + // 2、记录操作日志 + ResiEventOperationLogEntity reCallLog=new ResiEventOperationLogEntity(); + reCallLog.setCustomerId(resiEventEntity.getCustomerId()); + reCallLog.setResiEventId(resiEventEntity.getId()); + reCallLog.setUserId(formDTO.getUserId()); + reCallLog.setUserIdentity(EventConstant.STAFF); + reCallLog.setActionCode(ResiEventAction.CLOSE_CASE.getCode()); + reCallLog.setActionDesc(ResiEventAction.CLOSE_CASE.getDesc()); + reCallLog.setOperateTime(resiEventEntity.getCloseCaseTime()); + resiEventOperationLogDao.insert(reCallLog); + // 3、红点: + // 当前工作人员办结后: + // 3.1、报事人在已办结列表中展示红点:上面已经更新 + // 3.2、人大代表在未读/已读列表中展示红点 + resiEventMentionDao.updateRedDotShow(formDTO.getEventId(),null); + // 3.3、目前Db设计支持报给多个层级(组织或网格),按理说应该更新非当前组织外,其他的组织,显示红点,先不做了吧 todo + } + } \ No newline at end of file