Procházet zdrojové kódy

快照功能调整

zhuang před 5 měsíci
rodič
revize
553235168d

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

@@ -2214,36 +2214,49 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
             snapList.forEach(snapVo -> {
                 List<ZhcxProjectRectifySnapVo> dataList = snapVo.getData();
                 if (dataList != null) {
-                    // 按 date 字段倒序排序
-                    dataList.sort(Comparator.comparing(ZhcxProjectRectifySnapVo::getDate, Comparator.nullsLast(Comparator.reverseOrder())));
+
                     sortedDateList.forEach(date -> {
-                        if (dataList.stream().noneMatch(data -> {
+                        boolean b = 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"
-                        })) {
+                            return formattedDate.equals(date);
+                        });
+                        if (b) {
                             ZhcxProjectRectifySnapVo zhcxProjectRectifySnapVo = new ZhcxProjectRectifySnapVo();
-                            zhcxProjectRectifySnapVo.setDate(new Date(date)); // 将字符串 date 转换为 Date 对象
+                            // 将字符串 date 转换为 Date 对象
+                            ZhcxProjectRectifySnapVo zhcxProjectRectifySnapVo1 = dataList.get(0);
+                            BeanUtil.copyProperties(zhcxProjectRectifySnapVo1, zhcxProjectRectifySnapVo);
+                            zhcxProjectRectifySnapVo.setDate(new Date());
+                            zhcxProjectRectifySnapVo.setRectifytotal(null);
+                            zhcxProjectRectifySnapVo.setTbcnum(null);
+                            zhcxProjectRectifySnapVo.setUnFinishNum(null);
+                            zhcxProjectRectifySnapVo.setNowFinishNum(null);
+                            zhcxProjectRectifySnapVo.setFinishnum(null);
+                            zhcxProjectRectifySnapVo.setInitstatus(false);
                             dataList.add(zhcxProjectRectifySnapVo);
                         }
                     });
+                    // 按 date 字段倒序排序
+                    dataList.sort(Comparator.comparing(ZhcxProjectRectifySnapVo::getDate, Comparator.nullsLast(Comparator.reverseOrder())));
                     for (int j = dataList.size() -1; j >= 0; j--) {
                         ZhcxProjectRectifySnapVo current = dataList.get(j);
-                        Integer rectifytotal = current.getRectifytotal() != null ? current.getRectifytotal() : 0;
-                        Integer finishnum = current.getFinishnum() != null ? current.getFinishnum() : 0;
-                        // 设置未完成数
-                        current.setUnFinishNum(rectifytotal - finishnum);
-
-                        // 设置当前完成数
-                        if (j < dataList.size() - 1) {
-                            // 前一个元素
-                            ZhcxProjectRectifySnapVo previous = dataList.get(j + 1);
-                            int i1 = previous.getUnFinishNum() == null ? 0 : previous.getUnFinishNum();
-                            int i2 = current.getUnFinishNum() == null ? 0 : current.getUnFinishNum();
-                            current.setNowFinishNum(i1 - i2);
-                        } else {
-                            // 第一条记录没有 "前一条" 数据
-                            current.setNowFinishNum(0);
+                        if (current.getInitstatus()) {
+                            Integer rectifytotal = current.getRectifytotal() != null ? current.getRectifytotal() : 0;
+                            Integer finishnum = current.getFinishnum() != null ? current.getFinishnum() : 0;
+                            // 设置未完成数
+                            current.setUnFinishNum(rectifytotal - finishnum);
+
+                            // 设置当前完成数
+                            if (j < dataList.size() - 1) {
+                                // 前一个元素
+                                ZhcxProjectRectifySnapVo previous = dataList.get(j + 1);
+                                int i1 = previous.getUnFinishNum() == null ? 0 : previous.getUnFinishNum();
+                                int i2 = current.getUnFinishNum() == null ? 0 : current.getUnFinishNum();
+                                current.setNowFinishNum(i1 - i2);
+                            } else {
+                                // 第一条记录没有 "前一条" 数据
+                                current.setNowFinishNum(0);
+                            }
                         }
                     }
                 }

+ 3 - 0
business-entity/src/main/java/com/rongwei/bsentity/vo/ZhcxProjectRectifySnapVo.java

@@ -14,4 +14,7 @@ public class ZhcxProjectRectifySnapVo extends ZhcxProjectRectifySnapDo {
      * 当日完成数
      */
     private Integer nowFinishNum;
+
+
+    private Boolean initstatus = true;
 }