diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java index c186701..79ea93d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java @@ -19,6 +19,7 @@ import com.hz.pm.api.common.statemachine.event.AbstractStateChangeEvent; import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent; import com.hz.pm.api.common.statemachine.event.XcfhxStateChangeEvent; +import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.DecimalUtil; import com.hz.pm.api.projectdeclared.model.entity.Contract; import com.hz.pm.api.projectdeclared.model.entity.Purchase; @@ -958,26 +959,24 @@ public class WorkbenchManage { } public List projectMonitorEarlyWarnings(WorkbenchReq req) { - UserInfoDetails userInfoDetails = LoginUserUtil.userDetail(); + UserInfoDetails userInfoDetails = LoginUserUtil.userDetailNotNull(); // 从预警表中查询当前登录用户所能查看的项目 LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class); buildPermissionWarningWrapper(queryWrapper, userInfoDetails); // 查询状态非正常的预警信息 queryWrapper.eq(ProjectEarlyWarning::getNormal, Boolean.FALSE); queryWrapper.ne(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.NORMAL); + List hiddenProjectStatus = Arrays.asList(ProjectStatus.STOPPED_PASSED, ProjectStatus.CHANGE_APPLY_PASSED); + String hiddenStatusInSql = BizUtils.inSqlJoin(CollUtils.convert(hiddenProjectStatus, w -> w.getCode().toString())); + StringBuilder existsProjectSql = new StringBuilder("select 1 from nd_project np where np.project_code = nd_project_early_warning.project_code" + + " and np.newest = 1 and np.status not in " + hiddenStatusInSql); if (req.getUnitStrip() != null) { - String unitStripSql = String.format("select 1 from nd_project np where " + - "np.project_code = nd_project_early_warning.project_code " + - " and np.newest = 1 and np.unit_strip = %d", req.getUnitStrip()); - queryWrapper.exists(unitStripSql); + existsProjectSql.append(" and np.unit_strip = ").append(req.getUnitStrip()); } if (req.getProjectYear() != null) { - String projectYearSql = String.format("select 1 from nd_project np where " + - "np.project_code = nd_project_early_warning.project_code " + - " and np.newest = 1 and np.project_year = %d", req.getProjectYear()); - queryWrapper.exists(projectYearSql); + existsProjectSql.append(" and np.project_year = ").append(req.getProjectYear()); } - + queryWrapper.exists(existsProjectSql.toString()); List records = projectEarlyWarningService.list(queryWrapper); if (Objects.nonNull(req.getUnitId())) { List viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId());