瀏覽代碼

建行反馈接口增加鉴权

sunhz 3 年之前
父節點
當前提交
e06e7dbe52

+ 5 - 5
ruoyi-common/pom.xml

@@ -144,11 +144,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>fastjson</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>org.bouncycastle</groupId>
             <artifactId>bcprov-jdk16</artifactId>
             <version>1.46</version>
@@ -167,6 +162,11 @@
             <version>2.0.8</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.fasterxml.jackson.datatype</groupId>
+            <artifactId>jackson-datatype-jsr310</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 8 - 2
ruoyi-common/src/main/java/com/ruoyi/common/constant/CcbConstants.java

@@ -3,10 +3,16 @@ package com.ruoyi.common.constant;
 
 public class CcbConstants {
 
-    public static final String IN_URL = "https://in";
+    public static final String IN_URL = "http://124.127.94.35:6066/api/cargo/inCargoResp";
 
-    public static final String OUT_URL = "https://out";
+    public static final String OUT_URL = "http://124.127.94.35:6066/api/cargo/outCargoResp";
 
     public static final String SUCCESS = "Y";
 
+    public static final String APP_ID = "CCB-DH-WR-01-01";
+
+    public static final String SECRET_KEY = "DaoheTest123";
+
+    public static final String PLATFORM_ID = "CCB-DH-WR-01";
+
 }

+ 63 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/JsonUtil.java

@@ -0,0 +1,63 @@
+package com.ruoyi.common.utils;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+public class JsonUtil {
+    private static final Logger log = LoggerFactory.getLogger(JsonUtil.class);
+    private static final ObjectMapper objectMapper = new ObjectMapper();
+
+    public JsonUtil() {
+    }
+
+    public static String toJson(Object obj) {
+        try {
+            return objectMapper.writeValueAsString(obj);
+        } catch (Exception e) {
+            throw new IllegalStateException(e.getMessage());
+        }
+    }
+
+    public static <T> T toModel(String json, TypeReference<T> reference) {
+        try {
+            T obj = objectMapper.readValue(json, reference);
+            return obj;
+        } catch (Exception e) {
+            throw new IllegalStateException(e.getMessage());
+        }
+    }
+
+    public static <T> T toModel(String json, Class<T> type) {
+        try {
+            return objectMapper.readValue(json, type);
+        } catch (Exception e) {
+            throw new IllegalStateException(e.getMessage());
+        }
+    }
+
+    public static <T> List<T> toModel(String jsonStr, Class<?> collectionClass, Class<T> elementClasses) {
+        try {
+            JavaType type = objectMapper.getTypeFactory().constructParametricType(collectionClass, new Class[]{elementClasses});
+            return (List) objectMapper.readValue(jsonStr, type);
+        } catch (Exception var4) {
+            throw new IllegalStateException(var4.getMessage());
+        }
+    }
+
+    static {
+        objectMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
+        objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
+        objectMapper.setSerializationInclusion(Include.NON_EMPTY);
+        objectMapper.setDateFormat(new SimpleDateFormat("yyyy/MM/dd - HH:mm:ss Z"));
+        objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+        objectMapper.registerModule(new JavaTimeModule());
+    }
+}

+ 41 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/ShaUtil.java

@@ -0,0 +1,41 @@
+package com.ruoyi.common.utils;
+
+import java.security.MessageDigest;
+
+public final class ShaUtil {
+
+    public static String sha512(String plaintext) {
+        return sha(plaintext, "SHA-512");
+    }
+
+    public static String sha256(String plaintext) {
+        return sha(plaintext, "SHA-256");
+    }
+
+    private static String sha(String plaintext, String shaAlg) {
+
+        if (plaintext == null || plaintext.length() == 0) {
+            throw new IllegalArgumentException("Plain text must be not empty!!");
+        }
+
+        try {
+            MessageDigest md = MessageDigest.getInstance(shaAlg);
+            md.update(plaintext.getBytes());
+            byte[] bytBuffer = md.digest();
+            StringBuilder sb = new StringBuilder();
+
+            for (byte b : bytBuffer) {
+                String hex = Integer.toHexString(255 & b);
+                if (hex.length() == 1) {
+                    sb.append("0");
+                }
+
+                sb.append(hex);
+            }
+
+            return sb.toString();
+        } catch (Exception e) {
+            throw new IllegalStateException("do sha failed", e);
+        }
+    }
+}

