Browse Source

销售统计报表

txf 3 years ago
parent
commit
d6df98e518

+ 28 - 0
src/main/java/com/steerinfo/dil/controller/StatisticalReportController.java

@@ -57,4 +57,32 @@ public class StatisticalReportController extends BaseRESTfulController {
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReport,report);
         return success(pageList);
     }
+
+    @ApiOperation(value="查询辅料燃料统计报表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
+            @ApiImplicitParam(name = "apiId(423)", value = "动态表头", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
+    })
+    @PostMapping("/getAllSaleReport")
+    public RESTfulResult getAllSaleReport(@RequestBody(required=false) Map<String,Object> mapValue,
+                                       Integer apiId,
+                                       Integer pageNum,
+                                       Integer pageSize,
+                                       String carrierSsoId
+    ){
+        if(carrierSsoId != null){
+            if("null".equals(carrierSsoId)){
+                mapValue.put("carrierSsoId", carrierSsoId);
+            }
+        }
+        List<Map<String, Object>> allReport =  statisticalReportService.getAllSaleReportNum(mapValue);
+        PageHelper.startPage(pageNum, pageSize);
+        //分页数据
+        List<Map<String, Object>> report = statisticalReportService.getAllSaleReport(mapValue);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReport, report);
+        return success(pageList);
+    }
 }

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

@@ -15,4 +15,6 @@ public interface StatisticalReportMapper {
     //查询采购统计报表 (辅料、燃料、内转)
     List<Map<String, Object>> getAllPurchaseFLRLReport(Map<String, Object> map);
 
+    //查询销售统计报表
+    List<Map<String, Object>> getAllSaleReport(Map<String, Object> map);
 }

+ 6 - 0
src/main/java/com/steerinfo/dil/service/IStatisticalReportService.java

@@ -16,4 +16,10 @@ public interface IStatisticalReportService {
 
     //查询采购统计报表 (辅料、燃料、内转)
     List<Map<String, Object>> getAllPurchaseFLRLReport(Map<String, Object> map);
+
+    //查询销售统计报表
+    List<Map<String, Object>> getAllSaleReport(Map<String, Object> map);
+
+    //查询销售统计报表
+    List<Map<String, Object>> getAllSaleReportNum(Map<String, Object> map);
 }

+ 42 - 15
src/main/java/com/steerinfo/dil/service/impl/StatisticalReportImpl.java

