瀏覽代碼

Merge branch 'master' of https://git.steerinfo.com/DAL-DAZHOU/DAL-DAZHOU-AMS-API

luobang 2 年之前
父節點
當前提交
60b990a764

+ 11 - 1
src/main/java/com/steerinfo/dil/controller/AmsSaleOrderController.java

@@ -1318,7 +1318,13 @@ public class AmsSaleOrderController<RedisTemplate> extends BaseRESTfulController
     @ApiModelProperty(value = "修改厂内未装货车辆的运单车牌号")
     @PostMapping("/updateCapacityNumberInFactory")
     public RESTfulResult updateCapacityNumberInFactory(@RequestBody Map<String,Object> mapValue) {
-        Map<String, Object> result = amsSaleOrderService.updateCapacityNumberInFactory(mapValue);
+        Map<String, Object> result = new HashMap<>();
+        try{
+            result = amsSaleOrderService.updateCapacityNumberInFactory(mapValue);
+        }catch (Exception e){
+            e.printStackTrace();
+            return failed(e.getMessage());
+        }
         int result1= (int) result.get("result");
         if (result1 == 0) {
             return failed("已装货车辆不允许修改车牌");
@@ -1337,6 +1343,10 @@ public class AmsSaleOrderController<RedisTemplate> extends BaseRESTfulController
             System.out.println("-------------------------------------");
             System.out.println(s);
             System.out.println("-------------------------------------");
+            if (s == null || s.size() == 0) {
+                //失败,存入重试队列,准备重试
+                retryQueen.add(mapList);
+            }
             return success(result);
         }
     }

+ 1 - 1
src/main/java/com/steerinfo/dil/service/IAmsSaleOrderService.java

