Bladeren bron

工作通知扫表发送

tags/24080901
CMM 1 jaar geleden
bovenliggende
commit
58ddb3f4ab
100 gewijzigde bestanden met toevoegingen van 4287 en 564 verwijderingen
  1. +5
    -1
      ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java
  2. +19
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/config/DingOrganizationProperties.java
  3. +35
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java
  4. +0
    -36
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java
  5. +1
    -24
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java
  6. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java
  7. +1
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java
  8. +19
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionLevelConst.java
  9. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java
  10. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java
  11. +111
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java
  12. +59
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java
  13. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
  14. +138
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCache.java
  15. +44
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java
  16. +122
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java
  17. +205
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheImpl.java
  18. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  19. +22
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPageReq.java
  20. +59
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java
  21. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java
  22. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java
  23. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java
  24. +5
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java
  25. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java
  26. +475
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java
  27. +39
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java
  28. +45
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyStatusEnum.java
  29. +52
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeEnum.java
  30. +50
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeQueryEnum.java
  31. +49
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/QueryExpertAccountStatusEnum.java
  32. +0
    -20
      pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java
  33. +26
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java
  34. +0
    -20
      pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertIntentionWorkRegionController.java
  35. +61
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java
  36. +61
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertMetaApply.java
  37. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java
  38. +46
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoCommonHelper.java
  39. +142
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java
  40. +65
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java
  41. +527
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java
  42. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertMetaApplyMapper.java
  43. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertMetaApplyMapper.xml
  44. +48
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAdminExpertManageQuery.java
  45. +29
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExtraMaterialDO.java
  46. +41
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/RegionDtoMapKey.java
  47. +37
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/AdminModifyExpertInfoCmd.java
  48. +62
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java
  49. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertDeliveryDealCmd.java
  50. +18
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java
  51. +37
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java
  52. +22
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertIntentionApplyDealCmd.java
  53. +22
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertRecommendProofSaveCmd.java
  54. +36
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java
  55. +46
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/MetaApplyListQuery.java
  56. +60
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/SaveExpertAdminCmd.java
  57. +39
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java
  58. +17
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertDictionaryQuery.java
  59. +17
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertTagQuery.java
  60. +59
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ListExpertQuery.java
  61. +31
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRecommendProofSubmitRequest.java
  62. +49
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/MetaApplyResultRequest.java
  63. +56
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertAdminExpertManageListVO.java
  64. +76
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertApplyMetaVO.java
  65. +45
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertFullInfoVO.java
  66. +70
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/MetaApplyResultVo.java
  67. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java
  68. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertMetaApplyService.java
  69. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java
  70. +174
    -18
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java
  71. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertMetaApplyServiceImpl.java
  72. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java
  73. +4
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/builder/ExpertInviteBuilder.java
  74. +8
    -24
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java
  75. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingInnerProjectController.java
  76. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingOuterProjectController.java
  77. +7
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java
  78. +2
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/Meeting.java
  79. +37
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingInnerProject.java
  80. +61
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingOuterProject.java
  81. +10
    -32
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidInfoDTO.java
  82. +12
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingBasicDTO.java
  83. +32
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java
  84. +7
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertInviteTypeEnum.java
  85. +7
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteReq.java
  86. +31
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCreateReq.java
  87. +27
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AppointRuleVO.java
  88. +33
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AvoidInfoVO.java
  89. +6
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteDetailVO.java
  90. +3
    -45
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java
  91. +14
    -29
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java
  92. +35
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertInviteHelper.java
  93. +16
    -12
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java
  94. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java
  95. +29
    -117
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java
  96. +120
    -121
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  97. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingInnerProjectMapper.java
  98. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingInnerProjectMapper.xml
  99. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingOuterProjectMapper.java
  100. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingOuterProjectMapper.xml

+ 5
- 1
ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java Bestand weergeven

@@ -46,7 +46,7 @@ public class GeneratorCodeKingbaseConfig {
path + "/com/ningdatech/pmapi/" + packageName + "/mapper"));
})
.strategyConfig(builder -> {
builder.addTablePrefix("wflow");
builder.addTablePrefix("");
// 设置需要生成的表名
builder.addInclude(tableNames);
})
@@ -56,7 +56,11 @@ public class GeneratorCodeKingbaseConfig {
}

public static void main(String[] args) {
<<<<<<< HEAD
generate("Liuxinxin", "expert", PATH_LXX, "expert_avoid_company");
=======
generate("Liuxinxin", "expert", PATH_LXX, "expert_meta_apply");
>>>>>>> 3fc1952d747d914fc53e00cda93621feed6be50f
}

}

+ 19
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/config/DingOrganizationProperties.java Bestand weergeven

@@ -0,0 +1,19 @@
package com.ningdatech.pmapi.common.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
* @author liuxinxin
* @date 2022/9/9 下午5:37
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "organization")
public class DingOrganizationProperties {
private List<String> deptVisibleScopes = new ArrayList<>();
}

+ 35
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java Bestand weergeven

@@ -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 = "归档";


}

+ 0
- 36
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java Bestand weergeven

@@ -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 = "归档";



}

pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConstants.java → pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DefValConst.java Bestand weergeven

@@ -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;
}

pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConstant.java → pmapi/src/main/java/com/ningdatech/pmapi/common/constant/DingConst.java Bestand weergeven

@@ -6,7 +6,7 @@ package com.ningdatech.pmapi.common.constant;
* @author CMM
* @since 2023/02/01 14:49
*/
public interface DingConstant {
public interface DingConst {
/**
* 工作通知
*/

pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConstants.java → pmapi/src/main/java/com/ningdatech/pmapi/common/constant/ProjectDeclareConst.java Bestand weergeven

@@ -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 {

/**
* 基本信息

+ 19
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionLevelConst.java Bestand weergeven

@@ -0,0 +1,19 @@
package com.ningdatech.pmapi.common.constant;

/**
* <p>
* RegionLevelConst
* </p>
*
* @author WendyYang
* @since 13:57 2023/3/1
*/
public interface RegionLevelConst {

int PROVINCE = 1;

int CITY = 2;

int COUNTY = 3;

}

pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConstants.java → pmapi/src/main/java/com/ningdatech/pmapi/common/constant/StateMachineConst.java Bestand weergeven

@@ -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";

pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java → pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/BoolDisplayEnum.java Bestand weergeven

@@ -1,4 +1,4 @@
package com.ningdatech.pmapi.common.constant;
package com.ningdatech.pmapi.common.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

+ 111
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionCacheHelper.java Bestand weergeven

@@ -0,0 +1,111 @@
package com.ningdatech.pmapi.common.helper;


import com.ningdatech.pmapi.sys.model.dto.RegionDTO;
import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO;

import java.util.List;
import java.util.Map;

/**
* <p>
* RegionCacheHelper -
* </p>
*
* @author WendyYang
* @since 13:50 2023/3/1
*/
public interface RegionCacheHelper {


/**
* 获取完整的区域树状结构
*
* @return /
*/
List<RegionTreeDTO> all();

/**
* 获取用于前端回显示使用的unionList 仅用于返回前端的时候使用
*
* @param code 区域编码
* @param level 区域层级
* @return
*/
String getUnionPathStr(String code, Integer level);

/**
* 原专家库数据导入使用 返回名称区域Map
*
* @return
*/
Map<String, RegionDTO> getNameRegionMap();


/**
* key.getRegionCode() + "###" + key.getRegionLevel() ,regionMap.get(key)
*
* @return
*/
Map<String, RegionDTO> getRegionMap();

/**
* 获取市级区域列表
*
* @return
*/
List<RegionDTO> getMunicipalRegion();

/**
* 获取省级区域列表
*
* @return /
*/
List<RegionDTO> getProvincialRegion();

/**
* 根据区域code 区域层级获取 区域类
*
* @param code 区域编码
* @param level 区域层级
* @return /
*/
RegionDTO getByCodeAndLevel(String code, int level);

/**
* 根据传入的地区code与level获取所有上层地区集合
* 按照level升序排列
*
* @param code 地区编码
* @param level 地区层级
* @return /
*/
List<RegionDTO> listParents(String code, int level);

/**
* 获取所有区域编码「parent -> child」
*
* @param regionCode 区域编码
* @param regionLevel 级别
* @return /
*/
List<String> getRegionCodes(String regionCode, int regionLevel);

/**
* 获取当前区域所有的子集
*
* @param code 区域编码
* @param level 级别
* @return /
*/
List<String> getAllChildrenRegionCodeList(String code, int level);


/**
* 获取 根节点 区域层级编码
*
* @return /
*/
String getParentCodeRoot();

}

+ 59
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/RegionLimitHelper.java Bestand weergeven

@@ -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<RegionContainsBO> regionContainsBOList, String regionCode, Integer regionLevel);

/**
* 查询操作 包含区域包含列表装配
*
* @param queryRegionContainBo 查询区域范围列表
* @param expertAdminContainsRegionList 专家管理员可管理的区域范围列表
* @return /
*/
List<RegionContainsBO> queryContainsRegionAssembler(RegionContainsBO queryRegionContainBo, List<RegionContainsBO> expertAdminContainsRegionList);

/**
* 根据 区域层级-区域编码 获取区域包含列表
*
* @param regionLevel 区域层级
* @param regionCode 区域编码
* @return /
*/
RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode);

/**
* 根据专家管理员用户id 获取专家管理员管辖区域列表
*
* @param expertAdminUserId 专家管理员用户id
* @return /
*/
List<RegionContainsBO> getExpertAdminContainsRegion(Long expertAdminUserId);
}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java Bestand weergeven

@@ -22,4 +22,6 @@ public interface UserInfoHelper {

UserFullInfoDTO getUserFullInfo(Long userId);

String getUserName(Long userId);

}

+ 138
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionCache.java Bestand weergeven

@@ -0,0 +1,138 @@
package com.ningdatech.pmapi.common.helper.basic;

import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.common.model.RegionMapKey;
import com.ningdatech.pmapi.sys.convert.RegionConverter;
import com.ningdatech.pmapi.sys.model.dto.RegionDTO;
import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO;
import com.ningdatech.pmapi.sys.service.IRegionService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

/**
* <p>
* AbstractRegionCache
* </p>
*
* @author WendyYang
* @since 14:41 2023/3/1
*/
public abstract class AbstractRegionCache implements InitializingBean, RegionCacheHelper {

@Autowired
private IRegionService regionService;
/**
* 当前支持最大层级
*/
private static final int REGION_LEVEL_MAX = 3;

private LoadingCache<String, List<RegionTreeDTO>> regionsCache;

/**
* 中国行政区划编码
*/
private static final String PARENT_CODE_ROOT = "100000";

protected Map<RegionMapKey, RegionDTO> regionMap;

@Override
public void afterPropertiesSet() {
regionsCache = Caffeine.newBuilder()
.expireAfterWrite(10, TimeUnit.MINUTES)
.refreshAfterWrite(5, TimeUnit.MINUTES)
.build(key -> {
// 查询全部
List<RegionDTO> regionDTOList = regionService.all();
if (regionDTOList.isEmpty()) {
throw BizException.wrap("区域元数据不能为空");
}
regionMap = buildCacheMap(regionDTOList);
List<RegionDTO> regionInLevel = regionMap.values().stream()
.filter(regionDTO -> {
// 只过滤出小于等于level的region
if (Objects.isNull(regionDTO.getRegionLevel())) {
return false;
}
return Integer.parseInt(key) >= regionDTO.getRegionLevel();
}).collect(Collectors.toList());
List<RegionTreeDTO> treeDtos = RegionConverter.toRegionTreeDTOList(regionInLevel);
return toTreeStructure(treeDtos);
});
warmUp();
}

protected List<RegionTreeDTO> getByLevel(int level) {
return regionsCache.get(String.valueOf(level));
}

private Map<RegionMapKey, RegionDTO> buildCacheMap(List<RegionDTO> regionDTOList) {
Map<RegionMapKey, RegionDTO> regionDtoMap = new ConcurrentHashMap<>(256);
regionDTOList.forEach(region -> {
RegionMapKey key = RegionMapKey.builder()
.regionCode(region.getRegionCode())
.regionLevel(region.getRegionLevel())
.build();
regionDtoMap.put(key, region);
});
return regionDtoMap;
}

private List<RegionTreeDTO> toTreeStructure(List<RegionTreeDTO> rootList) {
List<RegionTreeDTO> nodeList = new ArrayList<>();
for (RegionTreeDTO treeNode : rootList) {
if (PARENT_CODE_ROOT.equals(treeNode.getParentCode()) || Objects.isNull(treeNode.getParentCode())) {
nodeList.add(treeNode);
}
treeNode.setChildren(getChildren(treeNode.getRegionCode(), treeNode.getLevel(), rootList));
}
return nodeList;
}

private List<RegionTreeDTO> getChildren(String regionCode, int regionLevel, List<RegionTreeDTO> list) {
List<RegionTreeDTO> childList = new ArrayList<>();
for (RegionTreeDTO regionTreeDTO : list) {
if (regionCode.equals(regionTreeDTO.getParentCode()) && regionLevel + 1 == regionTreeDTO.getLevel()) {
childList.add(regionTreeDTO);
}
}
for (RegionTreeDTO regionTreeDTO : childList) {
regionTreeDTO.setChildren(getChildren(regionTreeDTO.getRegionCode(), regionTreeDTO.getLevel(), list));
}
if (CollectionUtils.isEmpty(childList)) {
return Collections.emptyList();
}
childList.sort(Comparator.comparing(RegionTreeDTO::getRegionCode));
return childList;
}


private void warmUp() {
for (int level = 1; level <= REGION_LEVEL_MAX; level++) {
getByLevel(level);
}
}

protected List<RegionTreeDTO> getCopyListByLevel(int level) {
List<RegionTreeDTO> regionTreeDtos = regionsCache.get(String.valueOf(level));
List<RegionTreeDTO> copyRegionTreeDtos = new ArrayList<>();
if (CollectionUtils.isNotEmpty(regionTreeDtos)) {
copyRegionTreeDtos.addAll(regionTreeDtos);
}
return copyRegionTreeDtos;
}


@Override
public String getParentCodeRoot() {
return PARENT_CODE_ROOT;
}
}

+ 44
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/basic/AbstractRegionLimitHelper.java Bestand weergeven

@@ -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;

/**
* <p>
* AbstractRegionLimitHelper
* </p>
*
* @author WendyYang
* @since 14:35 2023/3/1
*/
@AllArgsConstructor
public abstract class AbstractRegionLimitHelper implements RegionLimitHelper {

protected final RegionCacheHelper regionCacheHelper;
protected final IExpertUserFullInfoService expertUserFullInfoService;


/**
* 根据 专家用户id 获取专家层级
*
* @param expertUserId /
* @return /
*/
protected ExpertRegionInfo getExpertRegionInfo(Long expertUserId) {
ExpertUserFullInfo userFullInfo = expertUserFullInfoService.getByUserId(expertUserId);
if (Objects.isNull(userFullInfo)) {
return new ExpertRegionInfo();
}
ExpertRegionInfo regionInfo = new ExpertRegionInfo();
regionInfo.setRegionCode(userFullInfo.getRegionCode());
regionInfo.setRegionLevel(userFullInfo.getRegionLevel());
return regionInfo;
}

}

+ 122
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionLimitHelperImpl.java Bestand weergeven

@@ -0,0 +1,122 @@
package com.ningdatech.pmapi.common.helper.impl;

import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.common.helper.basic.AbstractRegionLimitHelper;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo;
import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @author liuxinxin
* @date 2022/8/1 下午2:27
*/
@Component
public class RegionLimitHelperImpl extends AbstractRegionLimitHelper {

private static final Logger logger = LoggerFactory.getLogger(RegionLimitHelperImpl.class);

public RegionLimitHelperImpl(RegionCacheHelper regionCacheHelper, IExpertUserFullInfoService expertUserFullInfoService) {
super(regionCacheHelper, expertUserFullInfoService);
}

public static Boolean contains(Integer adminRegionLevel, List<String> 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<RegionContainsBO> expertAdminContainsRegion = getExpertAdminContainsRegion(expertAdminUserId);
ExpertRegionInfo expertRegionInfo = getExpertRegionInfo(expertUserId);
return regionContains(expertAdminContainsRegion, expertRegionInfo.getRegionCode(), expertRegionInfo.getRegionLevel());
}

@Override
public Boolean regionContains(List<RegionContainsBO> regionContainsBOList, String regionCode, Integer regionLevel) {
for (RegionContainsBO regionContainsBO : regionContainsBOList) {
Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel();
List<String> containsRegionCodeList = regionContainsBO.getContainsRegionCodeList();
for (String containsRegionCode : containsRegionCodeList) {
if (containsRegionCode.equals(regionCode) && parentRegionTreeLevel <= regionLevel) {
return true;
}
}
}
return false;
}


@Override
public List<RegionContainsBO> queryContainsRegionAssembler(RegionContainsBO queryRegionContainBo, List<RegionContainsBO> expertAdminContainsRegionList) {
List<RegionContainsBO> resultBoList = new ArrayList<>();
if (Objects.nonNull(queryRegionContainBo)) {
resultBoList.add(queryRegionContainBo);
Integer parentRegionTreeLevel = queryRegionContainBo.getParentRegionTreeLevel();
List<String> containsRegionCodeList = queryRegionContainBo.getContainsRegionCodeList();

// 查询取并级
if (CollectionUtils.isNotEmpty(expertAdminContainsRegionList)) {
for (RegionContainsBO regionContainsBO : expertAdminContainsRegionList) {
regionContainsBO.setParentRegionTreeLevel(parentRegionTreeLevel);
List<String> regionCodeList = regionContainsBO.getContainsRegionCodeList();
regionCodeList = regionCodeList.stream().filter(containsRegionCodeList::contains).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(regionCodeList)) {
regionContainsBO.setContainsRegionCodeList(regionCodeList);
resultBoList.add(regionContainsBO);
}
}
}
return resultBoList;
} else {
return expertAdminContainsRegionList;
}
}

@Override
public RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode) {
List<String> regionCodes = regionCacheHelper
.getAllChildrenRegionCodeList(regionCode, regionLevel);
RegionContainsBO regionContainsBO = new RegionContainsBO();
regionContainsBO.setContainsRegionCodeList(regionCodes);
regionContainsBO.setParentRegionTreeLevel(regionLevel);
return regionContainsBO;
}

@Override
public List<RegionContainsBO> getExpertAdminContainsRegion(Long expertAdminUserId) {
if (Objects.isNull(expertAdminUserId)) {
logger.error("getExpertAdminContainsRegion expertAdminUserId is null");
return new ArrayList<>();
}
// TODO
/*LambdaQueryWrapper<ExpertAdminRegion> expertAdminRegionEq = Wrappers.lambdaQuery(ExpertAdminRegion.class)
.eq(ExpertAdminRegion::getUserId, expertAdminUserId);
List<ExpertAdminRegion> expertAdminRegionList = iExpertAdminRegionService.list(expertAdminRegionEq);
List<RegionContainsBO> regionContainsBOList = new ArrayList<>();
for (ExpertAdminRegion expertAdminRegion : expertAdminRegionList) {
List<String> regionCodes = regionCacheHelper
.getAllChildrenRegionCodeList(expertAdminRegion.getRegionCode(), expertAdminRegion.getRegionLevel());
RegionContainsBO regionContainsBO = new RegionContainsBO();
regionContainsBO.setContainsRegionCodeList(regionCodes);
regionContainsBO.setParentRegionTreeLevel(expertAdminRegion.getRegionLevel());
regionContainsBOList.add(regionContainsBO);
}*/
return null;
}


}

+ 205
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheImpl.java Bestand weergeven

@@ -0,0 +1,205 @@
package com.ningdatech.pmapi.common.helper.impl;

