diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java index e8b9506a9a..eaf5d8c893 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java @@ -23,19 +23,21 @@ public class ScanContentUtils { * * @return */ - public static SyncScanResult imgSyncScan(String url, ImgScanParamDTO param) { - log.debug("imgSyncScan param:", JSON.toJSONString(param)); + public static Result imgSyncScan(String url, ImgScanParamDTO param) { + log.debug("imgSyncScan param:{}", JSON.toJSONString(param)); if (StringUtils.isBlank(url) || param == null) { throw new RenException("参数错误"); } try { Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param)); + log.debug("imgSyncScan result:{}", JSON.toJSONString(param)); if (result.success()) { - return JSON.parseObject(result.getData(), SyncScanResult.class); + return new Result().ok(JSON.parseObject(result.getData(), SyncScanResult.class)); } - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), result.getMsg()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), result.getMsg()); } catch (Exception e) { - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + log.debug("imgSyncScan param:{}", JSON.toJSONString(param)); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); } } @@ -44,19 +46,21 @@ public class ScanContentUtils { * * @return */ - public static SyncScanResult textSyncScan(String url, TextScanParamDTO param) { - log.debug("textSyncScan param:", JSON.toJSONString(param)); + public static Result textSyncScan(String url, TextScanParamDTO param) { + log.debug("textSyncScan param:{}", JSON.toJSONString(param)); if (StringUtils.isBlank(url) || param == null) { throw new RenException("参数错误"); } try { Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param)); + log.debug("textSyncScan result:{}", JSON.toJSONString(result)); if (result.success()) { - return JSON.parseObject(result.getData(), SyncScanResult.class); + return new Result().ok(JSON.parseObject(result.getData(), SyncScanResult.class)); } - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), result.getMsg()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), result.getMsg()); } catch (Exception e) { - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + log.error("textSyncScan exception:", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); } } } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index fd6f0c9044..9c6d312000 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/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 imgSyncScanResult = null; + Result textSyncScanResult = null; if(!CollectionUtils.isEmpty(imgScanParamDTO.getTasks())){ log.info("scanContent imgScanParamDTO:{}", JSON.toJSONString(imgScanParamDTO)); @@ -964,22 +964,24 @@ public class ArticleServiceImpl extends BaseServiceImpl