zx 3 years ago
parent
commit
1d5ec0f576

+ 24 - 5
src/main/java/com/steerinfo/dil/controller/AmstruckSporadicOrderController.java

@@ -85,7 +85,8 @@ public class AmstruckSporadicOrderController extends BaseRESTfulController {
                                                Integer dispatchStatus,
                                                Integer sporadicStatus,
                                                String carrierSsoId,
-                                               String userId) {
+                                               String userId,
+                                               String userIds) {
 
         if (con != null && !con.equals("undefined")) {
             String index="get_sporadic_order_list";//设置要查询的索引名称
@@ -116,6 +117,10 @@ public class AmstruckSporadicOrderController extends BaseRESTfulController {
             mapValue.put("userId",userId);
             count++;
         }
+        if (userIds!=null){
+            mapValue.put("userIds",userIds);
+            count++;
+        }
         List<Map<String, Object>> sporadicOrderList = null;
         if (mapValue.size() == count) {
             //将查询结果存入索引中
@@ -152,14 +157,28 @@ public class AmstruckSporadicOrderController extends BaseRESTfulController {
                                          Integer pageNum,
                                          Integer pageSize,
                                          Integer sporadicOrderId,
-                                         String con) {
+                                         String con,
+                                         String userId,
+                                         String userIds) {
+        int count=0;
         if (con != null && !con.equals("undefined")) {
             String index="see_all_materials";//设置要查询的索引名称
             return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
         }
-        mapValue.put("sporadicOrderId",sporadicOrderId);
+        if (userId!=null){
+            mapValue.put("userId",userId);
+            count++;
+        }
+        if (userIds!=null){
+            mapValue.put("userIds",userIds);
+            count++;
+        }
+        if (sporadicOrderId!=null) {
+            mapValue.put("sporadicOrderId", sporadicOrderId);
+            count++;
+        }
         List<Map<String, Object>> mapList = null;
-        if (mapValue.size() == 1) {
+        if (mapValue.size() == count) {
             //将查询结果存入索引中
             mapList =  amstruckSporadicOrderService.seeAllMaterials(mapValue);
             Map<String, Object> map1 = new HashMap<>();
@@ -177,7 +196,7 @@ public class AmstruckSporadicOrderController extends BaseRESTfulController {
             mapList = amstruckSporadicOrderService.seeAllMaterials(mapValue);
         }
         PageHelper.startPage(pageNum,pageSize);
-        List<Map<String, Object>> columnList = amstruckSporadicOrderService.getSporadicOrdersList(mapValue);
+        List<Map<String, Object>> columnList = amstruckSporadicOrderService.seeAllMaterials(mapValue);
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId, mapList,columnList);
         return success(pageList);
     }

+ 2 - 0
src/main/java/com/steerinfo/dil/mapper/AmstruckSporadicMaterialMapper.java

@@ -20,4 +20,6 @@ public interface AmstruckSporadicMaterialMapper extends IBaseMapper<AmstruckSpor
      // 查询承运商不为空的零星物资
     List<Map<String,Object>> getSporadicOrdersList3(Map<String,Object> map);
 
+    List<Map<String,Object>> getSporadicOrdersList4(Map<String,Object> mapValue);
+
 }

+ 5 - 0
src/main/java/com/steerinfo/dil/mapper/AmstruckSporadicOrderMapper.java

@@ -20,6 +20,9 @@ public interface AmstruckSporadicOrderMapper extends IBaseMapper<AmstruckSporadi
 
     // 查询零星物资订单一车多趟列表
     List<Map<String, Object>> getSporadicOrdersList1(Map<String, Object> mapValue);
+
+
+
     // 查询物资详情
     List<Map<String, Object>> seeAllMaterials(Map<String, Object> mapValue);
 
@@ -28,4 +31,6 @@ public interface AmstruckSporadicOrderMapper extends IBaseMapper<AmstruckSporadi
 
     //一车多趟,根据运输订单id查找运输订单信息
     Map<String,Object> selectOrderInfo(Integer orderId);
+
+    List<Map<String,Object>> selectOrderIdbySporadicOrderid(Integer sporadicOrderId);
 }

+ 39 - 12
src/main/java/com/steerinfo/dil/service/impl/AmstruckSporadicOrderServiceImpl.java

@@ -243,10 +243,8 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
     public int addSporadicOrder(Map<String, Object> map) {
         Integer orderType =(Integer) map.get("orderType");
         switch (orderType){
-   //      case 12:addSporadicOrders(map);
-  //               break;
-  //       case 13:addSporadicOrders(map);
-  //                break;
+            case 12:
+            case 13:
             case 15:
             case 16: addSporadicOrdersForCoke(map);
                     break;
@@ -258,10 +256,13 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
     public int addInwardSporadicOrder(Map<String, Object> map) {
         int result=0;
         BigDecimal sporadicOrderId = DataChange.dataToBigDecimal(map.get("sporadicOrderId"));
+        String userId=(String)map.get("userId");
         //添加承运商
         AmstruckSporadicOrder amstruckSporadicOrder=new AmstruckSporadicOrder();
         amstruckSporadicOrder.setSporadicOrderId(sporadicOrderId);
         amstruckSporadicOrder.setCarrierId(DataChange.dataToBigDecimal(map.get("carrierId")));
+        amstruckSporadicOrder.setUpdateUsername(userId);
+        amstruckSporadicOrder.setInsertTime(new Date());
         result += amstruckSporadicOrderMapper.updateByPrimaryKeySelective(amstruckSporadicOrder);
         return result ;
     }
@@ -315,26 +316,40 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
         List<Map<String, Object>> mapList=null;
         switch (orderType1) {
             case 12:
-                mapList = amstruckSporadicOrderMapper.getSporadicOrdersList(mapValue);
+                if (mapValue.get("sporadicStatus") != null) {
+                    //走查询订单id的接口
+                    mapList = amstruckSporadicOrderMapper.getSporadicOrdersList(mapValue);
+                }else {
+                    //不查询订单id的接口
+                    mapList=amstruckSporadicMaterialMapper.getSporadicOrdersList4(mapValue);
+                }
                 for (Map<String, Object> map : mapList) {
                     BigDecimal type = (BigDecimal) map.get("type");
+//                    BigDecimal orderStatus =(BigDecimal) map.get("orderStatus");
                     String orderType = "";
+//                    String status = "";
                     if (type.intValue() == 12) {
-                        orderType += "零星物资进厂";
+                        orderType += "内转零星进厂";
                     }
                     if (type.intValue() == 13) {
-                        orderType += "零星物资出厂";
+                        orderType += "内转零星出厂";
                     }
+//                    if (orderStatus.intValue()==4){
+//                        status += "已下发";
+//                    }
                     map.put("orderType", orderType);
                 }
+            case 13:
                 break;
             case 15:
                 if(mapValue.get("sporadicStatus") != null){
+                    //不查询订单id
                     mapList = amstruckSporadicMaterialMapper.getSporadicOrdersList2(mapValue);
                 }else{
+                    //查询订单id
                     mapList = amstruckSporadicOrderMapper.getSporadicOrdersList1(mapValue);
                 }
-                //没有承运商状态
+                //没有承运商状态为3
                 if (DataChange.dataToBigDecimal(mapValue.get("sporadicStatus")).intValue()==3) {
                     mapList =amstruckSporadicMaterialMapper.getSporadicOrdersList3(mapValue);
                 }
@@ -342,13 +357,14 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
                     BigDecimal type = (BigDecimal) map1.get("type");
                     String orderType = "";
                     if (type.intValue() == 15) {
-                        orderType += "内转零星进厂";
+                        orderType += "普通零星进厂";
                     }
                     if (type.intValue() == 16) {
-                        orderType += "内转零星出厂";
+                        orderType += "普通零星出厂";
                     }
                     map1.put("orderType", orderType);
                 }
+            case 16:
                 break;
         }
         return mapList;
@@ -467,11 +483,22 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
     //关闭零星订单,将订单吗状态设置为0  无法推送新的订单。
     @Override
     public int closeSporadicOrder(Map<String, Object> map) {
+        int result=0;
         BigDecimal sporadicOrderId =DataChange.dataToBigDecimal(map.get("sporadicOrderId"));
         AmstruckSporadicOrder amstruckSporadicOrder=new AmstruckSporadicOrder();
         amstruckSporadicOrder.setSporadicOrderId(sporadicOrderId);
         amstruckSporadicOrder.setSporadicOrderTimes(new BigDecimal(0));
-        amstruckSporadicOrderMapper.updateByPrimaryKeySelective(amstruckSporadicOrder);
-        return 1;
+        result+=amstruckSporadicOrderMapper.updateByPrimaryKeySelective(amstruckSporadicOrder);
+        //查找零星订单下的所有未接收的运输订单
+        List<Map<String, Object>> stringObjectMap = amstruckSporadicOrderMapper.selectOrderIdbySporadicOrderid(sporadicOrderId.intValue());
+        for (Map<String,Object> map1:stringObjectMap) {
+            //获取零星订单关联的未接收的订单
+            BigDecimal orderId =(BigDecimal) map1.get("orderId");
+            OmstruckOrder omstruckOrder=new OmstruckOrder();
+            omstruckOrder.setOrderId(orderId);
+            omstruckOrder.setOrderStatus(new BigDecimal(8));
+           result+=omstruckOrderMapper.updateByPrimaryKeySelective(omstruckOrder);
+        }
+        return result;
     }
 }

+ 1 - 1
src/main/resources/application-dev.yml

@@ -15,7 +15,7 @@ openfeign:
   ColumnDataFeign:
     url: ${COLUMNDATAFEIGN_URL:172.16.33.162:8001}
   TmsTruckFeign:
-    url: ${TMSTRUCKFEIGN_URL:172.16.33.162:8008}
+    url: ${TMSTRUCKFEIGN_URL:192.168.1.102:8008}
   ImFeign:
     url: ${IMFEIGN_URL:172.16.33.162:8018}
 

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -1,7 +1,7 @@
 api.version: api/v1/ams
 spring:
   profiles:
-    include: ${SPRING_PROFILES:prod}
+    include: ${SPRING_PROFILES:dev}
   jackson:
     date-format: yyyy-MM-dd HH:mm:ss
     time-zone: GMT+8

+ 84 - 1
src/main/resources/com/steerinfo/dil/mapper/AmstruckSporadicMaterialMapper.xml

@@ -382,7 +382,8 @@
     ASO.INSERT_TIME AS "insertTime",
     OO.ORDER_TYPE AS "type",
     RM.MATERIAL_NAME AS "materialName",
-    ASO.SPORADIC_ORDER_TIMES "sporadicOrderTimes"
+    ASO.SPORADIC_ORDER_TIMES "sporadicOrderTimes",
+    ASO.SPORADIC_TRANS_TIMES "transTimes"
     FROM AMSTRUCK_SPORADIC_ORDER ASO
     LEFT JOIN RMS_CONSIGNEE RCO
     ON ASO.RECEIVE_UNIT_ID = RCO.CONSIGNEE_ID
@@ -408,6 +409,9 @@
     <if test="userId!=null">
       and aso.INSERT_USERNAME=#{userId}
     </if>
+    <if test="userIds!=null">
+      and aso.UPDATE_USERNAME=#{userIds}
+    </if>
     )
     <where>
       <if test="sporadicOrderNo != null">
@@ -444,6 +448,82 @@
     <include refid="orderBy"></include>
   </select>
 
+<select id="getSporadicOrdersList4" resultType="java.util.Map">
+  SELECT *
+  FROM (
+  SELECT
+  ASO.SPORADIC_ORDER_ID AS "sporadicOrderId",
+  ASO.SPORADIC_ORDER_NO AS "sporadicOrderNo",
+  RSU.SUPPLIER_NAME AS "supplierName",
+  RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
+  RCA.CARRIER_NAME AS "carrierName",
+  ASO.INSERT_TIME AS "insertTime",
+  OO.ORDER_TYPE AS "type",
+  OO.ORDER_STATUS "orderStatus",
+  RM.MATERIAL_NAME "materialName",
+  ASO.SPORADIC_TRANS_TIMES "transTimes",
+  ASO.SPORADIC_ORDER_TIMES "sporadicOrderTimes"
+  FROM AMSTRUCK_SPORADIC_ORDER ASO
+  LEFT JOIN RMS_CONSIGNEE RCO
+  ON ASO.RECEIVE_UNIT_ID = RCO.CONSIGNEE_ID
+  LEFT JOIN RMS_SUPPLIER RSU
+  ON ASO.SEND_UNIT_ID = RSU.SUPPLIER_ID
+  LEFT JOIN RMS_CARRIER RCA
+  ON RCA.CARRIER_ID = ASO.CARRIER_ID
+  LEFT JOIN OMSTRUCK_ORDER OO
+  ON OO.ORDER_PLAN_ID = ASO.SPORADIC_ORDER_ID
+  LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
+  ON
+  OOM.ORDER_ID = OO.ORDER_ID
+  LEFT JOIN RMS_MATERIAL RM
+  ON RM.MATERIAL_ID = OOM.MATERIAL_ID
+  WHERE OO.ORDER_TYPE in (12,13)
+  AND ASO.ISSUE_STATUS = #{issueStatus}
+  AND ASO.DELETED = 0
+  <if test="userId!=null">
+    and ASO.INSERT_USERNAME=#{userId}
+  </if>
+  <if test="usersId!=null">
+    and ASO.UPDATE_USERNAME=#{usersId}
+  </if>
+  <if test="dispatchStatus != null">
+    AND ASO.DISPATCH_STATUS =  #{dispatchStatus}
+  </if>
+  )
+  <where>
+    <if test="sporadicOrderNo != null">
+      and
+      <foreach collection="sporadicOrderNo" item="item" open="(" separator="or" close=")">
+        "sporadicOrderNo" like '%${item}%'
+      </foreach>
+    </if>
+    <if test="supplierName != null">
+      and
+      <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
+        "supplierName" like '%${item}%'
+      </foreach>
+    </if>
+    <if test="consigneeCompanyName != null">
+      and
+      <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
+        "consigneeCompanyName" like '%${item}%'
+      </foreach>
+    </if>
+    <if test="carrierName != null">
+      and
+      <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
+        "carrierName" like '%${item}%'
+      </foreach>
+    </if>
+    <if test="insertTime != null">
+      and
+      <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
+        "insertTime" like to_date('${item}','yyyy-mm-dd hh24:mi:ss')
+      </foreach>
+    </if>
+  </where>
+  <include refid="orderBy"></include>
+</select>
 
   <select id="getSporadicOrdersList3" resultType="java.util.Map">
     select *
@@ -484,6 +564,9 @@
     <if test="userId!=null">
       and aso.INSERT_USERNAME=#{userId}
     </if>
+    <if test="userIds!=null">
+      and aso.UPDATE_USERNAME=#{userIds}
+    </if>
     )
     <where>
       <if test="sporadicOrderNo != null">