import cn.hutool.core.lang.Assert;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.helper.basic.AbstractRegionCache;
import com.ningdatech.pmapi.common.model.RegionMapKey;
import com.ningdatech.pmapi.sys.model.dto.RegionDTO;
import com.ningdatech.pmapi.sys.model.dto.RegionTreeDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
* @author liuxinxin
* @date 2022/7/22 上午8:58
* 构建地区码 地区树
*/
@Slf4j
@Component
public class RegionsCacheImpl extends AbstractRegionCache {

@Override
public List<RegionTreeDTO> all() {
return getByLevel(3);
}

@Override
public List<String> getAllChildrenRegionCodeList(String code, int level) {
List<RegionTreeDTO> regionTreeDTOList = all();
Set<String> childrenRegionCodeSet = new HashSet<>();
childrenRegionCodeSet.add(code);
RegionTreeDTO currentRegionTree = getCurrentRegionTree(code, level, regionTreeDTOList);
if (Objects.isNull(currentRegionTree)) {
List<String> childrenRegionCodeList = new ArrayList<>();
childrenRegionCodeList.add(code);
return childrenRegionCodeList;
}
getAllChildrenRegionCodeList(currentRegionTree.getChildren(), childrenRegionCodeSet);
return new ArrayList<>(childrenRegionCodeSet);
}

private RegionTreeDTO getCurrentRegionTree(String code, int level, List<RegionTreeDTO> regionTreeDtos) {
for (RegionTreeDTO regionTreeDTO : regionTreeDtos) {
if (level == regionTreeDTO.getLevel() && code.equals(regionTreeDTO.getRegionCode())) {
return regionTreeDTO;
}
if (CollectionUtils.isNotEmpty(regionTreeDTO.getChildren())) {
return getCurrentRegionTree(code, level, regionTreeDTO.getChildren());
}
}
return null;
}

private void getAllChildrenRegionCodeList(List<RegionTreeDTO> regionTreeDtos, Set<String> childrenRegionCodeSet) {
if (CollectionUtils.isEmpty(regionTreeDtos)) {
return;
}
for (RegionTreeDTO regionTreeDTO : regionTreeDtos) {
childrenRegionCodeSet.add(regionTreeDTO.getRegionCode());
getAllChildrenRegionCodeList(regionTreeDTO.getChildren(), childrenRegionCodeSet);

}
}

@Override
public List<String> getRegionCodes(String regionCode, int regionLevel) {
RegionTreeDTO regionTreeNode = getTreeByRegionAndCode(null, regionCode, regionLevel);
Assert.notNull(regionTreeNode, "不存在此级别区域信息:{}", regionLevel);
List<String> regionCodes = new ArrayList<>();
if (regionTreeNode != null) {
regionCodes.addAll(CollUtils.fieldList(treeToList(Collections.singletonList(regionTreeNode)), RegionTreeDTO::getRegionCode));
}
if (!regionCodes.contains(regionCode)) {
regionCodes.add(regionCode);
}
return regionCodes;
}

protected List<RegionTreeDTO> treeToList(List<RegionTreeDTO> treeList) {
ArrayList<RegionTreeDTO> result = new ArrayList<>();
treeList.forEach(w -> {
result.add(w);
if (CollectionUtils.isNotEmpty(w.getChildren())) {
result.addAll(treeToList(w.getChildren()));
}
});
return result;
}


/**
* 获取某一个地区开始的层级树
*
* @param list 地区集合
* @param code 地区编码
* @param level 地区层级
* @return /
*/
protected RegionTreeDTO getTreeByRegionAndCode(List<RegionTreeDTO> list, String code, int level) {
if (CollectionUtils.isEmpty(list)) {
list = super.getCopyListByLevel(3);
if (CollectionUtils.isEmpty(list)) {
return null;
}
}
Optional<RegionTreeDTO> 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<RegionDTO> listParents(String code, int level) {
List<RegionDTO> result = new ArrayList<>();
RegionDTO dto = regionMap.get(RegionMapKey.of(code, level));
result.add(0, dto);
if (dto.getParentCode().equals(super.getParentCodeRoot())) {
return result;
}
result.addAll(0, listParents(dto.getParentCode(), dto.getRegionLevel() - 1));
return result;
}

@Override
public RegionDTO getByCodeAndLevel(String code, int level) {
return regionMap.get(RegionMapKey.of(code, level));
}

@Override
public List<RegionDTO> getProvincialRegion() {
List<RegionDTO> provincialRegionList = new ArrayList<>();
regionMap.values().forEach(v -> {
if (v.getRegionCode().equals(v.getParentCode()) && v.getRegionLevel() == 2) {
provincialRegionList.add(v);
}
});
return provincialRegionList;
}

@Override
public List<RegionDTO> getMunicipalRegion() {
List<RegionDTO> municipalRegionList = new ArrayList<>();
regionMap.values().forEach(v -> {
if (v.getRegionCode().equals(v.getParentCode()) && v.getRegionLevel() == 3) {
municipalRegionList.add(v);
}
});
return municipalRegionList;
}

@Override
public Map<String, RegionDTO> getRegionMap() {
Map<String, RegionDTO> regionDtoMap = new ConcurrentHashMap<>(512);
regionMap.forEach((k, v) -> regionDtoMap.put(k.getRegionCode() + "###" + k.getRegionLevel(), v));
return regionDtoMap;
}

@Override
public Map<String, RegionDTO> getNameRegionMap() {
Map<String, RegionDTO> nameRegionDtoMap = new ConcurrentHashMap<>(512);
regionMap.forEach((k, v) -> nameRegionDtoMap.put(v.getRegionName(), v));
return nameRegionDtoMap;
}

@Override
public String getUnionPathStr(String code, Integer level) {
if (StringUtils.isBlank(code) || Objects.isNull(level)) {
return null;
}
List<String> unionPathStrList = new ArrayList<>();
buildUnionPathStrList(code, level, unionPathStrList);
Collections.reverse(unionPathStrList);
if (CollectionUtils.isEmpty(unionPathStrList)) {
return null;
}
return String.join("@@", unionPathStrList);
}

protected void buildUnionPathStrList(String code, Integer level, List<String> unionPathStrList) {
if (level <= 0 || super.getParentCodeRoot().equals(code)) {
return;
}
RegionDTO regionDTO = regionMap.get(RegionMapKey.of(code, level));
unionPathStrList.add(regionDTO.getRegionCode() + "##" + regionDTO.getRegionName() + "##" + regionDTO.getRegionLevel());
if (!super.getParentCodeRoot().equals(regionDTO.getParentCode())) {
buildUnionPathStrList(regionDTO.getParentCode(), level - 1, unionPathStrList);
}
}
}

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java Bestand weergeven

@@ -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;
}
}

+ 22
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/model/CommonPageReq.java Bestand weergeven

@@ -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();
}
}

+ 59
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/model/RegionMapKey.java Bestand weergeven

@@ -0,0 +1,59 @@
package com.ningdatech.pmapi.common.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;

import java.util.Objects;

/**
* <p>
* RegionMapKey
* </p>
*
* @author WendyYang
* @since 13:54 2023/3/1
*/
@Data
@Builder
@AllArgsConstructor
public class RegionMapKey {

public static RegionMapKey of(String regionCode, int regionLevel) {
return new RegionMapKey(regionCode, regionLevel);
}


@Tolerate
public RegionMapKey() {
}

/**
* 区域码
*/
private String regionCode;

/**
* 地区级别
*/
private Integer regionLevel;

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RegionMapKey regionMapKey = (RegionMapKey) o;
return regionCode.equals(regionMapKey.getRegionCode()) &&
regionLevel.equals(regionMapKey.getRegionLevel());
}

@Override
public int hashCode() {
return Objects.hash(regionCode, regionLevel);
}
}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java Bestand weergeven