@@ -20,25 +20,34 @@ public class StatisticalReportImpl implements IStatisticalReportService {
     @Autowired
     StatisticalReportMapper statisticalReportMapper;
 
+
+    /**
+     * 计算相差时间
+     * @return
+     */
+    public void calculateDifferenceTime(Map<String, Object> mesMap){
+        Object resultEntryGateTime = mesMap.get("resultEntryGateTime");
+        Object resultOutGateTime = mesMap.get("resultOutGateTime");
+        if(resultEntryGateTime != null && resultOutGateTime != null){
+            Date enterDate = (Date) resultEntryGateTime;
+            Date outDate = (Date) resultOutGateTime;
+            //计算相差时间
+            long dTime = outDate.getTime() - enterDate.getTime();
+            mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
+        }
+        if(resultEntryGateTime != null && resultOutGateTime == null){
+            //如果没有出厂时间则以当前时间减去进厂时间
+            Date enterDate = (Date) resultEntryGateTime;
+            long dTime = new Date().getTime() - enterDate.getTime();
+            mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
+        }
+    }
+
     //查询辅料燃料统计报表
     public List<Map<String, Object>> getRLFLReport(Map<String, Object> map){
         List<Map<String, Object>> mapList = statisticalReportMapper.getAllPurchaseFLRLReport(map);
         for (Map<String, Object> mesMap : mapList) {
-            Object resultEntryGateTime = mesMap.get("resultEntryGateTime");
-            Object resultOutGateTime = mesMap.get("resultOutGateTime");
-            if(resultEntryGateTime != null && resultOutGateTime != null){
-                Date enterDate = (Date) resultEntryGateTime;
-                Date outDate = (Date) resultOutGateTime;
-                //计算相差时间
-                long dTime = outDate.getTime() - enterDate.getTime();
-                mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
-            }
-            if(resultEntryGateTime != null && resultOutGateTime == null){
-                //如果没有出厂时间则以当前时间减去进厂时间
-                Date enterDate = (Date) resultEntryGateTime;
-                long dTime = new Date().getTime() - enterDate.getTime();
-                mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
-            }
+            calculateDifferenceTime(mesMap);
         }
         return mapList;
     }
@@ -48,5 +57,23 @@ public class StatisticalReportImpl implements IStatisticalReportService {
         return statisticalReportMapper.getAllPurchaseFLRLReport(map);
     }
 
+    /**
+     * 查询销售统计报表
+     * @param map
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getAllSaleReport(Map<String, Object> map) {
+        List<Map<String, Object>> mapList = statisticalReportMapper.getAllSaleReport(map);
+        for (Map<String, Object> mesMap : mapList) {
+            calculateDifferenceTime(mesMap);
+        }
+        return mapList;
+    }
+
+    @Override
+    public List<Map<String, Object>> getAllSaleReportNum(Map<String, Object> map) {
+        return statisticalReportMapper.getAllSaleReport(map);
+    }
 
 }

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

@@ -102,8 +102,121 @@
             </if>
         </where>
         <include refid="orderBy"></include>
-        <if test="orderField == null  ">
+        <if test="orderField == null">
             order by "insertTimee" desc
         </if>
     </select>
+
+<!--  查询销售统计报表  -->
+    <select id="getAllSaleReport" parameterType="java.util.Map" resultType="java.util.Map">
+        select
+               *
+        from (
+                 select OO.ORDER_NUMBER              "orderNumber",
+                        RC.CAPACITY_NUMBER           "capacityNumber",
+                        TER.RESULT_ENTRY_GATE_TIME   "resultEntryGateTime",
+                        TWR.RESULT_TARE_WEIGHT_TIME  "resultTareWeightTime",
+                        TWR.RESULT_TARE_WEIGHT       "resultTareWeight",
+                        TLR.RESULT_LOAD_END_TIME     "resultLoadEndTime",
+                        RW.WAREHOUSE_NAME            "warehouseName",
+                        TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
+                        TWR.RESULT_GROSS_WEIGHT      "resultGrossWeight",
+                        TWR.RESULT_NET_WEIGHT        "resultNetWeight",
+                        TLFR.RESULT_OUT_GATE_TIME    "resultOutGateTime"
+                 from OMSTRUCK_ORDER OO
+                          join TMSTRUCK_TOTAL_RESULT TTR
+                               on TTR.ORDER_ID = OO.ORDER_ID
+                          join TMSTRUCK_LOAD_RESULT TLR
+                               on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+                          join RMS_WAREHOUSE RW
+                               on RW.WAREHOUSE_ID = TLR.LOADING_ID
+                          join TMSTRUCK_WEIGHT_RESULT TWR
+                               on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+                          join TMSTRUCK_ENFACTORY_RESULT TER
+                               on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+                          join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
+                               on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+                          join RMS_CAPACITY RC
+                               on RC.CAPACITY_ID = OO.CAPACITY_ID
+                          <if test="carrierSsoId != null">
+                              join RMS_CARRIER RCA
+                                on RCA.CARRIER_ID = RC.CARRIER_ID
+                          </if>
+                 where OO.ORDER_TYPE = 1
+                          <if test="carrierSsoId != null">
+                              and RCA.CARRIER_SSO_ID = #{carrierSsoId}
+                          </if>
+             )
+        <where>
+            <if test="orderNumber != null">
+                <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+                    "orderNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="capacityNumber != null">
+                and
+                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+                    "capacityNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultEntryGateTime != null">
+                and
+                <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
+                    "resultEntryGateTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultTareWeightTime != null">
+                and
+                <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
+                    "resultTareWeightTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultTareWeight != null">
+                and
+                <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
+                    "resultTareWeight" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultLoadEndTime != null">
+                and
+                <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
+                    "resultLoadEndTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="warehouseName != null">
+                and
+                <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
+                    "warehouseName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultGrossWeightTime != null">
+                and
+                <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
+                    "resultGrossWeightTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultGrossWeight != null">
+                and
+                <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
+                    "resultGrossWeight" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultNetWeight != null">
+                and
+                <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
+                    "resultNetWeight" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultOutGateTime != null">
+                and
+                <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
+                    "resultOutGateTime" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+        <include refid="orderBy"></include>
+        <if test="orderField == null">
+            order by "resultOutGateTime" desc, "resultEntryGateTime" desc
+        </if>
+    </select>
 </mapper>