From 3631219246be48aec1e745e94e5b28ff4e8799c8 Mon Sep 17 00:00:00 2001
From: CZT <czt18638530771@163.com>
Date: 星期五, 20 十月 2023 19:35:54 +0800
Subject: [PATCH] 调整上海原版接口

---
 igds-api-inte/src/main/java/com/ld/igds/sh/service/ApiShServiceImpl1306.java |   43 +++++++++++++++++++++++++------------------
 1 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/igds-api-inte/src/main/java/com/ld/igds/sh/service/ApiShServiceImpl1306.java b/igds-api-inte/src/main/java/com/ld/igds/sh/service/ApiShServiceImpl1306.java
index 092e910..7e29cdf 100644
--- a/igds-api-inte/src/main/java/com/ld/igds/sh/service/ApiShServiceImpl1306.java
+++ b/igds-api-inte/src/main/java/com/ld/igds/sh/service/ApiShServiceImpl1306.java
@@ -2,7 +2,6 @@
 
 import com.alibaba.fastjson.JSONObject;
 import com.ld.igds.constant.FoodVariety;
-import com.ld.igds.constant.RedisConst;
 import com.ld.igds.inout.InoutConstant;
 import com.ld.igds.log.service.InteStatusLogService;
 import com.ld.igds.models.InoutNoticeOut;
@@ -15,6 +14,7 @@
 import com.ld.igds.sh.param.BaseParam;
 import com.ld.igds.sh.service.impl.HApiShServiceImpl;
 import com.ld.igds.sh.util.ApiShConst;
+import com.ld.igds.sh.util.ApiShUtil;
 import com.ld.igds.sh.util.RespCodeEnum;
 import com.ld.igds.sh.util.RespUtil;
 import com.ld.igds.util.ContextUtil;
