luobang há 1 ano atrás
pai
commit
84c588cbe6

+ 50 - 32
src/main/java/com/steerinfo/dil/service/impl/AmsSaleOrderServiceImpl.java

@@ -3278,6 +3278,23 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
         }
         if (s == null || s.size() == 0) {
             throw new Exception("登录金蝶失败!请重试派车!");
+        }else {
+            try {
+                JSONObject result = new JSONObject(s);
+                //如果status不为1,抛出异常
+                if (!result.getJSONObject("res").getString("status").equals("1")) {
+                    throw new Exception("上传金蝶失败!请重试派车:" + result.getJSONObject("requestException").getString("message"));
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                //只抛出自定义异常
+                if (e.getMessage().contains("Exception")) {
+                    throw new Exception("上传金蝶失败!请重试派车!");
+                } else {
+                    throw new Exception(e.getMessage());
+                }
+
+            }
         }
         return 1;
     }
@@ -3290,40 +3307,41 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
      */
     @Override
     public int batchPushCarNumberToEas(List<Map<String, Object>> mapList) throws Exception {
-        Map<String,Object> input = joinFeign.findCarNumberByOrderList(mapList);
-        Map<String,Object> totalMap = new HashMap<>();
-        totalMap.putAll(easCapacityTestUtil.getTotalMap());
-        totalMap.put("input",input);
-        Map<String,Object> s = joinFeign.pushCarNumberToEas(totalMap);
-        System.out.println(totalMap);
-        String json = JSONUtils.toJSONString(totalMap);
-        System.out.println(json);
-        totalMap.put("output",s);
-        System.out.println(totalMap);
-        try {
-            newFileTool.newFile("pushCarNumberToEas:"+totalMap,"金蝶通讯报文");
-        }catch (Exception e){
-            e.printStackTrace();
-        }
-        if (s == null || s.size() == 0) {
-            throw new Exception("登录金蝶失败!请重试派车!");
-        }else{
-            try{
-                JSONObject result = new JSONObject(s);
-                //如果status不为1,抛出异常
-                if(!result.getJSONObject("res").getString("status").equals("1")){
-                    throw new Exception("上传金蝶失败!请重试派车:"+result.getJSONObject("requestException").getString("message"));
-                }
-            }catch (Exception e){
+            Map<String, Object> input = joinFeign.findCarNumberByOrderList(mapList);
+            Map<String, Object> totalMap = new HashMap<>();
+            totalMap.putAll(easCapacityTestUtil.getTotalMap());
+            totalMap.put("input", input);
+            Map<String, Object> s = joinFeign.pushCarNumberToEas(totalMap);
+            System.out.println(totalMap);
+            String json = JSONUtils.toJSONString(totalMap);
+            System.out.println(json);
+            totalMap.put("output", s);
+            System.out.println(totalMap);
+            try {
+                newFileTool.newFile("pushCarNumberToEas:" + totalMap, "金蝶通讯报文");
+            } catch (Exception e) {
                 e.printStackTrace();
-                //只抛出自定义异常
-                if(e.getMessage().contains("Exception")){
-                    throw new Exception("上传金蝶失败!请重试派车!");
-                }else{
-                    throw new Exception(e.getMessage());
+            }
+            if (s == null || s.size() == 0) {
+                throw new Exception("登录金蝶失败!请重试派车!");
+            } else {
+                try {
+                    JSONObject result = new JSONObject(s);
+                    //如果status不为1,抛出异常
+                    if (!result.getJSONObject("res").getString("status").equals("1")) {
+                        throw new Exception("上传金蝶失败!请重试派车:" + result.getJSONObject("requestException").getString("message"));
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    //只抛出自定义异常
+                    if (e.getMessage().contains("Exception")) {
+                        throw new Exception("上传金蝶失败!请重试派车!");
+                    } else {
+                        throw new Exception(e.getMessage());
+                    }
+
                 }
 
-            }
         }
         return 1;
     }
@@ -3348,7 +3366,7 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
         if (orderMap != null) {
             throw new Exception("该订单已派发,无法重复派车");
         }
-        if (saleStatus == 1) {
+        if (saleStatus != 4) {
             throw new Exception("订单未审核,无法派车!");
         }
         int result = 0;