@@ -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<ProjectStatusChangeEvent> message) {


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java Bestand weergeven

@@ -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<ProjectStatusEnum, ProjectStatusChangeEvent> {

private static final String PROJECT_DECLARE = StateMachineConstants.PROJECT_DECLARE;
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

@Override
public void execute(StateContext<ProjectStatusEnum, ProjectStatusChangeEvent> stateContext) {


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/factory/ProjectDeclareGuardFactory.java Bestand weergeven

@@ -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<ProjectStatusEnum, ProjectStatusChangeEvent> {
@Override


+ 5
- 5
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java Bestand weergeven

@@ -1,8 +1,8 @@
package com.ningdatech.pmapi.common.statemachine.util;

import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.common.constant.ProjectDeclareConstants;
import com.ningdatech.pmapi.common.constant.StateMachineConstants;
import com.ningdatech.pmapi.common.constant.ProjectDeclareConst;
import com.ningdatech.pmapi.common.constant.StateMachineConst;
import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder;
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
@@ -32,7 +32,7 @@ import java.util.Objects;
@RequiredArgsConstructor
public class StateMachineUtils {

private static final String PROJECT_DECLARE = StateMachineConstants.PROJECT_DECLARE;
private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE;

private final ProjectDeclareStateMachineBuilder projectDeclareStateMachineBuilder;

@@ -70,7 +70,7 @@ public class StateMachineUtils {
* @since 2023/02/07 17:13
*/
public static boolean judgeDeclareAmount(Project project) {
int flag = project.getDeclareAmount().compareTo(ProjectDeclareConstants.Number.DECLARE_AMOUNT_JUDGEMENT);
int flag = project.getDeclareAmount().compareTo(ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT);
if (flag > 0 || flag == 0) {
return true;
}
@@ -87,7 +87,7 @@ public class StateMachineUtils {
*/
public static boolean isCityProject(Project project) {
String areaCode = project.getAreaCode();
if (areaCode.equals(StateMachineConstants.LI_SHUI_CITY_AREA_CODE)) {
if (areaCode.equals(StateMachineConst.LI_SHUI_CITY_AREA_CODE)) {
return true;
}
return false;


+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java Bestand weergeven

@@ -71,7 +71,6 @@ public class EmployeeBatchGetTask {
GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData();
if (CollUtil.isNotEmpty(data.getData())) {

allOrganizationEmployeePositionList.addAll(data.getData());
}
Long totalSize = data.getTotalSize();


+ 475
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertUserInfoAssembler.java Bestand weergeven

@@ -0,0 +1,475 @@
package com.ningdatech.pmapi.expert.assembler;

//import com.ningdatech.emapi.common.enumeration.BoolDisplayEnum;
//import com.ningdatech.emapi.common.helper.RegionCache;
//import com.ningdatech.emapi.common.utils.JSONObject;
//import com.ningdatech.emapi.expert.constants.DictExpertInfoTypeEnum;
//import com.ningdatech.emapi.expert.constants.ExpertApplyTypeEnum;
//import com.ningdatech.emapi.expert.constants.ExpertTagEnum;
//import com.ningdatech.emapi.expert.entity.*;
//import com.ningdatech.emapi.expert.entity.domain.*;
//import com.ningdatech.emapi.expert.entity.dto.*;
//import com.ningdatech.emapi.expert.entity.vo.ExpertFullInfoVO;
//import com.ningdatech.emapi.sys.file.entity.FileBasicInfo;
//import com.ningdatech.emapi.sys.file.entity.vo.result.AttachFileVo;
//import com.ningdatech.emapi.sys.meta.entity.RegionDtoMapKey;
//import com.ningdatech.emapi.sys.meta.entity.dto.DictionaryDTO;
//import com.ningdatech.emapi.sys.meta.entity.dto.TagDTO;
//import com.ningdatech.emapi.sys.meta.helper.DictionaryCache;
//import com.ningdatech.emapi.sys.meta.helper.TagCache;

import com.alibaba.fastjson.JSONObject;
import com.ningdatech.file.entity.vo.result.AttachFileVo;
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;
import com.ningdatech.pmapi.expert.entity.ExpertMetaApply;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.model.*;
import com.ningdatech.pmapi.expert.model.dto.*;
import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO;
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum;
import com.ningdatech.pmapi.meta.constant.ExpertTagEnum;
import com.ningdatech.pmapi.meta.helper.DictionaryCache;
import com.ningdatech.pmapi.meta.helper.TagCache;
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo;
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO;
import com.ningdatech.pmapi.meta.model.dto.TagDTO;
import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary;
import com.ningdatech.pmapi.meta.model.entity.ExpertTag;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
* @author liuxinxin
* @date 2022/7/27 上午10:46
*/
@Component
@RequiredArgsConstructor
public class ExpertUserInfoAssembler {

private final TagCache tagCache;
private final DictionaryCache dictionaryCache;
// private final RegionCache regionCache;

public ExpertFullInfoVO buildExpertFullInfoVO(List<AttachFileVo> attachFiles
, ExpertFullInfoAllDTO expertUserFullInfoAll) {
ExpertUserFullInfoDTO expertUserInfoDTO = expertUserFullInfoAll.getExpertUserInfoDTO();
// 字典字典段map
Map<String, List<DictionaryFieldInfo>> dictionaryFieldInfoMap =
buildDictionaryFieldInfoMap(expertUserFullInfoAll.getExpertDictionaryList());
// 专家文件资料map
Map<Long, FileBasicInfo> fileBasicInfoMap = buildFileBasicInfoMap(attachFiles);
// 专家标签字段map
Map<String, List<TagFieldInfo>> tagFieldInfoMap = buildTagFieldInfoMap(expertUserFullInfoAll.getExpertTagList());
// 专家履职意向地
List<ExpertRegionDTO> expertIntentionWorkRegionInfo =
expertUserFullInfoAll.getExpertIntentionWorkRegionInfo();
// 专家回避单位列表
List<ExpertAvoidCompanyDTO> expertAvoidCompanyList = expertUserFullInfoAll.getExpertAvoidCompanyList();
// 基本信息
ExpertBasicInfo basicInfo = buildExpertBasicInfo(expertUserInfoDTO, dictionaryFieldInfoMap, tagFieldInfoMap, expertIntentionWorkRegionInfo, fileBasicInfoMap);
// 学历信息
ExpertEduInfo eduInfo = buildExpertEduInfo(expertUserInfoDTO, dictionaryFieldInfoMap, fileBasicInfoMap);
// 职业信息
ExpertJobInfo jobInfo = buildExpertJobInfo(expertUserInfoDTO, dictionaryFieldInfoMap);
// 专业信息
ExpertProfessionalInfo professionalInfo =
buildExpertProfessionalInfo(expertUserInfoDTO, dictionaryFieldInfoMap, tagFieldInfoMap
, fileBasicInfoMap, expertAvoidCompanyList);
// 推荐信息
ExpertRecommendInfo recommendInfo = new ExpertRecommendInfo();
recommendInfo.setRecommendedWay(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()));
recommendInfo.setRecommendationProofFile(
getFileBasicInfoList(fileBasicInfoMap, expertUserInfoDTO.getRecommendationProofFileIdList()));
// 其他信息
ExpertOtherInfo otherInfo = new ExpertOtherInfo();
otherInfo.setOther(tagFieldInfoMap.get(ExpertTagEnum.OTHER.getKey()));
otherInfo.setRemark(expertUserInfoDTO.getRemark());

// 专家申请履职意向展示列表
List<ExpertRegionInfo> expertApplyIntentionWorkRegions = expertUserFullInfoAll.getExpertApplyIntentionWorkRegionInfo().stream().map(r -> {
ExpertRegionInfo expertApplyIntentionWorkRegion = new ExpertRegionInfo();
expertApplyIntentionWorkRegion.setRegionLevel(r.getRegionLevel());
expertApplyIntentionWorkRegion.setRegionCode(r.getRegionCode());
// expertApplyIntentionWorkRegion.setRegionName(regionCache.getUnionPathStr(r.getRegionCode(), r.getRegionLevel()));
return expertApplyIntentionWorkRegion;
}).collect(Collectors.toList());


ExpertFullInfoVO expertFullInfoVO = new ExpertFullInfoVO();
expertFullInfoVO.setUserId(expertUserInfoDTO.getUserId());
expertFullInfoVO.setBasicInfo(basicInfo);
expertFullInfoVO.setEduInfo(eduInfo);
expertFullInfoVO.setJobInfo(jobInfo);
expertFullInfoVO.setProfessionalInfo(professionalInfo);
expertFullInfoVO.setRecommendInfo(recommendInfo);
expertFullInfoVO.setExpertOtherInfo(otherInfo);
expertFullInfoVO.setExpertApplyIntentionWorkRegions(expertApplyIntentionWorkRegions);

return expertFullInfoVO;
}

public static Map<Long, FileBasicInfo> buildFileBasicInfoMap(List<AttachFileVo> attachFiles) {
return attachFiles.stream().map(r -> {
FileBasicInfo fileBasicInfo = new FileBasicInfo();
fileBasicInfo.setFileId(r.getFileId());
fileBasicInfo.setFileName(r.getOriginalFileName());
return fileBasicInfo;
}).collect(Collectors.toMap(FileBasicInfo::getFileId, Function.identity()));
}

public Map<String, List<TagFieldInfo>> buildTagFieldInfoMap(List<ExpertTagDTO> expertTagList) {
return expertTagList.stream().map(r -> {
TagFieldInfo tagFieldInfo = new TagFieldInfo();
tagFieldInfo.setTagCode(r.getTagCode());
tagFieldInfo.setTagFieldName(r.getExpertInfoField());
TagDTO tagDTO = tagCache.getByTagCode(r.getTagCode());
if (Objects.nonNull(tagDTO)) {
tagFieldInfo.setTagName(tagDTO.getTagName());
}
return tagFieldInfo;
}).collect(Collectors.groupingBy(TagFieldInfo::getTagFieldName));
}

public Map<String, List<DictionaryFieldInfo>> buildDictionaryFieldInfoMap(List<ExpertDictionaryDTO> expertDictionaryList) {
return expertDictionaryList.stream().map(r -> {
DictionaryFieldInfo dictionaryFieldInfo = new DictionaryFieldInfo();
dictionaryFieldInfo.setDictionaryFieldName(r.getExpertInfoField());
dictionaryFieldInfo.setDictionaryCode(r.getDictionaryCode());
DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(r.getDictionaryCode());
if (Objects.nonNull(dictionaryDTO)) {
dictionaryFieldInfo.setDictionaryName(dictionaryDTO.getName());
}
return dictionaryFieldInfo;
}).collect(Collectors.groupingBy(DictionaryFieldInfo::getDictionaryFieldName));
}

public static ExpertProfessionalInfo buildExpertProfessionalInfo(ExpertUserFullInfoDTO expertUserInfoDTO
, Map<String, List<DictionaryFieldInfo>> dictionaryFieldInfoMap, Map<String, List<TagFieldInfo>> tagFieldInfoMap
, Map<Long, FileBasicInfo> fileBasicInfoMap, List<ExpertAvoidCompanyDTO> expertAvoidCompanyList) {
ExpertProfessionalInfo professionalInfo = new ExpertProfessionalInfo();
professionalInfo.setTechnicalTitles(expertUserInfoDTO.getTechnicalTitles());
professionalInfo.setTitleLevel(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey()));
professionalInfo.setTitleCertificateFile(getFileBasicInfoList(fileBasicInfoMap, expertUserInfoDTO.getTitleCertificateFileIdList()));
professionalInfo.setGoodAt(tagFieldInfoMap.get(ExpertTagEnum.GOOD_AT.getKey()));
professionalInfo.setTechnicalExpertise(tagFieldInfoMap.get(ExpertTagEnum.TECHNICAL_EXPERTISE.getKey()));
professionalInfo.setAwards(expertUserInfoDTO.getAwards());
professionalInfo.setIndustrySector(tagFieldInfoMap.get(ExpertTagEnum.INDUSTRY_SECTOR.getKey()));
professionalInfo.setRecognitionReward(expertUserInfoDTO.getRecognitionReward());
professionalInfo.setAvoidCompanyList(expertAvoidCompanyList.stream().map(r -> {
ExpertAvoidCompanyInfo expertAvoidCompanyInfo = new ExpertAvoidCompanyInfo();
expertAvoidCompanyInfo.setCompanyName(r.getCompanyName());
expertAvoidCompanyInfo.setCompanyUniqCode(r.getCompanyUniqCode());
return expertAvoidCompanyInfo;
}).collect(Collectors.toList()));
return professionalInfo;
}

public static ExpertJobInfo buildExpertJobInfo(ExpertUserFullInfoDTO expertUserInfoDTO
, Map<String, List<DictionaryFieldInfo>> dictionaryFieldInfoMap) {
ExpertJobInfo jobInfo = new ExpertJobInfo();
jobInfo.setJobStatus(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.JOB_STATUS.getKey()));
jobInfo.setRetiredAt(expertUserInfoDTO.getRetiredAt());
jobInfo.setCompany(expertUserInfoDTO.getCompany());
jobInfo.setCompanyUniqCode(expertUserInfoDTO.getCompanyUniqCode());
jobInfo.setLegalEntityCode(expertUserInfoDTO.getLegalEntityCode());
jobInfo.setAdministrativeDuties(expertUserInfoDTO.getAdministrativeDuties());
jobInfo.setStartWorkAt(expertUserInfoDTO.getStartWorkAt());
jobInfo.setAdministrativeRank(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.ADMINISTRATIVE_RANK.getKey()));
jobInfo.setCompanyAttribute(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey()));
jobInfo.setAddress(expertUserInfoDTO.getAddress());
jobInfo.setExperience(expertUserInfoDTO.getExperience());
return jobInfo;
}

public static ExpertEduInfo buildExpertEduInfo(ExpertUserFullInfoDTO expertUserInfoDTO
, Map<String, List<DictionaryFieldInfo>> dictionaryFieldInfoMap, Map<Long, FileBasicInfo> fileBasicInfoMap) {
// 学历信息
ExpertEduInfo eduInfo = new ExpertEduInfo();
eduInfo.setSchool(expertUserInfoDTO.getSchool());
eduInfo.setGraduatedAt(expertUserInfoDTO.getGraduatedAt());
eduInfo.setAcademicTitle(expertUserInfoDTO.getAcademicTitle());
eduInfo.setEdu(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.EDU.getKey()));
eduInfo.setGraduationCertificateFile(getFileBasicInfoList(fileBasicInfoMap
, expertUserInfoDTO.getGraduationCertificateFileIdList()));
eduInfo.setDegree(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.DEGREE.getKey()));
eduInfo.setDegreeCertificateFile(getFileBasicInfoList(fileBasicInfoMap, expertUserInfoDTO.getDegreeCertificateFileIdList()));
return eduInfo;
}

public static List<FileBasicInfo> getFileBasicInfoList(Map<Long, FileBasicInfo> fileBasicInfoMap, List<Long> fileIdList) {
if (CollectionUtils.isEmpty(fileIdList)) {
return new ArrayList<>();
}
List<FileBasicInfo> fileBasicInfoList = new ArrayList<>();
for (Long fileId : fileIdList) {
FileBasicInfo fileBasicInfo = fileBasicInfoMap.get(fileId);
if (Objects.nonNull(fileBasicInfo)) {
fileBasicInfoList.add(fileBasicInfo);
}
}
return fileBasicInfoList;
}

public static FileBasicInfo getFileBasicInfo(Map<Long, FileBasicInfo> fileBasicInfoMap, Long fileId) {
if (Objects.isNull(fileId)) {
return null;
}
FileBasicInfo fileBasicInfo = fileBasicInfoMap.get(fileId);
return fileBasicInfo;
}

public ExpertBasicInfo buildExpertBasicInfo(ExpertUserFullInfoDTO expertUserInfoDTO
, Map<String, List<DictionaryFieldInfo>> dictionaryFieldInfoMap
, Map<String, List<TagFieldInfo>> tagFieldInfoMap
, List<ExpertRegionDTO> expertIntentionWorkRegionInfo
, Map<Long, FileBasicInfo> fileBasicInfoMap) {
//专家层级
ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo();
expertRegionInfo.setRegionLevel(expertUserInfoDTO.getRegionLevel());
expertRegionInfo.setRegionCode(expertUserInfoDTO.getRegionCode());

// 基本信息
ExpertBasicInfo basicInfo = new ExpertBasicInfo();
basicInfo.setIsDingUser(expertUserInfoDTO.getIsDingUser());
basicInfo.setPhoneNo(expertUserInfoDTO.getPhoneNo());
basicInfo.setName(expertUserInfoDTO.getName());
basicInfo.setAvatarFile(getFileBasicInfo(fileBasicInfoMap, expertUserInfoDTO.getAvatarFileId()));
basicInfo.setGender(expertUserInfoDTO.getGender());
basicInfo.setPolitical(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey()));
basicInfo.setIdCard(expertUserInfoDTO.getIdCard());
basicInfo.setOfficePhone(expertUserInfoDTO.getPhoneNo());
basicInfo.setBirth(expertUserInfoDTO.getBirth());
basicInfo.setBank(expertUserInfoDTO.getBank());
basicInfo.setBankNo(expertUserInfoDTO.getBankNo());
basicInfo.setEmail(expertUserInfoDTO.getEmail());
basicInfo.setHometown(expertUserInfoDTO.getHometown());
basicInfo.setNationality(expertUserInfoDTO.getNationality());
basicInfo.setExpertSource(tagFieldInfoMap.get(ExpertTagEnum.EXPERT_SOURCE.getKey()));
if (Objects.nonNull(expertRegionInfo)) {
// expertRegionInfo.setRegionName(regionCache.getUnionPathStr(expertRegionInfo.getRegionCode(), expertRegionInfo.getRegionLevel()));
basicInfo.setExpertRegionInfo(expertRegionInfo);
}

basicInfo.setExpertIntentionWorkRegions(expertIntentionWorkRegionInfo.stream().map(r -> {
ExpertRegionInfo expertIntentionWorkRegion = new ExpertRegionInfo();
expertIntentionWorkRegion.setRegionCode(r.getRegionCode());
expertIntentionWorkRegion.setRegionLevel(r.getRegionLevel());
// expertIntentionWorkRegion.setRegionName(regionCache.getUnionPathStr(r.getRegionCode(), r.getRegionLevel()));
return expertIntentionWorkRegion;
}).collect(Collectors.toList()));
basicInfo.setExpertType(dictionaryFieldInfoMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey()));
return basicInfo;
}

public static ExpertFullInfoAllDTO buildExpertFullInfoAllDTO(ExpertUserFullInfo expertUserFullInfo
, List<ExpertTag> expertTagList
, List<ExpertDictionary> expertDictionaryList
, List<ExpertIntentionWorkRegion> expertIntentionWorkRegionList
, List<ExpertMetaApply> expertMetaApplyList
, List<ExpertAvoidCompany> expertAvoidCompanyList) {
ExpertUserFullInfoDTO expertUserFullInfoDTO = buildExpertUserFullInfoDTO(expertUserFullInfo);
List<ExpertDictionaryDTO> expertDictionaryDTOList = buildExpertDictionaryDTOList(expertDictionaryList);
List<ExpertTagDTO> expertTagDTOList = buildExpertTagDTOList(expertTagList);
List<ExpertRegionDTO> expertIntentionWorkRegionInfo = buildExpertIntentionWorkRegionInfo(expertIntentionWorkRegionList);

// 专家申请履职意向展示列表
List<ExpertRegionDTO> expertApplyIntentionWorkRegionInfo = buildExpertApplyIntentionWorkRegionInfo(expertIntentionWorkRegionList, expertMetaApplyList);
List<ExpertAvoidCompanyDTO> expertAvoidCompanyDTOList = buildExpertAvoidCompanyDTOList(expertAvoidCompanyList);
ExpertFullInfoAllDTO expertFullInfoAllDTO = new ExpertFullInfoAllDTO();
expertFullInfoAllDTO.setUserId(expertUserFullInfo.getUserId());
expertFullInfoAllDTO.setExpertUserInfoDTO(expertUserFullInfoDTO);
expertFullInfoAllDTO.setExpertDictionaryList(expertDictionaryDTOList);
expertFullInfoAllDTO.setExpertTagList(expertTagDTOList);
expertFullInfoAllDTO.setExpertIntentionWorkRegionInfo(expertIntentionWorkRegionInfo);
expertFullInfoAllDTO.setExpertApplyIntentionWorkRegionInfo(expertApplyIntentionWorkRegionInfo);
expertFullInfoAllDTO.setExpertAvoidCompanyList(expertAvoidCompanyDTOList);
return expertFullInfoAllDTO;
}

private static List<ExpertRegionDTO> buildExpertApplyIntentionWorkRegionInfo(List<ExpertIntentionWorkRegion> expertIntentionWorkRegionList
, List<ExpertMetaApply> expertMetaApplyList) {
HashSet<RegionDtoMapKey> set = new HashSet();
for (ExpertIntentionWorkRegion expertIntentionWorkRegion : expertIntentionWorkRegionList) {
RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey();
regionDtoMapKey.setRegionCode(expertIntentionWorkRegion.getRegionCode());
regionDtoMapKey.setRegionLevel(expertIntentionWorkRegion.getRegionLevel());
set.add(regionDtoMapKey);
}

for (ExpertMetaApply expertMetaApply : expertMetaApplyList) {
String applyType = expertMetaApply.getApplyType();
RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey();
regionDtoMapKey.setRegionCode(expertMetaApply.getRegionCode());
regionDtoMapKey.setRegionLevel(expertMetaApply.getRegionLevel());
ExpertApplyTypeEnum typeEnum = ExpertApplyTypeEnum.of(applyType);
switch (typeEnum) {
case EXPERT_INTENTION_LEAVE: {
set.remove(regionDtoMapKey);
}
break;
case EXPERT_INTENTION_JOIN: {
set.add(regionDtoMapKey);
}
break;
default:
break;
}
}
return set.stream().map(r -> {
ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO();
expertRegionDTO.setRegionCode(r.getRegionCode());
expertRegionDTO.setRegionLevel(r.getRegionLevel());
return expertRegionDTO;
}).collect(Collectors.toList());
}

private static List<ExpertAvoidCompanyDTO> buildExpertAvoidCompanyDTOList(List<ExpertAvoidCompany> expertAvoidCompanyList) {
return expertAvoidCompanyList.stream().map(r -> {
ExpertAvoidCompanyDTO expertAvoidCompanyDTO = new ExpertAvoidCompanyDTO();
expertAvoidCompanyDTO.setCompanyUniqCode(r.getCompanyUniqCode());
expertAvoidCompanyDTO.setCompanyName(r.getCompanyName());
return expertAvoidCompanyDTO;
}).collect(Collectors.toList());
}

private static List<ExpertRegionDTO> buildExpertIntentionWorkRegionInfo(List<ExpertIntentionWorkRegion> expertIntentionWorkRegionList) {
return expertIntentionWorkRegionList.stream().map(r -> {
ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO();
expertRegionDTO.setRegionLevel(r.getRegionLevel());
expertRegionDTO.setRegionCode(r.getRegionCode());
return expertRegionDTO;
}).collect(Collectors.toList());
}

private static List<ExpertTagDTO> buildExpertTagDTOList(List<ExpertTag> expertTagList) {
return expertTagList.stream().map(r -> {
ExpertTagDTO expertTagDTO = new ExpertTagDTO();
expertTagDTO.setExpertInfoField(r.getExpertInfoField());
expertTagDTO.setTagCode(r.getTagCode());
return expertTagDTO;
}).collect(Collectors.toList());
}

private static List<ExpertDictionaryDTO> buildExpertDictionaryDTOList(List<ExpertDictionary> expertDictionaryList) {
return expertDictionaryList.stream().map(r -> {
ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO();
expertDictionaryDTO.setExpertInfoField(r.getExpertInfoField());
expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode());
return expertDictionaryDTO;
}).collect(Collectors.toList());
}

public static ExpertUserFullInfoDTO buildExpertUserFullInfoDTO(ExpertUserFullInfo expertUserFullInfo) {
ExpertUserFullInfoDTO expertUserFullInfoDTO = new ExpertUserFullInfoDTO();
expertUserFullInfoDTO.setIsDingUser(BoolDisplayEnum.judgeBoolean(expertUserFullInfo.getIsDingUser()));
expertUserFullInfoDTO.setPhoneNo(expertUserFullInfo.getPhoneNo());
expertUserFullInfoDTO.setGender(expertUserFullInfo.getGender());
expertUserFullInfoDTO.setName(expertUserFullInfo.getExpertName());
expertUserFullInfoDTO.setAvatarFileId(expertUserFullInfo.getAvatarFileId());
expertUserFullInfoDTO.setIdCard(expertUserFullInfo.getIdCard());
expertUserFullInfoDTO.setOfficePhone(expertUserFullInfo.getOfficePhone());
expertUserFullInfoDTO.setBirth(expertUserFullInfo.getBirth());
expertUserFullInfoDTO.setBankNo(expertUserFullInfo.getBankNo());
expertUserFullInfoDTO.setBank(expertUserFullInfo.getBank());
expertUserFullInfoDTO.setEmail(expertUserFullInfo.getEmail());
expertUserFullInfoDTO.setHometown(expertUserFullInfo.getHometown());
expertUserFullInfoDTO.setNationality(expertUserFullInfo.getNationality());

expertUserFullInfoDTO.setSchool(expertUserFullInfo.getSchool());
expertUserFullInfoDTO.setGraduatedAt(expertUserFullInfo.getGraduatedAt());
expertUserFullInfoDTO.setAcademicTitle(expertUserFullInfo.getAcademicTitle());
if (StringUtils.isNotBlank(expertUserFullInfo.getGraduationCertificateFileIdList())) {
expertUserFullInfoDTO.setGraduationCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getGraduationCertificateFileIdList(), Long.class));
}
if (StringUtils.isNotBlank(expertUserFullInfo.getDegreeCertificateFileIdList())) {
expertUserFullInfoDTO.setDegreeCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getDegreeCertificateFileIdList(), Long.class));
}
expertUserFullInfoDTO.setRetiredAt(expertUserFullInfo.getRetiredAt());
expertUserFullInfoDTO.setCompany(expertUserFullInfo.getCompany());
// expertUserFullInfoDTO.setCompanyUniqCode(expertUserFullInfo.getCompanyUniqCode());
expertUserFullInfoDTO.setLegalEntityCode(expertUserFullInfo.getLegalEntityCode());
expertUserFullInfoDTO.setAdministrativeDuties(expertUserFullInfo.getAdministrativeDuties());
expertUserFullInfoDTO.setStartWorkAt(expertUserFullInfo.getStartWorkAt());
expertUserFullInfoDTO.setAddress(expertUserFullInfo.getAddress());
expertUserFullInfoDTO.setExperience(expertUserFullInfo.getExperience());

expertUserFullInfoDTO.setTechnicalTitles(expertUserFullInfo.getTechnicalTitles());
if (StringUtils.isNotBlank(expertUserFullInfo.getTitleCertificateFileIdList())) {
expertUserFullInfoDTO.setTitleCertificateFileIdList(JSONObject.parseArray(expertUserFullInfo.getTitleCertificateFileIdList(), Long.class));
}
expertUserFullInfoDTO.setAwards(expertUserFullInfo.getAwards());
expertUserFullInfoDTO.setRecognitionReward(expertUserFullInfo.getRecognitionReward());

expertUserFullInfoDTO.setRegionCode(expertUserFullInfo.getRegionCode());
expertUserFullInfoDTO.setRegionLevel(expertUserFullInfo.getRegionLevel());

if (StringUtils.isNotBlank(expertUserFullInfo.getRecommendationProofFileIdList())) {
expertUserFullInfoDTO.setRecommendationProofFileIdList(JSONObject.parseArray(expertUserFullInfo.getRecommendationProofFileIdList(), Long.class));
}
expertUserFullInfoDTO.setRemark(expertUserFullInfo.getRemark());

return expertUserFullInfoDTO;
}

// public static ExpertAdminExpertManageListDTO buildExpertAdminExpertManageListDTO(ExpertUserFullInfo expertUserFullInfo
// , Map<Long, List<ExpertDictionary>> expertDictionaryMap, Map<Long, List<ExpertTag>> expertTagMap) {
// Long userId = expertUserFullInfo.getUserId();
// ExpertAdminExpertManageListDTO expertAdminExpertManageListDTO = new ExpertAdminExpertManageListDTO();
// expertAdminExpertManageListDTO.setUserId(expertUserFullInfo.getUserId());
// expertAdminExpertManageListDTO.setExpertName(expertUserFullInfo.getName());
// expertAdminExpertManageListDTO.setPhoneNo(expertUserFullInfo.getPhoneNo());
// expertAdminExpertManageListDTO.setIsDingUser(BoolDisplayEnum.judgeBoolean(expertUserFullInfo.getIsDingUser()));
// expertAdminExpertManageListDTO.setCompany(expertUserFullInfo.getCompany());
// expertAdminExpertManageListDTO.setLegalEntityCode(expertUserFullInfo.getLegalEntityCode());
// expertAdminExpertManageListDTO.setExpertAccountStatus(expertUserFullInfo.getExpertAccountStatus());
//
// // 装配字典数据
// List<ExpertDictionary> userExpertDictionaryList = Objects.isNull(expertDictionaryMap.get(userId)) ? new ArrayList<>() : expertDictionaryMap.get(userId);
// Map<String, List<ExpertDictionary>> fieldExpertDictionaryMap = userExpertDictionaryList.stream().collect(Collectors.groupingBy(ExpertDictionary::getExpertInfoField));
// expertAdminExpertManageListDTO.setExpertType(
// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())));
// expertAdminExpertManageListDTO.setCompanyAttribute(
// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE.getKey())));
// expertAdminExpertManageListDTO.setTitleLevel(
// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.TITLE_LEVEL.getKey())));
// // 装配标签数据
// List<ExpertTag> expertTagList = Objects.isNull(expertTagMap.get(userId)) ? new ArrayList<>() : expertTagMap.get(userId);
// Map<String, List<ExpertTag>> fieldExpertTagMap = expertTagList.stream().collect(Collectors.groupingBy(ExpertTag::getExpertInfoField));
// expertAdminExpertManageListDTO.setExpertSource(
// TagAssembler.toTagFieldInfoList(fieldExpertTagMap.get(ExpertTagEnum.EXPERT_SOURCE.getKey())));
//
// if (StringUtils.isNotBlank(expertUserFullInfo.getRegionCode()) && Objects.nonNull(expertUserFullInfo.getRegionLevel())) {
// ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo();
// expertRegionInfo.setRegionLevel(expertUserFullInfo.getRegionLevel());
// expertRegionInfo.setRegionCode(expertUserFullInfo.getRegionCode());
// expertAdminExpertManageListDTO.setExpertRegionInfo(expertRegionInfo);
// }
//
// // 以下数据为专家excel导出使用
// expertAdminExpertManageListDTO.setGender(expertUserFullInfo.getGender());
// expertAdminExpertManageListDTO.setBirth(expertUserFullInfo.getBirth());
// expertAdminExpertManageListDTO.setHometown(expertUserFullInfo.getHometown());
// expertAdminExpertManageListDTO.setNationality(expertUserFullInfo.getNationality());
// expertAdminExpertManageListDTO.setPolitical(
// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.POLITICAL.getKey())));
// expertAdminExpertManageListDTO.setIdCard(expertUserFullInfo.getIdCard());
// expertAdminExpertManageListDTO.setBankNo(expertUserFullInfo.getBankNo());
// expertAdminExpertManageListDTO.setEdu(
// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.EDU.getKey())));
// expertAdminExpertManageListDTO.setRecommendedWay(
// DictionaryAssembler.toDictionaryFieldInfoList(fieldExpertDictionaryMap.get(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey())));
// return expertAdminExpertManageListDTO;
//
// }


}

+ 39
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/RegionWrapperAssembler.java Bestand weergeven

