|
|
@ -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<SyncScanResult> imgSyncScan(String url, ImgScanParamDTO param) { |
|
|
|
log.debug("imgSyncScan param:{}", JSON.toJSONString(param)); |
|
|
|
if (StringUtils.isBlank(url) || param == null) { |
|
|
|
throw new RenException("参数错误"); |
|
|
|
} |
|
|
|
try { |
|
|
|
Result<String> 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<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) { |
|
|
|
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 |
|
|
|
*/ |
|
|
|
public static SyncScanResult textSyncScan(String url, TextScanParamDTO param) { |
|
|
|
log.debug("textSyncScan param:", JSON.toJSONString(param)); |
|
|
|
public static Result<SyncScanResult> textSyncScan(String url, TextScanParamDTO param) { |
|
|
|
log.debug("textSyncScan param:{}", JSON.toJSONString(param)); |
|
|
|
if (StringUtils.isBlank(url) || param == null) { |
|
|
|
throw new RenException("参数错误"); |
|
|
|
} |
|
|
|
try { |
|
|
|
Result<String> 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<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) { |
|
|
|
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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|