From 12c99c99ed89d1d11318d9b4c6c295d35e21b1e7 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期三, 20 八月 2025 18:30:00 +0800
Subject: [PATCH] 调整船运质检单号

---
 src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1109.java |  190 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 135 insertions(+), 55 deletions(-)

diff --git a/src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1109.java b/src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1109.java
index 98f35f9..d6d0ff8 100644
--- a/src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1109.java
+++ b/src/main/java/com/fzzy/async/fzzy40/impl/Fzzy40Sync1109.java
@@ -17,9 +17,12 @@
 import com.fzzy.async.fzzy40.repository.Fzzy40Sync1202Rep;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateFormatUtils;
+import org.apache.commons.lang.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.text.ParseException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -48,7 +51,7 @@
     private final static String BIZ_TAG_WEIGHT_FULL = "WEIGHT_FULL";
     private final static String BIZ_TAG_WEIGHT_EMPTY = "WEIGHT_EMPTY";
     private final static String BIZ_TAG_REGISTER = "REGISTER";
-    private final static String BIZ_TAG_HANDLE = "HANDLE";
+    private final static String BIZ_TAG_CARD_BACK = "CARD_BACK";
     /**
      * 鍑哄叆搴撶被鍨�
      */
@@ -112,6 +115,9 @@
                 if (inoutData.getRecordStatus().equals("DEL") || inoutData.getRecordStatus().equals("ERROR")) {
                     continue;
                 }
+                if (!inoutData.getProgress().equals("RECORD")){
+                    continue;
+                }
                 ids = new ArrayList<>();
                 wjlx = "";
                 //鑾峰彇鍑哄叆搴撲笟鍔″崟鍙蜂俊鎭�
@@ -145,12 +151,45 @@
                 }
                 int num = 1;
                 int idsNum = 0;
+                String bizTag = null;
                 for (Fz40FileInfo sysData : fileList) {
-                    //鍙悓姝ョО閲�
+                    apiData = new Api1109();
+
+                    //涓婚敭id
+                    apiData.setId(sysData.getFileId());
+                    //鏂囦欢璺緞
+                    apiData.setWjdz(fileUtil.getInoutFilePath(sysData.getCreateTime()) + sysData.getFileName());
+                    //鐧昏
+                    if (BIZ_TAG_REGISTER.equals(sysData.getBizTag()) || BIZ_TAG_CARD_BACK.equals(sysData.getBizTag())) {
+                        str = ids.get(0);
+                        wjmc = kqdm + "_" + str;
+                        //鏂囦欢鍚嶇О
+                        wjmc = getImgNameType(wjmc, sysData.getBizTag(), str, sysData.getFileName(), map);
+                        apiData.setWjmc(wjmc);
+                        //鏂囦欢绫诲瀷
+                        apiData.setWjlx(wjlx);
+                    }
+                    //绉伴噸
                     if (BIZ_TAG_WEIGHT_FULL.equals(sysData.getBizTag()) || BIZ_TAG_WEIGHT_EMPTY.equals(sysData.getBizTag())) {
-                        if(num > 6){
-                            num = 1;
-                            idsNum ++;
+                        bizTag = sysData.getBizTag();
+                        if(StringUtils.isNotEmpty(inoutData.getTransType()) && inoutData.getTransType().equals("3")){
+                            if(num > 6){
+                                num = 1;
+                                idsNum ++;
+                            }
+                        }else {
+                            if(num > 8){
+                                num = 1;
+                                idsNum ++;
+                            }
+                        }
+                        //2024-05-23 姝ゅ鏆傛椂璁剧疆鍚嶇О闀垮害闄愬埗锛屽悗鏈熻皟鏁村悗鍙垹闄�
+                        if(sysData.getCreateTime().after(DateUtils.parseDate("2024-04-18",new String[]{"yyyy-MM-dd"}))){
+                            if(StringUtils.isNotEmpty(inoutData.getTransType()) && inoutData.getTransType().equals("3")){
+                                bizTag = sysData.getBizTag();
+                            }else {
+                                bizTag = null;
+                            }
                         }
                         if(idsNum == ids.size()){
                             break;
@@ -159,39 +198,37 @@
 
                         wjmc = kqdm + "_" + str;
 
-                        apiData = new Api1109();
-
-                        //涓婚敭id
-                        apiData.setId(UUID.randomUUID().toString());
-                        //鏂囦欢璺緞
-                        apiData.setWjdz(fileUtil.getInoutFilePath(sysData.getCreateTime()) + sysData.getFileName());
-
                         //鏂囦欢鍚嶇О
-                        wjmc = getImgNameType(wjmc, sysData.getBizTag(), str, sysData.getFileName(), map);
+                        wjmc = getImgNameType(wjmc, bizTag, str, sysData.getFileName(), map);
                         apiData.setWjmc(wjmc);
-                        //鏂囦欢绫诲瀷
                         apiData.setWjlx(wjlx);
-
-                        //鎿嶄綔鏍囧織鍙婃渶鍚庢洿鏂版椂闂�
-                        apiData.setZhgxsj(new Date());
-
-                        //涓氬姟id銆佸簱鍖虹紪鐮併�佸悓姝ユ椂闂�
-                        apiData.setBizId(sysData.getFileId());
-                        apiData.setKqdm(kqdm);
-                        apiData.setSyncTime(new Date());
-
-                        api1109List = api1109Rep.getDataByBizId(apiData.getBizId());
-                        if (null == api1109List || api1109List.isEmpty()) {
-                            apiData.setCzbz(Constant.CZBZ_I);
-                        } else {
-                            apiData.setCzbz(api1109List.get(0).getCzbz());
+                        if (wjmc.indexOf(Constant.IMG_NAME_TYPE_IVG) >= 0 || wjmc.indexOf(Constant.IMG_NAME_TYPE_IVT) >= 0) {
+                            apiData.setWjlx(IMG_TYPE_4);
                         }
-
-                        //淇濆瓨鏁版嵁
-                        api1109Rep.save(apiData);
+                        if (wjmc.indexOf(Constant.IMG_NAME_TYPE_OVG) >= 0 || wjmc.indexOf(Constant.IMG_NAME_TYPE_OVT) >= 0) {
+                            apiData.setWjlx(IMG_TYPE_5);
+                        }
                         num ++;
-                        log.info("1109---鍚屾鏁版嵁锛歿}", apiData.toString());
                     }
+
+                    //鎿嶄綔鏍囧織鍙婃渶鍚庢洿鏂版椂闂�
+                    apiData.setZhgxsj(new Date());
+
+                    //涓氬姟id銆佸簱鍖虹紪鐮併�佸悓姝ユ椂闂�
+                    apiData.setBizId(sysData.getFileId());
+                    apiData.setKqdm(kqdm);
+                    apiData.setSyncTime(new Date());
+
+                    api1109List = api1109Rep.getDataByBizId(apiData.getBizId());
+                    if (null == api1109List || api1109List.isEmpty()) {
+                        apiData.setCzbz(Constant.CZBZ_I);
+                    } else {
+                        apiData.setCzbz(api1109List.get(0).getCzbz());
+                    }
+
+                    //淇濆瓨鏁版嵁
+                    api1109Rep.save(apiData);
+                    log.info("1109---鍚屾鏁版嵁锛歿}", apiData.toString());
                 }
             }
         } catch (Exception e) {
@@ -212,30 +249,54 @@
      * @return
      */
     private String getImgNameType(String wjmc, String bizTag, String bizId, String fileName, Map<String, Integer> map) {
-        if (fileName.indexOf(Constant.IMG_NAME_TYPE_GL) >= 0) {
-            return wjmc + "_" + Constant.IMG_NAME_TYPE_GL + ".jpg";
+        if(null == bizTag){
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_DJ) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_DJ + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_RK) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_RK + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_CK) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_CK + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_GL) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_GL + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_GR) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_GR + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_GT) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_GT + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_TL) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_TL + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_TR) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_TR + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_TT) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_TT + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_SL) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_SL + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_SF) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_SF + ".jpg";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_IVG) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_IVG + ".mp4";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_IVT) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_IVT + ".mp4";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_OVG) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_OVG + ".mp4";
+            }
+            if (fileName.indexOf(Constant.IMG_NAME_TYPE_OVT) >= 0) {
+                return wjmc + "_" + Constant.IMG_NAME_TYPE_OVT + ".mp4";
+            }
         }
