瀏覽代碼

Merge branch 'master' of https://git.steerinfo.com/DAL-DAZHOU1/DAL-TMS-TRUCK-API

zouzhd 3 年之前
父節點
當前提交
7bd59e0cef

+ 5 - 32
src/main/java/com/steerinfo/dil/controller/TmstruckEnfactoryResultController.java

@@ -61,47 +61,20 @@ public class TmstruckEnfactoryResultController extends BaseRESTfulController {
                                        String userId,
                                        String userIds
                                        ){
-        int count=0;
+
+        if(con!=null&&con.equals("undefined")){
+            mapValue.put("con","%"+con+"%");
+        }
         if (userId!=null){
             mapValue.put("userId",userId);
-            count++;
         }
         if (userIds!=null){
             mapValue.put("userIds",userIds);
-            count++;
         }
         if (orderType!=null){
             mapValue.put("orderTypee", orderType);
-            count++;
-        }
-
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                //设置要查询的索引名称
-                String index="get_enfactory_list";
-                //获取查询结果
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));
-            }
-        }
-        List<Map<String, Object>> allEnFactoryResult = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == count){
-            //将查询结果存入索引中
-            allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_enfactory_list");
-            //添加id
-            map.put("indexId","enFactoryId");
-            allEnFactoryResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allEnFactoryResult);
-            //删除
-            allEnFactoryResult.remove(allEnFactoryResult.size()-1);
         }
-        if(allEnFactoryResult == null)
-            allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
+        List<Map<String, Object>>  allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> enFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);

+ 5 - 29
src/main/java/com/steerinfo/dil/controller/TmstruckLeaveFactoryResultController.java

@@ -78,49 +78,25 @@ public class TmstruckLeaveFactoryResultController extends BaseRESTfulController
                                                String carrierSsoId,
                                                String userId,
                                                String userIds){
-        int count=0;
+
         if (userId!=null){
             mapValue.put("userId",userId);
-            count++;
         }
         if (userIds!=null){
             mapValue.put("userIds",userIds);
-            count++;
         }
-        if (orderType!=null){
+        if (orderType!=null) {
             mapValue.put("orderTypee", orderType);
-            count++;
         }
         if(carrierSsoId != null){
             if(!"null".equals(carrierSsoId)){
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_leavefactory_list";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
-        }
-        List<Map<String, Object>> allLeaveFactoryResult = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == count){
-            //将查询结果存入索引中
-            allLeaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_leavefactory_list");
-            //添加id
-            map.put("indexId","leaveFactoryId");
-            allLeaveFactoryResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allLeaveFactoryResult);
-            //删除
-            allLeaveFactoryResult.remove(allLeaveFactoryResult.size()-1);
+        if(con!=null&&con.equals("undefined")){
+            mapValue.put("con","%"+con+"%");
         }
-        if(allLeaveFactoryResult == null)
-            allLeaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
+        List<Map<String, Object>>  allLeaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> leaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);

+ 2 - 30
src/main/java/com/steerinfo/dil/controller/TmstruckLoadResultController.java

@@ -129,49 +129,21 @@ public class TmstruckLoadResultController extends BaseRESTfulController {
                                         String con,
                                         String userId,
                                         String userIds){
-        int count=0;
+
         if (status!=null){
             mapValue.put("status", status);
-            count++;
         }
         if (orderType!=null){
             mapValue.put("orderTypee", orderType);
-            count++;
         }
         if (userId!=null){
             mapValue.put("userId",userId);
-            count++;
         }
         if (userIds!=null){
             mapValue.put("userIds",userIds);
-            count++;
-        }
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_truck_load_list";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
         }
-        //不分页筛选数据
-        List<Map<String, Object>> allLoadResult = null;
         //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == count){
-            //将查询结果存入索引中
-            allLoadResult = tmstruckLoadResultService.getAllLoadResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_truck_load_list");
-            //添加id
-            map.put("indexId","truckLoadId");
-            allLoadResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allLoadResult);
-            //删除
-            allLoadResult.remove(allLoadResult.size()-1);
-        }
-        if(allLoadResult == null)
-            allLoadResult = tmstruckLoadResultService.getAllLoadResult(mapValue);
+        List<Map<String, Object>>   allLoadResult = tmstruckLoadResultService.getAllLoadResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> loadResult = tmstruckLoadResultService.getAllLoadResult(mapValue);

+ 2 - 29
src/main/java/com/steerinfo/dil/controller/TmstruckUnloadResultController.java

@@ -62,46 +62,19 @@ public class TmstruckUnloadResultController extends BaseRESTfulController {
                                            String userId,
                                            String  userIds
     ){
-        int count=0;
+
         if (orderType!=null){
             mapValue.put("orderTypee", orderType);
-            count++;
         }
         if (userId!=null){
             mapValue.put("userId",userId);
-            count++;
         }
         if (userIds!=null){
             mapValue.put("userIds",userIds);
-            count++;
-        }
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_truck_unload_list";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
         }
         //不分页筛选数据
         List<Map<String, Object>> allUnloadResult = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == count){
-            //将查询结果存入索引中
-            allUnloadResult = tmstruckUnloadResultService.getUnloadResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_truck_unload_list");
-            //添加id
-            map.put("indexId","truckUnloadId");
-            allUnloadResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allUnloadResult);
-            //删除
-            allUnloadResult.remove(allUnloadResult.size()-1);
-        }
-        if(allUnloadResult == null){
-            allUnloadResult = tmstruckUnloadResultService.getUnloadResult(mapValue);
-        }
+        allUnloadResult = tmstruckUnloadResultService.getUnloadResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> unloadResult = tmstruckUnloadResultService.getUnloadResult(mapValue);

