Browse Source

审核失败代码调整

master
jianjun 5 years ago
parent
commit
e27859ecc0
  1. 24
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java
  2. 24
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

24
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java

@ -23,19 +23,21 @@ public class ScanContentUtils {
* *
* @return * @return
*/ */
public static SyncScanResult imgSyncScan(String url, ImgScanParamDTO param) { public static Result<SyncScanResult> imgSyncScan(String url, ImgScanParamDTO param) {
log.debug("imgSyncScan param:", JSON.toJSONString(param)); log.debug("imgSyncScan param:{}", JSON.toJSONString(param));
if (StringUtils.isBlank(url) || param == null) { if (StringUtils.isBlank(url) || param == null) {
throw new RenException("参数错误"); throw new RenException("参数错误");
} }
try { try {
Result<String> result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param)); Result<String> result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param));
log.debug("imgSyncScan result:{}", JSON.toJSONString(param));
if (result.success()) { if (result.success()) {
return JSON.parseObject(result.getData(), SyncScanResult.class); return new Result<SyncScanResult>().ok(JSON.parseObject(result.getData(), SyncScanResult.class));
} }
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), result.getMsg()); return new Result<SyncScanResult>().error(EpmetErrorCode.SERVER_ERROR.getCode(), result.getMsg());
} catch (Exception e) { } catch (Exception e) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); log.debug("imgSyncScan param:{}", JSON.toJSONString(param));
return new Result<SyncScanResult>().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
} }
} }
@ -44,19 +46,21 @@ public class ScanContentUtils {
* *
* @return * @return
*/ */
public static SyncScanResult textSyncScan(String url, TextScanParamDTO param) { public static Result<SyncScanResult> textSyncScan(String url, TextScanParamDTO param) {
log.debug("textSyncScan param:", JSON.toJSONString(param)); log.debug("textSyncScan param:{}", JSON.toJSONString(param));
if (StringUtils.isBlank(url) || param == null) { if (StringUtils.isBlank(url) || param == null) {
throw new RenException("参数错误"); throw new RenException("参数错误");
} }
try { try {
Result<String> result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param)); Result<String> result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param));
log.debug("textSyncScan result:{}", JSON.toJSONString(result));
if (result.success()) { if (result.success()) {
return JSON.parseObject(result.getData(), SyncScanResult.class); return new Result<SyncScanResult>().ok(JSON.parseObject(result.getData(), SyncScanResult.class));
} }
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), result.getMsg()); return new Result<SyncScanResult>().error(EpmetErrorCode.SERVER_ERROR.getCode(), result.getMsg());
} catch (Exception e) { } catch (Exception e) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); log.error("textSyncScan exception:", e);
return new Result<SyncScanResult>().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
} }
} }
} }

24
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -948,8 +948,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
} }
}); });
} }
SyncScanResult imgSyncScanResult = null; Result<SyncScanResult> imgSyncScanResult = null;
SyncScanResult textSyncScanResult = null; Result<SyncScanResult> textSyncScanResult = null;
if(!CollectionUtils.isEmpty(imgScanParamDTO.getTasks())){ if(!CollectionUtils.isEmpty(imgScanParamDTO.getTasks())){
log.info("scanContent imgScanParamDTO:{}", JSON.toJSONString(imgScanParamDTO)); log.info("scanContent imgScanParamDTO:{}", JSON.toJSONString(imgScanParamDTO));
@ -964,22 +964,24 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
result = new SyncScanResult(); result = new SyncScanResult();
if (imgSyncScanResult.isAllPass()) { SyncScanResult imgSyncScanResultData = imgSyncScanResult.getData();
result.setAllPass(imgSyncScanResult.isAllPass()); if (imgSyncScanResult.success()&&imgSyncScanResultData.isAllPass()) {
result.getSuccessDataIds().addAll(imgSyncScanResult.getSuccessDataIds()); result.setAllPass(imgSyncScanResultData.isAllPass());
result.getFailDataIds().addAll(imgSyncScanResult.getFailDataIds()); result.getSuccessDataIds().addAll(imgSyncScanResultData.getSuccessDataIds());
result.getFailDataIds().addAll(imgSyncScanResultData.getFailDataIds());
} }
if (textSyncScanResult.isAllPass()) { SyncScanResult textSyncScanResultData = textSyncScanResult.getData();
result.setAllPass(result.isAllPass() ? textSyncScanResult.isAllPass() : false); if (textSyncScanResult.success()&&textSyncScanResultData.isAllPass()) {
result.getSuccessDataIds().addAll(textSyncScanResult.getSuccessDataIds()); result.setAllPass(result.isAllPass() ? textSyncScanResultData.isAllPass() : false);
result.getFailDataIds().addAll(textSyncScanResult.getFailDataIds()); result.getSuccessDataIds().addAll(textSyncScanResultData.getSuccessDataIds());
result.getFailDataIds().addAll(textSyncScanResultData.getFailDataIds());
} }
} catch (Exception e) { } catch (Exception e) {
log.error("scanContent exception", e); log.error("scanContent exception", e);
this.sendMsg(draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle())); this.sendMsg(draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL);
} }
log.error("scanContent result", JSON.toJSONString(result)); log.debug("scanContent result", JSON.toJSONString(result));
return result; return result;
} }
@Override @Override

Loading…
Cancel
Save