Browse Source

创建时间转换格式

Qchen 1 năm trước cách đây
mục cha
commit
c02717a1ea

+ 9 - 2
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java

@@ -41,7 +41,9 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.*;
 import java.util.function.Consumer;
 import java.util.function.Consumer;
@@ -143,14 +145,19 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
             ptlAgreementProductCostsNewLambdaQueryWrapper
             ptlAgreementProductCostsNewLambdaQueryWrapper
                     .ge(PtlAgreementProductCostsNew::getCostsEndDate, agreementProductQueryVo.getCostsEndDate());
                     .ge(PtlAgreementProductCostsNew::getCostsEndDate, agreementProductQueryVo.getCostsEndDate());
         }
         }
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         // 创建时间
         // 创建时间
         if (agreementProductQueryVo.getCreateStartTime() != null) {
         if (agreementProductQueryVo.getCreateStartTime() != null) {
+            LocalDate startDate = LocalDate.parse(agreementProductQueryVo.getCreateStartTime(), formatter);
+            LocalDateTime startDateTime = LocalDateTime.of(startDate, LocalTime.MIN);
             ptlAgreementProductCostsNewLambdaQueryWrapper
             ptlAgreementProductCostsNewLambdaQueryWrapper
-                    .ge(PtlAgreementProductCostsNew::getCreateTime, agreementProductQueryVo.getCreateStartTime());
+                    .ge(PtlAgreementProductCostsNew::getCreateTime, startDateTime);
         }
         }
         if (agreementProductQueryVo.getCreateEndTime() != null) {
         if (agreementProductQueryVo.getCreateEndTime() != null) {
+            LocalDate endDate = LocalDate.parse(agreementProductQueryVo.getCreateEndTime(), formatter);
+            LocalDateTime endDateTime = LocalDateTime.of(endDate, LocalTime.MAX);
             ptlAgreementProductCostsNewLambdaQueryWrapper
             ptlAgreementProductCostsNewLambdaQueryWrapper
-                    .le(PtlAgreementProductCostsNew::getCreateTime, agreementProductQueryVo.getCreateEndTime());
+                    .le(PtlAgreementProductCostsNew::getCreateTime, endDateTime);
         }
         }
         //是否有效  1失效  2 有效
         //是否有效  1失效  2 有效
         if (agreementProductQueryVo.getIsEffective() != null) {
         if (agreementProductQueryVo.getIsEffective() != null) {