Pārlūkot izejas kodu

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

luobang 2 gadi atpakaļ
vecāks
revīzija
fc124f3108

+ 24 - 228
src/main/java/com/steerinfo/dil/controller/StatisticalReportController.java

@@ -788,12 +788,12 @@ public class StatisticalReportController extends BaseRESTfulController {
         //初始化Map的值
         Map<String,Object> map1=new HashMap<>();
         map1.put("pinZhuang",null);
-        map1.put("chongQinSpellingData",0);
-        map1.put("chengDuSpellingData",0);
-        map1.put("gongChengSpellingData",0);
-        map1.put("chaungDongSpellingData",0);
-        map1.put("AllSpellingData",0);
-        Map<String,Object> map2=new HashMap<>();
+        map1.put("chongQinSpellingData",0);//重庆
+        map1.put("chengDuSpellingData",0);//成都
+        map1.put("gongChengSpellingData",0);//工程
+        map1.put("chaungDongSpellingData",0);//川东
+        map1.put("AllSpellingData",0);//合计
+        Map<String,Object> map2=new HashMap<>();//
         map2.put("pinZhuang",null);
         map2.put("chongQinSpellingData",0);
         map2.put("chengDuSpellingData",0);
@@ -852,230 +852,26 @@ public class StatisticalReportController extends BaseRESTfulController {
         spellingData.get(4).put("pinZhuang","五拼");
         spellingData.get(5).put("pinZhuang","六拼");
         spellingData.get(6).put("pinZhuang","合计");
-        for (Map<String, Object> stringObjectMap : report) {
-            int flag=0;
-            String areaName = (String) stringObjectMap.get("areaName");
-            //销售订单号
-            if (areaName==null){
+        for (Map<String, Object> item : report) {
+            String areaName=""+item.get("areaName");
+            int speNum=Integer.parseInt(""+item.get("speNum"));
+            int total=Integer.parseInt(""+item.get("total"));
+            //过滤无片区、拼装不在1-6之间的数据
+            if(areaName==null || areaName.equals("") || speNum >= 7 || speNum <=0){
                 continue;
             }
-            BigDecimal spellingNum =  DataChange.dataToBigDecimal(stringObjectMap.get("spellingNum"));
-            if (spellingNum.compareTo(BigDecimal.valueOf(1))==0){
-                if (areaName.equals("钢材重庆组")){
-                    Integer oneSpellingData = (Integer) spellingData.get(0).get("chongQinSpellingData");
-                    if (spellingData.get(0).get("chongQinSpellingData")!=null){
-                        spellingData.get(0).put("chongQinSpellingData",oneSpellingData+1);
-                    }else {
-                        spellingData.get(0).put("chongQinSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材成都组")){
-                    Integer oneSpellingData1 = (Integer) spellingData.get(0).get("chengDuSpellingData");
-                    if (spellingData.get(0).get("chengDuSpellingData")!=null){
-                        spellingData.get(0).put("chengDuSpellingData",oneSpellingData1+1);
-                    }else {
-                        spellingData.get(0).put("chengDuSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材工程组")){
-                    Integer oneSpellingData2 = (Integer) spellingData.get(0).get("gongChengSpellingData");
-                    if (spellingData.get(0).get("gongChengSpellingData")!=null){
-                        spellingData.get(0).put("gongChengSpellingData",oneSpellingData2+1);
-                    }else {
-                        spellingData.get(0).put("gongChengSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
-                    Integer oneSpellingData3 = (Integer) spellingData.get(0).get("chaungDongSpellingData");
-                    if (oneSpellingData3!=null){
-                        spellingData.get(0).put("chaungDongSpellingData",oneSpellingData3+1);
-                    }else {
-                        spellingData.get(0).put("chaungDongSpellingData",1);
-                    }
-                }
-                Integer oneSpellingData4 = (Integer) spellingData.get(0).get("AllSpellingData");
-                if (oneSpellingData4!=null){
-                    spellingData.get(0).put("AllSpellingData",oneSpellingData4+1);
-                }else {
-                    spellingData.get(0).put("AllSpellingData",1);
-                }
-            }else if (spellingNum.compareTo(BigDecimal.valueOf(2))==0){
-                if (areaName.equals("钢材重庆组")){
-                    Integer oneSpellingData = (Integer) spellingData.get(1).get("chongQinSpellingData");
-                    if (oneSpellingData!=null){
-                        spellingData.get(1).put("chongQinSpellingData",oneSpellingData+1);
-                    }else {
-                        spellingData.get(1).put("chongQinSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材成都组")){
-                    Integer oneSpellingData1 = (Integer) spellingData.get(1).get("chengDuSpellingData");
-                    if (oneSpellingData1!=null){
-                        spellingData.get(1).put("chengDuSpellingData",oneSpellingData1+1);
-                    }else {
-                        spellingData.get(1).put("chengDuSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材工程组")){
-                    Integer oneSpellingData2 = (Integer) spellingData.get(1).get("gongChengSpellingData");
-                    if (oneSpellingData2!=null){
-                        spellingData.get(1).put("gongChengSpellingData",oneSpellingData2+1);
-                    }else {
-                        spellingData.get(1).put("gongChengSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
-                    Integer oneSpellingData3 = (Integer) spellingData.get(1).get("chaungDongSpellingData");
-                    if (oneSpellingData3!=null){
-                        spellingData.get(1).put("chaungDongSpellingData",oneSpellingData3+1);
-                    }else {
-                        spellingData.get(1).put("chaungDongSpellingData",1);
-                    }
-                }
-                Integer oneSpellingData4 = (Integer) spellingData.get(1).get("AllSpellingData");
-                if (oneSpellingData4!=null){
-                    spellingData.get(1).put("AllSpellingData",oneSpellingData4+1);
-                }else {
-                    spellingData.get(1).put("AllSpellingData",1);
-                }
-            }else if (spellingNum.compareTo(BigDecimal.valueOf(3))==0){
-                if (areaName.equals("钢材重庆组")){
-                    Integer oneSpellingData = (Integer) spellingData.get(2).get("chongQinSpellingData");
-                    if (oneSpellingData!=null){
-                        spellingData.get(2).put("chongQinSpellingData",oneSpellingData+1);
-                    }else {
-                        spellingData.get(2).put("chongQinSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材成都组")){
-                    Integer oneSpellingData1 = (Integer) spellingData.get(2).get("chengDuSpellingData");
-                    if (oneSpellingData1!=null){
-                        spellingData.get(2).put("chengDuSpellingData",oneSpellingData1+1);
-                    }else {
-                        spellingData.get(2).put("chengDuSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材工程组")){
-                    Integer oneSpellingData2 = (Integer) spellingData.get(2).get("gongChengSpellingData");
-                    if (oneSpellingData2!=null){
-                        spellingData.get(2).put("gongChengSpellingData",oneSpellingData2+1);
-                    }else {
-                        spellingData.get(2).put("gongChengSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
-                    Integer oneSpellingData3 = (Integer) spellingData.get(2).get("chaungDongSpellingData");
-                    if (oneSpellingData3!=null){
-                        spellingData.get(2).put("chaungDongSpellingData",oneSpellingData3+1);
-                    }else {
-                        spellingData.get(2).put("chaungDongSpellingData",1);
-                    }
-                }
-                Integer oneSpellingData4 = (Integer) spellingData.get(2).get("AllSpellingData");
-                if (oneSpellingData4!=null){
-                    spellingData.get(2).put("AllSpellingData",oneSpellingData4+1);
-                }else {
-                    spellingData.get(2).put("AllSpellingData",1);
-                }
-            }else if (spellingNum.compareTo(BigDecimal.valueOf(4))==0){
-                if (areaName.equals("钢材重庆组")){
-                    Integer oneSpellingData = (Integer) spellingData.get(3).get("chongQinSpellingData");
-                    if (oneSpellingData!=null){
-                        spellingData.get(3).put("chongQinSpellingData",oneSpellingData+1);
-                    }else {
-                        spellingData.get(3).put("chongQinSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材成都组")){
-                    Integer oneSpellingData1 = (Integer) spellingData.get(3).get("chengDuSpellingData");
-                    if (oneSpellingData1!=null){
-                        spellingData.get(3).put("chengDuSpellingData",oneSpellingData1+1);
-                    }else {
-                        spellingData.get(3).put("chengDuSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材工程组")){
-                    Integer oneSpellingData2 = (Integer) spellingData.get(3).get("gongChengSpellingData");
-                    if (oneSpellingData2!=null){
-                        spellingData.get(3).put("gongChengSpellingData",oneSpellingData2+1);
-                    }else {
-                        spellingData.get(3).put("gongChengSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
-                    Integer oneSpellingData3 = (Integer) spellingData.get(3).get("chaungDongSpellingData");
-                    if (oneSpellingData3!=null){
-                        spellingData.get(3).put("chaungDongSpellingData",oneSpellingData3+1);
-                    }else {
-                        spellingData.get(3).put("chaungDongSpellingData",1);
-                    }
-                }
-                Integer oneSpellingData4 = (Integer) spellingData.get(3).get("AllSpellingData");
-                if (oneSpellingData4!=null){
-                    spellingData.get(3).put("AllSpellingData",oneSpellingData4+1);
-                }else {
-                    spellingData.get(3).put("AllSpellingData",1);
-                }
-            }else if (spellingNum.compareTo(BigDecimal.valueOf(5))==0){
-                if (areaName.equals("钢材重庆组")){
-                    Integer oneSpellingData = (Integer) spellingData.get(4).get("chongQinSpellingData");
-                    if (oneSpellingData!=null){
-                        spellingData.get(4).put("chongQinSpellingData",oneSpellingData+1);
-                    }else {
-                        spellingData.get(4).put("chongQinSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材成都组")){
-                    Integer oneSpellingData1 = (Integer) spellingData.get(4).get("chengDuSpellingData");
-                    if (oneSpellingData1!=null){
-                        spellingData.get(4).put("chengDuSpellingData",oneSpellingData1+1);
-                    }else {
-                        spellingData.get(4).put("chengDuSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材工程组")){
-                    Integer oneSpellingData2 = (Integer) spellingData.get(4).get("gongChengSpellingData");
-                    if (oneSpellingData2!=null){
-                        spellingData.get(4).put("gongChengSpellingData",oneSpellingData2+1);
-                    }else {
-                        spellingData.get(4).put("gongChengSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
-                    Integer oneSpellingData3 = (Integer) spellingData.get(4).get("chaungDongSpellingData");
-                    if (oneSpellingData3!=null){
-                        spellingData.get(4).put("chaungDongSpellingData",oneSpellingData3+1);
-                    }else {
-                        spellingData.get(4).put("chaungDongSpellingData",1);
-                    }
-                }
-                Integer oneSpellingData4 = (Integer) spellingData.get(4).get("AllSpellingData");
-                if (oneSpellingData4!=null){
-                    spellingData.get(4).put("AllSpellingData",oneSpellingData4+1);
-                }else {
-                    spellingData.get(4).put("AllSpellingData",1);
-                }
-            }else if (spellingNum.compareTo(BigDecimal.valueOf(6))==0){
-                if (areaName.equals("钢材重庆组")){
-                    Integer oneSpellingData = (Integer) spellingData.get(5).get("chongQinSpellingData");
-                    if (oneSpellingData!=null){
-                        spellingData.get(5).put("chongQinSpellingData",oneSpellingData+1);
-                    }else {
-                        spellingData.get(5).put("chongQinSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材成都组")){
-                    Integer oneSpellingData1 = (Integer) spellingData.get(5).get("chengDuSpellingData");
-                    if (oneSpellingData1!=null){
-                        spellingData.get(5).put("chengDuSpellingData",oneSpellingData1+1);
-                    }else {
-                        spellingData.get(5).put("chengDuSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材工程组")){
-                    Integer oneSpellingData2 = (Integer) spellingData.get(5).get("gongChengSpellingData");
-                    if (oneSpellingData2!=null){
-                        spellingData.get(5).put("gongChengSpellingData",oneSpellingData2+1);
-                    }else {
-                        spellingData.get(5).put("gongChengSpellingData",1);
-                    }
-                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
-                    Integer oneSpellingData3 = (Integer) spellingData.get(5).get("chaungDongSpellingData");
-                    if (oneSpellingData3!=null){
-                        spellingData.get(5).put("chaungDongSpellingData",oneSpellingData3+1);
-                    }else {
-                        spellingData.get(5).put("chaungDongSpellingData",1);
-                    }
-                }
-                Integer oneSpellingData4 = (Integer) spellingData.get(5).get("AllSpellingData");
-                if (oneSpellingData4!=null){
-                    spellingData.get(5).put("AllSpellingData",oneSpellingData4+1);
-                }else {
-                    spellingData.get(5).put("AllSpellingData",1);
-                }
+            if(areaName.contains("重庆")){
+                spellingData.get(speNum-1).put("chongQinSpellingData",total);
+                spellingData.get(speNum-1).put("AllSpellingData",total+(int) spellingData.get(speNum-1).get("AllSpellingData"));
+            }else if(areaName.contains("成都")){
+                spellingData.get(speNum-1).put("chengDuSpellingData",total);
+                spellingData.get(speNum-1).put("AllSpellingData",total+(int) spellingData.get(speNum-1).get("AllSpellingData"));
+            }else if(areaName.contains("工程")){
+                spellingData.get(speNum-1).put("gongChengSpellingData",total);
+                spellingData.get(speNum-1).put("AllSpellingData",total+(int) spellingData.get(speNum-1).get("AllSpellingData"));
+            }else if(areaName.contains("川东")){
+                spellingData.get(speNum-1).put("chaungDongSpellingData",total);
+                spellingData.get(speNum-1).put("AllSpellingData",total+(int) spellingData.get(speNum-1).get("AllSpellingData"));
             }
         }
         //每一列的合计

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

@@ -78,7 +78,7 @@ public class TmstruckEnfactoryResultController extends BaseRESTfulController {
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> enFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
-        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,enFactoryResult);
+        PageListAdd pageList = columnDataUtil.tableColumnData4(apiId, null,enFactoryResult);
         return success(pageList);
     }
 

+ 14 - 53
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -2268,76 +2268,37 @@
     </select>
 
     <select id="getSaleSteelSpellingReport" resultType="java.util.Map" parameterType="java.util.Map">
-        SELECT distinct OO.ORDER_ID "orderId",
-        ASO.SALE_ORDER_ID "saleOrderId",
-        to_char(ASOM.SALE_DATE_OF_RECEIPT - 1, 'yyyy-mm-dd') "orderTime",
-        ASO.SALE_NUMBER "saleOrderNo",
-        (SELECT COUNT(A_SM.SALE_MATERIAL_ID) FROM OMSTRUCK_ORDER O_O
-        LEFT JOIN AMS_SALE_ORDER_MATERIAL A_SOM
-        ON O_O.ORDER_PLAN_ID = A_SOM.SALE_ORDER_MATERIAL_ID
-        LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL A_STM
-        ON A_STM.SALE_ORDER_MATERIAL_ID = A_SOM.SALE_ORDER_MATERIAL_ID
-        LEFT JOIN AMS_SALE_MATERIAL A_SM
-        ON A_SM.SALE_MATERIAL_ID = A_STM.MATERIAL_ID
-        WHERE O_O.ORDER_ID=OO.ORDER_ID
-        ) "spellingNum",
-        RSA.AREA_NAME "areaName"
+        SELECT
+        "areaName",
+        "speNum",
+        COUNT("orderId") "total"
+        FROM (
+        SELECT
+        ASM.TRANSFER_OUT_OF_WAREHOUSE "areaName",
+        OO .ORDER_ID "orderId",
+        COUNT(ASOM.SALE_ORDER_MATERIAL_ID) "speNum"
         FROM AMS_SALE_ORDER ASO
-        LEFT JOIN RMS_CONSIGNEE RC
-        ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
-        LEFT JOIN RMS_SHIPPER RS
-        ON RS.SHIPPER_ID = ASO.SHIPPER_ID
-        LEFT JOIN RMS_SALE_AREA RSA
-        ON RSA.AREA_ID = RC.AREA_ID
-        LEFT JOIN RMS_SALER RSR
-        ON RSR.SALER_ID = ASO.SALER_ID
         LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
         ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
-        LEFT JOIN RMS_RECEIVE_PLACE RRP
-        ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
-        LEFT JOIN RMS_RECEIVE_ADDRESS RRA
-        ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
-        LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
-        ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
-        LEFT JOIN RMS_CARRIER R_CARRIER
-        ON R_CARRIER.CARRIER_ID = ADSO.CARRIER_ID
         LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
         ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
         LEFT JOIN AMS_SALE_MATERIAL ASM
         ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
-        LEFT JOIN RMS_MATERIAL RM
-        ON RM.MATERIAL_ID = ASM.MATERIAL_ID
         LEFT JOIN OMSTRUCK_ORDER OO
         ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
         AND NVL(OO.ORDER_TYPE, 0) in (0, 1)
-        LEFT JOIN RMS_CAPACITY RCA
-        ON RCA.CAPACITY_ID = OO.CAPACITY_ID
-        LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
-        ON TTR.ORDER_ID = OO.ORDER_ID
-        LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
-        ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
-        ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        AND TWR.MATERIAL_ID = RM.MATERIAL_ID
-        LEFT JOIN BMSTRUCK_DETAILS_ORDER BDO
-        ON BDO.WEIGHT_TASK_RESULT_ID = TWR.WEIGHT_TASK_RESULT_ID
-        LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE actp
-        ON actp.PRICE_ID = OO.PRICE_ID
-        LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
-        ON TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        LEFT JOIN TMSTRUCK_ARRIVAL_RESULT TAR
-        ON TAR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        LEFT JOIN TMStRUCK_RECEIPT_RESULT TRR
-        ON TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
         WHERE ASO.SALE_TYPE = 1
+        AND OO.ORDER_STATUS IN (4,5,2)
         AND ASO.DELETED = 0
         and ASM.SALE_MATERIAL_ID IS NOT NULL
         <if test="startTime != null">
             and to_date(#{startTime},'yyyy-mm-dd hh24:mi:ss') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')
             and to_date(#{endTime}, 'yyyy-mm-dd hh24:mi:ss') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')
         </if>
-        order by ASO.SALE_ORDER_ID  DESC,
-        OO.ORDER_ID DESC
+        GROUP BY ASM.TRANSFER_OUT_OF_WAREHOUSE,OO .ORDER_ID
+        )
+        GROUP BY "areaName","speNum"
+        ORDER BY "areaName","speNum"
     </select>
 
     <select id="getSaleSteelReportNew" resultType="java.util.Map" parameterType="java.util.Map">