@@ -25,7 +25,10 @@
 import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import java.util.*;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 
 /**
  * 绮鍑哄簱淇℃伅鏁版嵁鎺ュ彛
@@ -56,15 +59,18 @@
 
         String companyId = ContextUtil.getDefaultCompanyId();
 
-        String key = RedisConst.buildKey(companyId, ApiShConst.API_SH_1306);
-        Date startTime = (Date) redisUtil.get(key);
-        if(null == startTime){
-            startTime = DateUtils.addDays(param.getEndTime(), -30);
+//        String key = RedisConst.buildKey(companyId, ApiShConst.API_SH_1112);
+//        Date startTime = (Date) redisUtil.get(key);
+//        if(null == startTime){
+//            startTime = DateUtils.addDays(param.getEndTime(), -30);
+//        }
+//        redisUtil.set(key, param.getEndTime());
+        if(null == param.getStartTime()){
+            param.setStartTime(DateUtils.addDays(param.getEndTime(), -1));
         }
-        redisUtil.set(key, param.getEndTime());
 
         //鏌ヨ鏁版嵁
-        List<InoutRecord> inoutRecords = hApiShServiceImpl.listInoutRecord(companyId, param.getDepotId(), startTime, param.getEndTime(), InoutConstant.TYPE_OUT);
+        List<InoutRecord> inoutRecords = hApiShServiceImpl.listInoutRecord(companyId, param.getDepotId(), param.getStartTime(), param.getEndTime(), InoutConstant.TYPE_OUT);
 
         //鍝嶅簲鏁版嵁涓虹┖鍒欑洿鎺ヨ繑鍥炲搷搴旂爜2000
         if (inoutRecords == null || inoutRecords.isEmpty()) {
@@ -81,7 +87,7 @@
         for (InoutRecord inoutRecord : inoutRecords) {
             dto = new Dto1306();
             dto.setYwdh("14" + inoutRecord.getId().substring(4, 14));
-            dto.setHwbm(inoutRecord.getDepotId());
+            dto.setHwbm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()) + "01");
             dto.setCktzdh(inoutRecord.getNoticeId());
             dto.setYwlx("1");
             dto.setYwrq(DateFormatUtils.format(inoutRecord.getCompleteTime(),"yyyy-MM-dd HH:mm:ss"));
@@ -113,10 +119,11 @@
             dto.setDjmgryxm(StringUtils.isEmpty(inoutRecord.getFoodVariety())?"0":inoutRecord.getRegisterUser());
             dto.setCmqrmgryxm(StringUtils.isEmpty(inoutRecord.getCompleteUser())?"0":inoutRecord.getCompleteUser());
             dto.setNm(inoutRecord.getId());
-            dto.setZznm(inoutRecord.getDepotId().substring(0, 21));
+            dto.setZznm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()).substring(0, 21));
             dto.setDjbh(inoutRecord.getId());
             dto.setSxh(inoutRecord.getId().substring(10));
-            if(InoutConstant.RECORD_STATUS_DEL.equals(inoutRecord.getRecordStatus()) ){
+            if(InoutConstant.RECORD_STATUS_DEL.equals(inoutRecord.getRecordStatus()) ||
+                    "ERROR".equals(inoutRecord.getRecordStatus())){
                 dto.setDjzt("4"); //宸蹭綔搴�
             }else {
                 dto.setDjzt("2"); //鍑哄簱瀹屾垚
@@ -136,7 +143,7 @@
             dto.setLrfs("0");
             dto.setTzdbh(StringUtils.isEmpty(inoutRecord.getNoticeId())?"0":inoutRecord.getNoticeId());
             dto.setTzdnm(StringUtils.isEmpty(inoutRecord.getNoticeId())?"0":inoutRecord.getNoticeId());
-            dto.setWlmc(StringUtils.isEmpty(inoutRecord.getFoodVariety())?"0":FoodVariety.getMsg(inoutRecord.getFoodVariety()));
+            dto.setWlmc(StringUtils.isEmpty(inoutRecord.getFoodVariety())?"0": FoodVariety.getMsg(inoutRecord.getFoodVariety()));
             dto.setWlnm(StringUtils.isEmpty(inoutRecord.getFoodVariety())?"0":inoutRecord.getFoodVariety());
             dto.setWlbh(StringUtils.isEmpty(inoutRecord.getFoodVariety())?"0":inoutRecord.getFoodVariety());
             dto.setDz(StringUtils.isEmpty(inoutRecord.getUserAddress())?"0":inoutRecord.getUserAddress());
@@ -150,12 +157,12 @@
             dto.setJzqj(DateFormatUtils.format(inoutRecord.getCompleteTime(),"yyyy-MM-dd HH:mm:ss"));
             dto.setNx(StringUtils.isEmpty(inoutRecord.getFoodYear())?"0":inoutRecord.getFoodYear());
             dto.setKcxznm(StringUtils.isEmpty(inoutRecord.getFoodType())?"0":inoutRecord.getFoodType());
-            dto.setApclcf(inoutRecord.getDepotId());
-            dto.setApclhw(inoutRecord.getDepotId());
-            dto.setSjclcf(inoutRecord.getDepotId());
-            dto.setSjclcfnm(inoutRecord.getDepotId());
-            dto.setSjclhw(inoutRecord.getDepotId());
-            dto.setSjclhwnm(inoutRecord.getDepotId());
+            dto.setApclcf(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()));
+            dto.setApclhw(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()));
+            dto.setSjclcf(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()));
+            dto.setSjclcfnm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()));
+            dto.setSjclhw(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()));
+            dto.setSjclhwnm(ApiShUtil.getGbDepotId(inoutRecord.getDepotId()));
             dto.setBgy(StringUtils.isEmpty(inoutRecord.getHandleUser())?"0":inoutRecord.getHandleUser());
             dto.setQtkl(inoutRecord.getDeOther() + "");
             dto.setLhnd(StringUtils.isEmpty(inoutRecord.getFoodYear())?"0":inoutRecord.getFoodYear());

--
Gitblit v1.9.3