-        if (fileName.indexOf(Constant.IMG_NAME_TYPE_GR) >= 0) {
-            return wjmc + "_" + Constant.IMG_NAME_TYPE_GR + ".jpg";
-        }
-        if (fileName.indexOf(Constant.IMG_NAME_TYPE_GT) >= 0) {
-            return wjmc + "_" + Constant.IMG_NAME_TYPE_GT + ".jpg";
-        }
-        if (fileName.indexOf(Constant.IMG_NAME_TYPE_TL) >= 0) {
-            return wjmc + "_" + Constant.IMG_NAME_TYPE_TL + ".jpg";
-        }
-        if (fileName.indexOf(Constant.IMG_NAME_TYPE_TR) >= 0) {
-            return wjmc + "_" + Constant.IMG_NAME_TYPE_TR + ".jpg";
-        }
-        if (fileName.indexOf(Constant.IMG_NAME_TYPE_TT) >= 0) {
-            return wjmc + "_" + Constant.IMG_NAME_TYPE_TT + ".jpg";
-        }
-        if (fileName.indexOf(Constant.IMG_NAME_TYPE_SL) >= 0) {
-            return wjmc + "_" + Constant.IMG_NAME_TYPE_SL + ".jpg";
-        }
-        if (fileName.indexOf(Constant.IMG_NAME_TYPE_SF) >= 0) {
-            return wjmc + "_" + Constant.IMG_NAME_TYPE_SF + ".jpg";
-        }
+
         Integer num = 0;
         //姣涢噸
         if (BIZ_TAG_WEIGHT_FULL.equals(bizTag)) {
@@ -275,6 +336,25 @@
                 map.remove(bizId + "_" + bizTag);
             }
         }
+        //鍏ュ簱鐧昏
+        if (BIZ_TAG_REGISTER.equals(bizTag)) {
+            if (null == map.get(bizId + "_" + bizTag)) {
+                map.put(bizId + "_" + bizTag, 1);
+            }
+            num = map.get(bizId + "_" + bizTag);
+            if (num == 1) {
+                wjmc += "_" + Constant.IMG_NAME_TYPE_DJ;
+                map.put(bizId + "_" + bizTag, 2);
+            }
+            if (num == 2) {
+                wjmc += "_" + Constant.IMG_NAME_TYPE_RK;
+                map.remove(bizId + "_" + bizTag);
+            }
+        }
+        //鍑哄簱鐓х墖
+        if (BIZ_TAG_CARD_BACK.equals(bizTag)) {
+            wjmc += "_" + Constant.IMG_NAME_TYPE_CK;
+        }
         return wjmc + ".jpg";
     }
 }

--
Gitblit v1.9.3