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 015095cc83..ead3a480f5 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 @@ -97,6 +97,7 @@ public enum EpmetErrorCode { VOTE_ISSUE_PLEASE(8602,"请先选择支持或反对,再发表您的想法"), RESI_EVENT_READ(8603,"当前事件正在处理中,不能撤回"), RESI_EVENT_NOT_MY_REPORTED(8604,"当前事件不是您发布的,无权操作"), + CAN_NOT_REPLY_RESI_EVENT(8605,"办结、立项处理后不可回复"), // 爱心互助 居民端 NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"), diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ReplyFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ReplyFormDTO.java new file mode 100644 index 0000000000..a6729ff46f --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ReplyFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 回复通用入参 + * + * @author yinzuomei@elink-cn.com + * @date 2021/8/4 14:16 + */ +@Data +public class ReplyFormDTO implements Serializable { + private static final long serialVersionUID = 1653042839040178697L; + public interface AddUserInternalGroup { + } + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + @NotBlank(message = "事件id不能为空",groups = AddUserInternalGroup.class) + private String resiEventId; + @Length(min = 1, max = 200, message = "请填写回复内容,最多输入200字", groups = AddUserShowGroup.class) + private String content; + + //以下参数从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/ResiEventReplyController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventReplyController.java index dec9a9a80f..f7c57b14c5 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventReplyController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventReplyController.java @@ -21,6 +21,7 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.ReplyFormDTO; import com.epmet.dto.form.ReplyListFormDTO; import com.epmet.dto.result.ReplyListResultDTO; import com.epmet.service.ResiEventReplyService; @@ -59,4 +60,20 @@ public class ResiEventReplyController { return new Result>().ok(resiEventReplyService.replyList(formDTO)); } + /** + * 报事-工作人员回复 + * + * @param tokenDto + * @param replyFormDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/4 14:19 + */ + @PostMapping("govReply") + public Result govReply(@LoginUser TokenDto tokenDto,@RequestBody ReplyFormDTO replyFormDTO){ + replyFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(replyFormDTO,ReplyFormDTO.AddUserShowGroup.class,ReplyFormDTO.AddUserInternalGroup.class); + resiEventReplyService.govReply(replyFormDTO); + 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/ResiEventReplyService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventReplyService.java index 5065a9eb79..4311de0805 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventReplyService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventReplyService.java @@ -18,10 +18,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.form.ReplyFormDTO; import com.epmet.dto.form.ReplyListFormDTO; import com.epmet.dto.result.ReplyListResultDTO; import com.epmet.entity.ResiEventReplyEntity; -import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -41,4 +41,13 @@ public interface ResiEventReplyService extends BaseService */ List replyList(ReplyListFormDTO formDTO); + /** + * 报事-工作人员回复 + * + * @param replyFormDTO + * @return void + * @author yinzuomei + * @date 2021/8/4 14:20 + */ + void govReply(ReplyFormDTO replyFormDTO); } \ 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 98767e41c8..2a284ad914 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 @@ -18,13 +18,28 @@ package com.epmet.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.EventConstant; +import com.epmet.constant.ResiEventAction; +import com.epmet.dao.ResiEventDao; +import com.epmet.dao.ResiEventOperationLogDao; import com.epmet.dao.ResiEventReplyDao; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.form.ReplyFormDTO; import com.epmet.dto.form.ReplyListFormDTO; import com.epmet.dto.result.ReplyListResultDTO; +import com.epmet.entity.ResiEventEntity; +import com.epmet.entity.ResiEventOperationLogEntity; import com.epmet.entity.ResiEventReplyEntity; +import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.ResiEventReplyService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.Date; import java.util.List; /** @@ -35,6 +50,12 @@ import java.util.List; */ @Service public class ResiEventReplyServiceImpl extends BaseServiceImpl implements ResiEventReplyService { + @Autowired + private ResiEventDao resiEventDao; + @Autowired + private ResiEventOperationLogDao resiEventOperationLogDao; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; /** * @Description 报事详情-回复列表-两端通用 @@ -52,4 +73,47 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl staffResult = govOrgOpenFeignClient.getAgencyByStaff(replyFormDTO.getUserId()); + if (!staffResult.success() && null == staffResult.getData()) { + throw new RenException("查询当前工作人员信息异常"); + } + // 插入回复表 + ResiEventReplyEntity resiEventReplyEntity=new ResiEventReplyEntity(); + resiEventReplyEntity.setCustomerId(eventEntity.getCustomerId()); + resiEventReplyEntity.setResiEventId(replyFormDTO.getResiEventId()); + resiEventReplyEntity.setFromUserId(replyFormDTO.getUserId()); + resiEventReplyEntity.setContent(replyFormDTO.getContent()); + resiEventReplyEntity.setUserShowName(staffResult.getData().getOrganizationName()); + resiEventReplyEntity.setCreatedTime(new Date()); + baseDao.insert(resiEventReplyEntity); + // 记录操作日志 + //2、插入log日志 + ResiEventOperationLogEntity reCallLog=new ResiEventOperationLogEntity(); + reCallLog.setCustomerId(eventEntity.getCustomerId()); + reCallLog.setResiEventId(eventEntity.getId()); + reCallLog.setUserId(replyFormDTO.getUserId()); + reCallLog.setUserIdentity(EventConstant.STAFF); + reCallLog.setActionCode(ResiEventAction.REPLY.getCode()); + reCallLog.setActionDesc(ResiEventAction.REPLY.getDesc()); + reCallLog.setOperateTime(resiEventReplyEntity.getCreatedTime()); + resiEventOperationLogDao.insert(reCallLog); + } } \ No newline at end of file