@@ -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<ExpertUserFullInfo> wrapperQuery, List<RegionContainsBO> containsRegionList) {
for (RegionContainsBO regionContainsBO : containsRegionList) {
List<String> 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<ExpertMetaApply> wrapperQuery, List<RegionContainsBO> containsRegionList) {
for (RegionContainsBO regionContainsBO : containsRegionList) {
List<String> containsRegionCodeList = regionContainsBO.getContainsRegionCodeList();
Integer parentRegionTreeLevel = regionContainsBO.getParentRegionTreeLevel();
if (CollectionUtils.isNotEmpty(containsRegionCodeList)) {
wrapperQuery.and(wrapper -> wrapper.in(ExpertMetaApply::getRegionCode, containsRegionCodeList)
.ge(ExpertMetaApply::getRegionLevel, parentRegionTreeLevel));
}
}
}
}

+ 45
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyStatusEnum.java Bestand weergeven

@@ -0,0 +1,45 @@
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:38
*/
@AllArgsConstructor
@Getter
public enum ExpertApplyStatusEnum {

// 待审核
PENDING_REVIEW("pending_review"),
// 审核通过
PASSED("passed"),
// 审核不通过
REFUSED("refused"),
// 已撤销
REVOKED("revoked");
private final String key;

public static boolean contains(String key) {
if (StringUtils.isBlank(key)) {
return false;
}
for (ExpertApplyStatusEnum statusEnum : ExpertApplyStatusEnum.values()) {
if (statusEnum.key.equals(key)) {
return true;
}
}
return false;
}

public static ExpertApplyStatusEnum of(String key) {
for (ExpertApplyStatusEnum statusEnum : ExpertApplyStatusEnum.values()) {
if (statusEnum.key.equals(key)) {
return statusEnum;
}
}
throw new IllegalArgumentException(String.format("Illegal ExpertApplyStatusEnum = %s", key));
}
}

+ 52
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeEnum.java Bestand weergeven

@@ -0,0 +1,52 @@
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 ExpertApplyTypeEnum {

// 专家入库
EXPERT_STORAGE("expert_storage"),
// 专家出库
EXPERT_DELIVERY("expert_delivery"),
// 专家履职意向加入
EXPERT_INTENTION_JOIN("expert_intention_join"),
// 专家履职意向退出
EXPERT_INTENTION_LEAVE("expert_intention_leave"),
// 长期请假申请
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 (ExpertApplyTypeEnum typeEnum : ExpertApplyTypeEnum.values()) {
if (typeEnum.key.equals(key)) {
return true;
}
}
return false;
}

public static ExpertApplyTypeEnum of(String key) {
for (ExpertApplyTypeEnum typeEnum : ExpertApplyTypeEnum.values()) {
if (typeEnum.key.equals(key)) {
return typeEnum;
}
}
throw new IllegalArgumentException(String.format("IllegalExpertApplyTypeEnum = %s", key));
}

}

+ 50
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertApplyTypeQueryEnum.java Bestand weergeven

@@ -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));
}

}

+ 49
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/QueryExpertAccountStatusEnum.java Bestand weergeven

@@ -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));
}
}

+ 0
- 20
pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java Bestand weergeven

@@ -1,20 +0,0 @@
package com.ningdatech.pmapi.expert.controller;


import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;

/**
* <p>
* 前端控制器
* </p>
*
* @author Liuxinxin
* @since 2023-02-23
*/
@Controller
@RequestMapping("/pmapi.expert/expert-avoid-company")
public class ExpertAvoidCompanyController {

}

+ 26
- 4
pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java Bestand weergeven

@@ -1,15 +1,18 @@
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;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@@ -28,6 +31,7 @@ import javax.validation.Valid;
public class ExpertController {

private final ExpertManage expertManage;
private final ExpertAdminManage expertAdminManage;

@PostMapping("/basic-info-submit")
@ApiOperation("填写基本信息接口(专家报名使用))")
@@ -36,5 +40,23 @@ public class ExpertController {
expertManage.expertBasicInfoSubmit(request);
}

@PostMapping("/recommend-proof-submit")
@ApiOperation("推荐证明提交接口(专家报名使用)")
public void expertRecommendProofSubmit(@Valid @RequestBody ExpertRecommendProofSubmitRequest request) {
expertManage.expertRecommendProofSubmit(request);
}

@GetMapping("/detail")
@ApiOperation("专家获取专家详细信息")
public ExpertFullInfoVO getExpertFullInfoDetail() {
return expertManage.getExpertFullInfoDetail(null);
}

@PostMapping("/expert-library/list")
@ApiOperation("专家库列表查询接口")
public PageVo<ExpertAdminExpertManageListVO> getExpertLibraryList(
@RequestBody @Valid ExpertAdminExpertManageQuery expertAdminExpertManageQuery) {
return expertAdminManage.getExpertLibraryList(expertAdminExpertManageQuery);
}

}

+ 0
- 20
pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertIntentionWorkRegionController.java Bestand weergeven

@@ -1,20 +0,0 @@
package com.ningdatech.pmapi.expert.controller;


import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;

/**
* <p>
* 前端控制器
* </p>
*
* @author Liuxinxin
* @since 2023-02-22
*/
@Controller
@RequestMapping("/pmapi.expert/expert-intention-work-region")
public class ExpertIntentionWorkRegionController {

}

+ 61
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertMetaApplyController.java Bestand weergeven

@@ -0,0 +1,61 @@
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* <p>
* 前端控制器
* </p>
*
* @author Liuxinxin
* @since 2023-03-01
*/
@RestController
@RequestMapping("/api/v1/apply/meta/")
@Validated
@RequiredArgsConstructor
@Api(value = "ExpertMetaApplyController", tags = "专家申请管理相关接口")
public class ExpertMetaApplyController {

private final ExpertMetaApplyManage expertMetaApplyManage;

@PostMapping("/list")
@ApiOperation(value = "审核列表筛选")
public PageVo<ExpertApplyMetaVO> 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);
}


}

+ 61
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertMetaApply.java Bestand weergeven

@@ -0,0 +1,61 @@
package com.ningdatech.pmapi.expert.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
*
* </p>
*
* @author Liuxinxin
* @since 2023-03-01
*/
@TableName("expert_meta_apply")
@ApiModel(value = "ExpertMetaApply对象", description = "")
@Data
public class ExpertMetaApply implements Serializable {

private static final long serialVersionUID = 1L;

@TableId(type = IdType.AUTO)
private Long id;

private LocalDateTime createOn;

private LocalDateTime updateOn;

private Long createBy;

private Long updateBy;

private String applyType;

private Long userId;

private Long approverUserId;

private String applyStatus;

private LocalDateTime reviewTime;

private String auditOpinion;

private String regionCode;

private String approver;

private Integer regionLevel;

private Long applicantId;

private String extraMaterial;

private String displayEnable;
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java Bestand weergeven

@@ -11,7 +11,7 @@ import java.time.LocalDateTime;

/**
* <p>
*
*
* </p>
*
* @author Liuxinxin


+ 46
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertInfoCommonHelper.java Bestand weergeven

@@ -0,0 +1,46 @@
package com.ningdatech.pmapi.expert.helper;

import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO;
import com.ningdatech.pmapi.expert.model.dto.ExpertUserFullInfoDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
* @author liuxinxin
* @date 2022/7/28 上午10:18
*/
@Component
public class ExpertInfoCommonHelper {

/**
* 获取专家的所有文件id
* 头像,学位证书,毕业证书,推荐证明材料,职称证明
*
* @param expertUserFullInfoAll
* @return
*/
public List<Long> getExpertFileIdList(ExpertFullInfoAllDTO expertUserFullInfoAll) {
ExpertUserFullInfoDTO expertUserInfoDTO = expertUserFullInfoAll.getExpertUserInfoDTO();
List<Long> fileIdList = new ArrayList<>();
if (Objects.nonNull(expertUserInfoDTO.getAvatarFileId())) {
fileIdList.add(expertUserInfoDTO.getAvatarFileId());
}
if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getDegreeCertificateFileIdList())) {
fileIdList.addAll(expertUserInfoDTO.getDegreeCertificateFileIdList());
}
if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getGraduationCertificateFileIdList())) {
fileIdList.addAll(expertUserInfoDTO.getGraduationCertificateFileIdList());
}
if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getRecommendationProofFileIdList())) {
fileIdList.addAll(expertUserInfoDTO.getRecommendationProofFileIdList());
}
if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getTitleCertificateFileIdList())) {
fileIdList.addAll(expertUserInfoDTO.getTitleCertificateFileIdList());
}
return fileIdList;
}
}

+ 142
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertAdminManage.java Bestand weergeven

@@ -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<ExpertAdminExpertManageListVO> getExpertLibraryList(ExpertAdminExpertManageQuery query) {
Long userId = LoginUserUtil.getUserId();
ExpertAdminExpertManageQueryCmd expertAdminExpertManageQueryCmd = buildExpertAdminExpertManageQueryCmd(query, userId);
// CommonPage<ExpertAdminExpertManageListDTO> pageResult =
// expertAdminManageService.getExpertLibraryList(expertAdminExpertManageQueryCmd);
//
// PageVo<ExpertAdminExpertManageListVO> 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<ExpertDictionaryQuery> 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<ExpertTagQuery> 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<RegionContainsBO> expertAdminContainsRegionList = new ArrayList<>();

// 如果为超级管理员,可以查看所有的专家,包括没有层级的专家
if (!permissionCheckHelper.isSuperAdmin()) {
expertAdminContainsRegionList = regionLimitHelper.getExpertAdminContainsRegion(userId);
}
List<RegionContainsBO> 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;
}

}

+ 65
- 6
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java Bestand weergeven

@@ -1,25 +1,36 @@
package com.ningdatech.pmapi.expert.manage;

import com.ningdatech.basic.exception.BizException;
import com.ningdatech.file.entity.vo.result.AttachFileVo;
import com.ningdatech.file.service.FileService;
import com.ningdatech.pmapi.expert.assembler.ExpertInfoCmdAssembler;
import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler;
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum;
import com.ningdatech.pmapi.expert.constant.ExpertUserInfoStepEnum;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.helper.ExpertInfoCommonHelper;
import com.ningdatech.pmapi.expert.helper.ExpertManageHelper;
import com.ningdatech.pmapi.expert.model.ExpertBasicInfo;
import com.ningdatech.pmapi.expert.model.ExpertEduInfo;
import com.ningdatech.pmapi.expert.model.ExpertJobInfo;
import com.ningdatech.pmapi.expert.model.ExpertProfessionalInfo;
import com.ningdatech.pmapi.expert.model.*;
import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd;
import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd;
import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO;
import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO;
import com.ningdatech.pmapi.expert.model.req.ExpertRecommendProofSubmitRequest;
import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest;
import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO;
import com.ningdatech.pmapi.expert.service.ExpertInfoService;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum;
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @author liuxinxin
@@ -31,10 +42,11 @@ import java.util.Objects;
public class ExpertManage {

private final ExpertManageHelper expertManageHelper;

private final IExpertUserFullInfoService iExpertUserFullInfoService;

private final ExpertInfoService expertInfoService;
private final ExpertInfoCommonHelper expertInfoCommonHelper;
private final FileService fileService;
private final ExpertUserInfoAssembler expertUserInfoAssembler;


/**
@@ -75,4 +87,51 @@ public class ExpertManage {
}


public void expertRecommendProofSubmit(ExpertRecommendProofSubmitRequest request) {
// 用户id
Long expertUserId = LoginUserUtil.getUserId();
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId);
// 判断专家状态,是否可以进行证明材料提交
if (Objects.isNull(expertUserFullInfo)
|| !ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus())
|| ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep())) {
throw new BizException("当前状态无法提交证明材料");
}
// 根据用户id 获取用户信息,获取手机号校验 验证码是否正确
String phoneNo = expertUserFullInfo.getPhoneNo();
String verificationCode = request.getVerificationCode();

// 证明材料提交
List<FileBasicInfo> recommendProofFile = request.getRecommendProofFile();
List<DictionaryFieldInfo> recommendedWayList = request.getRecommendedWay();
ExpertRecommendProofSaveCmd expertRecommendProofSaveCmd = new ExpertRecommendProofSaveCmd();
if (CollectionUtils.isNotEmpty(recommendProofFile)) {
expertRecommendProofSaveCmd.setRecommendationProofFileIdList(recommendProofFile.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList()));
}
List<ExpertDictionaryDTO> recommendedWayDictionaryDTOList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(recommendedWayList)) {
recommendedWayDictionaryDTOList = recommendedWayList.stream().map(r -> {
ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO();
expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode());
expertDictionaryDTO.setExpertInfoField(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey());
return expertDictionaryDTO;
}).collect(Collectors.toList());
}
expertRecommendProofSaveCmd.setRecommendedWay(recommendedWayDictionaryDTOList);
expertRecommendProofSaveCmd.setUserId(expertUserId);
expertInfoService.expertRecommendProofSave(expertRecommendProofSaveCmd);
}

public ExpertFullInfoVO getExpertFullInfoDetail(Long expertUserId) {
Long currentUserId = LoginUserUtil.getUserId();
if (Objects.isNull(expertUserId)) {
expertUserId = currentUserId;
}
ExpertFullInfoAllDTO expertUserFullInfoAll = expertInfoService.getExpertUserFullInfoAll(expertUserId);
if (Objects.isNull(expertUserFullInfoAll)) {
return null;
}
List<Long> fileIdList = expertInfoCommonHelper.getExpertFileIdList(expertUserFullInfoAll);
List<AttachFileVo> attachFiles = fileService.getByIds(fileIdList);
return expertUserInfoAssembler.buildExpertFullInfoVO(attachFiles, expertUserFullInfoAll); }
}

+ 527
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java Bestand weergeven

@@ -0,0 +1,527 @@
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.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.model.ExpertRegionInfo;
import com.ningdatech.pmapi.meta.model.bo.RegionContainsBO;
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO;
import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary;
import com.ningdatech.pmapi.meta.service.IExpertDictionaryService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import 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 IExpertUserFullInfoService userFullInfoService;
private final DictionaryCache dictionaryCache;

private final ExpertInfoService expertInfoService;

private final UserInfoHelper userInfoHelper;

private final RegionLimitHelper regionLimitHelper;


public PageVo<ExpertApplyMetaVO> metaApplyListQuery(MetaApplyListQuery req) {
Long expertAdminUserId = LoginUserUtil.getUserId();
// 查找符合专家条件的用户id
List<RegionContainsBO> viewRegions = regionLimitHelper.getExpertAdminContainsRegion(expertAdminUserId);
ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(req, viewRegions);
// TODO
// List<Long> filterExpertUserIdList = expertAdminManageService.filterExpertUserIdList(queryCmd);
List<Long> filterExpertUserIdList = new ArrayList<>();
if (CollUtil.isEmpty(filterExpertUserIdList)) {
return PageVo.empty();
}

LambdaQueryWrapper<ExpertMetaApply> expertMetaApplyListQuery =
buildMetaApplyListQueryWrapper(req, filterExpertUserIdList, viewRegions);

RegionWrapperAssembler.expertMetaApplyRegionContainsWrapperAssembler(expertMetaApplyListQuery, viewRegions);
Page<ExpertMetaApply> pageResult = iMetaApplyService.page(req.page(), expertMetaApplyListQuery);
PageVo<ExpertApplyMetaVO> result = new PageVo<>();
result.setTotal(pageResult.getTotal());
BizUtils.notEmpty(pageResult.getRecords(), records -> {
List<Long> expertIds = CollUtils.fieldList(records, ExpertMetaApply::getUserId);
// 根据用户id 获取专家基本信息
List<ExpertUserFullInfo> expertList = userFullInfoService.listByUserIds(expertIds);
Map<Long, ExpertUserFullInfo> expertMap = CollUtils.listToMap(expertList, ExpertUserFullInfo::getUserId);
List<ExpertDictionary> expertDictList = expertDictionaryService.listByUserId(expertIds, DictExpertInfoTypeEnum.TITLE_LEVEL);
Map<Long, List<ExpertDictionary>> 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<ExpertMetaApply> 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<Long> fileIdList = CollUtils.fieldList(list, FileBasicInfo::getFileId);
// List<AttachFileVo> attachFiles = fileService.getByIds(fileIdList);
// List<FileBasicInfo> 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<ExpertSensitiveInfoModifyDetailRecord> 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<SensitiveModifySegment> sensitiveModifySegments = JSONUtils.parseArray(originalJson, SensitiveModifySegment.class);
//
// infoModifyApplyDisplayVo.setExpertApplyId(metaApplyId);
// List<InfoModifyApplyDisplayVO.InfoModifyApplyDisplayValue> 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<String> applyTypeTrans(ExpertApplyTypeQueryEnum applyTypeQueryEnum) {
List<String> 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<RegionContainsBO> 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<ExpertDictionaryQuery> 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<RegionContainsBO> 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<ExpertApplyMetaVO> buildExpertApplyMetaVOList(List<ExpertMetaApply> expertMetaApplyList
, Map<Long, ExpertUserFullInfo> expertUserFullInfoMap
, Map<Long, List<ExpertDictionary>> expertDictionaryListMap) {
List<ExpertApplyMetaVO> expertApplyMetaVOList = new ArrayList<>();
for (ExpertMetaApply expertMetaApply : expertMetaApplyList) {
ExpertApplyMetaVO expertApplyMetaVO = new ExpertApplyMetaVO();
Long userId = expertMetaApply.getUserId();
ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoMap.get(userId);
expertApplyMetaVO.setId(expertMetaApply.getId());
expertApplyMetaVO.setUserId(userId);
expertApplyMetaVO.setApplyStatus(expertMetaApply.getApplyStatus());

String applyType = expertMetaApply.getApplyType();
if (Objects.nonNull(applyType)) {
expertApplyMetaVO.setApplyType(applyTypeTrans(ExpertApplyTypeEnum.of(applyType)));
}
expertApplyMetaVO.setName(expertUserFullInfo.getExpertName());

// RegionDTO regionDTO = regionCache.getByCodeAndLevel(expertUserFullInfo.getRegionCode(), expertUserFullInfo.getRegionLevel());
ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo();
expertRegionInfo.setRegionCode(expertUserFullInfo.getRegionCode());
expertRegionInfo.setRegionLevel(expertUserFullInfo.getRegionLevel());
// expertRegionInfo.setRegionName(regionDTO.getRegionName());
expertApplyMetaVO.setExpertRegionInfo(expertRegionInfo);

List<ExpertDictionary> 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<ExpertMetaApply> buildMetaApplyListQueryWrapper(MetaApplyListQuery applyListReq,
List<Long> expertIdList,
List<RegionContainsBO> viewRegions) {
// 审核类型
List<String> applyTypeList = new ArrayList<>();
if (CollUtil.isNotEmpty(applyListReq.getApplyTypeList())) {
List<ExpertApplyTypeQueryEnum> applyTypeQueryEnumList = applyListReq.getApplyTypeList();
for (ExpertApplyTypeQueryEnum applyTypeQueryEnum : applyTypeQueryEnumList) {
applyTypeList.addAll(applyTypeTrans(applyTypeQueryEnum));
}
}
// 审核结果
List<String> applyStatusList = new ArrayList<>();
if (CollUtil.isNotEmpty(applyListReq.getApplyStatusList())) {
applyStatusList = CollUtils.fieldList(applyListReq.getApplyStatusList(), ExpertApplyStatusEnum::getKey);
;
}

LocalDateTime applyStartTime = applyListReq.getApplyStartTime();
LocalDateTime applyEndTime = applyListReq.getApplyEndTime();

// 不展示撤回的申请记录
LambdaQueryWrapper<ExpertMetaApply> 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<DictionaryFieldInfo> 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<TagFieldInfo> 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;
}

}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertMetaApplyMapper.java Bestand weergeven

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.expert.mapper;

import com.ningdatech.pmapi.expert.entity.ExpertMetaApply;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* Mapper 接口
* </p>
*
* @author Liuxinxin
* @since 2023-03-01
*/
public interface ExpertMetaApplyMapper extends BaseMapper<ExpertMetaApply> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertMetaApplyMapper.xml Bestand weergeven

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.pmapi.expert.mapper.ExpertMetaApplyMapper">

</mapper>

+ 48
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAdminExpertManageQuery.java Bestand weergeven

@@ -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;

}