+ 5 - 58
src/main/java/com/steerinfo/dil/controller/TmstruckWeightResultController.java

@@ -75,45 +75,18 @@ public class TmstruckWeightResultController extends BaseRESTfulController {
                                                String userId,
                                                String usersId
     ){
-        int count=0;
         if (orderType!=null) {
             mapValue.put("orderTypee", orderType);
-            count++;
         }
         if (userId!=null){
             mapValue.put("userId",userId);
-            count++;
         }
         if (usersId!=null){
             mapValue.put("usersId",usersId);
-            count++;
-        }
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_jimao_list";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
         }
         List<Map<String, Object>> allJiMaoResult = null;
         //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == count){
-            //将查询结果存入索引中
-            allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_jimao_list");
-            //添加id
-            map.put("indexId","jiMaoId");
-            allJiMaoResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allJiMaoResult);
-            //删除
-            allJiMaoResult.remove(allJiMaoResult.size()-1);
-        }
-        if(allJiMaoResult == null){
-            allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
-        }
+        allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> jiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
@@ -140,46 +113,20 @@ public class TmstruckWeightResultController extends BaseRESTfulController {
                                            String userId,
                                            String userIds
     ){
-        int count=0;
+
         if (orderType!=null) {
             mapValue.put("orderTypee", orderType);
-            count++;
         }
         if (userId!=null) {
             mapValue.put("userId",userId);
-            count++;
         }
-        if (userIds!=null){
-            mapValue.put("usersId",userIds);
-            count++;
-        }
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_jipi_list";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
+        if (userIds!=null) {
+            mapValue.put("usersId", userIds);
         }
         //不分页筛选数据
         List<Map<String, Object>> allJiPiResult = null;
         //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == count){
-            //将查询结果存入索引中
-            allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_jipi_list");
-            //添加id
-            map.put("indexId","jiPiId");
-            allJiPiResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allJiPiResult);
-            //删除
-            allJiPiResult.remove(allJiPiResult.size()-1);
-        }
-        if(allJiPiResult == null){
-            allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
-        }
+        allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> jiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);

+ 28 - 1
src/main/java/com/steerinfo/dil/util/DataChange.java

@@ -199,14 +199,41 @@ public class DataChange {
      * @return
      **/
     public static void queryDataByTwoDate(String startTime, String endTime, Map<String, Object> map,SimpleDateFormat sdf){
+        SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
         if (startTime != null && !"null".equals(startTime) && endTime != null && !"null".equals(endTime)) {
             map.put("startDate", sdf.format(new Date(Long.parseLong(startTime))));
             map.put("endDate", sdf.format(new Date(Long.parseLong(endTime))));
+        }
+        //如果开始时间和结束时间有且只有一个为空 则只查那天的数据
+        else if((startTime != null && !"null".equals(startTime)) || (endTime != null && !"null".equals(endTime))){
+            if(startTime != null && !"null".equals(startTime)){
+                queryDataByTwoDateSon(map, startTime, sdfDate);
+            }
+            if(endTime != null && !"null".equals(endTime)){
+                queryDataByTwoDateSon(map, endTime, sdfDate);
+            }
         }else {
             //如果两者时间都为空,则查询当天数据
-            SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
             String nowDate = sdfDate.format(new Date());
             map.put("oneDate", nowDate + " 00:00:00");
         }
     }
+
+    /**
+     * 上面方法的儿子方法 如果只传入了一个时间 则查询那天的数据
+     * @Author TXF
+     * @Date 2022/1/17 16:17
+     * @param map
+     * @param time
+     * @param sdfDate
+     * @return
+     **/
+    private static void queryDataByTwoDateSon(Map<String, Object> map, String time, SimpleDateFormat sdfDate){
+        Date date1 = new Date(Long.parseLong(time));
+        Date date2 = new Date(Long.parseLong(time) + 86400000);
+        String dayStartTime = sdfDate.format(date1);
+        String dayEndTime = sdfDate.format(date2);
+        map.put("startTime", dayStartTime + "00:00:00");
+        map.put("endTime", dayEndTime + "00:00:00");
+    }
 }

+ 10 - 12
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -30,10 +30,9 @@
                      TWR.RESULT_GROSS_WEIGHT_TIME   "resultGrossWeightTime",
                      RM.MATERIAL_NAME                     "materialName",
                      CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode",
