Browse Source

Merge remote-tracking branch 'origin/dev_resi_event' into dev_resi_event

dev_shibei_match
wxz 4 years ago
parent
commit
ee4377c75e
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 6
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MentionUserFormDTO.java
  3. 34
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ReplyFormDTO.java
  4. 17
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventReplyController.java
  5. 5
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ResiEventMentionEntity.java
  6. 11
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventReplyService.java
  7. 95
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java
  8. 1
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java
  9. 1
      epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.16__create_resievent_tables.sql

1
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, "您还未进入指定的签到范围~"),

6
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MentionUserFormDTO.java

@ -32,4 +32,10 @@ public class MentionUserFormDTO implements Serializable {
* 注册网格的所有上级
*/
private String pids;
/**
* 人大代表姓名
*/
private String userShowName;
}

34
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;
}

17
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<List<ReplyListResultDTO>>().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();
}
}

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

@ -50,6 +50,11 @@ public class ResiEventMentionEntity extends BaseEpmetEntity {
*/
private String userType;
/**
* 人大代表目前显示姓名
*/
private String userShowName;
/**
* 居民端用户id
*/

11
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<ResiEventReplyEntity>
*/
List<ReplyListResultDTO> replyList(ReplyListFormDTO formDTO);
/**
* 报事-工作人员回复
*
* @param replyFormDTO
* @return void
* @author yinzuomei
* @date 2021/8/4 14:20
*/
void govReply(ReplyFormDTO replyFormDTO);
}

95
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java

@ -18,14 +18,36 @@
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.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.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
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.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 java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* 事件回复表
@ -35,6 +57,16 @@ import java.util.List;
*/
@Service
public class ResiEventReplyServiceImpl extends BaseServiceImpl<ResiEventReplyDao, ResiEventReplyEntity> implements ResiEventReplyService {
@Autowired
private ResiEventDao resiEventDao;
@Autowired
private ResiEventOperationLogDao resiEventOperationLogDao;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
/**
* @Description 报事详情-回复列表-两端通用
@ -52,4 +84,67 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl<ResiEventReplyDao
});
return list;
}
/**
* 报事-工作人员回复:办结立项处理后不可回复
*
* @param replyFormDTO
* @return void
* @author yinzuomei
* @date 2021/8/4 14:20
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void govReply(ReplyFormDTO replyFormDTO) {
ResiEventEntity eventEntity=resiEventDao.selectById(replyFormDTO.getResiEventId());
// 办结、立项处理后不可回复
if(EventConstant.EVENT_STATUS_CLOSED_CASE.equals(eventEntity.getStatus())||eventEntity.getShiftProject()){
throw new RenException(EpmetErrorCode.CAN_NOT_REPLY_RESI_EVENT.getCode(),EpmetErrorCode.CAN_NOT_REPLY_RESI_EVENT.getMsg());
}
// 回复内容走审核
scanReplyContent(replyFormDTO.getContent());
//查询工作人员所属组织
Result<CustomerAgencyDTO> 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);
}
private void scanReplyContent(String content) {
if (StringUtils.isNotBlank(content)) {
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(content);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
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(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg());
}
}
}
}
}

1
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java

@ -200,6 +200,7 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
mentionEntity.setCustomerId(customerId);
mentionEntity.setResiEventId(resiEventId);
mentionEntity.setUserType(EventConstant.NPC_USER);
mentionEntity.setUserShowName(npc.getUserShowName());
mentionEntity.setUserId(npc.getUserId());
mentionEntity.setGridId(npc.getGridId());
mentionEntity.setAgencyId(npc.getAgencyId());

1
epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.16__create_resievent_tables.sql

@ -54,6 +54,7 @@ CREATE TABLE `resi_event_mention` (
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id',
`RESI_EVENT_ID` varchar(64) NOT NULL COMMENT '事件id',
`USER_TYPE` varchar(32) NOT NULL COMMENT '人大代表:npc_user',
`USER_SHOW_NAME` varchar(64) NOT NULL COMMENT '人大代表目前显示姓名',
`USER_ID` varchar(64) NOT NULL COMMENT '居民端用户id',
`GRID_ID` varchar(64) NOT NULL COMMENT '居民注册网格ID',
`AGENCY_ID` varchar(64) NOT NULL COMMENT '居民所属社区,就是grid_id的所属组织',

Loading…
Cancel
Save