diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingReviewTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingReviewTypeEnum.java
index 37d1adc..813a136 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingReviewTypeEnum.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/enumeration/MeetingReviewTypeEnum.java
@@ -1,13 +1,15 @@
package com.hz.pm.api.meeting.entity.enumeration;
+import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
+import java.util.Optional;
/**
*
- * MeetingReviewTypeEnum
+ * 会议评审类型
*
*
* @author WendyYang
@@ -17,19 +19,6 @@ import java.util.Arrays;
@AllArgsConstructor
public enum MeetingReviewTypeEnum {
- /**
- * 会议评审类型
- */
- PRELIMINARY_SCHEME_REVIEW("初步方案评审", "1"),
-
- CONSTRUCTION_SCHEME_REVIEW("建设方案评审", "2"),
-
- ACCEPTANCE_SCHEME_REVIEW("验收方案评审", "3"),
-
- DEPT_JOIN_REVIEW("部门联审", "4"),
-
- FAIRNESS_REVIEW("公平性审查", "5"),
-
PROJECT_REVIEW("项目评审", "6"),
EXPERT_REVIEW("专家论证", "7");
@@ -41,19 +30,20 @@ public enum MeetingReviewTypeEnum {
return this.getCode().equals(code);
}
- public static MeetingReviewTypeEnum getByCode(String code) {
+ public static MeetingReviewTypeEnum getNoNull(String code) {
+ return get(code).orElseThrow(() -> new IllegalArgumentException("无效的会议评审类型编码"));
+ }
+
+ public static Optional get(String code) {
return Arrays.stream(values())
.filter(w -> w.getCode().equals(code))
- .findFirst()
- .orElseThrow(() -> new IllegalArgumentException("无效的会议评审类型编码"));
+ .findFirst();
}
public static String getValue(String code) {
- return Arrays.stream(values())
- .filter(w -> w.getCode().equals(code))
- .map(MeetingReviewTypeEnum::getValue)
- .findFirst()
- .orElse("未知");
+ return get(code)
+ .flatMap(w -> Optional.of(w.getValue()))
+ .orElse(StrUtil.EMPTY);
}
}
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingOptionProjectReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingOptionProjectReq.java
index 4640631..37ce98a 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingOptionProjectReq.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingOptionProjectReq.java
@@ -1,7 +1,6 @@
package com.hz.pm.api.meeting.entity.req;
import com.ningdatech.basic.model.PagePo;
-import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -19,7 +18,4 @@ public class MeetingOptionProjectReq extends PagePo {
private String meetingType;
- @ApiModelProperty("会议ID")
- private Long meetingId;
-
}
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java
index 257a842..d806a90 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java
@@ -48,7 +48,6 @@ import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil;
import com.hz.pm.api.projectlib.helper.ProjectManageUtil;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
-import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.scheduler.listener.event.MhTodoSendEvent;
import com.hz.pm.api.sys.model.dto.RegionDTO;
@@ -56,6 +55,8 @@ import com.hz.pm.api.sys.model.entity.MsgCallRecord;
import com.hz.pm.api.sys.model.enumeration.SubmitTypeEnum;
import com.hz.pm.api.sys.service.IMsgCallRecordService;
import com.hz.pm.api.user.helper.MhUnitCache;
+import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper;
+import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper.UnitQueryState;
import com.hz.pm.api.user.model.entity.UserInfo;
import com.hz.pm.api.user.model.enumeration.RoleEnum;
import com.hz.pm.api.user.security.model.UserInfoDetails;
@@ -119,7 +120,7 @@ public class MeetingManage {
private final MhUnitCache mhUnitCache;
private final ProjectStateMachineUtil projectStateMachineUtil;
private final IMsgCallRecordService msgCallRecordService;
- private final IProjectInstService projectInstService;
+ private final MhUnitQueryAuthHelper mhUnitQueryAuthHelper;
private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:";
@@ -1078,51 +1079,27 @@ public class MeetingManage {
}
public PageVo optionProject(MeetingOptionProjectReq req) {
+ UnitQueryState unitQueryState = mhUnitQueryAuthHelper.listCanViewUnitIds(null);
+ if (!unitQueryState.isState()) {
+ return PageVo.empty();
+ }
String meetingType = req.getMeetingType();
LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class)
- .eq(Project::getNewest, Boolean.TRUE)
- .notIn(Project::getStage, ProjectStatus.STOPPED.getCode(), ProjectStatus.CHANGE.getCode());
- UserInfoDetails userDetail = LoginUserUtil.userDetailNotNull();
- switch (userDetail.maxAuthRole()) {
- case SUPER_ADMIN:
- break;
- case COMPANY_MANAGER:
- if (MhUnitConst.ROOT_UNIT_ID != userDetail.getMhUnitId()) {
- List viewUnitIds = mhUnitCache.getViewChildIdsRecursion(userDetail.getMhUnitId());
- if (CollUtil.isEmpty(viewUnitIds)) {
- return PageVo.empty();
- }
- query.in(Project::getBuildOrgCode, viewUnitIds);
- }
- break;
- default:
- query.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr());
- break;
- }
- switch (MeetingReviewTypeEnum.getByCode(meetingType)) {
- case PRELIMINARY_SCHEME_REVIEW:
- case CONSTRUCTION_SCHEME_REVIEW:
- case DEPT_JOIN_REVIEW:
- buildOptionProjectQuery(query, meetingType);
- buildOptionProjectQuery(query, meetingType);
- break;
- case ACCEPTANCE_SCHEME_REVIEW:
- buildOptionProjectQuery(query, meetingType, ProjectStatus.ON_FINALLY_INSPECTED);
- break;
- case FAIRNESS_REVIEW:
- break;
+ .notIn(Project::getStage, ProjectStatus.STOP_CHANGE_STAGE_CODES)
+ .eq(Project::getNewest, Boolean.TRUE);
+ BizUtils.notEmpty(unitQueryState.getUnitIds(), w -> {
+ List unitIdStrList = CollUtils.convert(w, String::valueOf);
+ query.in(Project::getBuildOrgCode, unitIdStrList);
+ });
+ switch (MeetingReviewTypeEnum.getNoNull(meetingType)) {
case PROJECT_REVIEW:
case EXPERT_REVIEW:
- query.isNotNull(Project::getConstructionPlanSealFile);
- buildOptionProjectQuery(query, meetingType, ProjectStatus.WITHOUT_EXPERT_REVIEW);
+ query.eq(Project::getStatus, ProjectStatus.WITHOUT_EXPERT_REVIEW.getCode())
+ .isNotNull(Project::getConstructionPlanSealFile);
break;
default:
return PageVo.empty();
}
- if (req.getMeetingId() != null) {
- query.notExists("select 1 from meeting_inner_project mip on mip.project_code = nd_project.project_code" +
- " and nd_project.newest = 1 and mip.meeting_id = {0}", req.getMeetingId());
- }
ProjectManageUtil.projectBaseQuery(query);
Page page = projectService.page(req.page(), query);
PageVo result = PageVo.of(null, page.getTotal());
@@ -1165,22 +1142,6 @@ public class MeetingManage {
return ProjectReviewResultBuilder.convert(projectReview);
}
- private void buildOptionProjectQuery(LambdaQueryWrapper query, String meetingType, ProjectStatus... statusList) {
- if (statusList != null && statusList.length > 0) {
- List statusCodeList = CollUtils.fieldList(Arrays.asList(statusList), ProjectStatus::getCode);
- query.in(Project::getStatus, statusCodeList);
- }
- String sql = String.format("select 1 from meeting m inner join meeting_inner_project mip on" +
- " m.is_inner_project = 1 and m.id = mip.meeting_id and nd_project.project_code = mip.project_code" +
- " and m.type = %s and m.status != 3", meetingType);
- String sql2 = String.format("1 = (select case when review_result in (2) then 1 else 0 end from " +
- " (select ner.review_result from meeting m inner join meeting_inner_project mip on" +
- " m.is_inner_project = 1 and m.id = mip.meeting_id and nd_project.id = mip.project_id" +
- " and m.type = %s and m.status != 3 left join nd_expert_review ner on ner.meeting_id = m.id " +
- " and ner.project_id = mip.project_id and ner.is_final = 1 order by m.create_on desc limit 1) t)", meetingType);
- query.and(q1 -> q1.notExists(sql).or(q2 -> q2.apply(sql2)));
- }
-
public void uploadMeetingResult(MeetingResultUploadReq req) {
String key = "meeting_result_upload:" + req.getMeetingId();
if (!distributedLock.lock(key, RETRY_TIMES)) {
diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java
index 08802ab..e19eee6 100644
--- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java
+++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java
@@ -6,6 +6,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
+import java.util.List;
import java.util.Optional;
/**
@@ -115,4 +116,6 @@ public enum ProjectStatus implements IStatus {
return get(code).orElseThrow(() -> BizException.wrap("项目状态无效:%s", code));
}
+ public static final List STOP_CHANGE_STAGE_CODES = Arrays.asList(CHANGE.getCode(), STOPPED.getCode());
+
}