+ 1 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -115,6 +115,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/*/api-docs").anonymous()
                 .antMatchers("/druid/**").anonymous()
                 .antMatchers("/api/**").anonymous()
+                .antMatchers("/ccb/**").anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()

+ 4 - 0
ruoyi-plugin/src/main/java/com/ruoyi/ccb/domain/basic/CargoDetail.java

@@ -1,5 +1,6 @@
 package com.ruoyi.ccb.domain.basic;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.util.Date;
@@ -96,6 +97,7 @@ public class CargoDetail {
     /**
      * 入库日期
      */
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date inStorageDate;
 
     /**
@@ -121,11 +123,13 @@ public class CargoDetail {
     /**
      * 出库日期
      */
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date outStorageDate;
 
     /**
      * 最近操作日期
      */
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date latestOptDate;
 
     /**

+ 3 - 0
ruoyi-plugin/src/main/java/com/ruoyi/ccb/domain/basic/CargoLockInfo.java

@@ -1,5 +1,6 @@
 package com.ruoyi.ccb.domain.basic;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.util.Date;
@@ -66,11 +67,13 @@ public class CargoLockInfo {
     /**
      * 锁定时间
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date lockTime;
 
     /**
      * 解锁时间
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date unlockTime;
 
     /**

+ 2 - 0
ruoyi-plugin/src/main/java/com/ruoyi/ccb/service/impl/CcbHttpServiceImpl.java

@@ -83,7 +83,9 @@ public class CcbHttpServiceImpl implements CcbHttpService {
                 lockInfo.setLockTime(object.getDate("lockTime"));
                 lockInfo.setWrNumber(detail.getWrNumber());
                 lockInfo.setElectronicTags(detail.getElectronicTags());
+                detail.setLockInfo(lockInfo);
             }
+            cargos.add(detail);
         });
 
         VoucherDetailR detailR = new VoucherDetailR();

+ 16 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/ccb/CargoInOutResult.java

@@ -0,0 +1,16 @@
+package com.ruoyi.warehouseBusiness.domain.ccb;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class CargoInOutResult {
+
+    private String result;
+
+    private String reason;
+
+    private List<CargoInfo> cargo;
+
+}

+ 150 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/ccb/CargoInfo.java

@@ -0,0 +1,150 @@
+package com.ruoyi.warehouseBusiness.domain.ccb;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 货物信息
+ *
+ * @author s
+ */
+@Data
+public class CargoInfo {
+
+    /**
+     * 商品类别
+     */
+    private String cargoType;
+
+    /**
+     * 货物编号
+     */
+    private String cargoNo;
+
+    /**
+     * 货物名称
+     */
+    private String cargoName;
+
+    /**
+     * 数量
+     */
+    private Long number;
+
+    /**
+     * 操作剩余数量
+     */
+    private Long numberLeft;
+
+    /**
+     * 数量单位
+     */
+    private String numberUnit;
+
+    /**
+     * 重量
+     */
+    private Double weight;
+
+    /**
+     * 操作剩余重量
+     */
+    private Double weightLeft;
+
+    /**
+     * 重量单位
+     */
+    private String weightUnit;
+
+    /**
+     * 规格
+     */
+    private String speci;
+
+    /**
+     * 库区号
+     */
+    private String shelvesName;
+
+    /**
+     * 仓库号
+     */
+    private String warehouseNo;
+
+    /**
+     * 仓库名称
+     */
+    private String warehouseName;
+
+    /**
+     * 生产厂家
+     */
+    private String proName;
+
+    /**
+     * 保管凭证号
+     */
+    private String takeVoucher;
+
+    /**
+     * 货物权属客户
+     */
+    private String cargoBelong;
+
+    /**
+     * 入库日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date inStorageDate;
+
+    /**
+     * 入库单号
+     */
+    private String inStorageNumber;
+
+    /**
+     * 报税状态
+     */
+    private String bondedStatus;
+
+    /**
+     * 提单号
+     */
+    private String blNumber;
+
+    /**
+     * 出库日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date outStorageDate;
+
+    /**
+     * 最近操作日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date latestOptDate;
+
+    /**
+     * 仓库编号
+     */
+    private String wrNumber;
+
+    /**
+     * 仓储中实际库存数量
+     */
+    private Long remainNumber;
+
+    /**
+     * 仓储中实际库存质量
+     */
+    private Double remainWeight;
+
+    /**
+     * 电子标签
+     */
+    private List<String> electronicTags;
+
+}

+ 18 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/ccb/InCargoRsp.java

