luobang 1 rok pred
rodič
commit
c93b3b049c

+ 27 - 7
src/main/java/com/steerinfo/dil/service/impl/AmsSaleOrderServiceImpl.java

@@ -278,11 +278,21 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
         }catch (Exception e){
             e.printStackTrace();
         }
-        String status = (String) s.get("status");
-        if ("-1".equals(status)) {
-            throw new Exception(amsSaleOrder.getSaleNumber() + "上传金蝶失败!");
+        if (s == null || s.size() == 0) {
+            throw new Exception(amsSaleOrder.getSaleNumber() + "登录金蝶失败!");
+        }else {
+            try {
+                JSONObject result1 = new JSONObject(s);
+                //如果status不为1,抛出异常
+                if (!result1.getJSONObject("res").getString("status").equals("1")) {
+                    throw new Exception(amsSaleOrder.getSaleNumber() + "上传金蝶失败!");
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                //只抛出自定义异常
+                throw new Exception(amsSaleOrder.getSaleNumber() + "上传金蝶失败!");
+            }
         }
-        System.out.println(s);
         amsSaleOrder.setSaleOrderStatus(new BigDecimal(1));
         try {
             saleLogUtil.logSaleOrder(saleOrderId,"物流上传销售订单至金蝶" ,"物流" ,SaleLogUtil.UPDATE);
@@ -1563,11 +1573,21 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
             }catch (Exception e){
                 e.printStackTrace();
             }
-            String status = (String) s.get("status");
-            if ("-1".equals(status)) {
+            if (s == null || s.size() == 0) {
                 continue;
+            }else {
+                try {
+                    JSONObject result1 = new JSONObject(s);
+                    //如果status不为1,抛出异常
+                    if (!result1.getJSONObject("res").getString("status").equals("1")) {
+                        continue;
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    //只抛出自定义异常
+                   continue;
+                }
             }
-            System.out.println(s);
             amsSaleOrder.setSaleOrderId(saleOrderId);
             amsSaleOrder.setSaleOrderStatus(new BigDecimal(1));
             try {