zelong.shao

customer|查询调整

1 package com.fedex.connect.customer.data.query; 1 package com.fedex.connect.customer.data.query;
2 2
3 -import com.fedex.connect.common.dependencies.util.DateUtil;
4 import com.fedex.connect.common.dependencies.util.Utils; 3 import com.fedex.connect.common.dependencies.util.Utils;
5 import com.fedex.connect.customer.data.PageBase; 4 import com.fedex.connect.customer.data.PageBase;
6 import lombok.Data; 5 import lombok.Data;
7 import org.springframework.util.CollectionUtils; 6 import org.springframework.util.CollectionUtils;
8 7
9 import java.time.LocalDate; 8 import java.time.LocalDate;
10 -import java.time.ZoneId; 9 +import java.time.format.DateTimeFormatter;
11 -import java.util.Date;
12 import java.util.List; 10 import java.util.List;
13 11
14 /** 12 /**
...@@ -28,11 +26,20 @@ public class ConsignmentQuery extends PageBase { ...@@ -28,11 +26,20 @@ public class ConsignmentQuery extends PageBase {
28 query.setCreateTimeFrom(null); 26 query.setCreateTimeFrom(null);
29 query.setCreateTimeTo(null); 27 query.setCreateTimeTo(null);
30 } 28 }
31 - //如果没有输入查询条件,则默认查三天的数据 29 + if (Utils.isEmpty(query.getCreateTimeFrom()) && Utils.isEmpty(query.getCreateTimeTo())) {
32 - if (CollectionUtils.isEmpty(query.getConsignmentCodeList()) && Utils.isEmpty(query.getConsignmentCode())){ 30 + // 获取当前日期,减去3天
33 LocalDate localDate = LocalDate.now().minusDays(3); 31 LocalDate localDate = LocalDate.now().minusDays(3);
34 - query.setCreateTimeFrom(DateUtil.timeFormat(Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()))); 32 +
35 - query.setCreateTimeTo(DateUtil.timeFormat(new Date())); 33 + // 设置 createTimeFrom 为 3 天前的日期(不带时分秒)
34 + String createTimeFrom = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
35 + query.setCreateTimeFrom(createTimeFrom);
36 +
37 + // 获取当前日期(不带时分秒)
38 + LocalDate currentDate = LocalDate.now();
39 +
40 + // 设置 createTimeTo 为今天的日期(不带时分秒)
41 + String createTimeTo = currentDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
42 + query.setCreateTimeTo(createTimeTo);
36 } 43 }
37 query.setStart(query.getStart()); 44 query.setStart(query.getStart());
38 return query; 45 return query;
......
...@@ -51,10 +51,10 @@ ...@@ -51,10 +51,10 @@
51 AND c.STATUS_CODE = #{statusCode} 51 AND c.STATUS_CODE = #{statusCode}
52 </if> 52 </if>
53 <if test="createTimeFrom != null and createTimeFrom != ''"> 53 <if test="createTimeFrom != null and createTimeFrom != ''">
54 - AND c.CREATE_TIME &gt;= TO_DATE(#{createTimeFrom}, 'YYYY-MM-DD HH24:MI:SS') 54 + AND c.CREATE_TIME &gt; TO_DATE(#{createTimeFrom} || ' 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
55 </if> 55 </if>
56 <if test="createTimeTo != null and createTimeTo != ''"> 56 <if test="createTimeTo != null and createTimeTo != ''">
57 - AND c.CREATE_TIME &lt;= TO_DATE(#{createTimeTo}, 'YYYY-MM-DD HH24:MI:SS') 57 + AND c.CREATE_TIME &lt; TO_DATE(#{createTimeTo} || ' 23:59:59', 'YYYY-MM-DD HH24:MI:SS')
58 </if> 58 </if>
59 <if test="consignmentCodeList != null and consignmentCodeList.size() != 0"> 59 <if test="consignmentCodeList != null and consignmentCodeList.size() != 0">
60 AND c.CONSIGNMENT_CODE IN 60 AND c.CONSIGNMENT_CODE IN
...@@ -77,10 +77,10 @@ ...@@ -77,10 +77,10 @@
77 OR c.user_uuid = #{uuid,jdbcType=VARCHAR} 77 OR c.user_uuid = #{uuid,jdbcType=VARCHAR}
78 ) 78 )
79 <if test="createTimeFrom != null and createTimeFrom != ''"> 79 <if test="createTimeFrom != null and createTimeFrom != ''">
80 - AND c.CREATE_TIME &gt;= TO_DATE(#{createTimeFrom}, 'YYYY-MM-DD HH24:MI:SS') 80 + AND c.CREATE_TIME &gt; TO_DATE(#{createTimeFrom} || ' 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
81 </if> 81 </if>
82 <if test="createTimeTo != null and createTimeTo != ''"> 82 <if test="createTimeTo != null and createTimeTo != ''">
83 - AND c.CREATE_TIME &lt;= TO_DATE(#{createTimeTo}, 'YYYY-MM-DD HH24:MI:SS') 83 + AND c.CREATE_TIME &lt; TO_DATE(#{createTimeTo} || ' 23:59:59', 'YYYY-MM-DD HH24:MI:SS')
84 </if> 84 </if>
85 <if test="consignmentCodeList != null and consignmentCodeList.size() != 0"> 85 <if test="consignmentCodeList != null and consignmentCodeList.size() != 0">
86 AND c.CONSIGNMENT_CODE IN 86 AND c.CONSIGNMENT_CODE IN
...@@ -92,4 +92,5 @@ ...@@ -92,4 +92,5 @@
92 92
93 93
94 94
95 +
95 </mapper> 96 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......