@@ -0,0 +1,18 @@
+package com.ruoyi.warehouseBusiness.domain.ccb;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class InCargoRsp {
+
+    private String userName;
+
+    private String uscc;
+
+    private String reqUser;
+
+    private List<CargoInOutResult> cargoInResults;
+
+}

+ 18 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/ccb/OutCargoRsp.java

@@ -0,0 +1,18 @@
+package com.ruoyi.warehouseBusiness.domain.ccb;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class OutCargoRsp {
+
+    private String userName;
+
+    private String uscc;
+
+    private String reqUser;
+
+    private List<CargoInOutResult> cargoOutResults;
+
+}

+ 91 - 53
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -26,10 +26,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.exception.BaseException;
 import com.ruoyi.common.exception.StorageFeeException;
 import com.ruoyi.common.exception.WarehouseException;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.DictUtils;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.*;
 import com.ruoyi.common.utils.ip.AddressUtils;
 import com.ruoyi.common.utils.poi.DrawExcel;
 import com.ruoyi.common.utils.poi.ExcelUtils;
@@ -56,6 +53,10 @@ import com.ruoyi.warehouseBusiness.component.CalculationWarehouseService;
 import com.ruoyi.warehouseBusiness.component.WarehouseBillsfilterService;
 import com.ruoyi.warehouseBusiness.component.impl.QueryWhgenlegServiceImpl;
 import com.ruoyi.warehouseBusiness.domain.*;
+import com.ruoyi.warehouseBusiness.domain.ccb.CargoInfo;
+import com.ruoyi.warehouseBusiness.domain.ccb.CargoInOutResult;
+import com.ruoyi.warehouseBusiness.domain.ccb.InCargoRsp;
+import com.ruoyi.warehouseBusiness.domain.ccb.OutCargoRsp;
 import com.ruoyi.warehouseBusiness.domain.dto.CalculateStorageFeesDTO;
 import com.ruoyi.warehouseBusiness.domain.dto.WarehousebillsDTO;
 import com.ruoyi.warehouseBusiness.domain.enums.FeesTypeEnum;
