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 4fc30ed..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,7 +56,7 @@ public class GeneratorCodeKingbaseConfig { } public static void main(String[] args) { - generate("Liuxinxin", "expert", PATH_LXX, "expert_meta_apply"); + generate("Liuxinxin", "expert", PATH_LXX, "expert_avoid_company"); } } 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/DefValConstants.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java similarity index 51% rename from pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConstants.java rename to pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java index a11b052..9646f75 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConstants.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java @@ -8,7 +8,7 @@ import com.ningdatech.basic.util.StrPool; * * @author PoffyZhang */ -public interface DefValConstants { +public interface DefValConst { /** * 默认的根节点path @@ -30,28 +30,5 @@ public interface DefValConstants { * 字典占位符 */ 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/DingConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java similarity index 86% rename from pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConstant.java rename to pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java index 9590c8b..4fbf071 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConstant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java @@ -6,7 +6,7 @@ package com.ningdatech.pmapi.common.constant; * @author CMM * @since 2023/02/01 14:49 */ -public interface DingConstant { +public interface DingConst { /** * 工作通知 */ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java similarity index 98% rename from pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java rename to pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java index 392cd3a..b9f08a2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java @@ -1,7 +1,5 @@ package com.ningdatech.pmapi.common.constant; -import io.swagger.models.auth.In; - import java.math.BigDecimal; /** @@ -10,7 +8,7 @@ import java.math.BigDecimal; * @author CMM * @since 2023/01/19 10:31 */ -public interface ProjectDeclareConstants { +public interface ProjectDeclareConst { /** * 基本信息 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/StateMachineConstants.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java similarity index 86% rename from pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConstants.java rename to pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java index e1a84c7..e90e5dc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConstants.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java @@ -5,7 +5,7 @@ package com.ningdatech.pmapi.common.constant; * @since 2023/02/07 16:24 */ -public class StateMachineConstants { +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/BoolDisplayEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java similarity index 90% rename from pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java rename to pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java index d4ab72f..29415af 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.common.constant; +package com.ningdatech.pmapi.common.enumeration; import lombok.AllArgsConstructor; import lombok.Getter; 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..adfa0d0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java @@ -0,0 +1,92 @@ +package com.ningdatech.pmapi.common.helper; + + +import com.ningdatech.pmapi.sys.model.dto.RegionDTO; +import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * RegionCacheHelper - + *

+ * + * @author WendyYang + * @since 13:50 2023/3/1 + */ +public interface RegionCacheHelper { + + + /** + * 获取完整的区域树状结构 + * + * @return / + */ + List all(); + + /** + * 根据区域code 区域层级获取 区域类 + * + * @param code 区域编码 + * @param level 区域层级 + * @return {@link RegionDTO} + */ + RegionDTO getByCodeAndLevel(String code, int level); + + /** + * 获取区域名称 + * + * @param code 区域编码 + * @param level 区域层级 + * @return 名称 + */ + String getRegionName(String code, int level); + + /** + * 根据传入的地区code与level获取所有上层地区集合 + * 按照level升序排列 + * + * @param code 地区编码 + * @param level 地区层级 + * @return / + */ + List listParents(String code, int level); + + /** + * 获取当前区域所有的子区域(包括自己) + * + * @param code 区域编码 + * @param level 级别 + * @return / + */ + Collection listChildRegionCodeList(String code, int level); + + /** + * 获取当前节点开始的区域树 + * + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return 区域树 + */ + RegionTreeVO getRegionTree(String regionCode, Integer regionLevel); + + /** + * 获取展示名称(浙江省/杭州市/滨江区) + * + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return java.lang.String + **/ + String getFullDisplayName(String regionCode, Integer regionLevel); + + /** + * 获取展示名称(杭州市/滨江区) + * + * @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/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/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/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 new file mode 100644 index 0000000..2142393 --- /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 regionCache; + 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..e3a02fc --- /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.Collection; +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 regionCache, IExpertUserFullInfoService expertUserFullInfoService) { + super(regionCache, 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) { + Collection regionCodes = regionCache.listChildRegionCodeList(regionCode, regionLevel); + RegionContainsBO regionContains = new RegionContainsBO(); + regionContains.setContainsRegionCodeList(new ArrayList<>(regionCodes)); + regionContains.setParentRegionTreeLevel(regionLevel); + return regionContains; + } + + @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/RegionsCacheHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java new file mode 100644 index 0000000..90ad7c2 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java @@ -0,0 +1,173 @@ +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 String getRegionName(String code, int level) { + return getByCodeAndLevel(code, level).getRegionName(); + } + + @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() - 2; i > 0; i--) { + if (level <= sLevel) { + break; + } + RegionDTO tmp = getByCodeAndLevel(regionCodes.get(i), --level); + builder.insert(0, StrPool.SLASH); + builder.insert(0, tmp.getRegionName()); + } + 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/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/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/common/model/RegionMapKey.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java new file mode 100644 index 0000000..213b0f6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java @@ -0,0 +1,53 @@ +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 +@AllArgsConstructor +public class RegionMapKey { + + public static RegionMapKey of(String regionCode, int regionLevel) { + return new RegionMapKey(regionCode, regionLevel); + } + + /** + * 区域码 + */ + 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..a60301f 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,12 +1,12 @@ 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; -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; @@ -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; @@ -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(); @@ -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/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/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/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/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/controller/ExpertMetaApplyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java index 0757750..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 @@ -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,38 @@ 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/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 new file mode 100644 index 0000000..81ccb68 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java @@ -0,0 +1,533 @@ +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.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; +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; +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; +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; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +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 RegionCacheHelper regionCacheHelper; + private final IExpertUserFullInfoService userFullInfoService; + private final DictionaryCache dictionaryCache; + + private final ExpertInfoService expertInfoService; + + private final UserInfoHelper userInfoHelper; + + private final RegionLimitHelper regionLimitHelper; + + private final ExpertUserInfoHelper expertUserInfoHelper; + + + public PageVo metaApplyListQuery(MetaApplyListQuery req) { + Long expertAdminUserId = LoginUserUtil.getUserId(); + // 查找符合专家条件的用户id + List viewRegions = regionLimitHelper.getExpertAdminContainsRegion(expertAdminUserId); + 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; + } + + @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); + 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) { + 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(); +// 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 = regionCacheHelper.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; + } + + 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/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/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..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,61 +1,62 @@ -//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/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/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/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; +} 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/ExpertInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java index e418920..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 @@ -2,8 +2,11 @@ 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; +import java.util.List; + /** * @author liuxinxin * @date 2022/7/22 下午4:39 @@ -27,4 +30,14 @@ public interface ExpertInfoService { * @return */ ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId); + + + void expertStorageDeal(ExpertStorageDealCmd cmd); + + + /** + * 批量获取用户全量信息 + **/ + List listExpertUserFullInfoAll(List userIds); } + 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/ExpertInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java index c52202e..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 @@ -2,8 +2,10 @@ 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.basic.util.CollUtils; +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; @@ -15,8 +17,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; @@ -27,9 +31,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -304,4 +306,102 @@ 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); + } + + + @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()); + } + } 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/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/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..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,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.dto.MeetingReviewProjectDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Builder; @@ -29,35 +28,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 +65,22 @@ 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; + + @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 1a6e19a..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 @@ -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; @@ -37,6 +38,9 @@ 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; import com.ningdatech.pmapi.user.util.LoginUserUtil; @@ -64,6 +68,7 @@ import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertIn @RequiredArgsConstructor public class MeetingManage { + private final RegionCacheHelper regionCache; private final IMeetingService meetingService; private final IExpertInviteAvoidRuleService inviteAvoidRuleService; private final IExpertInviteRuleService inviteRuleService; @@ -79,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; @@ -174,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 { @@ -304,35 +310,45 @@ public class MeetingManage { return result; } - public MeetingDetailBasicVO getMeetingBasicInfo(Long meetingId) { + public MeetingDetailBasicVO getMeetingDetail(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)); - } - return MeetingDetailBasicVO.builder() - .id(meeting.getId()) - .name(meeting.getName()) - .type(meeting.getType()) + Assert.notNull(meeting, "会议不存在"); + MeetingDetailBasicVO detail = MeetingDetailBasicVO.builder() + .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(); + 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) { @@ -441,9 +457,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); @@ -463,36 +476,31 @@ 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); }); - } - 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/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)); + } + } 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/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/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); + } + } 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..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,15 +6,14 @@ 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; 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; } @@ -71,31 +70,31 @@ 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); } - 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..3e66f78 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,11 +7,11 @@ 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; -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; @@ -41,19 +41,19 @@ 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; } // 项目阶段为已归档 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); + 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..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 @@ -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.entity.ProjectStatusChange; 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; } @@ -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); @@ -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..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 @@ -4,19 +4,17 @@ 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.ProjectStatusChange; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; @@ -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; } @@ -70,13 +68,13 @@ 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()); } - 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..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 @@ -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.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; @@ -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; } @@ -74,13 +67,13 @@ 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()); } - 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/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/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/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..20e3c0f --- /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) + .le(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/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/serivice/IProjectStagingService.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/IProjectStagingService.java similarity index 91% rename from pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/IProjectStagingService.java rename to pmapi/src/main/java/com/ningdatech/pmapi/staging/service/IProjectStagingService.java index 5481a4a..1d3e2a9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/IProjectStagingService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/IProjectStagingService.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.staging.serivice; +package com.ningdatech.pmapi.staging.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ningdatech.pmapi.projectlib.model.entity.Project; 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/serivice/impl/ProjectStagingServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/ProjectStagingServiceImpl.java similarity index 95% rename from pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/impl/ProjectStagingServiceImpl.java rename to pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/ProjectStagingServiceImpl.java index cb131a7..ce40bc1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/serivice/impl/ProjectStagingServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/ProjectStagingServiceImpl.java @@ -1,11 +1,11 @@ -package com.ningdatech.pmapi.staging.serivice.impl; +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.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/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/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 2401192..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.queryAll(); - 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 b5a0295..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 @@ -21,7 +21,16 @@ public interface IRegionService extends IService { * * @return 所有区域 */ - List queryAll(); + List all(); + + /** + * 查询区域 + * + * @param regionCode 区域编码 + * @param regionLevel 区域层级 + * @return {@link Region} + */ + Region getOne(String regionCode, int regionLevel); /** * 查询大于等与该级别的所有区域 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..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; @@ -24,9 +24,15 @@ 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 + public Region getOne(String regionCode, int regionLevel) { + return getOne(Wrappers.lambdaQuery(Region.class) + .eq(Region::getRegionCode, regionCode) + .eq(Region::getRegionLevel, regionLevel)); } @Override 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..cee1623 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,19 +1,18 @@ 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; 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 +23,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,9 +34,9 @@ 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; import com.wflow.contants.HisProInsEndActId; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; @@ -48,12 +49,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; @@ -87,6 +86,7 @@ public class TodoCenterManage { private final IDingEmployeeInfoService dingEmployeeInfoService; private final IDingOrganizationService dingOrganizationService; private final ProcessInstanceService processInstanceService; + private final INdWorkNoticeStagingService workNoticeStagingService; /** @@ -150,8 +150,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.先查出用户工作流 @@ -261,46 +261,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 +314,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 +333,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 +373,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); } } @@ -663,8 +670,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 +764,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 +861,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() diff --git a/pmapi/src/main/resources/application-dev.yml b/pmapi/src/main/resources/application-dev.yml index ec00ac1..14b6ecd 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 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 new file mode 100644 index 0000000..a228101 --- /dev/null +++ b/pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IRegionServiceTest.java @@ -0,0 +1,64 @@ +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.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +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 + */ +class IRegionServiceTest extends AppTests { + + @Autowired + private RegionCacheHelper regionCacheHelper; + @Autowired + private IRegionService regionService; + + @Test + public void test1() { + 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("============================================================================"); + }); + } + + @Test + public void test2() { + System.out.println(regionCacheHelper.getDisplayName("330100", 2)); + System.out.println(regionCacheHelper.getFullDisplayName("330102", 3)); + } + +} 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); + } }