Przeglądaj źródła

算发日志bug修复

linfutong 2 lat temu
rodzic
commit
48fa4c5d89

+ 10 - 11
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/CheckService.java

@@ -111,6 +111,12 @@ public class CheckService {
             if (StringUtils.isNull(labCheckInObj)) {
                 return R.fail(700, "未配置检查项");
             }
+            //上传原始图片
+            String orgImgUrl = "";
+            R<SysFile> r = remoteFileService.upload(file);
+            if (r.getCode() == 200) {
+                orgImgUrl = r.getData().getUrl();
+            }
             String labSkipped = "0";
             String labCheckCount = "2";
             Object labSkippedObj = map.get("skipped");
@@ -130,7 +136,7 @@ public class CheckService {
                 MultiValueMap<String, Object> params = getStringObjectMultiValueMap(checkValid, String.valueOf(id));
                 HttpEntity<MultiValueMap<String, Object>> files = getHttpEntityMap(toFile, params);
                 //添加一条算法请求记录
-                R<Long> alg = insertRequestRecordLog(file, subId, checkValid);
+                R<Long> alg = insertRequestRecordLog(orgImgUrl, subId, checkValid);
                 logger.info("==============>>>算法数据添加结果,alg="+ JSONObject.toJSONString(alg));
                 ImgPostResponse<AnalysisReturnData> send = HttpUtils.sendV5(restTemplateLocal, files, algorithmYml);
                 //算法记录更新
@@ -195,21 +201,14 @@ public class CheckService {
 
     /**
      * 添加日志记录
-     * @param file
+     * @param fileUrl
      * @param subId
      * @param checkValid
      * @return
      */
-    private R<Long> insertRequestRecordLog(MultipartFile file, Long subId, AlgorithmYml.CheckValid checkValid) {
+    private R<Long> insertRequestRecordLog(String fileUrl, Long subId, AlgorithmYml.CheckValid checkValid) {
         Algorithm algorithm = new Algorithm();
-        String img = "";
-        try {
-            R<SysFile> originalFile = remoteFileService.upload(file);
-            img = originalFile.getData().getUrl();
-        } catch (Exception e) {
-            logger.error("【算法服务】添加日志记录异常",e);
-        }
-        algorithm.setOriginalImg(img);
+        algorithm.setOriginalImg(fileUrl);
         algorithm.setSubId(subId);
         algorithm.setAlgorithmType("image");
         algorithm.setAlgorithmName(checkValid.getAlgorithmName());