-                        <if test="orderTypee == 17 or orderTypee == 18">
-                            RS.SUPPLIER_NAME           "supplierName",
-                            RCON.CONSIGNEE_COMPANY_NAME "receiveName",
-                        </if>
+                     APO.PURCHASE_ORDER_NO      "purchaseOrderNo",
+                     RS.SUPPLIER_NAME           "supplierName",
+                     RCON.CONSIGNEE_COMPANY_NAME "receiveName",
                      TWR.RESULT_TARE_WEIGHT_TIME    "resultTareWeightTime"
               from OMSTRUCK_ORDER OO
                        left join TMSTRUCK_TOTAL_RESULT TTR
@@ -66,14 +65,13 @@
                                  on TRR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
                        left join TMSTRUCK_QUALITY_RESULT TQR
                                  on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
-                       <if test="orderTypee == 17 or orderTypee == 18">
-                           left join AMS_PURCHASE_ORDER APO
-                                on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
-                           left join RMS_SUPPLIER RS
-                                on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
-                           left join RMS_CONSIGNEE RCON
-                                on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
-                       </if>
+                       left join AMS_PURCHASE_ORDER APO
+                            on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
+                       left join RMS_SUPPLIER RS
+                            on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
+                       left join RMS_CONSIGNEE RCON
+                            on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
+
               where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
                 and OO.ORDER_TYPE = #{orderTypee}
                     <if test="oneDate != null">

+ 8 - 4
src/main/resources/com/steerinfo/dil/mapper/TmstruckEnfactoryResultMapper.xml

@@ -1193,12 +1193,16 @@
         left join RMS_CAPACITY RC
         on RC.CAPACITY_ID = OO.CAPACITY_ID
         WHERE OO.ORDER_TYPE = #{orderTypee} and TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
-            <if test="userId">
+            <if test="userId!=null">
                and ASO.INSERT_USERNAME=#{userId}
             </if>
-            <if test="userIds">
+            <if test="userIds!=null">
                and ASO.UPDATE_USERNAME=#{userIds}
             </if>
+            <if test="con!=null">
+                where "orderNumber" like #{con} or "capacityNumber" like #{con}
+                or "gatepostName" like #{con} or  "materialName" like #{con}
+            </if>
         )
         <where>
             <if test="orderNumber != null">
@@ -1245,7 +1249,7 @@
         RC.CAPACITY_NUMBER          "capacityNumber",
         RG.GATEPOST_NAME            "gatepostName",
         TER.RESULT_ENTRY_MODE       "resultEntryMode",
-        to_char(TER.RESULT_ENTRY_GATE_TIME, 'yyyy-mm-dd hh:mm:ss')   "resultEntryGateTime",
+        TER.RESULT_ENTRY_GATE_TIME   "resultEntryGateTime",
         RS.SUPPLIER_NAME            "supplierName",
         TER.INSERT_TIME             "insertTime",
         RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
@@ -1347,7 +1351,7 @@
        RC.CAPACITY_NUMBER                 "capacityNumber",
        RG.GATEPOST_NAME                   "gatepostName",
        TLFR.RESULT_OUT_MODE               "resultOutMode",
-       to_char(TLFR.RESULT_OUT_GATE_TIME, 'yyyy-mm-dd hh:mm:ss')    "resultOutGateTime",
+       TLFR.RESULT_OUT_GATE_TIME    "resultOutGateTime",
        TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
   from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
   left join TMSTRUCK_TOTAL_RESULT TTR

+ 4 - 0
src/main/resources/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.xml

@@ -1118,6 +1118,10 @@
             <if test="userIds!=null">
               AND ASO.UPDATE_USERNAME=#{userIds}
             </if>
+            <if test="con!=null">
+                where "orderNumber" like #{con} or "capacityNumber" like #{con}
+                or "gatepostName" like #{con}  or  "materialName" like #{con}
+            </if>
         )
         <where>
             <if test="orderNumber != null">

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

@@ -1323,9 +1323,9 @@
     RM.MATERIAL_NAME            "materialName",
     OO.ORDER_NUMBER             "orderNumber",
     RC.CAPACITY_NUMBER          "capacityNumber",
-    to_char(TLR.RESULT_LOAD_START_TIME, 'yyyy-mm-dd hh:mm:ss')   "resultLoadStartTime",
+    TLR.RESULT_LOAD_START_TIME   "resultLoadStartTime",
     RW.WAREHOUSE_NAME           "warehouseName",
-    to_char(TLR.RESULT_LOAD_END_TIME, 'yyyy-mm-dd hh:mm:ss')  "resultLoadEndTime",
+    TLR.RESULT_LOAD_END_TIME   "resultLoadEndTime",
     TLR.RESULT_LOAD_DURATION  "loadDuration"
     FROM TMSTRUCK_LOAD_RESULT TLR
     LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR

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

@@ -796,7 +796,7 @@
         RC.CAPACITY_NUMBER    "capacityNumber",
         RM.MATERIAL_NAME      "materialName",
         RW.WAREHOUSE_NAME     "warehouseName",
-        to_char(TUR.RESULT_END_TIME, 'yyyy-mm-dd hh:mm:ss')   "resultEndTime"
+        TUR.RESULT_END_TIME   "resultEndTime"
         FROM TMSTRUCK_UNLOAD_RESULT TUR
         LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
         ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID