Browse Source

忘了回复内容要走审核

dev_shibei_match
yinzuomei 4 years ago
parent
commit
634d05f5b6
  1. 31
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java

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

@ -20,7 +20,11 @@ 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;
@ -35,12 +39,15 @@ 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;
/**
* 事件回复表
@ -56,6 +63,10 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl<ResiEventReplyDao
private ResiEventOperationLogDao resiEventOperationLogDao;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
/**
* @Description 报事详情-回复列表-两端通用
@ -90,6 +101,8 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl<ResiEventReplyDao
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()) {
@ -116,4 +129,22 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl<ResiEventReplyDao
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());
}
}
}
}
}
Loading…
Cancel
Save