| 
					
				 | 
			
			
				@@ -1,6 +1,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.ruoyi.warehouseBusiness.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hutool.core.bean.BeanUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.hutool.core.collection.CollectionUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hutool.core.util.ObjectUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -15,6 +16,7 @@ import com.ruoyi.basicData.domain.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.basicData.mapper.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.basicData.service.impl.TWarehouseServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.config.RuoYiConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ruoyi.common.constant.CcbConstants; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.core.domain.AjaxResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.core.domain.entity.SysDept; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.core.domain.entity.SysDictData; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -67,6 +69,9 @@ import com.ruoyi.warehouseBusiness.excel.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.warehouseBusiness.mapper.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.AllArgsConstructor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import okhttp3.OkHttpClient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import okhttp3.Request; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import okhttp3.RequestBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.poi.hssf.usermodel.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.poi.ss.usermodel.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.poi.ss.util.CellRangeAddress; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4192,6 +4197,70 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         map.put("fDateChanged", tWarehouseBills.getfDateChanged()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         map.put("warehousebills", tWarehouseBills); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         map.put("warehousebillsitems", warehousebillsitemsList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 处理银行反馈 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (WarehouseTypeEnum.SJRK.getType().equals(billsType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SysConfig feedbackConfig = sysConfigMapper.checkConfigKeyUnique("bank.feedback"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ObjectUtil.isNotNull(feedbackConfig) && "0".equals(feedbackConfig.getConfigValue())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 出入库不同处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                TCorps corp = tCorpsMapper.selectTCorpsById(tWarehouseBills.getfCorpid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (ObjectUtil.isNull(corp)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return AjaxResult.error("请求银行反馈异常,未找到客户"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                json.put("userName", corp.getfCname()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                json.put("uscc", corp.getUscc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                json.put("reqUser", corp.getfCname()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                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.getLabelByTop(tWarehouseBills.getfId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    JSONObject temp = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    json.put("cargo", temp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    json.put("result", "Y"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    array.add(temp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                json.put("cargoInResults", array); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                OkHttpClient okHttpClient = new OkHttpClient(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Request request = new Request.Builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .addHeader("content-type", "application/json") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .url(CcbConstants.IN_URL) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json.toString())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .build(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String s; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    s = Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } catch (IOException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return AjaxResult.error("请求银行反馈异常," + e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                JSONObject result = JSON.parseObject(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!CcbConstants.SUCCESS.equals(result.getString("result"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return AjaxResult.error("请求银行反馈失败," + result.getString("reason")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return AjaxResult.success("成功", map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4450,6 +4519,69 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return AjaxResult.error("库存明细更新失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 处理银行反馈 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (WarehouseTypeEnum.SJCK.getType().equals(billsType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                SysConfig feedbackConfig = sysConfigMapper.checkConfigKeyUnique("bank.feedback"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (ObjectUtil.isNotNull(feedbackConfig) && "0".equals(feedbackConfig.getConfigValue())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 出入库不同处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TCorps corp = tCorpsMapper.selectTCorpsById(tWhgenle.getfCorpid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (ObjectUtil.isNull(corp)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return AjaxResult.error("请求银行反馈异常,未找到客户"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    json.put("userName", corp.getfCname()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    json.put("uscc", corp.getUscc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    json.put("reqUser", corp.getfCname()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    List<Map<String, Object>> stockList = tWhgenlegMapper.selectStockList(tWhgenle.getfOriginalbillno(), tWhgenle.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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    json.put("cargoInResults", array); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    OkHttpClient okHttpClient = new OkHttpClient(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Request request = new Request.Builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            .addHeader("content-type", "application/json") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            .url(CcbConstants.OUT_URL) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            .post(RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json.toString())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            .build(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String s; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        s = Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } catch (IOException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return AjaxResult.error("请求银行反馈异常," + e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    JSONObject result = JSON.parseObject(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!CcbConstants.SUCCESS.equals(result.getString("result"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return AjaxResult.error("请求银行反馈失败," + result.getString("reason")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //  箱型数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (StringUtils.isNotNull(tCntr) && !"[]".equals(tCntr)) { 
			 |