+ 29
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExtraMaterialDO.java Bestand weergeven

@@ -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<FileBasicInfo> evidenceList;
}

+ 41
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/RegionDtoMapKey.java Bestand weergeven

@@ -0,0 +1,41 @@
package com.ningdatech.pmapi.expert.model;

import lombok.Data;

import java.util.Objects;

/**
* @author liuxinxin
* @date 2022/7/22 上午10:07
*/
@Data
public class RegionDtoMapKey {

/**
* 区域码
*/
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;
}
RegionDtoMapKey regionDtoMapKey = (RegionDtoMapKey) o;
return regionCode.equals(regionDtoMapKey.getRegionCode()) &&
regionLevel.equals(regionDtoMapKey.getRegionLevel());
}

@Override
public int hashCode() {
return Objects.hash(regionCode, regionLevel);
}
}

+ 37
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/AdminModifyExpertInfoCmd.java Bestand weergeven

@@ -0,0 +1,37 @@
//package com.ningdatech.pmapi.expert.model.cmd;
//
//import com.ningdatech.emapi.expert.entity.bo.ExpertInfoSensitiveFieldCheckBO;
//import com.ningdatech.emapi.expert.entity.dto.*;
//import lombok.Data;
//
//import java.util.List;
//
///**
// * @author liuxinxin
// * @date 2022/7/28 下午2:43
// */
//@Data
//public class AdminModifyExpertInfoCmd {
//
// private Long userId;
//
// private ExpertUserFullInfoDTO expertUserInfoDTO;
//
// private List<ExpertDictionaryDTO> expertDictionaryList;
//
// private List<ExpertTagDTO> expertTagList;
//
// /**
// * 专家履职意向(区域编码)
// */
// private List<ExpertRegionDTO> expertIntentionWorkRegionInfo;
//
// /**
// * 回避单位列表
// */
// private List<ExpertAvoidCompanyDTO> expertAvoidCompanyList;
//
// private ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO;
//
// private ModifyApplyExtraInfoDTO modifyApplyExtraInfo;
//}

+ 62
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertAdminExpertManageQueryCmd.java Bestand weergeven

@@ -0,0 +1,62 @@
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<ExpertAccountStatusEnum> expertAccountStatusList;

/**
* 区域编码
*/
@ApiModelProperty("区域编码")
private String regionCode;

/**
* 区域级别
*/
@ApiModelProperty("区域级别")
private Integer regionLevel;

/**
* 专家管理区域范围
*/
List<RegionContainsBO> regionContainsList;

/**
* 专家字典信息
*/
private List<ExpertDictionaryQuery> expertDictionaryQueryList;

/**
* 专家标签信息
*/
private List<ExpertTagQuery> expertTagQueryList;

/**
* 是否为钉用户
*/
private Boolean isDingUser;

}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertDeliveryDealCmd.java Bestand weergeven

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.expert.model.cmd;

import lombok.Data;

/**
* @author liuxinxin
* @date 2022/7/26 下午6:28
* 专家出库审核处理cmd
*/
@Data
public class ExpertDeliveryDealCmd {

private Long expertUserId;

private Boolean applyResult;
}

+ 18
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyApplyDealCmd.java Bestand weergeven

@@ -0,0 +1,18 @@
package com.ningdatech.pmapi.expert.model.cmd;

import lombok.Data;

/**
* @author liuxinxin
* @date 2022/7/28 下午5:35
*/
@Data
public class ExpertInfoModifyApplyDealCmd {

private Long expertUserId;

private Boolean applyResult;

private Long applyId;

}

+ 37
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertInfoModifyCmd.java Bestand weergeven

@@ -0,0 +1,37 @@
//package com.ningdatech.pmapi.expert.model.cmd;
//
//import com.ningdatech.emapi.expert.entity.bo.ExpertInfoSensitiveFieldCheckBO;
//import com.ningdatech.emapi.expert.entity.dto.*;
//import lombok.Data;
//
//import java.util.List;
//
///**
// * @author liuxinxin
// * @date 2022/7/28 下午2:43
// */
//@Data
//public class ExpertInfoModifyCmd {
//
// private Long userId;
//
// private ExpertUserFullInfoDTO expertUserInfoDTO;
//
// private List<ExpertDictionaryDTO> expertDictionaryList;
//
// private List<ExpertTagDTO> expertTagList;
//
// /**
// * 专家履职意向(区域编码)
// */
// private List<ExpertRegionDTO> expertIntentionWorkRegionInfo;
//
// /**
// * 回避单位列表
// */
// private List<ExpertAvoidCompanyDTO> expertAvoidCompanyList;
//
// private ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO;
//
// private ModifyApplyExtraInfoDTO modifyApplyExtraInfo;
//}

+ 22
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertIntentionApplyDealCmd.java Bestand weergeven

@@ -0,0 +1,22 @@
//package com.ningdatech.pmapi.expert.model.cmd;
//
//import com.ningdatech.emapi.expert.constants.ExpertApplyTypeEnum;
//import lombok.Data;
//
///**
// * @author liuxinxin
// * @date 2022/7/27 上午9:06
// */
//@Data
//public class ExpertIntentionApplyDealCmd {
//
// private Long expertUserId;
//
// private Boolean applyResult;
//
// ExpertApplyTypeEnum applyTypeEnum;
//
// private String expertRegionCode;
//
// private Integer expertRegionLevel;
//}

+ 22
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertRecommendProofSaveCmd.java Bestand weergeven

@@ -0,0 +1,22 @@
package com.ningdatech.pmapi.expert.model.cmd;

import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO;
import lombok.Data;

import java.util.List;

/**
* @author liuxinxin
* @date 2022/7/25 下午4:59
*/
@Data
public class ExpertRecommendProofSaveCmd {


private Long userId;

private List<Long> recommendationProofFileIdList;

private List<ExpertDictionaryDTO> recommendedWay;

}

+ 36
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertStorageDealCmd.java Bestand weergeven

@@ -0,0 +1,36 @@
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<ExpertDictionaryDTO> expertType;

/**
* 其他标签(标签code)
*/
private List<ExpertTagDTO> other;

private String remark;
}

+ 46
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/MetaApplyListQuery.java Bestand weergeven

@@ -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<ExpertApplyTypeQueryEnum> applyTypeList;

@ApiModelProperty("审核结果")
private List<ExpertApplyStatusEnum> 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;

}

+ 60
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/SaveExpertAdminCmd.java Bestand weergeven

@@ -0,0 +1,60 @@
//package com.ningdatech.pmapi.expert.model.cmd;
//
//import com.ningdatech.emapi.expert.entity.dto.ExpertAdminRegionDTO;
//import lombok.Data;
//
//import java.util.List;
//
///**
// * @author liuxinxin
// * @date 2022/8/1 上午10:54
// */
//@Data
//public class SaveExpertAdminCmd {
//
// /**
// * 用户id
// */
// private Long userId;
//
// /**
// * 是否浙政钉用户Y/N
// */
// private Boolean isDingUser;
//
// /**
// * 手机号
// */
// private String phoneNo;
//
// /**
// * 用户名称
// */
// private String name;
//
// /**
// * 工作单位
// */
// private String company;
//
// /**
// * 公司唯一标识
// */
// private String companyUniqCode;
//
// /**
// * 层级
// */
// private List<ExpertAdminRegionDTO> regionInfoList;
//
// /**
// * 用户状态(启用/关闭)
// */
// private Boolean isEnable;
//
// /**
// * 操作者id
// */
// private Long operatorId;
//
//}

+ 39
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertFullInfoAllDTO.java Bestand weergeven

@@ -0,0 +1,39 @@
package com.ningdatech.pmapi.expert.model.dto;

import lombok.Data;

import java.util.List;

/**
* @author liuxinxin
* @date 2022/7/27 上午10:22
* 专家全量信息表,包含履职意向,专家字典信息,专家标签信息,回避单位信息
*/
@Data
public class ExpertFullInfoAllDTO {

private Long userId;

private ExpertUserFullInfoDTO expertUserInfoDTO;

private List<ExpertDictionaryDTO> expertDictionaryList;

private List<ExpertTagDTO> expertTagList;

/**
* 专家履职意向(区域编码)
*/
private List<ExpertRegionDTO> expertIntentionWorkRegionInfo;

/**
* 专家申请履职意向展示列表
*/
private List<ExpertRegionDTO> expertApplyIntentionWorkRegionInfo;

/**
* 回避单位列表
*/
private List<ExpertAvoidCompanyDTO> expertAvoidCompanyList;


}

+ 17
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertDictionaryQuery.java Bestand weergeven

@@ -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<String> dictionaryCodeList;
}

+ 17
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ExpertTagQuery.java Bestand weergeven

@@ -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<String> tagCodeList;
}

+ 59
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/query/ListExpertQuery.java Bestand weergeven

@@ -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<String> expertAccountStatusList;

/**
* 区域编码
*/
private String regionCode;

/**
* 区域级别
*/
private Integer regionLevel;

/**
* 专家管理区域范围
*/
List<RegionContainsBO> regionContainsList;

/**
* 专家字典信息
*/
private List<ExpertDictionaryQuery> expertDictionaryQueryList;

/**
* 专家标签信息
*/
private List<ExpertTagQuery> expertTagQueryList;

private Boolean isDingUser;
}

+ 31
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRecommendProofSubmitRequest.java Bestand weergeven

@@ -0,0 +1,31 @@
package com.ningdatech.pmapi.expert.model.req;

import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo;
import com.ningdatech.pmapi.expert.model.FileBasicInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
* @author liuxinxin
* @date 2022/7/22 下午5:49
*/
@Data
@ApiModel("专家证明材料提交Request")
public class ExpertRecommendProofSubmitRequest {

@NotEmpty
@ApiModelProperty("推荐方式")
private List<DictionaryFieldInfo> recommendedWay;

@ApiModelProperty("推荐证明材料")
private List<FileBasicInfo> recommendProofFile;

@NotBlank
@ApiModelProperty("短信验证码")
private String verificationCode;
}

+ 49
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/MetaApplyResultRequest.java Bestand weergeven

@@ -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<DictionaryFieldInfo> expertType;

@ApiModelProperty("其他标签(标签code)")
private List<TagFieldInfo> other;

@ApiModelProperty("备注")
private String remark;
}
}

+ 56
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertAdminExpertManageListVO.java Bestand weergeven

@@ -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<DictionaryFieldInfo> titleLevel;

@ApiModelProperty("工作单位")
private String company;

@ApiModelProperty(" 单位法人编号")
private String legalEntityCode;

@ApiModelProperty("单位类型(字典code)")
private List<DictionaryFieldInfo> companyAttribute;

@ApiModelProperty(value = "手机号")
private String phoneNo;

@ApiModelProperty(value = "专家类型(内外围)")
private List<DictionaryFieldInfo> expertType;

@ApiModelProperty(value = "专家层级")
private ExpertRegionInfo expertRegionInfo;

@ApiModelProperty(value = "是否浙政钉用户")
private Boolean isDingUser;

@ApiModelProperty(value = "专家账号状态", allowableValues = "冻结:freezing,正常:normal")
private String expertAccountStatus;

@ApiModelProperty(value = "专家来源")
private List<TagFieldInfo> expertSource;
}

+ 76
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertApplyMetaVO.java Bestand weergeven

@@ -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<DictionaryFieldInfo> titleLevel;

/**
* 工作单位
*/
@ApiModelProperty("工作单位")
private String company;

/**
* 手机号
*/
@ApiModelProperty("手机号")
private String phoneNo;

/**
* 申请时间
*/
@ApiModelProperty("申请时间")
private LocalDateTime applyTime;


}

+ 45
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/ExpertFullInfoVO.java Bestand weergeven

@@ -0,0 +1,45 @@
package com.ningdatech.pmapi.expert.model.vo;

import com.ningdatech.pmapi.expert.model.*;
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
* @author liuxinxin
* @date 2022/7/25 下午1:43
*/
@Data
@ApiModel("专家全量信息")
public class ExpertFullInfoVO {

@ApiModelProperty("专家用户id")
private Long userId;

@ApiModelProperty("基本信息")
private ExpertBasicInfo basicInfo;

@ApiModelProperty("学历信息")
private ExpertEduInfo eduInfo;

@ApiModelProperty("职业信息")
private ExpertJobInfo jobInfo;

@ApiModelProperty("专业信息")
private ExpertProfessionalInfo professionalInfo;

@ApiModelProperty("推荐信息")
private ExpertRecommendInfo recommendInfo;

@ApiModelProperty("其他信息")
private ExpertOtherInfo expertOtherInfo;

@NotEmpty
@ApiModelProperty("专家申请履职意向展示列表")
private List<ExpertRegionInfo> expertApplyIntentionWorkRegions;

}

+ 70
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/model/vo/MetaApplyResultVo.java Bestand weergeven

@@ -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;

/**
* <p>
* LeaveAuditInfoVo
* </p>
*
* @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;
}


}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java Bestand weergeven

@@ -1,6 +1,9 @@
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;

/**
* @author liuxinxin
@@ -11,4 +14,22 @@ public interface ExpertInfoService {

void saveExpertInfo(ExpertFullInfoSaveCmd cmd);

/**
* 专家报名提交 推荐证明材料
*
* @param expertRecommendProofSaveCmd
*/
void expertRecommendProofSave(ExpertRecommendProofSaveCmd expertRecommendProofSaveCmd);

/**
* 根据user_id 获取用户全量信息
*
* @param userId
* @return
*/
ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId);


void expertStorageDeal(ExpertStorageDealCmd cmd);
}


+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertMetaApplyService.java Bestand weergeven

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.expert.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.expert.entity.ExpertMetaApply;

/**
* <p>
* 服务类
* </p>
*
* @author Liuxinxin
* @since 2023-03-01
*/
public interface IExpertMetaApplyService extends IService<ExpertMetaApply> {

}

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java Bestand weergeven

@@ -32,4 +32,14 @@ public interface IExpertUserFullInfoService extends IService<ExpertUserFullInfo>
**/
List<ExpertUserFullInfo> listByUserId(List<Long> userId);



/**
* 批量查询专家用户信息
*
* @param userIds 用户ID
* @return /
*/
List<ExpertUserFullInfo> listByUserIds(List<Long> userIds);

}

+ 174
- 18
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java Bestand weergeven

@@ -2,17 +2,24 @@ package com.ningdatech.pmapi.expert.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.common.constant.BoolDisplayEnum;
import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum;
import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler;
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum;
import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum;
import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum;
import com.ningdatech.pmapi.expert.constant.ExpertUserInfoStepEnum;
import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany;
import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion;
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.ExpertInfoService;
import com.ningdatech.pmapi.expert.service.IExpertAvoidCompanyService;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
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;
@@ -24,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -37,12 +45,11 @@ import java.util.stream.Collectors;
public class ExpertInfoServiceImpl implements ExpertInfoService {

private final IExpertUserFullInfoService iExpertUserFullInfoService;

private final IExpertTagService iExpertTagService;

private final IExpertDictionaryService iExpertDictionaryService;

private final IExpertAvoidCompanyService iExpertAvoidCompanyService;
private final IExpertIntentionWorkRegionService iExpertIntentionWorkRegionService;
private final IExpertMetaApplyService iExpertMetaApplyService;


/**
@@ -75,12 +82,12 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
.eq(ExpertDictionary::getUserId, userId);
iExpertDictionaryService.remove(expertDictionaryRemove);
// 删除所有专家履职意向申请
// TODO 补充审核逻辑
// LambdaQueryWrapper<ExpertMetaApply> expertMetaApplyRemove = Wrappers.lambdaQuery(ExpertMetaApply.class)
// .eq(ExpertMetaApply::getUserId, userId)
// .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey())
// .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.N.name());
// iExpertMetaApplyService.remove(expertMetaApplyRemove);
// 补充审核逻辑
LambdaQueryWrapper<ExpertMetaApply> expertMetaApplyRemove = Wrappers.lambdaQuery(ExpertMetaApply.class)
.eq(ExpertMetaApply::getUserId, userId)
.eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey())
.eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.N.name());
iExpertMetaApplyService.remove(expertMetaApplyRemove);
// 删除回避单位
LambdaQueryWrapper<ExpertAvoidCompany> expertAvoidCompanyRemove = Wrappers.lambdaQuery(ExpertAvoidCompany.class)
.eq(ExpertAvoidCompany::getUserId, userId);
@@ -104,11 +111,11 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
}
// 保存所有专家履职意向申请

// TODO 补充审核逻辑
// List<ExpertMetaApply> saveExpertIntentionWorkRegionApplyList = buildSaveExpertIntentionWorkRegionApplyList(userId, expertIntentionWorkRegionInfoList);
// if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) {
// iExpertMetaApplyService.saveBatch(saveExpertIntentionWorkRegionApplyList);
// }
// 审核逻辑
List<ExpertMetaApply> saveExpertIntentionWorkRegionApplyList = buildSaveExpertIntentionWorkRegionApplyList(userId, expertIntentionWorkRegionInfoList);
if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) {
iExpertMetaApplyService.saveBatch(saveExpertIntentionWorkRegionApplyList);
}
// 保存所有专家回避单位
List<ExpertAvoidCompany> saveExpertAvoidCompanyList = buildSaveExpertAvoidCompanyList(userId, expertAvoidCompanyList);
if (CollectionUtils.isNotEmpty(saveExpertAvoidCompanyList)) {
@@ -216,4 +223,153 @@ public class ExpertInfoServiceImpl implements ExpertInfoService {
}).collect(Collectors.toList());
}

@Override
@Transactional(rollbackFor = Exception.class)
public void expertRecommendProofSave(ExpertRecommendProofSaveCmd cmd) {
// 保存专家证明材料
Long userId = cmd.getUserId();
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId);
expertUserFullInfo.setRecommendationProofFileIdList(JSONObject.toJSONString(cmd.getRecommendationProofFileIdList()));
expertUserFullInfo.setUpdateOn(LocalDateTime.now());
expertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey());
iExpertUserFullInfoService.saveOrUpdate(expertUserFullInfo);

List<ExpertDictionaryDTO> recommendedWayList = cmd.getRecommendedWay();
if (CollectionUtils.isNotEmpty(recommendedWayList)) {
List<ExpertDictionary> saveExpertDictionaryList = recommendedWayList.stream().map(r -> {
ExpertDictionary expertDictionary = new ExpertDictionary();
expertDictionary.setUserId(userId);
expertDictionary.setExpertInfoField(r.getExpertInfoField());
expertDictionary.setDictionaryCode(r.getDictionaryCode());
expertDictionary.setUpdateOn(LocalDateTime.now());
expertDictionary.setCreateOn(LocalDateTime.now());
return expertDictionary;
}).collect(Collectors.toList());
iExpertDictionaryService.saveBatch(saveExpertDictionaryList);
}

// 创建入库申请
ExpertMetaApply expertRegionApply = new ExpertMetaApply();
expertRegionApply.setApplyType(ExpertApplyTypeEnum.EXPERT_STORAGE.getKey());
expertRegionApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey());
expertRegionApply.setRegionCode(expertUserFullInfo.getRegionCode());
expertRegionApply.setRegionLevel(expertUserFullInfo.getRegionLevel());
expertRegionApply.setUserId(userId);
expertRegionApply.setDisplayEnable(BoolDisplayEnum.Y.name());
iExpertMetaApplyService.save(expertRegionApply);
}

@Override
public ExpertFullInfoAllDTO getExpertUserFullInfoAll(Long userId) {
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId);
if (Objects.isNull(expertUserFullInfo)) {
return null;
}
// 所有专家标签字段
List<ExpertTag> expertTagList = iExpertTagService
.list(Wrappers.lambdaQuery(ExpertTag.class).eq(ExpertTag::getUserId, userId));
// 所有专家字典字段
List<ExpertDictionary> expertDictionaryList = iExpertDictionaryService
.list(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getUserId, userId));
// 专家履职意向列表
List<ExpertIntentionWorkRegion> expertIntentionWorkRegionList = iExpertIntentionWorkRegionService
.list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class).eq(ExpertIntentionWorkRegion::getUserId, userId));
// 专家履职意向申请列表
List<ExpertMetaApply> expertMetaApplyList = iExpertMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class)
.eq(ExpertMetaApply::getUserId, userId)
.eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey())
.in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_INTENTION_LEAVE.getKey()));
// 所有专家回避单位
List<ExpertAvoidCompany> expertAvoidCompanyList = iExpertAvoidCompanyService
.list(Wrappers.lambdaQuery(ExpertAvoidCompany.class).eq(ExpertAvoidCompany::getUserId, userId));

return ExpertUserInfoAssembler.buildExpertFullInfoAllDTO(expertUserFullInfo, expertTagList, expertDictionaryList
, expertIntentionWorkRegionList, expertMetaApplyList, expertAvoidCompanyList);

}


private List<ExpertMetaApply> buildSaveExpertIntentionWorkRegionApplyList(Long userId, List<ExpertRegionDTO> expertIntentionWorkRegionInfoList) {
if (CollectionUtils.isEmpty(expertIntentionWorkRegionInfoList)) {
return new ArrayList<>();
}
return expertIntentionWorkRegionInfoList.stream().map(r -> {
ExpertMetaApply expertMetaApply = new ExpertMetaApply();
expertMetaApply.setApplyType(ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey());
expertMetaApply.setApplyStatus(ExpertApplyStatusEnum.PENDING_REVIEW.getKey());
expertMetaApply.setRegionCode(r.getRegionCode());
expertMetaApply.setRegionLevel(r.getRegionLevel());
expertMetaApply.setUserId(userId);
expertMetaApply.setDisplayEnable(BoolDisplayEnum.N.name());
expertMetaApply.setUpdateOn(LocalDateTime.now());
expertMetaApply.setCreateOn(LocalDateTime.now());
return expertMetaApply;
}).collect(Collectors.toList());
}


/**
* 专家入库审核
*
* @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<ExpertTag> saveExpertTagList = buildSaveExpertTagList(expertUserId, cmd.getOther());
iExpertTagService.saveBatch(saveExpertTagList);
// 保存所有专家字典字段
List<ExpertDictionaryDTO> expertType = cmd.getExpertType();
if (CollectionUtils.isNotEmpty(expertType)) {
expertType = expertType.stream().peek(r -> r.setExpertInfoField(DictExpertInfoTypeEnum.EXPERT_TYPE.getKey())).collect(Collectors.toList());
List<ExpertDictionary> saveExpertDictionaryList = buildSaveExpertDictionaryList(expertUserId, expertType);
iExpertDictionaryService.saveBatch(saveExpertDictionaryList);
}

// 修改履职意向申请状态
LambdaUpdateWrapper<ExpertMetaApply> 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<SysUsersRoles> 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);
}



}

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertMetaApplyServiceImpl.java Bestand weergeven

@@ -0,0 +1,20 @@
package com.ningdatech.pmapi.expert.service.impl;

import com.ningdatech.pmapi.expert.entity.ExpertMetaApply;
import com.ningdatech.pmapi.expert.mapper.ExpertMetaApplyMapper;
import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author Liuxinxin
* @since 2023-03-01
*/
@Service
public class ExpertMetaApplyServiceImpl extends ServiceImpl<ExpertMetaApplyMapper, ExpertMetaApply> implements IExpertMetaApplyService {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java Bestand weergeven

@@ -33,4 +33,9 @@ public class ExpertUserFullInfoServiceImpl extends ServiceImpl<NdExpertUserFullI
return list(Wrappers.<ExpertUserFullInfo>lambdaQuery().in(ExpertUserFullInfo::getUserId, userIds));
}

@Override
public List<ExpertUserFullInfo> listByUserIds(List<Long> userIds) {
return list(Wrappers.<ExpertUserFullInfo>lambdaQuery().in(ExpertUserFullInfo::getUserId, userIds));
}

}

