Browse Source

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

dev_shibei_match
yinzuomei 4 years ago
parent
commit
4f87fcf4cb
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 34
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventReplyController.java
  3. 20
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventReplyService.java
  4. 115
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -97,7 +97,8 @@ public enum EpmetErrorCode {
VOTE_ISSUE_PLEASE(8602,"请先选择支持或反对,再发表您的想法"),
RESI_EVENT_READ(8603,"当前事件正在处理中,不能撤回"),
RESI_EVENT_NOT_MY_REPORTED(8604,"当前事件不是您发布的,无权操作"),
CAN_NOT_REPLY_RESI_EVENT(8605,"办结、立项处理后不可回复"),
CAN_NOT_REPLY_RESI_EVENT_GOV(8605,"办结、立项处理后不可回复"),
CAN_NOT_REPLY_RESI_EVENT_SELF(8606,"当前事件待处理,不可回复"),
// 爱心互助 居民端
NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"),

34
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventReplyController.java

@ -76,4 +76,38 @@ public class ResiEventReplyController {
resiEventReplyService.govReply(replyFormDTO);
return new Result();
}
/**
* 报事当事人回复
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author yinzuomei
* @date 2021/8/4 14:37
*/
@PostMapping("selfReply")
public Result selfReply(@LoginUser TokenDto tokenDto,@RequestBody ReplyFormDTO formDTO){
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,ReplyFormDTO.AddUserShowGroup.class,ReplyFormDTO.AddUserInternalGroup.class);
resiEventReplyService.selfReply(formDTO);
return new Result();
}
/**
* 艾特的人回复
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author yinzuomei
* @date 2021/8/4 15:06
*/
@PostMapping("atReply")
public Result atReply(@LoginUser TokenDto tokenDto,@RequestBody ReplyFormDTO formDTO){
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,ReplyFormDTO.AddUserShowGroup.class,ReplyFormDTO.AddUserInternalGroup.class);
resiEventReplyService.atReply(formDTO);
return new Result();
}
}

20
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ResiEventReplyService.java

@ -50,4 +50,24 @@ public interface ResiEventReplyService extends BaseService<ResiEventReplyEntity>
* @date 2021/8/4 14:20
*/
void govReply(ReplyFormDTO replyFormDTO);
/**
* 报事当事人回复
*
* @param formDTO
* @return void
* @author yinzuomei
* @date 2021/8/4 14:39
*/
void selfReply(ReplyFormDTO formDTO);
/**
* 艾特的人回复
*
* @param formDTO
* @return void
* @author yinzuomei
* @date 2021/8/4 15:06
*/
void atReply(ReplyFormDTO formDTO);
}

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