@@ -81,7 +82,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.http.*;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -615,13 +615,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             map.put("fBilltype", "其他账务");
             if (map.get("fVslid") != null) {
                 TVessel fVslid = tVesselMapper.selectTVesselById(((Integer) map.get("fVslid")).longValue());
-                if (fVslid != null){
+                if (fVslid != null) {
                     map.put("shipsName", fVslid.getfName());
                 }
             }
             if (map.get("fVoyid") != null) {
                 TVoyage voyage = tVoyageMapper.selectTVoyageById(((Integer) map.get("fVoyid")).longValue());
-                if (voyage != null){
+                if (voyage != null) {
                     map.put("voyage", voyage.getfNo());
                 }
             }
@@ -3009,7 +3009,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     }
 
     @Override
-    public AjaxResult ruoYiVersionOrderListNew(TWarehouseBills tWarehouseBills,LoginUser loginUser) {
+    public AjaxResult ruoYiVersionOrderListNew(TWarehouseBills tWarehouseBills, LoginUser loginUser) {
         List<Map<String, Object>> result = tWarehouseBillsMapper.ruoYiVersionOrderList(tWarehouseBills);
         List<ShipperDataVo> list = new ArrayList<>();
         try {
@@ -4219,10 +4219,9 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                     return AjaxResult.error("请求银行反馈异常,未找到客户");
                 }
 
-                JSONObject json = new JSONObject();
-                json.put("userName", corp.getfCname());
-                json.put("uscc", corp.getUscc());
-                json.put("reqUser", corp.getfCname());
+                InCargoRsp rsp = new InCargoRsp();
+                rsp.setUserName(corp.getfCname());
+                rsp.setUscc(corp.getUscc());
 
                 List<Map<String, Object>> stockList = tWhgenlegMapper.selectStockList(tWarehouseBills.getfBillno(), tWarehouseBills.getfCorpid());
                 if (CollectionUtil.isEmpty(stockList)) {
@@ -4230,29 +4229,48 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                     return AjaxResult.error("请求银行反馈异常,未找到库存");
                 }
 
-                JSONArray array = new JSONArray();
-                stockList.forEach(detail -> {
-                    detail.put("numberUnit", "件");
-                    detail.put("weightUnit", "千克");
-                    detail.put("cargoBelong", corp.getfCname());
-                    detail.put("inStorageNumber", detail.get("takeVoucher"));
-                    detail.put("remainNumber", detail.get("numberLeft"));
-                    detail.put("remainWeight", detail.get("weightLeft"));
-                    detail.put("electronicTags", warehousebillsitemsElabelMapper.getLabelByTop(tWarehouseBills.getfId()));
-
-                    JSONObject temp = new JSONObject();
-                    json.put("cargo", temp);
-                    json.put("result", "Y");
-                    array.add(temp);
+                List<CargoInfo> cargos = new ArrayList<>();
+                stockList.forEach(stockMap -> {
+                    String temp = JSON.toJSONString(stockMap);
+
+                    CargoInfo detail = JSON.parseObject(temp, CargoInfo.class);
+                    detail.setNumberUnit("件");
+                    detail.setWeightUnit("千克");
+                    detail.setCargoBelong(corp.getfCname());
+                    detail.setInStorageNumber(detail.getTakeVoucher());
+                    detail.setRemainNumber(detail.getNumberLeft());
+                    detail.setRemainWeight(detail.getWeightLeft());
+                    detail.setElectronicTags(warehousebillsitemsElabelMapper.getLabelByTop(tWarehouseBills.getfId()));
+
+                    cargos.add(detail);
                 });
 
-                json.put("cargoInResults", array);
+                String requestTime = DateUtils.dateTimeNow() + (Math.random() * 9 + 1) * 100000;
+                // 签名内容
+                String str = "appId=" + CcbConstants.APP_ID + "&"
+                        + "secretKey=" + CcbConstants.SECRET_KEY + "&"
+                        + "platformId=" + CcbConstants.PLATFORM_ID + "&"
+                        + "requestTime=" + requestTime + "&"
+                        + "body=" + JsonUtil.toJson(rsp);
+
+                CargoInOutResult inOutResult = new CargoInOutResult();
+                inOutResult.setResult("Y");
+                inOutResult.setCargo(cargos);
+
+                List<CargoInOutResult> inOutResults = new ArrayList<>();
+                inOutResults.add(inOutResult);
+                rsp.setCargoInResults(inOutResults);
 
                 OkHttpClient okHttpClient = new OkHttpClient();
                 Request request = new Request.Builder()
                         .addHeader("content-type", "application/json")
+                        .addHeader("X-RC-AppId", CcbConstants.APP_ID)
+                        .addHeader("X-RC-Sign", ShaUtil.sha256(str))
+                        .addHeader("X-RC-SignType", "SHA256")
+                        .addHeader("X-RC-RequestTime", "application/json")
+                        .addHeader("X-RC-RLF-Uid", CcbConstants.PLATFORM_ID)
                         .url(CcbConstants.IN_URL)
-                        .post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json.toString()))
+                        .post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
                         .build();
 
                 String s;
@@ -4263,6 +4281,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                     return AjaxResult.error("请求银行反馈异常," + e.getMessage());
                 }
 
+                System.out.println("建行返回结果:" + s);
                 JSONObject result = JSON.parseObject(s);
                 if (!CcbConstants.SUCCESS.equals(result.getString("result"))) {
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -4544,40 +4563,58 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                         return AjaxResult.error("请求银行反馈异常,未找到客户");
                     }
 
-                    JSONObject json = new JSONObject();
-                    json.put("userName", corp.getfCname());
-                    json.put("uscc", corp.getUscc());
-                    json.put("reqUser", corp.getfCname());
+                    OutCargoRsp rsp = new OutCargoRsp();
+                    rsp.setUserName(corp.getfCname());
+                    rsp.setUscc(corp.getUscc());
 
-                    List<Map<String, Object>> stockList = tWhgenlegMapper.selectStockList(tWhgenle.getfOriginalbillno(), tWhgenle.getfCorpid());
+                    List<Map<String, Object>> stockList = tWhgenlegMapper.selectStockList(tWarehouseBills.getfBillno(), tWarehouseBills.getfCorpid());
                     if (CollectionUtil.isEmpty(stockList)) {
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                         return AjaxResult.error("请求银行反馈异常,未找到库存");
                     }
 
-                    JSONArray array = new JSONArray();
-                    stockList.forEach(detail -> {
-                        detail.put("numberUnit", "件");
-                        detail.put("weightUnit", "千克");
-                        detail.put("cargoBelong", corp.getfCname());
-                        detail.put("inStorageNumber", detail.get("takeVoucher"));
-                        detail.put("remainNumber", detail.get("numberLeft"));
-                        detail.put("remainWeight", detail.get("weightLeft"));
-                        detail.put("electronicTags", warehousebillsitemsElabelMapper.getLabelByPid(wbItem.getfId()));
-
-                        JSONObject temp = new JSONObject();
-                        json.put("cargo", temp);
-                        json.put("result", "Y");
-                        array.add(temp);
+                    List<CargoInfo> cargos = new ArrayList<>();
+                    stockList.forEach(stockMap -> {
+                        String temp = JSON.toJSONString(stockMap);
+
+                        CargoInfo detail = JSON.parseObject(temp, CargoInfo.class);
+                        detail.setNumberUnit("件");
+                        detail.setWeightUnit("千克");
+                        detail.setCargoBelong(corp.getfCname());
+                        detail.setInStorageNumber(detail.getTakeVoucher());
+                        detail.setRemainNumber(detail.getNumberLeft());
+                        detail.setRemainWeight(detail.getWeightLeft());
+                        detail.setElectronicTags(warehousebillsitemsElabelMapper.getLabelByTop(tWarehouseBills.getfId()));
+
+                        cargos.add(detail);
                     });
 
-                    json.put("cargoInResults", array);
+                    String requestTime = DateUtils.dateTimeNow() + (Math.random() * 9 + 1) * 100000;
+                    // 签名内容
+                    String str = "appId=" + CcbConstants.APP_ID + "&"
+                            + "secretKey=" + CcbConstants.SECRET_KEY + "&"
+                            + "platformId=" + CcbConstants.PLATFORM_ID + "&"
+                            + "requestTime=" + requestTime + "&"
+                            + "body=" + JsonUtil.toJson(rsp);
+
+                    CargoInOutResult inOutResult = new CargoInOutResult();
+                    inOutResult.setResult("Y");
+                    inOutResult.setCargo(cargos);
+
+                    List<CargoInOutResult> inOutResults = new ArrayList<>();
+                    inOutResults.add(inOutResult);
+                    rsp.setCargoOutResults(inOutResults);
 
                     OkHttpClient okHttpClient = new OkHttpClient();
                     Request request = new Request.Builder()
                             .addHeader("content-type", "application/json")
+                            .addHeader("X-RC-AppId", CcbConstants.APP_ID)
+                            .addHeader("X-RC-Sign", ShaUtil.sha256(str))
+                            .addHeader("X-RC-SignType", "SHA256")
+                            .addHeader("X-RC-RequestTime", "application/json")
+                            .addHeader("X-RC-RLF-Uid", CcbConstants.PLATFORM_ID)
                             .url(CcbConstants.OUT_URL)
-                            .post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json.toString()))
+                            .post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), JsonUtil.toJson(rsp)))
                             .build();
 
                     String s;
