|
@@ -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);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|