From 1212ccd507d67f7424ef93b104692321dad3d70e Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 4 Sep 2024 10:33:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B3=A8=E9=87=8A=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/EarlyWarningWithoutSubmitTask.java | 141 --------------------- 1 file changed, 141 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningWithoutSubmitTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningWithoutSubmitTask.java index f31d133..3273b41 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningWithoutSubmitTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningWithoutSubmitTask.java @@ -125,7 +125,6 @@ public class EarlyWarningWithoutSubmitTask { List unitIdPathsStr = CollUtils.convert(unitIdPaths, String::valueOf); String orderSql = String.format(" order by field(mh_unit_id, %s) desc limit 1", CollUtils.join(unitIdPaths, w -> "'" + w + "'", StrUtil.COMMA)); - log.info("单位ID路径:{}", unitIdPathsStr); // 从当前建设单位开始向上获取滞后预警规则 WflowEarlyWarning warning = earlyWarningService.getOne(Wrappers.lambdaQuery(WflowEarlyWarning.class) .eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.DELAY_WARNING.getCode()) @@ -297,146 +296,6 @@ public class EarlyWarningWithoutSubmitTask { } stopWatch.stop(); log.info("=========== 滞后预警任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); - - //log.info("=========== 滞后预警任务开始 ==========="); - //StopWatch stopWatch = new StopWatch(); - //stopWatch.start(); - //// 1.查询 填报的 滞后预警规则 填报类型的 每个单位的 每个规则 - //Wrapper query = Wrappers.lambdaQuery(WflowEarlyWarning.class) - // .eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.DELAY_WARNING.getCode()) - // .eq(WflowEarlyWarning::getIsOpen, true); - //List warnings = earlyWarningService.list(query); - //for (WflowEarlyWarning warning : warnings) { - // long mhUnitId = warning.getMhUnitId(); - // String rule = warning.getRule(); - // if (StringUtils.isNotBlank(rule)) { - // JSONArray ruleArray = JSON.parseArray(rule); - // if (CollUtil.isNotEmpty(ruleArray)) { - // ruleArray.forEach(r -> { - // JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); - // Integer biz = rJson.getInteger("biz"); - // Integer delayTime = rJson.getInteger("delayTime"); - // String notice = rJson.getString("notice"); - // WarningFlowTypeEnum flowType = WarningFlowTypeEnum.getByCode(biz); - // if (Objects.isNull(delayTime) || Objects.isNull(biz) || flowType == null) { - // log.warn("规则数据 错误 :{}", rJson); - // return; - // } - // String path = flowType.getPath(); - // // 查询 所有这个单位 所配置滞后规则节点 未提交的项目 - // Wrapper projectQuery = Wrappers.lambdaQuery(Project.class) - // .eq(Project::getBuildOrgCode, mhUnitId) - // .eq(Project::getNewest, Boolean.TRUE) - // .eq(Project::getStatus, flowType.getProjectStatus().getCode()); - // List needNextProjects = projectService.list(projectQuery); - // List projectCodes = CollUtils.fieldList(needNextProjects, Project::getProjectCode); - // Map projectStatusChangeMap = MapUtil.newHashMap(); - // String stepName = null; - // switch (flowType) { - // // 已立项未采购 获取 立项时间 - // case APPROVED_PROJECT_NOT_PURCHASED:{ - // stepName = TaskConstant.StepName.PURCHASE; - // if (CollUtil.isNotEmpty(projectCodes)) { - // Map approvedProjectNotPurchasedMap = projectStatusChangeService.listLastEventMap(projectCodes, - // ProjectStateChangeEvent.DECLARED_RECORD_PASS); - // if (CollUtil.isNotEmpty(approvedProjectNotPurchasedMap)) { - // projectStatusChangeMap.putAll(approvedProjectNotPurchasedMap); - // } - // } - // } - // break; - // // 已采购未改造完成 获取合同签订时间 - // case PURCHASED_UNMODIFIED:{ - // stepName = TaskConstant.StepName.ADAPT_MODIFY; - // if (CollUtil.isNotEmpty(projectCodes)) { - // Map purchasedUnmodifiedMap = projectStatusChangeService.listLastEventMap(projectCodes, - // ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD); - // if (CollUtil.isNotEmpty(purchasedUnmodifiedMap)) { - // projectStatusChangeMap.putAll(purchasedUnmodifiedMap); - // } - // } - // } - // break; - // // 已改造完成未终验 获取单位确认时间 - // case MODIFIED_NOT_FINAL_INSPECTION:{ - // stepName = TaskConstant.StepName.FINAL; - // if (CollUtil.isNotEmpty(projectCodes)) { - // Map modifiedNotFinalInspectionMap = projectStatusChangeService.listLastEventMap(projectCodes, - // ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM); - // if (CollUtil.isNotEmpty(modifiedNotFinalInspectionMap)) { - // projectStatusChangeMap.putAll(modifiedNotFinalInspectionMap); - // } - // } - // } - // break; - // default: - // log.error("Unexpected value: {}", flowType); - // } - // // 查询当前预警表中 已存在的的滞后预警数据 - // Wrapper warningQuery = Wrappers.lambdaQuery(ProjectEarlyWarning.class) - // .eq(ProjectEarlyWarning::getRuleType, WarningRuleTypeEnum.DELAY_WARNING.getCode()); - // List projectEarlyWarnings = projectEarlyWarningService.list(warningQuery); - // Map projectEarlyWarningMap = CollUtils.listToMap(projectEarlyWarnings, c -> c.getProjectCode() + StrPool.DASH + c.getStepName()); - // // 按照当前配置的滞后规则 获取需要首页监测预警展示的项目 - // // 获取项目 滞后(历时)时间 - // HashMap touchTimeMap = MapUtil.newHashMap(); - // String finalStepName = stepName; - // List needRemoved = Lists.newArrayList(); - // List needToWaringProjects = needNextProjects.stream() - // .filter(p -> { - // ProjectStatusChange change = projectStatusChangeMap.get(p.getProjectCode()); - // LocalDateTime touchTime = change == null ? null : change.getCreateOn(); - // if (touchTime != null) { - // touchTimeMap.put(p.getProjectCode() + StrPool.DASH + biz, touchTime); - // long duration = getDurationTime(touchTime,LocalDateTime.now(),getTimeUnit()); - // if (duration > delayTime) { - // // 项目 滞后预警 - // projectEarlyWarningService.earlyWarning(p, WarningRuleTypeEnum.DELAY_WARNING.getCode(), com.wflow.enums.WarningNoticeTypeEnum.DELAY.getCode(), finalStepName); - // return Boolean.TRUE; - // }else { - // // 判断是否已经存在对应节点预警 如果有 从预警信息表中移除 - // if (projectEarlyWarningMap.containsKey(p.getProjectCode() + StrPool.DASH + finalStepName)) { - // ProjectEarlyWarning projectEarlyWarning = projectEarlyWarningMap.get(p.getProjectCode() + StrPool.DASH + finalStepName); - // needRemoved.add(projectEarlyWarning); - // } - // } - // } - // return Boolean.FALSE; - // }).collect(Collectors.toList()); - // // 根据当前配置的滞后规则 将不满足规则的历史预警信息从预警信息表中移除 - // if (CollUtil.isNotEmpty(needRemoved)){ - // projectEarlyWarningService.removeBatchByIds(needRemoved); - // } - // for (Project needToWaringProject : needToWaringProjects) { - // // 目前没有通知 - // // 如果去预警通知人 1.超级管理员 2.单位管理员 如果都包含 都要发 - // List batchEmployees = Lists.newArrayList(); - // if (StringUtils.isNotBlank(notice) && notice.contains(WarningNoticeTypeEnum.SUPER_ADMIN.getCode().toString())) { - // // 获取超级管理员用户信息 - // List superAdminUsers = userInfoHelper.getEmployeeCodesByRoleEnum(RoleEnum.SUPER_ADMIN); - // List superAdminEmployeeCodes = superAdminUsers.stream().map(UserInfo::getEmployeeCode).collect(Collectors.toList()); - // batchEmployees.addAll(superAdminEmployeeCodes); - // } - // if (StringUtils.isNotBlank(notice) && notice.contains(WarningNoticeTypeEnum.UNIT_ADMIN.getCode().toString())) { - // // 获取单位管理员用户信息 - // List unitAdminUsers = userInfoHelper.getEmployeeCodesByRoleEnum(RoleEnum.COMPANY_MANAGER); - // // 过滤出当前项目所属单位的单位管理员 - // List unitAdminEmployeeCodes = unitAdminUsers.stream().filter(user -> Objects.equals(user.getMhUnitId().toString(), needToWaringProject.getBuildOrgCode())) - // .map(UserInfo::getEmployeeCode).collect(Collectors.toList()); - // batchEmployees.addAll(unitAdminEmployeeCodes); - // } - // // 保存到预警记录中 - // earlyWarningManage.doEarlyWarningDelay(warning.getNoticeMethod(), biz, needToWaringProject, - // WarningRuleTypeEnum.DELAY_WARNING.getCode(), ProjectEarlyWarningStatusEnum.DELAY_TIME.getCode(), - // path, touchTimeMap); - // } - // }); - // } - // } - //} - // - //stopWatch.stop(); - //log.info("=========== 滞后预警任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); } private boolean isTouch(WarningFlowTypeEnum flowType, Boolean isPurchase, Boolean isModified, Boolean isFinalInspection) {