Browse Source

修改计划新增模板情况

master
gjh 1 month ago
parent
commit
080d2de2a4
  1. 48
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouPlaninfoServiceImpl.java

48
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouPlaninfoServiceImpl.java

@ -994,12 +994,58 @@ public class HuzhouPlaninfoServiceImpl extends ServiceImpl<HuzhouPlaninfoMapper,
checkExcelPlanLastLevelTime(planInfoList);
log.info("示范项目验收时间校验正确");
if (planInfoList.size() == 34) {
log.info("修改2000以上的项目计划采用不同的模板,并只修改未开始的节点!");
List<HuzhouPlaninfo> excelList = SerializationUtils.clone((ArrayList<HuzhouPlaninfo>) hashMap.get("arr"));
// 过滤掉 taskLevel 小于 1.7 的数据,并保留 taskLevel 等于 "1.10" 的记录
List<HuzhouPlaninfo> filteredList = excelList.stream()
.filter(item -> {
String taskLevelStr = item.getTaskLevel();
try {
// 检查是否是需要保留的特殊值
if ("1.10".equals(taskLevelStr)) {
return true;
}
// 将taskLevel转换为BigDecimal进行比较
BigDecimal taskLevel = new BigDecimal(taskLevelStr);
return taskLevel.compareTo(new BigDecimal("1.7")) >= 0; // 注意这里直接使用字符串"1.7"构造BigDecimal以避免浮点数精度问题
} catch (NumberFormatException e) {
// 如果转换失败,可以选择处理异常或忽略这条记录
throw new RuntimeException("无法将 taskLevel 转换为数字: " + taskLevelStr, e);
}
})
.collect(Collectors.toList());
excelList = filteredList;
excelList.forEach(item -> {log.info("需要新增:{}-->{}",item.getTaskLevel(),item.getTaskName());});
// 保存历史后删除
List<HuzhouPlaninfo> nowPlanInfoFromDb = getListByProjectId(projectid);
planinfoHistoryService.savePlanInfoToHistory(nowPlanInfoFromDb);
// 集中核验的之后的计划都删除
removeByProjectIdMoreThanTaskLevel(projectid);
// 特殊群里:删除1.10的未完成计划
LambdaQueryWrapper<HuzhouPlaninfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HuzhouPlaninfo::getProjectId,projectid);
queryWrapper.eq(HuzhouPlaninfo::getTaskLevel,"1.10");
queryWrapper.in(HuzhouPlaninfo::getIsfinish, "0");
this.remove(queryWrapper);
// 将之前的分组id修改为最新的分组id
LambdaUpdateWrapper<HuzhouPlaninfo> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(HuzhouPlaninfo::getProjectId,projectid);
wrapper.set(HuzhouPlaninfo::getGroupId,planInfoList.get(0).getGroupId());
update(null,wrapper);
saveBatch(excelList);
}else {
// 4.深克隆备份Excel重点计划以供后续做差集操作
List<HuzhouPlaninfo> excelList = SerializationUtils.clone((ArrayList<HuzhouPlaninfo>) hashMap.get("arr"));
// 5.新增要求:未完成的项目则可以修改
// 这里按照之前逻辑将 处于审批和未完成的计划过滤掉
filterIsAllowModifyPlaninfo(projectid, planInfoList);
//修改项目计划会重新修改项目阶段类型
projectinfoService.modifyStageById(projectid,"4");
// 6.将原有计划信息保存到历史记录中
@ -1021,6 +1067,8 @@ public class HuzhouPlaninfoServiceImpl extends ServiceImpl<HuzhouPlaninfoMapper,
planInfoList.removeIf(item -> "项目立项阶段".equals(item.getTaskName()));
// 10.批量新增
saveBatch(planInfoList);
}
//创建流程
WorkFlow workFlow = workflowService.createFlow("createPlaninfo",projectid);

Loading…
Cancel
Save