+ 29 - 2
src/main/resources/com/steerinfo/dil/mapper/AmstruckSporadicOrderMapper.xml

@@ -495,8 +495,10 @@
         ASO.INSERT_TIME AS "insertTime",
         OO.ORDER_TYPE AS "type",
         OO.ORDER_ID "orderId",
+        OO.ORDER_STATUS "orderStatus",
         RM.MATERIAL_NAME "materialName",
-        ASO.SPORADIC_TRANS_TIMES "transTimes"
+        ASO.SPORADIC_TRANS_TIMES "transTimes",
+        ASO.SPORADIC_ORDER_TIMES "sporadicOrderTimes"
         FROM AMSTRUCK_SPORADIC_ORDER ASO
         LEFT JOIN RMS_CONSIGNEE RCO
         ON ASO.RECEIVE_UNIT_ID = RCO.CONSIGNEE_ID
@@ -514,6 +516,15 @@
         WHERE OO.ORDER_TYPE in (12,13)
         AND ASO.ISSUE_STATUS = #{issueStatus}
         AND ASO.DELETED = 0
+            <if test="userId!=null">
+             and ASO.INSERT_USERNAME=#{userId}
+            </if>
+            <if test="usersId!=null">
+             and ASO.UPDATE_USERNAME=#{usersId}
+            </if>
+             <if test="dispatchStatus != null">
+             AND ASO.DISPATCH_STATUS =  #{dispatchStatus}
+             </if>
         )
         <where>
             <if test="sporadicOrderNo != null">