+ 4
- 5
pmapi/src/main/java/com/ningdatech/pmapi/meeting/builder/ExpertInviteBuilder.java Bestand weergeven

@@ -2,8 +2,7 @@ package com.ningdatech.pmapi.meeting.builder;

import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteType;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;

/**
* <p>
@@ -19,10 +18,10 @@ public class ExpertInviteBuilder {
}

public static MeetingExpert getExpertByRandom(Long meetingId, ExpertUserFullInfo user, Long ruleId) {
return getExpertBasic(meetingId, user, ruleId, ExpertInviteType.RANDOM);
return getExpertBasic(meetingId, user, ruleId, ExpertInviteTypeEnum.RANDOM);
}

private static MeetingExpert getExpertBasic(Long meetingId, ExpertUserFullInfo user, Long ruleId, ExpertInviteType type) {
private static MeetingExpert getExpertBasic(Long meetingId, ExpertUserFullInfo user, Long ruleId, ExpertInviteTypeEnum type) {
MeetingExpert expert = new MeetingExpert();
expert.setMeetingId(meetingId);
expert.setMobile(user.getPhoneNo());
@@ -34,7 +33,7 @@ public class ExpertInviteBuilder {
}

public static MeetingExpert getExpertByAppoint(Long meetingId, ExpertUserFullInfo user, Long ruleId) {
return getExpertBasic(meetingId, user, ruleId, ExpertInviteType.APPOINT);
return getExpertBasic(meetingId, user, ruleId, ExpertInviteTypeEnum.APPOINT);
}

}

+ 8
- 24
pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java Bestand weergeven

@@ -4,7 +4,6 @@ package com.ningdatech.pmapi.meeting.controller;
import com.ningdatech.basic.model.IdVo;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingBasicDTO;
import com.ningdatech.pmapi.meeting.entity.req.*;
import com.ningdatech.pmapi.meeting.entity.vo.*;
import com.ningdatech.pmapi.meeting.manage.MeetingManage;
@@ -33,27 +32,27 @@ public class MeetingController {

private final MeetingManage meetingManage;

@PostMapping("/save")
@ApiOperation("新建会议")
@PostMapping("/create")
@ApiOperation(value = "新建会议")
@WebLog(value = "新建会议")
public IdVo<Long> meetingCreate(@Valid @RequestBody MeetingBasicDTO req) {
return meetingManage.save(req);
public IdVo<Long> meetingCreate(@Valid @RequestBody MeetingCreateReq req) {
return meetingManage.meetingCreateAndInviteExpert(req);
}

@PostMapping("/expertInviteByCreate")
@ApiOperation("新建会议-专家抽取")
@ApiOperation(value = "新建会议-专家抽取", hidden = true)
@WebLog(value = "新建会议-专家抽取")
public void expertInviteByCreate(@Valid @RequestBody ExpertInviteCreateReq po) {
public void expertInviteByCreate(@Valid @RequestBody ExpertInviteReq po) {
meetingManage.expertInviteByCreate(po);
}

@ApiOperation("专家抽取数量校验")
@PostMapping("/expertCountOnChange")
public ExpertCountOnChangeVO expertCountOnChange(@RequestBody ExpertInviteCreateReq po) {
public ExpertCountOnChangeVO expertCountOnChange(@RequestBody ExpertInviteReq po) {
return meetingManage.expertCountOnChange(po);
}

@ApiOperation("专家抽取员事务列表")
@ApiOperation("专家抽取员会议列表")
@GetMapping("/meetingListByManager")
@WebLog(value = "专家抽取员事务列表")
public PageVo<MeetingByManagerVO> meetingListByManager(MeetingListReq po) {
@@ -74,21 +73,6 @@ public class MeetingController {
return meetingManage.getMeetingBasicInfo(meetingId);
}

@ApiOperation("会议结果上传")
@PostMapping("/uploadMeetingResult")
@WebLog(value = "会议结果上传")
public void uploadMeetingResult(@Valid @RequestBody MeetingResultReq po) {
meetingManage.uploadMeetingResult(po);

}

@ApiOperation("会议结果详情")
@GetMapping("/detail/{meetingId}/meetingResult")
@WebLog(value = "会议结果详情况")
public MeetingResultVO meetingResultDetail(@PathVariable Long meetingId) {
return meetingManage.meetingResultDetail(meetingId);
}

@ApiOperation("邀请情况详情")
@GetMapping("/detail/{meetingId}/inviteDetail")
@WebLog(value = "邀请情况详请")


+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingInnerProjectController.java Bestand weergeven

@@ -0,0 +1,20 @@
package com.ningdatech.pmapi.meeting.controller;


import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;

/**
* <p>
* 会议评审内部项目表 前端控制器
* </p>
*
* @author WendyYang
* @since 2023-02-28
*/
@Controller
@RequestMapping("/pmapi.meeting/meeting-inner-project")
public class MeetingInnerProjectController {

}

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingOuterProjectController.java Bestand weergeven

@@ -0,0 +1,20 @@
package com.ningdatech.pmapi.meeting.controller;


import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;

/**
* <p>
* 会议评审外部项目 前端控制器
* </p>
*
* @author WendyYang
* @since 2023-02-28
*/
@Controller
@RequestMapping("/pmapi.meeting/meeting-outer-project")
public class MeetingOuterProjectController {

}

+ 7
- 4
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java Bestand weergeven

@@ -35,11 +35,14 @@ public class ExpertInviteAvoidRule implements Serializable {
@ApiModelProperty("回避专家ID")
private String expertIds;

@ApiModelProperty("回避单位名称")
private String companyIds;
@ApiModelProperty("回避单位ID")
private String avoidUnitIds;

@ApiModelProperty("回避本单位同事")
private Boolean avoidMates;
@ApiModelProperty("回避条线ID")
private String avoidOrgIds;

@ApiModelProperty("每周参与次数")
private Integer weekInviteCount;

@ApiModelProperty("创建人ID")
private Long createBy;


+ 2
- 9
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/Meeting.java Bestand weergeven

@@ -81,20 +81,13 @@ public class Meeting implements Serializable {
@ApiModelProperty("是否停止随机邀请")
private Boolean inviteStopped;

@ApiModelProperty("是否进行了专家抽取")
private Boolean invited;

@ApiModelProperty("取消说明")
private String cancelRemark;

@ApiModelProperty("举办单位")
private String holdOrg;

@ApiModelProperty("举办单位ID")
private String holdOrgCode;

public String getHoldCompanyBracket() {
return "(" + this.getHoldOrg() + ")";
}
@ApiModelProperty("是否为内部项目")
private Boolean isInnerProject;

}

+ 37
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingInnerProject.java Bestand weergeven

@@ -0,0 +1,37 @@
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
* <p>
* 会议评审内部项目表
* </p>
*
* @author WendyYang
* @since 2023-02-28
*/
@Data
@TableName("meeting_inner_project")
@ApiModel(value = "MeetingInnerProject对象", description = "会议评审内部项目表")
public class MeetingInnerProject implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("会议ID")
private Long meetingId;

@ApiModelProperty("项目ID")
private Long projectId;

}

+ 61
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingOuterProject.java Bestand weergeven

@@ -0,0 +1,61 @@
package com.ningdatech.pmapi.meeting.entity.domain;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
* <p>
* 会议评审外部项目
* </p>
*
* @author WendyYang
* @since 2023-02-28
*/
@Data
@TableName("meeting_outer_project")
@ApiModel(value = "MeetingOuterProject对象", description = "会议评审外部项目")
public class MeetingOuterProject implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("申报单位")
private String buildOrg;

@ApiModelProperty("项目类型")
private String projectType;

@ApiModelProperty("预算年度")
private Integer projectYear;

@ApiModelProperty("申报金额")
private BigDecimal declareAmount;

@ApiModelProperty("会议ID")
private Long meetingId;

@TableField(fill = FieldFill.INSERT)
private Long createBy;

@TableField(fill = FieldFill.INSERT)
private LocalDateTime createOn;

@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateBy;

@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateOn;

}

+ 10
- 32
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidInfoDTO.java Bestand weergeven

@@ -6,12 +6,11 @@ import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.List;

/**
* <p>
* AvoidInfoDto
* 专家邀请回避规则
* </p>
*
* @author WendyYang
@@ -23,38 +22,17 @@ public class AvoidInfoDTO {

@ApiModelProperty("回避单位")
@NotEmpty(message = "回避单位不能为空", groups = {AbstractInviteRule.RuleSave.class})
private List<String> companyIds;
private List<String> avoidUnitIdList;

@ApiModelProperty("是否回避同单位其他专家")
@NotNull(message = "是否回避同单位其他专家不能为空")
private Boolean avoidMates;
@ApiModelProperty("回避条线")
@NotEmpty(message = "回避条线不能为空", groups = {AbstractInviteRule.RuleSave.class})
private List<String> avoidOrgIdList;

@ApiModelProperty("回避专家ID")
private List<Long> expertIds;
@ApiModelProperty("每周邀请次数")
private Integer weekInviteCount;

/**
* 返回一个默认值,仅在前端未传值时使用
*
* @return /
*/
public static AvoidInfoDTO defVal() {
AvoidInfoDTO val = new AvoidInfoDTO();
val.setAvoidMates(false);
val.setCompanyIds(Collections.emptyList());
val.setExpertIds(Collections.emptyList());
return val;
}

public void initDefVal() {
if (this.avoidMates == null) {
this.setAvoidMates(false);
}
if (this.companyIds == null) {
this.setCompanyIds(Collections.emptyList());
}
if (this.expertIds == null) {
this.setExpertIds(Collections.emptyList());
}
}
@ApiModelProperty("回避专家")
@NotEmpty(message = "回避专家不能为空", groups = {AbstractInviteRule.RuleSave.class})
private List<Long> expertIds;

}

+ 12
- 2
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingBasicDTO.java Bestand weergeven

@@ -1,6 +1,5 @@
package com.ningdatech.pmapi.meeting.entity.dto;

import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -9,6 +8,7 @@ import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

/**
* <p>
@@ -22,6 +22,10 @@ import java.time.LocalDateTime;
@ApiModel("会议基本信息")
public class MeetingBasicDTO {

@NotNull(message = "是否是系统内部项目不能为空")
@ApiModelProperty("是否是系统内部项目")
private Boolean isInnerProject;

@NotEmpty(message = "事务名称不能为空")
@ApiModelProperty("事务名称")
private String name;
@@ -50,10 +54,16 @@ public class MeetingBasicDTO {

@NotEmpty(message = "联系人不能为空")
@ApiModelProperty("联系人")
private String contacter;
private String connecter;

@NotEmpty(message = "联系方式不能为空")
@ApiModelProperty("联系方式")
private String contact;

@ApiModelProperty("内部项目ID")
private List<Long> projectIdList;

@ApiModelProperty("外部项目")
private List<MeetingReviewProjectDTO> projects;

}

+ 32
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingReviewProjectDTO.java Bestand weergeven

@@ -0,0 +1,32 @@
package com.ningdatech.pmapi.meeting.entity.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* <p>
* MeetingEvalProjectDTO
* </p>
*
* @author WendyYang
* @since 17:18 2023/2/28
*/
@Data
public class MeetingReviewProjectDTO {

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("预算年度")
private Integer projectYear;

@ApiModelProperty("项目类型")
private String projectType;

@ApiModelProperty("申报金额")
private String declareAmount;

@ApiModelProperty("申报单位")
private String buildOrg;

}

pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertInviteType.java → pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertInviteTypeEnum.java Bestand weergeven