@@ -156,7 +156,7 @@ public interface IAmsSaleOrderService {
     // 展示所有状态销售订单列表
     List<Map<String, Object>> getAllSteelSaleOrderList(Map<String, Object> mapValue);
     // 修改厂内未装货车辆的运单车牌号
-    Map<String, Object> updateCapacityNumberInFactory(Map<String, Object> mapValue);
+    Map<String, Object> updateCapacityNumberInFactory(Map<String, Object> mapValue) throws Exception;
     //修改收货客户的电话(销售)
     int updateConsigneeTel(Map<String,Object> mapValue);
     // 得到销售订单物资表主键

+ 61 - 54
src/main/java/com/steerinfo/dil/service/impl/AmsSaleOrderServiceImpl.java

@@ -1939,66 +1939,73 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
      * @return
      */
     @Override
-    public Map<String, Object> updateCapacityNumberInFactory(Map<String, Object> mapValue) {
+    public Map<String, Object> updateCapacityNumberInFactory(Map<String, Object> mapValue) throws Exception {
         Object lineSequence = mapValue.get("lineSequence");
         int result = 0;
-        try{
-            //查询输入进来的车牌号是否与原有车牌号一致,如果一致则退出
-            BigDecimal oldCapacityId = omstruckOrderMapper.getOldCapacityId(DataChange.dataToBigDecimal(mapValue.get("orderId")));
-            if(oldCapacityId.compareTo(DataChange.dataToBigDecimal(mapValue.get("capacityId"))) == 0) {
-                mapValue.put("result",1);
-                return mapValue;
+        //查询输入进来的车牌号是否与原有车牌号一致,如果一致则退出
+        BigDecimal oldCapacityId = omstruckOrderMapper.getOldCapacityId(DataChange.dataToBigDecimal(mapValue.get("orderId")));
+        if(oldCapacityId.compareTo(DataChange.dataToBigDecimal(mapValue.get("capacityId"))) == 0) {
+            mapValue.put("result",1);
+            return mapValue;
+        }
+        Integer isCheckGps = amsSaleOrderMapper.getDispachSwitch();
+        String capacityNo = (String) mapValue.get("capacityNo");
+        if(isCheckGps!=null && isCheckGps==0){
+            Map<String,Object> data = (Map<String,Object>)otmsFeign.getCurrentLocation(capacityNo).getData();
+            Map<String,Object> locationResult = (Map<String,Object>)data.get("result");
+            int isGPS=amsSaleOrderMapper.isGPS(capacityNo);
+            if(isGPS > 0){
+                System.out.println(capacityNo+"允许无GPS派车");
+            }else if(locationResult==null || locationResult.get("lon")==null || locationResult.get("lat")==null){
+                throw new Exception("该车没有GPS定位信息,请联系销售公司物流部,申请是否可以派车。");
             }
-            String capacityNo = (String) mapValue.get("capacityNo");
-            BigDecimal capacityTel = omstruckOrderMapper.getCapacityTel(capacityNo);
-            if (capacityTel.compareTo(BigDecimal.ZERO)!=0){
-                mapValue.put("capacityTel",capacityTel);
-            }else {
-                mapValue.put("capacityTel",0);
+        }
+        BigDecimal capacityTel = omstruckOrderMapper.getCapacityTel(capacityNo);
+        if (capacityTel.compareTo(BigDecimal.ZERO)!=0){
+            mapValue.put("capacityTel",capacityTel);
+        }else {
+            mapValue.put("capacityTel",0);
+        }
+        if (lineSequence == null || "0".equals(lineSequence.toString()) || "1".equals(lineSequence.toString()) || "2".equals(lineSequence.toString())) {
+            String capacityids="";
+            Integer capacityid1= (Integer) mapValue.get("capacityIds");
+            Integer capacityid2= (Integer) mapValue.get("capacityId");
+            if (capacityid1!=null && !("".equals(capacityid1))){
+                capacityids=capacityid1+","+capacityid2;
             }
-            if (lineSequence == null || "0".equals(lineSequence.toString()) || "1".equals(lineSequence.toString()) || "2".equals(lineSequence.toString())) {
-                String capacityids="";
-                Integer capacityid1= (Integer) mapValue.get("capacityIds");
-                Integer capacityid2= (Integer) mapValue.get("capacityId");
-                if (capacityid1!=null && !("".equals(capacityid1))){
-                    capacityids=capacityid1+","+capacityid2;
-                }
-                mapValue.put("capacityids",capacityids);
-                //这是修改车牌号
-                //将排队信息删掉
-                Map<String, Object> isSpellingMap = omstruckOrderMapper.getSteelIsSpelling(DataChange.dataToBigDecimal(mapValue.get("orderId")));
-                if(isSpellingMap != null && isSpellingMap.get("listId") != null){
-                    int isSpelling = DataChange.dataToBigDecimal(isSpellingMap.get("isSpelling")).intValue();
-                    if(isSpelling == 1 ){
-                        result += omstruckOrderMapper.deleteSpellingList(isSpellingMap.get("listId"));
-                    }else{
-                        result += omstruckOrderMapper.deleteQueueList(isSpellingMap.get("listId"));
-                    }
-                }
-                result += amsSaleOrderMapper.updateCapacityNumberInFactory(mapValue);
-                //若是接单之后还需要删除实绩且将状态变为4
-                //查询运输订单的状态和总实绩ID
-                Map<String, Object> orderMesMap = amsSaleOrderMapper.getOrderMes(mapValue);
-                BigDecimal resultTotalId = DataChange.dataToBigDecimal(orderMesMap.get("resultTotalId"));
-                //删除排队实绩
-                if (resultTotalId !=null && !("".equals(resultTotalId))){
-                    omstruckOrderMapper.deleteQueuingPerformance(resultTotalId);
-                }
-                if(DataChange.dataToBigDecimal(orderMesMap.get("orderStatus")).intValue() == 5){
-                    OmstruckOrder omstruckOrder = new OmstruckOrder();
-                    omstruckOrder.setOrderId(DataChange.dataToBigDecimal(mapValue.get("orderId")));
-                    omstruckOrder.setOrderStatus(new BigDecimal(4));
-                    omstruckOrder.setOrderLineSequence(new BigDecimal(0));
-                    /*omstruckOrder.set*/
-                    result += omstruckOrderMapper.updateByPrimaryKeySelective(omstruckOrder);
-                    result += omstruckOrderMapper.deleteEnResult(resultTotalId);
-                    result += omstruckOrderMapper.deleteWeightResult(resultTotalId);
-                    result += omstruckOrderMapper.deleteLoadResult(resultTotalId);
-                    result += omstruckOrderMapper.deleteLeaveResult(resultTotalId);
+            mapValue.put("capacityids",capacityids);
+            //这是修改车牌号
+            //将排队信息删掉
+            Map<String, Object> isSpellingMap = omstruckOrderMapper.getSteelIsSpelling(DataChange.dataToBigDecimal(mapValue.get("orderId")));
+            if(isSpellingMap != null && isSpellingMap.get("listId") != null){
+                int isSpelling = DataChange.dataToBigDecimal(isSpellingMap.get("isSpelling")).intValue();
+                if(isSpelling == 1 ){
+                    result += omstruckOrderMapper.deleteSpellingList(isSpellingMap.get("listId"));
+                }else{
+                    result += omstruckOrderMapper.deleteQueueList(isSpellingMap.get("listId"));
                 }
             }
-        }catch (Exception e){
-            System.out.println("e"+e.getMessage());
+            result += amsSaleOrderMapper.updateCapacityNumberInFactory(mapValue);
+            //若是接单之后还需要删除实绩且将状态变为4
+            //查询运输订单的状态和总实绩ID
+            Map<String, Object> orderMesMap = amsSaleOrderMapper.getOrderMes(mapValue);
+            BigDecimal resultTotalId = DataChange.dataToBigDecimal(orderMesMap.get("resultTotalId"));
+            //删除排队实绩
+            if (resultTotalId !=null && !("".equals(resultTotalId))){
+                omstruckOrderMapper.deleteQueuingPerformance(resultTotalId);
+            }
+            if(DataChange.dataToBigDecimal(orderMesMap.get("orderStatus")).intValue() == 5){
+                OmstruckOrder omstruckOrder = new OmstruckOrder();
+                omstruckOrder.setOrderId(DataChange.dataToBigDecimal(mapValue.get("orderId")));
+                omstruckOrder.setOrderStatus(new BigDecimal(4));
+                omstruckOrder.setOrderLineSequence(new BigDecimal(0));
+                /*omstruckOrder.set*/
+                result += omstruckOrderMapper.updateByPrimaryKeySelective(omstruckOrder);
+                result += omstruckOrderMapper.deleteEnResult(resultTotalId);
+                result += omstruckOrderMapper.deleteWeightResult(resultTotalId);
+                result += omstruckOrderMapper.deleteLoadResult(resultTotalId);
+                result += omstruckOrderMapper.deleteLeaveResult(resultTotalId);
+            }
         }
         mapValue.put("result",result);
         return mapValue;