@ -34,9 +34,11 @@ 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.dto.result.UserBaseInfoResultDTO;
import com.epmet.entity.ResiEventEntity;
import com.epmet.entity.ResiEventOperationLogEntity;
import com.epmet.entity.ResiEventReplyEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.ResiEventReplyService;
import org.apache.commons.lang3.StringUtils;
@ -44,7 +46,9 @@ 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.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@ -63,6 +67,9 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl<ResiEventReplyDao
private ResiEventOperationLogDao resiEventOperationLogDao;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
@ -96,11 +103,7 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl<ResiEventReplyDao
@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());
}
ResiEventEntity eventEntity=queryResiEntity(replyFormDTO.getResiEventId());
// 回复内容走审核
scanReplyContent(replyFormDTO.getContent());
//查询工作人员所属组织
@ -118,7 +121,6 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl<ResiEventReplyDao
resiEventReplyEntity.setCreatedTime(new Date());
baseDao.insert(resiEventReplyEntity);
// 记录操作日志
//2、插入log日志
ResiEventOperationLogEntity reCallLog=new ResiEventOperationLogEntity();
reCallLog.setCustomerId(eventEntity.getCustomerId());
reCallLog.setResiEventId(eventEntity.getId());
@ -130,6 +132,103 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl<ResiEventReplyDao
resiEventOperationLogDao.insert(reCallLog);
}
private ResiEventEntity queryResiEntity(String resiEventId) {
ResiEventEntity eventEntity=resiEventDao.selectById(resiEventId);
// 办结、立项处理后不可回复
if(EventConstant.EVENT_STATUS_CLOSED_CASE.equals(eventEntity.getStatus())||eventEntity.getShiftProject()){
throw new RenException(EpmetErrorCode.CAN_NOT_REPLY_RESI_EVENT_GOV.getCode(),EpmetErrorCode.CAN_NOT_REPLY_RESI_EVENT_GOV.getMsg());
}
return eventEntity;
}
/**
* 报事当事人回复
*
* @param formDTO
* @return void
* @author yinzuomei
* @date 2021/8/4 14:39
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void selfReply(ReplyFormDTO formDTO) {
//查询原事件、已办结、已立项不可回复
ResiEventEntity eventEntity=queryResiEntity(formDTO.getResiEventId());
// 只有被人读过,才可以回复
if (!eventEntity.getReadFlag()) {
throw new RenException(EpmetErrorCode.CAN_NOT_REPLY_RESI_EVENT_SELF.getCode(), EpmetErrorCode.CAN_NOT_REPLY_RESI_EVENT_SELF.getMsg());
}
// 回复内容走审核
scanReplyContent(formDTO.getContent());
// 查询当前用户的显示昵称
List<String> userIdList =new ArrayList<>();
userIdList.add(formDTO.getUserId());
Result<List<UserBaseInfoResultDTO>> userResult=epmetUserOpenFeignClient.queryUserBaseInfo(userIdList);
if(!userResult.success()|| CollectionUtils.isEmpty(userResult.getData())){
throw new RenException("查询当前用户信息异常");
}
// 插入回复表
ResiEventReplyEntity resiEventReplyEntity=new ResiEventReplyEntity();
resiEventReplyEntity.setCustomerId(eventEntity.getCustomerId());
resiEventReplyEntity.setResiEventId(formDTO.getResiEventId());
resiEventReplyEntity.setFromUserId(formDTO.getUserId());
resiEventReplyEntity.setContent(formDTO.getContent());
resiEventReplyEntity.setUserShowName(userResult.getData().get(0).getShowName());
resiEventReplyEntity.setCreatedTime(new Date());
baseDao.insert(resiEventReplyEntity);
// 记录操作日志
ResiEventOperationLogEntity reCallLog=new ResiEventOperationLogEntity();
reCallLog.setCustomerId(eventEntity.getCustomerId());
reCallLog.setResiEventId(eventEntity.getId());
reCallLog.setUserId(formDTO.getUserId());
reCallLog.setUserIdentity(EventConstant.REPORT_USER);
reCallLog.setActionCode(ResiEventAction.REPLY.getCode());
reCallLog.setActionDesc(ResiEventAction.REPLY.getDesc());
reCallLog.setOperateTime(resiEventReplyEntity.getCreatedTime());
resiEventOperationLogDao.insert(reCallLog);
}
/**
* 艾特的人回复
*
* @param replyFormDTO
* @return void
* @author yinzuomei
* @date 2021/8/4 15:06
*/
@Override
public void atReply(ReplyFormDTO replyFormDTO) {
ResiEventEntity eventEntity=queryResiEntity(replyFormDTO.getResiEventId());
// 回复内容走审核
scanReplyContent(replyFormDTO.getContent());
// 查询当前用户的显示昵称
List<String> userIdList =new ArrayList<>();
userIdList.add(replyFormDTO.getUserId());
Result<List<UserBaseInfoResultDTO>> userResult=epmetUserOpenFeignClient.queryUserBaseInfo(userIdList);
if(!userResult.success()|| CollectionUtils.isEmpty(userResult.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("人大代表-".concat(userResult.getData().get(0).getRealName()));
resiEventReplyEntity.setCreatedTime(new Date());
baseDao.insert(resiEventReplyEntity);
// 记录操作日志
ResiEventOperationLogEntity reCallLog=new ResiEventOperationLogEntity();
reCallLog.setCustomerId(eventEntity.getCustomerId());
reCallLog.setResiEventId(eventEntity.getId());
reCallLog.setUserId(replyFormDTO.getUserId());
reCallLog.setUserIdentity(EventConstant.RESI_USER);
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();
@ -147,4 +246,8 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl<ResiEventReplyDao
}
}
}
}
Loading…
Cancel
Save