luobang 3 rokov pred
rodič
commit
01ba7b29f1

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

@@ -5,6 +5,7 @@ import com.steerinfo.dil.mapper.OmstruckOrderMapper;
 import com.steerinfo.dil.service.IOmstruckOrderService;
 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;
@@ -16,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 
@@ -47,6 +49,7 @@ public class OmstruckOrderController extends BaseRESTfulController {
     OmstruckOrderMapper omstruckOrderMapper;
 
 
+    private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     /**
      * 展示承运商接收销售公司已接受的销售订单
      *
@@ -1097,14 +1100,19 @@ public class OmstruckOrderController extends BaseRESTfulController {
                                                   Integer pageSize,
                                                   Integer orderStatus,
                                                   String carrierId,
-                                                  String con) {
+                                                  String con,
+                                                    String startTime,String endTime) {
         if (mapValue == null) {
             mapValue = new HashMap<>();
         }
         if (carrierId != null && !"undefined".equals(carrierId)) {
             mapValue.put("carrierId",carrierId);
         }
+        if(con != null && !"null".equals(con)){
+            mapValue.put("con","%" + con  + "%");
+        }
         mapValue.put("orderStatus",(orderStatus));
+        DataChange.queryDataByDateTime(startTime, endTime, mapValue,sdfDateTime);//根据时间段查询数据
         PageHelper.startPage(pageNum,pageSize);
         List<Map<String, Object>> columnList = omstruckOrderService.getInwardOrderList(mapValue);
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,columnList);

+ 72 - 4
src/main/java/com/steerinfo/dil/util/DataChange.java

@@ -14,8 +14,6 @@ import java.util.Map;
  */
 
 public class DataChange {
-
-
     /**
      * 解析前端传来的日期字符串
      * @param vueDate
@@ -72,7 +70,7 @@ public class DataChange {
         if(date == null)
             return null;
         try{
-             changeDate = (Date) date;
+            changeDate = (Date) date;
         }catch (Exception e){
             e.printStackTrace();
         }
@@ -167,7 +165,7 @@ public class DataChange {
     }
 
     /**
-     * 根据时间段查询数据
+     * 根据时间段查询数据 支持只选择单个时间
      * @Author TXF
      * @Date 2022/1/10 23:21
      * @param startTime
@@ -188,4 +186,74 @@ public class DataChange {
             map.put("oneDate", sdf.format(new Date()));
         }
     }
+
+    /**
+     * 只支持两个时间查询
+     * @Author TXF
+     * @Date 2022/1/15 9:08
+     * @param startTime
+     * @param endTime
+     * @param sdf
+     * @return
+     **/
+    public static void queryDataByDateTime(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 {
+            //如果两者时间都为空,则查询当天数据
+            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("startDate", dayStartTime + " 00:00:00");
+        map.put("endDate", dayEndTime + " 00:00:00");
+    }
+
+    /**
+     * 生成带时间的八位数顺序号
+     * @param start 前缀
+     * @param id 顺序号  主键Id
+     * @return
+     */
+    public static String generateEightDigitsNumber(String start, Integer id,String pot){
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        StringBuilder sb = new StringBuilder(start + pot + sdf.format(new Date()) + pot);
+        sb.append(
+                id < 10
+                        ? "0000000" + id : id < 100
+                        ? "000000" + id : id < 1000
+                        ? "00000" + id : id < 10000
+                        ? "0000" + id : id < 100000
+                        ? "000" + id : id < 1000000
+                        ? "00" + id : id < 10000000
+                        ? "0" + id : id.toString()
+        );
+        return sb.toString();
+    }
 }

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

@@ -11,7 +11,7 @@ spring:
 #feign设置
 openfeign:
   ColumnDataFeign:
-    url: ${COLUMNDATAFEIGN_URL:172.16.33.166:8083}
+    url: ${COLUMNDATAFEIGN_URL:172.16.33.161:8083}
   TmsTruckFeign:
     url: ${TMSTRUCKFEIGN_URL:172.16.33.166:8088}
   AmsFeign:

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

@@ -2734,7 +2734,8 @@
         AIP.INSERT_TIME                    AS "insertTime",
         RW.WAREHOUSE_NAME                  AS "unloadName",
         RW1.WAREHOUSE_NAME                 AS "loadName",
-        RM.MATERIAL_NAME                   AS "materialName"
+        RM.MATERIAL_NAME                   AS "materialName",
+        RC.CAPACITY_NUMBER || RM.MATERIAL_NAME || RW1.WAREHOUSE_NAME || RW.WAREHOUSE_NAME "likeCon"
         FROM OMSTRUCK_ORDER OO
         LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
         ON OOM.ORDER_ID = OO.ORDER_ID
@@ -2765,8 +2766,18 @@
         <if test="orderStatus != null">
             AND OO.ORDER_STATUS = #{orderStatus}
         </if>
+        <if test="oneDate != null">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= OO.INSERT_TIME
+        </if>
+        <if test="startDate != null">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= OO.INSERT_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= OO.INSERT_TIME
+        </if>
         )
         <where>
+            <if test="con != null">
+                and "likeCon" like #{con}
+            </if>
             <if test="materialNumber != null">
                 and
                 <foreach collection="materialNumber" item="item" open="(" separator="or" close=")">