Quellcode durchsuchen

修改统计报表时间段查询

txf vor 3 Jahren
Ursprung
Commit
ff54cbd168

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

@@ -3,6 +3,7 @@ package com.steerinfo.dil.controller;
 import com.steerinfo.dil.service.impl.StatisticalReportImpl;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.dil.util.ColumnDataUtil;
+import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.dil.util.PageListAdd;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageHelper;
@@ -15,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -34,6 +37,8 @@ public class StatisticalReportController extends BaseRESTfulController {
     @Autowired
     ColumnDataUtil columnDataUtil;
 
+    private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
     @ApiOperation(value="查询辅料燃料统计报表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
@@ -47,9 +52,12 @@ public class StatisticalReportController extends BaseRESTfulController {
                                                Integer apiId,
                                                Integer pageNum,
                                                Integer pageSize,
+                                               String startTime,
+                                               String endTime,
                                                Integer orderType
     ){
         mapValue.put("orderTypee", orderType);
+        DataChange.queryDataByDate(startTime, endTime, mapValue, sdf);//根据时间段查询数据
         List<Map<String, Object>> allReport =  statisticalReportService.getAllPurchaseFLRLReport(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
@@ -71,6 +79,8 @@ public class StatisticalReportController extends BaseRESTfulController {
                                        Integer apiId,
                                        Integer pageNum,
                                        Integer pageSize,
+                                       String startTime,
+                                       String endTime,
                                        String carrierSsoId
     ){
         if(carrierSsoId != null){
@@ -78,6 +88,7 @@ public class StatisticalReportController extends BaseRESTfulController {
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
+        DataChange.queryDataByDate(startTime, endTime, mapValue, sdf);//根据时间段查询数据
         List<Map<String, Object>> allReport =  statisticalReportService.getAllSaleReportNum(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
@@ -99,6 +110,8 @@ public class StatisticalReportController extends BaseRESTfulController {
                                           Integer apiId,
                                           Integer pageNum,
                                           Integer pageSize,
+                                          String startTime,
+                                          String endTime,
                                           String carrierSsoId
     ){
         if(carrierSsoId != null){
@@ -106,6 +119,7 @@ public class StatisticalReportController extends BaseRESTfulController {
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
+        DataChange.queryDataByDate(startTime, endTime, mapValue, sdf);//根据时间段查询数据
         List<Map<String, Object>> allReport =  statisticalReportService.getSporadicSuppliesReportNum1(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
@@ -127,6 +141,8 @@ public class StatisticalReportController extends BaseRESTfulController {
                                                    Integer apiId,
                                                    Integer pageNum,
                                                    Integer pageSize,
+                                                   String startTime,
+                                                   String endTime,
                                                    String carrierSsoId
     ){
         if(carrierSsoId != null){
@@ -134,6 +150,7 @@ public class StatisticalReportController extends BaseRESTfulController {
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
+        DataChange.queryDataByDate(startTime, endTime, mapValue, sdf);//根据时间段查询数据
         List<Map<String, Object>> allReport =  statisticalReportService.getSporadicSuppliesReportNum2(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页数据

+ 22 - 0
src/main/java/com/steerinfo/dil/util/DataChange.java

@@ -166,4 +166,26 @@ public class DataChange {
         return sb.toString();
     }
 
+    /**
+     * 根据时间段查询数据
+     * @Author TXF
+     * @Date 2022/1/10 23:21
+     * @param startTime
+     * @param endTime
+     * @param map
+     * @param sdf
+     * @return
+     **/
+    public static void queryDataByDate(String startTime, String endTime, Map<String, Object> map, SimpleDateFormat sdf){
+        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) + 86400000)));
+        } else if (startTime != null && !"null".equals(startTime)) {
+            map.put("oneDate", sdf.format(new Date(Long.parseLong(startTime))));
+        } else if (endTime != null && !"null".equals(endTime)) {
+            map.put("oneDate", sdf.format(new Date(Long.parseLong(endTime))));
+        } else {
+            map.put("oneDate", sdf.format(new Date()));
+        }
+    }
 }

+ 28 - 0
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -76,6 +76,13 @@
                        </if>
               where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
                 and OO.ORDER_TYPE = #{orderTypee}
+                    <if test="oneDate != null">
+                        and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
+                    </if>
+                    <if test="startDate != null">
+                        and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
+                        and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
+                    </if>
              )
         <where>
             <if test="orderNumber != null">
@@ -205,6 +212,13 @@
                           <if test="carrierSsoId != null">
                               and RCA.CARRIER_SSO_ID = #{carrierSsoId}
                           </if>
+                          <if test="oneDate != null">
+                              and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
+                          </if>
+                          <if test="startDate != null">
+                              and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
+                              and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
+                          </if>
              )
         <where>
             <if test="orderNumber != null">
@@ -348,6 +362,13 @@
         <if test="carrierSsoId != null">
             and RCA.CARRIER_SSO_ID = #{carrierSsoId}
         </if>
+        <if test="oneDate != null">
+            and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
+        </if>
+        <if test="startDate != null">
+            and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
+        </if>
         )
         <where>
             <if test="orderNumber != null">
@@ -491,6 +512,13 @@
         <if test="carrierSsoId != null">
             and RCA.CARRIER_SSO_ID = #{carrierSsoId}
         </if>
+        <if test="oneDate != null">
+            and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
+        </if>
+        <if test="startDate != null">
+            and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
+        </if>
         )
         <where>
             <if test="orderNumber != null">