@@ -566,7 +577,7 @@
         OO.ORDER_ID "orderId",
         RM.MATERIAL_NAME AS "materialName",
         ASO.SPORADIC_ORDER_TIMES "sporadicOrderTimes",
-        ASO.SPORADIC_TRANS_TIMES "tranTimes"
+        ASO.SPORADIC_TRANS_TIMES "transTimes"
         FROM AMSTRUCK_SPORADIC_ORDER ASO
         LEFT JOIN RMS_CONSIGNEE RCO
         ON ASO.RECEIVE_UNIT_ID = RCO.CONSIGNEE_ID
@@ -598,6 +609,9 @@
         <if test="userId != null">
             and ASO.INSERT_USERNAME=#{userId}
         </if>
+        <if test="userIds!=null">
+            and aso.UPDATE_USERNAME=#{userIds}
+        </if>
         )
         <where>
             <if test="sporadicOrderNo != null">
@@ -650,6 +664,12 @@
         LEFT JOIN RMS_MATERIAL RM
         ON RM.MATERIAL_ID = OOM.MATERIAL_ID
         WHERE ASO.SPORADIC_ORDER_ID = #{sporadicOrderId}
+            <if test="userId!=null">
+             and ASO.INSERT_USERNAME=#{userId}
+            </if>
+            <if test="usersId!=null">
+             and ASO.UPDATE_USERNAME=#{usersId}
+            </if>
         )
         <where>
             <if test="materialName != null">
@@ -698,6 +718,13 @@
         where OO.ORDER_ID=#{orderId}
     </select>
 
+<!-- 根据零星订单id查找未接收的订单-->
+    <select id="selectOrderIdbySporadicOrderid" parameterType="java.lang.Integer" resultType="java.util.Map">
+        select OO.ORDER_ID "orderId"
+        from OMSTRUCK_ORDER OO
+        where OO.ORDER_STATUS=4 AND OO.ORDER_PLAN_ID=#{sporadicOrderId}
+    </select>
+
 
 
 </mapper>