From 04306724ac73e70b71566c09cec4b42ddb4e56f7 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 1 Mar 2023 11:13:24 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/model/CommonPageReq.java | 22 ++ .../expert/constant/ExpertApplyTypeQueryEnum.java | 50 +++ .../controller/ExpertMetaApplyController.java | 46 ++- .../pmapi/expert/manage/ExpertMetaApplyManage.java | 387 +++++++++++++++++++++ .../pmapi/expert/model/ExtraMaterialDO.java | 29 ++ .../model/cmd/ExpertAdminExpertManageQueryCmd.java | 122 +++---- .../pmapi/expert/model/cmd/MetaApplyListQuery.java | 46 +++ .../expert/model/query/ExpertDictionaryQuery.java | 17 + .../pmapi/expert/model/query/ExpertTagQuery.java | 17 + .../pmapi/expert/model/query/ListExpertQuery.java | 59 ++++ .../expert/model/req/MetaApplyResultRequest.java | 49 +++ .../pmapi/expert/model/vo/ExpertApplyMetaVO.java | 76 ++++ .../pmapi/expert/model/vo/MetaApplyResultVo.java | 70 ++++ .../expert/service/IExpertMetaApplyService.java | 4 +- .../expert/service/IExpertUserFullInfoService.java | 10 + .../impl/ExpertUserFullInfoServiceImpl.java | 5 + .../meta/service/IExpertDictionaryService.java | 15 + .../service/impl/ExpertDictionaryServiceImpl.java | 19 +- 18 files changed, 974 insertions(+), 69 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPageReq.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeQueryEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExtraMaterialDO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/MetaApplyListQuery.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertDictionaryQuery.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertTagQuery.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ListExpertQuery.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/MetaApplyResultRequest.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertApplyMetaVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/MetaApplyResultVo.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPageReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPageReq.java new file mode 100644 index 0000000..945ca97 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPageReq.java @@ -0,0 +1,22 @@ +package com.ningdatech.pmapi.common.model; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:19 + */ +@Data +public class CommonPageReq { + private static final long serialVersionUID = 1L; + private int pageSize; + private int pageNumber; + + public int getOffset() { + return (this.getPageNumber() - 1) * this.getPageSize(); + } + + public int getLimit() { + return this.getPageSize(); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeQueryEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeQueryEnum.java new file mode 100644 index 0000000..11701dc --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeQueryEnum.java @@ -0,0 +1,50 @@ +package com.ningdatech.pmapi.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +/** + * @author liuxinxin + * @date 2022/7/26 下午1:40 + * 专家 申请类型用于前端筛选时入参展示 + */ +@AllArgsConstructor +@Getter +public enum ExpertApplyTypeQueryEnum { + + // 专家入库 + EXPERT_STORAGE("expert_storage"), + // 专家出库 + EXPERT_DELIVERY("expert_delivery"), + // 专家履职意变更 + EXPERT_INTENTION_CHANGE("expert_intention_change"), + // 长期请假申请 + LONG_TERM_LEAVE("long_term_leave"), + // 专家信息修改申请 + EXPERT_INFO_MODIFY("expert_info_modify"); + + private final String key; + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (ExpertApplyTypeQueryEnum typeEnum : ExpertApplyTypeQueryEnum.values()) { + if (typeEnum.key.equals(key)) { + return true; + } + } + return false; + } + + public static ExpertApplyTypeQueryEnum of(String key) { + for (ExpertApplyTypeQueryEnum typeEnum : ExpertApplyTypeQueryEnum.values()) { + if (typeEnum.key.equals(key)) { + return typeEnum; + } + } + throw new IllegalArgumentException(String.format("ExpertApplyTypeQueryEnum = %s", key)); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java index 0757750..95600b3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java @@ -1,10 +1,19 @@ package com.ningdatech.pmapi.expert.controller; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.expert.manage.ExpertMetaApplyManage; +import com.ningdatech.pmapi.expert.model.cmd.MetaApplyListQuery; +import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; +import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO; +import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; /** *

@@ -15,10 +24,39 @@ import org.springframework.web.bind.annotation.RestController; * @since 2023-03-01 */ @RestController -@Api(tags = "专家相关审核") -@RequestMapping("/api/v1/expert-meta-apply") +@RequestMapping("/api/v1/apply/meta/") +@Validated @RequiredArgsConstructor +@Api(value = "ExpertMetaApplyController", tags = "专家申请管理相关接口") public class ExpertMetaApplyController { + private final ExpertMetaApplyManage expertMetaApplyManage; + + @PostMapping("/list") + @ApiOperation(value = "审核列表筛选") + public PageVo metaApplyListQuery(@RequestBody @Valid MetaApplyListQuery metaApplyListQuery) { +// ExpertMetaApplyValidator.metaApplyListQueryValidate(metaApplyListQuery); + return expertMetaApplyManage.metaApplyListQuery(metaApplyListQuery); + } + + @PostMapping("/result") + @ApiOperation(value = "审核结果处理") + public void metaApplyResult(@RequestBody @Valid MetaApplyResultRequest applyResultRequest) { + expertMetaApplyManage.metaApplyResult(applyResultRequest); + } + + @PostMapping("/revoke/{applyId}") + @ApiOperation(value = "申请撤销") + public void metaApplyRevoke(@PathVariable Long applyId) { + expertMetaApplyManage.metaApplyRevoke(applyId); + } + + @ApiOperation("申请审核详情") + @GetMapping("/detail/{applyId}") + public MetaApplyResultVo applyAuditDetail(@PathVariable Long applyId) { + return expertMetaApplyManage.metaApplyResult(applyId); + } + + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java new file mode 100644 index 0000000..ad41577 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java @@ -0,0 +1,387 @@ +package com.ningdatech.pmapi.expert.manage; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; +import com.ningdatech.pmapi.common.util.BizUtils; +import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; +import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; +import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeQueryEnum; +import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; +import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; +import com.ningdatech.pmapi.expert.model.cmd.MetaApplyListQuery; +import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; +import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; +import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO; +import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo; +import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; +import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; +import com.ningdatech.pmapi.meta.helper.DictionaryCache; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; +import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; +import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; +import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; +import com.ningdatech.pmapi.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/3/1 上午10:38 + */ + +@Component +@RequiredArgsConstructor +public class ExpertMetaApplyManage { + + private final IExpertMetaApplyService iMetaApplyService; + private final IExpertDictionaryService expertDictionaryService; + + // private final IExpertAdminManageService ExpertAdminManageService; + private final IExpertUserFullInfoService userFullInfoService; + private final DictionaryCache dictionaryCache; + + + public PageVo metaApplyListQuery(MetaApplyListQuery req) { + Long expertAdminUserId = LoginUserUtil.getUserId(); + // 查找符合专家条件的用户id + // TODO +// List viewRegions = regionLimitHelper.getExpertAdminContainsRegion(expertAdminUserId); + List viewRegions = new ArrayList<>(); + ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req, viewRegions); + // TODO +// List filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd); + List filterExpertUserIdList = new ArrayList<>(); + if (CollUtil.isEmpty(filterExpertUserIdList)) { + return PageVo.empty(); + } + + LambdaQueryWrapper expertMetaApplyListQuery = + buildMetaApplyListQueryWrapper(req, filterExpertUserIdList, viewRegions); + +// RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); + Page pageResult = iMetaApplyService.page(req.page(), expertMetaApplyListQuery); + PageVo result = new PageVo<>(); + result.setTotal(pageResult.getTotal()); + BizUtils.notEmpty(pageResult.getRecords(), records -> { + List expertIds = CollUtils.fieldList(records, ExpertMetaApply::getUserId); + // 根据用户id 获取专家基本信息 + List expertList = userFullInfoService.listByUserIds(expertIds); + Map expertMap = CollUtils.listToMap(expertList, ExpertUserFullInfo::getUserId); + List expertDictList = expertDictionaryService.listByUserId(expertIds, DictExpertInfoTypeEnum.TITLE_LEVEL); + Map> dictMap = CollUtils.group(expertDictList, ExpertDictionary::getUserId); + result.setRecords(buildExpertApplyMetaVOList(records, expertMap, dictMap)); + }); + return result; + } + + public void metaApplyResult(MetaApplyResultRequest applyResultRequest) { + + } + + + public MetaApplyResultVo metaApplyResult(Long applyId) { + ExpertMetaApply metaApply = iMetaApplyService.getById(applyId); + if (Objects.isNull(metaApply)) { + throw BizException.wrap("当前审核不存在"); + } + MetaApplyResultVo metaApplyResultVo = MetaApplyResultVo.builder() + .applyTime(metaApply.getCreateOn()) + .auditor(metaApply.getApprover()) + .expertUserId(metaApply.getUserId()) + .auditOption(metaApply.getAuditOpinion()) + .auditStatus(metaApply.getApplyStatus()) + .auditTime(metaApply.getReviewTime()) + .build(); + String extraMaterialStr = metaApply.getExtraMaterial(); +// if (StringUtils.isNotBlank(extraMaterialStr)) { +// ExtraMaterialDO extraMaterialDO = JSONObject.parseObject(extraMaterialStr, ExtraMaterialDO.class); +// ModifyApplyExtraInfo modifyApplyExtraInfo = new ModifyApplyExtraInfo(); +// BizUtils.notEmpty(extraMaterialDO.getEvidenceList(), list -> { +// List fileIdList = CollUtils.fieldList(list, FileBasicInfo::getFileId); +// List attachFiles = fileService.getByIds(fileIdList); +// List tempList = attachFiles.stream().map(r -> { +// FileBasicInfo fileBasicInfo = new FileBasicInfo(); +// fileBasicInfo.setFileId(r.getFileId()); +// fileBasicInfo.setFileName(r.getOriginalFileName()); +// return fileBasicInfo; +// }).collect(Collectors.toList()); +// modifyApplyExtraInfo.setEvidenceList(tempList); +// }); +// modifyApplyExtraInfo.setFactSheet(extraMaterialDO.getFactSheet()); +// metaApplyResultVo.setModifyApplyExtraInfo(modifyApplyExtraInfo); +// } + String applyType = metaApply.getApplyType(); + ExpertApplyTypeEnum applyTypeEnum = ExpertApplyTypeEnum.of(applyType); + switch (applyTypeEnum) { +// case EXPERT_INFO_MODIFY: +// buildInfoModifyApplyDisplayVO(metaApplyResultVo, metaApply); +// break; + case EXPERT_INTENTION_JOIN: + case EXPERT_INTENTION_LEAVE: + buildIntentionApplyDisplayVO(metaApplyResultVo, metaApply, applyTypeEnum); + break; + case EXPERT_DELIVERY: + case LONG_TERM_LEAVE: + case EXPERT_STORAGE: + default: + break; + } + metaApplyResultVo.setApplyType(applyTypeTrans(applyTypeEnum)); + return metaApplyResultVo; + } + + + public void metaApplyRevoke(Long applyId) { + + } + + private void buildIntentionApplyDisplayVO(MetaApplyResultVo metaApplyResultVo, ExpertMetaApply metaApply, ExpertApplyTypeEnum applyTypeEnum) { + String regionCode = metaApply.getRegionCode(); + Integer regionLevel = metaApply.getRegionLevel(); +// String unionPathStr = regionCache.getUnionPathStr(regionCode, regionLevel); + MetaApplyResultVo.IntentionApplyDisplayVO intentionApplyDisplayVO = new MetaApplyResultVo.IntentionApplyDisplayVO(); + intentionApplyDisplayVO.setExpertApplyId(metaApply.getId()); + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionCode(regionCode); + expertRegionInfo.setRegionLevel(regionLevel); +// expertRegionInfo.setRegionName(unionPathStr); + switch (applyTypeEnum) { + case EXPERT_INTENTION_LEAVE: { + intentionApplyDisplayVO.setReduceExpertRegion(expertRegionInfo); + } + break; + case EXPERT_INTENTION_JOIN: { + intentionApplyDisplayVO.setAddExpertRegion(expertRegionInfo); + } + break; + default: + break; + } + metaApplyResultVo.setIntentionApplyDisplayVo(intentionApplyDisplayVO); + } + +// private void buildInfoModifyApplyDisplayVO(MetaApplyResultVo metaApplyResultVo, ExpertMetaApply infoModifyApply) { +// InfoModifyApplyDisplayVO infoModifyApplyDisplayVo = new InfoModifyApplyDisplayVO(); +// if (Objects.nonNull(infoModifyApply)) { +// Long metaApplyId = infoModifyApply.getId(); +// LambdaQueryWrapper eq = Wrappers.lambdaQuery(ExpertSensitiveInfoModifyDetailRecord.class) +// .eq(ExpertSensitiveInfoModifyDetailRecord::getMetaApplyId, metaApplyId); +// ExpertSensitiveInfoModifyDetailRecord one = iExpertSensitiveInfoModifyDetailRecordService.getOne(eq); +// String originalJson = null; +// if (StringUtils.isNotBlank(one.getOriginalJson())) { +// originalJson = GzipUtils.uncompress(one.getOriginalJson()); +// } +// List sensitiveModifySegments = JSONUtils.parseArray(originalJson, SensitiveModifySegment.class); +// +// infoModifyApplyDisplayVo.setExpertApplyId(metaApplyId); +// List displayValueList = new ArrayList<>(); +// for (SensitiveModifySegment segment : sensitiveModifySegments) { +// InfoModifyApplyDisplayVO.InfoModifyApplyDisplayValue displayValue = sensitiveModifySegmentParser.getDisplayValue(segment); +// displayValueList.add(displayValue); +// } +// infoModifyApplyDisplayVo.setInfoModifyApplyDisplayValueList(displayValueList); +// metaApplyResultVo.setInfoModifyApplyDisplayVo(infoModifyApplyDisplayVo); +// } +// } + + private String applyTypeTrans(ExpertApplyTypeEnum applyTypeEnum) { + switch (applyTypeEnum) { + case EXPERT_INTENTION_JOIN: + case EXPERT_INTENTION_LEAVE: { + return ExpertApplyTypeQueryEnum.EXPERT_INTENTION_CHANGE.getKey(); + } + case EXPERT_INFO_MODIFY: { + return ExpertApplyTypeQueryEnum.EXPERT_INFO_MODIFY.getKey(); + } + case LONG_TERM_LEAVE: { + return ExpertApplyTypeQueryEnum.LONG_TERM_LEAVE.getKey(); + } + case EXPERT_DELIVERY: { + return ExpertApplyTypeQueryEnum.EXPERT_DELIVERY.getKey(); + } + case EXPERT_STORAGE: { + return ExpertApplyTypeQueryEnum.EXPERT_STORAGE.getKey(); + } + default: + return null; + } + } + + private List applyTypeTrans(ExpertApplyTypeQueryEnum applyTypeQueryEnum) { + List applyTypeList = new ArrayList<>(); + switch (applyTypeQueryEnum) { + case EXPERT_INTENTION_CHANGE: { + applyTypeList.add(ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()); + applyTypeList.add(ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey()); + } + break; + case EXPERT_INFO_MODIFY: { + applyTypeList.add(ExpertApplyTypeEnum.EXPERT_INFO_MODIFY.getKey()); + } + break; + case LONG_TERM_LEAVE: { + applyTypeList.add(ExpertApplyTypeEnum.LONG_TERM_LEAVE.getKey()); + } + break; + case EXPERT_DELIVERY: { + applyTypeList.add(ExpertApplyTypeEnum.EXPERT_DELIVERY.getKey()); + } + break; + case EXPERT_STORAGE: { + applyTypeList.add(ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); + } + break; + default: + break; + } + return applyTypeList; + } + + private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(MetaApplyListQuery query, List expertAdminContainsRegionList) { + ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = new ExpertAdminExpertManageQueryCmd(); + expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); + expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); + if (StringUtils.isNotBlank(query.getExpertName())) { + expertAdminExpertManageQueryCmd.setExpertName(query.getExpertName()); + } + if (StringUtils.isNotBlank(query.getCompanyName())) { + expertAdminExpertManageQueryCmd.setCompany(query.getCompanyName()); + } + List expertDictionaryQueryList = new ArrayList<>(); + if (StringUtils.isNotBlank(query.getTitleLevelDictionaryCode())) { + ExpertDictionaryQuery expertDictionaryQuery = new ExpertDictionaryQuery(); + expertDictionaryQuery.setExpertInfoField(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()); + expertDictionaryQuery.setDictionaryCodeList(CollectionUtil.toList(query.getTitleLevelDictionaryCode())); + expertDictionaryQueryList.add(expertDictionaryQuery); + } + +// List containsRegion; +// if (Objects.nonNull(query.getExpertRegion())) { +// RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegion().getRegionLevel() +// , query.getExpertRegion().getRegionCode()); +// containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); +// } else { +// containsRegion = expertAdminContainsRegionList; +// } + + expertAdminExpertManageQueryCmd.setExpertDictionaryQueryList(expertDictionaryQueryList); +// expertAdminExpertManageQueryCmd.setRegionContainsList(containsRegion); + expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); + expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); + return expertAdminExpertManageQueryCmd; + } + + + /** + * 装配 专家审核列表筛选返回VO + * + * @param expertMetaApplyList / + * @param expertUserFullInfoMap / + * @param expertDictionaryListMap / + * @return / + */ + private List buildExpertApplyMetaVOList(List expertMetaApplyList + , Map expertUserFullInfoMap + , Map> expertDictionaryListMap) { + List expertApplyMetaVOList = new ArrayList<>(); + for (ExpertMetaApply expertMetaApply : expertMetaApplyList) { + ExpertApplyMetaVO expertApplyMetaVO = new ExpertApplyMetaVO(); + Long userId = expertMetaApply.getUserId(); + ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoMap.get(userId); + expertApplyMetaVO.setId(expertMetaApply.getId()); + expertApplyMetaVO.setUserId(userId); + expertApplyMetaVO.setApplyStatus(expertMetaApply.getApplyStatus()); + + String applyType = expertMetaApply.getApplyType(); + if (Objects.nonNull(applyType)) { + expertApplyMetaVO.setApplyType(applyTypeTrans(ExpertApplyTypeEnum.of(applyType))); + } + expertApplyMetaVO.setName(expertUserFullInfo.getExpertName()); + +// RegionDTO regionDTO = regionCache.getByCodeAndLevel(expertUserFullInfo.getRegionCode(), expertUserFullInfo.getRegionLevel()); + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionCode(expertUserFullInfo.getRegionCode()); + expertRegionInfo.setRegionLevel(expertUserFullInfo.getRegionLevel()); +// expertRegionInfo.setRegionName(regionDTO.getRegionName()); + expertApplyMetaVO.setExpertRegionInfo(expertRegionInfo); + + List expertDictionaryList = expertDictionaryListMap.get(userId); + if (CollectionUtils.isNotEmpty(expertDictionaryList)) { + expertApplyMetaVO.setTitleLevel(expertDictionaryList.stream().map(r -> { + DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode()); + DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo(); + dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode()); + dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField()); + if (Objects.nonNull(dictionaryDTO)) { + dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName()); + } + return dictionaryFieldInfo; + }).collect(Collectors.toList())); + } + + expertApplyMetaVO.setCompany(expertUserFullInfo.getCompany()); + expertApplyMetaVO.setPhoneNo(expertUserFullInfo.getPhoneNo()); + expertApplyMetaVO.setApplyTime(expertMetaApply.getCreateOn()); + expertApplyMetaVOList.add(expertApplyMetaVO); + } + return expertApplyMetaVOList; + } + + private LambdaQueryWrapper buildMetaApplyListQueryWrapper(MetaApplyListQuery applyListReq, + List expertIdList, + List viewRegions) { + // 审核类型 + List applyTypeList = new ArrayList<>(); + if (CollUtil.isNotEmpty(applyListReq.getApplyTypeList())) { + List applyTypeQueryEnumList = applyListReq.getApplyTypeList(); + for (ExpertApplyTypeQueryEnum applyTypeQueryEnum : applyTypeQueryEnumList) { + applyTypeList.addAll(applyTypeTrans(applyTypeQueryEnum)); + } + } + // 审核结果 + List applyStatusList = new ArrayList<>(); + if (CollUtil.isNotEmpty(applyListReq.getApplyStatusList())) { + applyStatusList = CollUtils.fieldList(applyListReq.getApplyStatusList(), ExpertApplyStatusEnum::getKey); + ; + } + + LocalDateTime applyStartTime = applyListReq.getApplyStartTime(); + LocalDateTime applyEndTime = applyListReq.getApplyEndTime(); + + // 不展示撤回的申请记录 + LambdaQueryWrapper expertMetaApplyListQuery = Wrappers.lambdaQuery(ExpertMetaApply.class) + .in(CollectionUtils.isNotEmpty(applyTypeList), ExpertMetaApply::getApplyType, applyTypeList) + .in(CollectionUtils.isNotEmpty(applyStatusList), ExpertMetaApply::getApplyStatus, applyStatusList) + .in(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name()) + .in(CollectionUtils.isNotEmpty(expertIdList), ExpertMetaApply::getUserId, expertIdList) + .gt(Objects.nonNull(applyStartTime), ExpertMetaApply::getCreateOn, applyStartTime) + .lt(Objects.nonNull(applyEndTime), ExpertMetaApply::getCreateOn, applyEndTime) + .ne(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.REVOKED.getKey()) + .orderByDesc(ExpertMetaApply::getCreateOn); + +// RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); + return expertMetaApplyListQuery; + } + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExtraMaterialDO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExtraMaterialDO.java new file mode 100644 index 0000000..a0e8abf --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExtraMaterialDO.java @@ -0,0 +1,29 @@ +package com.ningdatech.pmapi.expert.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/27 下午4:18 + * 提交修改申请额外信息 + */ +@Data +@ApiModel("提交修改申请额外信息,保存于expert_meta_apply表的 extra_material 字段") +public class ExtraMaterialDO { + + /** + * 情况说明 + */ + @ApiModelProperty("申请说明") + private String factSheet; + + /** + * 证明材料 + */ + @ApiModelProperty("证明材料") + private List evidenceList; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java index c38d32c..57bf9f5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java @@ -1,61 +1,61 @@ -//package com.ningdatech.pmapi.expert.model.cmd; -// -//import com.ningdatech.emapi.common.model.CommonPageReq; -//import com.ningdatech.emapi.expert.constants.ExpertAccountStatusEnum; -//import com.ningdatech.emapi.expert.entity.bo.RegionContainsBO; -//import com.ningdatech.emapi.expert.entity.query.ExpertDictionaryQuery; -//import com.ningdatech.emapi.expert.entity.query.ExpertTagQuery; -//import io.swagger.annotations.ApiModelProperty; -//import lombok.Data; -// -//import java.util.List; -// -///** -// * @author liuxinxin -// * @date 2022/8/4 上午11:11 -// */ -//@Data -//public class ExpertAdminExpertManageQueryCmd extends CommonPageReq { -// -// @ApiModelProperty("专家姓名(精准匹配)") -// private String expertName; -// -// @ApiModelProperty("工作单位(模糊匹配)") -// private String company; -// -// @ApiModelProperty("专家账号状态") -// private List expertAccountStatusList; -// -// /** -// * 区域编码 -// */ -// @ApiModelProperty("区域编码") -// private String regionCode; -// -// /** -// * 区域级别 -// */ -// @ApiModelProperty("区域级别") -// private Integer regionLevel; -// -// /** -// * 专家管理区域范围 -// */ -// List regionContainsList; -// -// /** -// * 专家字典信息 -// */ -// private List expertDictionaryQueryList; -// -// /** -// * 专家标签信息 -// */ -// private List expertTagQueryList; -// -// /** -// * 是否为钉用户 -// */ -// private Boolean isDingUser; -// -//} +package com.ningdatech.pmapi.expert.model.cmd; + +import com.ningdatech.pmapi.common.model.CommonPageReq; +import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; +import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; +import com.ningdatech.pmapi.expert.model.query.ExpertTagQuery; +import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:11 + */ +@Data +public class ExpertAdminExpertManageQueryCmd extends CommonPageReq { + + @ApiModelProperty("专家姓名(精准匹配)") + private String expertName; + + @ApiModelProperty("工作单位(模糊匹配)") + private String company; + + @ApiModelProperty("专家账号状态") + private List expertAccountStatusList; + + /** + * 区域编码 + */ + @ApiModelProperty("区域编码") + private String regionCode; + + /** + * 区域级别 + */ + @ApiModelProperty("区域级别") + private Integer regionLevel; + + /** + * 专家管理区域范围 + */ + List regionContainsList; + + /** + * 专家字典信息 + */ + private List expertDictionaryQueryList; + + /** + * 专家标签信息 + */ + private List expertTagQueryList; + + /** + * 是否为钉用户 + */ + private Boolean isDingUser; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/MetaApplyListQuery.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/MetaApplyListQuery.java new file mode 100644 index 0000000..0049729 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/MetaApplyListQuery.java @@ -0,0 +1,46 @@ +package com.ningdatech.pmapi.expert.model.cmd; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; +import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeQueryEnum; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 下午2:35 + */ +@Data +@ApiModel("申请列表查询请求") +public class MetaApplyListQuery extends PagePo { + + @ApiModelProperty("审核类型") + private List applyTypeList; + + @ApiModelProperty("审核结果") + private List applyStatusList; + + @ApiModelProperty("工作单位") + private String companyName; + + @ApiModelProperty("专家姓名") + private String expertName; + + @ApiModelProperty("职称级别字典编码") + private String titleLevelDictionaryCode; + + @ApiModelProperty("专家层级") + private ExpertRegionInfo expertRegion; + + @ApiModelProperty("筛选开始时间") + private LocalDateTime applyStartTime; + + @ApiModelProperty("筛选结束时间") + private LocalDateTime applyEndTime; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertDictionaryQuery.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertDictionaryQuery.java new file mode 100644 index 0000000..0220b2f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertDictionaryQuery.java @@ -0,0 +1,17 @@ +package com.ningdatech.pmapi.expert.model.query; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/5 上午11:16 + */ +@Data +public class ExpertDictionaryQuery { + + private String expertInfoField; + + private List dictionaryCodeList; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertTagQuery.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertTagQuery.java new file mode 100644 index 0000000..164ba63 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertTagQuery.java @@ -0,0 +1,17 @@ +package com.ningdatech.pmapi.expert.model.query; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/5 上午11:16 + */ +@Data +public class ExpertTagQuery { + + private String expertInfoField; + + private List tagCodeList; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ListExpertQuery.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ListExpertQuery.java new file mode 100644 index 0000000..e39c3af --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ListExpertQuery.java @@ -0,0 +1,59 @@ +package com.ningdatech.pmapi.expert.model.query; + +import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/5 上午10:52 + */ +@Data +public class ListExpertQuery { + + private Integer limit; + private Integer offset; + + /** + * 专家姓名(精准匹配) + */ + private String expertName; + + /** + * 工作单位(模糊匹配) + */ + private String company; + + /** + * 专家账号状态 + */ + private List expertAccountStatusList; + + /** + * 区域编码 + */ + private String regionCode; + + /** + * 区域级别 + */ + private Integer regionLevel; + + /** + * 专家管理区域范围 + */ + List regionContainsList; + + /** + * 专家字典信息 + */ + private List expertDictionaryQueryList; + + /** + * 专家标签信息 + */ + private List expertTagQueryList; + + private Boolean isDingUser; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/MetaApplyResultRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/MetaApplyResultRequest.java new file mode 100644 index 0000000..5272f6f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/MetaApplyResultRequest.java @@ -0,0 +1,49 @@ +package com.ningdatech.pmapi.expert.model.req; + +import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; +import com.ningdatech.pmapi.expert.model.TagFieldInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 下午4:20 + * 申请结果请求基类 + */ +@Data +@Validated +public class MetaApplyResultRequest { + + @NotNull + @ApiModelProperty("申请id") + private Long applyId; + + @NotNull + @ApiModelProperty("审核结果") + private Boolean applyResult; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + @ApiModelProperty("入库审核额外参数,只有入库审核结果审批才需要填写") + private StorageApplyResultExtraInfo storageApplyResultExtraInfo; + + + @Data + @ApiModel("入库审核额外参数") + public static class StorageApplyResultExtraInfo { + @ApiModelProperty("专家类型-内外围") + private List expertType; + + @ApiModelProperty("其他标签(标签code)") + private List other; + + @ApiModelProperty("备注") + private String remark; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertApplyMetaVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertApplyMetaVO.java new file mode 100644 index 0000000..37f8acd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertApplyMetaVO.java @@ -0,0 +1,76 @@ +package com.ningdatech.pmapi.expert.model.vo; + +import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 上午11:17 + * 专家审核列表展示VO基础类 + */ +@Data +@ApiModel("审核列表展示VO") +public class ExpertApplyMetaVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("用户id") + private Long userId; + + /** + * 审核结果 + */ + @ApiModelProperty("审核结果") + private String applyStatus; + + /** + * 审核类型 + */ + @ApiModelProperty("审核类型") + private String applyType; + + /** + * 专家姓名 + */ + @ApiModelProperty("专家姓名") + private String name; + + /** + * 专家层级 + */ + @ApiModelProperty("专家层级") + private ExpertRegionInfo expertRegionInfo; + + /** + * 职称级别 + */ + @ApiModelProperty("职称级别") + private List titleLevel; + + /** + * 工作单位 + */ + @ApiModelProperty("工作单位") + private String company; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String phoneNo; + + /** + * 申请时间 + */ + @ApiModelProperty("申请时间") + private LocalDateTime applyTime; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/MetaApplyResultVo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/MetaApplyResultVo.java new file mode 100644 index 0000000..fae2507 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/MetaApplyResultVo.java @@ -0,0 +1,70 @@ +package com.ningdatech.pmapi.expert.model.vo; + +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * LeaveAuditInfoVo + *

+ * + * @author WendyYang + * @since 13:46 2022/8/12 + */ +@Data +@Builder +@ApiModel("审核详情返回参数") +public class MetaApplyResultVo { + + @ApiModelProperty("审核人") + private String auditor; + + @ApiModelProperty("审核时间") + private LocalDateTime auditTime; + + @ApiModelProperty("审核意见") + private String auditOption; + + @ApiModelProperty("审核状态") + private String auditStatus; + + @ApiModelProperty("申请时间") + private LocalDateTime applyTime; + + @ApiModelProperty("申请类型") + private String applyType; + + @ApiModelProperty("专家用户userId") + private Long expertUserId; + +// @ApiModelProperty("额外的材料") +// private ModifyApplyExtraInfo modifyApplyExtraInfo; +// +// @ApiModelProperty("信息修改申请展示列表-只有审核类型为信息变更审核时才有值") +// private InfoModifyApplyDisplayVO infoModifyApplyDisplayVo; + + @ApiModelProperty("履职意向修改申请展示列表-只有审核类型为履职意向变更时才会有值") + private IntentionApplyDisplayVO intentionApplyDisplayVo; + + + @Data + @ApiModel("履职意向修改申请展示列表") + public static class IntentionApplyDisplayVO { + + @ApiModelProperty("审核申请id") + private Long expertApplyId; + + @ApiModelProperty("履职意向增加") + private ExpertRegionInfo addExpertRegion; + + @ApiModelProperty("履职意向减少") + private ExpertRegionInfo reduceExpertRegion; + } + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertMetaApplyService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertMetaApplyService.java index 2c518bd..e9dcba1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertMetaApplyService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertMetaApplyService.java @@ -1,11 +1,11 @@ package com.ningdatech.pmapi.expert.service; -import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; /** *

- * 服务类 + * 服务类 *

* * @author Liuxinxin diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java index af68be9..a0a6c27 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java @@ -32,4 +32,14 @@ public interface IExpertUserFullInfoService extends IService **/ List listByUserId(List userId); + + + /** + * 批量查询专家用户信息 + * + * @param userIds 用户ID + * @return / + */ + List listByUserIds(List userIds); + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java index 69544bc..234d70d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java @@ -33,4 +33,9 @@ public class ExpertUserFullInfoServiceImpl extends ServiceImpllambdaQuery().in(ExpertUserFullInfo::getUserId, userIds)); } + @Override + public List listByUserIds(List userIds) { + return list(Wrappers.lambdaQuery().in(ExpertUserFullInfo::getUserId, userIds)); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java index 9ea3a35..cfb9ed0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java @@ -1,8 +1,12 @@ package com.ningdatech.pmapi.meta.service; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.Collection; +import java.util.List; + /** *

* 服务类 @@ -13,4 +17,15 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IExpertDictionaryService extends IService { + + /** + * 根据专家ID批量查询专家字典信息 + * + * @param userIds 专家ID + * @param dictType 专家字典类型 + * @return / + * @author WendyYang + **/ + List listByUserId(Collection userIds, DictExpertInfoTypeEnum dictType); + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java index 346f4ec..43ccffa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java @@ -1,11 +1,17 @@ package com.ningdatech.pmapi.meta.service.impl; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; import com.ningdatech.pmapi.meta.mapper.ExpertDictionaryMapper; +import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.util.Collection; +import java.util.List; + /** *

* 服务实现类 @@ -17,4 +23,13 @@ import org.springframework.stereotype.Service; @Service public class ExpertDictionaryServiceImpl extends ServiceImpl implements IExpertDictionaryService { + @Override + public List listByUserId(Collection userIds, DictExpertInfoTypeEnum dictType) { + // 获取专家职称 + LambdaQueryWrapper query = Wrappers.lambdaQuery(ExpertDictionary.class) + .in(ExpertDictionary::getUserId, userIds) + .eq(ExpertDictionary::getExpertInfoField, dictType.getKey()); + return list(query); + } + } From 2c02b69b735581c575b12486a11d9bbdc3b75f98 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 1 Mar 2023 13:49:50 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=BB=93=E6=9E=9C=E5=A4=84=E7=90=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/helper/UserInfoHelper.java | 2 + .../common/helper/impl/UserInfoHelperImpl.java | 7 ++ .../pmapi/expert/manage/ExpertMetaApplyManage.java | 126 ++++++++++++++++++++- .../expert/model/cmd/ExpertStorageDealCmd.java | 71 ++++++------ .../pmapi/expert/service/ExpertInfoService.java | 5 + .../expert/service/impl/ExpertInfoServiceImpl.java | 68 +++++++++++ 6 files changed, 242 insertions(+), 37 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java index d421e51..a9b9cc7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java @@ -22,4 +22,6 @@ public interface UserInfoHelper { UserFullInfoDTO getUserFullInfo(Long userId); + String getUserName(Long userId); + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java index 5dcac28..c4cc856 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java @@ -30,4 +30,11 @@ public class UserInfoHelperImpl implements UserInfoHelper { UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId); return userFullInfo; } + + @Override + public String getUserName(Long userId) { + UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId); + String realName = userFullInfo.getRealName(); + return realName; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java index ad41577..ac93a49 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java @@ -10,6 +10,7 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; +import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.util.BizUtils; import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; @@ -17,12 +18,17 @@ import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeQueryEnum; import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; +import com.ningdatech.pmapi.expert.model.TagFieldInfo; import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; +import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd; import com.ningdatech.pmapi.expert.model.cmd.MetaApplyListQuery; +import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; +import com.ningdatech.pmapi.expert.model.dto.ExpertTagDTO; import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO; import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo; +import com.ningdatech.pmapi.expert.service.ExpertInfoService; import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; @@ -36,6 +42,7 @@ import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.ArrayList; @@ -60,6 +67,10 @@ public class ExpertMetaApplyManage { private final IExpertUserFullInfoService userFullInfoService; private final DictionaryCache dictionaryCache; + private final ExpertInfoService expertInfoService; + + private final UserInfoHelper userInfoHelper; + public PageVo metaApplyListQuery(MetaApplyListQuery req) { Long expertAdminUserId = LoginUserUtil.getUserId(); @@ -94,10 +105,88 @@ public class ExpertMetaApplyManage { return result; } - public void metaApplyResult(MetaApplyResultRequest applyResultRequest) { + @Transactional(rollbackFor = Exception.class) + public void metaApplyResult(MetaApplyResultRequest req) { + Long applyId = req.getApplyId(); + ExpertMetaApply expertMetaApply = iMetaApplyService.getById(applyId); + Long userId = LoginUserUtil.getUserId(); + + // 校验专家管理员区域权限,是否可以审核当前专家申请 +// permissionCheckHelper.operationPermissionsCheck(userId, expertMetaApply.getUserId()); + String applyStatus = expertMetaApply.getApplyStatus(); + if (!ExpertApplyStatusEnum.PENDING_REVIEW.getKey().equals(applyStatus)) { + throw BizException.wrap("apply is already processed"); + } + ExpertApplyTypeEnum applyType = ExpertApplyTypeEnum.of(expertMetaApply.getApplyType()); + boolean applyResult = req.getApplyResult(); - } + switch (applyType) { + // 专家入库 + case EXPERT_STORAGE: { + ExpertStorageDealCmd expertStorageDealCmd = buildExpertStorageDealCmd(req, expertMetaApply.getUserId(), expertMetaApply); + expertInfoService.expertStorageDeal(expertStorageDealCmd); + // 专家入库时,需要先审核专家入库,入库成功后,再履职意向审核,如果履职意向跟专家层级是同一层级的,就直接同意不需要审核 + if (applyResult) { + Long expertUserId = expertMetaApply.getUserId(); +// ExpertRegionInfo expertRegionInfo = expertUserInfoHelper.getExpertRegionInfo(expertUserId); +// Integer regionLevel = expertRegionInfo.getRegionLevel(); +// String regionCode = expertRegionInfo.getRegionCode(); + + List expertJoinApplyList = iMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) + .eq(ExpertMetaApply::getUserId, expertUserId) + .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) + .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()) + .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name())); +// .eq(ExpertMetaApply::getRegionLevel, regionLevel) +// .eq(ExpertMetaApply::getRegionCode, regionCode)); + BizUtils.notEmpty(expertJoinApplyList, list -> list.forEach(r -> { + MetaApplyResultRequest resultRequest = new MetaApplyResultRequest(); + resultRequest.setApplyId(r.getId()); + resultRequest.setApplyResult(true); + resultRequest.setAuditOpinion("同意"); + metaApplyResult(resultRequest); + })); + } + } + break; + // 专家出库 + case EXPERT_DELIVERY: +// ExpertDeliveryDealCmd expertDeliveryDealCmd = buildExpertDeliveryDealCmd(req, expertMetaApply.getUserId()); +// expertInfoService.expertDeliveryDeal(expertDeliveryDealCmd); + break; + // 长期请假 + case LONG_TERM_LEAVE: +// leaveManage.leaveAuditCallback(req.getApplyResult(), applyId); + break; + // 专家信息审核 + case EXPERT_INFO_MODIFY: +// ExpertInfoModifyApplyDealCmd applyDealCmd = buildExpertInfoModifyApplyDealCmd(req, expertMetaApply.getUserId(), applyId); +// expertInfoService.expertInfoModifyDeal(applyDealCmd); + break; + // 专家履职意向加入/离开 + case EXPERT_INTENTION_JOIN: + case EXPERT_INTENTION_LEAVE: +// ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd = buildExpertIntentionApplyDealCmd(req, expertMetaApply); +// expertInfoService.expertIntentionApplyDeal(expertIntentionApplyDealCmd); + break; + default: + break; + } + Long expertUserId = expertMetaApply.getUserId(); + String auditOpinion = req.getAuditOpinion(); + // 发送审核结果短信 +// sendApplyResultNotify(applyType, applyResult, auditOpinion, expertUserId); + // 更新申请结果 + expertMetaApply.setApproverUserId(userId); + String adminUserName = userInfoHelper.getUserName(userId); + expertMetaApply.setApprover(adminUserName); + expertMetaApply.setAuditOpinion(auditOpinion); + expertMetaApply.setApplyStatus(applyResult ? ExpertApplyStatusEnum.PASSED.getKey() : ExpertApplyStatusEnum.REFUSED.getKey()); + expertMetaApply.setReviewTime(LocalDateTime.now()); + expertMetaApply.setUpdateOn(LocalDateTime.now()); + iMetaApplyService.saveOrUpdate(expertMetaApply); + } public MetaApplyResultVo metaApplyResult(Long applyId) { ExpertMetaApply metaApply = iMetaApplyService.getById(applyId); @@ -383,5 +472,38 @@ public class ExpertMetaApplyManage { return expertMetaApplyListQuery; } + private ExpertStorageDealCmd buildExpertStorageDealCmd( + MetaApplyResultRequest applyResultRequest, Long expertUserId, ExpertMetaApply expertMetaApply) { + MetaApplyResultRequest.StorageApplyResultExtraInfo extraInfo = applyResultRequest.getStorageApplyResultExtraInfo(); + ExpertStorageDealCmd expertStorageDealCmd = new ExpertStorageDealCmd(); + Boolean applyResult = applyResultRequest.getApplyResult(); + expertStorageDealCmd.setApplyResult(applyResult); + + if (Objects.nonNull(extraInfo)) { + List expertType = extraInfo.getExpertType(); + if (CollectionUtils.isNotEmpty(expertType)) { + expertStorageDealCmd.setExpertType(extraInfo.getExpertType().stream().map(r -> { + ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); + expertDictionaryDTO.setExpertInfoField(r.getDictionaryFieldName()); + expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); + return expertDictionaryDTO; + }).collect(Collectors.toList())); + } + List other = extraInfo.getOther(); + if (CollectionUtils.isNotEmpty(other)) { + expertStorageDealCmd.setOther(extraInfo.getOther().stream().map(r -> { + ExpertTagDTO expertTagDTO = new ExpertTagDTO(); + expertTagDTO.setExpertInfoField(r.getTagFieldName()); + expertTagDTO.setTagCode(r.getTagCode()); + return expertTagDTO; + }).collect(Collectors.toList())); + } + expertStorageDealCmd.setRemark(extraInfo.getRemark()); + } + expertStorageDealCmd.setExpertUserId(expertUserId); + expertStorageDealCmd.setJoinRegionCode(expertMetaApply.getRegionCode()); + expertStorageDealCmd.setJoinRegionLevel(expertMetaApply.getRegionLevel()); + return expertStorageDealCmd; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java index 607fe5f..d615e19 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java @@ -1,35 +1,36 @@ -//package com.ningdatech.pmapi.expert.model.cmd; -// -//import com.ningdatech.emapi.expert.entity.dto.ExpertDictionaryDTO; -//import com.ningdatech.emapi.expert.entity.dto.ExpertTagDTO; -//import lombok.Data; -// -//import java.util.List; -// -///** -// * @author liuxinxin -// * @date 2022/7/26 下午5:40 -// */ -//@Data -//public class ExpertStorageDealCmd { -// -// private Long expertUserId; -// -// private Boolean applyResult; -// -// private String joinRegionCode; -// -// private Integer joinRegionLevel; -// -// /** -// * 专家类型(内外围) -// */ -// private List expertType; -// -// /** -// * 其他标签(标签code) -// */ -// private List other; -// -// private String remark; -//} +package com.ningdatech.pmapi.expert.model.cmd; + + +import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; +import com.ningdatech.pmapi.expert.model.dto.ExpertTagDTO; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 下午5:40 + */ +@Data +public class ExpertStorageDealCmd { + + private Long expertUserId; + + private Boolean applyResult; + + private String joinRegionCode; + + private Integer joinRegionLevel; + + /** + * 专家类型(内外围) + */ + private List expertType; + + /** + * 其他标签(标签code) + */ + private List other; + + private String remark; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java index e418920..6ca67a3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.expert.service; import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd; +import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd; import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; /** @@ -27,4 +28,8 @@ public interface ExpertInfoService { * @return */ ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId); + + + void expertStorageDeal(ExpertStorageDealCmd cmd); } + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java index c52202e..cbe3ded 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.expert.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; @@ -15,8 +16,10 @@ import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd; +import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd; import com.ningdatech.pmapi.expert.model.dto.*; import com.ningdatech.pmapi.expert.service.*; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; import com.ningdatech.pmapi.meta.model.entity.ExpertTag; import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; @@ -28,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -304,4 +308,68 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { } + /** + * 专家入库审核 + * + * @param cmd + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void expertStorageDeal(ExpertStorageDealCmd cmd) { + boolean applyResult = cmd.getApplyResult(); + Long expertUserId = cmd.getExpertUserId(); + ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId); + + if (applyResult) { + // 修改专家状态为可用 + expertUserFullInfo.setExpertAccountStatus(ExpertAccountStatusEnum.AVAILABLE.getKey()); + expertUserFullInfo.setRemark(cmd.getRemark()); + expertUserFullInfo.setRegionCode(cmd.getJoinRegionCode()); + expertUserFullInfo.setRegionLevel(cmd.getJoinRegionLevel()); + + // 保存所有专家标签字段 + List saveExpertTagList = buildSaveExpertTagList(expertUserId, cmd.getOther()); + iExpertTagService.saveBatch(saveExpertTagList); + // 保存所有专家字典字段 + List expertType = cmd.getExpertType(); + if (CollectionUtils.isNotEmpty(expertType)) { + expertType = expertType.stream().peek(r -> r.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())).collect(Collectors.toList()); + List saveExpertDictionaryList = buildSaveExpertDictionaryList(expertUserId, expertType); + iExpertDictionaryService.saveBatch(saveExpertDictionaryList); + } + + // 修改履职意向申请状态 + LambdaUpdateWrapper set = Wrappers.lambdaUpdate(ExpertMetaApply.class).eq(ExpertMetaApply::getUserId, expertUserId) + .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()) + .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) + .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.N.name()) + .set(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name()); + iExpertMetaApplyService.update(set); + + } else { + expertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.INFORMATION_TO_BE_SUBMITTED.getKey()); + } + if (applyResult) { + // 补充专家 专家角色 TODO +// SysRole sysRole = roleService.getOne(Wrappers.lambdaQuery(SysRole.class) +// .eq(SysRole::getCode, SysRoleEnum.EXPERT.getKey())); +// if (Objects.nonNull(sysRole)) { +// Long roleId = sysRole.getRoleId(); +// LambdaQueryWrapper eq = Wrappers.lambdaQuery(SysUsersRoles.class) +// .eq(SysUsersRoles::getUserId, expertUserFullInfo.getUserId()) +// .eq(SysUsersRoles::getRoleId, sysRole.getRoleId()); +// SysUsersRoles one = userRoleService.getOne(eq); +// if (Objects.isNull(one)) { +// SysUsersRoles sysUsersRolesSaveRecord = new SysUsersRoles(); +// sysUsersRolesSaveRecord.setUserId(expertUserFullInfo.getUserId()); +// sysUsersRolesSaveRecord.setRoleId(roleId); +// userRoleService.saveAndReloadRoleListForToken(Collections.singletonList(sysUsersRolesSaveRecord), false); +// } +// } + } + iExpertUserFullInfoService.saveOrUpdate(expertUserFullInfo); + } + + + } From f285d86fffe190e4290f71bdacaf54f28cd33e8f Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 1 Mar 2023 13:57:42 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=92=A4=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expert/controller/ExpertMetaApplyController.java | 1 - .../pmapi/expert/manage/ExpertMetaApplyManage.java | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java index 95600b3..7060bb0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java @@ -58,5 +58,4 @@ public class ExpertMetaApplyController { } - } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java index ac93a49..215221f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java @@ -241,9 +241,25 @@ public class ExpertMetaApplyManage { public void metaApplyRevoke(Long applyId) { - + Long userId = LoginUserUtil.getUserId(); + ExpertMetaApply expertMetaApply = iMetaApplyService.getById(applyId); + if (Objects.isNull(expertMetaApply)) { + throw new BizException("apply not exist"); + } + if (!expertMetaApply.getUserId().equals(userId)) { + throw new BizException("has not right to operate"); + } + String applyStatus = expertMetaApply.getApplyStatus(); + ExpertApplyStatusEnum expertApplyStatusEnum = ExpertApplyStatusEnum.of(applyStatus); + if (!ExpertApplyStatusEnum.PENDING_REVIEW.equals(expertApplyStatusEnum)) { + throw new BizException("apply is already deal"); + } + expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.REVOKED.getKey()); + expertMetaApply.setUpdateOn(LocalDateTime.now()); + iMetaApplyService.updateById(expertMetaApply); } + private void buildIntentionApplyDisplayVO(MetaApplyResultVo metaApplyResultVo, ExpertMetaApply metaApply, ExpertApplyTypeEnum applyTypeEnum) { String regionCode = metaApply.getRegionCode(); Integer regionLevel = metaApply.getRegionLevel(); From 76e863bf27cb608e6477be7bedbb4c1647906b09 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 1 Mar 2023 14:44:53 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/constant/BoolDisplayEnum.java | 32 ---- .../pmapi/common/constant/CommonConst.java | 35 ++++ .../pmapi/common/constant/CommonConstant.java | 36 ---- .../pmapi/common/constant/DefValConst.java | 34 ++++ .../pmapi/common/constant/DefValConstants.java | 57 ------ .../pmapi/common/constant/DingConst.java | 14 ++ .../pmapi/common/constant/DingConstant.java | 14 -- .../pmapi/common/constant/ProjectDeclareConst.java | 169 +++++++++++++++++ .../common/constant/ProjectDeclareConstants.java | 171 ----------------- .../pmapi/common/constant/RegionLevelConst.java | 19 ++ .../pmapi/common/constant/StateMachineConst.java | 13 ++ .../common/constant/StateMachineConstants.java | 13 -- .../pmapi/common/enumeration/BoolDisplayEnum.java | 32 ++++ .../pmapi/common/helper/RegionCacheHelper.java | 111 +++++++++++ .../pmapi/common/helper/RegionLimitHelper.java | 59 ++++++ .../common/helper/basic/AbstractRegionCache.java | 138 ++++++++++++++ .../helper/basic/AbstractRegionLimitHelper.java | 44 +++++ .../common/helper/impl/RegionLimitHelperImpl.java | 122 ++++++++++++ .../pmapi/common/helper/impl/RegionsCacheImpl.java | 205 +++++++++++++++++++++ .../pmapi/common/model/RegionMapKey.java | 59 ++++++ .../statemachine/action/ProjectDeclareAction.java | 4 +- .../action/ProjectDeclareChoiceAction.java | 4 +- .../factory/ProjectDeclareGuardFactory.java | 4 +- .../statemachine/util/StateMachineUtils.java | 10 +- .../expert/service/impl/ExpertInfoServiceImpl.java | 2 +- .../pmapi/meeting/entity/vo/AppointRuleVO.java | 27 +++ .../pmapi/meeting/entity/vo/AvoidInfoVO.java | 33 ++++ .../meeting/entity/vo/ExpertInviteDetailVO.java | 13 +- .../meeting/entity/vo/InviteRuleDetailVO.java | 50 +---- .../meeting/entity/vo/MeetingDetailBasicVO.java | 43 ++--- .../pmapi/meeting/manage/MeetingManage.java | 57 +++--- .../ningdatech/pmapi/meta/manage/MetaManage.java | 2 +- .../pmapi/projectlib/handle/AnnualPlanHandle.java | 7 +- .../pmapi/projectlib/handle/ArchivedHandle.java | 6 +- .../handle/ConstructionPlanReviewHandle.java | 6 +- .../projectlib/handle/DeptUnitedReviewHandle.java | 6 +- .../handle/PreliminaryPreviewHandle.java | 6 +- .../projectlib/handle/ProjectApprovalHandle.java | 11 +- .../projectlib/handle/ProjectDeclareHandle.java | 4 +- .../handle/ProjectFinalInspectionHandle.java | 6 +- .../handle/ProjectPreliminaryInspectionHandle.java | 8 +- .../projectlib/handle/TenderPurchaseHandle.java | 13 +- .../projectlib/handle/UnitInnerAuditHandle.java | 4 +- .../projectlib/manage/AnnualPlanLibManage.java | 6 +- .../pmapi/projectlib/manage/ProjectLibManage.java | 6 +- .../manage/ProjectRenewalFundManage.java | 6 +- .../ningdatech/pmapi/sys/manage/RegionManage.java | 2 +- .../pmapi/sys/service/IRegionService.java | 2 +- .../pmapi/sys/service/impl/MenuServiceImpl.java | 4 +- .../pmapi/sys/service/impl/RegionServiceImpl.java | 5 +- .../pmapi/todocenter/manage/TodoCenterManage.java | 23 +-- .../user/security/auth/WebSecurityConfig.java | 4 +- 52 files changed, 1229 insertions(+), 532 deletions(-) delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConstants.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConstant.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionLevelConst.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConstants.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCache.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AppointRuleVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AvoidInfoVO.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java deleted file mode 100644 index d4ab72f..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * @author liuxinxin - * @date 2022/7/26 上午9:21 - */ -@AllArgsConstructor -@Getter -public enum BoolDisplayEnum { - - /** - * true - */ - Y, - - /** - * false - */ - N; - - public static boolean judgeBoolean(String key) { - return Y.name().equals(key); - } - - public static BoolDisplayEnum judgeBoolean(boolean key) { - return key ? Y : N; - } - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java new file mode 100644 index 0000000..19d85ad --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java @@ -0,0 +1,35 @@ +package com.ningdatech.pmapi.common.constant; + +/** + * @description: 常量 + * @author: LiuXinXin + * @date: 2022/5/5 17:31 + */ +public interface CommonConst { + + String COOKIE_KEY = "ND_JSESSION"; + + Integer EXPORT_PAGE_NUMBER = 1; + Integer EXPORT_PAGE_SIZE = 100000; + String CALL_STATUS = "status"; + String CALL_STATUS_OK_VALUE = "ok"; + + Integer COMMENT_MAX_SIZE = 163; + Integer SUB_COMMENT_SIZE_MIN = 0; + Integer SUB_COMMENT_SIZE_MAX = 160; + + String PROJECT_DECLARE = "项目申报"; + String UNIT_INNER_AUDIT = "单位内部审核"; + String PRELIMINARY_PREVIEW = "项目预审"; + String DEPT_UNITED_REVIEW = "部门联审"; + String ANNUAL_PLAN = "年度计划"; + String CONSTRUCTION_PLAN_REVIEW = "建设方案评审"; + String PROJECT_APPROVAL = "立项批复"; + String TENDER_PURCHASE = "招标采购"; + String PROJECT_PRELIMINARY_INSPECTION = "项目初验"; + String PROJECT_FINAL_INSPECTION = "项目终验"; + + String ARCHIVED = "归档"; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java deleted file mode 100644 index 3391e87..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -/** - * @description: 常量 - * @author: LiuXinXin - * @date: 2022/5/5 17:31 - */ -public class CommonConstant { - - public static final String COOKIE_KEY = "ND_JSESSION"; - - public static final Integer EXPORT_PAGE_NUMBER = 1; - public static final Integer EXPORT_PAGE_SIZE = 100000; - public static final String CALL_STATUS = "status"; - public static final String CALL_STATUS_OK_VALUE = "ok"; - - public static final Integer COMMENT_MAX_SIZE = 163; - public static final Integer SUB_COMMENT_SIZE_MIN = 0; - public static final Integer SUB_COMMENT_SIZE_MAX = 160; - - public static final String PROJECT_DECLARE = "项目申报"; - public static final String UNIT_INNER_AUDIT = "单位内部审核"; - public static final String PRELIMINARY_PREVIEW = "项目预审"; - public static final String DEPT_UNITED_REVIEW = "部门联审"; - public static final String ANNUAL_PLAN = "年度计划"; - public static final String CONSTRUCTION_PLAN_REVIEW = "建设方案评审"; - public static final String PROJECT_APPROVAL = "立项批复"; - public static final String TENDER_PURCHASE = "招标采购"; - public static final String PROJECT_PRELIMINARY_INSPECTION = "项目初验"; - public static final String PROJECT_FINAL_INSPECTION = "项目终验"; - - public static final String ARCHIVED = "归档"; - - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java new file mode 100644 index 0000000..9646f75 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java @@ -0,0 +1,34 @@ +package com.ningdatech.pmapi.common.constant; + + +import com.ningdatech.basic.util.StrPool; + +/** + * 默认值 + * + * @author PoffyZhang + */ +public interface DefValConst { + + /** + * 默认的根节点path + */ + String ROOT_PATH = StrPool.COMMA; + /** + * 默认树层级 + */ + Integer TREE_GRADE = 0; + /** + * 默认的父id + */ + Long PARENT_ID = 0L; + /** + * 默认的排序 + */ + Integer SORT_VALUE = 0; + /** + * 字典占位符 + */ + String DICT_PLACEHOLDER = "###"; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConstants.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConstants.java deleted file mode 100644 index a11b052..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConstants.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - - -import com.ningdatech.basic.util.StrPool; - -/** - * 默认值 - * - * @author PoffyZhang - */ -public interface DefValConstants { - - /** - * 默认的根节点path - */ - String ROOT_PATH = StrPool.COMMA; - /** - * 默认树层级 - */ - Integer TREE_GRADE = 0; - /** - * 默认的父id - */ - Long PARENT_ID = 0L; - /** - * 默认的排序 - */ - Integer SORT_VALUE = 0; - /** - * 字典占位符 - */ - String DICT_PLACEHOLDER = "###"; - /** - * 浙江省的region_id - */ - Long ZJREGION_ID = 116L; - - /** - * 城市 level - */ - Integer CITY_REGION_LEVEL = 2; - - /** - * 区的 level - */ - Integer QU_REGION_LEVEL = 3; - - /** - * 驾驶员异常数据GPS字符串起始偏移量 - */ - Integer GPS_START_OFFSET = 5; - - /** - * 驾驶员异常数据GPS字符串结尾偏移量 - */ - Integer GPS_END_OFFSET = 69; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java new file mode 100644 index 0000000..4fbf071 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java @@ -0,0 +1,14 @@ +package com.ningdatech.pmapi.common.constant; + +/** + * 浙政钉常量 + * + * @author CMM + * @since 2023/02/01 14:49 + */ +public interface DingConst { + /** + * 工作通知 + */ + String WORKING_NOTICE = "/message/workNotification"; +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConstant.java deleted file mode 100644 index 9590c8b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConstant.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -/** - * 浙政钉常量 - * - * @author CMM - * @since 2023/02/01 14:49 - */ -public interface DingConstant { - /** - * 工作通知 - */ - String WORKING_NOTICE = "/message/workNotification"; -} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java new file mode 100644 index 0000000..b9f08a2 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java @@ -0,0 +1,169 @@ +package com.ningdatech.pmapi.common.constant; + +import java.math.BigDecimal; + +/** + * 项目申报表单数据常量key + * @return + * @author CMM + * @since 2023/01/19 10:31 + */ +public interface ProjectDeclareConst { + + /** + * 基本信息 + */ + class BasicInformation { + // 项目名称 + public static final String PROJECT_NAME = "projectName"; + // 是否一地创新全省共享项目 + public static final String INNOVATION_SHARING_PROJECT = "innovationSharingProject"; + // 是否临时增补 + public static final String TEMPORARY_SUPPLEMENT = "temporarySupplement"; + // 项目负责人 + public static final String PROJECT_LEADER = "projectLeader"; + // 项目负责人手机号 + public static final String PROJECT_LEADER_PHONE_NUMBER = "projectLeaderPhoneNumber"; + // 项目联系人 + public static final String PROJECT_CONTACT = "projectContact"; + // 项目联系人手机号 + public static final String PROJECT_CONTACT_PHONE_NUMBER = "projectContactPhoneNumber"; + // 建设单位 + public static final String CONSTRUCTION_UNIT = "constructionUnit"; + // 建设单位统一信用代码 + public static final String CONSTRUCTION_UNIT_UNIFIED_CREDIT_CODE = "constructionUnitUnifiedCreditCode"; + // 项目类型 + public static final String PROJECT_TYPE = "projectType"; + // 是否首次新建 + public static final String FIRST_NEW_CONSTRUCTION = "firstNewConstruction"; + // 预算年度 + public static final String BUDGET_YEAR = "projectYear"; + // 建设开始时间 + public static final String CONSTRUCTION_START_TIME = "constructionStartTime"; + // 建设结束时间 + public static final String CONSTRUCTION_END_TIME = "constructionEndTime"; + // 四大体系 + public static final String FOUR_SYSTEM = "fourSystem"; + // 是否数字化改革项目 + public static final String DIGITAL_REFORM_PROJECT = "digitalReformProject"; + // 建设层级 + public static final String CONSTRUCTION_HIERARCHY = "constructionHierarchy"; + // 立项依据材料 + public static final String PROJECT_BASIS_MATERIAL = "projectBasisMaterial"; + // 发改编码 + public static final String CHANGE_CODE = "changeCode"; + // 财政编码 + public static final String FISCAL_CODE = "fiscalCode"; + // 是否上云 + public static final String ON_CLOUD = "onCloud"; + // 项目简介 + public static final String PROJECT_INTRODUCTION = "projectIntroduction"; + } + + /** + * 资金申报情况 + */ + class FundDeclareInfo { + // 申报金额 + public static final String DECLARE_AMOUNT = "declareAmount"; + // 自有资金 + public static final String OWN_FUND = "ownFund"; + // 政府投资-本级财政资金 + public static final String GOVERNMENT_INVESTMENT_SAME_LEVEL_FUND = "governmentInvestmentSameLevelFund"; + // 政府投资-上级补助资金 + public static final String GOVERNMENT_INVESTMENT_SUPERIOR_FUND = "governmentInvestmentSuperiorFund"; + // 银行贷款 + public static final String BANK_LOAN = "bankLoan"; + // 其他资金 + public static final String OTHER_FUND = "otherFund"; + } + + /** + * 总投资分配情况 + */ + class TotalInvestmentAllocations { + // 软件开发 + public static final String SOFTWARE_DEVELOPMENT = "softwareDevelopment"; + // 云资源、硬件配置 + public static final String CLOUD_RESOURCE_HARDWARE_CONFIGURATION = "cloudResourceHardwareConfiguration"; + // 第三方服务 + public static final String THIRD_PARTY_SERVICE = "thirdPartyService"; + } + /** + * 年度支付计划 + */ + class AnnualPaymentPlan { + // 年度支付金额 + public static final String ANNUAL_PAYMENT_AMOUNT = "annualPaymentAmount"; + // 自有资金 + public static final String OWN_FUND = "ownFund"; + // 政府投资-本级财政资金 + public static final String GOVERNMENT_INVESTMENT_SAME_LEVEL_FUND = "governmentInvestmentSameLevelFund"; + // 政府投资-上级补助资金 + public static final String GOVERNMENT_INVESTMENT_SUPERIOR_FUND = "governmentInvestmentSuperiorFund"; + // 银行贷款 + public static final String BANK_LOAN = "bankLoan"; + // 其他 + public static final String OTHER = "other"; + } + /** + * 核心业务 + */ + class CoreBusiness { + + } + /** + * 安全投入 + */ + class SafetyInput { + // 投入项 + public static final String INPUT_ITEM = "inputItem"; + // 内容描述 + public static final String CONTENT_DESCRIPTION = "contentDescription"; + // 金额 + public static final String AMOUNT = "amount"; + } + /** + * 工程形象进度 + */ + class ProjectImageProgress { + // 第一季度 + public static final String FIRST_QUARTER = "firstQuarter"; + // 第二季度 + public static final String SECOND_QUARTER = "secondQuarter"; + // 第三季度 + public static final String THIRD_QUARTER = "thirdQuarter"; + // 第四季度 + public static final String FOURTH_QUARTER = "fourthQuarter"; + } + /** + * 附件 + */ + class Appendix { + + } + /** + * 备注 + */ + class Remark { + + } + /** + * 应用信息 + */ + class ApplicationInformation { + + } + + class Number { + public static final BigDecimal DECLARE_AMOUNT_JUDGEMENT = BigDecimal.valueOf(1000); + + public static final Integer COUNTRY_BUILD_LEVEL = 1; + public static final Integer PROVINCE_BUILD_LEVEL = 2; + public static final Integer PROVINCE_SELF_BUILD_LEVEL = 3; + public static final Integer CITY_BUILD_LEVEL = 4; + public static final Integer CITY_SELF_BUILD_LEVEL = 5; + public static final Integer DISTRICTS_COUNTRIES_BUILD_LEVEL = 6; + public static final Integer VILLAGES_TOWNS_BUILD_LEVEL = 7; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java deleted file mode 100644 index 392cd3a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -import io.swagger.models.auth.In; - -import java.math.BigDecimal; - -/** - * 项目申报表单数据常量key - * @return - * @author CMM - * @since 2023/01/19 10:31 - */ -public interface ProjectDeclareConstants { - - /** - * 基本信息 - */ - class BasicInformation { - // 项目名称 - public static final String PROJECT_NAME = "projectName"; - // 是否一地创新全省共享项目 - public static final String INNOVATION_SHARING_PROJECT = "innovationSharingProject"; - // 是否临时增补 - public static final String TEMPORARY_SUPPLEMENT = "temporarySupplement"; - // 项目负责人 - public static final String PROJECT_LEADER = "projectLeader"; - // 项目负责人手机号 - public static final String PROJECT_LEADER_PHONE_NUMBER = "projectLeaderPhoneNumber"; - // 项目联系人 - public static final String PROJECT_CONTACT = "projectContact"; - // 项目联系人手机号 - public static final String PROJECT_CONTACT_PHONE_NUMBER = "projectContactPhoneNumber"; - // 建设单位 - public static final String CONSTRUCTION_UNIT = "constructionUnit"; - // 建设单位统一信用代码 - public static final String CONSTRUCTION_UNIT_UNIFIED_CREDIT_CODE = "constructionUnitUnifiedCreditCode"; - // 项目类型 - public static final String PROJECT_TYPE = "projectType"; - // 是否首次新建 - public static final String FIRST_NEW_CONSTRUCTION = "firstNewConstruction"; - // 预算年度 - public static final String BUDGET_YEAR = "projectYear"; - // 建设开始时间 - public static final String CONSTRUCTION_START_TIME = "constructionStartTime"; - // 建设结束时间 - public static final String CONSTRUCTION_END_TIME = "constructionEndTime"; - // 四大体系 - public static final String FOUR_SYSTEM = "fourSystem"; - // 是否数字化改革项目 - public static final String DIGITAL_REFORM_PROJECT = "digitalReformProject"; - // 建设层级 - public static final String CONSTRUCTION_HIERARCHY = "constructionHierarchy"; - // 立项依据材料 - public static final String PROJECT_BASIS_MATERIAL = "projectBasisMaterial"; - // 发改编码 - public static final String CHANGE_CODE = "changeCode"; - // 财政编码 - public static final String FISCAL_CODE = "fiscalCode"; - // 是否上云 - public static final String ON_CLOUD = "onCloud"; - // 项目简介 - public static final String PROJECT_INTRODUCTION = "projectIntroduction"; - } - - /** - * 资金申报情况 - */ - class FundDeclareInfo { - // 申报金额 - public static final String DECLARE_AMOUNT = "declareAmount"; - // 自有资金 - public static final String OWN_FUND = "ownFund"; - // 政府投资-本级财政资金 - public static final String GOVERNMENT_INVESTMENT_SAME_LEVEL_FUND = "governmentInvestmentSameLevelFund"; - // 政府投资-上级补助资金 - public static final String GOVERNMENT_INVESTMENT_SUPERIOR_FUND = "governmentInvestmentSuperiorFund"; - // 银行贷款 - public static final String BANK_LOAN = "bankLoan"; - // 其他资金 - public static final String OTHER_FUND = "otherFund"; - } - - /** - * 总投资分配情况 - */ - class TotalInvestmentAllocations { - // 软件开发 - public static final String SOFTWARE_DEVELOPMENT = "softwareDevelopment"; - // 云资源、硬件配置 - public static final String CLOUD_RESOURCE_HARDWARE_CONFIGURATION = "cloudResourceHardwareConfiguration"; - // 第三方服务 - public static final String THIRD_PARTY_SERVICE = "thirdPartyService"; - } - /** - * 年度支付计划 - */ - class AnnualPaymentPlan { - // 年度支付金额 - public static final String ANNUAL_PAYMENT_AMOUNT = "annualPaymentAmount"; - // 自有资金 - public static final String OWN_FUND = "ownFund"; - // 政府投资-本级财政资金 - public static final String GOVERNMENT_INVESTMENT_SAME_LEVEL_FUND = "governmentInvestmentSameLevelFund"; - // 政府投资-上级补助资金 - public static final String GOVERNMENT_INVESTMENT_SUPERIOR_FUND = "governmentInvestmentSuperiorFund"; - // 银行贷款 - public static final String BANK_LOAN = "bankLoan"; - // 其他 - public static final String OTHER = "other"; - } - /** - * 核心业务 - */ - class CoreBusiness { - - } - /** - * 安全投入 - */ - class SafetyInput { - // 投入项 - public static final String INPUT_ITEM = "inputItem"; - // 内容描述 - public static final String CONTENT_DESCRIPTION = "contentDescription"; - // 金额 - public static final String AMOUNT = "amount"; - } - /** - * 工程形象进度 - */ - class ProjectImageProgress { - // 第一季度 - public static final String FIRST_QUARTER = "firstQuarter"; - // 第二季度 - public static final String SECOND_QUARTER = "secondQuarter"; - // 第三季度 - public static final String THIRD_QUARTER = "thirdQuarter"; - // 第四季度 - public static final String FOURTH_QUARTER = "fourthQuarter"; - } - /** - * 附件 - */ - class Appendix { - - } - /** - * 备注 - */ - class Remark { - - } - /** - * 应用信息 - */ - class ApplicationInformation { - - } - - class Number { - public static final BigDecimal DECLARE_AMOUNT_JUDGEMENT = BigDecimal.valueOf(1000); - - public static final Integer COUNTRY_BUILD_LEVEL = 1; - public static final Integer PROVINCE_BUILD_LEVEL = 2; - public static final Integer PROVINCE_SELF_BUILD_LEVEL = 3; - public static final Integer CITY_BUILD_LEVEL = 4; - public static final Integer CITY_SELF_BUILD_LEVEL = 5; - public static final Integer DISTRICTS_COUNTRIES_BUILD_LEVEL = 6; - public static final Integer VILLAGES_TOWNS_BUILD_LEVEL = 7; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionLevelConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionLevelConst.java new file mode 100644 index 0000000..42161f8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionLevelConst.java @@ -0,0 +1,19 @@ +package com.ningdatech.pmapi.common.constant; + +/** + *

+ * RegionLevelConst + *

+ * + * @author WendyYang + * @since 13:57 2023/3/1 + */ +public interface RegionLevelConst { + + int PROVINCE = 1; + + int CITY = 2; + + int COUNTY = 3; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java new file mode 100644 index 0000000..e90e5dc --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java @@ -0,0 +1,13 @@ +package com.ningdatech.pmapi.common.constant; + +/** + * @author CMM + * @since 2023/02/07 16:24 + */ + +public class StateMachineConst { + + public static final String PROJECT_DECLARE = "projectDeclare"; + public static final String LI_SHUI_CITY_AREA_CODE = "331100"; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConstants.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConstants.java deleted file mode 100644 index e1a84c7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConstants.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -/** - * @author CMM - * @since 2023/02/07 16:24 - */ - -public class StateMachineConstants { - - public static final String PROJECT_DECLARE = "projectDeclare"; - public static final String LI_SHUI_CITY_AREA_CODE = "331100"; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java new file mode 100644 index 0000000..29415af --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java @@ -0,0 +1,32 @@ +package com.ningdatech.pmapi.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/7/26 上午9:21 + */ +@AllArgsConstructor +@Getter +public enum BoolDisplayEnum { + + /** + * true + */ + Y, + + /** + * false + */ + N; + + public static boolean judgeBoolean(String key) { + return Y.name().equals(key); + } + + public static BoolDisplayEnum judgeBoolean(boolean key) { + return key ? Y : N; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java new file mode 100644 index 0000000..219a23c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java @@ -0,0 +1,111 @@ +package com.ningdatech.pmapi.common.helper; + + +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO; + +import java.util.List; +import java.util.Map; + +/** + *

+ * RegionCacheHelper - + *

+ * + * @author WendyYang + * @since 13:50 2023/3/1 + */ +public interface RegionCacheHelper { + + + /** + * 获取完整的区域树状结构 + * + * @return / + */ + List all(); + + /** + * 获取用于前端回显示使用的unionList 仅用于返回前端的时候使用 + * + * @param code 区域编码 + * @param level 区域层级 + * @return + */ + String getUnionPathStr(String code, Integer level); + + /** + * 原专家库数据导入使用 返回名称区域Map + * + * @return + */ + Map getNameRegionMap(); + + + /** + * key.getRegionCode() + "###" + key.getRegionLevel() ,regionMap.get(key) + * + * @return + */ + Map getRegionMap(); + + /** + * 获取市级区域列表 + * + * @return + */ + List getMunicipalRegion(); + + /** + * 获取省级区域列表 + * + * @return / + */ + List getProvincialRegion(); + + /** + * 根据区域code 区域层级获取 区域类 + * + * @param code 区域编码 + * @param level 区域层级 + * @return / + */ + RegionDTO getByCodeAndLevel(String code, int level); + + /** + * 根据传入的地区code与level获取所有上层地区集合 + * 按照level升序排列 + * + * @param code 地区编码 + * @param level 地区层级 + * @return / + */ + List listParents(String code, int level); + + /** + * 获取所有区域编码「parent -> child」 + * + * @param regionCode 区域编码 + * @param regionLevel 级别 + * @return / + */ + List getRegionCodes(String regionCode, int regionLevel); + + /** + * 获取当前区域所有的子集 + * + * @param code 区域编码 + * @param level 级别 + * @return / + */ + List getAllChildrenRegionCodeList(String code, int level); + + + /** + * 获取 根节点 区域层级编码 + * + * @return / + */ + String getParentCodeRoot(); + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java new file mode 100644 index 0000000..d264cd9 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java @@ -0,0 +1,59 @@ +package com.ningdatech.pmapi.common.helper; + +import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/12/21 下午5:37 + * 区域限制帮助类 + */ + +public interface RegionLimitHelper { + + /** + * 管理员 是否包含 专家层级校验 + * + * @param expertUserId / + * @param expertAdminUserId / + * @return / + */ + Boolean regionContainsCheck(Long expertUserId, Long expertAdminUserId); + + /** + * 校验层级包含关系 + * + * @param regionContainsBOList / + * @param regionCode / + * @param regionLevel / + * @return / + */ + Boolean regionContains(List regionContainsBOList, String regionCode, Integer regionLevel); + + /** + * 查询操作 包含区域包含列表装配 + * + * @param queryRegionContainBo 查询区域范围列表 + * @param expertAdminContainsRegionList 专家管理员可管理的区域范围列表 + * @return / + */ + List queryContainsRegionAssembler(RegionContainsBO queryRegionContainBo, List expertAdminContainsRegionList); + + /** + * 根据 区域层级-区域编码 获取区域包含列表 + * + * @param regionLevel 区域层级 + * @param regionCode 区域编码 + * @return / + */ + RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode); + + /** + * 根据专家管理员用户id 获取专家管理员管辖区域列表 + * + * @param expertAdminUserId 专家管理员用户id + * @return / + */ + List getExpertAdminContainsRegion(Long expertAdminUserId); +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCache.java new file mode 100644 index 0000000..1322223 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCache.java @@ -0,0 +1,138 @@ +package com.ningdatech.pmapi.common.helper.basic; + +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.common.model.RegionMapKey; +import com.ningdatech.pmapi.sys.convert.RegionConverter; +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO; +import com.ningdatech.pmapi.sys.service.IRegionService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + *

+ * AbstractRegionCache + *

+ * + * @author WendyYang + * @since 14:41 2023/3/1 + */ +public abstract class AbstractRegionCache implements InitializingBean, RegionCacheHelper { + + @Autowired + private IRegionService regionService; + /** + * 当前支持最大层级 + */ + private static final int REGION_LEVEL_MAX = 3; + + private LoadingCache> regionsCache; + + /** + * 中国行政区划编码 + */ + private static final String PARENT_CODE_ROOT = "100000"; + + protected Map regionMap; + + @Override + public void afterPropertiesSet() { + regionsCache = Caffeine.newBuilder() + .expireAfterWrite(10, TimeUnit.MINUTES) + .refreshAfterWrite(5, TimeUnit.MINUTES) + .build(key -> { + // 查询全部 + List regionDTOList = regionService.all(); + if (regionDTOList.isEmpty()) { + throw BizException.wrap("区域元数据不能为空"); + } + regionMap = buildCacheMap(regionDTOList); + List regionInLevel = regionMap.values().stream() + .filter(regionDTO -> { + // 只过滤出小于等于level的region + if (Objects.isNull(regionDTO.getRegionLevel())) { + return false; + } + return Integer.parseInt(key) >= regionDTO.getRegionLevel(); + }).collect(Collectors.toList()); + List treeDtos = RegionConverter.toRegionTreeDTOList(regionInLevel); + return toTreeStructure(treeDtos); + }); + warmUp(); + } + + protected List getByLevel(int level) { + return regionsCache.get(String.valueOf(level)); + } + + private Map buildCacheMap(List regionDTOList) { + Map regionDtoMap = new ConcurrentHashMap<>(256); + regionDTOList.forEach(region -> { + RegionMapKey key = RegionMapKey.builder() + .regionCode(region.getRegionCode()) + .regionLevel(region.getRegionLevel()) + .build(); + regionDtoMap.put(key, region); + }); + return regionDtoMap; + } + + private List toTreeStructure(List rootList) { + List nodeList = new ArrayList<>(); + for (RegionTreeDTO treeNode : rootList) { + if (PARENT_CODE_ROOT.equals(treeNode.getParentCode()) || Objects.isNull(treeNode.getParentCode())) { + nodeList.add(treeNode); + } + treeNode.setChildren(getChildren(treeNode.getRegionCode(), treeNode.getLevel(), rootList)); + } + return nodeList; + } + + private List getChildren(String regionCode, int regionLevel, List list) { + List childList = new ArrayList<>(); + for (RegionTreeDTO regionTreeDTO : list) { + if (regionCode.equals(regionTreeDTO.getParentCode()) && regionLevel + 1 == regionTreeDTO.getLevel()) { + childList.add(regionTreeDTO); + } + } + for (RegionTreeDTO regionTreeDTO : childList) { + regionTreeDTO.setChildren(getChildren(regionTreeDTO.getRegionCode(), regionTreeDTO.getLevel(), list)); + } + if (CollectionUtils.isEmpty(childList)) { + return Collections.emptyList(); + } + childList.sort(Comparator.comparing(RegionTreeDTO::getRegionCode)); + return childList; + } + + + private void warmUp() { + for (int level = 1; level <= REGION_LEVEL_MAX; level++) { + getByLevel(level); + } + } + + protected List getCopyListByLevel(int level) { + List regionTreeDtos = regionsCache.get(String.valueOf(level)); + List copyRegionTreeDtos = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(regionTreeDtos)) { + copyRegionTreeDtos.addAll(regionTreeDtos); + } + return copyRegionTreeDtos; + } + + + @Override + public String getParentCodeRoot() { + return PARENT_CODE_ROOT; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java new file mode 100644 index 0000000..d990c0b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java @@ -0,0 +1,44 @@ +package com.ningdatech.pmapi.common.helper.basic; + +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.common.helper.RegionLimitHelper; +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import lombok.AllArgsConstructor; + +import java.util.Objects; + +/** + *

+ * AbstractRegionLimitHelper + *

+ * + * @author WendyYang + * @since 14:35 2023/3/1 + */ +@AllArgsConstructor +public abstract class AbstractRegionLimitHelper implements RegionLimitHelper { + + protected final RegionCacheHelper regionCacheHelper; + protected final IExpertUserFullInfoService expertUserFullInfoService; + + + /** + * 根据 专家用户id 获取专家层级 + * + * @param expertUserId / + * @return / + */ + protected ExpertRegionInfo getExpertRegionInfo(Long expertUserId) { + ExpertUserFullInfo userFullInfo = expertUserFullInfoService.getByUserId(expertUserId); + if (Objects.isNull(userFullInfo)) { + return new ExpertRegionInfo(); + } + ExpertRegionInfo regionInfo = new ExpertRegionInfo(); + regionInfo.setRegionCode(userFullInfo.getRegionCode()); + regionInfo.setRegionLevel(userFullInfo.getRegionLevel()); + return regionInfo; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java new file mode 100644 index 0000000..3228561 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java @@ -0,0 +1,122 @@ +package com.ningdatech.pmapi.common.helper.impl; + +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.common.helper.basic.AbstractRegionLimitHelper; +import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; +import org.apache.commons.collections4.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/8/1 下午2:27 + */ +@Component +public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { + + private static final Logger logger = LoggerFactory.getLogger(RegionLimitHelperImpl.class); + + public RegionLimitHelperImpl(RegionCacheHelper regionCacheHelper, IExpertUserFullInfoService expertUserFullInfoService) { + super(regionCacheHelper, expertUserFullInfoService); + } + + public static Boolean contains(Integer adminRegionLevel, List adminAllContainsRegionCodes + , Integer expertRegionLevel, String expertRegionCode) { + for (String adminAllContainsRegionCode : adminAllContainsRegionCodes) { + if (adminAllContainsRegionCode.equals(expertRegionCode) && adminRegionLevel >= expertRegionLevel) { + return true; + } + } + return false; + } + + @Override + public Boolean regionContainsCheck(Long expertUserId, Long expertAdminUserId) { + List expertAdminContainsRegion = getExpertAdminContainsRegion(expertAdminUserId); + ExpertRegionInfo expertRegionInfo = getExpertRegionInfo(expertUserId); + return regionContains(expertAdminContainsRegion, expertRegionInfo.getRegionCode(), expertRegionInfo.getRegionLevel()); + } + + @Override + public Boolean regionContains(List regionContainsBOList, String regionCode, Integer regionLevel) { + for (RegionContainsBO regionContainsBO : regionContainsBOList) { + Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); + List containsRegionCodeList = regionContainsBO.getContainsRegionCodeList(); + for (String containsRegionCode : containsRegionCodeList) { + if (containsRegionCode.equals(regionCode) && parentRegionTreeLevel <= regionLevel) { + return true; + } + } + } + return false; + } + + + @Override + public List queryContainsRegionAssembler(RegionContainsBO queryRegionContainBo, List expertAdminContainsRegionList) { + List resultBoList = new ArrayList<>(); + if (Objects.nonNull(queryRegionContainBo)) { + resultBoList.add(queryRegionContainBo); + Integer parentRegionTreeLevel = queryRegionContainBo.getParentRegionTreeLevel(); + List containsRegionCodeList = queryRegionContainBo.getContainsRegionCodeList(); + + // 查询取并级 + if (CollectionUtils.isNotEmpty(expertAdminContainsRegionList)) { + for (RegionContainsBO regionContainsBO : expertAdminContainsRegionList) { + regionContainsBO.setParentRegionTreeLevel(parentRegionTreeLevel); + List regionCodeList = regionContainsBO.getContainsRegionCodeList(); + regionCodeList = regionCodeList.stream().filter(containsRegionCodeList::contains).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(regionCodeList)) { + regionContainsBO.setContainsRegionCodeList(regionCodeList); + resultBoList.add(regionContainsBO); + } + } + } + return resultBoList; + } else { + return expertAdminContainsRegionList; + } + } + + @Override + public RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode) { + List regionCodes = regionCacheHelper + .getAllChildrenRegionCodeList(regionCode, regionLevel); + RegionContainsBO regionContainsBO = new RegionContainsBO(); + regionContainsBO.setContainsRegionCodeList(regionCodes); + regionContainsBO.setParentRegionTreeLevel(regionLevel); + return regionContainsBO; + } + + @Override + public List getExpertAdminContainsRegion(Long expertAdminUserId) { + if (Objects.isNull(expertAdminUserId)) { + logger.error("getExpertAdminContainsRegion expertAdminUserId is null"); + return new ArrayList<>(); + } + // TODO + /*LambdaQueryWrapper expertAdminRegionEq = Wrappers.lambdaQuery(ExpertAdminRegion.class) + .eq(ExpertAdminRegion::getUserId, expertAdminUserId); + List expertAdminRegionList = iExpertAdminRegionService.list(expertAdminRegionEq); + List regionContainsBOList = new ArrayList<>(); + for (ExpertAdminRegion expertAdminRegion : expertAdminRegionList) { + List regionCodes = regionCacheHelper + .getAllChildrenRegionCodeList(expertAdminRegion.getRegionCode(), expertAdminRegion.getRegionLevel()); + RegionContainsBO regionContainsBO = new RegionContainsBO(); + regionContainsBO.setContainsRegionCodeList(regionCodes); + regionContainsBO.setParentRegionTreeLevel(expertAdminRegion.getRegionLevel()); + regionContainsBOList.add(regionContainsBO); + }*/ + return null; + } + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheImpl.java new file mode 100644 index 0000000..df3c23d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheImpl.java @@ -0,0 +1,205 @@ +package com.ningdatech.pmapi.common.helper.impl; + +import cn.hutool.core.lang.Assert; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.common.helper.basic.AbstractRegionCache; +import com.ningdatech.pmapi.common.model.RegionMapKey; +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author liuxinxin + * @date 2022/7/22 上午8:58 + * 构建地区码 地区树 + */ +@Slf4j +@Component +public class RegionsCacheImpl extends AbstractRegionCache { + + @Override + public List all() { + return getByLevel(3); + } + + @Override + public List getAllChildrenRegionCodeList(String code, int level) { + List regionTreeDTOList = all(); + Set childrenRegionCodeSet = new HashSet<>(); + childrenRegionCodeSet.add(code); + RegionTreeDTO currentRegionTree = getCurrentRegionTree(code, level, regionTreeDTOList); + if (Objects.isNull(currentRegionTree)) { + List childrenRegionCodeList = new ArrayList<>(); + childrenRegionCodeList.add(code); + return childrenRegionCodeList; + } + getAllChildrenRegionCodeList(currentRegionTree.getChildren(), childrenRegionCodeSet); + return new ArrayList<>(childrenRegionCodeSet); + } + + private RegionTreeDTO getCurrentRegionTree(String code, int level, List regionTreeDtos) { + for (RegionTreeDTO regionTreeDTO : regionTreeDtos) { + if (level == regionTreeDTO.getLevel() && code.equals(regionTreeDTO.getRegionCode())) { + return regionTreeDTO; + } + if (CollectionUtils.isNotEmpty(regionTreeDTO.getChildren())) { + return getCurrentRegionTree(code, level, regionTreeDTO.getChildren()); + } + } + return null; + } + + private void getAllChildrenRegionCodeList(List regionTreeDtos, Set childrenRegionCodeSet) { + if (CollectionUtils.isEmpty(regionTreeDtos)) { + return; + } + for (RegionTreeDTO regionTreeDTO : regionTreeDtos) { + childrenRegionCodeSet.add(regionTreeDTO.getRegionCode()); + getAllChildrenRegionCodeList(regionTreeDTO.getChildren(), childrenRegionCodeSet); + + } + } + + @Override + public List getRegionCodes(String regionCode, int regionLevel) { + RegionTreeDTO regionTreeNode = getTreeByRegionAndCode(null, regionCode, regionLevel); + Assert.notNull(regionTreeNode, "不存在此级别区域信息:{}", regionLevel); + List regionCodes = new ArrayList<>(); + if (regionTreeNode != null) { + regionCodes.addAll(CollUtils.fieldList(treeToList(Collections.singletonList(regionTreeNode)), RegionTreeDTO::getRegionCode)); + } + if (!regionCodes.contains(regionCode)) { + regionCodes.add(regionCode); + } + return regionCodes; + } + + protected List treeToList(List treeList) { + ArrayList result = new ArrayList<>(); + treeList.forEach(w -> { + result.add(w); + if (CollectionUtils.isNotEmpty(w.getChildren())) { + result.addAll(treeToList(w.getChildren())); + } + }); + return result; + } + + + /** + * 获取某一个地区开始的层级树 + * + * @param list 地区集合 + * @param code 地区编码 + * @param level 地区层级 + * @return / + */ + protected RegionTreeDTO getTreeByRegionAndCode(List list, String code, int level) { + if (CollectionUtils.isEmpty(list)) { + list = super.getCopyListByLevel(3); + if (CollectionUtils.isEmpty(list)) { + return null; + } + } + Optional first = list.stream() + .filter(w -> w.getRegionCode().equals(code) && w.getLevel() == level) + .findFirst(); + if (first.isPresent()) { + return first.get(); + } + for (RegionTreeDTO dto : list) { + if (CollectionUtils.isEmpty(dto.getChildren())) { + continue; + } + RegionTreeDTO temp = getTreeByRegionAndCode(dto.getChildren(), code, level); + if (temp != null) { + return temp; + } + } + return null; + } + + @Override + public List listParents(String code, int level) { + List result = new ArrayList<>(); + RegionDTO dto = regionMap.get(RegionMapKey.of(code, level)); + result.add(0, dto); + if (dto.getParentCode().equals(super.getParentCodeRoot())) { + return result; + } + result.addAll(0, listParents(dto.getParentCode(), dto.getRegionLevel() - 1)); + return result; + } + + @Override + public RegionDTO getByCodeAndLevel(String code, int level) { + return regionMap.get(RegionMapKey.of(code, level)); + } + + @Override + public List getProvincialRegion() { + List provincialRegionList = new ArrayList<>(); + regionMap.values().forEach(v -> { + if (v.getRegionCode().equals(v.getParentCode()) && v.getRegionLevel() == 2) { + provincialRegionList.add(v); + } + }); + return provincialRegionList; + } + + @Override + public List getMunicipalRegion() { + List municipalRegionList = new ArrayList<>(); + regionMap.values().forEach(v -> { + if (v.getRegionCode().equals(v.getParentCode()) && v.getRegionLevel() == 3) { + municipalRegionList.add(v); + } + }); + return municipalRegionList; + } + + @Override + public Map getRegionMap() { + Map regionDtoMap = new ConcurrentHashMap<>(512); + regionMap.forEach((k, v) -> regionDtoMap.put(k.getRegionCode() + "###" + k.getRegionLevel(), v)); + return regionDtoMap; + } + + @Override + public Map getNameRegionMap() { + Map nameRegionDtoMap = new ConcurrentHashMap<>(512); + regionMap.forEach((k, v) -> nameRegionDtoMap.put(v.getRegionName(), v)); + return nameRegionDtoMap; + } + + @Override + public String getUnionPathStr(String code, Integer level) { + if (StringUtils.isBlank(code) || Objects.isNull(level)) { + return null; + } + List unionPathStrList = new ArrayList<>(); + buildUnionPathStrList(code, level, unionPathStrList); + Collections.reverse(unionPathStrList); + if (CollectionUtils.isEmpty(unionPathStrList)) { + return null; + } + return String.join("@@", unionPathStrList); + } + + protected void buildUnionPathStrList(String code, Integer level, List unionPathStrList) { + if (level <= 0 || super.getParentCodeRoot().equals(code)) { + return; + } + RegionDTO regionDTO = regionMap.get(RegionMapKey.of(code, level)); + unionPathStrList.add(regionDTO.getRegionCode() + "##" + regionDTO.getRegionName() + "##" + regionDTO.getRegionLevel()); + if (!super.getParentCodeRoot().equals(regionDTO.getParentCode())) { + buildUnionPathStrList(regionDTO.getParentCode(), level - 1, unionPathStrList); + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java new file mode 100644 index 0000000..31c5bf8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java @@ -0,0 +1,59 @@ +package com.ningdatech.pmapi.common.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.util.Objects; + +/** + *

+ * RegionMapKey + *

+ * + * @author WendyYang + * @since 13:54 2023/3/1 + */ +@Data +@Builder +@AllArgsConstructor +public class RegionMapKey { + + public static RegionMapKey of(String regionCode, int regionLevel) { + return new RegionMapKey(regionCode, regionLevel); + } + + + @Tolerate + public RegionMapKey() { + } + + /** + * 区域码 + */ + private String regionCode; + + /** + * 地区级别 + */ + private Integer regionLevel; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RegionMapKey regionMapKey = (RegionMapKey) o; + return regionCode.equals(regionMapKey.getRegionCode()) && + regionLevel.equals(regionMapKey.getRegionLevel()); + } + + @Override + public int hashCode() { + return Objects.hash(regionCode, regionLevel); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java index 8176cdb..6a301f8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java @@ -1,6 +1,6 @@ package com.ningdatech.pmapi.common.statemachine.action; -import com.ningdatech.pmapi.common.constant.StateMachineConstants; +import com.ningdatech.pmapi.common.constant.StateMachineConst; import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; @@ -23,7 +23,7 @@ import org.springframework.statemachine.annotation.WithStateMachine; @WithStateMachine(id = ProjectDeclareStateMachineBuilder.MACHINEID_TO) public class ProjectDeclareAction { - private static final String PROJECT_DECLARE = StateMachineConstants.PROJECT_DECLARE; + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") public void UNDER_INTERNAL_PASS(Message message) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java index d34a239..1367289 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java @@ -1,6 +1,6 @@ package com.ningdatech.pmapi.common.statemachine.action; -import com.ningdatech.pmapi.common.constant.StateMachineConstants; +import com.ningdatech.pmapi.common.constant.StateMachineConst; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; @@ -18,7 +18,7 @@ import org.springframework.statemachine.action.Action; @Slf4j public class ProjectDeclareChoiceAction implements Action { - private static final String PROJECT_DECLARE = StateMachineConstants.PROJECT_DECLARE; + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; @Override public void execute(StateContext stateContext) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java index 287bfa0..7936261 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java @@ -1,6 +1,6 @@ package com.ningdatech.pmapi.common.statemachine.factory; -import com.ningdatech.pmapi.common.constant.StateMachineConstants; +import com.ningdatech.pmapi.common.constant.StateMachineConst; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; @@ -16,7 +16,7 @@ import org.springframework.statemachine.guard.Guard; */ public class ProjectDeclareGuardFactory { - private static final String PROJECT_DECLARE = StateMachineConstants.PROJECT_DECLARE; + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; public class PendingPreQualificationChoiceGuard implements Guard { @Override diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java index d34313e..4aa67a8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java @@ -1,8 +1,8 @@ package com.ningdatech.pmapi.common.statemachine.util; import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.common.constant.ProjectDeclareConstants; -import com.ningdatech.pmapi.common.constant.StateMachineConstants; +import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; +import com.ningdatech.pmapi.common.constant.StateMachineConst; import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; @@ -32,7 +32,7 @@ import java.util.Objects; @RequiredArgsConstructor public class StateMachineUtils { - private static final String PROJECT_DECLARE = StateMachineConstants.PROJECT_DECLARE; + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; private final ProjectDeclareStateMachineBuilder projectDeclareStateMachineBuilder; @@ -70,7 +70,7 @@ public class StateMachineUtils { * @since 2023/02/07 17:13 */ public static boolean judgeDeclareAmount(Project project) { - int flag = project.getDeclareAmount().compareTo(ProjectDeclareConstants.Number.DECLARE_AMOUNT_JUDGEMENT); + int flag = project.getDeclareAmount().compareTo(ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT); if (flag > 0 || flag == 0) { return true; } @@ -87,7 +87,7 @@ public class StateMachineUtils { */ public static boolean isCityProject(Project project) { String areaCode = project.getAreaCode(); - if (areaCode.equals(StateMachineConstants.LI_SHUI_CITY_AREA_CODE)) { + if (areaCode.equals(StateMachineConst.LI_SHUI_CITY_AREA_CODE)) { return true; } return false; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java index cbe3ded..2dab362 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; +import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AppointRuleVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AppointRuleVO.java new file mode 100644 index 0000000..d93c100 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AppointRuleVO.java @@ -0,0 +1,27 @@ +package com.ningdatech.pmapi.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * 指定邀请规则 + *

+ * + * @author WendyYang + * @since 11:26 2023/3/1 + */ +@Data +@ApiModel("指定邀请规则") +public class AppointRuleVO { + + @ApiModelProperty("邀请说明") + private String inviteDesc; + + @ApiModelProperty("指定邀请专家") + private List experts; + +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AvoidInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AvoidInfoVO.java new file mode 100644 index 0000000..e256063 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AvoidInfoVO.java @@ -0,0 +1,33 @@ +package com.ningdatech.pmapi.meeting.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * 回避信息 + *

+ * + * @author WendyYang + * @since 11:25 2023/3/1 + */ +@Data +@ApiModel("回避信息") +public class AvoidInfoVO { + + @ApiModelProperty("回避单位") + private List avoidUnitIds; + + @ApiModelProperty("回避条线") + private List avoidOrgIds; + + @ApiModelProperty("每周邀请次数") + private Integer weekInviteCount; + + @ApiModelProperty("回避专家") + private List experts; + +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteDetailVO.java index 8c8cbb4..acb2d20 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteDetailVO.java @@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.ArrayList; import java.util.List; /** @@ -57,25 +56,25 @@ public class ExpertInviteDetailVO { } @ApiModelProperty("参与数量总计") - private Integer attendTotal = 0; + private Integer attendTotal; @ApiModelProperty("随机邀请参与数量") - private Integer randomAttend = 0; + private Integer randomAttend; @ApiModelProperty("指定邀请参与数量") - private Integer appointAttend = 0; + private Integer appointAttend; @ApiModelProperty("是否已停止邀请") private Boolean invitedStopped; @ApiModelProperty("最终参与名单") - private List attendList = new ArrayList<>(); + private List attendList; @ApiModelProperty("随机邀请名单") - private List randomInviteList = new ArrayList<>(); + private List randomInviteList; @ApiModelProperty("指定邀请名单") - private List appointInviteList = new ArrayList<>(); + private List appointInviteList; public void addAttendList(ExpertAttendListItemVO attend) { this.attendList.add(attend); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java index 8c0c082..e2f8e19 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java @@ -16,59 +16,15 @@ import java.util.List; @Data public class InviteRuleDetailVO { - @ApiModelProperty("是否创建邀请规则") - private Boolean invited; + private Integer inviteType; @ApiModelProperty("随机邀请规则") private List randomRules; - @ApiModelProperty("是否有指定抽取规则") - private Boolean hasAppointRule; - @ApiModelProperty("指定抽取规则") - private AppointRuleVo appointRule; - - @ApiModelProperty("是否有回避规则") - private Boolean hasAvoidInfo; + private AppointRuleVO appointRule; @ApiModelProperty("回避信息") - private AvoidInfoVo avoidInfo; - - @Data - public static class AvoidInfoVo { - - private List avoidUnitIds; - - private List avoidOrgIds; - - private Integer weekInviteCount; - - private List experts; - - } - - @Data - public static class AppointRuleVo { - - private String inviteDesc; - - private List experts; - - } - - public Boolean setAndGetHasAppointRule(Boolean hasAppointRule) { - this.hasAppointRule = hasAppointRule; - return this.hasAppointRule; - } - - public Boolean setAndGetHasAvoidInfo(Boolean hasAvoidInfo) { - this.hasAvoidInfo = hasAvoidInfo; - return this.hasAvoidInfo; - } - - public Boolean setAndGetInvited(Boolean invited) { - this.invited = invited; - return this.invited; - } + private AvoidInfoVO avoidInfo; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java index c5078aa..2cd42b2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java @@ -1,8 +1,7 @@ package com.ningdatech.pmapi.meeting.entity.vo; import com.alibaba.fastjson.annotation.JSONField; -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +import com.ningdatech.pmapi.meeting.entity.req.ExpertInviteReq; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Builder; @@ -10,7 +9,6 @@ import lombok.Data; import lombok.experimental.Tolerate; import java.time.LocalDateTime; -import java.util.List; /** *

@@ -29,35 +27,36 @@ public class MeetingDetailBasicVO { public MeetingDetailBasicVO() { } - private Long id; + private Long meetingId; @ApiModelProperty("会议名称") - private String name; + private String meetingName; @ApiModelProperty("会议类型名称") private String typeName; @ApiModelProperty("会议类型代码") - private String type; + private String meetingType; @ApiModelProperty("开始时间") @JSONField(format = "yyyy-MM-dd HH:mm") private LocalDateTime startTime; - @ApiModelProperty("结束时间") + @ApiModelProperty("评委到场时间") @JSONField(format = "yyyy-MM-dd HH:mm") - private LocalDateTime endTime; + private LocalDateTime judgesAttendanceTime; + + @ApiModelProperty("会议耗时") + private Integer meetingUsageTime; @ApiModelProperty("联系人") private String connecter; @ApiModelProperty("创建人") - private String author; - - private List regions; + private String creator; - @ApiModelProperty("地点") - private String address; + @ApiModelProperty("评审地点") + private String meetingAddress; @ApiModelProperty("联系方式") private String contact; @@ -65,33 +64,19 @@ public class MeetingDetailBasicVO { @ApiModelProperty("创建时间") private LocalDateTime createOn; - @ApiModelProperty("会议说明") - private String description; - - @ApiModelProperty("相关材料") - private List attachments; - - @ApiModelProperty("备注") - private String remark; - @ApiModelProperty("会议状态") private Integer status; - @ApiModelProperty("专家出席状态") - private Integer attendStatus; - @ApiModelProperty("取消说明") private String cancelRemark; @ApiModelProperty("创建人") private String createBy; - private Boolean invited; - @ApiModelProperty("抽取单位") private String holdOrg; - @ApiModelProperty("是否已确认下发会议通知名单") - private Boolean sendMeetingNotice; + @ApiModelProperty("抽取信息") + private InviteRuleDetailVO inviteRule; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java index 1a6e19a..5ba10b6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java @@ -17,6 +17,7 @@ import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.ValidUtil; import com.ningdatech.cache.lock.DistributedLock; import com.ningdatech.file.service.FileService; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; import com.ningdatech.pmapi.expert.helper.PermissionCheckHelper; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; @@ -64,6 +65,7 @@ import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertIn @RequiredArgsConstructor public class MeetingManage { + private final RegionCacheHelper regionCacheHelper; private final IMeetingService meetingService; private final IExpertInviteAvoidRuleService inviteAvoidRuleService; private final IExpertInviteRuleService inviteRuleService; @@ -306,32 +308,23 @@ public class MeetingManage { public MeetingDetailBasicVO getMeetingBasicInfo(Long meetingId) { Meeting meeting = meetingService.getById(meetingId); - if (Objects.isNull(meeting)) { - throw new BizException("该会议信息不存在"); - } - Integer attendStatus = null; - if (LoginUserUtil.isExpert()) { - List meIds = Collections.singletonList(meetingId); - List status = meetingExpertService.listByExpertIdAndStatus(LoginUserUtil.getUserId(), null, meIds); - if (status.isEmpty()) { - throw BizException.wrap("您未被邀请参加次会议"); - } - attendStatus = meetingManageHelper.getExpertAttendStatus(status.get(0)); - } + Assert.notNull(meeting, "会议不存在"); return MeetingDetailBasicVO.builder() - .id(meeting.getId()) - .name(meeting.getName()) - .type(meeting.getType()) + .meetingId(meeting.getId()) + .meetingName(meeting.getName()) + .meetingType(meeting.getType()) + .meetingAddress(meeting.getMeetingAddress()) .typeName(dictionaryCache.getByCode(meeting.getType()).getName()) - .author(meeting.getCreator()) .startTime(meeting.getStartTime()) - .createOn(meeting.getCreateOn()) + .judgesAttendanceTime(meeting.getJudgesAttendanceTime()) + .meetingUsageTime(meeting.getMeetingUsageTime()) .contact(meeting.getContact()) .connecter(meeting.getConnecter()) .status(meeting.getStatus()) - .attendStatus(attendStatus) - .createBy(meeting.getCreator()) .holdOrg(meeting.getHoldOrg()) + .createOn(meeting.getCreateOn()) + .creator(meeting.getCreator()) + .createBy(meeting.getCreator()) .build(); } @@ -441,9 +434,6 @@ public class MeetingManage { public InviteRuleDetailVO inviteRuleDetail(Long meetingId) { InviteRuleDetailVO result = new InviteRuleDetailVO(); List inviteRules = inviteRuleService.listByMeetingId(meetingId); - if (!result.setAndGetInvited(inviteRules.size() > 0)) { - return result; - } result.setRandomRules(new ArrayList<>()); Map> groupByType = CollUtils.group(inviteRules, w -> ExpertInviteTypeEnum.getByCode(w.getInviteType())); List randoms = groupByType.get(ExpertInviteTypeEnum.RANDOM); @@ -474,25 +464,22 @@ public class MeetingManage { } result.getRandomRules().add(randomRule); }); - } - List appoints = groupByType.get(ExpertInviteTypeEnum.APPOINT); - if (result.setAndGetHasAppointRule(CollUtil.isNotEmpty(appoints))) { - ExpertInviteRule appoint = appoints.get(0); - AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class); - InviteRuleDetailVO.AppointRuleVo vo = new InviteRuleDetailVO.AppointRuleVo(); - vo.setInviteDesc(appointRule.getInviteDesc()); - vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(appointRule.getExpertIds()).values())); - result.setAppointRule(vo); - } - AvoidInfoDTO avoidInfo = inviteAvoidRuleService.getAvoidInfoDto(meetingId); - if (result.setAndGetHasAvoidInfo(avoidInfo != null)) { - InviteRuleDetailVO.AvoidInfoVo vo = new InviteRuleDetailVO.AvoidInfoVo(); + AvoidInfoDTO avoidInfo = inviteAvoidRuleService.getAvoidInfoDto(meetingId); + AvoidInfoVO vo = new AvoidInfoVO(); vo.setAvoidOrgIds(avoidInfo.getAvoidOrgIdList()); vo.setAvoidUnitIds(avoidInfo.getAvoidUnitIdList()); if (CollUtil.isNotEmpty(avoidInfo.getExpertIds())) { vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(avoidInfo.getExpertIds()).values())); } result.setAvoidInfo(vo); + } else { + List appoints = groupByType.get(ExpertInviteTypeEnum.APPOINT); + ExpertInviteRule appoint = appoints.get(0); + AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class); + AppointRuleVO vo = new AppointRuleVO(); + vo.setInviteDesc(appointRule.getInviteDesc()); + vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(appointRule.getExpertIds()).values())); + result.setAppointRule(vo); } return result; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java index 398b7f1..b6cf02a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java @@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; +import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; import com.ningdatech.pmapi.common.util.BizUtils; import com.ningdatech.pmapi.meta.assembler.MetaDictionaryAssembler; import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java index f675d8a..a7079b3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; @@ -14,7 +13,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectService; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; @@ -63,7 +62,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { // 项目状态为年度计划中之前的状态 if (fieldList.contains(status)){ processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConstant.ANNUAL_PLAN); + processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); processSchedule.add(processDetailVO); return; } @@ -95,7 +94,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); } - processDetailVO.setProcessName(CommonConstant.ANNUAL_PLAN); + processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java index 4e74879..707212b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java @@ -7,7 +7,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectService; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; @@ -41,7 +41,7 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle { // 项目阶段不为已归档 if (!ProjectStatusEnum.ARCHIVED.getCode().equals(status)){ processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConstant.ARCHIVED); + processDetailVO.setProcessName(CommonConst.ARCHIVED); processSchedule.add(processDetailVO); return; } @@ -53,7 +53,7 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle { .eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS.name()) .last("limit 1")); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); - processDetailVO.setProcessName(CommonConstant.ARCHIVED); + processDetailVO.setProcessName(CommonConst.ARCHIVED); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java index d1f64f8..9ac5438 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java @@ -11,7 +11,7 @@ import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; @@ -51,7 +51,7 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle if (Objects.isNull(projectInst)){ processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConstant.CONSTRUCTION_PLAN_REVIEW); + processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW); processSchedule.add(processDetailVO); return; } @@ -76,7 +76,7 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle processDetailVO.setFinishTime(finishTime); } processDetailVO.setProcessProgressVo(instanceDetail); - processDetailVO.setProcessName(CommonConstant.CONSTRUCTION_PLAN_REVIEW); + processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java index 5236c0f..4446a28 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java @@ -11,7 +11,7 @@ import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; @@ -50,7 +50,7 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { .last("limit 1")); if (Objects.isNull(projectInst)){ processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConstant.DEPT_UNITED_REVIEW); + processDetailVO.setProcessName(CommonConst.DEPT_UNITED_REVIEW); processSchedule.add(processDetailVO); return; } @@ -74,7 +74,7 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { processDetailVO.setFinishTime(finishTime); } processDetailVO.setProcessProgressVo(instanceDetail); - processDetailVO.setProcessName(CommonConstant.DEPT_UNITED_REVIEW); + processDetailVO.setProcessName(CommonConst.DEPT_UNITED_REVIEW); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java index 73f4616..d4c71c8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java @@ -3,7 +3,7 @@ package com.ningdatech.pmapi.projectlib.handle; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; @@ -49,7 +49,7 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { .last("limit 1")); if (Objects.isNull(projectInst)){ processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConstant.PRELIMINARY_PREVIEW); + processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW); processSchedule.add(processDetailVO); return; } @@ -73,7 +73,7 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { processDetailVO.setFinishTime(finishTime); } processDetailVO.setProcessProgressVo(instanceDetail); - processDetailVO.setProcessName(CommonConstant.PRELIMINARY_PREVIEW); + processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java index e9ab43b..caa1779 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java @@ -3,24 +3,19 @@ package com.ningdatech.pmapi.projectlib.handle; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.*; -import java.util.stream.Collectors; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.projectlib.model.entity.Project; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import com.ningdatech.pmapi.projectlib.service.IProjectService; @@ -78,7 +73,7 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { // 项目状态为待立项批复之前的状态 if (fieldList.contains(status)){ processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConstant.PROJECT_APPROVAL); + processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); processSchedule.add(processDetailVO); return; } @@ -101,7 +96,7 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { processDetailVO.setFinishTime(approvalDateTime); processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); } - processDetailVO.setProcessName(CommonConstant.PROJECT_APPROVAL); + processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectDeclareHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectDeclareHandle.java index 7806f2e..d374548 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectDeclareHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectDeclareHandle.java @@ -1,6 +1,6 @@ package com.ningdatech.pmapi.projectlib.handle; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; @@ -37,7 +37,7 @@ public class ProjectDeclareHandle extends AbstractProcessBusinessHandle { Project project = projectService.getById(projectId); LocalDateTime createOn = project.getCreateOn(); processDetailVO.setFinishTime(createOn); - processDetailVO.setProcessName(CommonConstant.PROJECT_DECLARE); + processDetailVO.setProcessName(CommonConst.PROJECT_DECLARE); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java index dbd5045..144d568 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java @@ -15,7 +15,7 @@ import com.wflow.workflow.service.ProcessInstanceService; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; @@ -50,7 +50,7 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle if (Objects.isNull(projectInst)){ processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConstant.PROJECT_FINAL_INSPECTION); + processDetailVO.setProcessName(CommonConst.PROJECT_FINAL_INSPECTION); processSchedule.add(processDetailVO); return; } @@ -76,7 +76,7 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle processDetailVO.setFinishTime(finishTime); } processDetailVO.setProcessProgressVo(instanceDetail); - processDetailVO.setProcessName(CommonConstant.PRELIMINARY_PREVIEW); + processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java index 0b7754a..f207d82 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java @@ -4,18 +4,16 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; import java.util.Arrays; import java.util.List; -import java.util.Objects; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; -import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; @@ -60,7 +58,7 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH // 项目状态不在建设中及之后的状态 if (!fieldList.contains(status)){ processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConstant.PROJECT_PRELIMINARY_INSPECTION); + processDetailVO.setProcessName(CommonConst.PROJECT_PRELIMINARY_INSPECTION); processSchedule.add(processDetailVO); return; } @@ -76,7 +74,7 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH .last("limit 1")); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); } - processDetailVO.setProcessName(CommonConstant.TENDER_PURCHASE); + processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java index 0bf285a..8002c2c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java @@ -2,26 +2,19 @@ package com.ningdatech.pmapi.projectlib.handle; import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; -import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.*; -import java.util.stream.Collectors; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; -import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import com.ningdatech.pmapi.projectlib.service.IProjectService; @@ -63,7 +56,7 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { // 未进行立项批复 if (Objects.isNull(project.getApprovalDate())){ processDetailVO.setStepStatus(StepStatusEnum.NOT_START); - processDetailVO.setProcessName(CommonConstant.TENDER_PURCHASE); + processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); processSchedule.add(processDetailVO); return; } @@ -80,7 +73,7 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { .last("limit 1")); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); } - processDetailVO.setProcessName(CommonConstant.TENDER_PURCHASE); + processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java index b4326f7..ce3b334 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java @@ -10,7 +10,7 @@ import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; import com.ningdatech.pmapi.projectlib.service.IProjectInstService; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.wflow.workflow.bean.process.ProgressNode; @@ -69,7 +69,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { processDetailVO.setFinishTime(finishTime); } processDetailVO.setProcessProgressVo(instanceDetail); - processDetailVO.setProcessName(CommonConstant.UNIT_INNER_AUDIT); + processDetailVO.setProcessName(CommonConst.UNIT_INNER_AUDIT); processSchedule.add(processDetailVO); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java index ebbefd0..e2db4ad 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java @@ -12,7 +12,7 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.ValidUtil; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; @@ -217,8 +217,8 @@ public class AnnualPlanLibManage { } public void exportList(ProjectListReq param, HttpServletResponse response) { - param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); Integer isTemporaryAugment = param.getIsTemporaryAugment(); if (Objects.isNull(isTemporaryAugment)){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 012a12c..61a28ef 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; @@ -135,8 +135,8 @@ public class ProjectLibManage { } public void exportList(ProjectListReq param, HttpServletResponse response) { - param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); List projects = projectService.list(query); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java index ce45daa..ef5521f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java @@ -8,7 +8,7 @@ import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.common.util.ExcelExportStyle; import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; @@ -167,8 +167,8 @@ public class ProjectRenewalFundManage { public void exportList(HttpServletResponse response, ProjectRenewalListReq param) { - param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); Page page = param.page(); projectRenewalFundDeclarationService.pageSql(page, param); List records = page.getRecords(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java index 2401192..ca34fd1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java @@ -27,7 +27,7 @@ public class RegionManage { private final static Long ROOT_PARENT_ID = 0L; public List getRegionTree() { - List regions = regionService.queryAll(); + List regions = regionService.all(); Map> regionMap = CollUtils.group(regions, RegionDTO::getParentId); return RegionConverter.toRegionTree(ROOT_PARENT_ID, regionMap, false); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java index b5a0295..f70430d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java @@ -21,7 +21,7 @@ public interface IRegionService extends IService { * * @return 所有区域 */ - List queryAll(); + List all(); /** * 查询大于等与该级别的所有区域 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java index e0dc101..d00e4f8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java @@ -11,7 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Lists; import com.ningdatech.basic.exception.BaseUncheckedException; import com.ningdatech.basic.util.ValidatorUtil; -import com.ningdatech.pmapi.common.constant.DefValConstants; +import com.ningdatech.pmapi.common.constant.DefValConst; import com.ningdatech.pmapi.sys.model.entity.Menu; import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum; import com.ningdatech.pmapi.sys.model.dto.MenuSaveDTO; @@ -141,7 +141,7 @@ public class MenuServiceImpl extends ServiceImpl implements IM private void fill(Menu resource) { if (resource.getPid() == null || resource.getPid() <= 0) { - resource.setPid(DefValConstants.PARENT_ID); + resource.setPid(DefValConst.PARENT_ID); } else { Menu parent = getById(resource.getPid()); if (Objects.isNull(parent)) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java index 709ed42..7d43cc3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java @@ -24,9 +24,8 @@ import java.util.List; public class RegionServiceImpl extends ServiceImpl implements IRegionService { @Override - public List queryAll() { - List allRegions = this.lambdaQuery().ne(Region::getId, -1).list(); - return CollUtils.convert(allRegions, RegionConverter::toRegionDTO); + public List all() { + return CollUtils.convert(list(), RegionConverter::toRegionDTO); } @Override diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 787bf18..f3c89e3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -1,15 +1,13 @@ package com.ningdatech.pmapi.todocenter.manage; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.StopWatch; import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Sets; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; @@ -35,7 +33,6 @@ import com.ningdatech.pmapi.todocenter.model.dto.vo.ResToBeProcessedVO; import com.ningdatech.pmapi.user.entity.UserInfo; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.util.LoginUserUtil; -import com.ningdatech.zwdd.client.ZwddClient; import com.wflow.contants.HisProInsEndActId; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; @@ -48,12 +45,10 @@ import com.wflow.workflow.enums.ProcessStatusEnum; import com.wflow.workflow.service.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.assertj.core.util.Lists; import org.flowable.bpmn.model.*; import org.flowable.engine.*; import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.runtime.ActivityInstance; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; @@ -150,8 +145,8 @@ public class TodoCenterManage { public void exportTodoList(HttpServletResponse response, ToBeProcessedExportReq param) { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); - param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); //因为要解耦 不能把项目和工作流一起查 //1.先查出用户工作流 @@ -663,8 +658,8 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); - param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); // 查询用户已处理工作流 List userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), String.valueOf(userId)); @@ -757,8 +752,8 @@ public class TodoCenterManage { // 获取登录用户ID long userId = LoginUserUtil.getUserId(); - param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); // 查询用户已处理工作流 List userSubmittedList = processInstanceService.getUserSubmittedList(String.valueOf(userId), param.getProcessDefId(), null); List instCodes = userSubmittedList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); @@ -854,8 +849,8 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); - param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); - param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); + param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); + param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); // 查询抄送登录用户的工作流 List ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), String.valueOf(userId)); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java index 7da9923..99c8077 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java @@ -3,7 +3,7 @@ package com.ningdatech.pmapi.user.security.auth; import com.ningdatech.basic.util.NdJsonUtil; import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.common.constant.BizConst; -import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.user.security.auth.handler.DefaultExpiredSessionStrategy; import com.ningdatech.pmapi.user.security.auth.credential.CredentialAuthSecurityConfig; import org.springframework.beans.factory.annotation.Qualifier; @@ -61,7 +61,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { .expiredSessionStrategy(defaultExpiredSessionStrategy) .and().and() .logout().logoutUrl(authProperties.getLogoutUrl()).logoutSuccessHandler(logoutSuccessHandler) - .deleteCookies(CommonConstant.COOKIE_KEY) + .deleteCookies(CommonConst.COOKIE_KEY) // .and() // .cors().configurationSource(corsConfigurationSource()) .and() From 3fc1952d747d914fc53e00cda93621feed6be50f Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 1 Mar 2023 18:11:24 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E5=BA=93=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E9=99=90=E5=88=B6=E6=9D=83=E9=99=90=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expert/assembler/ExpertUserInfoAssembler.java | 2 +- .../expert/assembler/RegionWrapperAssembler.java | 39 ++++++ .../constant/QueryExpertAccountStatusEnum.java | 49 +++++++ .../pmapi/expert/controller/ExpertController.java | 11 ++ .../pmapi/expert/manage/ExpertAdminManage.java | 142 +++++++++++++++++++++ .../pmapi/expert/manage/ExpertMetaApplyManage.java | 32 ++--- .../expert/model/ExpertAdminExpertManageQuery.java | 48 +++++++ .../model/cmd/ExpertAdminExpertManageQueryCmd.java | 1 + .../model/vo/ExpertAdminExpertManageListVO.java | 56 ++++++++ 9 files changed, 364 insertions(+), 16 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/QueryExpertAccountStatusEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAdminExpertManageQuery.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertAdminExpertManageListVO.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java index 0ef9338..3231f86 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java @@ -20,7 +20,7 @@ package com.ningdatech.pmapi.expert.assembler; import com.alibaba.fastjson.JSONObject; import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; +import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java new file mode 100644 index 0000000..80a0cf1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java @@ -0,0 +1,39 @@ +package com.ningdatech.pmapi.expert.assembler; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/10 下午5:36 + */ + +public class RegionWrapperAssembler { + + public static void expertUserFullInfoRegionContainsWrapperAssembler(LambdaQueryWrapper wrapperQuery, List containsRegionList) { + for (RegionContainsBO regionContainsBO : containsRegionList) { + List containsRegionCodeList = regionContainsBO.getContainsRegionCodeList(); + Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); + if (CollectionUtils.isNotEmpty(containsRegionCodeList)) { + wrapperQuery.and(wrapper -> wrapper.in(ExpertUserFullInfo::getRegionCode, containsRegionCodeList) + .ge(ExpertUserFullInfo::getRegionLevel, parentRegionTreeLevel)); + } + } + } + + public static void expertMetaApplyRegionContainsWrapperAssembler(LambdaQueryWrapper wrapperQuery, List containsRegionList) { + for (RegionContainsBO regionContainsBO : containsRegionList) { + List containsRegionCodeList = regionContainsBO.getContainsRegionCodeList(); + Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel(); + if (CollectionUtils.isNotEmpty(containsRegionCodeList)) { + wrapperQuery.and(wrapper -> wrapper.in(ExpertMetaApply::getRegionCode, containsRegionCodeList) + .ge(ExpertMetaApply::getRegionLevel, parentRegionTreeLevel)); + } + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/QueryExpertAccountStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/QueryExpertAccountStatusEnum.java new file mode 100644 index 0000000..63f6111 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/QueryExpertAccountStatusEnum.java @@ -0,0 +1,49 @@ +package com.ningdatech.pmapi.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:14 + */ +@AllArgsConstructor +@Getter +public enum QueryExpertAccountStatusEnum { + + + /** + * 冻结中 + */ + FREEZING("freezing"), + + /** + * 正常 + */ + NORMAL("normal"); + + private final String key; + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (QueryExpertAccountStatusEnum statusEnum : QueryExpertAccountStatusEnum.values()) { + if (statusEnum.key.equals(key)) { + return true; + } + } + return false; + } + + + public static QueryExpertAccountStatusEnum of(String key) { + for (QueryExpertAccountStatusEnum statusEnum : QueryExpertAccountStatusEnum.values()) { + if (statusEnum.key.equals(key)) { + return statusEnum; + } + } + throw new IllegalArgumentException(String.format("Illegal QueryExpertAccountStatusEnum = %s", key)); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java index df457d6..b0309fa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java @@ -1,9 +1,13 @@ package com.ningdatech.pmapi.expert.controller; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.expert.manage.ExpertAdminManage; import com.ningdatech.pmapi.expert.manage.ExpertManage; +import com.ningdatech.pmapi.expert.model.ExpertAdminExpertManageQuery; import com.ningdatech.pmapi.expert.model.req.ExpertRecommendProofSubmitRequest; import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; +import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -27,6 +31,7 @@ import javax.validation.Valid; public class ExpertController { private final ExpertManage expertManage; + private final ExpertAdminManage expertAdminManage; @PostMapping("/basic-info-submit") @ApiOperation("填写基本信息接口(专家报名使用))") @@ -47,5 +52,11 @@ public class ExpertController { return expertManage.getExpertFullInfoDetail(null); } + @PostMapping("/expert-library/list") + @ApiOperation("专家库列表查询接口") + public PageVo getExpertLibraryList( + @RequestBody @Valid ExpertAdminExpertManageQuery expertAdminExpertManageQuery) { + return expertAdminManage.getExpertLibraryList(expertAdminExpertManageQuery); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java new file mode 100644 index 0000000..49655b7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java @@ -0,0 +1,142 @@ +package com.ningdatech.pmapi.expert.manage; + +import cn.hutool.core.collection.CollectionUtil; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.common.helper.RegionLimitHelper; +import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; +import com.ningdatech.pmapi.expert.constant.QueryExpertAccountStatusEnum; +import com.ningdatech.pmapi.expert.helper.PermissionCheckHelper; +import com.ningdatech.pmapi.expert.model.ExpertAdminExpertManageQuery; +import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; +import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; +import com.ningdatech.pmapi.expert.model.query.ExpertTagQuery; +import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; +import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; +import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; +import com.ningdatech.pmapi.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2023/3/1 下午2:12 + */ + +@Component +@RequiredArgsConstructor +public class ExpertAdminManage { + + private final PermissionCheckHelper permissionCheckHelper; + private final RegionLimitHelper regionLimitHelper; + + /** + * 专家管理员使用 专家库列表查询 + * + * @param query + * @return + */ + public PageVo getExpertLibraryList(ExpertAdminExpertManageQuery query) { + Long userId = LoginUserUtil.getUserId(); + ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = buildExpertAdminExpertManageQueryCmd(query, userId); +// CommonPage pageResult = +// expertAdminManageService.getExpertLibraryList(expertAdminExpertManageQueryCmd); +// +// PageVo pageVo = new PageVo<>(); +// pageVo.setTotal(pageResult.getItemsTotal()); +// pageVo.setRecords(expertAdminExpertManageAssembler.toExpertAdminExpertManageListVOList(pageResult.getItems())); +// return pageVo; + return null; + } + + + private ExpertAdminExpertManageQueryCmd buildExpertAdminExpertManageQueryCmd(ExpertAdminExpertManageQuery query, Long userId) { + ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = new ExpertAdminExpertManageQueryCmd(); + expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); + expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); + if (StringUtils.isNotBlank(query.getExpertName())) { + expertAdminExpertManageQueryCmd.setExpertName(query.getExpertName()); + } + if (StringUtils.isNotBlank(query.getCompany())) { + expertAdminExpertManageQueryCmd.setCompany(query.getCompany()); + } + List expertDictionaryQueryList = new ArrayList<>(); + if (StringUtils.isNotBlank(query.getTitleLevelDictionaryCode())) { + ExpertDictionaryQuery expertDictionaryQuery = new ExpertDictionaryQuery(); + expertDictionaryQuery.setExpertInfoField(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()); + expertDictionaryQuery.setDictionaryCodeList(CollectionUtil.toList(query.getTitleLevelDictionaryCode())); + expertDictionaryQueryList.add(expertDictionaryQuery); + } + if (StringUtils.isNotBlank(query.getCompanyAttributeDictionaryCode())) { + ExpertDictionaryQuery expertDictionaryQuery = new ExpertDictionaryQuery(); + expertDictionaryQuery.setExpertInfoField(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()); + expertDictionaryQuery.setDictionaryCodeList(CollectionUtil.toList(query.getCompanyAttributeDictionaryCode())); + expertDictionaryQueryList.add(expertDictionaryQuery); + } + if (StringUtils.isNotBlank(query.getExpertTypeDictionaryCode())) { + ExpertDictionaryQuery expertDictionaryQuery = new ExpertDictionaryQuery(); + expertDictionaryQuery.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()); + expertDictionaryQuery.setDictionaryCodeList(CollectionUtil.toList(query.getExpertTypeDictionaryCode())); + expertDictionaryQueryList.add(expertDictionaryQuery); + } + List expertTagQueryList = new ArrayList<>(); + if (StringUtils.isNotBlank(query.getExpertSourceTagCode())) { + ExpertTagQuery expertTagQuery = new ExpertTagQuery(); + expertTagQuery.setExpertInfoField(ExpertTagEnum.EXPERT_SOURCE.getKey()); + expertTagQuery.setTagCodeList(CollectionUtil.toList(query.getExpertSourceTagCode())); + expertTagQueryList.add(expertTagQuery); + } + if (StringUtils.isNotBlank(query.getGoodAtTagCode())) { + ExpertTagQuery expertTagQuery = new ExpertTagQuery(); + expertTagQuery.setExpertInfoField(ExpertTagEnum.GOOD_AT.getKey()); + expertTagQuery.setTagCodeList(CollectionUtil.toList(query.getGoodAtTagCode())); + expertTagQueryList.add(expertTagQuery); + } + if (StringUtils.isNotBlank(query.getExpertAccountStatus())) { + QueryExpertAccountStatusEnum queryExpertAccountStatusEnum = QueryExpertAccountStatusEnum.of(query.getExpertAccountStatus()); + switch (queryExpertAccountStatusEnum) { + case NORMAL: + expertAdminExpertManageQueryCmd + .setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.AVAILABLE)); + break; + case FREEZING: + expertAdminExpertManageQueryCmd + .setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.FREEZE)); + break; + default: + break; + } + } else { + expertAdminExpertManageQueryCmd + .setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.AVAILABLE, ExpertAccountStatusEnum.FREEZE)); + } + + List expertAdminContainsRegionList = new ArrayList<>(); + + // 如果为超级管理员,可以查看所有的专家,包括没有层级的专家 + if (!permissionCheckHelper.isSuperAdmin()) { + expertAdminContainsRegionList = regionLimitHelper.getExpertAdminContainsRegion(userId); + } + List containsRegion = new ArrayList<>(); + if (Objects.nonNull(query.getExpertRegionInfo())) { + RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegionInfo().getRegionLevel() + , query.getExpertRegionInfo().getRegionCode()); + containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); + } else { + containsRegion = expertAdminContainsRegionList; + } + expertAdminExpertManageQueryCmd.setExpertDictionaryQueryList(expertDictionaryQueryList); + expertAdminExpertManageQueryCmd.setExpertTagQueryList(expertTagQueryList); + expertAdminExpertManageQueryCmd.setIsDingUser(query.getIsDingUser()); + expertAdminExpertManageQueryCmd.setRegionContainsList(containsRegion); + expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); + expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); + return expertAdminExpertManageQueryCmd; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java index 215221f..2348321 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java @@ -9,9 +9,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; +import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; +import com.ningdatech.pmapi.common.helper.RegionLimitHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.util.BizUtils; +import com.ningdatech.pmapi.expert.assembler.RegionWrapperAssembler; import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeQueryEnum; @@ -71,13 +73,13 @@ public class ExpertMetaApplyManage { private final UserInfoHelper userInfoHelper; + private final RegionLimitHelper regionLimitHelper; + public PageVo metaApplyListQuery(MetaApplyListQuery req) { Long expertAdminUserId = LoginUserUtil.getUserId(); // 查找符合专家条件的用户id - // TODO -// List viewRegions = regionLimitHelper.getExpertAdminContainsRegion(expertAdminUserId); - List viewRegions = new ArrayList<>(); + List viewRegions = regionLimitHelper.getExpertAdminContainsRegion(expertAdminUserId); ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req, viewRegions); // TODO // List filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd); @@ -89,7 +91,7 @@ public class ExpertMetaApplyManage { LambdaQueryWrapper expertMetaApplyListQuery = buildMetaApplyListQueryWrapper(req, filterExpertUserIdList, viewRegions); -// RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); + RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); Page pageResult = iMetaApplyService.page(req.page(), expertMetaApplyListQuery); PageVo result = new PageVo<>(); result.setTotal(pageResult.getTotal()); @@ -380,17 +382,17 @@ public class ExpertMetaApplyManage { expertDictionaryQueryList.add(expertDictionaryQuery); } -// List containsRegion; -// if (Objects.nonNull(query.getExpertRegion())) { -// RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegion().getRegionLevel() -// , query.getExpertRegion().getRegionCode()); -// containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); -// } else { -// containsRegion = expertAdminContainsRegionList; -// } + List containsRegion; + if (Objects.nonNull(query.getExpertRegion())) { + RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegion().getRegionLevel() + , query.getExpertRegion().getRegionCode()); + containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); + } else { + containsRegion = expertAdminContainsRegionList; + } expertAdminExpertManageQueryCmd.setExpertDictionaryQueryList(expertDictionaryQueryList); -// expertAdminExpertManageQueryCmd.setRegionContainsList(containsRegion); + expertAdminExpertManageQueryCmd.setRegionContainsList(containsRegion); expertAdminExpertManageQueryCmd.setPageSize(query.getPageSize()); expertAdminExpertManageQueryCmd.setPageNumber(query.getPageNumber()); return expertAdminExpertManageQueryCmd; @@ -484,7 +486,7 @@ public class ExpertMetaApplyManage { .ne(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.REVOKED.getKey()) .orderByDesc(ExpertMetaApply::getCreateOn); -// RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); + RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions); return expertMetaApplyListQuery; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAdminExpertManageQuery.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAdminExpertManageQuery.java new file mode 100644 index 0000000..d1150d9 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAdminExpertManageQuery.java @@ -0,0 +1,48 @@ +package com.ningdatech.pmapi.expert.model; + + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/4 上午10:18 + */ +@Data +@ApiModel("专家库筛选接口") +public class ExpertAdminExpertManageQuery extends PagePo { + + @ApiModelProperty("专家姓名(精准匹配)") + private String expertName; + + @ApiModelProperty("工作单位(模糊匹配)") + private String company; + + @ApiModelProperty("职称级别字典编码") + private String titleLevelDictionaryCode; + + @ApiModelProperty("单位属性字典编码") + private String companyAttributeDictionaryCode; + + @ApiModelProperty(value = "专家账号状态", allowableValues = "冻结:freezing,正常:normal") + private String expertAccountStatus; + + @ApiModelProperty("区域信息") + private ExpertRegionInfo expertRegionInfo; + + @ApiModelProperty(value = "是否浙政钉用户") + private Boolean isDingUser; + + @ApiModelProperty("内外围字典编码") + private String expertTypeDictionaryCode; + + @ApiModelProperty("专家来源标签编码") + private String expertSourceTagCode; + + @ApiModelProperty("擅长方向标签编码") + private String goodAtTagCode; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java index 57bf9f5..665751c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.expert.model.cmd; + import com.ningdatech.pmapi.common.model.CommonPageReq; import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertAdminExpertManageListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertAdminExpertManageListVO.java new file mode 100644 index 0000000..fdbe9de --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertAdminExpertManageListVO.java @@ -0,0 +1,56 @@ +package com.ningdatech.pmapi.expert.model.vo; + + +import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; +import com.ningdatech.pmapi.expert.model.TagFieldInfo; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/4 上午11:04 + */ +@Data +@ApiModel("专家库列表查询返回model") +public class ExpertAdminExpertManageListVO { + + @ApiModelProperty(value = "用户id") + private Long userId; + + @ApiModelProperty(value = "专家姓名") + private String expertName; + + @ApiModelProperty(value = "职称级别") + private List titleLevel; + + @ApiModelProperty("工作单位") + private String company; + + @ApiModelProperty(" 单位法人编号") + private String legalEntityCode; + + @ApiModelProperty("单位类型(字典code)") + private List companyAttribute; + + @ApiModelProperty(value = "手机号") + private String phoneNo; + + @ApiModelProperty(value = "专家类型(内外围)") + private List expertType; + + @ApiModelProperty(value = "专家层级") + private ExpertRegionInfo expertRegionInfo; + + @ApiModelProperty(value = "是否浙政钉用户") + private Boolean isDingUser; + + @ApiModelProperty(value = "专家账号状态", allowableValues = "冻结:freezing,正常:normal") + private String expertAccountStatus; + + @ApiModelProperty(value = "专家来源") + private List expertSource; +} From c2179604094cb47616522ed72d9ce12281546eb0 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 1 Mar 2023 18:21:46 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=89=AB=E8=A1=A8=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/GeneratorCodeKingbaseConfig.java | 2 +- .../statemachine/util/StateMachineUtils.java | 4 +- .../pmapi/common/util/SendWorkNoticeUtil.java | 43 ++++++---- .../PrequalificationDeclaredProjectManage.java | 3 +- .../pmapi/projectlib/handle/AnnualPlanHandle.java | 21 +++-- .../pmapi/projectlib/handle/ArchivedHandle.java | 8 +- .../projectlib/handle/ProjectApprovalHandle.java | 13 +-- .../handle/ProjectPreliminaryInspectionHandle.java | 10 +-- .../projectlib/handle/TenderPurchaseHandle.java | 15 +--- .../mapper/NdProjectStatusChangeMapper.java | 4 +- .../model/entity/NdProjectStatusChange.java | 95 ---------------------- .../model/entity/ProjectStatusChange.java | 48 +++++++++++ .../service/INdProjectStatusChangeService.java | 4 +- .../impl/NdProjectStatusChangeServiceImpl.java | 4 +- .../scheduler/task/ProjectStatusFlowTask.java | 2 +- .../pmapi/scheduler/task/WorkNoticeFlowTask.java | 87 ++++++++++++++++++++ .../pmapi/staging/enums/MsgTypeEnum.java | 51 ++++++++++++ .../staging/mapper/NdWorkNoticeStagingMapper.java | 21 +++++ .../staging/mapper/NdWorkNoticeStagingMapper.xml | 12 +++ .../staging/model/entity/WorkNoticeStaging.java | 71 ++++++++++++++++ .../staging/serivice/IProjectStagingService.java | 18 ---- .../serivice/impl/ProjectStagingServiceImpl.java | 77 ------------------ .../service/INdWorkNoticeStagingService.java | 23 ++++++ .../staging/service/IProjectStagingService.java | 18 ++++ .../impl/NdWorkNoticeStagingServiceImpl.java | 84 +++++++++++++++++++ .../service/impl/ProjectStagingServiceImpl.java | 77 ++++++++++++++++++ .../pmapi/staging/utils/WorkNoticeFlowMapUtil.java | 83 +++++++++++++++++++ .../todocenter/bean/entity/WorkNoticeInfo.java | 1 + .../pmapi/todocenter/manage/TodoCenterManage.java | 64 +++++++++------ .../pmapi/todocenter/TodoCenterTest.java | 17 +++- 30 files changed, 693 insertions(+), 287 deletions(-) delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/NdProjectStatusChange.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectStatusChange.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/model/entity/WorkNoticeStaging.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/IProjectStagingService.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/impl/ProjectStagingServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/service/IProjectStagingService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/ProjectStagingServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index e55478e..2398e98 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -56,7 +56,7 @@ public class GeneratorCodeKingbaseConfig { } public static void main(String[] args) { - generate("Liuxinxin", "expert", PATH_LXX, "expert_avoid_company"); + generate("Liuxinxin", "expert", PATH_LXX, "expert_avoid_company"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java index d34313e..38f1893 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java @@ -6,7 +6,7 @@ import com.ningdatech.pmapi.common.constant.StateMachineConstants; import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import lombok.RequiredArgsConstructor; @@ -44,7 +44,7 @@ public class StateMachineUtils { public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { log.info("调用状态机前的项目状态为>>>>>>>>>>{}" + project.getStatus()); // 将状态变更记录保存到项目状态变更表中 - NdProjectStatusChange projectStatusChange = new NdProjectStatusChange(); + ProjectStatusChange projectStatusChange = new ProjectStatusChange(); projectStatusChange.setBeforeStatus(project.getStatus()); //获取TO状态机 StateMachine stateMachine = projectDeclareStateMachineBuilder.build(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/SendWorkNoticeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/SendWorkNoticeUtil.java index 4fc0644..77b0b73 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/SendWorkNoticeUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/SendWorkNoticeUtil.java @@ -4,8 +4,11 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.GenericResult; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; import com.ningdatech.zwdd.client.ZwddClient; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import java.util.List; import java.util.concurrent.*; /** @@ -15,18 +18,22 @@ import java.util.concurrent.*; * @since 2023/02/23 13:50 */ @Slf4j +@RequiredArgsConstructor +@Component public class SendWorkNoticeUtil { - private SendWorkNoticeUtil(){ + private final ZwddClient zwddClient; - } + /** + * 初始化线程池 + */ + public static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 10, + 60, TimeUnit.SECONDS, new ArrayBlockingQueue(10), new ThreadPoolExecutor.AbortPolicy()); - public static void sendWorkNotice(ZwddClient zwddClient, WorkNoticeInfo workNoticeInfo, String msg){ - // 初始化线程池 - ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10, 20, - 60, TimeUnit.SECONDS, new ArrayBlockingQueue(20), new ThreadPoolExecutor.AbortPolicy()); + public Boolean sendWorkNotice(WorkNoticeInfo workNoticeInfo){ // 将发送工作通知交给异步任务Future + String msg = workNoticeInfo.getMsg(); CompletableFuture future = CompletableFuture.supplyAsync(() -> { // 调用浙政钉的接口发送工作通知 long startTime = System.currentTimeMillis(); @@ -41,17 +48,19 @@ public class SendWorkNoticeUtil { return "发送工作通知失败!"; } return "发送工作通知成功!"; - }, threadPool); - String s; - try { - s = future.get(); - } catch (Exception e) { - throw new BizException("获取异步线程处理结果失败!"); - } - threadPool.shutdown(); - while (threadPool.isTerminated()) { + }, threadPool); + String s; + try { + s = future.get(); + } catch (Exception e) { + throw new BizException("获取异步线程处理结果失败!"); + } + threadPool.shutdown(); + while (!threadPool.isTerminated()) { + log.info(s); + return Boolean.FALSE; + } log.info(s); - break; - } + return Boolean.TRUE; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index 4e1571d..b0e17c8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -8,7 +8,6 @@ import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq; @@ -21,7 +20,7 @@ import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.pmapi.projectlib.service.IProjectInstService; import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.staging.serivice.IProjectStagingService; +import com.ningdatech.pmapi.staging.service.IProjectStagingService; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.bean.entity.WflowModels; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java index f675d8a..899b12f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java @@ -6,8 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import com.ningdatech.pmapi.projectlib.service.IProjectService; @@ -71,26 +70,26 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { // 项目状态为年度计划中 if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)){ // 根据部门联审通过的时间获取 - NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) - .eq(NdProjectStatusChange::getProjectId, projectId) - .eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .eq(ProjectStatusChange::getProjectId, projectId) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) .last("limit 1")); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); } else if (ProjectStatusEnum.BE_SUSPENDED.getCode().equals(status)) { // 根据年度计划暂缓的时间获取 - NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) - .eq(NdProjectStatusChange::getProjectId, projectId) - .eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .eq(ProjectStatusChange::getProjectId, projectId) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) .last("limit 1")); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.REJECTED); } else { // 根据开启方案申报的时间获取 - NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) - .eq(NdProjectStatusChange::getProjectId, projectId) - .eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .eq(ProjectStatusChange::getProjectId, projectId) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) .last("limit 1")); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java index 4e74879..e0fdf39 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java @@ -11,7 +11,7 @@ import com.ningdatech.pmapi.common.constant.CommonConstant; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; @@ -48,9 +48,9 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle { // 项目阶段为已归档 processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); // 根据项目终验获取归档时间 - NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) - .eq(NdProjectStatusChange::getProjectId, projectId) - .eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS.name()) + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .eq(ProjectStatusChange::getProjectId, projectId) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS.name()) .last("limit 1")); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setProcessName(CommonConstant.ARCHIVED); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java index e9ab43b..5014c0e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java @@ -3,24 +3,19 @@ package com.ningdatech.pmapi.projectlib.handle; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.*; -import java.util.stream.Collectors; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.projectlib.model.entity.Project; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.constant.CommonConstant; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import com.ningdatech.pmapi.projectlib.service.IProjectService; @@ -86,9 +81,9 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { // 当前项目状态为待立项批复 if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)){ // 根据建设方案评审通过的时间获取 - NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) - .eq(NdProjectStatusChange::getProjectId, projectId) - .eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS.name()) + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .eq(ProjectStatusChange::getProjectId, projectId) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS.name()) .last("limit 1")); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java index 0b7754a..9cb5bb9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java @@ -4,7 +4,6 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; import java.util.Arrays; import java.util.List; -import java.util.Objects; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @@ -15,8 +14,7 @@ import com.ningdatech.pmapi.common.constant.CommonConstant; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; -import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; @@ -70,9 +68,9 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH }else { processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); // 根据初验备案的时间获取 - NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) - .eq(NdProjectStatusChange::getProjectId, projectId) - .eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD.name()) + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .eq(ProjectStatusChange::getProjectId, projectId) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD.name()) .last("limit 1")); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java index 0bf285a..7e9a8de 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java @@ -2,26 +2,19 @@ package com.ningdatech.pmapi.projectlib.handle; import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; -import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.*; -import java.util.stream.Collectors; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.constant.CommonConstant; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; -import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import com.ningdatech.pmapi.projectlib.service.IProjectService; @@ -74,9 +67,9 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { }else if (fieldList.contains(status)){ processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); // 根据采购备案的时间获取 - NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) - .eq(NdProjectStatusChange::getProjectId, projectId) - .eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD.name()) + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) + .eq(ProjectStatusChange::getProjectId, projectId) + .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD.name()) .last("limit 1")); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectStatusChangeMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectStatusChangeMapper.java index 58c74c0..5d608fa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectStatusChangeMapper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/NdProjectStatusChangeMapper.java @@ -1,6 +1,6 @@ package com.ningdatech.pmapi.projectlib.mapper; -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** @@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @author CMM * @since 2023-02-27 */ -public interface NdProjectStatusChangeMapper extends BaseMapper { +public interface NdProjectStatusChangeMapper extends BaseMapper { } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/NdProjectStatusChange.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/NdProjectStatusChange.java deleted file mode 100644 index 16540dc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/NdProjectStatusChange.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.ningdatech.pmapi.projectlib.model.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - *

- * - *

- * - * @author CMM - * @since 2023-02-27 - */ -@TableName("nd_project_status_change") -@ApiModel(value = "NdProjectStatusChange对象", description = "") -public class NdProjectStatusChange implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("主键") - private Long id; - - @ApiModelProperty("项目ID") - private Long projectId; - - @ApiModelProperty("状态机执行前的项目状态") - private Integer beforeStatus; - - @ApiModelProperty("状态机执行后的项目状态") - private Integer afterStatus; - - @ApiModelProperty("状态变更对应的事件") - private String event; - - @ApiModelProperty("状态变更发生的时间") - private LocalDateTime createOn; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - public Long getProjectId() { - return projectId; - } - - public void setProjectId(Long projectId) { - this.projectId = projectId; - } - public Integer getBeforeStatus() { - return beforeStatus; - } - - public void setBeforeStatus(Integer beforeStatus) { - this.beforeStatus = beforeStatus; - } - public Integer getAfterStatus() { - return afterStatus; - } - - public void setAfterStatus(Integer afterStatus) { - this.afterStatus = afterStatus; - } - public String getEvent() { - return event; - } - - public void setEvent(String event) { - this.event = event; - } - public LocalDateTime getCreateOn() { - return createOn; - } - - public void setCreateOn(LocalDateTime createOn) { - this.createOn = createOn; - } - - @Override - public String toString() { - return "NdProjectStatusChange{" + - "id=" + id + - ", projectId=" + projectId + - ", beforeStatus=" + beforeStatus + - ", afterStatus=" + afterStatus + - ", event=" + event + - ", createOn=" + createOn + - "}"; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectStatusChange.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectStatusChange.java new file mode 100644 index 0000000..afc4cd1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectStatusChange.java @@ -0,0 +1,48 @@ +package com.ningdatech.pmapi.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-02-27 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName("nd_project_status_change") +@ApiModel(value = "NdProjectStatusChange对象", description = "") +public class ProjectStatusChange implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("项目ID") + private Long projectId; + + @ApiModelProperty("状态机执行前的项目状态") + private Integer beforeStatus; + + @ApiModelProperty("状态机执行后的项目状态") + private Integer afterStatus; + + @ApiModelProperty("状态变更对应的事件") + private String event; + + @ApiModelProperty("状态变更发生的时间") + private LocalDateTime createOn; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java index 9732a41..ebe223f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/INdProjectStatusChangeService.java @@ -1,6 +1,6 @@ package com.ningdatech.pmapi.projectlib.service; -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.baomidou.mybatisplus.extension.service.IService; /** @@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.extension.service.IService; * @author CMM * @since 2023-02-27 */ -public interface INdProjectStatusChangeService extends IService { +public interface INdProjectStatusChangeService extends IService { } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java index dc699b5..f052b8c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java @@ -1,6 +1,6 @@ package com.ningdatech.pmapi.projectlib.service.impl; -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; import com.ningdatech.pmapi.projectlib.mapper.NdProjectStatusChangeMapper; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -15,6 +15,6 @@ import org.springframework.stereotype.Service; * @since 2023-02-27 */ @Service -public class NdProjectStatusChangeServiceImpl extends ServiceImpl implements INdProjectStatusChangeService { +public class NdProjectStatusChangeServiceImpl extends ServiceImpl implements INdProjectStatusChangeService { } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java index db7c711..2e99d41 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java @@ -8,7 +8,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.scheduler.contants.TaskContant; import com.ningdatech.pmapi.staging.contants.StagingContant; import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; -import com.ningdatech.pmapi.staging.serivice.IProjectStagingService; +import com.ningdatech.pmapi.staging.service.IProjectStagingService; import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java new file mode 100644 index 0000000..c64977a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java @@ -0,0 +1,87 @@ +package com.ningdatech.pmapi.scheduler.task; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; + +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; +import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; +import com.ningdatech.pmapi.staging.utils.WorkNoticeFlowMapUtil; +import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; +import com.ningdatech.zwdd.client.ZwddClient; +import org.springframework.beans.BeanUtils; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.scheduler.contants.TaskContant; +import com.ningdatech.pmapi.staging.contants.StagingContant; +import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; +import com.ningdatech.pmapi.staging.service.IProjectStagingService; +import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 发送工作通知定时任务 + * @return + * @author CMM + * @since 2023/02/28 21:23 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class WorkNoticeFlowTask { + + private final INdWorkNoticeStagingService workNoticeStagingService; + private final ZwddClient zwddClient; + + @Scheduled(cron = "0 */1 * * * ?") + public void statusFlow() throws UnknownHostException { + //测试暂时用自己电脑HOST + if (TaskContant.Host.HOST_CMM.equals(InetAddress.getLocalHost().getHostName())) { + //1. 定时取 工作通知暂存表的数据进行发送 + List stagingList = workNoticeStagingService.list(Wrappers.lambdaQuery(WorkNoticeStaging.class) + .eq(WorkNoticeStaging::getDead, Boolean.FALSE) + .ge(WorkNoticeStaging::getNextTime, LocalDateTime.now()) + .le(WorkNoticeStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) + .orderByAsc(WorkNoticeStaging::getId)); + + log.info("需要发送的工作通知 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); + if(CollUtil.isEmpty(stagingList)){ + log.info("没有需要发送的工作通知!"); + return; + } + //遍历 + for(WorkNoticeStaging workNoticeStaging : stagingList){ + try{ + WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); + BeanUtils.copyProperties(workNoticeStaging,workNoticeInfo); + String receiverUserId = workNoticeInfo.getReceiverUserId(); + String bizMsgId = workNoticeInfo.getBizMsgId(); + String msg = workNoticeInfo.getMsg(); + GenericResult result = zwddClient.sendWorkNotice(receiverUserId, bizMsgId, msg); + if (result.isSuccess()){ + //执行成功了 删除暂存的数据 + workNoticeStagingService.removeById(workNoticeStaging); + } + }catch (Exception e){ + log.error("发送工作通知 异常 bizMsgId:【" + workNoticeStaging.getBizMsgId() + "】 异常内容:" + e); + }finally { + //增加重试的次数 和下次扫描时间 + workNoticeStagingService.addRetryTimes(workNoticeStaging); + } + } + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java new file mode 100644 index 0000000..67dab2e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java @@ -0,0 +1,51 @@ +package com.ningdatech.pmapi.staging.enums; + +import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 消息类型枚举 + * @author CMM + * @since 2023/02/28 17:34 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum MsgTypeEnum { + /** + * 消息类型 + */ + AUDIT(1, "项目审核(待审核)"), + PASS(2, "项目审核(通过)"), + REJECTED(3,"项目审核(被驳回)"), + BACKED(4,"项目审核(被退回)"), + WARING(5,"预警提醒"), + EXPORT_REVIEW(6,"专家评审"), + REVIEW_MEETING(7,"评审会议"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (MsgTypeEnum t : MsgTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.java new file mode 100644 index 0000000..9892c4d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.staging.mapper; + +import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-02-28 + */ +public interface NdWorkNoticeStagingMapper extends BaseMapper { + + Boolean addRetryTimes(@Param("id") Long id, @Param("retryTimes") Integer retryTimes, + @Param("nextRetryTime") LocalDateTime nextRetryTime, @Param("dead") Boolean dead); +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml new file mode 100644 index 0000000..cf684ba --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/mapper/NdWorkNoticeStagingMapper.xml @@ -0,0 +1,12 @@ + + + + + + update nd_work_notice_staging + set retry_times = #{retryTimes}, + next_time = #{nextRetryTime}, + dead = #{dead} + where id = #{id} and retry_times = #{retryTimes - 1} + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/model/entity/WorkNoticeStaging.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/model/entity/WorkNoticeStaging.java new file mode 100644 index 0000000..a5a2231 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/model/entity/WorkNoticeStaging.java @@ -0,0 +1,71 @@ +package com.ningdatech.pmapi.staging.model.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-02-28 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName("nd_work_notice_staging") +@ApiModel(value = "NdWorkNoticeStaging对象", description = "") +public class WorkNoticeStaging implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("浙政钉用户ID") + private Long accountId; + + @ApiModelProperty("部门编号") + private String organizationCode; + + @ApiModelProperty("部门名称") + private String organizationName; + + @ApiModelProperty("工作通知唯一标识") + private String bizMsgId; + + @ApiModelProperty("接收人浙政钉ID") + private String receiverUserId; + + @ApiModelProperty("工作通知内容") + private String msg; + + @ApiModelProperty("重试次数 最大10次") + private Integer retryTimes; + + @ApiModelProperty("false 可继续扫描 true 死信") + private Boolean dead; + + @ApiModelProperty("下次扫描时间") + private LocalDateTime nextTime; + + @ApiModelProperty("消息类型") + private MsgTypeEnum msgType; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/IProjectStagingService.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/IProjectStagingService.java deleted file mode 100644 index 5481a4a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/IProjectStagingService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ningdatech.pmapi.staging.serivice; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; - -/** - * @Classname IProjectStagingService - * @Description - * @Date 2023/2/20 10:08 - * @Author PoffyZhang - */ -public interface IProjectStagingService extends IService { - - Boolean addRetryTimes(ProjectStaging projectStaging); - - public Boolean addByProject(Project project,String remark) ; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/impl/ProjectStagingServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/impl/ProjectStagingServiceImpl.java deleted file mode 100644 index cb131a7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/impl/ProjectStagingServiceImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ningdatech.pmapi.staging.serivice.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.staging.contants.StagingContant; -import com.ningdatech.pmapi.staging.mapper.ProjectStagingMapper; -import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; -import com.ningdatech.pmapi.staging.serivice.IProjectStagingService; -import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; - -/** - *

- * 服务实现类 - *

- * - * @author zpf - * @since 2023-02-18 - */ -@Service -@Slf4j -@RequiredArgsConstructor -public class ProjectStagingServiceImpl extends ServiceImpl implements IProjectStagingService { - - private final ProjectStagingMapper mapper; - - private final ProjectStatusFlowMapUtil projectStatusFlowMapUtil; - - /** - * 在某些状态节点 增加一个项目到状态暂存库 - * @param project - * @return - */ - @Override - public Boolean addByProject(Project project,String remark) { - ProjectStaging projectStaging = ProjectStaging.builder() - .projectId(project.getId()) - .projectName(project.getProjectName()) - .stage(project.getStage()) - .status(project.getStatus()) - .createOn(LocalDateTime.now()) - .updateOn(LocalDateTime.now()) - .instCode(project.getInstCode()) - .processStatus(project.getProcessStatus()) - .nextTime(LocalDateTime.now()) - .retryTimes(0) - .remark(remark) - .build(); - return this.save(projectStaging); - } - - /** - * 增加 重试次数 和下次扫描时间 - * @param projectStaging - * @return - */ - @Override - public Boolean addRetryTimes(ProjectStaging projectStaging) { - Integer retryTimes = projectStaging.getRetryTimes() + 1; - if(!projectStatusFlowMapUtil.intervalTimeMap.containsKey(retryTimes)){ - log.info("没有对应重试间隔时间 添加重试信息失败"); - return Boolean.FALSE; - } - Integer addSeconds = projectStatusFlowMapUtil.intervalTimeMap.get(retryTimes); - Boolean dead = Boolean.FALSE; - //超过重试最大次数 dead置为 true - if(retryTimes.compareTo(StagingContant.Retry.MAX_RETRY_TIMES) > 0){ - dead = Boolean.TRUE; - } - LocalDateTime nextRetryTime = LocalDateTime.now().plusSeconds(addSeconds); - return mapper.addRetryTimes(projectStaging.getId(),retryTimes,nextRetryTime,dead); - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java new file mode 100644 index 0000000..262745d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/INdWorkNoticeStagingService.java @@ -0,0 +1,23 @@ +package com.ningdatech.pmapi.staging.service; + +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; +import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; +import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-02-28 + */ +public interface INdWorkNoticeStagingService extends IService { + + Boolean addRetryTimes(WorkNoticeStaging workNoticeStaging); + + public Boolean addByWorkNotice(WorkNoticeInfo workNoticeInfo, MsgTypeEnum msgType) ; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/IProjectStagingService.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/IProjectStagingService.java new file mode 100644 index 0000000..1d3e2a9 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/IProjectStagingService.java @@ -0,0 +1,18 @@ +package com.ningdatech.pmapi.staging.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; + +/** + * @Classname IProjectStagingService + * @Description + * @Date 2023/2/20 10:08 + * @Author PoffyZhang + */ +public interface IProjectStagingService extends IService { + + Boolean addRetryTimes(ProjectStaging projectStaging); + + public Boolean addByProject(Project project,String remark) ; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java new file mode 100644 index 0000000..360a740 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java @@ -0,0 +1,84 @@ +package com.ningdatech.pmapi.staging.service.impl; + +import com.ningdatech.pmapi.staging.contants.StagingContant; +import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; +import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; +import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; +import com.ningdatech.pmapi.staging.mapper.NdWorkNoticeStagingMapper; +import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.staging.utils.WorkNoticeFlowMapUtil; +import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-02-28 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class NdWorkNoticeStagingServiceImpl extends ServiceImpl implements INdWorkNoticeStagingService { + + private final NdWorkNoticeStagingMapper mapper; + + private final WorkNoticeFlowMapUtil workNoticeFlowMapUtil; + + /** + * 增加 重试次数 和下次扫描时间 + * @param workNoticeStaging + * @return java.lang.Boolean + * @author CMM + * @since 2023/02/28 18:02 + */ + @Override + public Boolean addRetryTimes(WorkNoticeStaging workNoticeStaging) { + Integer retryTimes = workNoticeStaging.getRetryTimes() + 1; + if(!workNoticeFlowMapUtil.intervalTimeMap.containsKey(retryTimes)){ + log.info("没有对应重试间隔时间 添加重试信息失败"); + return Boolean.FALSE; + } + Integer addSeconds = workNoticeFlowMapUtil.intervalTimeMap.get(retryTimes); + Boolean dead = Boolean.FALSE; + //超过重试最大次数 dead置为 true + if(retryTimes.compareTo(StagingContant.Retry.MAX_RETRY_TIMES) > 0){ + dead = Boolean.TRUE; + } + LocalDateTime nextRetryTime = LocalDateTime.now().plusSeconds(addSeconds); + return mapper.addRetryTimes(workNoticeStaging.getId(),retryTimes,nextRetryTime,dead); + } + + /** + * 在对应的流程处理后,增加一个工作通知到暂存表中 + * @param workNoticeInfo + * @param msgType + * @return java.lang.Boolean + * @author CMM + * @since 2023/02/28 20:02 + */ + @Override + public Boolean addByWorkNotice(WorkNoticeInfo workNoticeInfo, MsgTypeEnum msgType) { + WorkNoticeStaging workNoticeStaging = WorkNoticeStaging.builder() + .accountId(workNoticeInfo.getAccountId()) + .msg(workNoticeInfo.getMsg()) + .bizMsgId(workNoticeInfo.getBizMsgId()) + .organizationCode(workNoticeInfo.getOrganizationCode()) + .organizationName(workNoticeInfo.getOrganizationName()) + .receiverUserId(workNoticeInfo.getReceiverUserId()) + .msgType(msgType) + .createOn(LocalDateTime.now()) + .updateOn(LocalDateTime.now()) + .nextTime(LocalDateTime.now()) + .retryTimes(0) + .build(); + return this.save(workNoticeStaging); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/ProjectStagingServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/ProjectStagingServiceImpl.java new file mode 100644 index 0000000..ce40bc1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/ProjectStagingServiceImpl.java @@ -0,0 +1,77 @@ +package com.ningdatech.pmapi.staging.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.staging.contants.StagingContant; +import com.ningdatech.pmapi.staging.mapper.ProjectStagingMapper; +import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; +import com.ningdatech.pmapi.staging.service.IProjectStagingService; +import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-02-18 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class ProjectStagingServiceImpl extends ServiceImpl implements IProjectStagingService { + + private final ProjectStagingMapper mapper; + + private final ProjectStatusFlowMapUtil projectStatusFlowMapUtil; + + /** + * 在某些状态节点 增加一个项目到状态暂存库 + * @param project + * @return + */ + @Override + public Boolean addByProject(Project project,String remark) { + ProjectStaging projectStaging = ProjectStaging.builder() + .projectId(project.getId()) + .projectName(project.getProjectName()) + .stage(project.getStage()) + .status(project.getStatus()) + .createOn(LocalDateTime.now()) + .updateOn(LocalDateTime.now()) + .instCode(project.getInstCode()) + .processStatus(project.getProcessStatus()) + .nextTime(LocalDateTime.now()) + .retryTimes(0) + .remark(remark) + .build(); + return this.save(projectStaging); + } + + /** + * 增加 重试次数 和下次扫描时间 + * @param projectStaging + * @return + */ + @Override + public Boolean addRetryTimes(ProjectStaging projectStaging) { + Integer retryTimes = projectStaging.getRetryTimes() + 1; + if(!projectStatusFlowMapUtil.intervalTimeMap.containsKey(retryTimes)){ + log.info("没有对应重试间隔时间 添加重试信息失败"); + return Boolean.FALSE; + } + Integer addSeconds = projectStatusFlowMapUtil.intervalTimeMap.get(retryTimes); + Boolean dead = Boolean.FALSE; + //超过重试最大次数 dead置为 true + if(retryTimes.compareTo(StagingContant.Retry.MAX_RETRY_TIMES) > 0){ + dead = Boolean.TRUE; + } + LocalDateTime nextRetryTime = LocalDateTime.now().plusSeconds(addSeconds); + return mapper.addRetryTimes(projectStaging.getId(),retryTimes,nextRetryTime,dead); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java new file mode 100644 index 0000000..67b6327 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java @@ -0,0 +1,83 @@ +package com.ningdatech.pmapi.staging.utils; + +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import javax.annotation.PostConstruct; + +import com.ningdatech.pmapi.common.util.SendWorkNoticeUtil; +import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; +import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; +import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; +import org.springframework.stereotype.Component; + +import com.google.common.collect.Maps; +import com.ningdatech.pmapi.projectdeclared.manage.ReviewByDeptJointManage; +import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; + +import lombok.RequiredArgsConstructor; + +/** + * 工作通知流转 事件函数MAP + * @return + * @author CMM + * @since 2023/02/28 17:03 + */ +@Component +@RequiredArgsConstructor +public class WorkNoticeFlowMapUtil { + //public Map> workNoticeFlowFunctionMap = Maps.newHashMap(); + /** + * key 重试的次数 , value 是增加是描述 + */ + public Map intervalTimeMap = Maps.newHashMap(); + + ///** + // * 初始化工作通知分派逻辑,代替了if-else部分 + // * key: 枚举 消息类型 + // * value: lambda表达式,最终会获取发送工作通知的函数 + // */ + //@PostConstruct + //public void workNoticeFlowFunctionInit(){ + // // 待审核 + // workNoticeFlowFunctionMap.put(MsgTypeEnum.AUDIT.getCode(), + // workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos)); + // + // // 审核通过 + // workNoticeFlowFunctionMap.put(MsgTypeEnum.PASS.getCode(), + // workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos)); + // + // // 被驳回 + // workNoticeFlowFunctionMap.put(MsgTypeEnum.REJECTED.getCode(), + // workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos)); + // + // // 被退回 + // workNoticeFlowFunctionMap.put(MsgTypeEnum.BACKED.getCode(), + // workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos)); + // + // // 被驳回 + // workNoticeFlowFunctionMap.put(MsgTypeEnum.REJECTED.getCode(), + // workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos)); + // + //} + + /** + * 扫描的间隔越来越长 秒数 + */ + @PostConstruct + public void intervalTimeMapInit(){ + intervalTimeMap.put(1,60 * 2); + intervalTimeMap.put(2,60 * 6); + intervalTimeMap.put(3,60 * 15); + intervalTimeMap.put(4,60 * 30); + intervalTimeMap.put(5,60 * 60); + intervalTimeMap.put(6,60 * 60 * 2); + intervalTimeMap.put(7,60 * 60 * 5); + intervalTimeMap.put(8,60 * 60 * 12); + intervalTimeMap.put(9,60 * 60 * 24); + intervalTimeMap.put(10,60 * 60 * 72); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/WorkNoticeInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/WorkNoticeInfo.java index af2498e..761e051 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/WorkNoticeInfo.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/WorkNoticeInfo.java @@ -14,6 +14,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor public class WorkNoticeInfo { + private String msg; private Long accountId; private String organizationCode; private String organizationName; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 787bf18..8de2098 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -10,10 +10,12 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.util.ExcelDownUtil; +import com.ningdatech.pmapi.common.util.SendWorkNoticeUtil; import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; @@ -24,6 +26,8 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; +import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum; @@ -33,6 +37,7 @@ import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq; import com.ningdatech.pmapi.todocenter.model.dto.vo.ResToBeProcessedVO; import com.ningdatech.pmapi.user.entity.UserInfo; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.ningdatech.zwdd.client.ZwddClient; @@ -87,6 +92,8 @@ public class TodoCenterManage { private final IDingEmployeeInfoService dingEmployeeInfoService; private final IDingOrganizationService dingOrganizationService; private final ProcessInstanceService processInstanceService; + private final ZwddClient zwddClient; + private final INdWorkNoticeStagingService workNoticeStagingService; /** @@ -261,46 +268,46 @@ public class TodoCenterManage { // 获取发送浙政钉工作通知必要信息 WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), projectName); - // 异步发送工作通知 - // SendWorkNoticeUtil.sendWorkNotice(zwddClient,passWorkNoticeInfo,passMsg); + passWorkNoticeInfo.setMsg(passMsg); + // 放入工作通知暂存表中,通过扫表异步发送 + workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.AUDIT); return; } // 若不是被退回状态,流程通过后,判断当前登录用户是不是最后一个审核人 - - // TODO 若当前流程是预审流程,需要在提交预审申报的时候,调用状态机判断申报后的项目状态, - // 若是省级部门联审中,要对接外部接口,获取省级部门联审的结果,更新项目状态(预审申报提交的时候处理) - // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { switch (Objects.requireNonNull(ProjectStatusEnum.getValue(projectStatus))) { // 当前项目状态是单位内部审核中 case UNDER_INTERNAL_AUDIT: - // 当前项目状态是预审中 + // 当前项目状态是预审中 case PRE_APPLYING: - // 当前项目状态是部门联审中 + // 当前项目状态是部门联审中 case DEPARTMENT_JOINT_REVIEW: - // 当前项目状态是方案评审中 + // 当前项目状态是方案评审中 case SCHEME_UNDER_REVIEW: - // 当前项目状态是终验审核中 + // 当前项目状态是终验审核中 case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: updatePassProjectStatus(userId, declaredProject); break; default: throw new IllegalStateException("Unexpected value: " + projectStatus); } -// WorkNoticeInfo passWorkNoticeInfo2 = getSendWorkNoticeInfo(startUserInfo); -// String passMsg2 = String.format(PASS_MSG_TEMPLATE2, projectName, processDefinitionName); - // 异步发送工作通知 - // SendWorkNoticeUtil.sendWorkNotice(zwddClient,passWorkNoticeInfo2,passMsg2); + // 获取发送浙政钉工作通知必要信息 + WorkNoticeInfo passWorkNoticeInfo2 = getSendWorkNoticeInfo(startUserInfo); + String passMsg2 = String.format(PASS_MSG_TEMPLATE2, projectName, processDefinitionName); + passWorkNoticeInfo2.setMsg(passMsg2); + // 放入工作通知暂存表中,通过扫表异步发送 + workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo2, MsgTypeEnum.PASS); }else { // 若有下一个审核人(当前节点的用户), // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 // 获取发送浙政钉工作通知必要信息 -// WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); -// String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); - // 异步发送工作通知 -// SendWorkNoticeUtil.sendWorkNotice(zwddClient,sendWorkNoticeInfo,msg); + WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); + String msg = String.format(PASS_MSG_TEMPLATE, sendWorkNoticeInfo.getOrganizationName(), projectName); + sendWorkNoticeInfo.setMsg(msg); + // 放入工作通知暂存表中,通过扫表异步发送 + workNoticeStagingService.addByWorkNotice(sendWorkNoticeInfo, MsgTypeEnum.AUDIT); } break; // 盖章并通过 @@ -314,12 +321,14 @@ public class TodoCenterManage { // 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知: // 【项目名称】的【流程名称】被驳回,请及时处理。 processTaskService.handleTask(param, userId); - WorkNoticeInfo rejectWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); - String rejectMsg = String.format(REJECT_MSG_TEMPLATE, projectName, processDefinitionName); - // 异步发送工作通知 - // SendWorkNoticeUtil.sendWorkNotice(zwddClient,rejectWorkNoticeInfo,rejectMsg); // 更新项目状态和流程状态 updateRejectProjectStatus(userId, declaredProject); + // 获取发送浙政钉工作通知必要信息 + WorkNoticeInfo rejectWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); + String rejectMsg = String.format(REJECT_MSG_TEMPLATE, projectName, processDefinitionName); + rejectWorkNoticeInfo.setMsg(rejectMsg); + // 放入工作通知暂存表中,通过扫表异步发送 + workNoticeStagingService.addByWorkNotice(rejectWorkNoticeInfo, MsgTypeEnum.REJECTED); break; // 退回 case BACK: @@ -331,10 +340,12 @@ public class TodoCenterManage { declaredProject.setUpdateBy(userId); projectService.updateById(declaredProject); // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 + // 获取发送浙政钉工作通知必要信息 WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); String backMsg = String.format(BACK_MSG_TEMPLATE, projectName, processDefinitionName); - // 异步发送工作通知 - // SendWorkNoticeUtil.sendWorkNotice(zwddClient,backWorkNoticeInfo,backMsg); + backWorkNoticeInfo.setMsg(backMsg); + // 放入工作通知暂存表中,通过扫表异步发送 + workNoticeStagingService.addByWorkNotice(backWorkNoticeInfo, MsgTypeEnum.BACKED); break; // 撤回(流程发起人和当前流程审核人的前一个审核人操作) case WITHDRAW: @@ -369,9 +380,12 @@ public class TodoCenterManage { ProcessInstanceUserDto currentUser = currentProgressNode.getUser(); // 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 boolean orgFlag = currentUser.getOrgCode().equals(beforeUser.getOrgCode()); + boolean userFlag = beforeUser.getUserId().equals(String.valueOf( userId)); if (!orgFlag) { throw new BizException("下一个审核人和您不是同一个部门,无法撤回!"); - } else { + } else if (!userFlag){ + throw new BizException("当前登录用户无法进行撤回操作!"); + } else{ processTaskService.handleTask(param, userId); } } diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java index e6f893a..a61cf58 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java @@ -4,6 +4,8 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.GenericResult; import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.beanconfig.BeanConfig; +import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; +import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; import com.ningdatech.pmapi.user.entity.UserInfo; @@ -37,12 +39,12 @@ public class TodoCenterTest extends AppTests { @Autowired private TodoCenterManage todoCenterManage; - @Autowired private IUserInfoService userInfoService; - @Autowired private ZwddClient zwddClient; + @Autowired + private INdWorkNoticeStagingService workNoticeStagingService; @Test public void sendWorkNoticeTest() throws ExecutionException, InterruptedException { //String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-00-测试项目"); @@ -93,4 +95,15 @@ public class TodoCenterTest extends AppTests { break; } } + + @Test + public void sendWorkNoticeTest2(){ + UserInfo userInfo = userInfoService.getById(4L); + // 获取发送浙政钉工作通知必要信息 + WorkNoticeInfo passWorkNoticeInfo = todoCenterManage.getSendWorkNoticeInfo(userInfo); + String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), "测试项目0301-1"); + passWorkNoticeInfo.setMsg(passMsg); + // 放入工作通知暂存表中,通过扫表异步发送 + workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.AUDIT); + } } From 2bb19b8192e4e1e832c48b9f2dfa26ed6708f36c Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 1 Mar 2023 18:26:52 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=89=AB=E8=A1=A8=E5=8F=91=E9=80=81,=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java | 4 ---- .../ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java | 8 -------- .../projectlib/handle/ProjectPreliminaryInspectionHandle.java | 4 ---- .../ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java | 4 ---- 4 files changed, 20 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java index 7994cf3..8253a97 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java @@ -6,11 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; -<<<<<<< HEAD import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -======= -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; ->>>>>>> 3fc1952d747d914fc53e00cda93621feed6be50f import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import com.ningdatech.pmapi.projectlib.service.IProjectService; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java index e05e5a5..d634354 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java @@ -10,20 +10,12 @@ import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -<<<<<<< HEAD -import com.ningdatech.pmapi.common.constant.CommonConstant; -======= import com.ningdatech.pmapi.common.constant.CommonConst; ->>>>>>> 3fc1952d747d914fc53e00cda93621feed6be50f import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; -<<<<<<< HEAD import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -======= -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; ->>>>>>> 3fc1952d747d914fc53e00cda93621feed6be50f import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; import com.ningdatech.pmapi.projectlib.service.IProjectService; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java index 943f876..9d1e8a1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java @@ -14,11 +14,7 @@ import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; -<<<<<<< HEAD import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -======= -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; ->>>>>>> 3fc1952d747d914fc53e00cda93621feed6be50f import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java index b73af77..e5dbb08 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java @@ -13,11 +13,7 @@ import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; -<<<<<<< HEAD import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; -======= -import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; ->>>>>>> 3fc1952d747d914fc53e00cda93621feed6be50f import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; From fc45bb3c357424a7c89ecf5d6a44de5b15f0b0dd Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 1 Mar 2023 18:42:29 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=89=AB=E8=A1=A8=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java index c64977a..20e3c0f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/WorkNoticeFlowTask.java @@ -53,7 +53,7 @@ public class WorkNoticeFlowTask { //1. 定时取 工作通知暂存表的数据进行发送 List stagingList = workNoticeStagingService.list(Wrappers.lambdaQuery(WorkNoticeStaging.class) .eq(WorkNoticeStaging::getDead, Boolean.FALSE) - .ge(WorkNoticeStaging::getNextTime, LocalDateTime.now()) + .le(WorkNoticeStaging::getNextTime, LocalDateTime.now()) .le(WorkNoticeStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) .orderByAsc(WorkNoticeStaging::getId)); From 36814d23c277bf79bebcabe9a664f4f3d9880e3e Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Thu, 2 Mar 2023 10:47:58 +0800 Subject: [PATCH 09/14] generator Fix --- .../ningdatech/generator/config/GeneratorCodeKingbaseConfig.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index c0705f6..287e667 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -56,11 +56,7 @@ public class GeneratorCodeKingbaseConfig { } public static void main(String[] args) { -<<<<<<< HEAD - generate("Liuxinxin", "expert", PATH_LXX, "expert_avoid_company"); -======= - generate("Liuxinxin", "expert", PATH_LXX, "expert_meta_apply"); ->>>>>>> 3fc1952d747d914fc53e00cda93621feed6be50f + generate("Liuxinxin", "expert", PATH_LXX, "expert_avoid_company"); } } From d678a1f7064e0781cdd9e23b29bc60e087aa6afd Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Thu, 2 Mar 2023 11:43:59 +0800 Subject: [PATCH 10/14] =?UTF-8?q?fix=20=E5=8D=95=E4=BD=8D=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=A0=91=E5=BD=A2=E7=BB=93=E6=9E=84=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/expert/manage/ExpertMetaApplyManage.java | 22 +++++--- .../pmapi/meta/helper/ExpertUserInfoHelper.java | 16 ++++++ .../meta/helper/ExpertUserInfoHelperImpl.java | 63 ++++++++++++++++++++++ pmapi/src/main/resources/application-dev.yml | 2 +- 4 files changed, 94 insertions(+), 9 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelperImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java index 2348321..81ccb68 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java @@ -10,6 +10,7 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.common.helper.RegionLimitHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.util.BizUtils; @@ -35,11 +36,13 @@ import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; import com.ningdatech.pmapi.meta.helper.DictionaryCache; +import com.ningdatech.pmapi.meta.helper.ExpertUserInfoHelper; import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO; import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; @@ -66,6 +69,7 @@ public class ExpertMetaApplyManage { private final IExpertDictionaryService expertDictionaryService; // private final IExpertAdminManageService ExpertAdminManageService; + private final RegionCacheHelper regionCacheHelper; private final IExpertUserFullInfoService userFullInfoService; private final DictionaryCache dictionaryCache; @@ -75,6 +79,8 @@ public class ExpertMetaApplyManage { private final RegionLimitHelper regionLimitHelper; + private final ExpertUserInfoHelper expertUserInfoHelper; + public PageVo metaApplyListQuery(MetaApplyListQuery req) { Long expertAdminUserId = LoginUserUtil.getUserId(); @@ -130,17 +136,17 @@ public class ExpertMetaApplyManage { // 专家入库时,需要先审核专家入库,入库成功后,再履职意向审核,如果履职意向跟专家层级是同一层级的,就直接同意不需要审核 if (applyResult) { Long expertUserId = expertMetaApply.getUserId(); -// ExpertRegionInfo expertRegionInfo = expertUserInfoHelper.getExpertRegionInfo(expertUserId); -// Integer regionLevel = expertRegionInfo.getRegionLevel(); -// String regionCode = expertRegionInfo.getRegionCode(); + ExpertRegionInfo expertRegionInfo = expertUserInfoHelper.getExpertRegionInfo(expertUserId); + Integer regionLevel = expertRegionInfo.getRegionLevel(); + String regionCode = expertRegionInfo.getRegionCode(); List expertJoinApplyList = iMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) .eq(ExpertMetaApply::getUserId, expertUserId) .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()) - .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name())); -// .eq(ExpertMetaApply::getRegionLevel, regionLevel) -// .eq(ExpertMetaApply::getRegionCode, regionCode)); + .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name()) + .eq(ExpertMetaApply::getRegionLevel, regionLevel) + .eq(ExpertMetaApply::getRegionCode, regionCode)); BizUtils.notEmpty(expertJoinApplyList, list -> list.forEach(r -> { MetaApplyResultRequest resultRequest = new MetaApplyResultRequest(); resultRequest.setApplyId(r.getId()); @@ -425,11 +431,11 @@ public class ExpertMetaApplyManage { } expertApplyMetaVO.setName(expertUserFullInfo.getExpertName()); -// RegionDTO regionDTO = regionCache.getByCodeAndLevel(expertUserFullInfo.getRegionCode(), expertUserFullInfo.getRegionLevel()); + RegionDTO regionDTO = regionCacheHelper.getByCodeAndLevel(expertUserFullInfo.getRegionCode(), expertUserFullInfo.getRegionLevel()); ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); expertRegionInfo.setRegionCode(expertUserFullInfo.getRegionCode()); expertRegionInfo.setRegionLevel(expertUserFullInfo.getRegionLevel()); -// expertRegionInfo.setRegionName(regionDTO.getRegionName()); + expertRegionInfo.setRegionName(regionDTO.getRegionName()); expertApplyMetaVO.setExpertRegionInfo(expertRegionInfo); List expertDictionaryList = expertDictionaryListMap.get(userId); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelper.java new file mode 100644 index 0000000..75d0798 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.meta.helper; + +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; + +/** + * @author liuxinxin + * @date 2023/3/2 上午11:02 + */ + +public interface ExpertUserInfoHelper { + + ExpertUserFullInfo getExpertBasicFullInfo(Long expertUserId); + + ExpertRegionInfo getExpertRegionInfo(Long expertUserId); +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelperImpl.java new file mode 100644 index 0000000..63e2497 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/ExpertUserInfoHelperImpl.java @@ -0,0 +1,63 @@ +package com.ningdatech.pmapi.meta.helper; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * @author liuxinxin + * @date 2022/8/30 下午2:17 + * 公共专家相关信息工具类 用于获取专家的一些基础信息 + */ +@Component +@RequiredArgsConstructor +public class ExpertUserInfoHelperImpl implements ExpertUserInfoHelper { + + private final IExpertUserFullInfoService iExpertUserFullInfoService; + + /** + * 获取专家 + * + * @param expertUserId + * @return + */ + @Override + public ExpertUserFullInfo getExpertBasicFullInfo(Long expertUserId) { + ExpertUserFullInfo one = iExpertUserFullInfoService + .getOne(Wrappers.lambdaQuery(ExpertUserFullInfo.class).eq(ExpertUserFullInfo::getUserId, expertUserId)); + return one; + } + + /** + * 获取专家层级 + * + * @param expertUserId + * @return + */ + @Override + public ExpertRegionInfo getExpertRegionInfo(Long expertUserId) { + ExpertUserFullInfo one = getExpertBasicFullInfo(expertUserId); + + Integer regionLevel = one.getRegionLevel(); + String regionCode = one.getRegionCode(); + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionCode(regionCode); + expertRegionInfo.setRegionLevel(regionLevel); + return expertRegionInfo; + } + +// /** +// * 专家是否已经出库 +// */ +// public Boolean isDelivery(Long expertUserId) { +// ExpertUserFullInfo one = getExpertBasicFullInfo(expertUserId); +// if (Objects.isNull(one)) { +// return true; +// } +// return ExpertAccountStatusEnum.DELIVERY.getKey().equals(one.getExpertAccountStatus()); +// } + +} diff --git a/pmapi/src/main/resources/application-dev.yml b/pmapi/src/main/resources/application-dev.yml index f2e6e8c..f16ff34 100644 --- a/pmapi/src/main/resources/application-dev.yml +++ b/pmapi/src/main/resources/application-dev.yml @@ -173,7 +173,7 @@ sa-token: #浙政钉公司顶级organizationCode organization: dept-visible-scopes: - - 430857a6-fa0b-49f6-89f8-5437b0e2d234 + - GO_ff70e47bae684fdba0d64f4acab85661 yxt: wsdl-url: http://115.239.137.23:9501/ws/v1?wsdl From 08b0d2e640fa6f062515ea14c99ae1eb12a03888 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 2 Mar 2023 16:08:52 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/constant/RegionConst.java | 43 +++++ .../pmapi/common/constant/RegionLevelConst.java | 19 -- .../pmapi/common/helper/RegionCacheHelper.java | 82 +++------ .../common/helper/basic/AbstractRegionCache.java | 138 -------------- .../helper/basic/AbstractRegionCacheHelper.java | 69 +++++++ .../helper/basic/AbstractRegionLimitHelper.java | 2 +- .../common/helper/impl/RegionLimitHelperImpl.java | 16 +- .../common/helper/impl/RegionsCacheHelperImpl.java | 167 +++++++++++++++++ .../pmapi/common/helper/impl/RegionsCacheImpl.java | 205 --------------------- .../pmapi/meeting/manage/MeetingManage.java | 13 +- .../pmapi/scheduler/task/InitProcessTask.java | 4 +- .../ningdatech/pmapi/sys/contant/RegionConst.java | 26 --- .../pmapi/sys/controller/RegionController.java | 8 +- .../pmapi/sys/convert/RegionConverter.java | 30 +-- .../ningdatech/pmapi/sys/manage/RegionManage.java | 15 +- .../ningdatech/pmapi/sys/model/dto/RegionDTO.java | 2 + .../ningdatech/pmapi/sys/model/entity/Region.java | 2 + .../pmapi/sys/service/IRegionService.java | 9 + .../pmapi/sys/service/impl/RegionServiceImpl.java | 11 +- .../pmapi/sys/service/IRegionServiceTest.java | 58 ++++++ 20 files changed, 430 insertions(+), 489 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionLevelConst.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCache.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCacheHelper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheImpl.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/sys/contant/RegionConst.java create mode 100644 pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java new file mode 100644 index 0000000..014a1d9 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java @@ -0,0 +1,43 @@ +package com.ningdatech.pmapi.common.constant; + +/** + *

+ * RegionConst + *

+ * + * @author WendyYang + * @since 13:57 2023/3/1 + */ +public interface RegionConst { + + //---------------------------------------地区层级(缩写RL)------------------------------------------------------------- + + int RL_PROVINCE = 1; + + int RL_CITY = 2; + + int RL_COUNTY = 3; + + //---------------------------------------地区编码(缩写RC)------------------------------------------------------------- + + /** + * 丽水行政区划编码 + */ + String RC_LS = "331100"; + + /** + * 中国行政区划编码 + */ + String RC_CHINA = "100000"; + + + /** + * 浙江行政区划编码 + */ + String RC_ZJ = "330000"; + + //----------------------------------------地区父级ID(缩写PID)--------------------------------------------------------- + + long PID_CHINA = 0; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionLevelConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionLevelConst.java deleted file mode 100644 index 42161f8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionLevelConst.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.common.constant; - -/** - *

- * RegionLevelConst - *

- * - * @author WendyYang - * @since 13:57 2023/3/1 - */ -public interface RegionLevelConst { - - int PROVINCE = 1; - - int CITY = 2; - - int COUNTY = 3; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java index 219a23c..334b327 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java @@ -2,10 +2,10 @@ package com.ningdatech.pmapi.common.helper; import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO; +import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO; +import java.util.Collection; import java.util.List; -import java.util.Map; /** *

@@ -23,52 +23,14 @@ public interface RegionCacheHelper { * * @return / */ - List all(); - - /** - * 获取用于前端回显示使用的unionList 仅用于返回前端的时候使用 - * - * @param code 区域编码 - * @param level 区域层级 - * @return - */ - String getUnionPathStr(String code, Integer level); - - /** - * 原专家库数据导入使用 返回名称区域Map - * - * @return - */ - Map getNameRegionMap(); - - - /** - * key.getRegionCode() + "###" + key.getRegionLevel() ,regionMap.get(key) - * - * @return - */ - Map getRegionMap(); - - /** - * 获取市级区域列表 - * - * @return - */ - List getMunicipalRegion(); - - /** - * 获取省级区域列表 - * - * @return / - */ - List getProvincialRegion(); + List all(); /** * 根据区域code 区域层级获取 区域类 * * @param code 区域编码 * @param level 区域层级 - * @return / + * @return {@link RegionDTO} */ RegionDTO getByCodeAndLevel(String code, int level); @@ -83,29 +45,39 @@ public interface RegionCacheHelper { List listParents(String code, int level); /** - * 获取所有区域编码「parent -> child」 + * 获取当前区域所有的子区域(包括自己) * - * @param regionCode 区域编码 - * @param regionLevel 级别 + * @param code 区域编码 + * @param level 级别 * @return / */ - List getRegionCodes(String regionCode, int regionLevel); + Collection listChildRegionCodeList(String code, int level); /** - * 获取当前区域所有的子集 + * 获取当前节点开始的区域树 * - * @param code 区域编码 - * @param level 级别 - * @return / + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return 区域树 */ - List getAllChildrenRegionCodeList(String code, int level); + RegionTreeVO getRegionTree(String regionCode, Integer regionLevel); + /** + * 获取展示名称(浙江省/杭州市/滨江区) + * + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return java.lang.String + **/ + String getFullDisplayName(String regionCode, Integer regionLevel); /** - * 获取 根节点 区域层级编码 + * 获取展示名称(杭州市/滨江区) * - * @return / - */ - String getParentCodeRoot(); + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return java.lang.String + **/ + String getDisplayName(String regionCode, Integer regionLevel); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCache.java deleted file mode 100644 index 1322223..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCache.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.ningdatech.pmapi.common.helper.basic; - -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; -import com.ningdatech.pmapi.common.model.RegionMapKey; -import com.ningdatech.pmapi.sys.convert.RegionConverter; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO; -import com.ningdatech.pmapi.sys.service.IRegionService; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -/** - *

- * AbstractRegionCache - *

- * - * @author WendyYang - * @since 14:41 2023/3/1 - */ -public abstract class AbstractRegionCache implements InitializingBean, RegionCacheHelper { - - @Autowired - private IRegionService regionService; - /** - * 当前支持最大层级 - */ - private static final int REGION_LEVEL_MAX = 3; - - private LoadingCache> regionsCache; - - /** - * 中国行政区划编码 - */ - private static final String PARENT_CODE_ROOT = "100000"; - - protected Map regionMap; - - @Override - public void afterPropertiesSet() { - regionsCache = Caffeine.newBuilder() - .expireAfterWrite(10, TimeUnit.MINUTES) - .refreshAfterWrite(5, TimeUnit.MINUTES) - .build(key -> { - // 查询全部 - List regionDTOList = regionService.all(); - if (regionDTOList.isEmpty()) { - throw BizException.wrap("区域元数据不能为空"); - } - regionMap = buildCacheMap(regionDTOList); - List regionInLevel = regionMap.values().stream() - .filter(regionDTO -> { - // 只过滤出小于等于level的region - if (Objects.isNull(regionDTO.getRegionLevel())) { - return false; - } - return Integer.parseInt(key) >= regionDTO.getRegionLevel(); - }).collect(Collectors.toList()); - List treeDtos = RegionConverter.toRegionTreeDTOList(regionInLevel); - return toTreeStructure(treeDtos); - }); - warmUp(); - } - - protected List getByLevel(int level) { - return regionsCache.get(String.valueOf(level)); - } - - private Map buildCacheMap(List regionDTOList) { - Map regionDtoMap = new ConcurrentHashMap<>(256); - regionDTOList.forEach(region -> { - RegionMapKey key = RegionMapKey.builder() - .regionCode(region.getRegionCode()) - .regionLevel(region.getRegionLevel()) - .build(); - regionDtoMap.put(key, region); - }); - return regionDtoMap; - } - - private List toTreeStructure(List rootList) { - List nodeList = new ArrayList<>(); - for (RegionTreeDTO treeNode : rootList) { - if (PARENT_CODE_ROOT.equals(treeNode.getParentCode()) || Objects.isNull(treeNode.getParentCode())) { - nodeList.add(treeNode); - } - treeNode.setChildren(getChildren(treeNode.getRegionCode(), treeNode.getLevel(), rootList)); - } - return nodeList; - } - - private List getChildren(String regionCode, int regionLevel, List list) { - List childList = new ArrayList<>(); - for (RegionTreeDTO regionTreeDTO : list) { - if (regionCode.equals(regionTreeDTO.getParentCode()) && regionLevel + 1 == regionTreeDTO.getLevel()) { - childList.add(regionTreeDTO); - } - } - for (RegionTreeDTO regionTreeDTO : childList) { - regionTreeDTO.setChildren(getChildren(regionTreeDTO.getRegionCode(), regionTreeDTO.getLevel(), list)); - } - if (CollectionUtils.isEmpty(childList)) { - return Collections.emptyList(); - } - childList.sort(Comparator.comparing(RegionTreeDTO::getRegionCode)); - return childList; - } - - - private void warmUp() { - for (int level = 1; level <= REGION_LEVEL_MAX; level++) { - getByLevel(level); - } - } - - protected List getCopyListByLevel(int level) { - List regionTreeDtos = regionsCache.get(String.valueOf(level)); - List copyRegionTreeDtos = new ArrayList<>(); - if (CollectionUtils.isNotEmpty(regionTreeDtos)) { - copyRegionTreeDtos.addAll(regionTreeDtos); - } - return copyRegionTreeDtos; - } - - - @Override - public String getParentCodeRoot() { - return PARENT_CODE_ROOT; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCacheHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCacheHelper.java new file mode 100644 index 0000000..4b0caa5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCacheHelper.java @@ -0,0 +1,69 @@ +package com.ningdatech.pmapi.common.helper.basic; + +import cn.hutool.core.lang.Assert; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.ningdatech.pmapi.common.model.RegionMapKey; +import com.ningdatech.pmapi.sys.convert.RegionConverter; +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +import com.ningdatech.pmapi.sys.model.entity.Region; +import com.ningdatech.pmapi.sys.service.IRegionService; +import lombok.extern.slf4j.Slf4j; +import org.assertj.core.util.Lists; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + *

+ * AbstractRegionCache + *

+ * + * @author WendyYang + * @since 14:41 2023/3/1 + */ +@Slf4j +public abstract class AbstractRegionCacheHelper implements InitializingBean { + + @Autowired + private IRegionService regionService; + + private LoadingCache regionsCache; + + private void initRegionCache() { + List allRegions = regionService.all(); + if (allRegions.isEmpty()) { + log.warn("区域元数据未初始化"); + return; + } + allRegions.forEach(w -> { + RegionMapKey key = RegionMapKey.of(w.getRegionCode(), w.getRegionLevel()); + regionsCache.put(key, w); + }); + } + + protected RegionDTO get(RegionMapKey key) { + return regionsCache.get(key); + } + + protected List all() { + return Lists.newArrayList(regionsCache.asMap().values()); + } + + @Override + public void afterPropertiesSet() { + regionsCache = Caffeine.newBuilder() + .refreshAfterWrite(7, TimeUnit.DAYS) + .maximumSize(512) + .build(key -> { + Region region = regionService.getOne(key.getRegionCode(), key.getRegionLevel()); + Assert.notNull(region, "区域不存在:%s", key); + return RegionConverter.toRegionDTO(region); + }); + // 初始化所有区域数据到缓存 + initRegionCache(); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java index d990c0b..2142393 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java @@ -20,7 +20,7 @@ import java.util.Objects; @AllArgsConstructor public abstract class AbstractRegionLimitHelper implements RegionLimitHelper { - protected final RegionCacheHelper regionCacheHelper; + protected final RegionCacheHelper regionCache; protected final IExpertUserFullInfoService expertUserFullInfoService; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java index 3228561..e3a02fc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java @@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -24,8 +25,8 @@ public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { private static final Logger logger = LoggerFactory.getLogger(RegionLimitHelperImpl.class); - public RegionLimitHelperImpl(RegionCacheHelper regionCacheHelper, IExpertUserFullInfoService expertUserFullInfoService) { - super(regionCacheHelper, expertUserFullInfoService); + public RegionLimitHelperImpl(RegionCacheHelper regionCache, IExpertUserFullInfoService expertUserFullInfoService) { + super(regionCache, expertUserFullInfoService); } public static Boolean contains(Integer adminRegionLevel, List adminAllContainsRegionCodes @@ -88,12 +89,11 @@ public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { @Override public RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode) { - List regionCodes = regionCacheHelper - .getAllChildrenRegionCodeList(regionCode, regionLevel); - RegionContainsBO regionContainsBO = new RegionContainsBO(); - regionContainsBO.setContainsRegionCodeList(regionCodes); - regionContainsBO.setParentRegionTreeLevel(regionLevel); - return regionContainsBO; + Collection regionCodes = regionCache.listChildRegionCodeList(regionCode, regionLevel); + RegionContainsBO regionContains = new RegionContainsBO(); + regionContains.setContainsRegionCodeList(new ArrayList<>(regionCodes)); + regionContains.setParentRegionTreeLevel(regionLevel); + return regionContains; } @Override diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java new file mode 100644 index 0000000..427ffb0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java @@ -0,0 +1,167 @@ +package com.ningdatech.pmapi.common.helper.impl; + +import cn.hutool.core.text.StrPool; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.common.constant.RegionConst; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.common.helper.basic.AbstractRegionCacheHelper; +import com.ningdatech.pmapi.common.model.RegionMapKey; +import com.ningdatech.pmapi.common.util.StrUtils; +import com.ningdatech.pmapi.sys.convert.RegionConverter; +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO; +import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/22 上午8:58 + * 构建地区码 地区树 + */ +@Slf4j +@Component +public class RegionsCacheHelperImpl extends AbstractRegionCacheHelper implements RegionCacheHelper { + + @Override + public RegionDTO getByCodeAndLevel(String code, int level) { + return super.get(RegionMapKey.of(code, level)); + } + + @Override + public List all() { + return super.all(); + } + + @Override + public Collection listChildRegionCodeList(String regionCode, int regionLevel) { + RegionDTO currRegion = getByCodeAndLevel(regionCode, regionLevel); + if (currRegion.getParentCode().equals(regionCode)) { + return Collections.singletonList(regionCode); + } + List allRegions = all(); + return allRegions.stream().filter(w -> StrUtils.split(w.getRegionCodePath()).contains(regionCode)) + .map(RegionDTO::getRegionCode).collect(Collectors.toSet()); + } + + @Override + public RegionTreeVO getRegionTree(String regionCode, Integer regionLevel) { + Map> regions; + Long parentId; + if (regionCode == null || regionCode.equals(RegionConst.RC_CHINA)) { + regions = CollUtils.group(all(), RegionDTO::getParentId); + parentId = RegionConst.PID_CHINA; + } else { + RegionDTO currRegion = getByCodeAndLevel(regionCode, regionLevel); + if (currRegion.getParentCode().equals(regionCode)) { + return RegionConverter.toRegionTreeVO(currRegion); + } + regions = all().stream() + .filter(w -> StrUtils.split(w.getRegionCodePath()).contains(regionCode)) + .collect(Collectors.groupingBy(RegionDTO::getParentId)); + parentId = currRegion.getParentId(); + } + regions.values().forEach(w -> w.sort(Comparator.comparing(x -> Long.parseLong(x.getRegionCode())))); + return RegionConverter.toRegionTree(parentId, regions, false).get(0); + } + + @Override + public String getFullDisplayName(String regionCode, Integer regionLevel) { + RegionDTO regionCurr = getByCodeAndLevel(regionCode, regionLevel); + return getDisplayName(regionCurr, RegionConst.RL_PROVINCE); + } + + @Override + public String getDisplayName(String regionCode, Integer regionLevel) { + RegionDTO regionCurr = getByCodeAndLevel(regionCode, regionLevel); + return getDisplayName(regionCurr, RegionConst.RL_CITY); + } + + //------------------------------------------------------------------------------------------------------------------ + + /** + * 获取指定层级的展示名称 + * + * @param region 当前区域 + * @param sLevel 开始层级 + * @return 展示名称 + */ + private String getDisplayName(RegionDTO region, int sLevel) { + Integer level = region.getRegionLevel(); + if (RegionConst.RL_PROVINCE > sLevel || sLevel > level) { + throw BizException.wrap("区域层级无效"); + } + if (sLevel == level) { + return region.getRegionName(); + } + StringBuilder builder = new StringBuilder(); + List regionCodes = StrUtils.split(region.getRegionCodePath()); + for (int i = regionCodes.size() - 1; i > 0; i--) { + if (level <= sLevel) { + break; + } + RegionDTO tmp = getByCodeAndLevel(regionCodes.get(i), --level); + builder.append(tmp.getRegionName()).append(StrPool.SLASH); + } + builder.append(region.getRegionName()); + return builder.toString(); + } + + protected List getCopyListByLevel(int level) { + List regions = all().stream() + .filter(w -> w.getRegionLevel() <= level) + .collect(Collectors.toList()); + return RegionConverter.toRegionTreeDTOList(regions); + } + + /** + * 获取某一个地区开始的层级树 + * + * @param list 地区集合 + * @param code 地区编码 + * @param level 地区层级 + * @return / + */ + private RegionTreeDTO getTreeByRegionAndCode(List list, String code, int level) { + if (CollectionUtils.isEmpty(list)) { + list = getCopyListByLevel(3); + if (CollectionUtils.isEmpty(list)) { + return null; + } + } + Optional first = list.stream() + .filter(w -> w.getRegionCode().equals(code) && w.getLevel() == level) + .findFirst(); + if (first.isPresent()) { + return first.get(); + } + for (RegionTreeDTO dto : list) { + if (CollectionUtils.isEmpty(dto.getChildren())) { + continue; + } + RegionTreeDTO temp = getTreeByRegionAndCode(dto.getChildren(), code, level); + if (temp != null) { + return temp; + } + } + return null; + } + + @Override + public List listParents(String code, int level) { + List result = new ArrayList<>(); + RegionDTO dto = getByCodeAndLevel(code, level); + result.add(0, dto); + if (RegionConst.RC_CHINA.equals(dto.getParentCode())) { + return result; + } + result.addAll(0, listParents(dto.getParentCode(), dto.getRegionLevel() - 1)); + return result; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheImpl.java deleted file mode 100644 index df3c23d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.ningdatech.pmapi.common.helper.impl; - -import cn.hutool.core.lang.Assert; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.common.helper.basic.AbstractRegionCache; -import com.ningdatech.pmapi.common.model.RegionMapKey; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; -import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -/** - * @author liuxinxin - * @date 2022/7/22 上午8:58 - * 构建地区码 地区树 - */ -@Slf4j -@Component -public class RegionsCacheImpl extends AbstractRegionCache { - - @Override - public List all() { - return getByLevel(3); - } - - @Override - public List getAllChildrenRegionCodeList(String code, int level) { - List regionTreeDTOList = all(); - Set childrenRegionCodeSet = new HashSet<>(); - childrenRegionCodeSet.add(code); - RegionTreeDTO currentRegionTree = getCurrentRegionTree(code, level, regionTreeDTOList); - if (Objects.isNull(currentRegionTree)) { - List childrenRegionCodeList = new ArrayList<>(); - childrenRegionCodeList.add(code); - return childrenRegionCodeList; - } - getAllChildrenRegionCodeList(currentRegionTree.getChildren(), childrenRegionCodeSet); - return new ArrayList<>(childrenRegionCodeSet); - } - - private RegionTreeDTO getCurrentRegionTree(String code, int level, List regionTreeDtos) { - for (RegionTreeDTO regionTreeDTO : regionTreeDtos) { - if (level == regionTreeDTO.getLevel() && code.equals(regionTreeDTO.getRegionCode())) { - return regionTreeDTO; - } - if (CollectionUtils.isNotEmpty(regionTreeDTO.getChildren())) { - return getCurrentRegionTree(code, level, regionTreeDTO.getChildren()); - } - } - return null; - } - - private void getAllChildrenRegionCodeList(List regionTreeDtos, Set childrenRegionCodeSet) { - if (CollectionUtils.isEmpty(regionTreeDtos)) { - return; - } - for (RegionTreeDTO regionTreeDTO : regionTreeDtos) { - childrenRegionCodeSet.add(regionTreeDTO.getRegionCode()); - getAllChildrenRegionCodeList(regionTreeDTO.getChildren(), childrenRegionCodeSet); - - } - } - - @Override - public List getRegionCodes(String regionCode, int regionLevel) { - RegionTreeDTO regionTreeNode = getTreeByRegionAndCode(null, regionCode, regionLevel); - Assert.notNull(regionTreeNode, "不存在此级别区域信息:{}", regionLevel); - List regionCodes = new ArrayList<>(); - if (regionTreeNode != null) { - regionCodes.addAll(CollUtils.fieldList(treeToList(Collections.singletonList(regionTreeNode)), RegionTreeDTO::getRegionCode)); - } - if (!regionCodes.contains(regionCode)) { - regionCodes.add(regionCode); - } - return regionCodes; - } - - protected List treeToList(List treeList) { - ArrayList result = new ArrayList<>(); - treeList.forEach(w -> { - result.add(w); - if (CollectionUtils.isNotEmpty(w.getChildren())) { - result.addAll(treeToList(w.getChildren())); - } - }); - return result; - } - - - /** - * 获取某一个地区开始的层级树 - * - * @param list 地区集合 - * @param code 地区编码 - * @param level 地区层级 - * @return / - */ - protected RegionTreeDTO getTreeByRegionAndCode(List list, String code, int level) { - if (CollectionUtils.isEmpty(list)) { - list = super.getCopyListByLevel(3); - if (CollectionUtils.isEmpty(list)) { - return null; - } - } - Optional first = list.stream() - .filter(w -> w.getRegionCode().equals(code) && w.getLevel() == level) - .findFirst(); - if (first.isPresent()) { - return first.get(); - } - for (RegionTreeDTO dto : list) { - if (CollectionUtils.isEmpty(dto.getChildren())) { - continue; - } - RegionTreeDTO temp = getTreeByRegionAndCode(dto.getChildren(), code, level); - if (temp != null) { - return temp; - } - } - return null; - } - - @Override - public List listParents(String code, int level) { - List result = new ArrayList<>(); - RegionDTO dto = regionMap.get(RegionMapKey.of(code, level)); - result.add(0, dto); - if (dto.getParentCode().equals(super.getParentCodeRoot())) { - return result; - } - result.addAll(0, listParents(dto.getParentCode(), dto.getRegionLevel() - 1)); - return result; - } - - @Override - public RegionDTO getByCodeAndLevel(String code, int level) { - return regionMap.get(RegionMapKey.of(code, level)); - } - - @Override - public List getProvincialRegion() { - List provincialRegionList = new ArrayList<>(); - regionMap.values().forEach(v -> { - if (v.getRegionCode().equals(v.getParentCode()) && v.getRegionLevel() == 2) { - provincialRegionList.add(v); - } - }); - return provincialRegionList; - } - - @Override - public List getMunicipalRegion() { - List municipalRegionList = new ArrayList<>(); - regionMap.values().forEach(v -> { - if (v.getRegionCode().equals(v.getParentCode()) && v.getRegionLevel() == 3) { - municipalRegionList.add(v); - } - }); - return municipalRegionList; - } - - @Override - public Map getRegionMap() { - Map regionDtoMap = new ConcurrentHashMap<>(512); - regionMap.forEach((k, v) -> regionDtoMap.put(k.getRegionCode() + "###" + k.getRegionLevel(), v)); - return regionDtoMap; - } - - @Override - public Map getNameRegionMap() { - Map nameRegionDtoMap = new ConcurrentHashMap<>(512); - regionMap.forEach((k, v) -> nameRegionDtoMap.put(v.getRegionName(), v)); - return nameRegionDtoMap; - } - - @Override - public String getUnionPathStr(String code, Integer level) { - if (StringUtils.isBlank(code) || Objects.isNull(level)) { - return null; - } - List unionPathStrList = new ArrayList<>(); - buildUnionPathStrList(code, level, unionPathStrList); - Collections.reverse(unionPathStrList); - if (CollectionUtils.isEmpty(unionPathStrList)) { - return null; - } - return String.join("@@", unionPathStrList); - } - - protected void buildUnionPathStrList(String code, Integer level, List unionPathStrList) { - if (level <= 0 || super.getParentCodeRoot().equals(code)) { - return; - } - RegionDTO regionDTO = regionMap.get(RegionMapKey.of(code, level)); - unionPathStrList.add(regionDTO.getRegionCode() + "##" + regionDTO.getRegionName() + "##" + regionDTO.getRegionLevel()); - if (!super.getParentCodeRoot().equals(regionDTO.getParentCode())) { - buildUnionPathStrList(regionDTO.getParentCode(), level - 1, unionPathStrList); - } - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java index 5ba10b6..661fd73 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java @@ -38,6 +38,7 @@ import com.ningdatech.pmapi.meeting.service.*; import com.ningdatech.pmapi.meeting.task.ExpertInviteTask; import com.ningdatech.pmapi.meta.helper.DictionaryCache; import com.ningdatech.pmapi.meta.helper.TagCache; +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.util.LoginUserUtil; @@ -65,7 +66,7 @@ import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertIn @RequiredArgsConstructor public class MeetingManage { - private final RegionCacheHelper regionCacheHelper; + private final RegionCacheHelper regionCache; private final IMeetingService meetingService; private final IExpertInviteAvoidRuleService inviteAvoidRuleService; private final IExpertInviteRuleService inviteRuleService; @@ -453,14 +454,12 @@ public class MeetingManage { }); } if (StrUtil.isNotEmpty(randomRule.getIntentionRegionCode())) { - // TODO 履职意向地 - /*List intentionRegions = regionCache.listParents(randomRule.getIntentionRegionCode(), randomRule.getIntentionRegionLevel()); - randomRule.setIntentionRegions(intentionRegions);*/ + List intentionRegions = regionCache.listParents(randomRule.getIntentionRegionCode(), randomRule.getIntentionRegionLevel()); + randomRule.setIntentionRegions(intentionRegions); } if (StrUtil.isNotEmpty(randomRule.getExpertRegionCode())) { - // TODO 专家层级 - /*List expertRegions = regionCache.listParents(randomRule.getExpertRegionCode(), randomRule.getExpertRegionLevel()); - randomRule.setExpertRegions(expertRegions);*/ + List expertRegions = regionCache.listParents(randomRule.getExpertRegionCode(), randomRule.getExpertRegionLevel()); + randomRule.setExpertRegions(expertRegions); } result.getRandomRules().add(randomRule); }); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java index d28a2f7..6555193 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java @@ -6,9 +6,9 @@ import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Maps; import com.ningdatech.basic.exception.BizException; +import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.scheduler.contants.TaskContant; -import com.ningdatech.pmapi.sys.contant.RegionConst; import com.ningdatech.pmapi.sys.model.entity.Region; import com.ningdatech.pmapi.sys.service.IRegionService; import com.wflow.bean.dto.WflowModelHistorysDto; @@ -53,7 +53,7 @@ public class InitProcessTask { //1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 List regions = regionService.list(Wrappers.lambdaQuery(Region.class) .eq(Region::getDeleted,Boolean.FALSE) - .eq(Region::getParentCode, RegionConst.LS_REGION_CODE)); + .eq(Region::getParentCode, RegionConst.RC_LS)); if(CollUtil.isEmpty(regions)){ throw new BizException("丽水地区数据为空 任务结束!"); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/contant/RegionConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/contant/RegionConst.java deleted file mode 100644 index f664939..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/contant/RegionConst.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ningdatech.pmapi.sys.contant; - -/** - *

- * 地区常量 - *

- * - * @author WendyYang - * @since 18:54 2023/1/28 - */ -public interface RegionConst { - - Integer FIRST_LEVEL = 1; - - Integer SECOND_LEVEL = 2; - - Integer THIRD_LEVEL = 3; - - Long EMPTY_PARENT_ID = 0L; - - /** - * 丽水地区CODE - */ - String LS_REGION_CODE = "331100"; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RegionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RegionController.java index 45c479f..5eb16bb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RegionController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RegionController.java @@ -8,10 +8,9 @@ import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.util.List; - /** *

* 前端控制器 @@ -31,8 +30,9 @@ public class RegionController { @GetMapping("/tree") @ApiOperation("获取区域编码的树状结构") - public List getRegionTree() { - return regionManage.getRegionTree(); + public RegionTreeVO getRegionTree(@RequestParam(required = false) String regionCode, + @RequestParam(required = false) Integer regionLevel) { + return regionManage.getRegionTree(regionCode, regionLevel); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/convert/RegionConverter.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/convert/RegionConverter.java index 563b268..2ce9a08 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/convert/RegionConverter.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/convert/RegionConverter.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.sys.convert; +import cn.hutool.core.collection.CollUtil; import com.ningdatech.pmapi.sys.model.entity.Region; import com.ningdatech.pmapi.sys.model.dto.RegionDTO; import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO; @@ -32,6 +33,7 @@ public class RegionConverter { dto.setDeleted(region.getDeleted()); dto.setGovUnit(region.getGovUnit()); dto.setParentId(region.getParentId()); + dto.setRegionCodePath(region.getRegionCodePath()); dto.unionCode(); return dto; } @@ -56,6 +58,19 @@ public class RegionConverter { return treeDto; } + public static RegionTreeVO toRegionTreeVO(RegionDTO region) { + RegionTreeVO node = new RegionTreeVO(); + node.setRegionLevel(region.getRegionLevel()); + node.setName(region.getRegionName()); + node.setParentCode(region.getParentCode()); + node.setRegionCode(region.getRegionCode()); + node.setUnionCode(region.getUnionCode()); + node.setId(region.getId()); + node.setUnionCode(region.getUnionCode()); + node.setGovUnit(region.getGovUnit()); + return node; + } + public static List toRegionTree(Long parentId, Map> regions, boolean showDeleted) { List treeList = new ArrayList<>(); @@ -64,19 +79,12 @@ public class RegionConverter { if (!showDeleted && region.getDeleted()) { continue; } - RegionTreeVO treeNode = new RegionTreeVO(); - treeNode.setRegionLevel(region.getRegionLevel()); - treeNode.setName(region.getRegionName()); - treeNode.setParentCode(region.getParentCode()); - treeNode.setRegionCode(region.getRegionCode()); + RegionTreeVO node = toRegionTreeVO(region); List regionList = regions.get(region.getId()); - if (CollectionUtils.isNotEmpty(regionList)) { - treeNode.setChildren(toRegionTree(region.getId(), regions, showDeleted)); + if (CollUtil.isNotEmpty(regionList)) { + node.setChildren(toRegionTree(region.getId(), regions, showDeleted)); } - treeNode.setId(region.getId()); - treeNode.setUnionCode(region.getUnionCode()); - treeNode.setGovUnit(region.getGovUnit()); - treeList.add(treeNode); + treeList.add(node); } return treeList; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java index ca34fd1..d53d0a3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java @@ -1,14 +1,10 @@ package com.ningdatech.pmapi.sys.manage; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.pmapi.sys.convert.RegionConverter; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO; import com.ningdatech.pmapi.sys.service.IRegionService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Map; /** *

@@ -23,13 +19,10 @@ import java.util.Map; public class RegionManage { private final IRegionService regionService; + private final RegionCacheHelper regionCache; - private final static Long ROOT_PARENT_ID = 0L; - - public List getRegionTree() { - List regions = regionService.all(); - Map> regionMap = CollUtils.group(regions, RegionDTO::getParentId); - return RegionConverter.toRegionTree(ROOT_PARENT_ID, regionMap, false); + public RegionTreeVO getRegionTree(String regionCode, Integer regionLevel) { + return regionCache.getRegionTree(regionCode, regionLevel); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RegionDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RegionDTO.java index b0d82dc..081aac0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RegionDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/RegionDTO.java @@ -49,6 +49,8 @@ public class RegionDTO { private Long parentId; + private String regionCodePath; + public void unionCode() { this.unionCode = String.format("%s##%s##%s", this.regionCode, this.regionName, this.regionLevel); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Region.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Region.java index 9cd09d9..dc97b52 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Region.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Region.java @@ -41,6 +41,8 @@ public class Region implements Serializable { private LocalDateTime updateOn; + private String regionCodePath; + private Boolean deleted; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java index f70430d..901a498 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java @@ -24,6 +24,15 @@ public interface IRegionService extends IService { List all(); /** + * 查询区域 + * + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return {@link Region} + */ + Region getOne(String regionCode, int regionLevel); + + /** * 查询大于等与该级别的所有区域 * * @param regionLevel diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java index 7d43cc3..0a2e2ae 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java @@ -4,9 +4,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.sys.convert.RegionConverter; -import com.ningdatech.pmapi.sys.model.entity.Region; -import com.ningdatech.pmapi.sys.model.dto.RegionDTO; import com.ningdatech.pmapi.sys.mapper.RegionMapper; +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +import com.ningdatech.pmapi.sys.model.entity.Region; import com.ningdatech.pmapi.sys.service.IRegionService; import org.springframework.stereotype.Service; @@ -29,6 +29,13 @@ public class RegionServiceImpl extends ServiceImpl impleme } @Override + public Region getOne(String regionCode, int regionLevel) { + return getOne(Wrappers.lambdaQuery(Region.class) + .eq(Region::getRegionCode, regionCode) + .eq(Region::getRegionLevel, regionLevel)); + } + + @Override public List listGeLevel(int regionLevel) { List regionsByLevel = lambdaQuery().ne(Region::getId, -1) .le(Region::getRegionLevel, regionLevel).list(); diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java new file mode 100644 index 0000000..17321c9 --- /dev/null +++ b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java @@ -0,0 +1,58 @@ +package com.ningdatech.pmapi.sys.service; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.AppTests; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.sys.model.entity.Region; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + +/** + *

+ * IRegionServiceTest + *

+ * + * @author WendyYang + * @since 16:57 2023/3/1 + */ +public class IRegionServiceTest extends AppTests { + + @Autowired + private IRegionService regionService; + + @Test + public void init() { + AtomicLong idIncr = new AtomicLong(1); + Map> map = CollUtils.group(regionService.list(), Region::getRegionLevel); + regionService.remove(null); + map.keySet().stream().sorted().forEach(w -> { + List list = new ArrayList<>(); + List regions = map.get(w); + for (Region region : regions) { + if (w == 1) { + region.setRegionCodePath(region.getParentCode() + "," + region.getRegionCode()); + region.setParentId(0L); + } else { + Region parent = regionService.getOne(Wrappers.lambdaQuery(Region.class) + .eq(Region::getRegionCode, region.getParentCode()) + .eq(Region::getRegionLevel, region.getRegionLevel() - 1)); + region.setRegionCodePath(parent.getRegionCodePath() + "," + region.getRegionCode()); + region.setParentId(parent.getId()); + } + region.setId(idIncr.getAndIncrement()); + list.add(region); + } + regionService.saveBatch(list); + System.out.println("============================================================================"); + }); + } + + +} From 77d85c90181265553373d133878bf1d8a5e98f0e Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 2 Mar 2023 16:48:28 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/common/helper/RegionCacheHelper.java | 9 +++++++++ .../pmapi/common/helper/impl/RegionsCacheHelperImpl.java | 10 ++++++++-- .../com/ningdatech/pmapi/common/model/RegionMapKey.java | 10 ++-------- .../com/ningdatech/pmapi/sys/service/IMenuServiceTest.java | 4 +--- .../ningdatech/pmapi/sys/service/IRegionServiceTest.java | 14 ++++++++++---- 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java index 334b327..adfa0d0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java @@ -35,6 +35,15 @@ public interface RegionCacheHelper { RegionDTO getByCodeAndLevel(String code, int level); /** + * 获取区域名称 + * + * @param code 区域编码 + * @param level 区域层级 + * @return 名称 + */ + String getRegionName(String code, int level); + + /** * 根据传入的地区code与level获取所有上层地区集合 * 按照level升序排列 * diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java index 427ffb0..90ad7c2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java @@ -34,6 +34,11 @@ public class RegionsCacheHelperImpl extends AbstractRegionCacheHelper implements } @Override + public String getRegionName(String code, int level) { + return getByCodeAndLevel(code, level).getRegionName(); + } + + @Override public List all() { return super.all(); } @@ -101,12 +106,13 @@ public class RegionsCacheHelperImpl extends AbstractRegionCacheHelper implements } StringBuilder builder = new StringBuilder(); List regionCodes = StrUtils.split(region.getRegionCodePath()); - for (int i = regionCodes.size() - 1; i > 0; i--) { + for (int i = regionCodes.size() - 2; i > 0; i--) { if (level <= sLevel) { break; } RegionDTO tmp = getByCodeAndLevel(regionCodes.get(i), --level); - builder.append(tmp.getRegionName()).append(StrPool.SLASH); + builder.insert(0, StrPool.SLASH); + builder.insert(0, tmp.getRegionName()); } builder.append(region.getRegionName()); return builder.toString(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java index 31c5bf8..213b0f6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java @@ -16,7 +16,6 @@ import java.util.Objects; * @since 13:54 2023/3/1 */ @Data -@Builder @AllArgsConstructor public class RegionMapKey { @@ -24,11 +23,6 @@ public class RegionMapKey { return new RegionMapKey(regionCode, regionLevel); } - - @Tolerate - public RegionMapKey() { - } - /** * 区域码 */ @@ -48,8 +42,8 @@ public class RegionMapKey { return false; } RegionMapKey regionMapKey = (RegionMapKey) o; - return regionCode.equals(regionMapKey.getRegionCode()) && - regionLevel.equals(regionMapKey.getRegionLevel()); + return regionCode.equals(regionMapKey.getRegionCode()) + && regionLevel.equals(regionMapKey.getRegionLevel()); } @Override diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java index 7b5d953..7d9a566 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java @@ -1,11 +1,9 @@ package com.ningdatech.pmapi.sys.service; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.io.FileUtil; import cn.hutool.db.Db; import cn.hutool.db.Entity; import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.sys.model.entity.Menu; @@ -74,7 +72,7 @@ class IMenuServiceTest extends AppTests { public void initMenu() { // menuService.remove(null); roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class) - .eq(RoleMenu::getRoleId,1)); + .eq(RoleMenu::getRoleId, 1)); // String str = FileUtil.readString("/Users/wendy/Desktop/long_text_2023-02-13-15-28-42.txt", "UTF-8"); // List obj = JSONUtil.toList(str, JSONObject.class); // save(obj, 0); diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java index 17321c9..a228101 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java @@ -5,9 +5,8 @@ import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.sys.model.entity.Region; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; @@ -22,13 +21,15 @@ import java.util.concurrent.atomic.AtomicLong; * @author WendyYang * @since 16:57 2023/3/1 */ -public class IRegionServiceTest extends AppTests { +class IRegionServiceTest extends AppTests { @Autowired + private RegionCacheHelper regionCacheHelper; + @Autowired private IRegionService regionService; @Test - public void init() { + public void test1() { AtomicLong idIncr = new AtomicLong(1); Map> map = CollUtils.group(regionService.list(), Region::getRegionLevel); regionService.remove(null); @@ -54,5 +55,10 @@ public class IRegionServiceTest extends AppTests { }); } + @Test + public void test2() { + System.out.println(regionCacheHelper.getDisplayName("330100", 2)); + System.out.println(regionCacheHelper.getFullDisplayName("330102", 3)); + } } From a1b0c01a64009f2f0b0e4404e76c1fcaba358181 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Thu, 2 Mar 2023 17:36:29 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=9A=20=E6=89=B9=E9=87=8F=E8=8E=B7=E5=8F=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=85=A8=E9=87=8F=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/expert/service/ExpertInfoService.java | 8 +++++ .../expert/service/impl/ExpertInfoServiceImpl.java | 40 +++++++++++++++++++--- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java index 6ca67a3..1b17c9d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java @@ -5,6 +5,8 @@ import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd; import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd; import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; +import java.util.List; + /** * @author liuxinxin * @date 2022/7/22 下午4:39 @@ -31,5 +33,11 @@ public interface ExpertInfoService { void expertStorageDeal(ExpertStorageDealCmd cmd); + + + /** + * 批量获取用户全量信息 + **/ + List listExpertUserFullInfoAll(List userIds); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java index 2dab362..e6ba88c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; @@ -30,10 +31,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -371,5 +369,39 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { } + @Override + public List listExpertUserFullInfoAll(List userIds) { + List expertUserFullInfos = iExpertUserFullInfoService.listByUserIds(userIds); + // 所有专家标签字段 + List expertTagList = iExpertTagService.list(Wrappers.lambdaQuery(ExpertTag.class) + .in(ExpertTag::getUserId, userIds)); + Map> expertTagListMap = CollUtils.group(expertTagList, ExpertTag::getUserId); + // 所有专家字典字段 + List expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class) + .in(ExpertDictionary::getUserId, userIds)); + Map> expertDictMap = CollUtils.group(expertDictionaryList, ExpertDictionary::getUserId); + // 专家履职意向列表 + List expertIntentionWorkRegionList = iExpertIntentionWorkRegionService + .list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) + .in(ExpertIntentionWorkRegion::getUserId, userIds)); + Map> intentionRegionMap = CollUtils.group(expertIntentionWorkRegionList, ExpertIntentionWorkRegion::getUserId); + // 专家履职意向申请列表 + List expertMetaApplyList = iExpertMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) + .in(ExpertMetaApply::getUserId, userIds) + .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) + .in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey())); + Map> metaApplyMap = CollUtils.group(expertMetaApplyList, ExpertMetaApply::getUserId); + // 所有专家回避单位 + List expertAvoidCompanyList = iExpertAvoidCompanyService.list(Wrappers.lambdaQuery(ExpertAvoidCompany.class) + .in(ExpertAvoidCompany::getUserId, userIds)); + Map> avoidInfoMap = CollUtils.group(expertAvoidCompanyList, ExpertAvoidCompany::getUserId); + return expertUserFullInfos.stream().map(w -> ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(w, + expertTagListMap.getOrDefault(w.getUserId(), Collections.emptyList()), + expertDictMap.getOrDefault(w.getUserId(), Collections.emptyList()), + intentionRegionMap.getOrDefault(w.getUserId(), Collections.emptyList()), + metaApplyMap.getOrDefault(w.getUserId(), Collections.emptyList()), + avoidInfoMap.getOrDefault(w.getUserId(), Collections.emptyList()))) + .collect(Collectors.toList()); + } } From dc330a0f64bc88ff253a85889f2250c63e4ac99c Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 2 Mar 2023 17:56:09 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E4=BC=9A=E8=AE=AE=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meeting/controller/MeetingController.java | 2 +- .../entity/domain/ExpertInviteAvoidRule.java | 10 ++++---- .../meeting/entity/domain/ExpertInviteRule.java | 8 ++++--- .../entity/dto/MeetingReviewProjectDTO.java | 4 +++- .../meeting/entity/vo/MeetingDetailBasicVO.java | 6 ++++- .../pmapi/meeting/helper/MeetingManageHelper.java | 4 ++-- .../pmapi/meeting/manage/MeetingManage.java | 28 +++++++++++++++++++--- .../service/IMeetingInnerProjectService.java | 11 +++++++++ .../service/IMeetingOuterProjectService.java | 11 +++++++++ .../impl/ExpertInviteAvoidRuleServiceImpl.java | 2 +- .../impl/MeetingInnerProjectServiceImpl.java | 11 ++++++++- .../impl/MeetingOuterProjectServiceImpl.java | 11 ++++++++- 12 files changed, 90 insertions(+), 18 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java index 991c528..fcad666 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java @@ -70,7 +70,7 @@ public class MeetingController { @GetMapping("detail/{meetingId}/basicInfo") @WebLog(value = "会议详情-基本信息") public MeetingDetailBasicVO meetingBasic(@PathVariable Long meetingId) { - return meetingManage.getMeetingBasicInfo(meetingId); + return meetingManage.getMeetingDetail(meetingId); } @ApiOperation("邀请情况详情") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java index 2f41a0b..22dd2eb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java @@ -1,8 +1,6 @@ package com.ningdatech.pmapi.meeting.entity.domain; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -33,7 +31,7 @@ public class ExpertInviteAvoidRule implements Serializable { private Long meetingId; @ApiModelProperty("回避专家ID") - private String expertIds; + private String avoidExpertIds; @ApiModelProperty("回避单位ID") private String avoidUnitIds; @@ -45,15 +43,19 @@ public class ExpertInviteAvoidRule implements Serializable { private Integer weekInviteCount; @ApiModelProperty("创建人ID") + @TableField(fill = FieldFill.INSERT) private Long createBy; @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) private LocalDateTime createOn; @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateOn; @ApiModelProperty("修改人ID") + @TableField(fill = FieldFill.INSERT_UPDATE) private Long updateBy; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteRule.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteRule.java index f317cc8..797f631 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteRule.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteRule.java @@ -1,8 +1,6 @@ package com.ningdatech.pmapi.meeting.entity.domain; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -35,15 +33,19 @@ public class ExpertInviteRule implements Serializable { private String inviteRule; @ApiModelProperty("创建人ID") + @TableField(fill = FieldFill.INSERT) private Long createBy; @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) private LocalDateTime createOn; @ApiModelProperty("修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateOn; @ApiModelProperty("修改人ID") + @TableField(fill = FieldFill.INSERT_UPDATE) private Long updateBy; @ApiModelProperty("抽取类型:1 自定义规则、2 指定邀请") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java index 41ac6e2..2964d50 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java @@ -3,6 +3,8 @@ package com.ningdatech.pmapi.meeting.entity.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.math.BigDecimal; + /** *

* MeetingEvalProjectDTO @@ -24,7 +26,7 @@ public class MeetingReviewProjectDTO { private String projectType; @ApiModelProperty("申报金额") - private String declareAmount; + private BigDecimal declareAmount; @ApiModelProperty("申报单位") private String buildOrg; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java index 2cd42b2..b4c767b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java @@ -1,7 +1,7 @@ package com.ningdatech.pmapi.meeting.entity.vo; import com.alibaba.fastjson.annotation.JSONField; -import com.ningdatech.pmapi.meeting.entity.req.ExpertInviteReq; +import com.ningdatech.pmapi.meeting.entity.dto.MeetingReviewProjectDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Builder; @@ -9,6 +9,7 @@ import lombok.Data; import lombok.experimental.Tolerate; import java.time.LocalDateTime; +import java.util.List; /** *

@@ -79,4 +80,7 @@ public class MeetingDetailBasicVO { @ApiModelProperty("抽取信息") private InviteRuleDetailVO inviteRule; + @ApiModelProperty("评审项目信息") + private List projects; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java index 030b0a7..c8e39ba 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java @@ -143,7 +143,7 @@ public class MeetingManageHelper { ExpertInviteAvoidRule avoidRule = inviteAvoidRuleService.getByMeetingId(meetingId); AvoidInfoDTO result = new AvoidInfoDTO(); result.setAvoidOrgIdList(StrUtil.split(avoidRule.getAvoidOrgIds(), ",")); - result.setExpertIds(BizUtils.splitToLong(avoidRule.getExpertIds())); + result.setExpertIds(BizUtils.splitToLong(avoidRule.getAvoidExpertIds())); result.setAvoidUnitIdList(StrUtil.split(avoidRule.getAvoidUnitIds(), ",")); result.setWeekInviteCount(result.getWeekInviteCount()); return result; @@ -151,7 +151,7 @@ public class MeetingManageHelper { public void saveAvoidInfo(Long meetingId, List expertIds) { ExpertInviteAvoidRule avoidRule = inviteAvoidRuleService.getByMeetingId(meetingId); - avoidRule.setExpertIds(CollUtils.joinByComma(expertIds)); + avoidRule.setAvoidExpertIds(CollUtils.joinByComma(expertIds)); inviteAvoidRuleService.saveOrUpdate(avoidRule); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java index 661fd73..e813842 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java @@ -38,6 +38,8 @@ import com.ningdatech.pmapi.meeting.service.*; import com.ningdatech.pmapi.meeting.task.ExpertInviteTask; import com.ningdatech.pmapi.meta.helper.DictionaryCache; import com.ningdatech.pmapi.meta.helper.TagCache; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.sys.model.dto.RegionDTO; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.service.IUserInfoService; @@ -82,6 +84,7 @@ public class MeetingManage { private final DistributedLock distributedLock; private final PermissionCheckHelper permissionCheckHelper; private final IUserInfoService userInfoService; + private final IProjectService projectService; private final IMeetingInnerProjectService meetingInnerProjectService; private final IMeetingOuterProjectService meetingOuterProjectService; @@ -177,7 +180,7 @@ public class MeetingManage { avoidRule.setWeekInviteCount(ObjectUtil.defaultIfNull(avoidRule.getWeekInviteCount(), 0)); avoidRule.setAvoidOrgIds(CollUtils.joinByComma(avoidInfo.getAvoidOrgIdList())); avoidRule.setAvoidUnitIds(CollUtils.joinByComma(avoidInfo.getAvoidUnitIdList())); - avoidRule.setExpertIds(CollUtils.joinByComma(avoidInfo.getExpertIds())); + avoidRule.setAvoidExpertIds(CollUtils.joinByComma(avoidInfo.getExpertIds())); inviteAvoidRuleService.save(avoidRule); } } else { @@ -307,10 +310,10 @@ public class MeetingManage { return result; } - public MeetingDetailBasicVO getMeetingBasicInfo(Long meetingId) { + public MeetingDetailBasicVO getMeetingDetail(Long meetingId) { Meeting meeting = meetingService.getById(meetingId); Assert.notNull(meeting, "会议不存在"); - return MeetingDetailBasicVO.builder() + MeetingDetailBasicVO detail = MeetingDetailBasicVO.builder() .meetingId(meeting.getId()) .meetingName(meeting.getName()) .meetingType(meeting.getType()) @@ -327,6 +330,25 @@ public class MeetingManage { .creator(meeting.getCreator()) .createBy(meeting.getCreator()) .build(); + if (meeting.getIsInnerProject()) { + List innerProjects = meetingInnerProjectService.listByMeetingId(meetingId); + List projects = projectService.listByIds(CollUtils.fieldList(innerProjects, MeetingInnerProject::getProjectId)); + List convert = CollUtils.convert(projects, w -> { + MeetingReviewProjectDTO mrp = new MeetingReviewProjectDTO(); + mrp.setBuildOrg(w.getBuildOrgName()); + mrp.setProjectName(w.getProjectName()); + mrp.setProjectType(w.getProjectType().toString()); + mrp.setProjectYear(w.getProjectYear()); + mrp.setDeclareAmount(w.getDeclareAmount()); + return mrp; + }); + detail.setProjects(convert); + } else { + List outerProjects = meetingOuterProjectService.listByMeetingId(meetingId); + detail.setProjects(BeanUtil.copyToList(outerProjects, MeetingReviewProjectDTO.class)); + } + detail.setInviteRule(inviteRuleDetail(meetingId)); + return detail; } public ExpertInviteDetailVO inviteDetail(Long meetingId) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingInnerProjectService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingInnerProjectService.java index be0a0b1..668f765 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingInnerProjectService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingInnerProjectService.java @@ -3,6 +3,8 @@ package com.ningdatech.pmapi.meeting.service; import com.ningdatech.pmapi.meeting.entity.domain.MeetingInnerProject; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** *

* 会议评审内部项目表 服务类 @@ -13,4 +15,13 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IMeetingInnerProjectService extends IService { + /** + * 查询会议评审的内部项目 + * + * @param meetingId 会议ID + * @return 会议关联的系统内部项目 + * @author WendyYang + **/ + List listByMeetingId(Long meetingId); + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingOuterProjectService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingOuterProjectService.java index b7f66a9..6b9d823 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingOuterProjectService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingOuterProjectService.java @@ -3,6 +3,8 @@ package com.ningdatech.pmapi.meeting.service; import com.ningdatech.pmapi.meeting.entity.domain.MeetingOuterProject; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** *

* 会议评审外部项目 服务类 @@ -13,4 +15,13 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IMeetingOuterProjectService extends IService { + /** + * 查询会议评审的外部项目 + * + * @param meetingId 会议ID + * @return 评审的外部项目 + * @author WendyYang + **/ + List listByMeetingId(Long meetingId); + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java index 57f7eb0..0fed622 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java @@ -38,7 +38,7 @@ public class ExpertInviteAvoidRuleServiceImpl extends ServiceImpl * 会议评审内部项目表 服务实现类 @@ -17,4 +20,10 @@ import org.springframework.stereotype.Service; @Service public class MeetingInnerProjectServiceImpl extends ServiceImpl implements IMeetingInnerProjectService { + @Override + public List listByMeetingId(Long meetingId) { + return list(Wrappers.lambdaQuery(MeetingInnerProject.class) + .eq(MeetingInnerProject::getMeetingId, meetingId)); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingOuterProjectServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingOuterProjectServiceImpl.java index f84b62d..0ec1250 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingOuterProjectServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingOuterProjectServiceImpl.java @@ -1,11 +1,14 @@ package com.ningdatech.pmapi.meeting.service.impl; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ningdatech.pmapi.meeting.entity.domain.MeetingOuterProject; import com.ningdatech.pmapi.meeting.mapper.MeetingOuterProjectMapper; import com.ningdatech.pmapi.meeting.service.IMeetingOuterProjectService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.util.List; + /** *

* 会议评审外部项目 服务实现类 @@ -17,4 +20,10 @@ import org.springframework.stereotype.Service; @Service public class MeetingOuterProjectServiceImpl extends ServiceImpl implements IMeetingOuterProjectService { + @Override + public List listByMeetingId(Long meetingId) { + return list(Wrappers.lambdaQuery(MeetingOuterProject.class) + .eq(MeetingOuterProject::getMeetingId, meetingId)); + } + }