|
|
@ -24,12 +24,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.scan.param.ImgScanParamDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.ImgTaskDTO; |
|
|
|
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.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.dto.CustomerGridDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.CommonDataFilterResultDTO; |
|
|
@ -72,14 +79,15 @@ import com.epmet.resi.group.dto.topic.form.*; |
|
|
|
import com.epmet.resi.group.dto.topic.form.CheckTopicPublisherFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.*; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
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.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -91,6 +99,7 @@ import java.util.stream.Collectors; |
|
|
|
* @since v1.0.0 2020-03-31 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopicEntity> implements ResiTopicService { |
|
|
|
|
|
|
|
@Autowired |
|
|
@ -132,6 +141,13 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
@Autowired |
|
|
|
private GovIssueFeignClient govIssueFeignClient; |
|
|
|
|
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
|
private String scanApiUrl; |
|
|
|
@Value("${openapi.scan.method.textSyncScan}") |
|
|
|
private String textSyncScanMethod; |
|
|
|
@Value("${openapi.scan.method.imgSyncScan}") |
|
|
|
private String imgSyncScanMethod; |
|
|
|
|
|
|
|
|
|
|
|
private final Log logger = LogFactory.getLog(getClass()); |
|
|
|
|
|
|
@ -199,6 +215,41 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result createTopic(TokenDto tokenDto, ResiTopicPublishFormDTO resiTopicPublishFormDTO) { |
|
|
|
String topicContent = resiTopicPublishFormDTO.getTopicContent(); |
|
|
|
List<String> attachmentList = resiTopicPublishFormDTO.getAttachmentList(); |
|
|
|
//创建话题内容审核
|
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
TextTaskDTO taskDTO = new TextTaskDTO(); |
|
|
|
taskDTO.setContent(topicContent); |
|
|
|
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()) { |
|
|
|
log.error(String.format(TopicConstant.CREATE_TOPIC,topicContent)); |
|
|
|
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
//创建话题图片审核
|
|
|
|
if (attachmentList.size() != NumConstant.ZERO){ |
|
|
|
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); |
|
|
|
attachmentList.forEach(url -> { |
|
|
|
ImgTaskDTO task = new ImgTaskDTO(); |
|
|
|
task.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
task.setUrl(url); |
|
|
|
imgScanParamDTO.getTasks().add(task); |
|
|
|
}); |
|
|
|
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); |
|
|
|
if (!imgScanResult.success()){ |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!imgScanResult.getData().isAllPass()) { |
|
|
|
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (null == tokenDto) { |
|
|
|
logger.error(ModuleConstant.USER_NOT_NULL); |
|
|
|
throw new RenException(ModuleConstant.USER_NOT_NULL); |
|
|
@ -1045,6 +1096,29 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void shiftIssue(ResiTopicTurnIssueFromDTO topicTurnIssueFromDTO) { |
|
|
|
//话题转议题审核:标题、建议
|
|
|
|
String issueTitle = topicTurnIssueFromDTO.getIssueTitle(); |
|
|
|
String suggestion = topicTurnIssueFromDTO.getSuggestion(); |
|
|
|
TextScanParamDTO textScan = new TextScanParamDTO(); |
|
|
|
//标题
|
|
|
|
TextTaskDTO taskTitle = new TextTaskDTO(); |
|
|
|
taskTitle.setContent(issueTitle); |
|
|
|
taskTitle.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
textScan.getTasks().add(taskTitle); |
|
|
|
//建议
|
|
|
|
TextTaskDTO taskSuggestion = new TextTaskDTO(); |
|
|
|
taskSuggestion.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
taskSuggestion.setContent(suggestion); |
|
|
|
textScan.getTasks().add(taskSuggestion); |
|
|
|
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScan); |
|
|
|
if (!textSyncScanResult.success()){ |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!textSyncScanResult.getData().isAllPass()) { |
|
|
|
log.error(String.format(TopicConstant.SHIFT_ISSUE,issueTitle,suggestion)); |
|
|
|
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
//1.统一时间(群组服务 -> 议题服务)
|
|
|
|
Date now = new Date(); |
|
|
|
//2.调用gov-org获取数据权限
|
|
|
|