|
|
@ -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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |