Эх сурвалжийг харах

业务单据上传程序修改

chenw 7 жил өмнө
parent
commit
cb34832c74

+ 7 - 2
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseEndTask.java

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.transfers.task;
 package com.usoftchina.saas.transfers.task;
 
 
 import com.usoftchina.saas.account.api.CompanyApi;
 import com.usoftchina.saas.account.api.CompanyApi;
+import com.usoftchina.saas.account.dto.CompanyDTO;
 import com.usoftchina.saas.inquiry.po.purchase.PurchaseDetailEnd;
 import com.usoftchina.saas.inquiry.po.purchase.PurchaseDetailEnd;
 import com.usoftchina.saas.purchase.api.PurchaseApi;
 import com.usoftchina.saas.purchase.api.PurchaseApi;
 import com.usoftchina.saas.purchase.dto.PurchaseDetailDTO;
 import com.usoftchina.saas.purchase.dto.PurchaseDetailDTO;
@@ -41,7 +42,7 @@ public class SendPurchaseEndTask extends Executable {
 
 
     @Override
     @Override
     public void execute(MessageInfo messageInfo) throws Exception {
     public void execute(MessageInfo messageInfo) throws Exception {
-        String accessSecretKey = companyApi.getCompanyById(messageInfo.getCompanyId()).getData().getAccessKey();
+        CompanyDTO companyDTO = companyApi.getCompanyById(messageInfo.getCompanyId()).getData();
         PurchaseFormDTO purchaseFormDTO = purchaseApi.getFormData(Long.parseLong(messageInfo.getBizId())).getData();
         PurchaseFormDTO purchaseFormDTO = purchaseApi.getFormData(Long.parseLong(messageInfo.getBizId())).getData();
         short endStatus = 0;
         short endStatus = 0;
         //结案、反结案
         //结案、反结案
@@ -60,10 +61,14 @@ public class SendPurchaseEndTask extends Executable {
                         new BigDecimal(purchaseDetailDTO.getId()).intValue());
                         new BigDecimal(purchaseDetailDTO.getId()).intValue());
                 purchaseDetailEndList.add(purchaseDetailEnd);
                 purchaseDetailEndList.add(purchaseDetailEnd);
             }
             }
+            //添加身份ID
+            String url = b2bConfig.getCommon() + purchaseEndUrl + "?access_id=" + companyDTO.getUu();
             //发送给b2b
             //发送给b2b
-            boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + purchaseEndUrl, JsonUtils.toJsonString(purchaseDetailEndList), accessSecretKey);
+            boolean success = SendUtil.sendToB2B(url, JsonUtils.toJsonString(purchaseDetailEndList), companyDTO.getAccessKey());
             if (success) {
             if (success) {
                 purchaseApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
                 purchaseApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
+            } else {
+                throw new Exception("上传失败");
             }
             }
         }
         }
 
 

+ 9 - 2
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseInResTask.java

@@ -20,6 +20,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -39,7 +40,7 @@ public class SendPurchaseInResTask extends Executable {
     private B2BConfig b2bConfig;
     private B2BConfig b2bConfig;
 
 
     private static final Logger LOGGER = LoggerFactory.getLogger(SendProductTask.class);
     private static final Logger LOGGER = LoggerFactory.getLogger(SendProductTask.class);
-    private final String prodInUrl = "/erp/purchase/prodInOut/nonPosting";
+    private final String prodInResUrl = "/erp/purchase/prodInOut/nonPosting";
 
 
     @Override
     @Override
     public void execute(MessageInfo messageInfo) throws Exception {
     public void execute(MessageInfo messageInfo) throws Exception {
@@ -56,7 +57,13 @@ public class SendPurchaseInResTask extends Executable {
         b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
         b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
         LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
         LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
 
 
-        boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + prodInUrl, JsonUtils.toJsonString(b2bPurchaseProdInOut), companyDTO.getAccessKey());
+        //添加身份ID
+        String url = b2bConfig.getCommon() + prodInResUrl + "?access_id=" + companyDTO.getUu();
+        //将数据改为B2B数据格式
+        List<PurchaseProdInOut> data = new ArrayList<PurchaseProdInOut>();
+        data.add(b2bPurchaseProdInOut);
+
+        boolean success = SendUtil.sendToB2B(url, JsonUtils.toJsonString(data), companyDTO.getAccessKey());
         if (success) {
         if (success) {
             LOGGER.info("采购验收单(反过账)上传成功, id={}", messageInfo.getBizId());
             LOGGER.info("采购验收单(反过账)上传成功, id={}", messageInfo.getBizId());
             prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
             prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");

+ 10 - 1
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseInTask.java

@@ -24,6 +24,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -62,10 +63,18 @@ public class SendPurchaseInTask extends Executable{
         b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
         b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
         LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
         LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
 
 
-        boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + prodInUrl, JsonUtils.toJsonString(b2bPurchaseProdInOut), companyDTO.getAccessKey());
+        //添加身份ID
+        String url = b2bConfig.getCommon() + prodInUrl + "?access_id=" + companyDTO.getUu();
+        //将数据改为B2B数据格式
+        List<PurchaseProdInOut> data = new ArrayList<PurchaseProdInOut>();
+        data.add(b2bPurchaseProdInOut);
+        boolean success = SendUtil.sendToB2B(url, JsonUtils.toJsonString(data), companyDTO.getAccessKey());
         if (success) {
         if (success) {
             LOGGER.info("采购验收单上传成功, id={}", messageInfo.getBizId());
             LOGGER.info("采购验收单上传成功, id={}", messageInfo.getBizId());
             prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
             prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
+        } else {
+            LOGGER.info("采购验收单上传失败, id={}", messageInfo.getBizId());
+            throw new Exception("上传失败");
         }
         }
     }
     }
 
 

+ 9 - 2
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseOutResTask.java

@@ -20,6 +20,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -38,7 +39,7 @@ public class SendPurchaseOutResTask extends Executable {
     private B2BConfig b2bConfig;
     private B2BConfig b2bConfig;
 
 
     private static final Logger LOGGER = LoggerFactory.getLogger(SendProductTask.class);
     private static final Logger LOGGER = LoggerFactory.getLogger(SendProductTask.class);
-    private final String prodOutUrl = "/erp/purchase/prodReturn/nonPosting";
+    private final String prodOutResUrl = "/erp/purchase/prodReturn/nonPosting";
 
 
 
 
     @Override
     @Override
@@ -56,7 +57,13 @@ public class SendPurchaseOutResTask extends Executable {
         b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
         b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
         LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
         LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
 
 
-        boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + prodOutUrl, JsonUtils.toJsonString(b2bPurchaseProdInOut), companyDTO.getAccessKey());
+        //添加身份ID
+        String url = b2bConfig.getCommon() + prodOutResUrl + "?access_id=" + companyDTO.getUu();
+        //将数据改为B2B数据格式
+        List<PurchaseProdInOut> data = new ArrayList<PurchaseProdInOut>();
+        data.add(b2bPurchaseProdInOut);
+
+        boolean success = SendUtil.sendToB2B(url, JsonUtils.toJsonString(data), companyDTO.getAccessKey());
         if (success) {
         if (success) {
             LOGGER.info("采购验退单(反过账)上传成功, id={}", messageInfo.getBizId());
             LOGGER.info("采购验退单(反过账)上传成功, id={}", messageInfo.getBizId());
             prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
             prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");

+ 11 - 1
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseOutTask.java

@@ -20,6 +20,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -57,10 +58,19 @@ public class SendPurchaseOutTask extends Executable{
         b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
         b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
         LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
         LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
 
 
-        boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + prodOutUrl, JsonUtils.toJsonString(b2bPurchaseProdInOut), companyDTO.getAccessKey());
+        //添加身份ID
+        String url = b2bConfig.getCommon() + prodOutUrl + "?access_id=" + companyDTO.getUu();
+        //将数据改为B2B数据格式
+        List<PurchaseProdInOut> data = new ArrayList<PurchaseProdInOut>();
+        data.add(b2bPurchaseProdInOut);
+
+        boolean success = SendUtil.sendToB2B(url, JsonUtils.toJsonString(data), companyDTO.getAccessKey());
         if (success) {
         if (success) {
             LOGGER.info("采购验退单上传成功, id={}", messageInfo.getBizId());
             LOGGER.info("采购验退单上传成功, id={}", messageInfo.getBizId());
             prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
             prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
+        } else {
+            LOGGER.info("采购验退单上传失败, id={}", messageInfo.getBizId());
+            throw new Exception("上传失败");
         }
         }
     }
     }
 
 

+ 1 - 1
applications/transfers/transfers-server/src/main/java/com/usoftchina/saas/transfers/task/SendPurchaseTask.java

@@ -70,7 +70,7 @@ public class SendPurchaseTask extends Executable {
             b2bPurchase.setPurchaseDetails(b2bPurchaseDetailList);
             b2bPurchase.setPurchaseDetails(b2bPurchaseDetailList);
             //添加身份ID
             //添加身份ID
             String url = b2bConfig.getCommon() + purchaseUrl + "?access_id=" + companyDTO.getUu();
             String url = b2bConfig.getCommon() + purchaseUrl + "?access_id=" + companyDTO.getUu();
-            //将数据改为数据格式
+            //将数据改为B2B数据格式
             List<Purchase> data = new ArrayList<Purchase>();
             List<Purchase> data = new ArrayList<Purchase>();
             data.add(b2bPurchase);
             data.add(b2bPurchase);
             boolean success = SendUtil.sendToB2B(url, JsonUtils.toJsonString(data), companyDTO.getAccessKey());
             boolean success = SendUtil.sendToB2B(url, JsonUtils.toJsonString(data), companyDTO.getAccessKey());