@@ -13,7 +13,7 @@ import java.util.Arrays;
* @since 10:11 2022/7/26
*/
@Getter
public enum ExpertInviteType {
public enum ExpertInviteTypeEnum {

/**
* 专家抽取类型
@@ -24,12 +24,16 @@ public enum ExpertInviteType {
private final Integer code;
private final String name;

ExpertInviteType(Integer code, String name) {
ExpertInviteTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}

public static ExpertInviteType getByCode(Integer code) {
public boolean eq(Integer code) {
return this.getCode().equals(code);
}

public static ExpertInviteTypeEnum getByCode(Integer code) {
return Arrays.stream(values())
.filter(w -> w.getCode().equals(code))
.findFirst()

pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteCreateReq.java → pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteReq.java Bestand weergeven

@@ -1,6 +1,5 @@
package com.ningdatech.pmapi.meeting.entity.req;

import com.ningdatech.pmapi.meeting.entity.dto.AbstractInviteRule;
import com.ningdatech.pmapi.meeting.entity.dto.AppointInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.dto.AvoidInfoDTO;
import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO;
@@ -22,15 +21,19 @@ import java.util.List;
*/
@Data
@ApiModel("专家抽取新家实体")
public class ExpertInviteCreateReq {
public class ExpertInviteReq {

@NotNull(message = "会议ID不能为空", groups = {AbstractInviteRule.RuleSave.class, AbstractInviteRule.CountCheck.class})
@ApiModelProperty("会议ID")
private Long meetingId;

@NotNull(message = "抽取类型不能为空")
@ApiModelProperty("抽取类型:1 随机抽取、2 指定抽取")
private Integer inviteType;

@Valid
@NotNull(message = "回避信息不能为空")
@ApiModelProperty("回避信息")
private AvoidInfoDTO avoidInfo;
private AvoidInfoDTO avoidRule;

@Valid
@ApiModelProperty("随机抽取规则")

+ 31
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCreateReq.java Bestand weergeven

@@ -0,0 +1,31 @@
package com.ningdatech.pmapi.meeting.entity.req;

import com.ningdatech.pmapi.meeting.entity.dto.MeetingBasicDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
* <p>
* MeetingCreateReq
* </p>
*
* @author WendyYang
* @since 14:33 2023/2/28
*/
@Data
public class MeetingCreateReq {

@Valid
@NotNull(message = "会议基本信息不能为空")
@ApiModelProperty("会议基本信息")
private MeetingBasicDTO meetingBasicInfo;

@Valid
@NotNull(message = "会议邀请规则不能为空")
@ApiModelProperty("会议邀请规则")
private ExpertInviteReq expertInviteRule;

}

+ 27
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AppointRuleVO.java Bestand weergeven

@@ -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;

/**
* <p>
* 指定邀请规则
* </p>
*
* @author WendyYang
* @since 11:26 2023/3/1
*/
@Data
@ApiModel("指定邀请规则")
public class AppointRuleVO {

@ApiModelProperty("邀请说明")
private String inviteDesc;

@ApiModelProperty("指定邀请专家")
private List<ExpertBasicInfoVO> experts;

}

+ 33
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/AvoidInfoVO.java Bestand weergeven

@@ -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;

/**
* <p>
* 回避信息
* </p>
*
* @author WendyYang
* @since 11:25 2023/3/1
*/
@Data
@ApiModel("回避信息")
public class AvoidInfoVO {

@ApiModelProperty("回避单位")
private List<String> avoidUnitIds;

@ApiModelProperty("回避条线")
private List<String> avoidOrgIds;

@ApiModelProperty("每周邀请次数")
private Integer weekInviteCount;

@ApiModelProperty("回避专家")
private List<ExpertBasicInfoVO> experts;

}

+ 6
- 7
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/ExpertInviteDetailVO.java Bestand weergeven

@@ -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<ExpertAttendListItemVO> attendList = new ArrayList<>();
private List<ExpertAttendListItemVO> attendList;

@ApiModelProperty("随机邀请名单")
private List<RandomInviteListItemVO> randomInviteList = new ArrayList<>();
private List<RandomInviteListItemVO> randomInviteList;

@ApiModelProperty("指定邀请名单")
private List<RandomInviteListItemVO> appointInviteList = new ArrayList<>();
private List<RandomInviteListItemVO> appointInviteList;

public void addAttendList(ExpertAttendListItemVO attend) {
this.attendList.add(attend);


+ 3
- 45
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java Bestand weergeven

@@ -16,57 +16,15 @@ import java.util.List;
@Data
public class InviteRuleDetailVO {

@ApiModelProperty("是否创建邀请规则")
private Boolean invited;
private Integer inviteType;

@ApiModelProperty("随机邀请规则")
private List<RandomInviteRuleVO> 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<String> companyIds;

private Boolean avoidMates;

private List<ExpertBasicInfoVO> experts;

}

@Data
public static class AppointRuleVo {

private String inviteDesc;

private List<ExpertBasicInfoVO> 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;

}

+ 14
- 29
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingDetailBasicVO.java Bestand weergeven

@@ -1,8 +1,7 @@
package com.ningdatech.pmapi.meeting.entity.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.ningdatech.file.entity.vo.result.AttachFileVo;
import com.ningdatech.pmapi.sys.model.dto.RegionDTO;
import com.ningdatech.pmapi.meeting.entity.req.ExpertInviteReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
@@ -10,7 +9,6 @@ import lombok.Data;
import lombok.experimental.Tolerate;

import java.time.LocalDateTime;
import java.util.List;

/**
* <p>
@@ -29,35 +27,36 @@ public class MeetingDetailBasicVO {
public MeetingDetailBasicVO() {
}

private Long id;
private Long meetingId;

@ApiModelProperty("会议名称")
private String name;
private String meetingName;

@ApiModelProperty("会议类型名称")
private String typeName;

@ApiModelProperty("会议类型代码")
private String type;
private String meetingType;

@ApiModelProperty("开始时间")
@JSONField(format = "yyyy-MM-dd HH:mm")
private LocalDateTime startTime;

@ApiModelProperty("结束时间")
@ApiModelProperty("评委到场时间")
@JSONField(format = "yyyy-MM-dd HH:mm")
private LocalDateTime endTime;
private LocalDateTime judgesAttendanceTime;

@ApiModelProperty("会议耗时")
private Integer meetingUsageTime;

@ApiModelProperty("联系人")
private String connecter;

@ApiModelProperty("创建人")
private String author;

private List<RegionDTO> regions;
private String creator;

@ApiModelProperty("地点")
private String address;
@ApiModelProperty("评审地点")
private String meetingAddress;

@ApiModelProperty("联系方式")
private String contact;
@@ -65,33 +64,19 @@ public class MeetingDetailBasicVO {
@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("会议说明")
private String description;

@ApiModelProperty("相关材料")
private List<AttachFileVo> 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;

}

+ 35
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertInviteHelper.java Bestand weergeven

@@ -1,10 +1,17 @@
package com.ningdatech.pmapi.meeting.helper;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.AbstractInviteRule;
import com.ningdatech.pmapi.meeting.entity.dto.AppointInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.dto.AvoidInfoDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatus;
@@ -12,7 +19,9 @@ import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
import com.ningdatech.pmapi.meeting.service.IMeetingService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import java.time.LocalDateTime;
import java.util.*;
@@ -32,6 +41,7 @@ public class ExpertInviteHelper {

private final IMeetingService meetingService;
private final IMeetingExpertService meetingExpertService;
private final IExpertUserFullInfoService expertUserFullInfoService;

/**
* 获取时间段内被抽中的专家(通知中、确认参加)
@@ -77,4 +87,29 @@ public class ExpertInviteHelper {
return expertIds;
}

public Map<Long, ExpertUserFullInfo> checkAppointExpert(AppointInviteRuleDTO appointRule) {
if (appointRule == null) {
return Collections.emptyMap();
}
List<ExpertUserFullInfo> expertInfos = expertUserFullInfoService.listByUserId(appointRule.getExpertIds());
return CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId);
}

/**
* 构建邀请规则
*
* @param rule 邀请规则
* @param meetingId 会议ID
* @return {@link ExpertInviteRule}
* @author WendyYang
**/
public static ExpertInviteRule getExpertInviteRule(AbstractInviteRule rule, Long meetingId) {
ExpertInviteRule result = new ExpertInviteRule();
result.setInviteRule(JSONObject.toJSONString(rule));
result.setInviteCount(rule.getCount());
result.setInviteType(rule.getInviteType());
result.setMeetingId(meetingId);
return result;
}

}

+ 16
- 12
pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java Bestand weergeven

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.common.util.StrUtils;
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.service.ExpertInfoService;
@@ -16,6 +15,7 @@ import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.AvoidInfoDTO;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingBasicDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatus;
import com.ningdatech.pmapi.meeting.entity.req.MeetingListReq;
@@ -50,6 +50,14 @@ public class MeetingManageHelper {
private final IExpertInviteRuleService inviteRuleService;
private final IExpertInviteAvoidRuleService inviteAvoidRuleService;

public void checkReviewProject(MeetingBasicDTO meetingBasic) {
if (meetingBasic.getIsInnerProject()) {
Assert.notEmpty(meetingBasic.getProjectIdList(), "评审项目不能为空");
} else {
Assert.notEmpty(meetingBasic.getProjects(), "评审项目不能为空");
}
}

/**
* 获取专家出席会议的状态
*
@@ -80,7 +88,6 @@ public class MeetingManageHelper {
.connecter(meeting.getConnecter())
.contact(meeting.getContact())
.status(meeting.getStatus())
.invited(meeting.getInvited())
.holdOrg(meeting.getHoldOrg())
.build();
}
@@ -134,11 +141,12 @@ public class MeetingManageHelper {

public AvoidInfoDTO getAvoidInfoDto(Long meetingId) {
ExpertInviteAvoidRule avoidRule = inviteAvoidRuleService.getByMeetingId(meetingId);
AvoidInfoDTO avoidInfoDto = new AvoidInfoDTO();
avoidInfoDto.setAvoidMates(avoidRule.getAvoidMates());
avoidInfoDto.setExpertIds(BizUtils.splitToLong(avoidRule.getExpertIds()));
avoidInfoDto.setCompanyIds(StrUtils.split(avoidRule.getCompanyIds()));
return avoidInfoDto;
AvoidInfoDTO result = new AvoidInfoDTO();
result.setAvoidOrgIdList(StrUtil.split(avoidRule.getAvoidOrgIds(), ","));
result.setExpertIds(BizUtils.splitToLong(avoidRule.getExpertIds()));
result.setAvoidUnitIdList(StrUtil.split(avoidRule.getAvoidUnitIds(), ","));
result.setWeekInviteCount(result.getWeekInviteCount());
return result;
}

public void saveAvoidInfo(Long meetingId, List<Long> expertIds) {
@@ -159,16 +167,12 @@ public class MeetingManageHelper {
AvoidInfoDTO avoidRule = getAvoidInfoDto(meetingId);
Map<String, Integer> countMap = new HashMap<>(16);
experts.forEach(expert -> {
if (avoidRule.getCompanyIds().contains(expert.getCompany())) {
if (avoidRule.getAvoidUnitIdList().contains(expert.getCompany())) {
throw BizException.wrap("回避单位的专家不可出现在指定邀请名单中");
}
if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds()) && avoidRule.getExpertIds().contains(expert.getUserId())) {
throw BizException.wrap("已回避的专家不可被指定邀请");
}
if (avoidRule.getAvoidMates()) {
Integer oldValue = countMap.put(expert.getCompany(), 1);
Assert.isNull(oldValue, "不可选择同单位的多个专家");
}
// 校验专家状态
ExpertAccountStatusEnum accountStatus = ExpertAccountStatusEnum.of(expert.getExpertAccountStatus());
if (!accountStatus.equals(ExpertAccountStatusEnum.AVAILABLE)) {


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java Bestand weergeven

@@ -13,7 +13,7 @@ import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.CountConfirmByMeetingIdDTO;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteType;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusByDashboard;
import com.ningdatech.pmapi.meeting.entity.req.MeetingCalenderReq;
@@ -202,7 +202,7 @@ public class DashboardManage {
item.setExpertMeetingId(w.getId());
Meeting meeting = meetingMap.get(w.getMeetingId());
item.setMeetingName(meeting.getName());
item.setInviteType(ExpertInviteType.getByCode(w.getInviteType()).getName());
item.setInviteType(ExpertInviteTypeEnum.getByCode(w.getInviteType()).getName());
item.setStatus(w.getStatus());
item.setStartTime(meeting.getStartTime());
item.setEndTime(meeting.getEndTime());


+ 29
- 117
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java Bestand weergeven

@@ -1,7 +1,6 @@
package com.ningdatech.pmapi.meeting.manage;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.CollUtils;
@@ -16,7 +15,10 @@ import com.ningdatech.pmapi.meeting.builder.ExpertInviteBuilder;
import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.*;
import com.ningdatech.pmapi.meeting.entity.dto.AvoidInfoDTO;
import com.ningdatech.pmapi.meeting.entity.dto.ExpertChooseDTO;
import com.ningdatech.pmapi.meeting.entity.dto.ExpertDictChooseDTO;
import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper;
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper;
@@ -35,13 +37,14 @@ import org.apache.commons.collections4.Predicate;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule;

/**
* <p>
* 专家邀请管理
@@ -149,7 +152,7 @@ public class ExpertInviteManage {
return null;
}
// 处理专家回避单位 与 抽取回避单位是否相同
List<Long> avoidCompanyExpertIds = avoidCompanyExpertIds(avoidInfo.getCompanyIds());
List<Long> avoidCompanyExpertIds = avoidCompanyExpertIds(avoidInfo.getAvoidUnitIdList());

// 聚合用户ID
List<Long> expertIdsIn = new ArrayList<>();
@@ -261,10 +264,10 @@ public class ExpertInviteManage {
}
boolean avoid = avoidInfo != null;
boolean avoidExpert = avoid && CollUtil.isNotEmpty(avoidInfo.getExpertIds());
boolean avoidCompany = avoid && CollUtil.isNotEmpty(avoidInfo.getCompanyIds());
boolean avoidCompany = avoid && CollUtil.isNotEmpty(avoidInfo.getAvoidUnitIdList());
Set<String> tmpAvoidCompany = new HashSet<>();
if (avoidCompany) {
List<String> companyIds = avoidInfo.getCompanyIds();
List<String> companyIds = avoidInfo.getAvoidUnitIdList();
for (String companyId : companyIds) {
if (companyId.contains(",")) {
String[] splitCompanyIds = companyId.split(",");
@@ -277,16 +280,11 @@ public class ExpertInviteManage {
}
}
// 回避信息
if (CollUtil.isNotEmpty(appointExpertIds) && avoid && avoidInfo.getAvoidMates()) {
// 如果设置了回避本单位同事且手动指定了专家,则对应的单位需要排除
List<ExpertUserFullInfo> appointUsers = expertUserFullInfoService.listByUserId(appointExpertIds);
tmpAvoidCompany.addAll(CollUtils.fieldList(appointUsers, ExpertUserFullInfo::getCompany));
}
LambdaQueryWrapper<ExpertUserFullInfo> query = buildBaseExpertQuery();
query.notIn(!tmpAvoidCompany.isEmpty(), ExpertUserFullInfo::getCompany, tmpAvoidCompany);
if (avoidCompany) {
query.notExists("select 1 from expert_avoid_company eac where eac.user_id = expert_user_full_info.user_id" +
" and company_name in ({0})", CollUtils.joinByComma(avoidInfo.getCompanyIds()));
" and company_name in ({0})", CollUtils.joinByComma(avoidInfo.getAvoidUnitIdList()));
}
// 处理专家层级
addRegionLimit(query, randomRule);
@@ -326,21 +324,11 @@ public class ExpertInviteManage {
if (userFullInfos.isEmpty()) {
return result;
}
if (avoid && avoidInfo.getAvoidMates()) {
// 回避同单位其他专家
Map<String, List<ExpertUserFullInfo>> userFullInfoMap = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompany);
result.setTotal(userFullInfoMap.size());
if (randomRule.getCount() == null || userFullInfoMap.size() >= randomRule.getCount()) {
List<ExpertUserFullInfo> userFullInfoList = inviteGroupByCompany(userFullInfoMap, randomRule.getCount());
result.setExperts(userFullInfoList);
}
} else {
result.setTotal(userFullInfos.size());
// count为空表示数量校验
if (randomRule.getCount() == null || result.getTotal() >= randomRule.getCount()) {
List<ExpertUserFullInfo> userFullInfoList = inviteWithoutCompany(userFullInfos, randomRule.getCount());
result.setExperts(userFullInfoList);
}
result.setTotal(userFullInfos.size());
// count为空表示数量校验
if (randomRule.getCount() == null || result.getTotal() >= randomRule.getCount()) {
List<ExpertUserFullInfo> userFullInfoList = inviteWithoutCompany(userFullInfos, randomRule.getCount());
result.setExperts(userFullInfoList);
}
return result;
}
@@ -369,9 +357,9 @@ public class ExpertInviteManage {
return result;
}
LambdaQueryWrapper<ExpertUserFullInfo> query = buildBaseExpertQuery();
query.notIn(ExpertUserFullInfo::getCompany, avoidInfo.getCompanyIds());
query.notIn(ExpertUserFullInfo::getCompany, avoidInfo.getAvoidUnitIdList());
query.notExists("select 1 from expert_avoid_company eac where eac.user_id = expert_user_full_info.user_id" +
" and company_name in ({0})", CollUtils.joinByComma(avoidInfo.getCompanyIds()));
" and company_name in ({0})", CollUtils.joinByComma(avoidInfo.getAvoidOrgIdList()));

// 处理专家层级
if (ObjectUtils.allNotNull(randomRule.getExpertRegionCode(), randomRule.getExpertRegionLevel())) {
@@ -440,23 +428,10 @@ public class ExpertInviteManage {
removeExpertIds.add(replacedExpertId);
}
List<Long> tempExpertIds = CollUtils.fieldList(removeExpertByCompany, MeetingExpert::getExpertId);
if (avoidInfo.getAvoidMates()) {
if (!tempExpertIds.isEmpty()) {
Set<String> confirmedCompany = userFullInfos.stream()
.filter(w -> tempExpertIds.contains(w.getUserId()))
.map(ExpertUserFullInfo::getCompany).collect(Collectors.toSet());
userFullInfos.removeIf(w -> confirmedCompany.contains(w.getCompany()));
}
userFullInfos.removeIf(w -> removeExpertIds.contains(w.getUserId()));
Map<String, List<ExpertUserFullInfo>> groupByCompany = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompany);
result.setTotal(groupByCompany.size());
result.setExperts(inviteGroupByCompany(groupByCompany, count));
} else {
// 移除确认参加、通知中的、拒绝参加、已取消
userFullInfos.removeIf(w -> tempExpertIds.contains(w.getUserId()) || removeExpertIds.contains(w.getUserId()));
result.setTotal(userFullInfos.size());
result.setExperts(inviteWithoutCompany(userFullInfos, count));
}
// 移除确认参加、通知中的、拒绝参加、已取消
userFullInfos.removeIf(w -> tempExpertIds.contains(w.getUserId()) || removeExpertIds.contains(w.getUserId()));
result.setTotal(userFullInfos.size());
result.setExperts(inviteWithoutCompany(userFullInfos, count));
return result;
}

@@ -569,78 +544,27 @@ public class ExpertInviteManage {
}

/**
* 构建邀请规则
*
* @param inviteRule 邀请规则
* @param meetingId 会议ID
* @return {@link ExpertInviteRule}
* @author WendyYang
**/
private static ExpertInviteRule getExpertInviteRule(AbstractInviteRule inviteRule, Long meetingId) {
ExpertInviteRule rule = new ExpertInviteRule();
rule.setInviteRule(JSONObject.toJSONString(inviteRule));
rule.setInviteCount(inviteRule.getCount());
rule.setInviteType(inviteRule.getInviteType());
rule.setMeetingId(meetingId);
return rule;
}

public Map<Long, ExpertUserFullInfo> checkAppointExpertConflictWithAvoidRule(AppointInviteRuleDTO appointRule, AvoidInfoDTO avoidRule) {
if (appointRule == null) {
return Collections.emptyMap();
}
List<ExpertUserFullInfo> expertInfos = expertUserFullInfoService.listByUserId(appointRule.getExpertIds());
Map<Long, ExpertUserFullInfo> infoMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId);
if (avoidRule == null) {
return infoMap;
}
Map<String, Integer> countMap = new HashMap<>(16);
infoMap.forEach((key, userFullInfo) -> {
if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds())) {
boolean contains = avoidRule.getExpertIds().contains(key);
Assert.isTrue(!contains, "已回避的专家不可被指定邀请");
}
if (CollectionUtils.isNotEmpty(avoidRule.getCompanyIds())) {
boolean contains = avoidRule.getCompanyIds().contains(userFullInfo.getCompany());
Assert.isTrue(!contains, "回避单位的专家不可出现在指定邀请名单中");
}
if (avoidRule.getAvoidMates()) {
Integer oldValue = countMap.put(userFullInfo.getCompany(), 1);
Assert.isNull(oldValue, "不可选择同单位的多个专家");
}
});
return infoMap;
}


/**
* 专家抽取(会议创建时抽取)
*
* @param randomRules 随机抽取规则
* @param appointRule 指定抽取规则
* @param avoid 回避信息
* @author WendyYang
**/
public void expertInviteByMeetingCreate(Meeting meeting,
List<RandomInviteRuleDTO> randomRules,
AppointInviteRuleDTO appointRule,
AvoidInfoDTO avoid) {
Map<Long, ExpertUserFullInfo> appointUser = checkAppointExpertConflictWithAvoidRule(appointRule, avoid);
public void expertRandomInviteByMeetingCreate(Meeting meeting,
List<RandomInviteRuleDTO> randomRules,
AvoidInfoDTO avoid) {
List<MeetingExpert> expertInserts = new ArrayList<>();
boolean appointed = appointRule != null;
// 处理随机抽取规则
if (CollectionUtils.isNotEmpty(randomRules)) {
List<ExpertInviteRule> randoms = new ArrayList<>();
List<ExpertChooseDTO> expertsByRandom = new ArrayList<>();
List<Long> tempExpertIdSelected = new ArrayList<>();
if (appointed) {
tempExpertIdSelected.addAll(appointRule.getExpertIds());
}
LocalDateTime startTime = meeting.getStartTime(), endTime = meeting.getEndTime();
List<Long> choosedExpertIds = new ArrayList<>();
LocalDateTime startTime = meeting.getStartTime();
LocalDateTime endTime = meeting.getEndTime();
randomRules.forEach(rule -> {
ExpertChooseDTO tempExperts = expertInviteByRandomRule(avoid, rule, tempExpertIdSelected, startTime, endTime);
ExpertChooseDTO tempExperts = expertInviteByRandomRule(avoid, rule, choosedExpertIds, startTime, endTime);
expertsByRandom.add(tempExperts);
tempExpertIdSelected.addAll(CollUtils.fieldList(tempExperts.getExperts(), ExpertUserFullInfo::getUserId));
choosedExpertIds.addAll(CollUtils.fieldList(tempExperts.getExperts(), ExpertUserFullInfo::getUserId));
randoms.add(getExpertInviteRule(rule, meeting.getId()));
});
inviteRuleService.saveBatch(randoms);
@@ -654,18 +578,6 @@ public class ExpertInviteManage {
}
yxtCallOrSmsHelper.callByMeetingExperts(meeting, expertInserts);
}
if (appointed) {
// 处理指定抽取规则
ExpertInviteRule appoint = getExpertInviteRule(appointRule, meeting.getId());
inviteRuleService.save(appoint);
Long ruleId = appoint.getId();
appointRule.getExpertIds().forEach(w -> {
ExpertUserFullInfo info = appointUser.get(w);
MeetingExpert expert = ExpertInviteBuilder.getExpertByAppoint(meeting.getId(), info, ruleId);
expert.setStatus(ExpertAttendStatus.NOTICING.getCode());
expertInserts.add(expert);
});
}
meetingExpertService.saveBatch(expertInserts);
}



+ 120
- 121
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java Bestand weergeven

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.meeting.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSON;
@@ -16,17 +17,15 @@ 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;
import com.ningdatech.pmapi.meeting.builder.ExpertInviteBuilder;
import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteAvoidRule;
import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.domain.*;
import com.ningdatech.pmapi.meeting.entity.dto.*;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteType;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatus.Manager;
import com.ningdatech.pmapi.meeting.entity.req.*;
import com.ningdatech.pmapi.meeting.entity.vo.*;
@@ -35,10 +34,7 @@ import com.ningdatech.pmapi.meeting.entity.vo.ExpertInviteDetailVO.RandomInviteL
import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper;
import com.ningdatech.pmapi.meeting.helper.MeetingManageHelper;
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper;
import com.ningdatech.pmapi.meeting.service.IExpertInviteAvoidRuleService;
import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
import com.ningdatech.pmapi.meeting.service.IMeetingService;
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;
@@ -46,7 +42,6 @@ import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@@ -54,6 +49,9 @@ import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule;

/**
* <p>
@@ -67,6 +65,7 @@ import java.util.function.Function;
@RequiredArgsConstructor
public class MeetingManage {

private final RegionCacheHelper regionCacheHelper;
private final IMeetingService meetingService;
private final IExpertInviteAvoidRuleService inviteAvoidRuleService;
private final IExpertInviteRuleService inviteRuleService;
@@ -82,6 +81,8 @@ public class MeetingManage {
private final DistributedLock distributedLock;
private final PermissionCheckHelper permissionCheckHelper;
private final IUserInfoService userInfoService;
private final IMeetingInnerProjectService meetingInnerProjectService;
private final IMeetingOuterProjectService meetingOuterProjectService;

private final ExpertInviteHelper expertInviteHelper;
private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:";
@@ -93,23 +94,45 @@ public class MeetingManage {
*/
public static final int RETRY_TIMES = 3;

public IdVo<Long> save(MeetingBasicDTO po) {
String md5ByParam = SecureUtil.md5(po.toString());
@Transactional(rollbackFor = Exception.class)
public IdVo<Long> meetingCreateAndInviteExpert(MeetingCreateReq req) {
MeetingBasicDTO meetingBasic = req.getMeetingBasicInfo();
meetingManageHelper.checkReviewProject(meetingBasic);
String md5ByParam = SecureUtil.md5(meetingBasic.toString());
String key = MEETING_CREATE_KEY + md5ByParam;
if (!distributedLock.lock(key, RETRY_TIMES)) {
throw BizException.wrap("会议正在创建中");
}
try {
Meeting meeting = BeanUtil.copyProperties(po, Meeting.class);
// 保存会议基本信息
Meeting meeting = BeanUtil.copyProperties(meetingBasic, Meeting.class);
meeting.setStatus(Manager.UNCOMPLETED.getCode());
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
// TODO
meeting.setHoldOrg(userDetail.getOrganizationName());
meeting.setHoldOrgCode(userDetail.getOrganizationCode());
meeting.setRegionCode(userDetail.getRegionCode());
meeting.setCreator(userDetail.getUsername());
meeting.setInvited(Boolean.FALSE);
meeting.setInviteStopped(true);
meetingService.save(meeting);
if (meetingBasic.getIsInnerProject()) {
List<MeetingInnerProject> projects = meetingBasic.getProjectIdList().stream().map(w -> {
MeetingInnerProject project = new MeetingInnerProject();
project.setMeetingId(meeting.getId());
project.setProjectId(w);
return project;
}).collect(Collectors.toList());
meetingInnerProjectService.saveBatch(projects);
} else {
List<MeetingOuterProject> projects = meetingBasic.getProjects().stream().map(w -> {
MeetingOuterProject project = BeanUtil.copyProperties(w, MeetingOuterProject.class);
project.setMeetingId(meeting.getId());
return project;
}).collect(Collectors.toList());
meetingOuterProjectService.saveBatch(projects);
}
// 抽取专家
req.getExpertInviteRule().setMeetingId(meeting.getId());
expertInviteByCreate(req.getExpertInviteRule());
return IdVo.of(meeting.getId());
} finally {
distributedLock.releaseLock(key);
@@ -117,45 +140,61 @@ public class MeetingManage {
}

@Transactional(rollbackFor = Exception.class)
public void expertInviteByCreate(ExpertInviteCreateReq req) {
// 未传递指定邀请专家直接忽略
if (req.getAppointRule() != null && CollectionUtils.isEmpty(req.getAppointRule().getExpertIds())) {
Assert.isTrue(CollectionUtils.isNotEmpty(req.getRandomRules()), "未指定抽取规则");
req.setAppointRule(null);
}
public void expertInviteByCreate(ExpertInviteReq req) {
String key = INVITED_RULE_CREATE + req.getMeetingId();
if (!distributedLock.lock(key, RETRY_TIMES)) {
throw BizException.wrap("不可重复进行专家抽取");
}
try {
Meeting meeting = meetingService.getById(req.getMeetingId());
Assert.isTrue(!meeting.getInvited(), "不可重复进行专家抽取");
ExpertCountOnChangeVO countOnChange = expertCountOnChange(req);
for (int i = 0; i < req.getRandomRules().size(); i++) {
Integer checkCount = countOnChange.getCountList().get(i);
Integer inviteCount = req.getRandomRules().get(i).getCount();
Assert.isTrue(checkCount >= inviteCount, "可供抽取的专家数量不足");
}
AvoidInfoDTO avoidInfo = req.getAvoidInfo();
expertInviteManage.expertInviteByMeetingCreate(meeting, req.getRandomRules(), req.getAppointRule(), avoidInfo);
LambdaUpdateWrapper<Meeting> updater = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getInvited, Boolean.TRUE)
.eq(Meeting::getId, req.getMeetingId());
if (CollectionUtils.isNotEmpty(req.getRandomRules())) {
if (ExpertInviteTypeEnum.RANDOM.eq(req.getInviteType())) {
List<RandomInviteRuleDTO> randomRules = req.getRandomRules();
Assert.notEmpty(randomRules, "随机抽取规则不能为空");
AvoidInfoDTO avoidInfo = req.getAvoidRule();
Assert.notNull(avoidInfo, "回避信息不能为空");
// 随机抽取的话则需进行抽取数量校验
ExpertCountOnChangeVO countOnChange = expertCountOnChange(req);
if (!countOnChange.getStatus()) {
throw BizException.wrap(countOnChange.getMessage());
}
for (int i = 0; i < randomRules.size(); i++) {
Integer checkCount = countOnChange.getCountList().get(i);
Integer inviteCount = randomRules.get(i).getCount();
Assert.isTrue(checkCount >= inviteCount, "可供抽取的专家数量不足");
}
expertInviteManage.expertRandomInviteByMeetingCreate(meeting, randomRules, avoidInfo);
expertInviteTask.addInviteExpertTaskByMeetingCreate(meeting.getId(), 5);
updater.set(Meeting::getInviteStopped, false);
}
meetingService.update(updater);
// 回避规则
if (avoidInfo != null) {
ExpertInviteAvoidRule avoidRule = new ExpertInviteAvoidRule();
avoidRule.setMeetingId(meeting.getId());
avoidRule.setAvoidMates(avoidInfo.getAvoidMates());
avoidRule.setCompanyIds(CollUtils.joinByComma(avoidInfo.getCompanyIds()));
if (CollectionUtils.isNotEmpty(avoidInfo.getExpertIds())) {
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class);
update.set(Meeting::getInviteStopped, false);
update.eq(Meeting::getId, meeting.getId());
meetingService.update(update);
// 回避规则
if (avoidInfo != null) {
ExpertInviteAvoidRule avoidRule = new ExpertInviteAvoidRule();
avoidRule.setMeetingId(meeting.getId());
// 未传值时设置为0 表示不限制周参与次数
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()));
inviteAvoidRuleService.save(avoidRule);
}
inviteAvoidRuleService.save(avoidRule);
} else {
// 指定邀请
AppointInviteRuleDTO appointRule = req.getAppointRule();
Assert.notNull(appointRule, "指定邀请规则不能为空");
Map<Long, ExpertUserFullInfo> usersMap = expertInviteHelper.checkAppointExpert(appointRule);
// 处理指定抽取规则
ExpertInviteRule appoint = getExpertInviteRule(appointRule, meeting.getId());
inviteRuleService.save(appoint);
Long ruleId = appoint.getId();
List<MeetingExpert> experts = appointRule.getExpertIds().stream().map(w -> {
ExpertUserFullInfo info = usersMap.get(w);
MeetingExpert expert = ExpertInviteBuilder.getExpertByAppoint(meeting.getId(), info, ruleId);
expert.setStatus(ExpertAttendStatus.NOTICING.getCode());
return expert;
}).collect(Collectors.toList());
meetingExpertService.saveBatch(experts);
}
} finally {
distributedLock.releaseLock(key);
@@ -165,35 +204,27 @@ public class MeetingManage {
/**
* 抽取数量校验
*
* @param po 抽取参数
* @param req 抽取参数
* @return {@link ExpertCountOnChangeVO}
* @author WendyYang
**/
public ExpertCountOnChangeVO expertCountOnChange(ExpertInviteCreateReq po) {
public ExpertCountOnChangeVO expertCountOnChange(ExpertInviteReq req) {
// 未传递指定邀请专家直接忽略
if (po.getAppointRule() != null && CollUtil.isEmpty(po.getAppointRule().getExpertIds())) {
Assert.isTrue(CollUtil.isNotEmpty(po.getRandomRules()), "未指定抽取规则");
po.setAppointRule(null);
}
boolean appointed = po.getAppointRule() != null;
expertInviteManage.checkAppointExpertConflictWithAvoidRule(po.getAppointRule(), po.getAvoidInfo());
Meeting meeting = meetingService.getById(po.getMeetingId());
expertInviteHelper.checkAppointExpert(req.getAppointRule());
Meeting meeting = meetingService.getById(req.getMeetingId());
ExpertCountOnChangeVO resultCount = new ExpertCountOnChangeVO();
resultCount.setStatus(true);
resultCount.setCountList(new ArrayList<>());
// 参数校验
String errMsg = ValidUtil.validFast(po, AbstractInviteRule.CountCheck.class);
String errMsg = ValidUtil.validFast(req, AbstractInviteRule.CountCheck.class);
if (errMsg != null) {
resultCount.setStatus(false);
resultCount.setMessage(errMsg);
return resultCount;
}
List<Long> expertIdsChoose = new ArrayList<>();
if (appointed) {
expertIdsChoose.addAll(po.getAppointRule().getExpertIds());
}
for (RandomInviteRuleDTO randomRule : po.getRandomRules()) {
ExpertChooseDTO chooseExpert = expertInviteManage.expertInviteByRandomRule(po.getAvoidInfo(),
for (RandomInviteRuleDTO randomRule : req.getRandomRules()) {
ExpertChooseDTO chooseExpert = expertInviteManage.expertInviteByRandomRule(req.getAvoidRule(),
randomRule, expertIdsChoose, meeting.getStartTime(), meeting.getEndTime());
resultCount.addCountList(chooseExpert.getTotal());
}
@@ -277,53 +308,26 @@ public class MeetingManage {

public MeetingDetailBasicVO getMeetingBasicInfo(Long meetingId) {
Meeting meeting = meetingService.getById(meetingId);
if (Objects.isNull(meeting)) {
throw new BizException("该会议信息不存在");
}
Integer attendStatus = null;
if (LoginUserUtil.isExpert()) {
List<Long> meIds = Collections.singletonList(meetingId);
List<MeetingAndAttendStatusDTO> status = meetingExpertService.listByExpertIdAndStatus(LoginUserUtil.getUserId(), null, meIds);
if (status.isEmpty()) {
throw BizException.wrap("您未被邀请参加次会议");
}
attendStatus = meetingManageHelper.getExpertAttendStatus(status.get(0));
}
Assert.notNull(meeting, "会议不存在");
return MeetingDetailBasicVO.builder()
.id(meeting.getId())
.name(meeting.getName())
.type(meeting.getType())
.meetingId(meeting.getId())
.meetingName(meeting.getName())
.meetingType(meeting.getType())
.meetingAddress(meeting.getMeetingAddress())
.typeName(dictionaryCache.getByCode(meeting.getType()).getName())
.author(meeting.getCreator())
.startTime(meeting.getStartTime())
.createOn(meeting.getCreateOn())
.judgesAttendanceTime(meeting.getJudgesAttendanceTime())
.meetingUsageTime(meeting.getMeetingUsageTime())
.contact(meeting.getContact())
.connecter(meeting.getConnecter())
.status(meeting.getStatus())
.attendStatus(attendStatus)
.cancelRemark(meeting.getCancelRemark())
.createBy(meeting.getCreator())
.holdOrg(meeting.getHoldOrg())
.invited(meeting.getInvited())
.createOn(meeting.getCreateOn())
.creator(meeting.getCreator())
.createBy(meeting.getCreator())
.build();
}

public void uploadMeetingResult(MeetingResultReq po) {
LambdaUpdateWrapper<Meeting> updater = Wrappers.lambdaUpdate(Meeting.class)
.eq(Meeting::getId, po.getMeetingId())
.set(Meeting::getStatus, Manager.COMPLETED.getCode());
meetingService.update(updater);
}

public MeetingResultVO meetingResultDetail(Long meetingId) {
LambdaQueryWrapper<Meeting> query = Wrappers.lambdaQuery(Meeting.class)
.eq(Meeting::getId, meetingId);
MeetingResultVO result = new MeetingResultVO();
result.setMeetingId(meetingId);
return result;
}


public ExpertInviteDetailVO inviteDetail(Long meetingId) {
ExpertInviteDetailVO result = new ExpertInviteDetailVO();
Meeting meeting = meetingService.getById(meetingId);
@@ -340,7 +344,7 @@ public class MeetingManage {
List<MeetingExpert> attendList = new ArrayList<>();
List<Long> expertIds = new ArrayList<>();
experts.forEach(w -> {
boolean randomInvite = w.getInviteType().equals(ExpertInviteType.RANDOM.getCode());
boolean randomInvite = w.getInviteType().equals(ExpertInviteTypeEnum.RANDOM.getCode());
if (randomInvite) {
randomList.add(w);
} else {
@@ -382,7 +386,7 @@ public class MeetingManage {
attendList.forEach(w -> {
ExpertBasicInfoVO expertBasicInfoVo = expertBasicInfoVoMap.get(w.getExpertId());
ExpertAttendListItemVO item = BeanUtil.copyProperties(expertBasicInfoVo, ExpertAttendListItemVO.class);
item.setInviteType(ExpertInviteType.getByCode(w.getInviteType()).getName());
item.setInviteType(ExpertInviteTypeEnum.getByCode(w.getInviteType()).getName());
result.addAttendList(item);
});
return result;
@@ -430,13 +434,10 @@ public class MeetingManage {
public InviteRuleDetailVO inviteRuleDetail(Long meetingId) {
InviteRuleDetailVO result = new InviteRuleDetailVO();
List<ExpertInviteRule> inviteRules = inviteRuleService.listByMeetingId(meetingId);
if (!result.setAndGetInvited(inviteRules.size() > 0)) {
return result;
}
result.setRandomRules(new ArrayList<>());
Map<ExpertInviteType, List<ExpertInviteRule>> groupByType = CollUtils.group(inviteRules, w -> ExpertInviteType.getByCode(w.getInviteType()));
List<ExpertInviteRule> randoms = groupByType.get(ExpertInviteType.RANDOM);
if (CollectionUtils.isNotEmpty(randoms)) {
Map<ExpertInviteTypeEnum, List<ExpertInviteRule>> groupByType = CollUtils.group(inviteRules, w -> ExpertInviteTypeEnum.getByCode(w.getInviteType()));
List<ExpertInviteRule> randoms = groupByType.get(ExpertInviteTypeEnum.RANDOM);
if (CollUtil.isNotEmpty(randoms)) {
randoms.forEach(random -> {
RandomInviteRuleVO randomRule = JSON.parseObject(random.getInviteRule(), RandomInviteRuleVO.class);
if (randomRule.getExpertTags() != null) {
@@ -452,35 +453,34 @@ public class MeetingManage {
});
}
if (StrUtil.isNotEmpty(randomRule.getIntentionRegionCode())) {
// TODO 履职意向地
/*List<RegionDTO> intentionRegions = regionCache.listParents(randomRule.getIntentionRegionCode(), randomRule.getIntentionRegionLevel());
randomRule.setIntentionRegions(intentionRegions);*/
}
if (StrUtil.isNotEmpty(randomRule.getExpertRegionCode())) {
// TODO 专家层级
/*List<RegionDTO> expertRegions = regionCache.listParents(randomRule.getExpertRegionCode(), randomRule.getExpertRegionLevel());
randomRule.setExpertRegions(expertRegions);*/
}
result.getRandomRules().add(randomRule);
});
}
List<ExpertInviteRule> appoints = groupByType.get(ExpertInviteType.APPOINT);
if (result.setAndGetHasAppointRule(CollUtil.isNotEmpty(appoints))) {
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<ExpertInviteRule> appoints = groupByType.get(ExpertInviteTypeEnum.APPOINT);
ExpertInviteRule appoint = appoints.get(0);
AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class);
InviteRuleDetailVO.AppointRuleVo vo = new InviteRuleDetailVO.AppointRuleVo();
AppointRuleVO vo = new 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();
vo.setAvoidMates(avoidInfo.getAvoidMates());
vo.setCompanyIds(avoidInfo.getCompanyIds());
if (CollectionUtils.isNotEmpty(avoidInfo.getExpertIds())) {
vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(avoidInfo.getExpertIds()).values()));
}
result.setAvoidInfo(vo);
}
return result;
}

@@ -506,7 +506,7 @@ public class MeetingManage {
// 邀请规则
RandomInviteRuleDTO randomInviteRuleDto = null;
for (ExpertInviteRule rule : inviteRules) {
if (rule.getInviteType().equals(ExpertInviteType.RANDOM.getCode()) &&
if (rule.getInviteType().equals(ExpertInviteTypeEnum.RANDOM.getCode()) &&
rule.getId().equals(meetingExpert.getRuleId())) {
randomInviteRuleDto = JSON.parseObject(rule.getInviteRule(), RandomInviteRuleDTO.class);
ruleId = rule.getId();
@@ -607,7 +607,6 @@ public class MeetingManage {
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getStatus, Manager.CANCELED.getCode())
.set(Meeting::getUpdateBy, LoginUserUtil.getUserId())
.set(Meeting::getCancelRemark, po.getCancelRemark())
.set(Meeting::getUpdateOn, LocalDateTime.now())
.eq(Meeting::getId, po.getMeetingId());
meetingService.update(update);


+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingInnerProjectMapper.java Bestand weergeven

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.meeting.mapper;

import com.ningdatech.pmapi.meeting.entity.domain.MeetingInnerProject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 会议评审内部项目表 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2023-02-28
*/
public interface MeetingInnerProjectMapper extends BaseMapper<MeetingInnerProject> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingInnerProjectMapper.xml Bestand weergeven

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.pmapi.meeting.mapper.MeetingInnerProjectMapper">

</mapper>

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingOuterProjectMapper.java Bestand weergeven

@@ -0,0 +1,16 @@
package com.ningdatech.pmapi.meeting.mapper;

import com.ningdatech.pmapi.meeting.entity.domain.MeetingOuterProject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 会议评审外部项目 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2023-02-28
*/
public interface MeetingOuterProjectMapper extends BaseMapper<MeetingOuterProject> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingOuterProjectMapper.xml Bestand weergeven

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.pmapi.meeting.mapper.MeetingOuterProjectMapper">

</mapper>

Some files were not shown because too many files changed in this diff

Laden…
Annuleren
Opslaan