|
@@ -67,787 +67,1496 @@ import java.util.stream.Collectors;
|
|
|
@AllArgsConstructor
|
|
|
public class SysArchiveManager {
|
|
|
|
|
|
- private final SysImplementPlanService implementPlanService;
|
|
|
- private final SysImplPlanDetailsService implPlanDetailsService;
|
|
|
- private final SysImplPlanDetailsItemService implPlanDetailsItemService;
|
|
|
-
|
|
|
- private final SysPlanPkgService planPkgService;
|
|
|
-
|
|
|
- private final WmScorePackageService packageService;
|
|
|
- private final WmScorePackageStatusService packageStatusService;
|
|
|
- private final WmPackageContractService packageContractService;
|
|
|
- private final WmPackageTaskTypeQtyService packageTaskTypeQtyService;
|
|
|
- private final WmScoreTaskTypeService packageTaskTypeService;
|
|
|
- private final WmPackageRedemptionNoticeService packageRedemptionNoticeService;
|
|
|
-
|
|
|
- private final WmTaskService taskService;
|
|
|
- private final WmTaskContentService taskContentService;
|
|
|
-
|
|
|
- private final SysCheckChainNodeCheckHistoryService checkChainNodeCheckHistoryService;
|
|
|
-
|
|
|
- private final WmTaskSupervisionService taskSupervisionService;
|
|
|
- private final WmTaskSupervisionAdviceService taskSupervisionAdviceService;
|
|
|
-
|
|
|
-
|
|
|
- private final SysArchiveService archiveService;
|
|
|
- private final SysArchiveItemService archiveItemService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 归档计划
|
|
|
- *
|
|
|
- * @param operator 操作人
|
|
|
- * @param resource 归档信息
|
|
|
- * @return 处理结果
|
|
|
- */
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean destroyPlan(SysArchiveDto.OnPlanArchive resource, HnqzUser operator) {
|
|
|
-
|
|
|
- // 获取当前计划ID的记录
|
|
|
- SysImplementPlan plan = implementPlanService.getById(resource.getPlanId());
|
|
|
-
|
|
|
-
|
|
|
- if (plan == null) {
|
|
|
- log.info("归档所需的根计划不存在");
|
|
|
- throw new BizException("归档所需的根计划不存在");
|
|
|
- }
|
|
|
-
|
|
|
- if (!StrUtil.equals(resource.getConfirmPlanName(), plan.getPlanName())) {
|
|
|
- log.info("确认计划名称和实际计划名称不匹配,请核实");
|
|
|
- throw new BizException("确认计划名称和实际计划名称不匹配,请核实");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 判断是否是跟计划
|
|
|
- boolean isRootPlan = (plan.getParentId() == 0);
|
|
|
-
|
|
|
- // 获取要归档的数据
|
|
|
- // 1.1 获取需要的的归档记录
|
|
|
- List<SysImplementPlan> planRecords = getPlanRecords(plan);
|
|
|
-
|
|
|
- // 1.2 获取所需要的归档详情
|
|
|
- List<SysImplPlanDetails> planDetailsRecords = getPlanDetailsRecords(planRecords);
|
|
|
-
|
|
|
- // 1.3 获取所有归档的拆机详情
|
|
|
- List<SysImplPlanDetailsItem> planDetailsItemRecords = getPlanDetailsItemRecords(planDetailsRecords);
|
|
|
-
|
|
|
- // 1.4 获取计划和执行包的关联关系
|
|
|
- List<SysPlanPkg> planPkgRecords = getPlanPkgRecords(planRecords);
|
|
|
+ private final SysImplementPlanService implementPlanService;
|
|
|
+ private final SysImplPlanDetailsService implPlanDetailsService;
|
|
|
+ private final SysImplPlanDetailsItemService implPlanDetailsItemService;
|
|
|
+
|
|
|
+ private final SysPlanPkgService planPkgService;
|
|
|
+
|
|
|
+ private final WmScorePackageService packageService;
|
|
|
+ private final WmScorePackageStatusService packageStatusService;
|
|
|
+ private final WmPackageContractService packageContractService;
|
|
|
+ private final WmPackageTaskTypeQtyService packageTaskTypeQtyService;
|
|
|
+ private final WmScoreTaskTypeService packageTaskTypeService;
|
|
|
+ private final WmPackageRedemptionNoticeService packageRedemptionNoticeService;
|
|
|
+
|
|
|
+ private final WmTaskService taskService;
|
|
|
+ private final WmTaskContentService taskContentService;
|
|
|
+
|
|
|
+ private final SysCheckChainNodeCheckHistoryService checkChainNodeCheckHistoryService;
|
|
|
+
|
|
|
+ private final WmTaskSupervisionService taskSupervisionService;
|
|
|
+ private final WmTaskSupervisionAdviceService taskSupervisionAdviceService;
|
|
|
+
|
|
|
+ private final SysArchiveService archiveService;
|
|
|
+ private final SysArchiveItemService archiveItemService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 归档计划
|
|
|
+ *
|
|
|
+ * @param operator 操作人
|
|
|
+ * @param resource 归档信息
|
|
|
+ * @return 处理结果
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean destroyPlan(SysArchiveDto.OnPlanArchive resource, HnqzUser operator) {
|
|
|
+
|
|
|
+ // 获取当前计划ID的记录
|
|
|
+ SysImplementPlan plan = implementPlanService.getById(resource.getPlanId());
|
|
|
+
|
|
|
+ if (plan == null) {
|
|
|
+ log.info("归档所需的根计划不存在");
|
|
|
+ throw new BizException("归档所需的根计划不存在");
|
|
|
+ }
|
|
|
|
|
|
- // 1.5 获取要归档的执行包
|
|
|
- List<WmScorePackage> packageRecords = getPackageRecords(planPkgRecords);
|
|
|
+ if (!StrUtil.equals(resource.getConfirmPlanName(), plan.getPlanName())) {
|
|
|
+ log.info("确认计划名称和实际计划名称不匹配,请核实");
|
|
|
+ throw new BizException("确认计划名称和实际计划名称不匹配,请核实");
|
|
|
+ }
|
|
|
|
|
|
- // 1.6 获取要归档的领取记录
|
|
|
- List<WmScorePackageStatus> packageStatusRecords = getPackageStatusRecords(packageRecords);
|
|
|
+ // 判断是否是跟计划
|
|
|
+ boolean isRootPlan = (plan.getParentId() == 0);
|
|
|
+
|
|
|
+ // 获取要归档的数据
|
|
|
+ // 1.1 获取需要的的归档记录
|
|
|
+ List<SysImplementPlan> planRecords = getPlanRecords(plan);
|
|
|
+
|
|
|
+ // 1.2 获取所需要的归档详情
|
|
|
+ List<SysImplPlanDetails> planDetailsRecords = getPlanDetailsRecords(planRecords);
|
|
|
+
|
|
|
+ // 1.3 获取所有归档的拆机详情
|
|
|
+ List<SysImplPlanDetailsItem> planDetailsItemRecords =
|
|
|
+ getPlanDetailsItemRecords(planDetailsRecords);
|
|
|
+
|
|
|
+ // 1.4 获取计划和执行包的关联关系
|
|
|
+ List<SysPlanPkg> planPkgRecords = getPlanPkgRecords(planRecords);
|
|
|
+
|
|
|
+ // 1.5 获取要归档的执行包
|
|
|
+ List<WmScorePackage> packageRecords = getPackageRecords(planPkgRecords);
|
|
|
+
|
|
|
+ // 1.6 获取要归档的领取记录
|
|
|
+ List<WmScorePackageStatus> packageStatusRecords = getPackageStatusRecords(packageRecords);
|
|
|
+
|
|
|
+ // 1.7 获取积分包的合同记录
|
|
|
+ List<WmPackageContract> packageContractRecords = getPackageContractRecords(packageRecords);
|
|
|
+
|
|
|
+ // 1.8 获取积分包任务类型个数
|
|
|
+ List<WmPackageTaskTypeQty> packageTaskTypeQtyRecords =
|
|
|
+ getPackageTaskTypeQtyRecords(packageRecords);
|
|
|
+
|
|
|
+ // 1.9 获取原始积分包任务类型记录
|
|
|
+ List<WmScoreTaskType> scoreTaskTypeRecords = getScoreTaskTypeRecords(packageRecords);
|
|
|
+
|
|
|
+ // 1.10 获取任务记录
|
|
|
+ List<WmTask> taskRecords = getTaskRecords(packageRecords);
|
|
|
+
|
|
|
+ // 1.11 获取任务内容记录
|
|
|
+ List<WmTaskContent> taskContentRecords = getTaskContentRecords(taskRecords);
|
|
|
+
|
|
|
+ // 1.12 获取任务审核历史
|
|
|
+ List<SysCheckChainNodeCheckHistory> checkChainNodeCheckHistoryRecords =
|
|
|
+ getCheckChainNodeCheckHistoryRecords(taskRecords);
|
|
|
+
|
|
|
+ // 1.13 获取监察记录
|
|
|
+ List<WmTaskSupervision> taskSupervisionRecords = getTaskSupervisionRecords(taskRecords);
|
|
|
+
|
|
|
+ // 1.14 获取监察建议记录
|
|
|
+ List<WmTaskSupervisionAdvice> taskSupervisionAdviceRecords =
|
|
|
+ getTaskSupervisionAdviceRecords(taskSupervisionRecords);
|
|
|
+
|
|
|
+ // 1.15 获取执行包的兑付通知
|
|
|
+ List<WmPackageRedemptionNotice> redemptionNoticeRecords =
|
|
|
+ getRedemptionNoticeRecords(packageRecords);
|
|
|
+
|
|
|
+ // 保存归档信息
|
|
|
+ // 2.1 构建归档项
|
|
|
+ SysArchiveEntity archiveEntity = new SysArchiveEntity();
|
|
|
+ archiveEntity.setArchiveHead("PLAN");
|
|
|
+ archiveEntity.setOriginInfo(plan.getPlanName());
|
|
|
+ archiveEntity.setArchiveInfo(
|
|
|
+ String.format(
|
|
|
+ "%s(%s终止)",
|
|
|
+ plan.getPlanName(),
|
|
|
+ DateTimeFormatter.ofPattern(DatePattern.PURE_DATETIME_PATTERN)
|
|
|
+ .format(LocalDateTime.now())));
|
|
|
+ archiveEntity.setArchiveReason(resource.getArchiveReason());
|
|
|
+ archiveEntity.setCreateBy(operator.getUsername());
|
|
|
+ archiveEntity.setCreateTime(LocalDateTime.now());
|
|
|
+ archiveService.save(archiveEntity);
|
|
|
+
|
|
|
+ // 2.2 构建归档项记录
|
|
|
+ Integer archiveId = archiveEntity.getArchiveId();
|
|
|
+ List<SysArchiveItem> items = new LinkedList<>();
|
|
|
+
|
|
|
+ // 2.2.1 归档计划
|
|
|
+ if (CollUtil.isNotEmpty(planRecords)) {
|
|
|
+
|
|
|
+ String clzName = SysImplementPlan.class.getSimpleName();
|
|
|
+ String fullClzName = SysImplementPlan.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ planRecords.stream()
|
|
|
+ .map(
|
|
|
+ plan1 -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(plan1));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 1.7 获取积分包的合同记录
|
|
|
- List<WmPackageContract> packageContractRecords = getPackageContractRecords(packageRecords);
|
|
|
+ // 2.2.2 归档计划详情
|
|
|
+ if (CollUtil.isNotEmpty(planDetailsRecords)) {
|
|
|
|
|
|
- // 1.8 获取积分包任务类型个数
|
|
|
- List<WmPackageTaskTypeQty> packageTaskTypeQtyRecords = getPackageTaskTypeQtyRecords(packageRecords);
|
|
|
+ String clzName = SysImplPlanDetails.class.getSimpleName();
|
|
|
+ String fullClzName = SysImplPlanDetails.class.getName();
|
|
|
|
|
|
- // 1.9 获取原始积分包任务类型记录
|
|
|
- List<WmScoreTaskType> scoreTaskTypeRecords = getScoreTaskTypeRecords(packageRecords);
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ planDetailsRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
|
|
|
- // 1.10 获取任务记录
|
|
|
- List<WmTask> taskRecords = getTaskRecords(packageRecords);
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
- // 1.11 获取任务内容记录
|
|
|
- List<WmTaskContent> taskContentRecords = getTaskContentRecords(taskRecords);
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 1.12 获取任务审核历史
|
|
|
- List<SysCheckChainNodeCheckHistory> checkChainNodeCheckHistoryRecords = getCheckChainNodeCheckHistoryRecords(taskRecords);
|
|
|
+ // 2.2.3 归档详情拆解
|
|
|
+ if (CollUtil.isNotEmpty(planDetailsItemRecords)) {
|
|
|
+ String clzName = SysImplPlanDetailsItem.class.getSimpleName();
|
|
|
+ String fullClzName = SysImplPlanDetailsItem.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ planDetailsItemRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 1.13 获取监察记录
|
|
|
- List<WmTaskSupervision> taskSupervisionRecords = getTaskSupervisionRecords(taskRecords);
|
|
|
+ // 2.2.4 计划执行包关联关系
|
|
|
+ if (CollUtil.isNotEmpty(planPkgRecords)) {
|
|
|
+ String clzName = SysPlanPkg.class.getSimpleName();
|
|
|
+ String fullClzName = SysPlanPkg.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ planPkgRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 1.14 获取监察建议记录
|
|
|
- List<WmTaskSupervisionAdvice> taskSupervisionAdviceRecords = getTaskSupervisionAdviceRecords(taskSupervisionRecords);
|
|
|
+ // 2.2.5 归档的执行包
|
|
|
+ if (CollUtil.isNotEmpty(packageRecords)) {
|
|
|
+ String clzName = WmScorePackage.class.getSimpleName();
|
|
|
+ String fullClzName = WmScorePackage.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ packageRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 1.15 获取执行包的兑付通知
|
|
|
- List<WmPackageRedemptionNotice> redemptionNoticeRecords = getRedemptionNoticeRecords(packageRecords);
|
|
|
+ // 2.2.6 归档领取记录
|
|
|
+ if (CollUtil.isNotEmpty(packageStatusRecords)) {
|
|
|
+ String clzName = WmScorePackageStatus.class.getSimpleName();
|
|
|
+ String fullClzName = WmScorePackageStatus.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ packageStatusRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
+ // 2.2.7 归档包合同
|
|
|
+ if (CollUtil.isNotEmpty(packageContractRecords)) {
|
|
|
+ String clzName = WmPackageContract.class.getSimpleName();
|
|
|
+ String fullClzName = WmPackageContract.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ packageContractRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 保存归档信息
|
|
|
- // 2.1 构建归档项
|
|
|
- SysArchiveEntity archiveEntity = new SysArchiveEntity();
|
|
|
- archiveEntity.setArchiveHead("PLAN");
|
|
|
- archiveEntity.setOriginInfo(plan.getPlanName());
|
|
|
- archiveEntity.setArchiveInfo(String.format("%s(%s终止)", plan.getPlanName(), DateTimeFormatter.ofPattern(DatePattern.PURE_DATETIME_PATTERN).format(LocalDateTime.now())));
|
|
|
- archiveEntity.setArchiveReason(resource.getArchiveReason());
|
|
|
- archiveEntity.setCreateBy(operator.getUsername());
|
|
|
- archiveEntity.setCreateTime(LocalDateTime.now());
|
|
|
- archiveService.save(archiveEntity);
|
|
|
+ // 2.2.8 包任务类型分配数
|
|
|
+ if (CollUtil.isNotEmpty(packageTaskTypeQtyRecords)) {
|
|
|
+ String clzName = WmPackageTaskTypeQty.class.getSimpleName();
|
|
|
+ String fullClzName = WmPackageTaskTypeQty.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ packageTaskTypeQtyRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 2.2 构建归档项记录
|
|
|
- Integer archiveId = archiveEntity.getArchiveId();
|
|
|
- List<SysArchiveItem> items = new LinkedList<>();
|
|
|
+ // 2.2.9 原始任务类型数
|
|
|
+ if (CollUtil.isNotEmpty(scoreTaskTypeRecords)) {
|
|
|
+ String clzName = WmScoreTaskType.class.getSimpleName();
|
|
|
+ String fullClzName = WmScoreTaskType.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ scoreTaskTypeRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 2.2.1 归档计划
|
|
|
- if (CollUtil.isNotEmpty(planRecords)) {
|
|
|
+ // 2.2.10 任务记录
|
|
|
+ if (CollUtil.isNotEmpty(taskRecords)) {
|
|
|
+ String clzName = WmTask.class.getSimpleName();
|
|
|
+ String fullClzName = WmTask.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ taskRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- String clzName = SysImplementPlan.class.getSimpleName();
|
|
|
- String fullClzName = SysImplementPlan.class.getName();
|
|
|
+ // 2.2.11 任务内容
|
|
|
+ if (CollUtil.isNotEmpty(taskContentRecords)) {
|
|
|
+ String clzName = WmTaskContent.class.getSimpleName();
|
|
|
+ String fullClzName = WmTaskContent.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ taskContentRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- List<SysArchiveItem> collect = planRecords.stream().map(plan1 -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(plan1));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
+ // 2.2.12 审核历史
|
|
|
+ if (CollUtil.isNotEmpty(checkChainNodeCheckHistoryRecords)) {
|
|
|
+ String clzName = SysCheckChainNodeCheckHistory.class.getSimpleName();
|
|
|
+ String fullClzName = SysCheckChainNodeCheckHistory.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ checkChainNodeCheckHistoryRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ // 2.2.13 任务监察
|
|
|
+ if (CollUtil.isNotEmpty(taskSupervisionRecords)) {
|
|
|
+ String clzName = WmTaskSupervision.class.getSimpleName();
|
|
|
+ String fullClzName = WmTaskSupervision.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ taskSupervisionRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
+ // 2.2.14 任务监察建议
|
|
|
+ if (CollUtil.isNotEmpty(taskSupervisionAdviceRecords)) {
|
|
|
+ String clzName = WmTaskSupervisionAdvice.class.getSimpleName();
|
|
|
+ String fullClzName = WmTaskSupervisionAdvice.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ taskSupervisionAdviceRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 2.2.2 归档计划详情
|
|
|
- if (CollUtil.isNotEmpty(planDetailsRecords)) {
|
|
|
+ // 2.2.15 兑付通知记录
|
|
|
+ if (CollUtil.isNotEmpty(redemptionNoticeRecords)) {
|
|
|
+ String clzName = WmPackageRedemptionNotice.class.getSimpleName();
|
|
|
+ String fullClzName = WmPackageRedemptionNotice.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ redemptionNoticeRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- String clzName = SysImplPlanDetails.class.getSimpleName();
|
|
|
- String fullClzName = SysImplPlanDetails.class.getName();
|
|
|
+ archiveItemService.saveBatch(items);
|
|
|
+
|
|
|
+ // ~ 删除历史数据==========================
|
|
|
+ // 3.1 删除归档计划
|
|
|
+ if (CollUtil.isNotEmpty(planRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ planRecords.stream()
|
|
|
+ .mapToInt(SysImplementPlan::getPlanId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ implementPlanService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- List<SysArchiveItem> collect = planDetailsRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
+ // 3.2 删除归档计划详情
|
|
|
+ if (CollUtil.isNotEmpty(planDetailsRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ planDetailsRecords.stream()
|
|
|
+ .mapToInt(SysImplPlanDetails::getDetailsId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ implPlanDetailsService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ // 3.3 删除归档详情拆解
|
|
|
+ if (CollUtil.isNotEmpty(planDetailsItemRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ planDetailsItemRecords.stream()
|
|
|
+ .mapToInt(SysImplPlanDetailsItem::getItemId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ implPlanDetailsItemService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- items.addAll(collect);
|
|
|
+ // 3.4 删除计划执行包关联关系
|
|
|
+ if (CollUtil.isNotEmpty(planPkgRecords)) {
|
|
|
+ for (SysPlanPkg planPkg : planPkgRecords) {
|
|
|
+ planPkgService.remove(
|
|
|
+ Wrappers.<SysPlanPkg>lambdaQuery()
|
|
|
+ .eq(SysPlanPkg::getPlanId, planPkg.getPlanId())
|
|
|
+ .eq(SysPlanPkg::getPkgId, planPkg.getPkgId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ // 3.5 删除归档的执行包
|
|
|
+ if (CollUtil.isNotEmpty(packageRecords)) {
|
|
|
+ Set<String> collect =
|
|
|
+ packageRecords.stream().map(WmScorePackage::getId).collect(Collectors.toSet());
|
|
|
+ packageService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 2.2.3 归档详情拆解
|
|
|
- if (CollUtil.isNotEmpty(planDetailsItemRecords)) {
|
|
|
- String clzName = SysImplPlanDetailsItem.class.getSimpleName();
|
|
|
- String fullClzName = SysImplPlanDetailsItem.class.getName();
|
|
|
+ // 3.6 删除归档领取记录
|
|
|
+ if (CollUtil.isNotEmpty(packageStatusRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ packageStatusRecords.stream()
|
|
|
+ .map(WmScorePackageStatus::getId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ packageStatusService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- List<SysArchiveItem> collect = planDetailsItemRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
+ // 3.7 删除归档包合同
|
|
|
+ if (CollUtil.isNotEmpty(packageContractRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ packageContractRecords.stream()
|
|
|
+ .mapToInt(WmPackageContract::getContractId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ packageContractService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ // 3.8 删除包任务类型分配数
|
|
|
+ if (CollUtil.isNotEmpty(packageTaskTypeQtyRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ packageTaskTypeQtyRecords.stream()
|
|
|
+ .mapToInt(WmPackageTaskTypeQty::getRecordId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ packageTaskTypeQtyService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.4 计划执行包关联关系
|
|
|
- if (CollUtil.isNotEmpty(planPkgRecords)) {
|
|
|
- String clzName = SysPlanPkg.class.getSimpleName();
|
|
|
- String fullClzName = SysPlanPkg.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = planPkgRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.5 归档的执行包
|
|
|
- if (CollUtil.isNotEmpty(packageRecords)) {
|
|
|
- String clzName = WmScorePackage.class.getSimpleName();
|
|
|
- String fullClzName = WmScorePackage.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = packageRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.6 归档领取记录
|
|
|
- if (CollUtil.isNotEmpty(packageStatusRecords)) {
|
|
|
- String clzName = WmScorePackageStatus.class.getSimpleName();
|
|
|
- String fullClzName = WmScorePackageStatus.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = packageStatusRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.7 归档包合同
|
|
|
- if (CollUtil.isNotEmpty(packageContractRecords)) {
|
|
|
- String clzName = WmPackageContract.class.getSimpleName();
|
|
|
- String fullClzName = WmPackageContract.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = packageContractRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.8 包任务类型分配数
|
|
|
- if (CollUtil.isNotEmpty(packageTaskTypeQtyRecords)) {
|
|
|
- String clzName = WmPackageTaskTypeQty.class.getSimpleName();
|
|
|
- String fullClzName = WmPackageTaskTypeQty.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = packageTaskTypeQtyRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.9 原始任务类型数
|
|
|
- if (CollUtil.isNotEmpty(scoreTaskTypeRecords)) {
|
|
|
- String clzName = WmScoreTaskType.class.getSimpleName();
|
|
|
- String fullClzName = WmScoreTaskType.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = scoreTaskTypeRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.10 任务记录
|
|
|
- if (CollUtil.isNotEmpty(taskRecords)) {
|
|
|
- String clzName = WmTask.class.getSimpleName();
|
|
|
- String fullClzName = WmTask.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = taskRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.11 任务内容
|
|
|
- if (CollUtil.isNotEmpty(taskContentRecords)) {
|
|
|
- String clzName = WmTaskContent.class.getSimpleName();
|
|
|
- String fullClzName = WmTaskContent.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = taskContentRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.12 审核历史
|
|
|
- if (CollUtil.isNotEmpty(checkChainNodeCheckHistoryRecords)) {
|
|
|
- String clzName = SysCheckChainNodeCheckHistory.class.getSimpleName();
|
|
|
- String fullClzName = SysCheckChainNodeCheckHistory.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = checkChainNodeCheckHistoryRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.13 任务监察
|
|
|
- if (CollUtil.isNotEmpty(taskSupervisionRecords)) {
|
|
|
- String clzName = WmTaskSupervision.class.getSimpleName();
|
|
|
- String fullClzName = WmTaskSupervision.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = taskSupervisionRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.14 任务监察建议
|
|
|
- if (CollUtil.isNotEmpty(taskSupervisionAdviceRecords)) {
|
|
|
- String clzName = WmTaskSupervisionAdvice.class.getSimpleName();
|
|
|
- String fullClzName = WmTaskSupervisionAdvice.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = taskSupervisionAdviceRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 2.2.15 兑付通知记录
|
|
|
- if (CollUtil.isNotEmpty(redemptionNoticeRecords)) {
|
|
|
- String clzName = WmPackageRedemptionNotice.class.getSimpleName();
|
|
|
- String fullClzName = WmPackageRedemptionNotice.class.getName();
|
|
|
-
|
|
|
- List<SysArchiveItem> collect = redemptionNoticeRecords.stream().map(record -> {
|
|
|
- SysArchiveItem item = new SysArchiveItem();
|
|
|
- item.setClassName(clzName);
|
|
|
- item.setFullClassName(fullClzName);
|
|
|
- item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
- item.setArchiveId(archiveId);
|
|
|
-
|
|
|
- return item;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- items.addAll(collect);
|
|
|
- }
|
|
|
-
|
|
|
- archiveItemService.saveBatch(items);
|
|
|
-
|
|
|
-
|
|
|
- //~ 删除历史数据==========================
|
|
|
- // 3.1 删除归档计划
|
|
|
- if (CollUtil.isNotEmpty(planRecords)) {
|
|
|
- Set<Integer> collect = planRecords.stream().mapToInt(SysImplementPlan::getPlanId).boxed().collect(Collectors.toSet());
|
|
|
- implementPlanService.removeByIds(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 3.2 删除归档计划详情
|
|
|
- if (CollUtil.isNotEmpty(planDetailsRecords)) {
|
|
|
- Set<Integer> collect = planDetailsRecords.stream().mapToInt(SysImplPlanDetails::getDetailsId).boxed().collect(Collectors.toSet());
|
|
|
- implPlanDetailsService.removeByIds(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 3.3 删除归档详情拆解
|
|
|
- if (CollUtil.isNotEmpty(planDetailsItemRecords)) {
|
|
|
- Set<Integer> collect = planDetailsItemRecords.stream().mapToInt(SysImplPlanDetailsItem::getItemId).boxed().collect(Collectors.toSet());
|
|
|
- implPlanDetailsItemService.removeByIds(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 3.4 删除计划执行包关联关系
|
|
|
- if (CollUtil.isNotEmpty(planPkgRecords)) {
|
|
|
- for (SysPlanPkg planPkg : planPkgRecords) {
|
|
|
- planPkgService.remove(Wrappers.<SysPlanPkg>lambdaQuery()
|
|
|
- .eq(SysPlanPkg::getPlanId, planPkg.getPlanId())
|
|
|
- .eq(SysPlanPkg::getPkgId, planPkg.getPkgId()));
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 3.5 删除归档的执行包
|
|
|
- if (CollUtil.isNotEmpty(packageRecords)) {
|
|
|
- Set<String> collect = packageRecords.stream().map(WmScorePackage::getId).collect(Collectors.toSet());
|
|
|
- packageService.removeByIds(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 3.6 删除归档领取记录
|
|
|
- if (CollUtil.isNotEmpty(packageStatusRecords)) {
|
|
|
- Set<Integer> collect = packageStatusRecords.stream().map(WmScorePackageStatus::getId).collect(Collectors.toSet());
|
|
|
- packageStatusService.removeByIds(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 3.7 删除归档包合同
|
|
|
- if (CollUtil.isNotEmpty(packageContractRecords)) {
|
|
|
- Set<Integer> collect = packageContractRecords.stream().mapToInt(WmPackageContract::getContractId).boxed().collect(Collectors.toSet());
|
|
|
- packageContractService.removeByIds(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 3.8 删除包任务类型分配数
|
|
|
- if (CollUtil.isNotEmpty(packageTaskTypeQtyRecords)) {
|
|
|
- Set<Integer> collect = packageTaskTypeQtyRecords.stream().mapToInt(WmPackageTaskTypeQty::getRecordId).boxed().collect(Collectors.toSet());
|
|
|
- packageTaskTypeQtyService.removeByIds(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 3.9 删除原始任务类型数
|
|
|
- if (CollUtil.isNotEmpty(scoreTaskTypeRecords)) {
|
|
|
- Set<Long> collect = scoreTaskTypeRecords.stream().mapToLong(WmScoreTaskType::getId).boxed().collect(Collectors.toSet());
|
|
|
- packageTaskTypeService.removeByIds(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 3.10 删除任务记录
|
|
|
- if (CollUtil.isNotEmpty(taskRecords)) {
|
|
|
- Set<String> collect = taskRecords.stream().map(WmTask::getId).collect(Collectors.toSet());
|
|
|
- taskService.removeByIds(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 3.11 删除任务内容
|
|
|
- if (CollUtil.isNotEmpty(taskContentRecords)) {
|
|
|
- Set<Integer> collect = taskContentRecords.stream().mapToInt(WmTaskContent::getId).boxed().collect(Collectors.toSet());
|
|
|
- taskContentService.removeByIds(collect);
|
|
|
- }
|
|
|
-
|
|
|
- // 3.12 删除审核历史
|
|
|
- if (CollUtil.isNotEmpty(checkChainNodeCheckHistoryRecords)) {
|
|
|
- Set<Integer> collect = checkChainNodeCheckHistoryRecords.stream().mapToInt(SysCheckChainNodeCheckHistory::getHistoryId).boxed().collect(Collectors.toSet());
|
|
|
- checkChainNodeCheckHistoryService.removeByIds(collect);
|
|
|
- }
|
|
|
+ // 3.9 删除原始任务类型数
|
|
|
+ if (CollUtil.isNotEmpty(scoreTaskTypeRecords)) {
|
|
|
+ Set<Long> collect =
|
|
|
+ scoreTaskTypeRecords.stream()
|
|
|
+ .mapToLong(WmScoreTaskType::getId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ packageTaskTypeService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 3.13 删除任务监察
|
|
|
- if (CollUtil.isNotEmpty(taskSupervisionRecords)) {
|
|
|
- Set<Long> collect = taskSupervisionRecords.stream().mapToLong(WmTaskSupervision::getSupervisionId).boxed().collect(Collectors.toSet());
|
|
|
- taskSupervisionService.removeByIds(collect);
|
|
|
- }
|
|
|
+ // 3.10 删除任务记录
|
|
|
+ if (CollUtil.isNotEmpty(taskRecords)) {
|
|
|
+ Set<String> collect = taskRecords.stream().map(WmTask::getId).collect(Collectors.toSet());
|
|
|
+ taskService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 3.14 删除任务监察建议
|
|
|
- if (CollUtil.isNotEmpty(taskSupervisionAdviceRecords)) {
|
|
|
- Set<Long> collect = taskSupervisionAdviceRecords.stream().mapToLong(WmTaskSupervisionAdvice::getAdviceId).boxed().collect(Collectors.toSet());
|
|
|
- taskSupervisionAdviceService.removeByIds(collect);
|
|
|
- }
|
|
|
+ // 3.11 删除任务内容
|
|
|
+ if (CollUtil.isNotEmpty(taskContentRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ taskContentRecords.stream()
|
|
|
+ .mapToInt(WmTaskContent::getId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ taskContentService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- // 3.15 删除执行包兑付通知
|
|
|
- if (CollUtil.isNotEmpty(redemptionNoticeRecords)) {
|
|
|
- Set<Integer> collect = redemptionNoticeRecords.stream().mapToInt(WmPackageRedemptionNotice::getNoticeId).boxed().collect(Collectors.toSet());
|
|
|
- packageRedemptionNoticeService.removeByIds(collect);
|
|
|
- }
|
|
|
+ // 3.12 删除审核历史
|
|
|
+ if (CollUtil.isNotEmpty(checkChainNodeCheckHistoryRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ checkChainNodeCheckHistoryRecords.stream()
|
|
|
+ .mapToInt(SysCheckChainNodeCheckHistory::getHistoryId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ checkChainNodeCheckHistoryService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- //~ 更新必要数据==========================
|
|
|
- // 如果不是跟计划,需要父级更新可用分值
|
|
|
- if (!isRootPlan) {
|
|
|
+ // 3.13 删除任务监察
|
|
|
+ if (CollUtil.isNotEmpty(taskSupervisionRecords)) {
|
|
|
+ Set<Long> collect =
|
|
|
+ taskSupervisionRecords.stream()
|
|
|
+ .mapToLong(WmTaskSupervision::getSupervisionId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ taskSupervisionService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- SysImplementPlan parentPlan = implementPlanService.getById(plan.getParentId());
|
|
|
- parentPlan.setAvailScore(parentPlan.getAvailScore() + plan.getPlanScore());
|
|
|
- parentPlan.setUpdateTime(LocalDateTime.now());
|
|
|
- parentPlan.setUpdateBy(operator.getUsername());
|
|
|
- implementPlanService.updateById(parentPlan);
|
|
|
+ // 3.14 删除任务监察建议
|
|
|
+ if (CollUtil.isNotEmpty(taskSupervisionAdviceRecords)) {
|
|
|
+ Set<Long> collect =
|
|
|
+ taskSupervisionAdviceRecords.stream()
|
|
|
+ .mapToLong(WmTaskSupervisionAdvice::getAdviceId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ taskSupervisionAdviceService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ // 3.15 删除执行包兑付通知
|
|
|
+ if (CollUtil.isNotEmpty(redemptionNoticeRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ redemptionNoticeRecords.stream()
|
|
|
+ .mapToInt(WmPackageRedemptionNotice::getNoticeId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ packageRedemptionNoticeService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- return Boolean.TRUE;
|
|
|
+ // ~ 更新必要数据==========================
|
|
|
+ // 如果不是跟计划,需要父级更新可用分值
|
|
|
+ if (!isRootPlan) {
|
|
|
|
|
|
+ SysImplementPlan parentPlan = implementPlanService.getById(plan.getParentId());
|
|
|
+ parentPlan.setAvailScore(parentPlan.getAvailScore() + plan.getPlanScore());
|
|
|
+ parentPlan.setUpdateTime(LocalDateTime.now());
|
|
|
+ parentPlan.setUpdateBy(operator.getUsername());
|
|
|
+ implementPlanService.updateById(parentPlan);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取计划记录
|
|
|
- *
|
|
|
- * @param plan 根计划
|
|
|
- * @return 需要归档的所有计划
|
|
|
- */
|
|
|
- private List<SysImplementPlan> getPlanRecords(SysImplementPlan plan) {
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
|
|
|
- List<SysImplementPlan> archivePlans = new LinkedList<>();
|
|
|
+ /**
|
|
|
+ * 获取计划记录
|
|
|
+ *
|
|
|
+ * @param plan 根计划
|
|
|
+ * @return 需要归档的所有计划
|
|
|
+ */
|
|
|
+ private List<SysImplementPlan> getPlanRecords(SysImplementPlan plan) {
|
|
|
|
|
|
- archivePlans.add(plan);
|
|
|
+ List<SysImplementPlan> archivePlans = new LinkedList<>();
|
|
|
|
|
|
- List<Integer> queryIds = new LinkedList<>();
|
|
|
- queryIds.add(plan.getPlanId());
|
|
|
- while (true) {
|
|
|
+ archivePlans.add(plan);
|
|
|
|
|
|
- List<SysImplementPlan> plans = implementPlanService.list(Wrappers.<SysImplementPlan>lambdaQuery().in(SysImplementPlan::getParentId, queryIds));
|
|
|
+ List<Integer> queryIds = new LinkedList<>();
|
|
|
+ queryIds.add(plan.getPlanId());
|
|
|
+ while (true) {
|
|
|
|
|
|
- if (CollUtil.isEmpty(plans)) {
|
|
|
- break;
|
|
|
- }
|
|
|
+ List<SysImplementPlan> plans =
|
|
|
+ implementPlanService.list(
|
|
|
+ Wrappers.<SysImplementPlan>lambdaQuery().in(SysImplementPlan::getParentId, queryIds));
|
|
|
|
|
|
- archivePlans.addAll(plans);
|
|
|
+ if (CollUtil.isEmpty(plans)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- queryIds = plans.stream().mapToInt(SysImplementPlan::getPlanId).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
- }
|
|
|
+ archivePlans.addAll(plans);
|
|
|
|
|
|
- return archivePlans;
|
|
|
+ queryIds =
|
|
|
+ plans.stream()
|
|
|
+ .mapToInt(SysImplementPlan::getPlanId)
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取计划详情信息
|
|
|
- *
|
|
|
- * @param planRecords 计划
|
|
|
- * @return 计划详情信息
|
|
|
- */
|
|
|
- private List<SysImplPlanDetails> getPlanDetailsRecords(Collection<SysImplementPlan> planRecords) {
|
|
|
+ return archivePlans;
|
|
|
+ }
|
|
|
|
|
|
- if (CollUtil.isEmpty(planRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
-
|
|
|
- List<Integer> planIds = planRecords.stream().mapToInt(SysImplementPlan::getPlanId).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- return implPlanDetailsService.list(Wrappers.<SysImplPlanDetails>lambdaQuery().in(SysImplPlanDetails::getPlanId, planIds));
|
|
|
+ /**
|
|
|
+ * 获取计划详情信息
|
|
|
+ *
|
|
|
+ * @param planRecords 计划
|
|
|
+ * @return 计划详情信息
|
|
|
+ */
|
|
|
+ private List<SysImplPlanDetails> getPlanDetailsRecords(Collection<SysImplementPlan> planRecords) {
|
|
|
|
|
|
+ if (CollUtil.isEmpty(planRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取所有归档详情拆解信息
|
|
|
- *
|
|
|
- * @param planDetailsRecords 计划详情信息
|
|
|
- * @return 计划详情信息
|
|
|
- */
|
|
|
- private List<SysImplPlanDetailsItem> getPlanDetailsItemRecords(Collection<SysImplPlanDetails> planDetailsRecords) {
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(planDetailsRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
-
|
|
|
- List<Integer> collect = planDetailsRecords.stream().mapToInt(SysImplPlanDetails::getDetailsId).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- return implPlanDetailsItemService.list(Wrappers.<SysImplPlanDetailsItem>lambdaQuery().in(SysImplPlanDetailsItem::getDetailsId, collect));
|
|
|
-
|
|
|
+ List<Integer> planIds =
|
|
|
+ planRecords.stream()
|
|
|
+ .mapToInt(SysImplementPlan::getPlanId)
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return implPlanDetailsService.list(
|
|
|
+ Wrappers.<SysImplPlanDetails>lambdaQuery().in(SysImplPlanDetails::getPlanId, planIds));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取所有归档详情拆解信息
|
|
|
+ *
|
|
|
+ * @param planDetailsRecords 计划详情信息
|
|
|
+ * @return 计划详情信息
|
|
|
+ */
|
|
|
+ private List<SysImplPlanDetailsItem> getPlanDetailsItemRecords(
|
|
|
+ Collection<SysImplPlanDetails> planDetailsRecords) {
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(planDetailsRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取计划和执行包的关联关系
|
|
|
- *
|
|
|
- * @param planRecords 执行计划
|
|
|
- * @return 关系列表
|
|
|
- */
|
|
|
- private List<SysPlanPkg> getPlanPkgRecords(Collection<SysImplementPlan> planRecords) {
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(planRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
- List<Integer> planIds = planRecords.stream().mapToInt(SysImplementPlan::getPlanId).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- return planPkgService.list(Wrappers.<SysPlanPkg>lambdaQuery().in(SysPlanPkg::getPlanId, planIds));
|
|
|
-
|
|
|
-
|
|
|
+ List<Integer> collect =
|
|
|
+ planDetailsRecords.stream()
|
|
|
+ .mapToInt(SysImplPlanDetails::getDetailsId)
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return implPlanDetailsItemService.list(
|
|
|
+ Wrappers.<SysImplPlanDetailsItem>lambdaQuery()
|
|
|
+ .in(SysImplPlanDetailsItem::getDetailsId, collect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取计划和执行包的关联关系
|
|
|
+ *
|
|
|
+ * @param planRecords 执行计划
|
|
|
+ * @return 关系列表
|
|
|
+ */
|
|
|
+ private List<SysPlanPkg> getPlanPkgRecords(Collection<SysImplementPlan> planRecords) {
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(planRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取关联执行包
|
|
|
- *
|
|
|
- * @param planPkgs 计划和执行包关联关系
|
|
|
- * @return 关联的执行包集合
|
|
|
- */
|
|
|
- private List<WmScorePackage> getPackageRecords(Collection<SysPlanPkg> planPkgs) {
|
|
|
- if (CollUtil.isEmpty(planPkgs)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
-
|
|
|
- List<String> pkgIds = planPkgs.stream().map(pp -> pp.getPkgId().toString()).distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- return packageService.listByIds(pkgIds);
|
|
|
-
|
|
|
+ List<Integer> planIds =
|
|
|
+ planRecords.stream()
|
|
|
+ .mapToInt(SysImplementPlan::getPlanId)
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return planPkgService.list(
|
|
|
+ Wrappers.<SysPlanPkg>lambdaQuery().in(SysPlanPkg::getPlanId, planIds));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取计划和执行包的关联关系
|
|
|
+ *
|
|
|
+ * @param pkgId 执行包ID
|
|
|
+ * @return 关系列表
|
|
|
+ */
|
|
|
+ private List<SysPlanPkg> getPlanPkgRecords1(String pkgId) {
|
|
|
+
|
|
|
+ if (StrUtil.isEmpty(pkgId)) {
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取领取记录
|
|
|
- *
|
|
|
- * @param packageRecords 包信息
|
|
|
- * @return 记录集合
|
|
|
- */
|
|
|
- private List<WmScorePackageStatus> getPackageStatusRecords(Collection<WmScorePackage> packageRecords) {
|
|
|
- if (CollUtil.isEmpty(packageRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
-
|
|
|
- List<String> collect = packageRecords.stream().map(WmScorePackage::getId).distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- return packageStatusService.list(Wrappers.<WmScorePackageStatus>lambdaQuery().in(WmScorePackageStatus::getPackageId, collect));
|
|
|
-
|
|
|
+ return planPkgService.list(
|
|
|
+ Wrappers.<SysPlanPkg>lambdaQuery().in(SysPlanPkg::getPkgId, Integer.parseInt(pkgId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取关联执行包
|
|
|
+ *
|
|
|
+ * @param planPkgs 计划和执行包关联关系
|
|
|
+ * @return 关联的执行包集合
|
|
|
+ */
|
|
|
+ private List<WmScorePackage> getPackageRecords(Collection<SysPlanPkg> planPkgs) {
|
|
|
+ if (CollUtil.isEmpty(planPkgs)) {
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取积分包合同
|
|
|
- *
|
|
|
- * @param packageRecords 积分包记录
|
|
|
- * @return 合同集合
|
|
|
- */
|
|
|
- private List<WmPackageContract> getPackageContractRecords(Collection<WmScorePackage> packageRecords) {
|
|
|
+ List<String> pkgIds =
|
|
|
+ planPkgs.stream()
|
|
|
+ .map(pp -> pp.getPkgId().toString())
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return packageService.listByIds(pkgIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取领取记录
|
|
|
+ *
|
|
|
+ * @param packageRecords 包信息
|
|
|
+ * @return 记录集合
|
|
|
+ */
|
|
|
+ private List<WmScorePackageStatus> getPackageStatusRecords(
|
|
|
+ Collection<WmScorePackage> packageRecords) {
|
|
|
+ if (CollUtil.isEmpty(packageRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
|
|
|
+ List<String> collect =
|
|
|
+ packageRecords.stream()
|
|
|
+ .map(WmScorePackage::getId)
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return packageStatusService.list(
|
|
|
+ Wrappers.<WmScorePackageStatus>lambdaQuery()
|
|
|
+ .in(WmScorePackageStatus::getPackageId, collect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取积分包合同
|
|
|
+ *
|
|
|
+ * @param packageRecords 积分包记录
|
|
|
+ * @return 合同集合
|
|
|
+ */
|
|
|
+ private List<WmPackageContract> getPackageContractRecords(
|
|
|
+ Collection<WmScorePackage> packageRecords) {
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(packageRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
|
|
|
- if (CollUtil.isEmpty(packageRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
+ List<Integer> collect =
|
|
|
+ packageRecords.stream()
|
|
|
+ .mapToInt(pkg -> Integer.parseInt(pkg.getId()))
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return packageContractService.list(
|
|
|
+ Wrappers.<WmPackageContract>lambdaQuery().in(WmPackageContract::getPackageId, collect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取积分包任务类型记录数
|
|
|
+ *
|
|
|
+ * @param packageRecords 积分包记录
|
|
|
+ * @return 积分包任务类型数记录
|
|
|
+ */
|
|
|
+ private List<WmPackageTaskTypeQty> getPackageTaskTypeQtyRecords(
|
|
|
+ Collection<WmScorePackage> packageRecords) {
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(packageRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
|
|
|
- List<Integer> collect = packageRecords.stream().mapToInt(pkg -> Integer.parseInt(pkg.getId())).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
+ List<Integer> collect =
|
|
|
+ packageRecords.stream()
|
|
|
+ .mapToInt(pkg -> Integer.parseInt(pkg.getId()))
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return packageTaskTypeQtyService.listPkgTaskTypeQtyByPkgIds(collect);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取原始任务积分包任务类型记录
|
|
|
+ *
|
|
|
+ * @param packageRecords 执行包记录
|
|
|
+ * @return 记录集合
|
|
|
+ */
|
|
|
+ private List<WmScoreTaskType> getScoreTaskTypeRecords(Collection<WmScorePackage> packageRecords) {
|
|
|
+ if (CollUtil.isEmpty(packageRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
|
|
|
- return packageContractService.list(Wrappers.<WmPackageContract>lambdaQuery().in(WmPackageContract::getPackageId, collect));
|
|
|
+ List<String> collect =
|
|
|
+ packageRecords.stream()
|
|
|
+ .map(WmScorePackage::getId)
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return packageTaskTypeService.list(
|
|
|
+ Wrappers.<WmScoreTaskType>lambdaQuery().in(WmScoreTaskType::getScoreId, collect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取任务记录
|
|
|
+ *
|
|
|
+ * @param packageRecords 执行包记录
|
|
|
+ * @return 任务集合
|
|
|
+ */
|
|
|
+ private List<WmTask> getTaskRecords(Collection<WmScorePackage> packageRecords) {
|
|
|
+ if (CollUtil.isEmpty(packageRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
|
|
|
+ List<String> collect =
|
|
|
+ packageRecords.stream()
|
|
|
+ .map(WmScorePackage::getId)
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return taskService.list(Wrappers.<WmTask>lambdaQuery().in(WmTask::getScorePackageId, collect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取任务内容
|
|
|
+ *
|
|
|
+ * @param taskRecords 任务记录
|
|
|
+ * @return 任务内容集合
|
|
|
+ */
|
|
|
+ private List<WmTaskContent> getTaskContentRecords(Collection<WmTask> taskRecords) {
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(taskRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取积分包任务类型记录数
|
|
|
- *
|
|
|
- * @param packageRecords 积分包记录
|
|
|
- * @return 积分包任务类型数记录
|
|
|
- */
|
|
|
- private List<WmPackageTaskTypeQty> getPackageTaskTypeQtyRecords(Collection<WmScorePackage> packageRecords) {
|
|
|
+ List<Integer> collect =
|
|
|
+ taskRecords.stream()
|
|
|
+ .mapToInt(t -> Integer.parseInt(t.getTaskContentId()))
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
- if (CollUtil.isEmpty(packageRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
+ return taskContentService.listByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- List<Integer> collect = packageRecords.stream().mapToInt(pkg -> Integer.parseInt(pkg.getId())).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
+ /**
|
|
|
+ * 获取任务监察记录
|
|
|
+ *
|
|
|
+ * @param taskRecords 任务记录
|
|
|
+ * @return 监察记录
|
|
|
+ */
|
|
|
+ private List<WmTaskSupervision> getTaskSupervisionRecords(Collection<WmTask> taskRecords) {
|
|
|
|
|
|
- return packageTaskTypeQtyService.listPkgTaskTypeQtyByPkgIds(collect);
|
|
|
+ if (CollUtil.isEmpty(taskRecords)) {
|
|
|
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取原始任务积分包任务类型记录
|
|
|
- *
|
|
|
- * @param packageRecords 执行包记录
|
|
|
- * @return 记录集合
|
|
|
- */
|
|
|
- private List<WmScoreTaskType> getScoreTaskTypeRecords(Collection<WmScorePackage> packageRecords) {
|
|
|
- if (CollUtil.isEmpty(packageRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
-
|
|
|
- List<String> collect = packageRecords.stream().map(WmScorePackage::getId).distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- return packageTaskTypeService.list(Wrappers.<WmScoreTaskType>lambdaQuery().in(WmScoreTaskType::getScoreId, collect));
|
|
|
-
|
|
|
+ List<Integer> collect =
|
|
|
+ taskRecords.stream()
|
|
|
+ .mapToInt(t -> Integer.parseInt(t.getId()))
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return taskSupervisionService.list(
|
|
|
+ Wrappers.<WmTaskSupervision>lambdaQuery().in(WmTaskSupervision::getTaskId, collect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取任务监察建议
|
|
|
+ *
|
|
|
+ * @param taskSupervisionRecords 任务监察记录
|
|
|
+ * @return 监察建议集合
|
|
|
+ */
|
|
|
+ private List<WmTaskSupervisionAdvice> getTaskSupervisionAdviceRecords(
|
|
|
+ Collection<WmTaskSupervision> taskSupervisionRecords) {
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(taskSupervisionRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ List<Long> collect =
|
|
|
+ taskSupervisionRecords.stream()
|
|
|
+ .mapToLong(WmTaskSupervision::getSupervisionId)
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return taskSupervisionAdviceService.list(
|
|
|
+ Wrappers.<WmTaskSupervisionAdvice>lambdaQuery()
|
|
|
+ .in(WmTaskSupervisionAdvice::getTaskSupervisionId, collect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取任务审核历史
|
|
|
+ *
|
|
|
+ * @param taskRecords 任务记录
|
|
|
+ * @return 审核历史
|
|
|
+ */
|
|
|
+ private List<SysCheckChainNodeCheckHistory> getCheckChainNodeCheckHistoryRecords(
|
|
|
+ Collection<WmTask> taskRecords) {
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(taskRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取任务记录
|
|
|
- *
|
|
|
- * @param packageRecords 执行包记录
|
|
|
- * @return 任务集合
|
|
|
- */
|
|
|
- private List<WmTask> getTaskRecords(Collection<WmScorePackage> packageRecords) {
|
|
|
- if (CollUtil.isEmpty(packageRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
-
|
|
|
- List<String> collect = packageRecords.stream().map(WmScorePackage::getId).distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- return taskService.list(Wrappers.<WmTask>lambdaQuery().in(WmTask::getScorePackageId, collect));
|
|
|
+ List<Integer> collect =
|
|
|
+ taskRecords.stream()
|
|
|
+ .mapToInt(t -> Integer.parseInt(t.getId()))
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return checkChainNodeCheckHistoryService.list(
|
|
|
+ Wrappers.<SysCheckChainNodeCheckHistory>lambdaQuery()
|
|
|
+ .in(SysCheckChainNodeCheckHistory::getTargetId, collect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取积分包兑付通知
|
|
|
+ *
|
|
|
+ * @param packageRecords 积分包记录
|
|
|
+ * @return 兑付通知记录
|
|
|
+ */
|
|
|
+ private List<WmPackageRedemptionNotice> getRedemptionNoticeRecords(
|
|
|
+ Collection<WmScorePackage> packageRecords) {
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(packageRecords)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
|
|
|
+ List<Integer> collect =
|
|
|
+ packageRecords.stream()
|
|
|
+ .map(pkg -> Integer.parseInt(pkg.getId()))
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return packageRedemptionNoticeService.list(
|
|
|
+ Wrappers.<WmPackageRedemptionNotice>lambdaQuery()
|
|
|
+ .in(WmPackageRedemptionNotice::getPackageId, collect));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 归档积分包(用于终止操作)
|
|
|
+ *
|
|
|
+ * @param operator 操作人
|
|
|
+ * @param resource 归档信息
|
|
|
+ * @return 处理结果
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean destroyPkg(SysArchiveDto.OnPkgStop resource, HnqzUser operator) {
|
|
|
+
|
|
|
+ String pkgId = resource.getPkgId();
|
|
|
+
|
|
|
+ // 获取当前ID的记录
|
|
|
+ WmScorePackage pkg = packageService.getById(pkgId);
|
|
|
+
|
|
|
+ if (pkg == null) {
|
|
|
+ log.info("归档所需的执行包不存在");
|
|
|
+ throw new BizException("归档所需的执行包不存在");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取任务内容
|
|
|
- *
|
|
|
- * @param taskRecords 任务记录
|
|
|
- * @return 任务内容集合
|
|
|
- */
|
|
|
- private List<WmTaskContent> getTaskContentRecords(Collection<WmTask> taskRecords) {
|
|
|
+ // 判断是否需要更新积分
|
|
|
+ boolean isRootPkg = StrUtil.isBlank(pkg.getRelationScoreId());
|
|
|
+
|
|
|
+ // // 获取要归档的数据
|
|
|
+ // // 1.1 获取需要的的归档记录
|
|
|
+ // List<SysImplementPlan> planRecords = getPlanRecords(plan);
|
|
|
+
|
|
|
+ // // 1.2 获取所需要的归档详情
|
|
|
+ // List<SysImplPlanDetails> planDetailsRecords = getPlanDetailsRecords(planRecords);
|
|
|
+
|
|
|
+ // // 1.3 获取所有归档的拆机详情
|
|
|
+ // List<SysImplPlanDetailsItem> planDetailsItemRecords =
|
|
|
+ // getPlanDetailsItemRecords(planDetailsRecords);
|
|
|
+
|
|
|
+ // 1.4 获取计划和执行包的关联关系
|
|
|
+ List<SysPlanPkg> planPkgRecords = getPlanPkgRecords1(pkgId);
|
|
|
+
|
|
|
+ // 1.5 获取要归档的执行包
|
|
|
+ List<WmScorePackage> packageRecords = Collections.singletonList(pkg);
|
|
|
+
|
|
|
+ // 1.6 获取要归档的领取记录
|
|
|
+ List<WmScorePackageStatus> packageStatusRecords = getPackageStatusRecords(packageRecords);
|
|
|
+
|
|
|
+ // 1.7 获取积分包的合同记录
|
|
|
+ List<WmPackageContract> packageContractRecords = getPackageContractRecords(packageRecords);
|
|
|
+
|
|
|
+ // 1.8 获取积分包任务类型个数
|
|
|
+ List<WmPackageTaskTypeQty> packageTaskTypeQtyRecords =
|
|
|
+ getPackageTaskTypeQtyRecords(packageRecords);
|
|
|
+
|
|
|
+ // 1.9 获取原始积分包任务类型记录
|
|
|
+ List<WmScoreTaskType> scoreTaskTypeRecords = getScoreTaskTypeRecords(packageRecords);
|
|
|
+
|
|
|
+ // 1.10 获取任务记录
|
|
|
+ List<WmTask> taskRecords = getTaskRecords(packageRecords);
|
|
|
+
|
|
|
+ // 1.11 获取任务内容记录
|
|
|
+ List<WmTaskContent> taskContentRecords = getTaskContentRecords(taskRecords);
|
|
|
+
|
|
|
+ // 1.12 获取任务审核历史
|
|
|
+ List<SysCheckChainNodeCheckHistory> checkChainNodeCheckHistoryRecords =
|
|
|
+ getCheckChainNodeCheckHistoryRecords(taskRecords);
|
|
|
+
|
|
|
+ // 1.13 获取监察记录
|
|
|
+ List<WmTaskSupervision> taskSupervisionRecords = getTaskSupervisionRecords(taskRecords);
|
|
|
+
|
|
|
+ // 1.14 获取监察建议记录
|
|
|
+ List<WmTaskSupervisionAdvice> taskSupervisionAdviceRecords =
|
|
|
+ getTaskSupervisionAdviceRecords(taskSupervisionRecords);
|
|
|
+
|
|
|
+ // 1.15 获取执行包的兑付通知
|
|
|
+ List<WmPackageRedemptionNotice> redemptionNoticeRecords =
|
|
|
+ getRedemptionNoticeRecords(packageRecords);
|
|
|
+
|
|
|
+ // 保存归档信息
|
|
|
+ // 2.1 构建归档项
|
|
|
+ SysArchiveEntity archiveEntity = new SysArchiveEntity();
|
|
|
+ archiveEntity.setArchiveHead("PKG");
|
|
|
+ archiveEntity.setOriginInfo(pkg.getScorePackageName());
|
|
|
+ archiveEntity.setArchiveInfo(
|
|
|
+ String.format(
|
|
|
+ "%s(%s终止)",
|
|
|
+ pkg.getScorePackageName(),
|
|
|
+ DateTimeFormatter.ofPattern(DatePattern.PURE_DATETIME_PATTERN)
|
|
|
+ .format(LocalDateTime.now())));
|
|
|
+ archiveEntity.setArchiveReason(resource.getArchiveReason());
|
|
|
+ archiveEntity.setCreateBy(operator.getUsername());
|
|
|
+ archiveEntity.setCreateTime(LocalDateTime.now());
|
|
|
+ archiveService.save(archiveEntity);
|
|
|
+
|
|
|
+ // 2.2 构建归档项记录
|
|
|
+ Integer archiveId = archiveEntity.getArchiveId();
|
|
|
+ List<SysArchiveItem> items = new LinkedList<>();
|
|
|
+
|
|
|
+ // 2.2.4 计划执行包关联关系
|
|
|
+ if (CollUtil.isNotEmpty(planPkgRecords)) {
|
|
|
+ String clzName = SysPlanPkg.class.getSimpleName();
|
|
|
+ String fullClzName = SysPlanPkg.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ planPkgRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- if (CollUtil.isEmpty(taskRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
+ // 2.2.5 归档的执行包
|
|
|
+ if (CollUtil.isNotEmpty(packageRecords)) {
|
|
|
+ String clzName = WmScorePackage.class.getSimpleName();
|
|
|
+ String fullClzName = WmScorePackage.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ packageRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- List<Integer> collect = taskRecords.stream().mapToInt(t -> Integer.parseInt(t.getTaskContentId())).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
+ // 2.2.6 归档领取记录
|
|
|
+ if (CollUtil.isNotEmpty(packageStatusRecords)) {
|
|
|
+ String clzName = WmScorePackageStatus.class.getSimpleName();
|
|
|
+ String fullClzName = WmScorePackageStatus.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ packageStatusRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- return taskContentService.listByIds(collect);
|
|
|
+ // 2.2.7 归档包合同
|
|
|
+ if (CollUtil.isNotEmpty(packageContractRecords)) {
|
|
|
+ String clzName = WmPackageContract.class.getSimpleName();
|
|
|
+ String fullClzName = WmPackageContract.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ packageContractRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
+ // 2.2.8 包任务类型分配数
|
|
|
+ if (CollUtil.isNotEmpty(packageTaskTypeQtyRecords)) {
|
|
|
+ String clzName = WmPackageTaskTypeQty.class.getSimpleName();
|
|
|
+ String fullClzName = WmPackageTaskTypeQty.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ packageTaskTypeQtyRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
+ // 2.2.9 原始任务类型数
|
|
|
+ if (CollUtil.isNotEmpty(scoreTaskTypeRecords)) {
|
|
|
+ String clzName = WmScoreTaskType.class.getSimpleName();
|
|
|
+ String fullClzName = WmScoreTaskType.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ scoreTaskTypeRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取任务监察记录
|
|
|
- *
|
|
|
- * @param taskRecords 任务记录
|
|
|
- * @return 监察记录
|
|
|
- */
|
|
|
- private List<WmTaskSupervision> getTaskSupervisionRecords(Collection<WmTask> taskRecords) {
|
|
|
+ // 2.2.10 任务记录
|
|
|
+ if (CollUtil.isNotEmpty(taskRecords)) {
|
|
|
+ String clzName = WmTask.class.getSimpleName();
|
|
|
+ String fullClzName = WmTask.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ taskRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- if (CollUtil.isEmpty(taskRecords)) {
|
|
|
+ // 2.2.11 任务内容
|
|
|
+ if (CollUtil.isNotEmpty(taskContentRecords)) {
|
|
|
+ String clzName = WmTaskContent.class.getSimpleName();
|
|
|
+ String fullClzName = WmTaskContent.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ taskContentRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
+ // 2.2.12 审核历史
|
|
|
+ if (CollUtil.isNotEmpty(checkChainNodeCheckHistoryRecords)) {
|
|
|
+ String clzName = SysCheckChainNodeCheckHistory.class.getSimpleName();
|
|
|
+ String fullClzName = SysCheckChainNodeCheckHistory.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ checkChainNodeCheckHistoryRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- List<Integer> collect = taskRecords.stream().mapToInt(t -> Integer.parseInt(t.getId())).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
+ // 2.2.13 任务监察
|
|
|
+ if (CollUtil.isNotEmpty(taskSupervisionRecords)) {
|
|
|
+ String clzName = WmTaskSupervision.class.getSimpleName();
|
|
|
+ String fullClzName = WmTaskSupervision.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ taskSupervisionRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- return taskSupervisionService.list(Wrappers.<WmTaskSupervision>lambdaQuery().in(WmTaskSupervision::getTaskId, collect));
|
|
|
+ // 2.2.14 任务监察建议
|
|
|
+ if (CollUtil.isNotEmpty(taskSupervisionAdviceRecords)) {
|
|
|
+ String clzName = WmTaskSupervisionAdvice.class.getSimpleName();
|
|
|
+ String fullClzName = WmTaskSupervisionAdvice.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ taskSupervisionAdviceRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取任务监察建议
|
|
|
- *
|
|
|
- * @param taskSupervisionRecords 任务监察记录
|
|
|
- * @return 监察建议集合
|
|
|
- */
|
|
|
- private List<WmTaskSupervisionAdvice> getTaskSupervisionAdviceRecords(Collection<WmTaskSupervision> taskSupervisionRecords) {
|
|
|
+ // 2.2.15 兑付通知记录
|
|
|
+ if (CollUtil.isNotEmpty(redemptionNoticeRecords)) {
|
|
|
+ String clzName = WmPackageRedemptionNotice.class.getSimpleName();
|
|
|
+ String fullClzName = WmPackageRedemptionNotice.class.getName();
|
|
|
+
|
|
|
+ List<SysArchiveItem> collect =
|
|
|
+ redemptionNoticeRecords.stream()
|
|
|
+ .map(
|
|
|
+ record -> {
|
|
|
+ SysArchiveItem item = new SysArchiveItem();
|
|
|
+ item.setClassName(clzName);
|
|
|
+ item.setFullClassName(fullClzName);
|
|
|
+ item.setItemContent(JSONUtil.toJsonStr(record));
|
|
|
+ item.setArchiveId(archiveId);
|
|
|
+
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ items.addAll(collect);
|
|
|
+ }
|
|
|
|
|
|
- if (CollUtil.isEmpty(taskSupervisionRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
- List<Long> collect = taskSupervisionRecords.stream().mapToLong(WmTaskSupervision::getSupervisionId).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
+ archiveItemService.saveBatch(items);
|
|
|
|
|
|
- return taskSupervisionAdviceService.list(Wrappers.<WmTaskSupervisionAdvice>lambdaQuery().in(WmTaskSupervisionAdvice::getTaskSupervisionId, collect));
|
|
|
+ // ~ 删除历史数据==========================
|
|
|
+ // 3.1 删除执行包
|
|
|
+ packageService.removeById(pkgId);
|
|
|
|
|
|
+ // 3.4 删除计划执行包关联关系
|
|
|
+ if (CollUtil.isNotEmpty(planPkgRecords)) {
|
|
|
+ for (SysPlanPkg planPkg : planPkgRecords) {
|
|
|
+ planPkgService.remove(
|
|
|
+ Wrappers.<SysPlanPkg>lambdaQuery()
|
|
|
+ .eq(SysPlanPkg::getPlanId, planPkg.getPlanId())
|
|
|
+ .eq(SysPlanPkg::getPkgId, planPkg.getPkgId()));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取任务审核历史
|
|
|
- *
|
|
|
- * @param taskRecords 任务记录
|
|
|
- * @return 审核历史
|
|
|
- */
|
|
|
- private List<SysCheckChainNodeCheckHistory> getCheckChainNodeCheckHistoryRecords(Collection<WmTask> taskRecords) {
|
|
|
+ // 3.5 删除归档的执行包
|
|
|
+ if (CollUtil.isNotEmpty(packageRecords)) {
|
|
|
+ Set<String> collect =
|
|
|
+ packageRecords.stream().map(WmScorePackage::getId).collect(Collectors.toSet());
|
|
|
+ packageService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- if (CollUtil.isEmpty(taskRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
+ // 3.6 删除归档领取记录
|
|
|
+ if (CollUtil.isNotEmpty(packageStatusRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ packageStatusRecords.stream()
|
|
|
+ .map(WmScorePackageStatus::getId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ packageStatusService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- List<Integer> collect = taskRecords.stream().mapToInt(t -> Integer.parseInt(t.getId())).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
+ // 3.7 删除归档包合同
|
|
|
+ if (CollUtil.isNotEmpty(packageContractRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ packageContractRecords.stream()
|
|
|
+ .mapToInt(WmPackageContract::getContractId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ packageContractService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- return checkChainNodeCheckHistoryService.list(Wrappers.<SysCheckChainNodeCheckHistory>lambdaQuery().in(SysCheckChainNodeCheckHistory::getTargetId, collect));
|
|
|
+ // 3.8 删除包任务类型分配数
|
|
|
+ if (CollUtil.isNotEmpty(packageTaskTypeQtyRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ packageTaskTypeQtyRecords.stream()
|
|
|
+ .mapToInt(WmPackageTaskTypeQty::getRecordId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ packageTaskTypeQtyService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
+ // 3.9 删除原始任务类型数
|
|
|
+ if (CollUtil.isNotEmpty(scoreTaskTypeRecords)) {
|
|
|
+ Set<Long> collect =
|
|
|
+ scoreTaskTypeRecords.stream()
|
|
|
+ .mapToLong(WmScoreTaskType::getId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ packageTaskTypeService.removeByIds(collect);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取积分包兑付通知
|
|
|
- *
|
|
|
- * @param packageRecords 积分包记录
|
|
|
- * @return 兑付通知记录
|
|
|
- */
|
|
|
- private List<WmPackageRedemptionNotice> getRedemptionNoticeRecords(Collection<WmScorePackage> packageRecords) {
|
|
|
+ // 3.10 删除任务记录
|
|
|
+ if (CollUtil.isNotEmpty(taskRecords)) {
|
|
|
+ Set<String> collect = taskRecords.stream().map(WmTask::getId).collect(Collectors.toSet());
|
|
|
+ taskService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- if (CollUtil.isEmpty(packageRecords)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
+ // 3.11 删除任务内容
|
|
|
+ if (CollUtil.isNotEmpty(taskContentRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ taskContentRecords.stream()
|
|
|
+ .mapToInt(WmTaskContent::getId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ taskContentService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- List<Integer> collect = packageRecords.stream().map(pkg -> Integer.parseInt(pkg.getId())).distinct().sorted().collect(Collectors.toList());
|
|
|
+ // 3.12 删除审核历史
|
|
|
+ if (CollUtil.isNotEmpty(checkChainNodeCheckHistoryRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ checkChainNodeCheckHistoryRecords.stream()
|
|
|
+ .mapToInt(SysCheckChainNodeCheckHistory::getHistoryId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ checkChainNodeCheckHistoryService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
- return packageRedemptionNoticeService.list(Wrappers.<WmPackageRedemptionNotice>lambdaQuery().in(WmPackageRedemptionNotice::getPackageId, collect));
|
|
|
+ // 3.13 删除任务监察
|
|
|
+ if (CollUtil.isNotEmpty(taskSupervisionRecords)) {
|
|
|
+ Set<Long> collect =
|
|
|
+ taskSupervisionRecords.stream()
|
|
|
+ .mapToLong(WmTaskSupervision::getSupervisionId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ taskSupervisionService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
+ // 3.14 删除任务监察建议
|
|
|
+ if (CollUtil.isNotEmpty(taskSupervisionAdviceRecords)) {
|
|
|
+ Set<Long> collect =
|
|
|
+ taskSupervisionAdviceRecords.stream()
|
|
|
+ .mapToLong(WmTaskSupervisionAdvice::getAdviceId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ taskSupervisionAdviceService.removeByIds(collect);
|
|
|
+ }
|
|
|
|
|
|
+ // 3.15 删除执行包兑付通知
|
|
|
+ if (CollUtil.isNotEmpty(redemptionNoticeRecords)) {
|
|
|
+ Set<Integer> collect =
|
|
|
+ redemptionNoticeRecords.stream()
|
|
|
+ .mapToInt(WmPackageRedemptionNotice::getNoticeId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ packageRedemptionNoticeService.removeByIds(collect);
|
|
|
}
|
|
|
|
|
|
+ // ~ 更新必要数据==========================
|
|
|
+ // 如果不是跟计划,需要父级更新可用分值
|
|
|
+ if (!isRootPkg) {
|
|
|
+
|
|
|
+ WmScorePackage parentPkg = packageService.getById(pkg.getRelationScoreId());
|
|
|
+ parentPkg.setKfpjf(parentPkg.getKfpjf() + pkg.getScore());
|
|
|
+ parentPkg.setUpdateTime(LocalDateTime.now());
|
|
|
+ parentPkg.setUpdateUser(operator.getId());
|
|
|
+ String remark =
|
|
|
+ "下游执行包(ID:" + pkgId + "),被终止(操作人:" + operator.getId() + "),归还积分(" + pkg.getScore() + ");";
|
|
|
+ parentPkg.setRemark(remark);
|
|
|
+ packageService.updateById(parentPkg);
|
|
|
+ }
|
|
|
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
}
|