Ver Fonte

整改快照

zhuang há 8 meses atrás
pai
commit
b9ac7a7d1e

+ 17 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxProjectManageServiceImpl.java

@@ -47,6 +47,8 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -1865,7 +1867,9 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
                 .eq(ZhcxProjectRectifySnapDo::getProjectid, projectId)
                 .eq(ZhcxProjectRectifySnapDo::getMachineno, machineNo)
                 .eq(ZhcxProjectRectifySnapDo::getDeleted, "0")
-                .between(ZhcxProjectRectifySnapDo::getDate, LocalDateTime.now().minusDays(30), LocalDateTime.now());
+                .between(ZhcxProjectRectifySnapDo::getDate,
+                        Date.from(LocalDateTime.now().minusDays(29).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant())
+                        , Date.from(LocalDateTime.now().toLocalDate().atTime(LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant()));
         //IPage<ZhcxProjectRectifySnapDo> pageData = zhcxProjectRectifySnapService.page(page, eq);
 //        List<ZhcxProjectRectifySnapDo> list = pageData.getRecords();
 //        Long total = pageData.getTotal();  // 总记录数
@@ -1926,6 +1930,18 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
             if (dataList != null) {
                 // 按 date 字段倒序排序
                 dataList.sort(Comparator.comparing(ZhcxProjectRectifySnapDo::getDate, Comparator.nullsLast(Comparator.reverseOrder())));
+                sortedDateList.forEach(date -> {
+                    if (dataList.stream().noneMatch(data -> {
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
+                        String formattedDate = sdf.format(data.getDate());
+                        return formattedDate.equals(date); // 假设 date 是一个字符串,格式为 "yyyy-MM-dd"
+                    })) {
+                        ZhcxProjectRectifySnapDo zhcxProjectRectifySnapDo = new ZhcxProjectRectifySnapDo();
+                        zhcxProjectRectifySnapDo.setDate(new Date(date)); // 将字符串 date 转换为 Date 对象
+                        dataList.add(zhcxProjectRectifySnapDo);
+                    }
+                });
+
             }
         });
         rectifySnapDto.setDateList(sortedDateList);