@@ -9424,12 +9461,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
      * @return
      */
     @Override
-    public AjaxResult receipt(TWarehouseBills tWarehouseBills,LoginUser loginUser) {
+    public AjaxResult receipt(TWarehouseBills tWarehouseBills, LoginUser loginUser) {
         List<JoabBoxVo> receipt = tWarehousebillsCntritemsMapper.receipt(tWarehouseBills.getOrderList());
         if (CollectionUtils.isEmpty(receipt)) {
             throw new SecurityException("未找到设备交接单信息");
-        }else {
-            receipt.stream().forEach(item ->{
+        } else {
+            receipt.stream().forEach(item -> {
                 item.setContPerson(loginUser.getUsername());//押箱操作人姓名
                 item.setPrintPerson(loginUser.getUsername());//打印操作员姓名
             });
@@ -9457,7 +9494,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             throw new WarehouseException(responseVo.getMessage().get("msg"));
         }
         //修改订单信息
-        tWarehouseBills.getOrderList().stream().forEach(item ->{
+        tWarehouseBills.getOrderList().stream().forEach(item -> {
             //修改订单信息
             TWarehouseBills bills = new TWarehouseBills();
             bills.setfId(item);
@@ -9540,6 +9577,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         }
         return buff;
     }
+
     //测试设备单新增 接口
     public static void main(String[] args) {
         List<JoabBoxVo> list = new ArrayList<>();

+ 21 - 16
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/WarehouseBillsCcbServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.warehouseBusiness.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.github.pagehelper.PageHelper;
 import com.ruoyi.basicData.domain.TCorps;
@@ -64,6 +65,11 @@ public class WarehouseBillsCcbServiceImpl implements IWarehouseBillsCcbService {
                 return AjaxResult.error("客户不存在!");
             }
 
+            TGoods goods = goodsMapper.getGoodsByNo(item.getCargoNo());
+            if (ObjectUtil.isNull(goods)) {
+                return AjaxResult.error("商品不存在!");
+            }
+
             // 初始化数据
             Date bsDate = new Date();
             String billNo = serialServiceImpl.getBillNo(billType, bsDate);
@@ -86,7 +92,7 @@ public class WarehouseBillsCcbServiceImpl implements IWarehouseBillsCcbService {
                 bill.setfTrademodeid(1L);
             }
 
-            bill.setfGoodsid(item.getfGoodsid());
+            bill.setfGoodsid(goods.getfId());
             bill.setfPlanqty(item.getfPlanqty());
             bill.setfPlangrossweight(item.getfPlangrossweight());
             bill.setfPlannetweight(item.getfPlannetweight());
@@ -134,11 +140,6 @@ public class WarehouseBillsCcbServiceImpl implements IWarehouseBillsCcbService {
             billId = bill.getfId();
 
             // 从表数据处理
-            TGoods goods = goodsMapper.getGoodsByNo(item.getCargoNo());
-            if (ObjectUtil.isNull(goods)) {
-                return AjaxResult.error("商品不存在!");
-            }
-
             item.setfGoodsid(goods.getfId());
             item.setfPid(billId);
             item.setfBillno(billNo);
@@ -170,20 +171,24 @@ public class WarehouseBillsCcbServiceImpl implements IWarehouseBillsCcbService {
                 }
                 item.setfSrcid(stock.getfId());
                 item.setfSrcBsdate(stock.getfBsdate());
+                item.setfChargedate(stock.getfChargedate());
             }
             billItemMapper.insertTWarehousebillsitems(item);
 
             if ("SJCK".equals(billType)) {
-                item.getElectronicTags().forEach(tag -> {
-                    TWarehousebillsitemsElabel eLabel = new TWarehousebillsitemsElabel();
-                    eLabel.setfGPid(billId);
-                    eLabel.setfPid(item.getfId());
-                    eLabel.setfContent(tag);
-                    eLabel.setfType(2);
-                    eLabel.setCreateBy("CCB");
-                    eLabel.setCreateTime(bsDate);
-                    eLabelMapper.insert(eLabel);
-                });
+                List<String> tags = item.getElectronicTags();
+                if (CollectionUtil.isNotEmpty(tags)) {
+                    tags.forEach(tag -> {
+                        TWarehousebillsitemsElabel eLabel = new TWarehousebillsitemsElabel();
+                        eLabel.setfGPid(billId);
+                        eLabel.setfPid(item.getfId());
+                        eLabel.setfContent(tag);
+                        eLabel.setfType(2);
+                        eLabel.setCreateBy("CCB");
+                        eLabel.setCreateTime(bsDate);
+                        eLabelMapper.insert(eLabel);
+                    });
+                }
             }
         }
         return AjaxResult.success();

+ 3 - 1
ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml

@@ -20,12 +20,14 @@
         <result property="fWarehouseid" column="f_warehouseid"/>
         <result property="fPregrossweight" column="f_pregrossweight"/>
         <result property="fPrenetweight" column="f_prenetweight"/>
+        <result property="fBsdate" column="f_bsdate"/>
         <result property="fQtyd" column="f_qtyD"/>
         <result property="fVolumnd" column="f_volumnD"/>
         <result property="fBillingway" column="f_billingway"/>
         <result property="fGrossweightd" column="f_grossweightD"/>
         <result property="fNetweightd" column="f_netweightD"/>
         <result property="fVolumnc" column="f_volumnC"/>
+        <result property="fVolumnblc" column="f_volumnblc"/>
         <result property="fQtyc" column="f_qtyC"/>
         <result property="fGrossweightc" column="f_grossweightC"/>
         <result property="fQtyblc" column="f_qtyblc"/>
@@ -1413,7 +1415,7 @@
             left join sys_dict_data t3 on t3.dict_value = t2.f_typeid
             left join t_warehouse t4 on t4.f_id = t1.f_warehouse_locationid
             left join t_warehouse t5 on t5.f_id = t1.f_warehouseid
-            left join t_warehousebillsitems t6 on t6.f_billno = f_originalbillno
+            left join t_warehousebillsitems t6 on t6.f_billno = t1.f_originalbillno
         <where>
             t3.status = '0'
             and t3.dict_type = 'data_goods_category'