From e50065d4054b05e5ead580e5593498eabfd9010b Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 22 Feb 2023 10:34:27 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E5=BA=93=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/GeneratorCodeKingbaseConfig.java | 2 +- .../controller/ExpertUserFullInfoController.java | 20 ++++ .../pmapi/expert/entity/ExpertUserFullInfo.java | 105 +++++++++++++++++++++ .../expert/mapper/NdExpertUserFullInfoMapper.java | 16 ++++ .../expert/mapper/NdExpertUserFullInfoMapper.xml | 5 + .../expert/service/IExpertUserFullInfoService.java | 16 ++++ .../impl/ExpertUserFullInfoServiceImpl.java | 20 ++++ 7 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertUserFullInfoController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index 1da4c6a..83a5a4c 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -56,7 +56,7 @@ public class GeneratorCodeKingbaseConfig { } public static void main(String[] args) { - generate("WendyYang", "projectlib", PATH_YYD, "nd_project_renewal_fund_declaration"); + generate("Liuxinxin", "expert", PATH_LXX, "nd_expert_user_full_info"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertUserFullInfoController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertUserFullInfoController.java new file mode 100644 index 0000000..55e6ab3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertUserFullInfoController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.expert.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/pmapi.expert/nd-expert-user-full-info") +public class ExpertUserFullInfoController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java new file mode 100644 index 0000000..76f024a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java @@ -0,0 +1,105 @@ +package com.ningdatech.pmapi.expert.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@TableName("nd_expert_user_full_info") +@Data +@ApiModel(value = "NdExpertUserFullInfo对象", description = "") +public class ExpertUserFullInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String expertAccountStatus; + + private String isDingUser; + + private String userInfoStep; + + private String phoneNo; + + private String gender; + + private String expertName; + + private String avatarFileId; + + private String idCard; + + private String officePhone; + + private String bankNo; + + private String bank; + + private String email; + + private String school; + + private LocalDateTime graduatedAt; + + private String academicTitle; + + private String graduationCertificateFileIdList; + + private String degreeCertificateFileIdList; + + private LocalDateTime retiredAt; + + private String company; + + private String legalEntityCode; + + private String administrativeDuties; + + private String startWorkAt; + + private String address; + + private String experience; + + private String technicalTitles; + + private String titleCertificateFileIdList; + + private String awards; + + private String recognitionReward; + + private String recommendationProofFileIdList; + + private String regionCode; + + private String regionLevel; + + private String recommendedWay; + + private String remark; + + private String hometown; + + private String nationality; + + private LocalDateTime birth; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.java new file mode 100644 index 0000000..884b0be --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.expert.mapper; + +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface NdExpertUserFullInfoMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.xml new file mode 100644 index 0000000..1819911 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/NdExpertUserFullInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java new file mode 100644 index 0000000..5003a20 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.expert.service; + +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IExpertUserFullInfoService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java new file mode 100644 index 0000000..580d087 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.expert.service.impl; + +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.ningdatech.pmapi.expert.mapper.NdExpertUserFullInfoMapper; +import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class ExpertUserFullInfoServiceImpl extends ServiceImpl implements IExpertUserFullInfoService { + +} From 286eaf40dc5449af6a1bb17078ac214814b94ae8 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 22 Feb 2023 10:50:17 +0800 Subject: [PATCH 02/16] meta_tag --- .../config/GeneratorCodeKingbaseConfig.java | 2 +- .../pmapi/tag/controller/MetaTagController.java | 20 +++++++++++ .../com/ningdatech/pmapi/tag/entity/MetaTag.java | 41 ++++++++++++++++++++++ .../ningdatech/pmapi/tag/mapper/MetaTagMapper.java | 16 +++++++++ .../ningdatech/pmapi/tag/mapper/MetaTagMapper.xml | 5 +++ .../pmapi/tag/service/IMetaTagService.java | 16 +++++++++ .../pmapi/tag/service/impl/MetaTagServiceImpl.java | 20 +++++++++++ .../pmapi/user/manage/UserInfoManage.java | 1 - 8 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/MetaTagController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IMetaTagService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/MetaTagServiceImpl.java diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index 83a5a4c..8ad79cd 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -56,7 +56,7 @@ public class GeneratorCodeKingbaseConfig { } public static void main(String[] args) { - generate("Liuxinxin", "expert", PATH_LXX, "nd_expert_user_full_info"); + generate("Liuxinxin", "tag", PATH_LXX, "meta_tag"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/MetaTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/MetaTagController.java new file mode 100644 index 0000000..84fd5d1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/MetaTagController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.tag.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/pmapi.tag/meta-tag") +public class MetaTagController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java new file mode 100644 index 0000000..261d81b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.tag.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Data +@TableName("meta_tag") +@ApiModel(value = "MetaTag对象", description = "") +public class MetaTag implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private String tagName; + + private Long tagLevel; + + private String parentCode; + + private String tagType; + + private String tagCode; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.java new file mode 100644 index 0000000..3e7a783 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.tag.mapper; + +import com.ningdatech.pmapi.tag.entity.MetaTag; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface MetaTagMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.xml new file mode 100644 index 0000000..2b3f916 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IMetaTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IMetaTagService.java new file mode 100644 index 0000000..ce9005b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IMetaTagService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.tag.service; + +import com.ningdatech.pmapi.tag.entity.MetaTag; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IMetaTagService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/MetaTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/MetaTagServiceImpl.java new file mode 100644 index 0000000..458b843 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/MetaTagServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.tag.service.impl; + +import com.ningdatech.pmapi.tag.entity.MetaTag; +import com.ningdatech.pmapi.tag.mapper.MetaTagMapper; +import com.ningdatech.pmapi.tag.service.IMetaTagService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class MetaTagServiceImpl extends ServiceImpl implements IMetaTagService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java index d74ae3f..cbb1376 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java @@ -86,7 +86,6 @@ public class UserInfoManage { resListVO.setOrgName(r.getOrganizationCode()); resListVO.setOrgCode(r.getOrganizationCode()); // TODO 从用户信息中获取 - // 从所属组织中获取 // resListVO.setRegionId(); From 954fe784c8c0df03de44b576a8158b0b0a72a59c Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 22 Feb 2023 11:12:14 +0800 Subject: [PATCH 03/16] meta tag dictionary expert_dictionary expert_tag --- .../config/GeneratorCodeKingbaseConfig.java | 2 +- .../controller/ExpertDictionaryController.java | 20 +++++++++ .../controller/MetaDictionaryController.java | 20 +++++++++ .../pmapi/dictionary/entity/ExpertDictionary.java | 36 +++++++++++++++++ .../pmapi/dictionary/entity/MetaDictionary.java | 47 ++++++++++++++++++++++ .../dictionary/mapper/ExpertDictionaryMapper.java | 16 ++++++++ .../dictionary/mapper/ExpertDictionaryMapper.xml | 5 +++ .../dictionary/mapper/MetaDictionaryMapper.java | 16 ++++++++ .../dictionary/mapper/MetaDictionaryMapper.xml | 5 +++ .../service/IExpertDictionaryService.java | 16 ++++++++ .../dictionary/service/IMetaDictionaryService.java | 16 ++++++++ .../service/impl/ExpertDictionaryServiceImpl.java | 20 +++++++++ .../service/impl/MetaDictionaryServiceImpl.java | 20 +++++++++ .../pmapi/tag/controller/ExpertTagController.java | 20 +++++++++ .../com/ningdatech/pmapi/tag/entity/ExpertTag.java | 36 +++++++++++++++++ .../pmapi/tag/mapper/ExpertTagMapper.java | 16 ++++++++ .../pmapi/tag/mapper/ExpertTagMapper.xml | 5 +++ .../pmapi/tag/service/IExpertTagService.java | 16 ++++++++ .../tag/service/impl/ExpertTagServiceImpl.java | 20 +++++++++ 19 files changed, 351 insertions(+), 1 deletion(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/ExpertDictionaryController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/MetaDictionaryController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IExpertDictionaryService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IMetaDictionaryService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/ExpertDictionaryServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/MetaDictionaryServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/ExpertTagController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IExpertTagService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/ExpertTagServiceImpl.java diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index 8ad79cd..cd63542 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -56,7 +56,7 @@ public class GeneratorCodeKingbaseConfig { } public static void main(String[] args) { - generate("Liuxinxin", "tag", PATH_LXX, "meta_tag"); + generate("Liuxinxin", "tag", PATH_LXX, "expert_tag"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/ExpertDictionaryController.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/ExpertDictionaryController.java new file mode 100644 index 0000000..80d63a7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/ExpertDictionaryController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.dictionary.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/pmapi.dictionary/expert-dictionary") +public class ExpertDictionaryController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/MetaDictionaryController.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/MetaDictionaryController.java new file mode 100644 index 0000000..6bb2a01 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/MetaDictionaryController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.dictionary.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/pmapi.dictionary/meta-dictionary") +public class MetaDictionaryController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java new file mode 100644 index 0000000..a2de62f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java @@ -0,0 +1,36 @@ +package com.ningdatech.pmapi.dictionary.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Data +@TableName("expert_dictionary") +@ApiModel(value = "ExpertDictionary对象", description = "") +public class ExpertDictionary implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private String dictionaryCode; + + private String expertInfoField; + + private Long userId; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java new file mode 100644 index 0000000..f643b5b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java @@ -0,0 +1,47 @@ +package com.ningdatech.pmapi.dictionary.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Data +@TableName("meta_dictionary") +@ApiModel(value = "MetaDictionary对象", description = "") +public class MetaDictionary implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private String dictionaryType; + + private String dictionaryCode; + + private String dictionaryName; + + private String dictionaryDescribe; + + private Integer sortValue; + + private Long createBy; + + private String readonly; + + private Long updateBy; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.java new file mode 100644 index 0000000..8066d56 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.dictionary.mapper; + +import com.ningdatech.pmapi.dictionary.entity.ExpertDictionary; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface ExpertDictionaryMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.xml new file mode 100644 index 0000000..2b2971c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.java new file mode 100644 index 0000000..b02222c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.dictionary.mapper; + +import com.ningdatech.pmapi.dictionary.entity.MetaDictionary; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface MetaDictionaryMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.xml new file mode 100644 index 0000000..6541927 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IExpertDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IExpertDictionaryService.java new file mode 100644 index 0000000..a10655b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IExpertDictionaryService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.dictionary.service; + +import com.ningdatech.pmapi.dictionary.entity.ExpertDictionary; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IExpertDictionaryService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IMetaDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IMetaDictionaryService.java new file mode 100644 index 0000000..47a1ab6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IMetaDictionaryService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.dictionary.service; + +import com.ningdatech.pmapi.dictionary.entity.MetaDictionary; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IMetaDictionaryService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/ExpertDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/ExpertDictionaryServiceImpl.java new file mode 100644 index 0000000..f9025cc --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/ExpertDictionaryServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.dictionary.service.impl; + +import com.ningdatech.pmapi.dictionary.entity.ExpertDictionary; +import com.ningdatech.pmapi.dictionary.mapper.ExpertDictionaryMapper; +import com.ningdatech.pmapi.dictionary.service.IExpertDictionaryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class ExpertDictionaryServiceImpl extends ServiceImpl implements IExpertDictionaryService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/MetaDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/MetaDictionaryServiceImpl.java new file mode 100644 index 0000000..882c55a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/MetaDictionaryServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.dictionary.service.impl; + +import com.ningdatech.pmapi.dictionary.entity.MetaDictionary; +import com.ningdatech.pmapi.dictionary.mapper.MetaDictionaryMapper; +import com.ningdatech.pmapi.dictionary.service.IMetaDictionaryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class MetaDictionaryServiceImpl extends ServiceImpl implements IMetaDictionaryService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/ExpertTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/ExpertTagController.java new file mode 100644 index 0000000..c284fb8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/ExpertTagController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.tag.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/pmapi.tag/expert-tag") +public class ExpertTagController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java new file mode 100644 index 0000000..8b24ad8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java @@ -0,0 +1,36 @@ +package com.ningdatech.pmapi.tag.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@TableName("expert_tag") +@Data +@ApiModel(value = "ExpertTag对象", description = "") +public class ExpertTag implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String tagCode; + + private String expertInfoField; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.java new file mode 100644 index 0000000..01a1bf2 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.tag.mapper; + +import com.ningdatech.pmapi.tag.entity.ExpertTag; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface ExpertTagMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.xml new file mode 100644 index 0000000..d705269 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IExpertTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IExpertTagService.java new file mode 100644 index 0000000..4970bb6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IExpertTagService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.tag.service; + +import com.ningdatech.pmapi.tag.entity.ExpertTag; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IExpertTagService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/ExpertTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/ExpertTagServiceImpl.java new file mode 100644 index 0000000..d62ceef --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/ExpertTagServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.tag.service.impl; + +import com.ningdatech.pmapi.tag.entity.ExpertTag; +import com.ningdatech.pmapi.tag.mapper.ExpertTagMapper; +import com.ningdatech.pmapi.tag.service.IExpertTagService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class ExpertTagServiceImpl extends ServiceImpl implements IExpertTagService { + +} From 009fe4836a4b80949cc6bfef6aa705eca1570309 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 22 Feb 2023 11:12:42 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../todocenter/bean/entity/ProcessComment.java | 35 ------------ .../pmapi/todocenter/manage/TodoCenterManage.java | 62 +++++++++++++++++++--- .../model/dto/req/ReqProcessHandlerDTO.java | 3 +- 3 files changed, 57 insertions(+), 43 deletions(-) delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProcessComment.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProcessComment.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProcessComment.java deleted file mode 100644 index 95a4a8b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProcessComment.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ningdatech.pmapi.todocenter.bean.entity; - -import com.ningdatech.pmapi.common.model.FileBasicInfo; -import com.wflow.workflow.bean.vo.ProcessHandlerParamsVo; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Collections; -import java.util.List; - -/** - * 审核意见实体 - * - * @author CMM - * @since 2023/02/01 16:25 - */ -@Data -@NoArgsConstructor -public class ProcessComment { - /** - * 文字评论 - */ - protected String text; - /** - * 评论附件 - */ - protected List attachments; - - public ProcessComment(String text, List attachments) { - this.text = text; - this.attachments = null == attachments ? Collections.emptyList() : attachments; - } -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index f882b27..2131c7a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -22,7 +22,6 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum; @@ -43,6 +42,7 @@ import com.wflow.exception.BusinessException; import com.wflow.mapper.WflowCcTasksMapper; import com.wflow.mapper.WflowModelHistorysMapper; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; +import com.wflow.workflow.bean.process.ProcessComment; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.vo.ProcessInstanceVo; import com.wflow.workflow.bean.vo.ProcessProgressVo; @@ -61,7 +61,6 @@ import org.flowable.engine.history.HistoricActivityInstance; import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.runtime.ActivityInstance; import org.flowable.engine.runtime.Execution; -import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.task.Comment; import org.flowable.task.api.Task; import org.flowable.task.api.history.HistoricTaskInstance; @@ -105,7 +104,6 @@ public class TodoCenterManage { private final ZwddClient zwddClient; private final IDingEmployeeInfoService dingEmployeeInfoService; private final IDingOrganizationService dingOrganizationService; - private final ProcessInstanceService processInstanceService; /** @@ -207,13 +205,66 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); + // 获取入参 + String processInstanceId = param.getInstanceId(); + Long projectId = param.getProjectId(); + + // 获取当前要处理的流程实例 + HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(processInstanceId) + .singleResult(); + // 获取流程发起人信息 + String startUserId = instance.getStartUserId(); + ProcessInstanceUserDto startUser = userInfoService.getUserInfo(startUserId); + // 若进行的是撤回操作(流程发起人和当前流程审核人的前一个审核人操作) if (param.getAction().equals(ProcessHandlerEnum.WITHDRAW)) { + // 当前登录用户是流程发起人 + if (userId.equals(Long.valueOf(startUser.getUserId()))){ + // processTaskService.handleTask(param, userId); + // 获取当前申报项目 + Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) + .eq(Project::getInstCode, processInstanceId) + .eq(Project::getId,projectId)); + // 获取当前项目状态 + Integer projectStatus = declaredProject.getStatus(); + // TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录 + // 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 + switch (Objects.requireNonNull(ProjectStatusEnum.getValue(projectStatus))) { + // 当前项目状态是单位内部审核中 + case UNDER_INTERNAL_AUDIT: + // 当前项目状态是预审中 + case PRE_APPLYING: + // 当前项目状态是部门联审中 + case DEPARTMENT_JOINT_REVIEW: + // 当前项目状态是方案评审中 + case SCHEME_UNDER_REVIEW: + // 当前项目状态是终验审核中 + case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: + updateWithdrawProjectStatus(userId, declaredProject); + break; + default: + throw new IllegalStateException("Unexpected value: " + projectStatus); + } + }else { + // 当前登录用户不是流程发起人 + ProcessProgressVo progressInstanceDetail = processInstanceService + .getProgressInstanceDetail(null, processInstanceId); + List progressInfo = progressInstanceDetail.getProgressInfo(); + // 获取当前当前工作流任务前一个审核人信息 + ProgressNode beforeProgressNode = progressInfo.get(progressInfo.size() - 2); + ProcessInstanceUserDto beforeUser = beforeProgressNode.getUser(); + // 获取当前当前工作流任务当前审核人信息 + ProgressNode currentProgressNode = progressInfo.get(progressInfo.size() - 1); + ProcessInstanceUserDto currentUser = currentProgressNode.getUser(); + // 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 + + Boolean orgFlag = true; + // processTaskService.handleTask(param, userId); + } HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery() .taskId(param.getTaskId()) .singleResult(); - // 获取要处理的项目ID - Long projectId = param.getProjectId(); doWithDrawProcess(handledTaskInstance, userId, projectId); return; } @@ -873,7 +924,6 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); -// String userId = param.getUserId(); param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java index eba90b5..0a9c98d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java @@ -1,8 +1,7 @@ package com.ningdatech.pmapi.todocenter.model.dto.req; -import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment; +import com.wflow.workflow.bean.process.ProcessComment; import com.wflow.workflow.enums.ProcessHandlerEnum; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; From 8f9cba75f9dc37d2759604b26a350386de9b3d41 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 22 Feb 2023 11:37:15 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E5=B1=A5=E8=81=8C?= =?UTF-8?q?=E6=84=8F=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/GeneratorCodeKingbaseConfig.java | 2 +- .../ExpertIntentionWorkRegionController.java | 20 ++++++++++++ .../expert/entity/ExpertIntentionWorkRegion.java | 36 ++++++++++++++++++++++ .../mapper/ExpertIntentionWorkRegionMapper.java | 16 ++++++++++ .../mapper/ExpertIntentionWorkRegionMapper.xml | 5 +++ .../service/IExpertIntentionWorkRegionService.java | 16 ++++++++++ .../impl/ExpertIntentionWorkRegionServiceImpl.java | 20 ++++++++++++ 7 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertIntentionWorkRegionController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertIntentionWorkRegionService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertIntentionWorkRegionServiceImpl.java diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index cd63542..49bc070 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -56,7 +56,7 @@ public class GeneratorCodeKingbaseConfig { } public static void main(String[] args) { - generate("Liuxinxin", "tag", PATH_LXX, "expert_tag"); + generate("Liuxinxin", "expert", PATH_LXX, "expert_intention_work_region"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertIntentionWorkRegionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertIntentionWorkRegionController.java new file mode 100644 index 0000000..55ef1a5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertIntentionWorkRegionController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.expert.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/pmapi.expert/expert-intention-work-region") +public class ExpertIntentionWorkRegionController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java new file mode 100644 index 0000000..502773d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java @@ -0,0 +1,36 @@ +package com.ningdatech.pmapi.expert.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@TableName("expert_intention_work_region") +@Data +@ApiModel(value = "ExpertIntentionWorkRegion对象", description = "") +public class ExpertIntentionWorkRegion implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String regionCode; + + private Integer regionLevel; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.java new file mode 100644 index 0000000..1867577 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.expert.mapper; + +import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface ExpertIntentionWorkRegionMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.xml new file mode 100644 index 0000000..f33bbfa --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertIntentionWorkRegionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertIntentionWorkRegionService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertIntentionWorkRegionService.java new file mode 100644 index 0000000..6c1a9b5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertIntentionWorkRegionService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.expert.service; + +import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IExpertIntentionWorkRegionService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertIntentionWorkRegionServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertIntentionWorkRegionServiceImpl.java new file mode 100644 index 0000000..74403d9 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertIntentionWorkRegionServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.expert.service.impl; + +import com.ningdatech.pmapi.expert.entity.ExpertIntentionWorkRegion; +import com.ningdatech.pmapi.expert.mapper.ExpertIntentionWorkRegionMapper; +import com.ningdatech.pmapi.expert.service.IExpertIntentionWorkRegionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class ExpertIntentionWorkRegionServiceImpl extends ServiceImpl implements IExpertIntentionWorkRegionService { + +} From 826b95bb7594733c640edaa26343e791739e7bdf Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 22 Feb 2023 14:23:05 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=87=AA=E5=A2=9E?= =?UTF-8?q?=E4=B8=BB=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java index 791a84f..c7ee627 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java @@ -1,5 +1,7 @@ package com.ningdatech.pmapi.user.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.AllArgsConstructor; @@ -28,6 +30,7 @@ public class UserInfo implements Serializable { private static final long serialVersionUID = 1L; + @TableId(type = IdType.AUTO) private Long id; private LocalDateTime createOn; From d2bc2eefd69269008b8392020f88fe2fc91e057e Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 22 Feb 2023 14:25:18 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/dictionary/entity/ExpertDictionary.java | 3 +++ .../ningdatech/pmapi/dictionary/entity/MetaDictionary.java | 3 +++ .../pmapi/expert/entity/ExpertIntentionWorkRegion.java | 11 +++++++---- .../ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java | 9 ++++++--- .../main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java | 3 +++ .../main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java | 3 +++ 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java index a2de62f..e5f5181 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java @@ -1,5 +1,7 @@ package com.ningdatech.pmapi.dictionary.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.time.LocalDateTime; @@ -22,6 +24,7 @@ public class ExpertDictionary implements Serializable { private static final long serialVersionUID = 1L; + @TableId(type = IdType.AUTO) private Long id; private LocalDateTime createOn; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java index f643b5b..7bf2183 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java @@ -1,5 +1,7 @@ package com.ningdatech.pmapi.dictionary.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; @@ -22,6 +24,7 @@ public class MetaDictionary implements Serializable { private static final long serialVersionUID = 1L; + @TableId(type = IdType.AUTO) private Long id; private LocalDateTime createOn; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java index 502773d..a001dca 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertIntentionWorkRegion.java @@ -1,15 +1,17 @@ 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 java.io.Serializable; -import java.time.LocalDateTime; import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.io.Serializable; +import java.time.LocalDateTime; + /** *

- * + * *

* * @author Liuxinxin @@ -22,6 +24,7 @@ public class ExpertIntentionWorkRegion implements Serializable { private static final long serialVersionUID = 1L; + @TableId(type = IdType.AUTO) private Long id; private LocalDateTime createOn; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java index 76f024a..a6af778 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java @@ -1,12 +1,14 @@ 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 java.io.Serializable; -import java.time.LocalDateTime; import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.io.Serializable; +import java.time.LocalDateTime; + /** *

* @@ -22,6 +24,7 @@ public class ExpertUserFullInfo implements Serializable { private static final long serialVersionUID = 1L; + @TableId(type = IdType.AUTO) private Long id; private LocalDateTime createOn; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java index 8b24ad8..d409abf 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java @@ -1,5 +1,7 @@ package com.ningdatech.pmapi.tag.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.time.LocalDateTime; @@ -22,6 +24,7 @@ public class ExpertTag implements Serializable { private static final long serialVersionUID = 1L; + @TableId(type = IdType.AUTO) private Long id; private LocalDateTime createOn; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java index 261d81b..cc4b52a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java @@ -1,5 +1,7 @@ package com.ningdatech.pmapi.tag.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.time.LocalDateTime; @@ -22,6 +24,7 @@ public class MetaTag implements Serializable { private static final long serialVersionUID = 1L; + @TableId(type = IdType.AUTO) private Long id; private LocalDateTime createOn; From ac4d52da98f20b1588853ea6d0f34eb8edf54c39 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 22 Feb 2023 14:42:51 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E8=A7=92=E8=89=B2=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/sys/controller/RoleController.java | 9 ++++++--- .../java/com/ningdatech/pmapi/sys/manage/RoleManage.java | 16 ++++++++++++++++ .../java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java | 8 +++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java index 1950dc2..2d59277 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RoleController.java @@ -5,12 +5,13 @@ import cn.hutool.core.lang.Assert; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.sys.model.entity.Role; -import com.ningdatech.pmapi.sys.model.req.RolePageReq; +import com.ningdatech.pmapi.sys.manage.RoleManage; +import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO; import com.ningdatech.pmapi.sys.model.dto.RoleSaveDTO; import com.ningdatech.pmapi.sys.model.dto.RoleUpdateDTO; +import com.ningdatech.pmapi.sys.model.entity.Role; +import com.ningdatech.pmapi.sys.model.req.RolePageReq; import com.ningdatech.pmapi.sys.model.vo.RoleVO; -import com.ningdatech.pmapi.sys.manage.RoleManage; import com.ningdatech.pmapi.sys.service.IRoleService; import com.ningdatech.pmapi.user.util.LoginUserUtil; import io.swagger.annotations.Api; @@ -62,6 +63,8 @@ public class RoleController { Assert.notNull(role, "角色不存在"); RoleVO query = BeanUtil.toBean(role, RoleVO.class); query.setManageRoleIdList(BizUtils.splitToLong(role.getManageRoleIds())); + List menuDataScope = roleManage.getMenuDataScope(id); + query.setMenuDataScopeList(menuDataScope); // 菜单 roleManage.buildMenu(query); return query; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java index 33001de..7397dc7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java @@ -6,13 +6,16 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO; import com.ningdatech.pmapi.sys.model.entity.Menu; import com.ningdatech.pmapi.sys.model.entity.Role; import com.ningdatech.pmapi.sys.model.entity.RoleMenu; +import com.ningdatech.pmapi.sys.model.entity.RoleMenuDatascope; import com.ningdatech.pmapi.sys.model.req.RolePageReq; import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO; import com.ningdatech.pmapi.sys.model.vo.RoleVO; import com.ningdatech.pmapi.sys.service.IMenuService; +import com.ningdatech.pmapi.sys.service.IRoleMenuDatascopeService; import com.ningdatech.pmapi.sys.service.IRoleMenuService; import com.ningdatech.pmapi.sys.service.IRoleService; import lombok.RequiredArgsConstructor; @@ -38,6 +41,7 @@ public class RoleManage { private final IRoleService roleService; private final IMenuService menuService; private final IRoleMenuService roleMenuService; + private final IRoleMenuDatascopeService roleMenuDatascopeService; public PageVo queryList(RolePageReq rolePageReq) { Page page = rolePageReq.page(); @@ -71,4 +75,16 @@ public class RoleManage { query.setMenu(menus); } + public List getMenuDataScope(Long roleId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(RoleMenuDatascope.class) + .eq(RoleMenuDatascope::getRoleId, roleId); + List menuDataScopes = roleMenuDatascopeService.list(query); + return CollUtils.convert(menuDataScopes, w -> { + MenuDataScopeDTO dto = new MenuDataScopeDTO(); + dto.setDataScope(w.getDatascope()); + dto.setMenuId(w.getMenuId()); + return dto; + }); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java index e9d18ec..570d5ec 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.sys.model.vo; +import com.ningdatech.pmapi.sys.model.dto.MenuDataScopeDTO; import com.ningdatech.pmapi.sys.model.entity.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -49,11 +50,8 @@ public class RoleVO extends BaseEntity { @ApiModelProperty("是否是内置角色:true 是、false 否") private Boolean fixed; - /** - * 数据范围 - */ - @ApiModelProperty(value = "数据范围 1全部 2本区域 3本区域以及下区域 4本公司") - private Integer dataScope; + @ApiModelProperty("菜单数据权限") + private List menuDataScopeList; /** * 菜单 From 9e0a96041330885f8adffeeb9447fe80b861c98d Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 22 Feb 2023 16:11:37 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/sys/controller/NoticeController.java | 5 +++-- .../src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java index 6f8a722..92e42b4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java @@ -61,8 +61,9 @@ public class NoticeController { @GetMapping("/dashboard/list") @ApiOperation("工作台公告列表") - public PageVo dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit) { - return noticeManage.dashboardList(limit); + public PageVo dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit, + @RequestParam(required = false) Integer type) { + return noticeManage.dashboardList(limit, type); } @GetMapping("/manage/list") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index ad11871..128610b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -73,10 +73,11 @@ public class NoticeManage { } - public PageVo dashboardList(Integer limit) { + public PageVo dashboardList(Integer limit, Integer type) { NoticeListReq req = new NoticeListReq(); req.setPageSize(limit); req.setEnabled(true); + req.setType(type); return listByManager(req); } From f84ca1d210822f7f362d83db77f819b6ab46794a Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 22 Feb 2023 16:17:38 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=AE=A1=E7=90=86/?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E7=AE=A1=E7=90=86/=E6=A0=87=E7=AD=BEcache/?= =?UTF-8?q?=E5=AD=97=E5=85=B8cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/constant/BoolDisplayEnum.java | 32 +++ .../com/ningdatech/pmapi/common/util/BizUtils.java | 6 + .../controller/ExpertDictionaryController.java | 20 -- .../controller/MetaDictionaryController.java | 20 -- .../pmapi/dictionary/entity/ExpertDictionary.java | 39 --- .../pmapi/dictionary/entity/MetaDictionary.java | 50 ---- .../dictionary/mapper/ExpertDictionaryMapper.java | 16 -- .../dictionary/mapper/ExpertDictionaryMapper.xml | 5 - .../dictionary/mapper/MetaDictionaryMapper.java | 16 -- .../dictionary/mapper/MetaDictionaryMapper.xml | 5 - .../service/IExpertDictionaryService.java | 16 -- .../dictionary/service/IMetaDictionaryService.java | 16 -- .../service/impl/ExpertDictionaryServiceImpl.java | 20 -- .../service/impl/MetaDictionaryServiceImpl.java | 20 -- .../pmapi/expert/entity/ExpertUserFullInfo.java | 2 +- .../meta/assembler/MetaDictionaryAssembler.java | 36 +++ .../pmapi/meta/assembler/MetaTagAssembler.java | 62 +++++ .../pmapi/meta/constant/DictAllTypeEnum.java | 53 ++++ .../meta/constant/DictExpertInfoTypeEnum.java | 70 +++++ .../pmapi/meta/constant/ExpertTagEnum.java | 51 ++++ .../ningdatech/pmapi/meta/constant/TagConst.java | 21 ++ .../controller/ExpertDictionaryController.java | 20 ++ .../pmapi/meta/controller/ExpertTagController.java | 20 ++ .../meta/controller/MetaDictionaryController.java | 20 ++ .../pmapi/meta/controller/MetaTagController.java | 20 ++ .../meta/controller/MetaTagManageController.java | 79 ++++++ .../pmapi/meta/helper/DictionaryCache.java | 49 ++++ .../com/ningdatech/pmapi/meta/helper/TagCache.java | 55 ++++ .../meta/helper/basic/AbstractDictionaryCache.java | 54 ++++ .../pmapi/meta/helper/basic/AbstractTagsCache.java | 97 +++++++ .../meta/helper/impl/DictionaryCacheImpl.java | 40 +++ .../pmapi/meta/helper/impl/TagsCacheImpl.java | 105 ++++++++ .../ningdatech/pmapi/meta/manage/MetaManage.java | 289 +++++++++++++++++++++ .../pmapi/meta/mapper/ExpertDictionaryMapper.java | 16 ++ .../pmapi/meta/mapper/ExpertDictionaryMapper.xml | 5 + .../pmapi/meta/mapper/ExpertTagMapper.java | 16 ++ .../pmapi/meta/mapper/ExpertTagMapper.xml | 5 + .../pmapi/meta/mapper/MetaDictionaryMapper.java | 16 ++ .../pmapi/meta/mapper/MetaDictionaryMapper.xml | 5 + .../pmapi/meta/mapper/MetaTagMapper.java | 16 ++ .../ningdatech/pmapi/meta/mapper/MetaTagMapper.xml | 5 + .../pmapi/meta/model/ExpertRegionInfo.java | 36 +++ .../pmapi/meta/model/bo/RegionContainsBO.java | 24 ++ .../pmapi/meta/model/dto/DictionaryDTO.java | 40 +++ .../ningdatech/pmapi/meta/model/dto/TagDTO.java | 37 +++ .../pmapi/meta/model/dto/TagTreeDTO.java | 42 +++ .../pmapi/meta/model/entity/ExpertDictionary.java | 38 +++ .../pmapi/meta/model/entity/ExpertTag.java | 38 +++ .../pmapi/meta/model/entity/MetaDictionary.java | 50 ++++ .../pmapi/meta/model/entity/MetaTag.java | 43 +++ .../pmapi/meta/model/po/AddDictionaryRequest.java | 37 +++ .../pmapi/meta/model/po/AddTagTypeRequest.java | 20 ++ .../pmapi/meta/model/po/DictionaryListRequest.java | 19 ++ .../pmapi/meta/model/po/ReqTagListPO.java | 14 + .../pmapi/meta/model/po/TagListRequest.java | 14 + .../pmapi/meta/model/po/TagQueryRequest.java | 24 ++ .../pmapi/meta/model/vo/DictionaryListVO.java | 25 ++ .../pmapi/meta/model/vo/DictionaryVO.java | 49 ++++ .../ningdatech/pmapi/meta/model/vo/TagListVO.java | 41 +++ .../ningdatech/pmapi/meta/model/vo/TagTreeVO.java | 58 +++++ .../ningdatech/pmapi/meta/model/vo/TagTypeVO.java | 23 ++ .../meta/service/IExpertDictionaryService.java | 16 ++ .../pmapi/meta/service/IExpertTagService.java | 16 ++ .../pmapi/meta/service/IMetaDictionaryService.java | 22 ++ .../pmapi/meta/service/IMetaTagService.java | 21 ++ .../service/impl/ExpertDictionaryServiceImpl.java | 20 ++ .../meta/service/impl/ExpertTagServiceImpl.java | 20 ++ .../service/impl/MetaDictionaryServiceImpl.java | 32 +++ .../meta/service/impl/MetaTagServiceImpl.java | 33 +++ .../meta/validate/TagListRequestValidator.java | 31 +++ .../pmapi/tag/controller/ExpertTagController.java | 20 -- .../pmapi/tag/controller/MetaTagController.java | 20 -- .../com/ningdatech/pmapi/tag/entity/ExpertTag.java | 39 --- .../com/ningdatech/pmapi/tag/entity/MetaTag.java | 44 ---- .../pmapi/tag/mapper/ExpertTagMapper.java | 16 -- .../pmapi/tag/mapper/ExpertTagMapper.xml | 5 - .../ningdatech/pmapi/tag/mapper/MetaTagMapper.java | 16 -- .../ningdatech/pmapi/tag/mapper/MetaTagMapper.xml | 5 - .../pmapi/tag/service/IExpertTagService.java | 16 -- .../pmapi/tag/service/IMetaTagService.java | 16 -- .../tag/service/impl/ExpertTagServiceImpl.java | 20 -- .../pmapi/tag/service/impl/MetaTagServiceImpl.java | 20 -- 82 files changed, 2147 insertions(+), 481 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/ExpertDictionaryController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/MetaDictionaryController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.xml delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.xml delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IExpertDictionaryService.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IMetaDictionaryService.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/ExpertDictionaryServiceImpl.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/MetaDictionaryServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictAllTypeEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictExpertInfoTypeEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/ExpertTagEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/TagConst.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertDictionaryController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertTagController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/DictionaryCache.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/TagCache.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractTagsCache.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/DictionaryCacheImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/TagsCacheImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/ExpertRegionInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/bo/RegionContainsBO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/DictionaryDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagTreeDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertDictionary.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertTag.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaDictionary.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaTag.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddDictionaryRequest.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddTagTypeRequest.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/DictionaryListRequest.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagListPO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagListRequest.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagQueryRequest.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryListVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagListVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTreeVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTypeVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaDictionaryService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaTagService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertTagServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaDictionaryServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaTagServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/TagListRequestValidator.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/ExpertTagController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/MetaTagController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.xml delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.xml delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IExpertTagService.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IMetaTagService.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/ExpertTagServiceImpl.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/MetaTagServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java new file mode 100644 index 0000000..d4ab72f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BoolDisplayEnum.java @@ -0,0 +1,32 @@ +package com.ningdatech.pmapi.common.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/7/26 上午9:21 + */ +@AllArgsConstructor +@Getter +public enum BoolDisplayEnum { + + /** + * true + */ + Y, + + /** + * false + */ + N; + + public static boolean judgeBoolean(String key) { + return Y.name().equals(key); + } + + public static BoolDisplayEnum judgeBoolean(boolean key) { + return key ? Y : N; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java index 7343207..66d8e18 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/BizUtils.java @@ -8,6 +8,7 @@ import org.springframework.util.NumberUtils; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.UUID; import java.util.function.Consumer; import java.util.stream.Collectors; @@ -63,4 +64,9 @@ public class BizUtils { } return result; } + + public static String uuid32() { + return UUID.randomUUID().toString().replace("-", ""); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/ExpertDictionaryController.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/ExpertDictionaryController.java deleted file mode 100644 index 80d63a7..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/ExpertDictionaryController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.dictionary.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Controller -@RequestMapping("/pmapi.dictionary/expert-dictionary") -public class ExpertDictionaryController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/MetaDictionaryController.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/MetaDictionaryController.java deleted file mode 100644 index 6bb2a01..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/controller/MetaDictionaryController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.dictionary.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Controller -@RequestMapping("/pmapi.dictionary/meta-dictionary") -public class MetaDictionaryController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java deleted file mode 100644 index e5f5181..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/ExpertDictionary.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.dictionary.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Data -@TableName("expert_dictionary") -@ApiModel(value = "ExpertDictionary对象", description = "") -public class ExpertDictionary implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private String dictionaryCode; - - private String expertInfoField; - - private Long userId; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java deleted file mode 100644 index 7bf2183..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/entity/MetaDictionary.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ningdatech.pmapi.dictionary.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; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Data -@TableName("meta_dictionary") -@ApiModel(value = "MetaDictionary对象", description = "") -public class MetaDictionary implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private String dictionaryType; - - private String dictionaryCode; - - private String dictionaryName; - - private String dictionaryDescribe; - - private Integer sortValue; - - private Long createBy; - - private String readonly; - - private Long updateBy; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.java deleted file mode 100644 index 8066d56..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.dictionary.mapper; - -import com.ningdatech.pmapi.dictionary.entity.ExpertDictionary; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface ExpertDictionaryMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.xml deleted file mode 100644 index 2b2971c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/ExpertDictionaryMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.java deleted file mode 100644 index b02222c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.dictionary.mapper; - -import com.ningdatech.pmapi.dictionary.entity.MetaDictionary; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface MetaDictionaryMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.xml deleted file mode 100644 index 6541927..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/mapper/MetaDictionaryMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IExpertDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IExpertDictionaryService.java deleted file mode 100644 index a10655b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IExpertDictionaryService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.dictionary.service; - -import com.ningdatech.pmapi.dictionary.entity.ExpertDictionary; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface IExpertDictionaryService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IMetaDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IMetaDictionaryService.java deleted file mode 100644 index 47a1ab6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/IMetaDictionaryService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.dictionary.service; - -import com.ningdatech.pmapi.dictionary.entity.MetaDictionary; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface IMetaDictionaryService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/ExpertDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/ExpertDictionaryServiceImpl.java deleted file mode 100644 index f9025cc..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/ExpertDictionaryServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.dictionary.service.impl; - -import com.ningdatech.pmapi.dictionary.entity.ExpertDictionary; -import com.ningdatech.pmapi.dictionary.mapper.ExpertDictionaryMapper; -import com.ningdatech.pmapi.dictionary.service.IExpertDictionaryService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Service -public class ExpertDictionaryServiceImpl extends ServiceImpl implements IExpertDictionaryService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/MetaDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/MetaDictionaryServiceImpl.java deleted file mode 100644 index 882c55a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dictionary/service/impl/MetaDictionaryServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.dictionary.service.impl; - -import com.ningdatech.pmapi.dictionary.entity.MetaDictionary; -import com.ningdatech.pmapi.dictionary.mapper.MetaDictionaryMapper; -import com.ningdatech.pmapi.dictionary.service.IMetaDictionaryService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Service -public class MetaDictionaryServiceImpl extends ServiceImpl implements IMetaDictionaryService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java index a6af778..26842c2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java @@ -93,7 +93,7 @@ public class ExpertUserFullInfo implements Serializable { private String regionCode; - private String regionLevel; + private Integer regionLevel; private String recommendedWay; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java new file mode 100644 index 0000000..e1f1521 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java @@ -0,0 +1,36 @@ +package com.ningdatech.pmapi.meta.assembler; + + +import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; +import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; +import com.ningdatech.pmapi.meta.model.vo.DictionaryVO; + +/** + * @author liuxinxin + * @date 2022/7/22 上午10:53 + */ + +public class MetaDictionaryAssembler { + + public static DictionaryDTO toDictionaryDTO(MetaDictionary dictionaryManage) { + DictionaryDTO dictionaryDTO = new DictionaryDTO(); + dictionaryDTO.setDescribe(dictionaryManage.getDictionaryDescribe()); + dictionaryDTO.setDictionaryCode(dictionaryManage.getDictionaryCode()); + dictionaryDTO.setDictionaryType(dictionaryManage.getDictionaryType()); + dictionaryDTO.setName(dictionaryManage.getDictionaryName()); + dictionaryDTO.setReadonly(dictionaryManage.getReadonly()); + dictionaryDTO.setSortValue(dictionaryManage.getSortValue()); + return dictionaryDTO; + } + + public static DictionaryVO toDictionaryVO(DictionaryDTO dictionaryDTO) { + DictionaryVO dictionaryVO = new DictionaryVO(); + dictionaryVO.setDescribe(dictionaryDTO.getDescribe()); + dictionaryVO.setDictionaryCode(dictionaryDTO.getDictionaryCode()); + dictionaryVO.setDictionaryType(dictionaryDTO.getDictionaryType()); + dictionaryVO.setName(dictionaryDTO.getName()); + dictionaryVO.setReadonly(dictionaryDTO.getReadonly()); + dictionaryVO.setSortValue(dictionaryDTO.getSortValue()); + return dictionaryVO; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java new file mode 100644 index 0000000..2491eb4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java @@ -0,0 +1,62 @@ +package com.ningdatech.pmapi.meta.assembler; + +import com.ningdatech.pmapi.meta.model.entity.MetaTag; +import com.ningdatech.pmapi.meta.model.dto.TagDTO; +import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; +import com.ningdatech.pmapi.meta.model.vo.TagTreeVO; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:57 + */ + +public class MetaTagAssembler { + + public static TagDTO toTagDTO(MetaTag metaTagManage) { + TagDTO tagDTO = new TagDTO(); + tagDTO.setParentCode(metaTagManage.getParentCode()); + tagDTO.setTagCode(metaTagManage.getTagCode()); + tagDTO.setTagLevel(metaTagManage.getTagLevel()); + tagDTO.setTagName(metaTagManage.getTagName()); + return tagDTO; + } + + public static List toTagTreeDTOList(List tagDTOList) { + if (CollectionUtils.isEmpty(tagDTOList)) { + return new ArrayList<>(); + } + return tagDTOList.stream().map(MetaTagAssembler::toTagTreeDTO).collect(Collectors.toList()); + + } + + public static TagTreeDTO toTagTreeDTO(TagDTO tagDTO) { + TagTreeDTO tagTreeDTO = new TagTreeDTO(); + tagTreeDTO.setParentCode(tagDTO.getParentCode()); + tagTreeDTO.setTagCode(tagDTO.getTagCode()); + tagTreeDTO.setTagLevel(tagDTO.getTagLevel()); + tagTreeDTO.setTagName(tagDTO.getTagName()); + return tagTreeDTO; + } + + public static List toTagTreeVOList(List tagTreeDTOList) { + List tagTreeVOList = new ArrayList<>(); + for (TagTreeDTO tagTreeDTO : tagTreeDTOList) { + TagTreeVO tagTreeVO = new TagTreeVO(); + tagTreeVO.setTagLevel(tagTreeDTO.getTagLevel()); + tagTreeVO.setTagName(tagTreeDTO.getTagName()); + tagTreeVO.setParentCode(tagTreeDTO.getParentCode()); + tagTreeVO.setTagCode(tagTreeDTO.getTagCode()); + tagTreeVO.setUnionCode(tagTreeDTO.getTagName() + "##" + tagTreeDTO.getTagCode()); + if (CollectionUtils.isNotEmpty(tagTreeDTO.getChildren())) { + tagTreeVO.setChildren(toTagTreeVOList(tagTreeDTO.getChildren())); + } + tagTreeVOList.add(tagTreeVO); + } + return tagTreeVOList; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictAllTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictAllTypeEnum.java new file mode 100644 index 0000000..25d6310 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictAllTypeEnum.java @@ -0,0 +1,53 @@ +package com.ningdatech.pmapi.meta.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:08 + */ +@AllArgsConstructor +@Getter +public enum DictAllTypeEnum { + + // 政治面貌 + POLITICAL("political"), + // 专家来源 + EXPERT_SOURCE("expert_source"), + // 学历 + EDU("edu"), + // 学位 + DEGREE("degree"), + // 在职状态 + JOB_STATUS("job_status"), + // 行政职级 + ADMINISTRATIVE_RANK("administrative_rank"), + // 内外围(专家类型) + EXPERT_TYPE("expert_type"), + // 单位类型 + COMPANY_ATTRIBUTE("company_attribute"), + // 职称级别 + TITLE_LEVEL("title_level"), + // 通知类型 + NOTICE_TYPE("notice_type"), + // 会议类型 + MEETING_TYPE("meeting_type"); + + private final String key; + + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (DictAllTypeEnum typeEnum : DictAllTypeEnum.values()) { + if (typeEnum.key.equals(key)) { + return true; + } + } + return false; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictExpertInfoTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictExpertInfoTypeEnum.java new file mode 100644 index 0000000..d8b1962 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/DictExpertInfoTypeEnum.java @@ -0,0 +1,70 @@ +package com.ningdatech.pmapi.meta.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:08 + */ +@AllArgsConstructor +@Getter +public enum DictExpertInfoTypeEnum { + + // 政治面貌 + POLITICAL("political"), + // 学历 + EDU("edu"), + // 学位 + DEGREE("degree"), + // 在职状态 + JOB_STATUS("job_status"), + // 行政职级 + ADMINISTRATIVE_RANK("administrative_rank"), + // 内外围(专家类型) + EXPERT_TYPE("expert_type"), + // 单位类型 + COMPANY_ATTRIBUTE("company_attribute"), + // 职称级别 + TITLE_LEVEL("title_level"), + // 推荐方式 + RECOMMENDED_WAY("recommended_way"); + + + private final String key; + + public static List getAll() { + List dictionaryList = new ArrayList<>(); + DictExpertInfoTypeEnum[] values = DictExpertInfoTypeEnum.values(); + for (DictExpertInfoTypeEnum typeEnum : values) { + dictionaryList.add(typeEnum.key); + } + return dictionaryList; + } + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (DictExpertInfoTypeEnum typeEnum : DictExpertInfoTypeEnum.values()) { + if (typeEnum.key.equals(key)) { + return true; + } + } + return false; + } + + public static DictExpertInfoTypeEnum of(String key) { + for (DictExpertInfoTypeEnum statusEnum : DictExpertInfoTypeEnum.values()) { + if (statusEnum.key.equals(key)) { + return statusEnum; + } + } + throw new IllegalArgumentException(String.format("Illegal DictionaryExpertInfoTypeEnum = %s", key)); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/ExpertTagEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/ExpertTagEnum.java new file mode 100644 index 0000000..79ca540 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/ExpertTagEnum.java @@ -0,0 +1,51 @@ +package com.ningdatech.pmapi.meta.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 上午11:13 + */ +@AllArgsConstructor +@Getter +public enum ExpertTagEnum { + + // 专家来源 + EXPERT_SOURCE("expert_source"), + // 擅长方向 + GOOD_AT("good_at"), + // 技术专长 + TECHNICAL_EXPERTISE("technical_expertise"), + // 行业领域 + INDUSTRY_SECTOR("industry_sector"), + // 其他 + OTHER("other"); + + private final String key; + + public static List getAll() { + List tagList = new ArrayList<>(); + ExpertTagEnum[] values = ExpertTagEnum.values(); + for (ExpertTagEnum fieldEnum : values) { + tagList.add(fieldEnum.key); + } + return tagList; + } + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (ExpertTagEnum fieldEnum : ExpertTagEnum.values()) { + if (fieldEnum.key.equals(key)) { + return true; + } + } + return false; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/TagConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/TagConst.java new file mode 100644 index 0000000..fd0cc27 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/constant/TagConst.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.meta.constant; + +/** + * @author liuxinxin + * @date 2022/8/27 下午1:49 + */ + +public class TagConst { + + private TagConst() { + } + + /** + * 标签类型顶级时 parent_code 为 -1 + */ + public static final String TAG_ROOT_PARENT_CODE = "-1"; + + public static final Long TAG_ROOT_LEVEL = 1L; + + public static final String TAG_CREATOR = "管理员"; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertDictionaryController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertDictionaryController.java new file mode 100644 index 0000000..cff8529 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertDictionaryController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.meta.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/pmapi.dictionary/expert-dictionary") +public class ExpertDictionaryController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertTagController.java new file mode 100644 index 0000000..67e9574 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertTagController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.meta.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/pmapi.tag/expert-tag") +public class ExpertTagController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryController.java new file mode 100644 index 0000000..030cffd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.meta.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/pmapi.dictionary/meta-dictionary") +public class MetaDictionaryController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagController.java new file mode 100644 index 0000000..49bec9c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.meta.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/pmapi.tag/meta-tag") +public class MetaTagController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java new file mode 100644 index 0000000..913d51f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java @@ -0,0 +1,79 @@ +package com.ningdatech.pmapi.meta.controller; + + +import com.ningdatech.pmapi.meta.manage.MetaManage; +import com.ningdatech.pmapi.meta.model.po.AddTagTypeRequest; +import com.ningdatech.pmapi.meta.model.po.ReqTagListPO; +import com.ningdatech.pmapi.meta.model.po.TagQueryRequest; +import com.ningdatech.pmapi.meta.model.vo.TagListVO; +import com.ningdatech.pmapi.meta.model.vo.TagTreeVO; +import com.ningdatech.pmapi.meta.model.vo.TagTypeVO; +import com.ningdatech.pmapi.meta.validate.TagListRequestValidator; +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.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author liuxinxin + * @since 2022-07-21 + */ +@RestController +@Validated +@RequiredArgsConstructor +@RequestMapping("/api/v1/meta") +@Api(value = "MetaController", tags = "基础数据接口") +public class MetaTagManageController { + + /** + * 专家标签的缓存时间设置为5分钟,单位秒 + */ + private static final Long MAX_AGE = 5 * 60L; + /** + * max-age=86400 + */ + private static final String MAX_AGE_STR = "max-age=" + MAX_AGE; + private final MetaManage metaManage; + + @PostMapping("/tag") + @ApiOperation("获取专家标签的树状结构") + public List getRegionTree(HttpServletResponse response, @RequestBody ReqTagListPO request) { + response.setHeader("Cache-Control", MAX_AGE_STR); + TagListRequestValidator.tagListRequestValidator(request); + return metaManage.getTagTree(request); + } + + @PostMapping("/tag/query") + @ApiOperation("标签查询接口") + public List tagQuery(@Valid @RequestBody TagQueryRequest tagQueryRequest) { + return metaManage.tagQuery(tagQueryRequest); + } + + @PostMapping("/tag-tyoe/list") + @ApiOperation("获取标签分类列表") + public List tagTypeList() { + return metaManage.tagTypeList(); + } + + @PostMapping("/add/tag-type") + @ApiOperation("新增标签分类") + public void addTagType(@Valid @RequestBody AddTagTypeRequest request) { + metaManage.addTagType(request); + } + + @PostMapping("/remove/tag/{tagCode}") + @ApiOperation("删除标签") + public void removeTagName(@PathVariable String tagCode) { + metaManage.removeTagName(tagCode); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/DictionaryCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/DictionaryCache.java new file mode 100644 index 0000000..35c251c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/DictionaryCache.java @@ -0,0 +1,49 @@ +package com.ningdatech.pmapi.meta.helper; + + + +import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum; +import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/12/22 上午11:03 + */ + +public interface DictionaryCache { + + /** + * 根据字典类型枚举 获取 字典列表 + * + * @param dictionaryType + * @return + */ + List getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType); + + /** + * 根据字典类型 获取 字典列表 + * + * @param dictionaryType + * @return + */ + List getDictionaryListByDictionaryType(String dictionaryType); + + /** + * 根据字典类型、字典编码 获取 字典实体 + * + * @param dictionaryType + * @param code + * @return + */ + DictionaryDTO getDictionaryByDictionaryType(DictAllTypeEnum dictionaryType, String code); + + /** + * 根据字典编码 获取 字典实体 + * + * @param dictionaryCode + * @return + */ + DictionaryDTO getByCode(String dictionaryCode); +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/TagCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/TagCache.java new file mode 100644 index 0000000..70cc7a5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/TagCache.java @@ -0,0 +1,55 @@ +package com.ningdatech.pmapi.meta.helper; + + +import com.ningdatech.pmapi.meta.model.dto.TagDTO; +import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; + +import java.util.List; +import java.util.Map; + +/** + * @author liuxinxin + * @date 2022/12/22 上午11:56 + */ + +public interface TagCache { + + /** + * @param level 最多几级标签 + * @param rootTagCode 根标签类型及对应的字段类型 + * @return + */ + TagTreeDTO getTagTreeDTO(int level, String rootTagCode); + + /** + * 根据标签编码获取 实体类 + * + * @param tagCode + * @return + */ + TagDTO getByTagCode(String tagCode); + + /** + * 导入原专家库数据使用 + * + * @return + */ + Map getNameTagDtoMap(); + + /** + * 获取所有子节点包含当前节点 + * + * @param code 标签编码 + * @return + */ + List listChildren(String code); + + /** + * 获取所有子节点包含当前节点的编码 + * + * @param code 标签编码 + * @return + */ + List listChildrenCodes(String code); + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java new file mode 100644 index 0000000..bd4773e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractDictionaryCache.java @@ -0,0 +1,54 @@ +package com.ningdatech.pmapi.meta.helper.basic; + +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; +import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum; +import com.ningdatech.pmapi.meta.helper.DictionaryCache; +import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/12/22 上午11:03 + */ +public abstract class AbstractDictionaryCache implements InitializingBean, DictionaryCache { + + @Autowired + private IMetaDictionaryService iMetaDictionaryService; + + protected Map dictionaryMap; + protected LoadingCache> dictionaryCacheHelper; + + @Override + public void afterPropertiesSet() { + dictionaryCacheHelper = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) + .refreshAfterWrite(5, TimeUnit.MINUTES).build(key -> { + List dictionaryDTOList = iMetaDictionaryService.queryAll(); + dictionaryMap = buildCateMap(dictionaryDTOList); + Map> dictionaryTypeListMap = dictionaryDTOList.stream().collect(Collectors.groupingBy(DictionaryDTO::getDictionaryType)); + return dictionaryTypeListMap.get(key); + }); + warmUp(); + } + + private Map buildCateMap(List dictionaryDTOList) { + Map dictionaryDtoMap = new ConcurrentHashMap<>(128); + dictionaryDTOList.forEach(dictionaryDTO -> dictionaryDtoMap.put(dictionaryDTO.getDictionaryCode(), dictionaryDTO)); + return dictionaryDtoMap; + } + + private void warmUp() { + for (DictAllTypeEnum typeEnum : DictAllTypeEnum.values()) { + dictionaryCacheHelper.get(typeEnum.getKey()); + } + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractTagsCache.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractTagsCache.java new file mode 100644 index 0000000..b360c0e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/basic/AbstractTagsCache.java @@ -0,0 +1,97 @@ +package com.ningdatech.pmapi.meta.helper.basic; + +import cn.hutool.core.lang.Assert; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; +import com.ningdatech.pmapi.meta.helper.TagCache; +import com.ningdatech.pmapi.meta.model.dto.TagDTO; +import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; +import com.ningdatech.pmapi.meta.service.IMetaTagService; +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; + +/** + * @author liuxinxin + * @date 2022/12/22 上午11:56 + */ +public abstract class AbstractTagsCache implements InitializingBean, TagCache { + + protected static final int MAX_LEVEL = 4; + + @Autowired + private IMetaTagService iMetaTagService; + + protected LoadingCache> tagsCache; + + protected Map tagDtoMap; + + @Override + public void afterPropertiesSet() { + tagsCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) + .refreshAfterWrite(5, TimeUnit.MINUTES) + .build(key -> { + // 查询全部 + List tagDTOList = iMetaTagService.queryAll(); + // TODO 临时关闭校验 +// Assert.isTrue(CollectionUtils.isNotEmpty(tagDTOList), "MetaTags queryAll is Empty"); + tagDtoMap = buildCateMap(tagDTOList); + List tagInLevel = tagDTOList.stream().filter(tagDto -> { + // 只过滤出小于等于level的tag + if (Objects.isNull(tagDto.getTagLevel())) { + return false; + } + return Integer.parseInt(key) >= tagDto.getTagLevel(); + }).collect(Collectors.toList()); + List treeDtos = MetaTagAssembler.toTagTreeDTOList(tagInLevel); + return toTreeStructure(treeDtos); + }); + warmUp(); + } + + private Map buildCateMap(List tagDTOList) { + Map tagDtoMapTemp = new ConcurrentHashMap<>(1024); + tagDTOList.forEach(tagDTO -> tagDtoMapTemp.put(tagDTO.getTagCode(), tagDTO)); + return tagDtoMapTemp; + } + + private List toTreeStructure(List rootList) { + List nodeList = new ArrayList<>(); + for (TagTreeDTO tagTreeDTO : rootList) { + if ("-1".equals(tagTreeDTO.getParentCode()) || Objects.isNull(tagTreeDTO.getParentCode())) { + nodeList.add(tagTreeDTO); + } + tagTreeDTO.setChildren(getChildren(tagTreeDTO.getTagCode(), rootList)); + } + return nodeList; + } + + public void warmUp() { + for (int level = 1; level <= MAX_LEVEL; level++) { + tagsCache.get(level + ""); + } + } + + protected List getChildren(String tagCode, List list) { + List childList = new ArrayList<>(); + for (TagTreeDTO tagTreeDTO : list) { + if (tagCode.equals(tagTreeDTO.getParentCode())) { + childList.add(tagTreeDTO); + } + } + for (TagTreeDTO tagTreeDTO : childList) { + tagTreeDTO.setChildren(getChildren(tagTreeDTO.getTagCode(), list)); + } + if (CollectionUtils.isEmpty(childList)) { + return Collections.emptyList(); + } + return childList; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/DictionaryCacheImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/DictionaryCacheImpl.java new file mode 100644 index 0000000..944fa1d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/DictionaryCacheImpl.java @@ -0,0 +1,40 @@ +package com.ningdatech.pmapi.meta.helper.impl; + +import com.ningdatech.pmapi.meta.constant.DictAllTypeEnum; +import com.ningdatech.pmapi.meta.helper.basic.AbstractDictionaryCache; +import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/7/22 上午10:47 + */ +@Component +public class DictionaryCacheImpl extends AbstractDictionaryCache { + + @Override + public List getDictionaryListByDictionaryType(DictAllTypeEnum dictionaryType) { + return dictionaryCacheHelper.get(dictionaryType.getKey()); + } + + @Override + public List getDictionaryListByDictionaryType(String dictionaryType) { + return dictionaryCacheHelper.get(dictionaryType); + } + + @Override + public DictionaryDTO getDictionaryByDictionaryType(DictAllTypeEnum dictionaryType, String code) { + return Objects.requireNonNull(dictionaryCacheHelper.get(dictionaryType.getKey())) + .stream().filter(w -> w.getDictionaryCode().equals(code)) + .findFirst().orElse(null); + } + + @Override + public DictionaryDTO getByCode(String dictionaryCode) { + return dictionaryMap.get(dictionaryCode); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/TagsCacheImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/TagsCacheImpl.java new file mode 100644 index 0000000..b952ba6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/helper/impl/TagsCacheImpl.java @@ -0,0 +1,105 @@ +package com.ningdatech.pmapi.meta.helper.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.meta.helper.basic.AbstractTagsCache; +import com.ningdatech.pmapi.meta.model.dto.TagDTO; +import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:51 + * 标签树 + */ +@Slf4j +@Component +public class TagsCacheImpl extends AbstractTagsCache { + + @Override + public TagTreeDTO getTagTreeDTO(int level, String rootTagCode) { + List tagTreeDtos = tagsCache.get(level + ""); + for (TagTreeDTO tagTreeDTO : tagTreeDtos) { + if (tagTreeDTO.getTagCode().equals(rootTagCode)) { + return tagTreeDTO; + } + } + throw new BizException("rootTagCode not exist"); + } + + @Override + public TagDTO getByTagCode(String tagCode) { + return tagDtoMap.get(tagCode); + } + + /** + * 导入原专家库数据使用 + * + * @return + */ + @Override + public Map getNameTagDtoMap() { + Map nameTagDtoMap = new HashMap<>(1024); + for (String key : tagDtoMap.keySet()) { + nameTagDtoMap.put(tagDtoMap.get(key).getTagName(), tagDtoMap.get(key)); + } + return nameTagDtoMap; + } + + + /** + * 获取所有子节点包含当前节点 + * + * @param code 标签编码 + * @return java.util.List + * @author WendyYang + **/ + @Override + public List listChildren(String code) { + List allTree = tagsCache.get(String.valueOf(MAX_LEVEL)); + assert allTree != null; + List children = getChildren(code, allTree); + TagDTO tagDTO = tagDtoMap.get(code); + TagTreeDTO rootNode = BeanUtil.copyProperties(tagDTO, TagTreeDTO.class); + rootNode.setChildren(children); + return treeToList(rootNode); + } + + /** + * 获取所有子节点包含当前节点的编码 + * + * @param code 标签编码 + * @return java.util.List + * @author WendyYang + **/ + @Override + public List listChildrenCodes(String code) { + return CollUtils.fieldList(listChildren(code), TagTreeDTO::getTagCode); + } + + /** + * tree -> list + * + * @param tagTreeDTO 树节点 + * @return java.util.List + * @author WendyYang + **/ + private List treeToList(TagTreeDTO tagTreeDTO) { + List result = new ArrayList<>(); + result.add(tagTreeDTO); + if (tagTreeDTO.getChildren() != null && tagTreeDTO.getChildren().size() > 0) { + tagTreeDTO.getChildren().forEach(node -> { + result.addAll(treeToList(node)); + }); + } + return result; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java new file mode 100644 index 0000000..0e17c41 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java @@ -0,0 +1,289 @@ +package com.ningdatech.pmapi.meta.manage; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; +import com.ningdatech.pmapi.common.util.BizUtils; +import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; +import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; +import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; +import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; +import com.ningdatech.pmapi.meta.assembler.MetaDictionaryAssembler; +import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; +import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; +import com.ningdatech.pmapi.meta.constant.TagConst; +import com.ningdatech.pmapi.meta.model.entity.ExpertTag; +import com.ningdatech.pmapi.meta.model.entity.MetaTag; +import com.ningdatech.pmapi.meta.helper.DictionaryCache; +import com.ningdatech.pmapi.meta.helper.TagCache; +import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; +import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; +import com.ningdatech.pmapi.meta.model.po.*; +import com.ningdatech.pmapi.meta.model.vo.*; +import com.ningdatech.pmapi.meta.service.IExpertTagService; +import com.ningdatech.pmapi.meta.service.IMetaTagService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/2/22 下午2:34 + */ +@Component +@RequiredArgsConstructor +public class MetaManage { + + // private final RegionCache regionCache; + private final DictionaryCache dictionaryCache; + private final TagCache tagCache; + private final IMetaDictionaryService metaDictionaryManageService; + private final IExpertDictionaryService iExpertDictionaryService; + private final IMetaTagService iMetaTagManageService; + private final IExpertTagService iExpertTagService; + +// public List getRegionTree() { +// List regionTreeDtos = regionCache.getAll(); +// return MetaRegionAssembler.toRegionTreeVOList(regionTreeDtos); +// } + + public List getDictionaryList(DictionaryListRequest request) { + List dictionaryTypeList = request.getDictionaryTypeList(); + if (CollectionUtils.isEmpty(dictionaryTypeList)) { + dictionaryTypeList = DictExpertInfoTypeEnum.getAll(); + } + + List dictionaryListVos = new ArrayList<>(); + for (String dictionaryType : dictionaryTypeList) { + DictionaryListVO dictionaryListVO = new DictionaryListVO(); + dictionaryListVO.setDictionaryName(dictionaryType); + List dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); + List dictionaryVOList = dictionaryList.stream() + .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); + dictionaryListVO.setDictionaryList(dictionaryVOList); + dictionaryListVos.add(dictionaryListVO); + } + return dictionaryListVos; + } + + public List commonDictList(DictionaryListRequest request) { + List result = new ArrayList<>(); + if (request.getAllDict()) { + Map> groupByType = CollUtils.group(metaDictionaryManageService.list(), MetaDictionary::getDictionaryType); + groupByType.forEach((k, v) -> { + DictionaryListVO dictionaryListVO = new DictionaryListVO(); + dictionaryListVO.setDictionaryName(k); + List dictionaryVOList = v.stream() + .map(w -> { + DictionaryVO vo = new DictionaryVO(); + vo.setDescribe(w.getDictionaryDescribe()); + vo.setDictionaryCode(w.getDictionaryCode()); + vo.setDictionaryType(w.getDictionaryType()); + vo.setName(w.getDictionaryName()); + vo.setReadonly(w.getReadonly()); + vo.setSortValue(w.getSortValue()); + return vo; + }).collect(Collectors.toList()); + dictionaryListVO.setDictionaryList(dictionaryVOList); + result.add(dictionaryListVO); + }); + } else { + List dictionaryTypeList = request.getDictionaryTypeList(); + for (String dictionaryType : dictionaryTypeList) { + DictionaryListVO dictionaryListVO = new DictionaryListVO(); + dictionaryListVO.setDictionaryName(dictionaryType); + List dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); + List dictionaryVOList = dictionaryList.stream() + .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); + dictionaryListVO.setDictionaryList(dictionaryVOList); + result.add(dictionaryListVO); + } + } + return result; + } + + public List getTagTree(ReqTagListPO request) { + List rootTagCodeList = request.getRootTagCodeList(); + if (CollectionUtils.isEmpty(rootTagCodeList)) { + rootTagCodeList = ExpertTagEnum.getAll(); + } + List tagTreeDTOList = new ArrayList<>(); + for (String rootTagCode : rootTagCodeList) { + TagTreeDTO tagTreeDTO = tagCache.getTagTreeDTO(4, rootTagCode); + if (Objects.nonNull(tagTreeDTO)) { + tagTreeDTOList.add(tagTreeDTO); + } + } + return MetaTagAssembler.toTagTreeVOList(tagTreeDTOList); + } + + + /** + * 专家管理员才能调用 + * + * @param addDictionaryRequest + */ + @Transactional(rollbackFor = Exception.class) + public void addDictionary(AddDictionaryRequest addDictionaryRequest) { + String dictionaryType = addDictionaryRequest.getDictionaryType(); + boolean contains = DictExpertInfoTypeEnum.contains(dictionaryType); + if (!contains) { + throw BizException.wrap("无效的专家字典类型:%s", dictionaryType); + } + String name = addDictionaryRequest.getName(); + Integer sortValue = addDictionaryRequest.getSortValue(); + LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType); + List dictionaryManageList = metaDictionaryManageService.list(eq); + + MetaDictionary saveRecord = new MetaDictionary(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setDictionaryName(name); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setDictionaryCode(BizUtils.uuid32()); + saveRecord.setDictionaryType(dictionaryType); + saveRecord.setReadonly(BoolDisplayEnum.N.name()); + saveRecord.setSortValue(sortValue); + + List saveRecordList = new ArrayList<>(); + saveRecordList.add(saveRecord); + for (MetaDictionary metaDictionary : dictionaryManageList) { + if (metaDictionary.getSortValue() >= sortValue) { + metaDictionary.setSortValue(metaDictionary.getSortValue() + 1); + } + saveRecordList.add(metaDictionary); + } + boolean remove = metaDictionaryManageService + .remove(Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType)); + if (remove) { + metaDictionaryManageService.saveBatch(saveRecordList); + } + } + + public void removeDictionary(String dictionaryCode) { + LambdaUpdateWrapper eq = Wrappers.lambdaUpdate(MetaDictionary.class) + .eq(MetaDictionary::getDictionaryCode, dictionaryCode); + MetaDictionary one = metaDictionaryManageService.getOne(eq); + if (Objects.isNull(one)) { + throw BizException.wrap("字典值不存在"); + } + if (BoolDisplayEnum.judgeBoolean(one.getReadonly())) { + throw BizException.wrap("内置字典值无法删除"); + } + List expertDictionaryList = iExpertDictionaryService.list(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getDictionaryCode, dictionaryCode)); + if (CollUtil.isNotEmpty(expertDictionaryList)) { + throw BizException.wrap("该字典值已被使用无法删除"); + } + metaDictionaryManageService.removeById(one); + } + + public void addTagType(AddTagTypeRequest request) { + String tagName = request.getTagName(); + LambdaQueryWrapper in = Wrappers.lambdaQuery(MetaTag.class) + .in(MetaTag::getTagName, tagName) + .in(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); + List list = iMetaTagManageService.list(in); + if (CollectionUtils.isNotEmpty(list)) { + throw BizException.wrap("该标签类型已存在"); + } + MetaTag saveRecord = new MetaTag(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setParentCode(TagConst.TAG_ROOT_PARENT_CODE); + saveRecord.setTagCode(BizUtils.uuid32()); + saveRecord.setTagName(tagName); + saveRecord.setTagLevel(TagConst.TAG_ROOT_LEVEL); + iMetaTagManageService.save(saveRecord); + } + + public void removeTagName(String tagCode) { + LambdaQueryWrapper eq = Wrappers.lambdaQuery(ExpertTag.class) + .eq(ExpertTag::getTagCode, tagCode); + List expertTagList = iExpertTagService.list(eq); + if (CollectionUtils.isNotEmpty(expertTagList)) { + throw BizException.wrap("该标签正在使用无法删除"); + } + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, tagCode); + List list = iMetaTagManageService.list(queryWrapper); + if (CollectionUtils.isNotEmpty(list)) { + throw BizException.wrap("该标签存在子标签无法删除"); + } + LambdaQueryWrapper metaTagManageLambdaQueryWrapper = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getTagCode, tagCode); + MetaTag one = iMetaTagManageService.getOne(metaTagManageLambdaQueryWrapper); + if (Objects.nonNull(one)) { + iMetaTagManageService.removeById(one); + } + } + + public List tagTypeList() { + LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); + List list = iMetaTagManageService.list(eq); + return list.stream().map(r -> { + TagTypeVO tagTypeVO = new TagTypeVO(); + tagTypeVO.setTagCode(r.getTagCode()); + tagTypeVO.setTagLevel(r.getTagLevel()); + tagTypeVO.setTagName(r.getTagName()); + tagTypeVO.setTagName(r.getTagName()); + return tagTypeVO; + }).collect(Collectors.toList()); + } + + public List tagQuery(TagQueryRequest tagQueryRequest) { + String parentCode = tagQueryRequest.getParentCode(); + if (StringUtils.isBlank(parentCode)) { + parentCode = TagConst.TAG_ROOT_PARENT_CODE; + } + LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaTag.class) + .eq(MetaTag::getParentCode, parentCode); + List list = iMetaTagManageService.list(eq); + + List tagCodeList = CollUtils.fieldList(list, MetaTag::getTagCode); + Map> hasChildrenMap = new HashMap<>(16); + Map> useFrequencyMap = new HashMap<>(16); + if (CollectionUtils.isNotEmpty(tagCodeList)) { + List childrenMetaTagList = iMetaTagManageService.list(Wrappers.lambdaQuery(MetaTag.class) + .in(MetaTag::getParentCode, tagCodeList)); + hasChildrenMap = CollUtils.group(childrenMetaTagList, MetaTag::getParentCode); + + List expertTagList = iExpertTagService.list(Wrappers.lambdaQuery(ExpertTag.class) + .in(ExpertTag::getTagCode, tagCodeList)); + useFrequencyMap = CollUtils.group(expertTagList, ExpertTag::getTagCode); + } + + Map> finalHasChildrenMap = hasChildrenMap; + Map> finalUseFrequencyMap = useFrequencyMap; + return list.stream().map(r -> { + TagListVO tagListVO = new TagListVO(); + tagListVO.setCreateTime(r.getCreateOn()); + tagListVO.setCreator(TagConst.TAG_CREATOR); + tagListVO.setTagLevel(r.getTagLevel()); + tagListVO.setTagCode(r.getTagCode()); + tagListVO.setTagName(r.getTagName()); + List metaTagManages = finalHasChildrenMap.get(r.getTagCode()); + if (CollUtil.isNotEmpty(metaTagManages)) { + tagListVO.setIsLeaf(false); + tagListVO.setHasChildren(true); + } else { + tagListVO.setIsLeaf(true); + tagListVO.setHasChildren(false); + } + long useFrequency = 0; + List expertTagList = finalUseFrequencyMap.get(r.getTagCode()); + if (CollUtil.isNotEmpty(expertTagList)) { + useFrequency = expertTagList.size(); + } + tagListVO.setUseFrequency(useFrequency); + return tagListVO; + }).collect(Collectors.toList()); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.java new file mode 100644 index 0000000..b15fc12 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.meta.mapper; + +import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface ExpertDictionaryMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.xml new file mode 100644 index 0000000..5bbce65 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertDictionaryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.java new file mode 100644 index 0000000..ae93928 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.meta.mapper; + +import com.ningdatech.pmapi.meta.model.entity.ExpertTag; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface ExpertTagMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.xml new file mode 100644 index 0000000..017d58f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/ExpertTagMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java new file mode 100644 index 0000000..da9a0f4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.meta.mapper; + +import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface MetaDictionaryMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.xml new file mode 100644 index 0000000..516061f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.java new file mode 100644 index 0000000..fcb8fc5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.meta.mapper; + +import com.ningdatech.pmapi.meta.model.entity.MetaTag; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface MetaTagMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.xml new file mode 100644 index 0000000..0476da7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaTagMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/ExpertRegionInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/ExpertRegionInfo.java new file mode 100644 index 0000000..37c17ed --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/ExpertRegionInfo.java @@ -0,0 +1,36 @@ +package com.ningdatech.pmapi.meta.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:43 + */ +@Data +@ApiModel("专家区域信息") +public class ExpertRegionInfo { + + /** + * 区域编码 + */ + @NotBlank + @ApiModelProperty("区域编码") + private String regionCode; + + /** + * 区域级别 + */ + @NotBlank + @ApiModelProperty("区域级别") + private Integer regionLevel; + + /** + * 区域名称 + */ + @ApiModelProperty("区域名称") + private String regionName; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/bo/RegionContainsBO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/bo/RegionContainsBO.java new file mode 100644 index 0000000..a07aee7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/bo/RegionContainsBO.java @@ -0,0 +1,24 @@ +package com.ningdatech.pmapi.meta.model.bo; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 下午4:48 + */ +@Data +public class RegionContainsBO { + + /** + * 最高级节点级别 + */ + private Integer parentRegionTreeLevel; + + /** + * 所有区域码列表 + */ + private List containsRegionCodeList; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/DictionaryDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/DictionaryDTO.java new file mode 100644 index 0000000..7030775 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/DictionaryDTO.java @@ -0,0 +1,40 @@ +package com.ningdatech.pmapi.meta.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 上午10:49 + */ +@Data +public class DictionaryDTO { + + private String dictionaryType; + + /** + * 编码 随机数处理 + */ + private String dictionaryCode; + + /** + * 名称 + */ + private String name; + + /** + * 描述 + */ + private String describe; + + /** + * 排序 + */ + private Integer sortValue; + + /** + * 是否内置,内置不可删除 + */ + private String readonly; + +} + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagDTO.java new file mode 100644 index 0000000..1cbc019 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagDTO.java @@ -0,0 +1,37 @@ +package com.ningdatech.pmapi.meta.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:53 + */ +@Data +public class TagDTO { + + /** + * 标签 编码 + * 根标签
擅长方向 good_at + * 技术专长 technical_expertise + * 行业领域 industry_sector + * 其他 other + */ + private String tagCode; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 标签级别 + */ + private Long tagLevel; + + /** + * 标签父级id + * 当parent_tag_code 为 -1 时为顶级标签 + */ + private String parentCode; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagTreeDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagTreeDTO.java new file mode 100644 index 0000000..6aa437a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/dto/TagTreeDTO.java @@ -0,0 +1,42 @@ +package com.ningdatech.pmapi.meta.model.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:53 + */ +@Data +public class TagTreeDTO { + + + /** + * 标签 编码 + * 根标签
擅长方向 good_at + * 技术专长 technical_expertise + * 行业领域 industry_sector + * 其他 other + */ + private String tagCode; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 标签级别 + */ + private Long tagLevel; + + /** + * 标签父级id + * 当parent_tag_code 为 -1 时为顶级标签 + */ + private String parentCode; + + + private List children; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertDictionary.java new file mode 100644 index 0000000..a6d5b42 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertDictionary.java @@ -0,0 +1,38 @@ +package com.ningdatech.pmapi.meta.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Data +@TableName("expert_dictionary") +@ApiModel(value = "ExpertDictionary对象", description = "") +public class ExpertDictionary implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private String dictionaryCode; + + private String expertInfoField; + + private Long userId; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertTag.java new file mode 100644 index 0000000..e9abc27 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/ExpertTag.java @@ -0,0 +1,38 @@ +package com.ningdatech.pmapi.meta.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@TableName("expert_tag") +@Data +@ApiModel(value = "ExpertTag对象", description = "") +public class ExpertTag implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String tagCode; + + private String expertInfoField; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaDictionary.java new file mode 100644 index 0000000..ed67e4b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaDictionary.java @@ -0,0 +1,50 @@ +package com.ningdatech.pmapi.meta.model.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Data +@TableName("meta_dictionary") +@ApiModel(value = "MetaDictionary对象", description = "") +public class MetaDictionary implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private String dictionaryType; + + private String dictionaryCode; + + private String dictionaryName; + + private String dictionaryDescribe; + + private Integer sortValue; + + private Long createBy; + + private String readonly; + + private Long updateBy; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaTag.java new file mode 100644 index 0000000..c3d770e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/entity/MetaTag.java @@ -0,0 +1,43 @@ +package com.ningdatech.pmapi.meta.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Data +@TableName("meta_tag") +@ApiModel(value = "MetaTag对象", description = "") +public class MetaTag implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private String tagName; + + private Long tagLevel; + + private String parentCode; + + private String tagType; + + private String tagCode; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddDictionaryRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddDictionaryRequest.java new file mode 100644 index 0000000..3814f48 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddDictionaryRequest.java @@ -0,0 +1,37 @@ +package com.ningdatech.pmapi.meta.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/8/25 上午11:10 + */ +@Data +@ApiModel("新增字典值") +public class AddDictionaryRequest { + + @ApiModelProperty(value = "字典类型") + @NotBlank + private String dictionaryType; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotBlank + private String name; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + @NotNull + private Integer sortValue; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddTagTypeRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddTagTypeRequest.java new file mode 100644 index 0000000..4de8c34 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddTagTypeRequest.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.meta.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/8/27 上午10:17 + */ +@ApiModel(description = "新增标签分类") +@Data +public class AddTagTypeRequest { + + @ApiModelProperty("标签分类名") + @NotBlank + private String tagName; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/DictionaryListRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/DictionaryListRequest.java new file mode 100644 index 0000000..879d896 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/DictionaryListRequest.java @@ -0,0 +1,19 @@ +package com.ningdatech.pmapi.meta.model.po; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:05 + */ +@Data +public class DictionaryListRequest { + + private List dictionaryTypeList; + + private Boolean allDict = false; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagListPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagListPO.java new file mode 100644 index 0000000..178756f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagListPO.java @@ -0,0 +1,14 @@ +package com.ningdatech.pmapi.meta.model.po; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午2:43 + */ +@Data +public class ReqTagListPO { + private List rootTagCodeList; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagListRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagListRequest.java new file mode 100644 index 0000000..a6b996a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagListRequest.java @@ -0,0 +1,14 @@ +package com.ningdatech.pmapi.meta.model.po; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午2:43 + */ +@Data +public class TagListRequest { + private List rootTagCodeList; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagQueryRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagQueryRequest.java new file mode 100644 index 0000000..aab5309 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagQueryRequest.java @@ -0,0 +1,24 @@ +package com.ningdatech.pmapi.meta.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/27 下午2:30 + */ +@Data +@ApiModel(description = "标签查询request") +public class TagQueryRequest { +// +// @ApiModelProperty("标签类型") +// private Long tagType; +// +// @ApiModelProperty("标签名") +// private String tagName; + + @ApiModelProperty("父级标签编码") + private String parentCode; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryListVO.java new file mode 100644 index 0000000..0efaa33 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryListVO.java @@ -0,0 +1,25 @@ +package com.ningdatech.pmapi.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:13 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "DictionaryListVO", description = "字典列表结构VO") +public class DictionaryListVO { + + @ApiModelProperty(value = "字典名称") + private String dictionaryName; + + @ApiModelProperty(value = "字典选项名称") + private List dictionaryList; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryVO.java new file mode 100644 index 0000000..777f453 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryVO.java @@ -0,0 +1,49 @@ +package com.ningdatech.pmapi.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 上午11:26 + */ +@Data +@ApiModel(value = "DictionaryListVO", description = "字典结构VO") +public class DictionaryVO { + + + @ApiModelProperty(value = "字典类型") + private String dictionaryType; + + /** + * 编码 随机数处理 + */ + @ApiModelProperty(value = "编码") + private String dictionaryCode; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + private String describe; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer sortValue; + + /** + * 是否内置,内置不可删除 + */ + @ApiModelProperty(value = "是否内置,内置不可删除") + private String readonly; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagListVO.java new file mode 100644 index 0000000..f26ddc0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagListVO.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/8/27 下午2:35 + */ +@Data +@ApiModel(description = "标签列表展示") +public class TagListVO { + + @ApiModelProperty(value = "标签 编码") + private String tagCode; + + @ApiModelProperty(value = "标签名称") + private String tagName; + + @ApiModelProperty(value = "标签级别") + private Long tagLevel; + + @ApiModelProperty(value = "使用频次") + private Long useFrequency; + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + @ApiModelProperty(value = "创建人") + private String creator; + + @ApiModelProperty(value = "是否为叶子节点") + private Boolean isLeaf; + + @ApiModelProperty(value = "是否有子集") + private Boolean hasChildren; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTreeVO.java new file mode 100644 index 0000000..ba87646 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTreeVO.java @@ -0,0 +1,58 @@ +package com.ningdatech.pmapi.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午2:27 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "TagTreeVO", description = "标签树状结构VO") +public class TagTreeVO { + + /** + * 标签 编码 + * 根标签
擅长方向 good_at + * 技术专长 technical_expertise + * 行业领域 industry_sector + * 其他 other + */ + @ApiModelProperty(value = " * 标签 编码\n" + + " * 根标签\u2028擅长方向 good_at\n" + + " * 技术专长 technical_expertise\n" + + " * 行业领域 industry_sector\n" + + " * 其他 other") + private String tagCode; + + /** + * 标签名称 + */ + @ApiModelProperty(value = "标签名称") + private String tagName; + + /** + * 标签级别 + */ + @ApiModelProperty(value = "标签级别") + private Long tagLevel; + + /** + * 标签父级id + * 当parent_tag_code 为 -1 时为顶级标签 + */ + @ApiModelProperty(value = " * 标签父级id\n" + + " * 当parent_tag_code 为 -1 时为顶级标签") + private String parentCode; + + @ApiModelProperty(value = "子节点标签") + private List children; + + @ApiModelProperty(value = "联合唯一字段方便页面使用(tagName##tagCode)") + private String unionCode; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTypeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTypeVO.java new file mode 100644 index 0000000..255bf0b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTypeVO.java @@ -0,0 +1,23 @@ +package com.ningdatech.pmapi.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/27 下午2:20 + */ +@Data +@ApiModel(description = "标签类型VO") +public class TagTypeVO { + + @ApiModelProperty(value = "标签编码") + private String tagCode; + + @ApiModelProperty(value = "标签名称") + private String tagName; + + @ApiModelProperty(value = "标签级别") + private Long tagLevel; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java new file mode 100644 index 0000000..9ea3a35 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.meta.service; + +import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IExpertDictionaryService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java new file mode 100644 index 0000000..74e2e8a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.meta.service; + +import com.ningdatech.pmapi.meta.model.entity.ExpertTag; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IExpertTagService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaDictionaryService.java new file mode 100644 index 0000000..4745147 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaDictionaryService.java @@ -0,0 +1,22 @@ +package com.ningdatech.pmapi.meta.service; + +import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IMetaDictionaryService extends IService { + + List queryAll(); + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaTagService.java new file mode 100644 index 0000000..862fe70 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IMetaTagService.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.meta.service; + +import com.ningdatech.pmapi.meta.model.entity.MetaTag; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.meta.model.dto.TagDTO; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +public interface IMetaTagService extends IService { + + List queryAll(); + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java new file mode 100644 index 0000000..346f4ec --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertDictionaryServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.meta.service.impl; + +import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; +import com.ningdatech.pmapi.meta.mapper.ExpertDictionaryMapper; +import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class ExpertDictionaryServiceImpl extends ServiceImpl implements IExpertDictionaryService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertTagServiceImpl.java new file mode 100644 index 0000000..891089f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/ExpertTagServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.meta.service.impl; + +import com.ningdatech.pmapi.meta.model.entity.ExpertTag; +import com.ningdatech.pmapi.meta.mapper.ExpertTagMapper; +import com.ningdatech.pmapi.meta.service.IExpertTagService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class ExpertTagServiceImpl extends ServiceImpl implements IExpertTagService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaDictionaryServiceImpl.java new file mode 100644 index 0000000..e55df9e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaDictionaryServiceImpl.java @@ -0,0 +1,32 @@ +package com.ningdatech.pmapi.meta.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; +import com.ningdatech.pmapi.meta.mapper.MetaDictionaryMapper; +import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; +import com.ningdatech.pmapi.meta.assembler.MetaDictionaryAssembler; +import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class MetaDictionaryServiceImpl extends ServiceImpl implements IMetaDictionaryService { + + @Override + public List queryAll() { + List dictionaryList = this.lambdaQuery().ne(MetaDictionary::getId, -1).list(); + List dictionaryDTOList = dictionaryList.stream().map(MetaDictionaryAssembler::toDictionaryDTO).collect(Collectors.toList()); + return dictionaryDTOList; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaTagServiceImpl.java new file mode 100644 index 0000000..c60de04 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/impl/MetaTagServiceImpl.java @@ -0,0 +1,33 @@ +package com.ningdatech.pmapi.meta.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; +import com.ningdatech.pmapi.meta.model.entity.MetaTag; +import com.ningdatech.pmapi.meta.mapper.MetaTagMapper; +import com.ningdatech.pmapi.meta.model.dto.TagDTO; +import com.ningdatech.pmapi.meta.service.IMetaTagService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Service +public class MetaTagServiceImpl extends ServiceImpl implements IMetaTagService { + + + @Override + public List queryAll() { + List allTags = this.lambdaQuery().ne(MetaTag::getId, -1).list(); + List allTagDTOList = allTags.stream().map(MetaTagAssembler::toTagDTO).collect(Collectors.toList()); + return allTagDTOList; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/TagListRequestValidator.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/TagListRequestValidator.java new file mode 100644 index 0000000..836c3c6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/TagListRequestValidator.java @@ -0,0 +1,31 @@ +package com.ningdatech.pmapi.meta.validate; + + +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; +import com.ningdatech.pmapi.meta.model.po.ReqTagListPO; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午2:44 + */ + +public class TagListRequestValidator { + + private TagListRequestValidator() { + } + + public static void tagListRequestValidator(ReqTagListPO request) { + List rootTagCodeList = request.getRootTagCodeList(); + if (CollectionUtils.isNotEmpty(rootTagCodeList)) { + for (String rootTagCode : rootTagCodeList) { + if (!ExpertTagEnum.contains(rootTagCode)) { + throw new BizException("Illegal rootTagCode:" + rootTagCode); + } + } + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/ExpertTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/ExpertTagController.java deleted file mode 100644 index c284fb8..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/ExpertTagController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.tag.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Controller -@RequestMapping("/pmapi.tag/expert-tag") -public class ExpertTagController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/MetaTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/MetaTagController.java deleted file mode 100644 index 84fd5d1..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/controller/MetaTagController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.tag.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Controller -@RequestMapping("/pmapi.tag/meta-tag") -public class MetaTagController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java deleted file mode 100644 index d409abf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/ExpertTag.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ningdatech.pmapi.tag.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@TableName("expert_tag") -@Data -@ApiModel(value = "ExpertTag对象", description = "") -public class ExpertTag implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long userId; - - private String tagCode; - - private String expertInfoField; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java deleted file mode 100644 index cc4b52a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/entity/MetaTag.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ningdatech.pmapi.tag.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Data -@TableName("meta_tag") -@ApiModel(value = "MetaTag对象", description = "") -public class MetaTag implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private String tagName; - - private Long tagLevel; - - private String parentCode; - - private String tagType; - - private String tagCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.java deleted file mode 100644 index 01a1bf2..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.tag.mapper; - -import com.ningdatech.pmapi.tag.entity.ExpertTag; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface ExpertTagMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.xml deleted file mode 100644 index d705269..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/ExpertTagMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.java deleted file mode 100644 index 3e7a783..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.tag.mapper; - -import com.ningdatech.pmapi.tag.entity.MetaTag; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface MetaTagMapper extends BaseMapper { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.xml deleted file mode 100644 index 2b3f916..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/mapper/MetaTagMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IExpertTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IExpertTagService.java deleted file mode 100644 index 4970bb6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IExpertTagService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.tag.service; - -import com.ningdatech.pmapi.tag.entity.ExpertTag; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface IExpertTagService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IMetaTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IMetaTagService.java deleted file mode 100644 index ce9005b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/IMetaTagService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ningdatech.pmapi.tag.service; - -import com.ningdatech.pmapi.tag.entity.MetaTag; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 服务类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -public interface IMetaTagService extends IService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/ExpertTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/ExpertTagServiceImpl.java deleted file mode 100644 index d62ceef..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/ExpertTagServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.tag.service.impl; - -import com.ningdatech.pmapi.tag.entity.ExpertTag; -import com.ningdatech.pmapi.tag.mapper.ExpertTagMapper; -import com.ningdatech.pmapi.tag.service.IExpertTagService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Service -public class ExpertTagServiceImpl extends ServiceImpl implements IExpertTagService { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/MetaTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/MetaTagServiceImpl.java deleted file mode 100644 index 458b843..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/tag/service/impl/MetaTagServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.tag.service.impl; - -import com.ningdatech.pmapi.tag.entity.MetaTag; -import com.ningdatech.pmapi.tag.mapper.MetaTagMapper; -import com.ningdatech.pmapi.tag.service.IMetaTagService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Service -public class MetaTagServiceImpl extends ServiceImpl implements IMetaTagService { - -} From 61c5945e03030b2463a1a6a7a3703aa13c501283 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 22 Feb 2023 16:34:16 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E5=91=BD=E5=90=8D=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/expert/controller/ExpertController.java | 20 ++++ .../controller/ExpertUserFullInfoController.java | 20 ---- .../meta/assembler/MetaDictionaryAssembler.java | 20 ++-- .../pmapi/meta/assembler/MetaTagAssembler.java | 24 ++--- .../controller/ExpertDictionaryController.java | 20 ---- .../pmapi/meta/controller/ExpertTagController.java | 20 ---- .../meta/controller/MetaDictionaryController.java | 20 ---- .../controller/MetaDictionaryManageController.java | 62 +++++++++++ .../pmapi/meta/controller/MetaTagController.java | 20 ---- .../meta/controller/MetaTagManageController.java | 20 ++-- .../ningdatech/pmapi/meta/manage/MetaManage.java | 116 ++++++++++----------- .../pmapi/meta/mapper/MetaDictionaryMapper.java | 4 +- .../pmapi/meta/model/po/AddDictionaryRequest.java | 37 ------- .../pmapi/meta/model/po/AddTagTypeRequest.java | 20 ---- .../pmapi/meta/model/po/DictionaryListRequest.java | 19 ---- .../pmapi/meta/model/po/ReqAddDictionaryPO.java | 37 +++++++ .../pmapi/meta/model/po/ReqAddTagTypePO.java | 20 ++++ .../pmapi/meta/model/po/ReqDictionaryListPO.java | 19 ++++ .../pmapi/meta/model/po/ReqTagQueryPO.java | 24 +++++ .../pmapi/meta/model/po/TagListRequest.java | 14 --- .../pmapi/meta/model/po/TagQueryRequest.java | 24 ----- .../pmapi/meta/model/vo/DictionaryListVO.java | 25 ----- .../pmapi/meta/model/vo/DictionaryVO.java | 49 --------- .../pmapi/meta/model/vo/ResDictionaryListVO.java | 25 +++++ .../pmapi/meta/model/vo/ResDictionaryVO.java | 49 +++++++++ .../pmapi/meta/model/vo/ResTagListVO.java | 41 ++++++++ .../pmapi/meta/model/vo/ResTagTreeVO.java | 58 +++++++++++ .../pmapi/meta/model/vo/ResTagTypeVO.java | 23 ++++ .../ningdatech/pmapi/meta/model/vo/TagListVO.java | 41 -------- .../ningdatech/pmapi/meta/model/vo/TagTreeVO.java | 58 ----------- .../ningdatech/pmapi/meta/model/vo/TagTypeVO.java | 23 ---- .../meta/validate/DictionaryRequestValidator.java | 27 +++++ 32 files changed, 494 insertions(+), 505 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertUserFullInfoController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertDictionaryController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertTagController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryManageController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagController.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddDictionaryRequest.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddTagTypeRequest.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/DictionaryListRequest.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddDictionaryPO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddTagTypePO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqDictionaryListPO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagQueryPO.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagListRequest.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagQueryRequest.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryListVO.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryListVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagListVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTreeVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTypeVO.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagListVO.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTreeVO.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTypeVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/DictionaryRequestValidator.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java new file mode 100644 index 0000000..d778372 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.expert.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-22 + */ +@Controller +@RequestMapping("/api/v1/expert") +public class ExpertController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertUserFullInfoController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertUserFullInfoController.java deleted file mode 100644 index 55e6ab3..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertUserFullInfoController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.expert.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Controller -@RequestMapping("/pmapi.expert/nd-expert-user-full-info") -public class ExpertUserFullInfoController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java index e1f1521..109d695 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaDictionaryAssembler.java @@ -3,7 +3,7 @@ package com.ningdatech.pmapi.meta.assembler; import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; -import com.ningdatech.pmapi.meta.model.vo.DictionaryVO; +import com.ningdatech.pmapi.meta.model.vo.ResDictionaryVO; /** * @author liuxinxin @@ -23,14 +23,14 @@ public class MetaDictionaryAssembler { return dictionaryDTO; } - public static DictionaryVO toDictionaryVO(DictionaryDTO dictionaryDTO) { - DictionaryVO dictionaryVO = new DictionaryVO(); - dictionaryVO.setDescribe(dictionaryDTO.getDescribe()); - dictionaryVO.setDictionaryCode(dictionaryDTO.getDictionaryCode()); - dictionaryVO.setDictionaryType(dictionaryDTO.getDictionaryType()); - dictionaryVO.setName(dictionaryDTO.getName()); - dictionaryVO.setReadonly(dictionaryDTO.getReadonly()); - dictionaryVO.setSortValue(dictionaryDTO.getSortValue()); - return dictionaryVO; + public static ResDictionaryVO toDictionaryVO(DictionaryDTO dictionaryDTO) { + ResDictionaryVO resDictionaryVO = new ResDictionaryVO(); + resDictionaryVO.setDescribe(dictionaryDTO.getDescribe()); + resDictionaryVO.setDictionaryCode(dictionaryDTO.getDictionaryCode()); + resDictionaryVO.setDictionaryType(dictionaryDTO.getDictionaryType()); + resDictionaryVO.setName(dictionaryDTO.getName()); + resDictionaryVO.setReadonly(dictionaryDTO.getReadonly()); + resDictionaryVO.setSortValue(dictionaryDTO.getSortValue()); + return resDictionaryVO; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java index 2491eb4..44f850d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/assembler/MetaTagAssembler.java @@ -3,7 +3,7 @@ package com.ningdatech.pmapi.meta.assembler; import com.ningdatech.pmapi.meta.model.entity.MetaTag; import com.ningdatech.pmapi.meta.model.dto.TagDTO; import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; -import com.ningdatech.pmapi.meta.model.vo.TagTreeVO; +import com.ningdatech.pmapi.meta.model.vo.ResTagTreeVO; import org.apache.commons.collections4.CollectionUtils; import java.util.ArrayList; @@ -43,20 +43,20 @@ public class MetaTagAssembler { return tagTreeDTO; } - public static List toTagTreeVOList(List tagTreeDTOList) { - List tagTreeVOList = new ArrayList<>(); + public static List toTagTreeVOList(List tagTreeDTOList) { + List resTagTreeVOList = new ArrayList<>(); for (TagTreeDTO tagTreeDTO : tagTreeDTOList) { - TagTreeVO tagTreeVO = new TagTreeVO(); - tagTreeVO.setTagLevel(tagTreeDTO.getTagLevel()); - tagTreeVO.setTagName(tagTreeDTO.getTagName()); - tagTreeVO.setParentCode(tagTreeDTO.getParentCode()); - tagTreeVO.setTagCode(tagTreeDTO.getTagCode()); - tagTreeVO.setUnionCode(tagTreeDTO.getTagName() + "##" + tagTreeDTO.getTagCode()); + ResTagTreeVO resTagTreeVO = new ResTagTreeVO(); + resTagTreeVO.setTagLevel(tagTreeDTO.getTagLevel()); + resTagTreeVO.setTagName(tagTreeDTO.getTagName()); + resTagTreeVO.setParentCode(tagTreeDTO.getParentCode()); + resTagTreeVO.setTagCode(tagTreeDTO.getTagCode()); + resTagTreeVO.setUnionCode(tagTreeDTO.getTagName() + "##" + tagTreeDTO.getTagCode()); if (CollectionUtils.isNotEmpty(tagTreeDTO.getChildren())) { - tagTreeVO.setChildren(toTagTreeVOList(tagTreeDTO.getChildren())); + resTagTreeVO.setChildren(toTagTreeVOList(tagTreeDTO.getChildren())); } - tagTreeVOList.add(tagTreeVO); + resTagTreeVOList.add(resTagTreeVO); } - return tagTreeVOList; + return resTagTreeVOList; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertDictionaryController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertDictionaryController.java deleted file mode 100644 index cff8529..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertDictionaryController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.meta.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Controller -@RequestMapping("/pmapi.dictionary/expert-dictionary") -public class ExpertDictionaryController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertTagController.java deleted file mode 100644 index 67e9574..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/ExpertTagController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.meta.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Controller -@RequestMapping("/pmapi.tag/expert-tag") -public class ExpertTagController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryController.java deleted file mode 100644 index 030cffd..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.meta.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Controller -@RequestMapping("/pmapi.dictionary/meta-dictionary") -public class MetaDictionaryController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryManageController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryManageController.java new file mode 100644 index 0000000..80b2081 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaDictionaryManageController.java @@ -0,0 +1,62 @@ +package com.ningdatech.pmapi.meta.controller; + + +import com.ningdatech.pmapi.meta.manage.MetaManage; +import com.ningdatech.pmapi.meta.model.po.ReqAddDictionaryPO; +import com.ningdatech.pmapi.meta.model.po.ReqDictionaryListPO; +import com.ningdatech.pmapi.meta.model.vo.ResDictionaryListVO; +import com.ningdatech.pmapi.meta.validate.DictionaryRequestValidator; +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; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author liuxinxin + * @since 2022-07-21 + */ +@RestController +@Validated +@RequiredArgsConstructor +@RequestMapping("/api/v1/meta/dictionary") +@Api(tags = "基础数据接口") +public class MetaDictionaryManageController { + + // private final IMetaDictionaryManageService metaDictionaryManageService; + private final MetaManage metaManage; + + @PostMapping("/list") + @ApiOperation("字典筛选数据返回") + public List expertDictList(@RequestBody ReqDictionaryListPO request) { + DictionaryRequestValidator.dictionaryRequestValidator(request); + return metaManage.getDictionaryList(request); + } + + @PostMapping("/common/list") + @ApiOperation("通用字典筛选数据返回") + public List commonDictList(@RequestBody ReqDictionaryListPO request) { + DictionaryRequestValidator.dictionaryRequestValidator(request); + return metaManage.commonDictList(request); + } + + @PostMapping("/add/dictionary") + @ApiOperation("添加字典值") + public void addDictionary(@Valid @RequestBody ReqAddDictionaryPO reqAddDictionaryPO) { + metaManage.addDictionary(reqAddDictionaryPO); + } + + @PostMapping("/remove/dictionary/{dictionaryCode}") + @ApiOperation("删除字典值") + public void removeDictionary(@PathVariable String dictionaryCode) { + metaManage.removeDictionary(dictionaryCode); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagController.java deleted file mode 100644 index 49bec9c..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.meta.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.stereotype.Controller; - -/** - *

- * 前端控制器 - *

- * - * @author Liuxinxin - * @since 2023-02-22 - */ -@Controller -@RequestMapping("/pmapi.tag/meta-tag") -public class MetaTagController { - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java index 913d51f..6b27ddc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/controller/MetaTagManageController.java @@ -2,12 +2,12 @@ package com.ningdatech.pmapi.meta.controller; import com.ningdatech.pmapi.meta.manage.MetaManage; -import com.ningdatech.pmapi.meta.model.po.AddTagTypeRequest; +import com.ningdatech.pmapi.meta.model.po.ReqAddTagTypePO; import com.ningdatech.pmapi.meta.model.po.ReqTagListPO; -import com.ningdatech.pmapi.meta.model.po.TagQueryRequest; -import com.ningdatech.pmapi.meta.model.vo.TagListVO; -import com.ningdatech.pmapi.meta.model.vo.TagTreeVO; -import com.ningdatech.pmapi.meta.model.vo.TagTypeVO; +import com.ningdatech.pmapi.meta.model.po.ReqTagQueryPO; +import com.ningdatech.pmapi.meta.model.vo.ResTagListVO; +import com.ningdatech.pmapi.meta.model.vo.ResTagTreeVO; +import com.ningdatech.pmapi.meta.model.vo.ResTagTypeVO; import com.ningdatech.pmapi.meta.validate.TagListRequestValidator; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -46,7 +46,7 @@ public class MetaTagManageController { @PostMapping("/tag") @ApiOperation("获取专家标签的树状结构") - public List getRegionTree(HttpServletResponse response, @RequestBody ReqTagListPO request) { + public List getRegionTree(HttpServletResponse response, @RequestBody ReqTagListPO request) { response.setHeader("Cache-Control", MAX_AGE_STR); TagListRequestValidator.tagListRequestValidator(request); return metaManage.getTagTree(request); @@ -54,19 +54,19 @@ public class MetaTagManageController { @PostMapping("/tag/query") @ApiOperation("标签查询接口") - public List tagQuery(@Valid @RequestBody TagQueryRequest tagQueryRequest) { - return metaManage.tagQuery(tagQueryRequest); + public List tagQuery(@Valid @RequestBody ReqTagQueryPO reqTagQueryPO) { + return metaManage.tagQuery(reqTagQueryPO); } @PostMapping("/tag-tyoe/list") @ApiOperation("获取标签分类列表") - public List tagTypeList() { + public List tagTypeList() { return metaManage.tagTypeList(); } @PostMapping("/add/tag-type") @ApiOperation("新增标签分类") - public void addTagType(@Valid @RequestBody AddTagTypeRequest request) { + public void addTagType(@Valid @RequestBody ReqAddTagTypePO request) { metaManage.addTagType(request); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java index 0e17c41..398b7f1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/manage/MetaManage.java @@ -10,24 +10,24 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; -import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; -import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; import com.ningdatech.pmapi.meta.assembler.MetaDictionaryAssembler; import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; import com.ningdatech.pmapi.meta.constant.TagConst; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; -import com.ningdatech.pmapi.meta.model.entity.MetaTag; import com.ningdatech.pmapi.meta.helper.DictionaryCache; import com.ningdatech.pmapi.meta.helper.TagCache; import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; +import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; +import com.ningdatech.pmapi.meta.model.entity.ExpertTag; +import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; +import com.ningdatech.pmapi.meta.model.entity.MetaTag; import com.ningdatech.pmapi.meta.model.po.*; import com.ningdatech.pmapi.meta.model.vo.*; +import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; import com.ningdatech.pmapi.meta.service.IExpertTagService; +import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; import com.ningdatech.pmapi.meta.service.IMetaTagService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -45,7 +45,6 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class MetaManage { - // private final RegionCache regionCache; private final DictionaryCache dictionaryCache; private final TagCache tagCache; private final IMetaDictionaryService metaDictionaryManageService; @@ -53,40 +52,35 @@ public class MetaManage { private final IMetaTagService iMetaTagManageService; private final IExpertTagService iExpertTagService; -// public List getRegionTree() { -// List regionTreeDtos = regionCache.getAll(); -// return MetaRegionAssembler.toRegionTreeVOList(regionTreeDtos); -// } - - public List getDictionaryList(DictionaryListRequest request) { + public List getDictionaryList(ReqDictionaryListPO request) { List dictionaryTypeList = request.getDictionaryTypeList(); if (CollectionUtils.isEmpty(dictionaryTypeList)) { dictionaryTypeList = DictExpertInfoTypeEnum.getAll(); } - List dictionaryListVos = new ArrayList<>(); + List resDictionaryListVos = new ArrayList<>(); for (String dictionaryType : dictionaryTypeList) { - DictionaryListVO dictionaryListVO = new DictionaryListVO(); - dictionaryListVO.setDictionaryName(dictionaryType); + ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); + resDictionaryListVO.setDictionaryName(dictionaryType); List dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); - List dictionaryVOList = dictionaryList.stream() + List resDictionaryVOList = dictionaryList.stream() .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); - dictionaryListVO.setDictionaryList(dictionaryVOList); - dictionaryListVos.add(dictionaryListVO); + resDictionaryListVO.setDictionaryList(resDictionaryVOList); + resDictionaryListVos.add(resDictionaryListVO); } - return dictionaryListVos; + return resDictionaryListVos; } - public List commonDictList(DictionaryListRequest request) { - List result = new ArrayList<>(); + public List commonDictList(ReqDictionaryListPO request) { + List result = new ArrayList<>(); if (request.getAllDict()) { Map> groupByType = CollUtils.group(metaDictionaryManageService.list(), MetaDictionary::getDictionaryType); groupByType.forEach((k, v) -> { - DictionaryListVO dictionaryListVO = new DictionaryListVO(); - dictionaryListVO.setDictionaryName(k); - List dictionaryVOList = v.stream() + ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); + resDictionaryListVO.setDictionaryName(k); + List resDictionaryVOList = v.stream() .map(w -> { - DictionaryVO vo = new DictionaryVO(); + ResDictionaryVO vo = new ResDictionaryVO(); vo.setDescribe(w.getDictionaryDescribe()); vo.setDictionaryCode(w.getDictionaryCode()); vo.setDictionaryType(w.getDictionaryType()); @@ -95,25 +89,25 @@ public class MetaManage { vo.setSortValue(w.getSortValue()); return vo; }).collect(Collectors.toList()); - dictionaryListVO.setDictionaryList(dictionaryVOList); - result.add(dictionaryListVO); + resDictionaryListVO.setDictionaryList(resDictionaryVOList); + result.add(resDictionaryListVO); }); } else { List dictionaryTypeList = request.getDictionaryTypeList(); for (String dictionaryType : dictionaryTypeList) { - DictionaryListVO dictionaryListVO = new DictionaryListVO(); - dictionaryListVO.setDictionaryName(dictionaryType); + ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); + resDictionaryListVO.setDictionaryName(dictionaryType); List dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); - List dictionaryVOList = dictionaryList.stream() + List resDictionaryVOList = dictionaryList.stream() .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); - dictionaryListVO.setDictionaryList(dictionaryVOList); - result.add(dictionaryListVO); + resDictionaryListVO.setDictionaryList(resDictionaryVOList); + result.add(resDictionaryListVO); } } return result; } - public List getTagTree(ReqTagListPO request) { + public List getTagTree(ReqTagListPO request) { List rootTagCodeList = request.getRootTagCodeList(); if (CollectionUtils.isEmpty(rootTagCodeList)) { rootTagCodeList = ExpertTagEnum.getAll(); @@ -132,17 +126,17 @@ public class MetaManage { /** * 专家管理员才能调用 * - * @param addDictionaryRequest + * @param reqAddDictionaryPO */ @Transactional(rollbackFor = Exception.class) - public void addDictionary(AddDictionaryRequest addDictionaryRequest) { - String dictionaryType = addDictionaryRequest.getDictionaryType(); + public void addDictionary(ReqAddDictionaryPO reqAddDictionaryPO) { + String dictionaryType = reqAddDictionaryPO.getDictionaryType(); boolean contains = DictExpertInfoTypeEnum.contains(dictionaryType); if (!contains) { throw BizException.wrap("无效的专家字典类型:%s", dictionaryType); } - String name = addDictionaryRequest.getName(); - Integer sortValue = addDictionaryRequest.getSortValue(); + String name = reqAddDictionaryPO.getName(); + Integer sortValue = reqAddDictionaryPO.getSortValue(); LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType); List dictionaryManageList = metaDictionaryManageService.list(eq); @@ -187,7 +181,7 @@ public class MetaManage { metaDictionaryManageService.removeById(one); } - public void addTagType(AddTagTypeRequest request) { + public void addTagType(ReqAddTagTypePO request) { String tagName = request.getTagName(); LambdaQueryWrapper in = Wrappers.lambdaQuery(MetaTag.class) .in(MetaTag::getTagName, tagName) @@ -225,21 +219,21 @@ public class MetaManage { } } - public List tagTypeList() { + public List tagTypeList() { LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); List list = iMetaTagManageService.list(eq); return list.stream().map(r -> { - TagTypeVO tagTypeVO = new TagTypeVO(); - tagTypeVO.setTagCode(r.getTagCode()); - tagTypeVO.setTagLevel(r.getTagLevel()); - tagTypeVO.setTagName(r.getTagName()); - tagTypeVO.setTagName(r.getTagName()); - return tagTypeVO; + ResTagTypeVO resTagTypeVO = new ResTagTypeVO(); + resTagTypeVO.setTagCode(r.getTagCode()); + resTagTypeVO.setTagLevel(r.getTagLevel()); + resTagTypeVO.setTagName(r.getTagName()); + resTagTypeVO.setTagName(r.getTagName()); + return resTagTypeVO; }).collect(Collectors.toList()); } - public List tagQuery(TagQueryRequest tagQueryRequest) { - String parentCode = tagQueryRequest.getParentCode(); + public List tagQuery(ReqTagQueryPO reqTagQueryPO) { + String parentCode = reqTagQueryPO.getParentCode(); if (StringUtils.isBlank(parentCode)) { parentCode = TagConst.TAG_ROOT_PARENT_CODE; } @@ -263,27 +257,27 @@ public class MetaManage { Map> finalHasChildrenMap = hasChildrenMap; Map> finalUseFrequencyMap = useFrequencyMap; return list.stream().map(r -> { - TagListVO tagListVO = new TagListVO(); - tagListVO.setCreateTime(r.getCreateOn()); - tagListVO.setCreator(TagConst.TAG_CREATOR); - tagListVO.setTagLevel(r.getTagLevel()); - tagListVO.setTagCode(r.getTagCode()); - tagListVO.setTagName(r.getTagName()); + ResTagListVO resTagListVO = new ResTagListVO(); + resTagListVO.setCreateTime(r.getCreateOn()); + resTagListVO.setCreator(TagConst.TAG_CREATOR); + resTagListVO.setTagLevel(r.getTagLevel()); + resTagListVO.setTagCode(r.getTagCode()); + resTagListVO.setTagName(r.getTagName()); List metaTagManages = finalHasChildrenMap.get(r.getTagCode()); if (CollUtil.isNotEmpty(metaTagManages)) { - tagListVO.setIsLeaf(false); - tagListVO.setHasChildren(true); + resTagListVO.setIsLeaf(false); + resTagListVO.setHasChildren(true); } else { - tagListVO.setIsLeaf(true); - tagListVO.setHasChildren(false); + resTagListVO.setIsLeaf(true); + resTagListVO.setHasChildren(false); } long useFrequency = 0; List expertTagList = finalUseFrequencyMap.get(r.getTagCode()); if (CollUtil.isNotEmpty(expertTagList)) { useFrequency = expertTagList.size(); } - tagListVO.setUseFrequency(useFrequency); - return tagListVO; + resTagListVO.setUseFrequency(useFrequency); + return resTagListVO; }).collect(Collectors.toList()); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java index da9a0f4..0307169 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/mapper/MetaDictionaryMapper.java @@ -1,11 +1,11 @@ package com.ningdatech.pmapi.meta.mapper; -import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; /** *

- * Mapper 接口 + * Mapper 接口 *

* * @author Liuxinxin diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddDictionaryRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddDictionaryRequest.java deleted file mode 100644 index 3814f48..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddDictionaryRequest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ningdatech.pmapi.meta.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -/** - * @author liuxinxin - * @date 2022/8/25 上午11:10 - */ -@Data -@ApiModel("新增字典值") -public class AddDictionaryRequest { - - @ApiModelProperty(value = "字典类型") - @NotBlank - private String dictionaryType; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - @NotBlank - private String name; - - /** - * 排序 - */ - @ApiModelProperty(value = "排序") - @NotNull - private Integer sortValue; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddTagTypeRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddTagTypeRequest.java deleted file mode 100644 index 4de8c34..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/AddTagTypeRequest.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ningdatech.pmapi.meta.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author liuxinxin - * @date 2022/8/27 上午10:17 - */ -@ApiModel(description = "新增标签分类") -@Data -public class AddTagTypeRequest { - - @ApiModelProperty("标签分类名") - @NotBlank - private String tagName; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/DictionaryListRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/DictionaryListRequest.java deleted file mode 100644 index 879d896..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/DictionaryListRequest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ningdatech.pmapi.meta.model.po; - -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/21 下午6:05 - */ -@Data -public class DictionaryListRequest { - - private List dictionaryTypeList; - - private Boolean allDict = false; - - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddDictionaryPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddDictionaryPO.java new file mode 100644 index 0000000..5825080 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddDictionaryPO.java @@ -0,0 +1,37 @@ +package com.ningdatech.pmapi.meta.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/8/25 上午11:10 + */ +@Data +@ApiModel("新增字典值") +public class ReqAddDictionaryPO { + + @ApiModelProperty(value = "字典类型") + @NotBlank + private String dictionaryType; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotBlank + private String name; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + @NotNull + private Integer sortValue; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddTagTypePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddTagTypePO.java new file mode 100644 index 0000000..d41d1cb --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqAddTagTypePO.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.meta.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/8/27 上午10:17 + */ +@ApiModel(description = "新增标签分类") +@Data +public class ReqAddTagTypePO { + + @ApiModelProperty("标签分类名") + @NotBlank + private String tagName; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqDictionaryListPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqDictionaryListPO.java new file mode 100644 index 0000000..245bfb6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqDictionaryListPO.java @@ -0,0 +1,19 @@ +package com.ningdatech.pmapi.meta.model.po; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:05 + */ +@Data +public class ReqDictionaryListPO { + + private List dictionaryTypeList; + + private Boolean allDict = false; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagQueryPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagQueryPO.java new file mode 100644 index 0000000..31527c4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/ReqTagQueryPO.java @@ -0,0 +1,24 @@ +package com.ningdatech.pmapi.meta.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/27 下午2:30 + */ +@Data +@ApiModel(description = "标签查询request") +public class ReqTagQueryPO { +// +// @ApiModelProperty("标签类型") +// private Long tagType; +// +// @ApiModelProperty("标签名") +// private String tagName; + + @ApiModelProperty("父级标签编码") + private String parentCode; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagListRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagListRequest.java deleted file mode 100644 index a6b996a..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagListRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ningdatech.pmapi.meta.model.po; - -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 下午2:43 - */ -@Data -public class TagListRequest { - private List rootTagCodeList; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagQueryRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagQueryRequest.java deleted file mode 100644 index aab5309..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/po/TagQueryRequest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ningdatech.pmapi.meta.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/8/27 下午2:30 - */ -@Data -@ApiModel(description = "标签查询request") -public class TagQueryRequest { -// -// @ApiModelProperty("标签类型") -// private Long tagType; -// -// @ApiModelProperty("标签名") -// private String tagName; - - @ApiModelProperty("父级标签编码") - private String parentCode; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryListVO.java deleted file mode 100644 index 0efaa33..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryListVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ningdatech.pmapi.meta.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.ToString; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/21 下午6:13 - */ -@Data -@ToString(callSuper = true) -@ApiModel(value = "DictionaryListVO", description = "字典列表结构VO") -public class DictionaryListVO { - - @ApiModelProperty(value = "字典名称") - private String dictionaryName; - - @ApiModelProperty(value = "字典选项名称") - private List dictionaryList; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryVO.java deleted file mode 100644 index 777f453..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/DictionaryVO.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ningdatech.pmapi.meta.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/7/22 上午11:26 - */ -@Data -@ApiModel(value = "DictionaryListVO", description = "字典结构VO") -public class DictionaryVO { - - - @ApiModelProperty(value = "字典类型") - private String dictionaryType; - - /** - * 编码 随机数处理 - */ - @ApiModelProperty(value = "编码") - private String dictionaryCode; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - private String name; - - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - private String describe; - - /** - * 排序 - */ - @ApiModelProperty(value = "排序") - private Integer sortValue; - - /** - * 是否内置,内置不可删除 - */ - @ApiModelProperty(value = "是否内置,内置不可删除") - private String readonly; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryListVO.java new file mode 100644 index 0000000..e1661c3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryListVO.java @@ -0,0 +1,25 @@ +package com.ningdatech.pmapi.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:13 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "DictionaryListVO", description = "字典列表结构VO") +public class ResDictionaryListVO { + + @ApiModelProperty(value = "字典名称") + private String dictionaryName; + + @ApiModelProperty(value = "字典选项名称") + private List dictionaryList; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryVO.java new file mode 100644 index 0000000..040b235 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResDictionaryVO.java @@ -0,0 +1,49 @@ +package com.ningdatech.pmapi.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 上午11:26 + */ +@Data +@ApiModel(value = "DictionaryListVO", description = "字典结构VO") +public class ResDictionaryVO { + + + @ApiModelProperty(value = "字典类型") + private String dictionaryType; + + /** + * 编码 随机数处理 + */ + @ApiModelProperty(value = "编码") + private String dictionaryCode; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + private String describe; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer sortValue; + + /** + * 是否内置,内置不可删除 + */ + @ApiModelProperty(value = "是否内置,内置不可删除") + private String readonly; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagListVO.java new file mode 100644 index 0000000..91f9782 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagListVO.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/8/27 下午2:35 + */ +@Data +@ApiModel(description = "标签列表展示") +public class ResTagListVO { + + @ApiModelProperty(value = "标签 编码") + private String tagCode; + + @ApiModelProperty(value = "标签名称") + private String tagName; + + @ApiModelProperty(value = "标签级别") + private Long tagLevel; + + @ApiModelProperty(value = "使用频次") + private Long useFrequency; + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + @ApiModelProperty(value = "创建人") + private String creator; + + @ApiModelProperty(value = "是否为叶子节点") + private Boolean isLeaf; + + @ApiModelProperty(value = "是否有子集") + private Boolean hasChildren; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTreeVO.java new file mode 100644 index 0000000..ee1f6bb --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTreeVO.java @@ -0,0 +1,58 @@ +package com.ningdatech.pmapi.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午2:27 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "TagTreeVO", description = "标签树状结构VO") +public class ResTagTreeVO { + + /** + * 标签 编码 + * 根标签
擅长方向 good_at + * 技术专长 technical_expertise + * 行业领域 industry_sector + * 其他 other + */ + @ApiModelProperty(value = " * 标签 编码\n" + + " * 根标签\u2028擅长方向 good_at\n" + + " * 技术专长 technical_expertise\n" + + " * 行业领域 industry_sector\n" + + " * 其他 other") + private String tagCode; + + /** + * 标签名称 + */ + @ApiModelProperty(value = "标签名称") + private String tagName; + + /** + * 标签级别 + */ + @ApiModelProperty(value = "标签级别") + private Long tagLevel; + + /** + * 标签父级id + * 当parent_tag_code 为 -1 时为顶级标签 + */ + @ApiModelProperty(value = " * 标签父级id\n" + + " * 当parent_tag_code 为 -1 时为顶级标签") + private String parentCode; + + @ApiModelProperty(value = "子节点标签") + private List children; + + @ApiModelProperty(value = "联合唯一字段方便页面使用(tagName##tagCode)") + private String unionCode; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTypeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTypeVO.java new file mode 100644 index 0000000..e097f16 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/ResTagTypeVO.java @@ -0,0 +1,23 @@ +package com.ningdatech.pmapi.meta.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/8/27 下午2:20 + */ +@Data +@ApiModel(description = "标签类型VO") +public class ResTagTypeVO { + + @ApiModelProperty(value = "标签编码") + private String tagCode; + + @ApiModelProperty(value = "标签名称") + private String tagName; + + @ApiModelProperty(value = "标签级别") + private Long tagLevel; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagListVO.java deleted file mode 100644 index f26ddc0..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagListVO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.ningdatech.pmapi.meta.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * @author liuxinxin - * @date 2022/8/27 下午2:35 - */ -@Data -@ApiModel(description = "标签列表展示") -public class TagListVO { - - @ApiModelProperty(value = "标签 编码") - private String tagCode; - - @ApiModelProperty(value = "标签名称") - private String tagName; - - @ApiModelProperty(value = "标签级别") - private Long tagLevel; - - @ApiModelProperty(value = "使用频次") - private Long useFrequency; - - @ApiModelProperty(value = "创建时间") - private LocalDateTime createTime; - - @ApiModelProperty(value = "创建人") - private String creator; - - @ApiModelProperty(value = "是否为叶子节点") - private Boolean isLeaf; - - @ApiModelProperty(value = "是否有子集") - private Boolean hasChildren; - -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTreeVO.java deleted file mode 100644 index ba87646..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTreeVO.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ningdatech.pmapi.meta.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.ToString; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2022/7/22 下午2:27 - */ -@Data -@ToString(callSuper = true) -@ApiModel(value = "TagTreeVO", description = "标签树状结构VO") -public class TagTreeVO { - - /** - * 标签 编码 - * 根标签
擅长方向 good_at - * 技术专长 technical_expertise - * 行业领域 industry_sector - * 其他 other - */ - @ApiModelProperty(value = " * 标签 编码\n" + - " * 根标签\u2028擅长方向 good_at\n" + - " * 技术专长 technical_expertise\n" + - " * 行业领域 industry_sector\n" + - " * 其他 other") - private String tagCode; - - /** - * 标签名称 - */ - @ApiModelProperty(value = "标签名称") - private String tagName; - - /** - * 标签级别 - */ - @ApiModelProperty(value = "标签级别") - private Long tagLevel; - - /** - * 标签父级id - * 当parent_tag_code 为 -1 时为顶级标签 - */ - @ApiModelProperty(value = " * 标签父级id\n" + - " * 当parent_tag_code 为 -1 时为顶级标签") - private String parentCode; - - @ApiModelProperty(value = "子节点标签") - private List children; - - @ApiModelProperty(value = "联合唯一字段方便页面使用(tagName##tagCode)") - private String unionCode; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTypeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTypeVO.java deleted file mode 100644 index 255bf0b..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/model/vo/TagTypeVO.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ningdatech.pmapi.meta.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2022/8/27 下午2:20 - */ -@Data -@ApiModel(description = "标签类型VO") -public class TagTypeVO { - - @ApiModelProperty(value = "标签编码") - private String tagCode; - - @ApiModelProperty(value = "标签名称") - private String tagName; - - @ApiModelProperty(value = "标签级别") - private Long tagLevel; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/DictionaryRequestValidator.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/DictionaryRequestValidator.java new file mode 100644 index 0000000..293cdc2 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/validate/DictionaryRequestValidator.java @@ -0,0 +1,27 @@ +package com.ningdatech.pmapi.meta.validate; + +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; +import com.ningdatech.pmapi.meta.model.po.ReqDictionaryListPO; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/21 下午6:15 + */ + +public class DictionaryRequestValidator { + + public static void dictionaryRequestValidator(ReqDictionaryListPO reqDictionaryListPO) { + List dictionaryTypeList = reqDictionaryListPO.getDictionaryTypeList(); + if (CollectionUtils.isNotEmpty(dictionaryTypeList)) { + for (String dictionaryType : dictionaryTypeList) { + if (!DictExpertInfoTypeEnum.contains(dictionaryType)) { + throw new BizException("Illegal dictionaryType: " + dictionaryType); + } + } + } + } +} From 86fa4ca7d4438b5519012387058c087cca5ced03 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 22 Feb 2023 16:43:53 +0800 Subject: [PATCH 12/16] adjust --- .../ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java index f7847d8..fd71650 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java @@ -23,6 +23,7 @@ import javax.validation.Valid; @Controller @RequestMapping("/api/v1/fiscal-code") @RequiredArgsConstructor +@ApiOperation("印章配置/财政编码配置") public class CompanyFiscalCodeController { private final CompanyFiscalCodeManage companyFiscalCodeManage; From f03c804eddb9c56d901e567a9f5ce213e8a1c2da Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 22 Feb 2023 19:25:10 +0800 Subject: [PATCH 13/16] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TodoCenterController.java | 2 +- .../pmapi/todocenter/manage/TodoCenterManage.java | 952 +++++++++++---------- .../model/dto/req/ReqProcessHandlerDTO.java | 60 -- 3 files changed, 500 insertions(+), 514 deletions(-) delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java index 58a090c..cf31e16 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java @@ -5,8 +5,8 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; -import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO; import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq; +import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; import org.springframework.web.bind.annotation.*; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 2131c7a..c48e2e6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -1,9 +1,7 @@ package com.ningdatech.pmapi.todocenter.manage; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; @@ -25,9 +23,6 @@ import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum; -import com.ningdatech.pmapi.todocenter.extension.cmd.BackToHisApprovalNodeCmd; -import com.ningdatech.pmapi.todocenter.extension.cmd.SaveCommentCmd; -import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO; import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedReq; import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq; import com.ningdatech.pmapi.todocenter.model.dto.vo.ResToBeProcessedVO; @@ -36,34 +31,20 @@ import com.ningdatech.pmapi.user.entity.UserInfo; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.ningdatech.zwdd.client.ZwddClient; -import com.wflow.bean.entity.WflowModels; import com.wflow.contants.HisProInsEndActId; -import com.wflow.exception.BusinessException; -import com.wflow.mapper.WflowCcTasksMapper; -import com.wflow.mapper.WflowModelHistorysMapper; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; -import com.wflow.workflow.bean.process.ProcessComment; +import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.vo.ProcessInstanceVo; import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.bean.vo.ProcessTaskVo; -import com.wflow.workflow.enums.ProcessHandlerEnum; import com.wflow.workflow.enums.ProcessStatusEnum; import com.wflow.workflow.service.*; -import com.wflow.workflow.service.FormService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.assertj.core.util.Lists; -import org.assertj.core.util.Maps; -import org.flowable.bpmn.model.*; import org.flowable.engine.*; -import org.flowable.engine.history.HistoricActivityInstance; import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.engine.runtime.ActivityInstance; -import org.flowable.engine.runtime.Execution; -import org.flowable.engine.task.Comment; -import org.flowable.task.api.Task; -import org.flowable.task.api.history.HistoricTaskInstance; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletResponse; @@ -87,15 +68,7 @@ public class TodoCenterManage { private final TaskService taskService; private final ProcessTaskService processTaskService; - private final RepositoryService repositoryService; - private final RuntimeService runtimeService; - private final FormService formService; - private final ManagementService managementService; private final HistoryService historyService; - private final WflowModelHistorysMapper modelHistorysMapper; - private final ProcessNodeCatchService nodeCatchService; - private final WflowCcTasksMapper ccTasksMapper; - private final ProcessModelService processModelService; private final IUserInfoService userInfoService; private final IProjectService projectService; @@ -209,91 +182,164 @@ public class TodoCenterManage { String processInstanceId = param.getInstanceId(); Long projectId = param.getProjectId(); + // 获取当前申报项目 + Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) + .eq(Project::getInstCode, processInstanceId) + .eq(Project::getId,projectId)); + // 获取当前项目名称 + String projectName = declaredProject.getProjectName(); + // 获取当前项目状态 + Integer projectStatus = declaredProject.getStatus(); + // 获取当前未处理流程详情 + ProcessProgressVo currentInstanceDetail = processInstanceService.getProgressInstanceDetail(null, processInstanceId); + // 获取当前未处理流程状态 + String currentProcessStatus = currentInstanceDetail.getStatus(); + // 获取当前要处理的流程实例 HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(processInstanceId) .singleResult(); // 获取流程发起人信息 String startUserId = instance.getStartUserId(); - ProcessInstanceUserDto startUser = userInfoService.getUserInfo(startUserId); - - // 若进行的是撤回操作(流程发起人和当前流程审核人的前一个审核人操作) - if (param.getAction().equals(ProcessHandlerEnum.WITHDRAW)) { - // 当前登录用户是流程发起人 - if (userId.equals(Long.valueOf(startUser.getUserId()))){ - // processTaskService.handleTask(param, userId); - // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, processInstanceId) - .eq(Project::getId,projectId)); - // 获取当前项目状态 - Integer projectStatus = declaredProject.getStatus(); - // TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录 - // 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 - switch (Objects.requireNonNull(ProjectStatusEnum.getValue(projectStatus))) { - // 当前项目状态是单位内部审核中 - case UNDER_INTERNAL_AUDIT: - // 当前项目状态是预审中 - case PRE_APPLYING: - // 当前项目状态是部门联审中 - case DEPARTMENT_JOINT_REVIEW: - // 当前项目状态是方案评审中 - case SCHEME_UNDER_REVIEW: - // 当前项目状态是终验审核中 - case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - updateWithdrawProjectStatus(userId, declaredProject); - break; - default: - throw new IllegalStateException("Unexpected value: " + projectStatus); - } - }else { - // 当前登录用户不是流程发起人 - ProcessProgressVo progressInstanceDetail = processInstanceService - .getProgressInstanceDetail(null, processInstanceId); - List progressInfo = progressInstanceDetail.getProgressInfo(); - // 获取当前当前工作流任务前一个审核人信息 - ProgressNode beforeProgressNode = progressInfo.get(progressInfo.size() - 2); - ProcessInstanceUserDto beforeUser = beforeProgressNode.getUser(); - // 获取当前当前工作流任务当前审核人信息 - ProgressNode currentProgressNode = progressInfo.get(progressInfo.size() - 1); - ProcessInstanceUserDto currentUser = currentProgressNode.getUser(); - // 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 - - Boolean orgFlag = true; - // processTaskService.handleTask(param, userId); - } - HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery() - .taskId(param.getTaskId()) - .singleResult(); - doWithDrawProcess(handledTaskInstance, userId, projectId); - return; - } - Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); - HashMap formData = new HashMap<>(32); - if (Objects.isNull(task)) { - throw new BizException("任务不存在"); - } + UserInfo startUserInfo = userInfoService.getById(Long.valueOf(startUserId)); + // 获取流程定义名称 + String processDefinitionName = instance.getProcessDefinitionName(); + switch (param.getAction()) { // 通过 case PASS: - formService.updateInstanceFormData(param.getInstanceId(), formData); - doPass(task, userId, param); + // 通过该任务,流程到下一审核人处 + processTaskService.handleTask(param, userId); + // 获取流程通过后的流程实例 + HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(processInstanceId) + .singleResult(); + // 获取流程通过后当前流程详情 + ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, processInstanceId); + // 获取流程通过后当前审核人信息,向其发送工作通知 + List newProgressInfo = newInstanceDetail.getProgressInfo(); + ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1); + UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(currentNode.getUserId())); + + // 如果流程状态是被退回状态,流程通过后,进入下一个审核人, + // 当前通过审核人一定不是最后一个审核人(下一个审核人至多是最后一个),更新流程状态为审核中 + if (ProcessStatusEnum.BE_BACKED.getCode().equals(currentProcessStatus)) { + // 更新流程状态为审核中 + declaredProject.setProcessStatus(ProcessStatusEnum.UNDER_REVIEW.getCode()); + declaredProject.setUpdateOn(LocalDateTime.now()); + declaredProject.setUpdateBy(userId); + projectService.updateById(declaredProject); + // 获取发送浙政钉工作通知必要信息 + WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); + String passMsg = String.format(PASS_MSG_TEMPLATE, null, projectName); + // zwddClient.sendWorkNotice(passWorkNoticeInfo.getReceiverUserId(),passWorkNoticeInfo.getBizMsgId(),passMsg); + return; + } + // 若不是被退回状态,流程通过后,判断当前登录用户是不是最后一个审核人 + + // TODO 若当前流程是预审流程,需要在提交预审申报的时候,调用状态机判断申报后的项目状态, + // 若是省级部门联审中,要对接外部接口,获取省级部门联审的结果,更新项目状态(预审申报提交的时候处理) + + // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 + // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 + if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { + switch (Objects.requireNonNull(ProjectStatusEnum.getValue(projectStatus))) { + // 当前项目状态是单位内部审核中 + case UNDER_INTERNAL_AUDIT: + // 当前项目状态是预审中 + case PRE_APPLYING: + // 当前项目状态是部门联审中 + case DEPARTMENT_JOINT_REVIEW: + // 当前项目状态是方案评审中 + case SCHEME_UNDER_REVIEW: + // 当前项目状态是终验审核中 + case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: + updatePassProjectStatus(userId, declaredProject); + break; + default: + throw new IllegalStateException("Unexpected value: " + projectStatus); + } + WorkNoticeInfo passWorkNoticeInfo2 = getSendWorkNoticeInfo(startUserInfo); + String passMsg2 = String.format(PASS_MSG_TEMPLATE2, projectName, processDefinitionName); + // zwddClient.sendWorkNotice(passWorkNoticeInfo2.getReceiverUserId(),passWorkNoticeInfo2.getBizMsgId(),passMsg2); + }else { + // 若有下一个审核人(当前节点的用户), + // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 + // 获取发送浙政钉工作通知必要信息 + WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); + String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); + // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); + } break; // 盖章并通过 case SEAL_PASS: - formService.updateInstanceFormData(param.getInstanceId(), formData); - doSealPass(task, userId, param); + // 通过该任务,流程到下一审核人处 + processTaskService.handleTask(param, userId); break; // 驳回 case REJECT: - formService.updateInstanceFormData(param.getInstanceId(), formData); - doReject(task, userId, param); + // 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知: + // 【项目名称】的【流程名称】被驳回,请及时处理。 + processTaskService.handleTask(param, userId); + WorkNoticeInfo rejectWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); + String rejectMsg = String.format(REJECT_MSG_TEMPLATE, projectName, processDefinitionName); + zwddClient.sendWorkNotice(rejectWorkNoticeInfo.getReceiverUserId(),rejectWorkNoticeInfo.getBizMsgId(),rejectMsg); + // 更新项目状态和流程状态 + updateRejectProjectStatus(userId, declaredProject); break; // 退回 case BACK: - formService.updateInstanceFormData(param.getInstanceId(), formData); - doBackTask(task, userId, param); + // 退回该任务 + processTaskService.handleTask(param, userId); + // 更新申报项目表中的流程状态为被退回 + declaredProject.setProcessStatus(ProcessStatusEnum.BE_BACKED.getCode()); + declaredProject.setUpdateOn(LocalDateTime.now()); + declaredProject.setUpdateBy(userId); + projectService.updateById(declaredProject); + // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 + WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); + String backMsg = String.format(BACK_MSG_TEMPLATE, projectName, processDefinitionName); + zwddClient.sendWorkNotice(backWorkNoticeInfo.getReceiverUserId(),backWorkNoticeInfo.getBizMsgId(),backMsg); break; + // 撤回(流程发起人和当前流程审核人的前一个审核人操作) + case WITHDRAW: + // 当前登录用户是流程发起人 + if (userId.equals(Long.valueOf(startUserId))){ + processTaskService.handleTask(param, userId); + // 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 + switch (Objects.requireNonNull(ProjectStatusEnum.getValue(projectStatus))) { + // 当前项目状态是单位内部审核中 + case UNDER_INTERNAL_AUDIT: + // 当前项目状态是预审中 + case PRE_APPLYING: + // 当前项目状态是部门联审中 + case DEPARTMENT_JOINT_REVIEW: + // 当前项目状态是方案评审中 + case SCHEME_UNDER_REVIEW: + // 当前项目状态是终验审核中 + case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: + updateWithdrawProjectStatus(userId, declaredProject); + break; + default: + throw new IllegalStateException("Unexpected value: " + projectStatus); + } + }else { + // 当前登录用户不是流程发起人 + List currentProgressInfo = currentInstanceDetail.getProgressInfo(); + // 获取当前工作流任务前一个审核人信息 + ProgressNode beforeProgressNode = currentProgressInfo.get(currentProgressInfo.size() - 2); + ProcessInstanceUserDto beforeUser = beforeProgressNode.getUser(); + // 获取当前当前工作流任务当前审核人信息 + ProgressNode currentProgressNode = currentProgressInfo.get(currentProgressInfo.size() - 1); + ProcessInstanceUserDto currentUser = currentProgressNode.getUser(); + // 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 + boolean orgFlag = currentUser.getOrgCode().equals(beforeUser.getOrgCode()); + if (!orgFlag) { + throw new BizException("下一个审核人和您不是同一个部门,无法撤回!"); + } else { + processTaskService.handleTask(param, userId); + } + } default: throw new IllegalStateException("Unexpected value: " + param.getAction()); } @@ -306,39 +352,39 @@ public class TodoCenterManage { * @param userId * @param param 参数 */ - private void doReject(Task task, Long userId, ReqProcessHandlerDTO param) { - // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, task.getProcessInstanceId()) - .eq(Project::getId,param.getProjectId())); - String projectName = declaredProject.getProjectName(); - - Map var = new HashMap<>(16); - var.put("approve_" + task.getId(), param.getAction()); - // 保存审核意见 - if (hasComment(param.getAuditInfo())) { - // 执行自定义的保存评论的功能 - managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), - String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); - } - // 获取bpm对象 - BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); - // 获取根节点即流程发起节点 - FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); - // TODO 中止流程并使项目进入对应状态,给项目创建人、 - // 流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 - String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); - // 获取浙政钉用户ID - UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); - WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); - WflowModels wflowModels = getLastWflowModels(task); - String formName = wflowModels.getFormName(); - String msg = String.format(REJECT_MSG_TEMPLATE, projectName, formName); - zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); - // 更新项目状态和流程状态 - updateRejectProjectStatus(userId, declaredProject); - taskService.complete(param.getTaskId(), var); - } + //private void doReject(Task task, Long userId, ReqProcessHandlerDTO param) { + // // 获取当前申报项目 + // Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) + // .eq(Project::getInstCode, task.getProcessInstanceId()) + // .eq(Project::getId,param.getProjectId())); + // String projectName = declaredProject.getProjectName(); + // + // Map var = new HashMap<>(16); + // var.put("approve_" + task.getId(), param.getAction()); + // // 保存审核意见 + // if (hasComment(param.getAuditInfo())) { + // // 执行自定义的保存评论的功能 + // managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), + // String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); + // } + // // 获取bpm对象 + // BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); + // // 获取根节点即流程发起节点 + // FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); + // // TODO 中止流程并使项目进入对应状态,给项目创建人、 + // // 流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 + // String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); + // // 获取浙政钉用户ID + // UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); + // WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); + // WflowModels wflowModels = getLastWflowModels(task); + // String formName = wflowModels.getFormName(); + // String msg = String.format(REJECT_MSG_TEMPLATE, projectName, formName); + // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); + // // 更新项目状态和流程状态 + // updateRejectProjectStatus(userId, declaredProject); + // taskService.complete(param.getTaskId(), var); + //} /** * 当为驳回操作时,更新项目表中的项目状态 @@ -376,15 +422,15 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/01 17:30 */ - private WflowModels getLastWflowModels(Task task) { - WflowModels wflowModels = processModelService.getOne( - Wrappers.lambdaQuery(WflowModels.class).eq(WflowModels::getProcessDefId, task.getProcessDefinitionId())); - if (ObjectUtil.isNull(wflowModels)) { - log.warn("流程{}不存在", wflowModels.getFormId()); - throw new BusinessException("不存在该表单"); - } - return wflowModels; - } + //private WflowModels getLastWflowModels(Task task) { + // WflowModels wflowModels = processModelService.getOne( + // Wrappers.lambdaQuery(WflowModels.class).eq(WflowModels::getProcessDefId, task.getProcessDefinitionId())); + // if (ObjectUtil.isNull(wflowModels)) { + // log.warn("流程{}不存在", wflowModels.getFormId()); + // throw new BusinessException("不存在该表单"); + // } + // return wflowModels; + //} /** * 审批任务:盖章并通过 @@ -393,26 +439,26 @@ public class TodoCenterManage { * @param userId * @param param 参数 */ - private void doSealPass(Task task, Long userId, ReqProcessHandlerDTO param) { - String processInstanceId = task.getProcessInstanceId(); - // 获取当前申报项目 - Project declaredProject = projectService - .getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); - String projectName = declaredProject.getProjectName(); - - Map var = new HashMap<>(16); - var.put("approve_" + task.getId(), param.getAction()); - // 保存审核意见 - if (hasComment(param.getAuditInfo())) { - // 执行自定义的保存评论的功能 - managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), - String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); - } - // TODO 判断项目申报单位级别,区县单位申报有上级主管单位意见栏,市级单位没有 - - // TODO 市级单位:为大数据局;区县单位:为大数据中心(根据附件区分?) - taskService.complete(param.getTaskId(), var); - } + //private void doSealPass(Task task, Long userId, ReqProcessHandlerDTO param) { + // String processInstanceId = task.getProcessInstanceId(); + // // 获取当前申报项目 + // Project declaredProject = projectService + // .getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); + // String projectName = declaredProject.getProjectName(); + // + // Map var = new HashMap<>(16); + // var.put("approve_" + task.getId(), param.getAction()); + // // 保存审核意见 + // if (hasComment(param.getAuditInfo())) { + // // 执行自定义的保存评论的功能 + // managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), + // String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); + // } + // // TODO 判断项目申报单位级别,区县单位申报有上级主管单位意见栏,市级单位没有 + // + // // TODO 市级单位:为大数据局;区县单位:为大数据中心(根据附件区分?) + // taskService.complete(param.getTaskId(), var); + //} /** * 审批任务:通过 @@ -420,100 +466,100 @@ public class TodoCenterManage { * @param userId * @param param 参数 */ - private void doPass(Task task, Long userId, ReqProcessHandlerDTO param) { - String processInstanceId = task.getProcessInstanceId(); - // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, task.getProcessInstanceId()) - .eq(Project::getId,param.getProjectId())); - String projectName = declaredProject.getProjectName(); - - Map var = new HashMap<>(16); - var.put("approve_" + task.getId(), param.getAction()); - // 保存审核意见 - if (hasComment(param.getAuditInfo())) { - // 执行自定义的保存评论的功能 - managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), - String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); - } - // 如果流程状态是被退回状态,流程通过后,进入下一个审核人,当前通过审核人一定不是最后一个审核人(下一个审核人至多是最后一个),更新流程状态为审核中 - if (ProcessStatusEnum.BE_BACKED.getCode().equals(declaredProject.getProcessStatus())) { - // 通过该任务,流程到下一审核人处 - taskService.complete(param.getTaskId(), var); - // 更新流程状态为审核中 - declaredProject.setProcessStatus(ProcessStatusEnum.UNDER_REVIEW.getCode()); - declaredProject.setUpdateOn(LocalDateTime.now()); - declaredProject.setUpdateBy(userId); - projectService.updateById(declaredProject); - // 获取此时待审核任务 - Task currentTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); - // 获取审核人信息,向审核人发送工作通知 - String currentUserId = currentTask.getAssignee(); - UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(currentUserId)); - // 获取发送浙政钉工作通知必要信息 - WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); - String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); - zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); - return; - } - // 获取bpm对象 - BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); - // 若不是被退回项目,传节点定义key 获取当前节点 - FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); - // TODO 若当前流程是预审流程,需要在提交预审申报的时候,调用状态机判断申报后的项目状态, - // 若是省级部门联审中,要对接外部接口,获取省级部门联审的结果,更新项目状态(预审申报提交的时候处理) - // 需要先通过后才能有下一个节点的信息 - taskService.complete(param.getTaskId(), var); - // 获取当前项目状态 - Integer status = declaredProject.getStatus(); - // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 - // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 - HistoricProcessInstance instance = historyService - .createHistoricProcessInstanceQuery() - .processInstanceId(processInstanceId) - .singleResult(); - if (HisProInsEndActId.END.equals(instance.getEndActivityId())) { - switch (Objects.requireNonNull(ProjectStatusEnum.getValue(status))) { - // 当前项目状态是单位内部审核中 - case UNDER_INTERNAL_AUDIT: - // 当前项目状态是预审中 - case PRE_APPLYING: - // 当前项目状态是部门联审中 - case DEPARTMENT_JOINT_REVIEW: - // 当前项目状态是方案评审中 - case SCHEME_UNDER_REVIEW: - // 当前项目状态是终验审核中 - case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - updatePassProjectStatus(userId, declaredProject); - break; - default: - throw new IllegalStateException("Unexpected value: " + status); - } - } - // 若有下一个审核人(当前节点的用户), - // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 - String nextUserId = getNextUserId(currentNode, processInstanceId); - if (Objects.nonNull(nextUserId)) { - // 获取浙政钉用户ID - UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); - WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); - String msg = String.format(PASS_MSG_TEMPLATE, sendWorkNoticeInfo.getOrganizationName(), projectName); - zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); - } else { - // 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 - // TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知 - // 获取根节点即流程发起节点 - FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); - String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); - // 获取浙政钉用户ID - UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); - WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); - WflowModels wflowModels = getLastWflowModels(task); - String formName = wflowModels.getFormName(); - String msg = String.format(PASS_MSG_TEMPLATE2, projectName, formName); - zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); - } - } + //private void doPass(Task task, Long userId, ReqProcessHandlerDTO param) { + // String processInstanceId = task.getProcessInstanceId(); + // // 获取当前申报项目 + // Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) + // .eq(Project::getInstCode, task.getProcessInstanceId()) + // .eq(Project::getId,param.getProjectId())); + // String projectName = declaredProject.getProjectName(); + // + // Map var = new HashMap<>(16); + // var.put("approve_" + task.getId(), param.getAction()); + // // 保存审核意见 + // if (hasComment(param.getAuditInfo())) { + // // 执行自定义的保存评论的功能 + // managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), + // String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); + // } + // // 如果流程状态是被退回状态,流程通过后,进入下一个审核人,当前通过审核人一定不是最后一个审核人(下一个审核人至多是最后一个),更新流程状态为审核中 + // if (ProcessStatusEnum.BE_BACKED.getCode().equals(declaredProject.getProcessStatus())) { + // // 通过该任务,流程到下一审核人处 + // taskService.complete(param.getTaskId(), var); + // // 更新流程状态为审核中 + // declaredProject.setProcessStatus(ProcessStatusEnum.UNDER_REVIEW.getCode()); + // declaredProject.setUpdateOn(LocalDateTime.now()); + // declaredProject.setUpdateBy(userId); + // projectService.updateById(declaredProject); + // // 获取此时待审核任务 + // Task currentTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); + // // 获取审核人信息,向审核人发送工作通知 + // String currentUserId = currentTask.getAssignee(); + // UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(currentUserId)); + // // 获取发送浙政钉工作通知必要信息 + // WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); + // String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); + // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); + // return; + // } + // // 获取bpm对象 + // BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); + // // 若不是被退回项目,传节点定义key 获取当前节点 + // FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); + // // TODO 若当前流程是预审流程,需要在提交预审申报的时候,调用状态机判断申报后的项目状态, + // // 若是省级部门联审中,要对接外部接口,获取省级部门联审的结果,更新项目状态(预审申报提交的时候处理) + // // 需要先通过后才能有下一个节点的信息 + // taskService.complete(param.getTaskId(), var); + // // 获取当前项目状态 + // Integer status = declaredProject.getStatus(); + // // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 + // // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 + // HistoricProcessInstance instance = historyService + // .createHistoricProcessInstanceQuery() + // .processInstanceId(processInstanceId) + // .singleResult(); + // if (HisProInsEndActId.END.equals(instance.getEndActivityId())) { + // switch (Objects.requireNonNull(ProjectStatusEnum.getValue(status))) { + // // 当前项目状态是单位内部审核中 + // case UNDER_INTERNAL_AUDIT: + // // 当前项目状态是预审中 + // case PRE_APPLYING: + // // 当前项目状态是部门联审中 + // case DEPARTMENT_JOINT_REVIEW: + // // 当前项目状态是方案评审中 + // case SCHEME_UNDER_REVIEW: + // // 当前项目状态是终验审核中 + // case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: + // updatePassProjectStatus(userId, declaredProject); + // break; + // default: + // throw new IllegalStateException("Unexpected value: " + status); + // } + // } + // // 若有下一个审核人(当前节点的用户), + // // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 + // String nextUserId = getNextUserId(currentNode, processInstanceId); + // if (Objects.nonNull(nextUserId)) { + // // 获取浙政钉用户ID + // UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); + // WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); + // String msg = String.format(PASS_MSG_TEMPLATE, sendWorkNoticeInfo.getOrganizationName(), projectName); + // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); + // } else { + // // 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 + // // TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知 + // // 获取根节点即流程发起节点 + // FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); + // String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); + // // 获取浙政钉用户ID + // UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); + // WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); + // WflowModels wflowModels = getLastWflowModels(task); + // String formName = wflowModels.getFormName(); + // String msg = String.format(PASS_MSG_TEMPLATE2, projectName, formName); + // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); + // } + //} /** * 获取发送浙政钉工作通知的信息 @@ -583,28 +629,28 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/02 */ - private String getRootUserId(FlowNode rootNode, String processInstanceId) { - String rootUserId = null; - // 输出连线 - List outgoingFlows = rootNode.getOutgoingFlows(); - // 遍历返回下一个节点信息 - for (SequenceFlow currentOutgoingFlow : outgoingFlows) { - // 类型自己判断 - FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); - // TODO 若要会签需判断候选人 - // 发起事件 - if (targetFlowElement instanceof StartEvent) { - String actId = targetFlowElement.getId(); - ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() - .processInstanceId(processInstanceId).activityId(actId).singleResult(); - String executionId = activityInstance.getExecutionId(); - rootUserId = runtimeService.getVariable(executionId, "initiator", String.class); - break; - } - } - return rootUserId; - - } + //private String getRootUserId(FlowNode rootNode, String processInstanceId) { + // String rootUserId = null; + // // 输出连线 + // List outgoingFlows = rootNode.getOutgoingFlows(); + // // 遍历返回下一个节点信息 + // for (SequenceFlow currentOutgoingFlow : outgoingFlows) { + // // 类型自己判断 + // FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); + // // TODO 若要会签需判断候选人 + // // 发起事件 + // if (targetFlowElement instanceof StartEvent) { + // String actId = targetFlowElement.getId(); + // ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() + // .processInstanceId(processInstanceId).activityId(actId).singleResult(); + // String executionId = activityInstance.getExecutionId(); + // rootUserId = runtimeService.getVariable(executionId, "initiator", String.class); + // break; + // } + // } + // return rootUserId; + // + //} /** * 获取当前节点的下一个节点的审核用户ID * @@ -614,31 +660,31 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/02 */ - private String getNextUserId(FlowNode currentNode, String processInstanceId) { - String nextUserId = null; - // 输出连线 - List outgoingFlows = currentNode.getOutgoingFlows(); - // 遍历返回下一个节点信息 - for (SequenceFlow currentOutgoingFlow : outgoingFlows) { - // 类型自己判断 - FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); - // 如果下个审批节点为结束节点,那么跳过该节点 - if (targetFlowElement instanceof EndEvent) { - continue; - } - // TODO 若要会签需判断候选人 - // 用户任务 - if (targetFlowElement instanceof UserTask) { - String actId = targetFlowElement.getId(); - ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() - .processInstanceId(processInstanceId).activityId(actId).singleResult(); - String executionId = activityInstance.getExecutionId(); - nextUserId = runtimeService.getVariable(executionId, "assignee", String.class); - break; - } - } - return nextUserId; - } + //private String getNextUserId(FlowNode currentNode, String processInstanceId) { + // String nextUserId = null; + // // 输出连线 + // List outgoingFlows = currentNode.getOutgoingFlows(); + // // 遍历返回下一个节点信息 + // for (SequenceFlow currentOutgoingFlow : outgoingFlows) { + // // 类型自己判断 + // FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); + // // 如果下个审批节点为结束节点,那么跳过该节点 + // if (targetFlowElement instanceof EndEvent) { + // continue; + // } + // // TODO 若要会签需判断候选人 + // // 用户任务 + // if (targetFlowElement instanceof UserTask) { + // String actId = targetFlowElement.getId(); + // ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() + // .processInstanceId(processInstanceId).activityId(actId).singleResult(); + // String executionId = activityInstance.getExecutionId(); + // nextUserId = runtimeService.getVariable(executionId, "assignee", String.class); + // break; + // } + // } + // return nextUserId; + //} /** * 判断处理操作是否含有审核意见 @@ -648,10 +694,10 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/01 */ - private boolean hasComment(ProcessComment comment) { - return Objects.nonNull(comment) - && (StrUtil.isNotBlank(comment.getText()) || isNotEmpty(comment.getAttachments())); - } + //private boolean hasComment(ProcessComment comment) { + // return Objects.nonNull(comment) + // && (StrUtil.isNotBlank(comment.getText()) || isNotEmpty(comment.getAttachments())); + //} /** * 撤销流程处理 @@ -660,117 +706,117 @@ public class TodoCenterManage { * @param userId 当前登录用户ID * @param projectId */ - private void doWithDrawProcess(HistoricTaskInstance handledTaskInstance, Long userId, Long projectId) { - String processInstanceId = handledTaskInstance.getProcessInstanceId(); - // 获取当前流程实例待审核任务信息 - Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); - // 获取当前流程实例信息 - HistoricProcessInstance historicProcessInstance = historyService - .createHistoricProcessInstanceQuery() - .processInstanceId(processInstanceId) - .singleResult(); - // 流程发起人ID - String startUserId = historicProcessInstance.getStartUserId(); - // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, processInstanceId) - .eq(Project::getId,projectId)); - String projectName = declaredProject.getProjectName(); - - // 获取bpm对象 - BpmnModel bpmnModel = repositoryService.getBpmnModel(handledTaskInstance.getProcessDefinitionId()); - // 传节点定义key 获取传入节点(撤回操作人在流程配置中所在的节点) - FlowNode handledNode = (FlowNode) bpmnModel.getFlowElement(handledTaskInstance.getTaskDefinitionKey()); - - // 获取当前流程状态 - Integer status = declaredProject.getStatus(); - - // 判断当前登录用户是否是流程发起人 - if (startUserId.equals(String.valueOf(userId))) { - // TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录 - // 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 - switch (Objects.requireNonNull(ProjectStatusEnum.getValue(status))) { - // 当前项目状态是单位内部审核中 - case UNDER_INTERNAL_AUDIT: - // 当前项目状态是预审中 - case PRE_APPLYING: - // 当前项目状态是部门联审中 - case DEPARTMENT_JOINT_REVIEW: - // 当前项目状态是方案评审中 - case SCHEME_UNDER_REVIEW: - // 当前项目状态是终验审核中 - case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - updateWithdrawProjectStatus(userId, declaredProject); - break; - default: - throw new IllegalStateException("Unexpected value: " + status); - } - List executions = runtimeService.createExecutionQuery() - .processInstanceId(handledTaskInstance.getProcessInstanceId()).onlyChildExecutions().list(); - // 强制流程指向撤回 - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(task.getProcessInstanceId()) - .moveActivityIdTo(task.getTaskDefinitionKey(), HisProInsEndActId.WITHDRAW) - .moveExecutionsToSingleActivityId(executions.stream() - .map(Execution::getId) - .collect(Collectors.toList()), HisProInsEndActId.WITHDRAW) - .changeState(); - } else { - // 获取当前流程待审核节点 - FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); - SequenceFlow sequenceFlow = currentNode.getIncomingFlows().get(0); - // 获取上一个节点的activityId - String sourceRef = sequenceFlow.getSourceRef(); - - HistoricActivityInstance lastInstance = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(task.getProcessInstanceId()) - .activityId(sourceRef) - .activityType("userTask") - .finished() - .singleResult(); - // 获取前一个审核节点审核人信息 - String beforeUserId = lastInstance.getAssignee(); - // 获取当前审核节点审核人信息 - String currentUserId = task.getAssignee(); - //HashSet userSet = new HashSet<>(); - //userSet.add(beforeUserId); - //userSet.add(currentUserId); - //Map userMap = userInfoService.getUserMapByIds(userSet); - //UserInfoVO beforeUserInfoVO = userMap.get(Long.valueOf(beforeUserId)); - //UserInfoVO currentUserInfoVO = userMap.get(Long.valueOf(currentUserId)); - //String beforeUserOrgCode = beforeUserInfoVO.getOrganizationCode(); - //String currentUserOrgCode = currentUserInfoVO.getOrganizationCode(); - //Boolean orgFlag = currentUserOrgCode.equals(beforeUserOrgCode) ? true : false; - - // TODO 判断前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 - Boolean orgFlag = true; - if (orgFlag) { - // 注意:是前一个审核人,说明此时仍在一个审核流程中,项目状态不需要改变,流程状态也不要改变,仍为审核中 - // 在审核记录中移除前一个审核人提交过的审核意见 - Comment comment = taskService.getProcessInstanceComments(processInstanceId).stream() - .filter(c -> c.getTaskId().equals(handledTaskInstance.getId())) - .findFirst() - .get(); - taskService.deleteComment(comment.getId()); - // 我已处理中去掉自己之前处理的记录 - String taskInstanceId = handledTaskInstance.getId(); - historyService.deleteHistoricTaskInstance(taskInstanceId); - - List executions = runtimeService.createExecutionQuery() - .processInstanceId(handledTaskInstance.getProcessInstanceId()).onlyChildExecutions().list(); - // 强制流程指向前一个审核人节点 - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(task.getProcessInstanceId()) - .moveActivityIdsToSingleActivityId(executions.stream() - .map(Execution::getActivityId) - .collect(Collectors.toList()), handledNode.getId()) - .changeState(); - } else { - throw new BizException("下一个审核人和您不是同一个部门,无法撤回!"); - } - - } - } + //private void doWithDrawProcess(HistoricTaskInstance handledTaskInstance, Long userId, Long projectId) { + // String processInstanceId = handledTaskInstance.getProcessInstanceId(); + // // 获取当前流程实例待审核任务信息 + // Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); + // // 获取当前流程实例信息 + // HistoricProcessInstance historicProcessInstance = historyService + // .createHistoricProcessInstanceQuery() + // .processInstanceId(processInstanceId) + // .singleResult(); + // // 流程发起人ID + // String startUserId = historicProcessInstance.getStartUserId(); + // // 获取当前申报项目 + // Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) + // .eq(Project::getInstCode, processInstanceId) + // .eq(Project::getId,projectId)); + // String projectName = declaredProject.getProjectName(); + // + // // 获取bpm对象 + // BpmnModel bpmnModel = repositoryService.getBpmnModel(handledTaskInstance.getProcessDefinitionId()); + // // 传节点定义key 获取传入节点(撤回操作人在流程配置中所在的节点) + // FlowNode handledNode = (FlowNode) bpmnModel.getFlowElement(handledTaskInstance.getTaskDefinitionKey()); + // + // // 获取当前流程状态 + // Integer status = declaredProject.getStatus(); + // + // // 判断当前登录用户是否是流程发起人 + // if (startUserId.equals(String.valueOf(userId))) { + // // TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录 + // // 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 + // switch (Objects.requireNonNull(ProjectStatusEnum.getValue(status))) { + // // 当前项目状态是单位内部审核中 + // case UNDER_INTERNAL_AUDIT: + // // 当前项目状态是预审中 + // case PRE_APPLYING: + // // 当前项目状态是部门联审中 + // case DEPARTMENT_JOINT_REVIEW: + // // 当前项目状态是方案评审中 + // case SCHEME_UNDER_REVIEW: + // // 当前项目状态是终验审核中 + // case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: + // updateWithdrawProjectStatus(userId, declaredProject); + // break; + // default: + // throw new IllegalStateException("Unexpected value: " + status); + // } + // List executions = runtimeService.createExecutionQuery() + // .processInstanceId(handledTaskInstance.getProcessInstanceId()).onlyChildExecutions().list(); + // // 强制流程指向撤回 + // runtimeService.createChangeActivityStateBuilder() + // .processInstanceId(task.getProcessInstanceId()) + // .moveActivityIdTo(task.getTaskDefinitionKey(), HisProInsEndActId.WITHDRAW) + // .moveExecutionsToSingleActivityId(executions.stream() + // .map(Execution::getId) + // .collect(Collectors.toList()), HisProInsEndActId.WITHDRAW) + // .changeState(); + // } else { + // // 获取当前流程待审核节点 + // FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); + // SequenceFlow sequenceFlow = currentNode.getIncomingFlows().get(0); + // // 获取上一个节点的activityId + // String sourceRef = sequenceFlow.getSourceRef(); + // + // HistoricActivityInstance lastInstance = historyService.createHistoricActivityInstanceQuery() + // .processInstanceId(task.getProcessInstanceId()) + // .activityId(sourceRef) + // .activityType("userTask") + // .finished() + // .singleResult(); + // // 获取前一个审核节点审核人信息 + // String beforeUserId = lastInstance.getAssignee(); + // // 获取当前审核节点审核人信息 + // String currentUserId = task.getAssignee(); + // //HashSet userSet = new HashSet<>(); + // //userSet.add(beforeUserId); + // //userSet.add(currentUserId); + // //Map userMap = userInfoService.getUserMapByIds(userSet); + // //UserInfoVO beforeUserInfoVO = userMap.get(Long.valueOf(beforeUserId)); + // //UserInfoVO currentUserInfoVO = userMap.get(Long.valueOf(currentUserId)); + // //String beforeUserOrgCode = beforeUserInfoVO.getOrganizationCode(); + // //String currentUserOrgCode = currentUserInfoVO.getOrganizationCode(); + // //Boolean orgFlag = currentUserOrgCode.equals(beforeUserOrgCode) ? true : false; + // + // // TODO 判断前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 + // Boolean orgFlag = true; + // if (orgFlag) { + // // 注意:是前一个审核人,说明此时仍在一个审核流程中,项目状态不需要改变,流程状态也不要改变,仍为审核中 + // // 在审核记录中移除前一个审核人提交过的审核意见 + // Comment comment = taskService.getProcessInstanceComments(processInstanceId).stream() + // .filter(c -> c.getTaskId().equals(handledTaskInstance.getId())) + // .findFirst() + // .get(); + // taskService.deleteComment(comment.getId()); + // // 我已处理中去掉自己之前处理的记录 + // String taskInstanceId = handledTaskInstance.getId(); + // historyService.deleteHistoricTaskInstance(taskInstanceId); + // + // List executions = runtimeService.createExecutionQuery() + // .processInstanceId(handledTaskInstance.getProcessInstanceId()).onlyChildExecutions().list(); + // // 强制流程指向前一个审核人节点 + // runtimeService.createChangeActivityStateBuilder() + // .processInstanceId(task.getProcessInstanceId()) + // .moveActivityIdsToSingleActivityId(executions.stream() + // .map(Execution::getActivityId) + // .collect(Collectors.toList()), handledNode.getId()) + // .changeState(); + // } else { + // throw new BizException("下一个审核人和您不是同一个部门,无法撤回!"); + // } + // + // } + //} /** * 当为撤回操作时,更新项目表中的项目状态为前一个状态 * @@ -806,47 +852,47 @@ public class TodoCenterManage { * @param userId 当前登录用户ID * @param param 参数 */ - private void doBackTask(Task task, Long userId, ReqProcessHandlerDTO param) { - // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, task.getProcessInstanceId()) - .eq(Project::getId,param.getProjectId())); - String projectName = declaredProject.getProjectName(); - // 保存审核意见 - if (hasComment(param.getAuditInfo())) { - // 执行自定义的保存评论的功能 - managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), - String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); - } - // 获取bpm对象 - BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); - // 传节点定义key 获取根节点即流程发起节点 - FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); - - // 流程变成【被退回】状态,待我处理中,为流程发起人增加一条待办记录, - // 执行自定义回退逻辑,回退到流程发起人 - // 注意:因为审核人有执行退回的权限,且是退回到流程发起人,说明是在同一个流程实例中,所以项目状态不需要更新 - managementService.executeCommand(new BackToHisApprovalNodeCmd(runtimeService, bpmnModel, param.getTaskId(), rootNode.getId())); - runtimeService.setVariables(param.getInstanceId(), - Maps.newHashMap("approve_" + param.getTaskId(), param.getAction())); - log.info("用户[{}] 退回流程[{}] [{} -> {}]", userId, param.getInstanceId(), - task.getTaskDefinitionKey(), - param.getTargetNode()); - // 更新申报项目表中的流程状态为被退回 - declaredProject.setProcessStatus(ProcessStatusEnum.BE_BACKED.getCode()); - declaredProject.setUpdateOn(LocalDateTime.now()); - declaredProject.setUpdateBy(userId); - projectService.updateById(declaredProject); - // TODO 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 - String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); - UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); - WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); - WflowModels wflowModels = getLastWflowModels(task); - String formName = wflowModels.getFormName(); - String msg = String.format(BACK_MSG_TEMPLATE, projectName, formName); - zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); - - } + //private void doBackTask(Task task, Long userId, ReqProcessHandlerDTO param) { + // // 获取当前申报项目 + // Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) + // .eq(Project::getInstCode, task.getProcessInstanceId()) + // .eq(Project::getId,param.getProjectId())); + // String projectName = declaredProject.getProjectName(); + // // 保存审核意见 + // if (hasComment(param.getAuditInfo())) { + // // 执行自定义的保存评论的功能 + // managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), + // String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); + // } + // // 获取bpm对象 + // BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); + // // 传节点定义key 获取根节点即流程发起节点 + // FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); + // + // // 流程变成【被退回】状态,待我处理中,为流程发起人增加一条待办记录, + // // 执行自定义回退逻辑,回退到流程发起人 + // // 注意:因为审核人有执行退回的权限,且是退回到流程发起人,说明是在同一个流程实例中,所以项目状态不需要更新 + // managementService.executeCommand(new BackToHisApprovalNodeCmd(runtimeService, bpmnModel, param.getTaskId(), rootNode.getId())); + // runtimeService.setVariables(param.getInstanceId(), + // Maps.newHashMap("approve_" + param.getTaskId(), param.getAction())); + // log.info("用户[{}] 退回流程[{}] [{} -> {}]", userId, param.getInstanceId(), + // task.getTaskDefinitionKey(), + // param.getTargetNode()); + // // 更新申报项目表中的流程状态为被退回 + // declaredProject.setProcessStatus(ProcessStatusEnum.BE_BACKED.getCode()); + // declaredProject.setUpdateOn(LocalDateTime.now()); + // declaredProject.setUpdateBy(userId); + // projectService.updateById(declaredProject); + // // TODO 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 + // String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); + // UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); + // WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); + // WflowModels wflowModels = getLastWflowModels(task); + // String formName = wflowModels.getFormName(); + // String msg = String.format(BACK_MSG_TEMPLATE, projectName, formName); + // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); + // + //} /** * 查询流程表单数据及审批的进度步骤 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java deleted file mode 100644 index 0a9c98d..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ningdatech.pmapi.todocenter.model.dto.req; - -import com.wflow.workflow.bean.process.ProcessComment; -import com.wflow.workflow.enums.ProcessHandlerEnum; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.validation.constraints.NotNull; - -/** - * 流程处理操作参数实体 - * - * @author CMM - * @since 2023/01/30 09:09 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ReqProcessHandlerDTO { - - /** - * 要处理的项目ID - */ - @NotNull(message = "要处理的项目ID不能为空!") - private Long projectId; - - /** - * 实例ID - */ - @NotNull(message = "流程实例ID不能为空!") - private String instanceId; - /** - * 任务ID - */ - @NotNull(message = "任务ID不能为空!") - private String taskId; - /** - * 签名图片地址 - */ - private String signature; - /** - * 操作类型 - */ - @NotNull(message = "操作类型不能为空!") - private ProcessHandlerEnum action; - /** - * 目标用户 - */ - private String targetUser; - /** - * 目标节点 - */ - private String targetNode; - - /** - * 审核信息 - */ - private ProcessComment auditInfo; -} From a208a3bed12248f0d7258752a2759f104d061e54 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 23 Feb 2023 09:13:56 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/todocenter/manage/TodoCenterManage.java | 470 +++------------------ 1 file changed, 53 insertions(+), 417 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index c48e2e6..46fd699 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -43,8 +43,10 @@ import com.wflow.workflow.service.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.assertj.core.util.Lists; +import org.flowable.bpmn.model.*; import org.flowable.engine.*; import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.engine.runtime.ActivityInstance; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletResponse; @@ -55,6 +57,7 @@ import java.util.stream.Collectors; import static cn.hutool.core.collection.CollUtil.isEmpty; import static cn.hutool.core.collection.CollUtil.isNotEmpty; import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.*; +import static com.wflow.workflow.task.TriggerServiceTask.runtimeService; /** * @author ZPF @@ -65,8 +68,6 @@ import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.*; @Slf4j public class TodoCenterManage { - private final TaskService taskService; - private final ProcessTaskService processTaskService; private final HistoryService historyService; private final IUserInfoService userInfoService; @@ -283,7 +284,7 @@ public class TodoCenterManage { processTaskService.handleTask(param, userId); WorkNoticeInfo rejectWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); String rejectMsg = String.format(REJECT_MSG_TEMPLATE, projectName, processDefinitionName); - zwddClient.sendWorkNotice(rejectWorkNoticeInfo.getReceiverUserId(),rejectWorkNoticeInfo.getBizMsgId(),rejectMsg); + // zwddClient.sendWorkNotice(rejectWorkNoticeInfo.getReceiverUserId(),rejectWorkNoticeInfo.getBizMsgId(),rejectMsg); // 更新项目状态和流程状态 updateRejectProjectStatus(userId, declaredProject); break; @@ -299,7 +300,7 @@ public class TodoCenterManage { // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); String backMsg = String.format(BACK_MSG_TEMPLATE, projectName, processDefinitionName); - zwddClient.sendWorkNotice(backWorkNoticeInfo.getReceiverUserId(),backWorkNoticeInfo.getBizMsgId(),backMsg); + // zwddClient.sendWorkNotice(backWorkNoticeInfo.getReceiverUserId(),backWorkNoticeInfo.getBizMsgId(),backMsg); break; // 撤回(流程发起人和当前流程审核人的前一个审核人操作) case WITHDRAW: @@ -340,51 +341,12 @@ public class TodoCenterManage { processTaskService.handleTask(param, userId); } } + break; default: throw new IllegalStateException("Unexpected value: " + param.getAction()); } } - /** - * 审批任务:驳回 - * - * @param task 当前任务 - * @param userId - * @param param 参数 - */ - //private void doReject(Task task, Long userId, ReqProcessHandlerDTO param) { - // // 获取当前申报项目 - // Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - // .eq(Project::getInstCode, task.getProcessInstanceId()) - // .eq(Project::getId,param.getProjectId())); - // String projectName = declaredProject.getProjectName(); - // - // Map var = new HashMap<>(16); - // var.put("approve_" + task.getId(), param.getAction()); - // // 保存审核意见 - // if (hasComment(param.getAuditInfo())) { - // // 执行自定义的保存评论的功能 - // managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), - // String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); - // } - // // 获取bpm对象 - // BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); - // // 获取根节点即流程发起节点 - // FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); - // // TODO 中止流程并使项目进入对应状态,给项目创建人、 - // // 流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 - // String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); - // // 获取浙政钉用户ID - // UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); - // WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); - // WflowModels wflowModels = getLastWflowModels(task); - // String formName = wflowModels.getFormName(); - // String msg = String.format(REJECT_MSG_TEMPLATE, projectName, formName); - // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); - // // 更新项目状态和流程状态 - // updateRejectProjectStatus(userId, declaredProject); - // taskService.complete(param.getTaskId(), var); - //} /** * 当为驳回操作时,更新项目表中的项目状态 @@ -414,152 +376,6 @@ public class TodoCenterManage { projectService.updateById(declaredProject); } - /** - * 获取最新版本的流程配置 - * - * @param task 当前任务 - * @return com.wflow.bean.entity.WflowModels - * @author CMM - * @since 2023/02/01 17:30 - */ - //private WflowModels getLastWflowModels(Task task) { - // WflowModels wflowModels = processModelService.getOne( - // Wrappers.lambdaQuery(WflowModels.class).eq(WflowModels::getProcessDefId, task.getProcessDefinitionId())); - // if (ObjectUtil.isNull(wflowModels)) { - // log.warn("流程{}不存在", wflowModels.getFormId()); - // throw new BusinessException("不存在该表单"); - // } - // return wflowModels; - //} - - /** - * 审批任务:盖章并通过 - * - * @param task 当前任务 - * @param userId - * @param param 参数 - */ - //private void doSealPass(Task task, Long userId, ReqProcessHandlerDTO param) { - // String processInstanceId = task.getProcessInstanceId(); - // // 获取当前申报项目 - // Project declaredProject = projectService - // .getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); - // String projectName = declaredProject.getProjectName(); - // - // Map var = new HashMap<>(16); - // var.put("approve_" + task.getId(), param.getAction()); - // // 保存审核意见 - // if (hasComment(param.getAuditInfo())) { - // // 执行自定义的保存评论的功能 - // managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), - // String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); - // } - // // TODO 判断项目申报单位级别,区县单位申报有上级主管单位意见栏,市级单位没有 - // - // // TODO 市级单位:为大数据局;区县单位:为大数据中心(根据附件区分?) - // taskService.complete(param.getTaskId(), var); - //} - - /** - * 审批任务:通过 - * @param task 当前任务 - * @param userId - * @param param 参数 - */ - //private void doPass(Task task, Long userId, ReqProcessHandlerDTO param) { - // String processInstanceId = task.getProcessInstanceId(); - // // 获取当前申报项目 - // Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - // .eq(Project::getInstCode, task.getProcessInstanceId()) - // .eq(Project::getId,param.getProjectId())); - // String projectName = declaredProject.getProjectName(); - // - // Map var = new HashMap<>(16); - // var.put("approve_" + task.getId(), param.getAction()); - // // 保存审核意见 - // if (hasComment(param.getAuditInfo())) { - // // 执行自定义的保存评论的功能 - // managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), - // String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); - // } - // // 如果流程状态是被退回状态,流程通过后,进入下一个审核人,当前通过审核人一定不是最后一个审核人(下一个审核人至多是最后一个),更新流程状态为审核中 - // if (ProcessStatusEnum.BE_BACKED.getCode().equals(declaredProject.getProcessStatus())) { - // // 通过该任务,流程到下一审核人处 - // taskService.complete(param.getTaskId(), var); - // // 更新流程状态为审核中 - // declaredProject.setProcessStatus(ProcessStatusEnum.UNDER_REVIEW.getCode()); - // declaredProject.setUpdateOn(LocalDateTime.now()); - // declaredProject.setUpdateBy(userId); - // projectService.updateById(declaredProject); - // // 获取此时待审核任务 - // Task currentTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); - // // 获取审核人信息,向审核人发送工作通知 - // String currentUserId = currentTask.getAssignee(); - // UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(currentUserId)); - // // 获取发送浙政钉工作通知必要信息 - // WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); - // String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); - // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); - // return; - // } - // // 获取bpm对象 - // BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); - // // 若不是被退回项目,传节点定义key 获取当前节点 - // FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); - // // TODO 若当前流程是预审流程,需要在提交预审申报的时候,调用状态机判断申报后的项目状态, - // // 若是省级部门联审中,要对接外部接口,获取省级部门联审的结果,更新项目状态(预审申报提交的时候处理) - // // 需要先通过后才能有下一个节点的信息 - // taskService.complete(param.getTaskId(), var); - // // 获取当前项目状态 - // Integer status = declaredProject.getStatus(); - // // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 - // // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 - // HistoricProcessInstance instance = historyService - // .createHistoricProcessInstanceQuery() - // .processInstanceId(processInstanceId) - // .singleResult(); - // if (HisProInsEndActId.END.equals(instance.getEndActivityId())) { - // switch (Objects.requireNonNull(ProjectStatusEnum.getValue(status))) { - // // 当前项目状态是单位内部审核中 - // case UNDER_INTERNAL_AUDIT: - // // 当前项目状态是预审中 - // case PRE_APPLYING: - // // 当前项目状态是部门联审中 - // case DEPARTMENT_JOINT_REVIEW: - // // 当前项目状态是方案评审中 - // case SCHEME_UNDER_REVIEW: - // // 当前项目状态是终验审核中 - // case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - // updatePassProjectStatus(userId, declaredProject); - // break; - // default: - // throw new IllegalStateException("Unexpected value: " + status); - // } - // } - // // 若有下一个审核人(当前节点的用户), - // // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 - // String nextUserId = getNextUserId(currentNode, processInstanceId); - // if (Objects.nonNull(nextUserId)) { - // // 获取浙政钉用户ID - // UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); - // WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); - // String msg = String.format(PASS_MSG_TEMPLATE, sendWorkNoticeInfo.getOrganizationName(), projectName); - // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); - // } else { - // // 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 - // // TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知 - // // 获取根节点即流程发起节点 - // FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); - // String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); - // // 获取浙政钉用户ID - // UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); - // WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); - // WflowModels wflowModels = getLastWflowModels(task); - // String formName = wflowModels.getFormName(); - // String msg = String.format(PASS_MSG_TEMPLATE2, projectName, formName); - // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); - // } - //} /** * 获取发送浙政钉工作通知的信息 @@ -629,28 +445,28 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/02 */ - //private String getRootUserId(FlowNode rootNode, String processInstanceId) { - // String rootUserId = null; - // // 输出连线 - // List outgoingFlows = rootNode.getOutgoingFlows(); - // // 遍历返回下一个节点信息 - // for (SequenceFlow currentOutgoingFlow : outgoingFlows) { - // // 类型自己判断 - // FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); - // // TODO 若要会签需判断候选人 - // // 发起事件 - // if (targetFlowElement instanceof StartEvent) { - // String actId = targetFlowElement.getId(); - // ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() - // .processInstanceId(processInstanceId).activityId(actId).singleResult(); - // String executionId = activityInstance.getExecutionId(); - // rootUserId = runtimeService.getVariable(executionId, "initiator", String.class); - // break; - // } - // } - // return rootUserId; - // - //} + private String getRootUserId(FlowNode rootNode, String processInstanceId) { + String rootUserId = null; + // 输出连线 + List outgoingFlows = rootNode.getOutgoingFlows(); + // 遍历返回下一个节点信息 + for (SequenceFlow currentOutgoingFlow : outgoingFlows) { + // 类型自己判断 + FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); + // TODO 若要会签需判断候选人 + // 发起事件 + if (targetFlowElement instanceof StartEvent) { + String actId = targetFlowElement.getId(); + ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() + .processInstanceId(processInstanceId).activityId(actId).singleResult(); + String executionId = activityInstance.getExecutionId(); + rootUserId = runtimeService.getVariable(executionId, "initiator", String.class); + break; + } + } + return rootUserId; + + } /** * 获取当前节点的下一个节点的审核用户ID * @@ -660,164 +476,33 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/02 */ - //private String getNextUserId(FlowNode currentNode, String processInstanceId) { - // String nextUserId = null; - // // 输出连线 - // List outgoingFlows = currentNode.getOutgoingFlows(); - // // 遍历返回下一个节点信息 - // for (SequenceFlow currentOutgoingFlow : outgoingFlows) { - // // 类型自己判断 - // FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); - // // 如果下个审批节点为结束节点,那么跳过该节点 - // if (targetFlowElement instanceof EndEvent) { - // continue; - // } - // // TODO 若要会签需判断候选人 - // // 用户任务 - // if (targetFlowElement instanceof UserTask) { - // String actId = targetFlowElement.getId(); - // ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() - // .processInstanceId(processInstanceId).activityId(actId).singleResult(); - // String executionId = activityInstance.getExecutionId(); - // nextUserId = runtimeService.getVariable(executionId, "assignee", String.class); - // break; - // } - // } - // return nextUserId; - //} - - /** - * 判断处理操作是否含有审核意见 - * - * @param comment 审核意见 - * @return boolean - * @author CMM - * @since 2023/02/01 - */ - //private boolean hasComment(ProcessComment comment) { - // return Objects.nonNull(comment) - // && (StrUtil.isNotBlank(comment.getText()) || isNotEmpty(comment.getAttachments())); - //} + private String getNextUserId(FlowNode currentNode, String processInstanceId) { + String nextUserId = null; + // 输出连线 + List outgoingFlows = currentNode.getOutgoingFlows(); + // 遍历返回下一个节点信息 + for (SequenceFlow currentOutgoingFlow : outgoingFlows) { + // 类型自己判断 + FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); + // 如果下个审批节点为结束节点,那么跳过该节点 + if (targetFlowElement instanceof EndEvent) { + continue; + } + // TODO 若要会签需判断候选人 + // 用户任务 + if (targetFlowElement instanceof UserTask) { + String actId = targetFlowElement.getId(); + ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() + .processInstanceId(processInstanceId).activityId(actId).singleResult(); + String executionId = activityInstance.getExecutionId(); + nextUserId = runtimeService.getVariable(executionId, "assignee", String.class); + break; + } + } + return nextUserId; + } /** - * 撤销流程处理 - * - * @param handledTaskInstance 已处理的历史任务实例 - * @param userId 当前登录用户ID - * @param projectId - */ - //private void doWithDrawProcess(HistoricTaskInstance handledTaskInstance, Long userId, Long projectId) { - // String processInstanceId = handledTaskInstance.getProcessInstanceId(); - // // 获取当前流程实例待审核任务信息 - // Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); - // // 获取当前流程实例信息 - // HistoricProcessInstance historicProcessInstance = historyService - // .createHistoricProcessInstanceQuery() - // .processInstanceId(processInstanceId) - // .singleResult(); - // // 流程发起人ID - // String startUserId = historicProcessInstance.getStartUserId(); - // // 获取当前申报项目 - // Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - // .eq(Project::getInstCode, processInstanceId) - // .eq(Project::getId,projectId)); - // String projectName = declaredProject.getProjectName(); - // - // // 获取bpm对象 - // BpmnModel bpmnModel = repositoryService.getBpmnModel(handledTaskInstance.getProcessDefinitionId()); - // // 传节点定义key 获取传入节点(撤回操作人在流程配置中所在的节点) - // FlowNode handledNode = (FlowNode) bpmnModel.getFlowElement(handledTaskInstance.getTaskDefinitionKey()); - // - // // 获取当前流程状态 - // Integer status = declaredProject.getStatus(); - // - // // 判断当前登录用户是否是流程发起人 - // if (startUserId.equals(String.valueOf(userId))) { - // // TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录 - // // 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 - // switch (Objects.requireNonNull(ProjectStatusEnum.getValue(status))) { - // // 当前项目状态是单位内部审核中 - // case UNDER_INTERNAL_AUDIT: - // // 当前项目状态是预审中 - // case PRE_APPLYING: - // // 当前项目状态是部门联审中 - // case DEPARTMENT_JOINT_REVIEW: - // // 当前项目状态是方案评审中 - // case SCHEME_UNDER_REVIEW: - // // 当前项目状态是终验审核中 - // case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - // updateWithdrawProjectStatus(userId, declaredProject); - // break; - // default: - // throw new IllegalStateException("Unexpected value: " + status); - // } - // List executions = runtimeService.createExecutionQuery() - // .processInstanceId(handledTaskInstance.getProcessInstanceId()).onlyChildExecutions().list(); - // // 强制流程指向撤回 - // runtimeService.createChangeActivityStateBuilder() - // .processInstanceId(task.getProcessInstanceId()) - // .moveActivityIdTo(task.getTaskDefinitionKey(), HisProInsEndActId.WITHDRAW) - // .moveExecutionsToSingleActivityId(executions.stream() - // .map(Execution::getId) - // .collect(Collectors.toList()), HisProInsEndActId.WITHDRAW) - // .changeState(); - // } else { - // // 获取当前流程待审核节点 - // FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); - // SequenceFlow sequenceFlow = currentNode.getIncomingFlows().get(0); - // // 获取上一个节点的activityId - // String sourceRef = sequenceFlow.getSourceRef(); - // - // HistoricActivityInstance lastInstance = historyService.createHistoricActivityInstanceQuery() - // .processInstanceId(task.getProcessInstanceId()) - // .activityId(sourceRef) - // .activityType("userTask") - // .finished() - // .singleResult(); - // // 获取前一个审核节点审核人信息 - // String beforeUserId = lastInstance.getAssignee(); - // // 获取当前审核节点审核人信息 - // String currentUserId = task.getAssignee(); - // //HashSet userSet = new HashSet<>(); - // //userSet.add(beforeUserId); - // //userSet.add(currentUserId); - // //Map userMap = userInfoService.getUserMapByIds(userSet); - // //UserInfoVO beforeUserInfoVO = userMap.get(Long.valueOf(beforeUserId)); - // //UserInfoVO currentUserInfoVO = userMap.get(Long.valueOf(currentUserId)); - // //String beforeUserOrgCode = beforeUserInfoVO.getOrganizationCode(); - // //String currentUserOrgCode = currentUserInfoVO.getOrganizationCode(); - // //Boolean orgFlag = currentUserOrgCode.equals(beforeUserOrgCode) ? true : false; - // - // // TODO 判断前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 - // Boolean orgFlag = true; - // if (orgFlag) { - // // 注意:是前一个审核人,说明此时仍在一个审核流程中,项目状态不需要改变,流程状态也不要改变,仍为审核中 - // // 在审核记录中移除前一个审核人提交过的审核意见 - // Comment comment = taskService.getProcessInstanceComments(processInstanceId).stream() - // .filter(c -> c.getTaskId().equals(handledTaskInstance.getId())) - // .findFirst() - // .get(); - // taskService.deleteComment(comment.getId()); - // // 我已处理中去掉自己之前处理的记录 - // String taskInstanceId = handledTaskInstance.getId(); - // historyService.deleteHistoricTaskInstance(taskInstanceId); - // - // List executions = runtimeService.createExecutionQuery() - // .processInstanceId(handledTaskInstance.getProcessInstanceId()).onlyChildExecutions().list(); - // // 强制流程指向前一个审核人节点 - // runtimeService.createChangeActivityStateBuilder() - // .processInstanceId(task.getProcessInstanceId()) - // .moveActivityIdsToSingleActivityId(executions.stream() - // .map(Execution::getActivityId) - // .collect(Collectors.toList()), handledNode.getId()) - // .changeState(); - // } else { - // throw new BizException("下一个审核人和您不是同一个部门,无法撤回!"); - // } - // - // } - //} - /** * 当为撤回操作时,更新项目表中的项目状态为前一个状态 * * @param userId @@ -846,55 +531,6 @@ public class TodoCenterManage { } /** - * 退回流程处理 - * - * @param task 当前任务 - * @param userId 当前登录用户ID - * @param param 参数 - */ - //private void doBackTask(Task task, Long userId, ReqProcessHandlerDTO param) { - // // 获取当前申报项目 - // Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - // .eq(Project::getInstCode, task.getProcessInstanceId()) - // .eq(Project::getId,param.getProjectId())); - // String projectName = declaredProject.getProjectName(); - // // 保存审核意见 - // if (hasComment(param.getAuditInfo())) { - // // 执行自定义的保存评论的功能 - // managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), - // String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); - // } - // // 获取bpm对象 - // BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); - // // 传节点定义key 获取根节点即流程发起节点 - // FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); - // - // // 流程变成【被退回】状态,待我处理中,为流程发起人增加一条待办记录, - // // 执行自定义回退逻辑,回退到流程发起人 - // // 注意:因为审核人有执行退回的权限,且是退回到流程发起人,说明是在同一个流程实例中,所以项目状态不需要更新 - // managementService.executeCommand(new BackToHisApprovalNodeCmd(runtimeService, bpmnModel, param.getTaskId(), rootNode.getId())); - // runtimeService.setVariables(param.getInstanceId(), - // Maps.newHashMap("approve_" + param.getTaskId(), param.getAction())); - // log.info("用户[{}] 退回流程[{}] [{} -> {}]", userId, param.getInstanceId(), - // task.getTaskDefinitionKey(), - // param.getTargetNode()); - // // 更新申报项目表中的流程状态为被退回 - // declaredProject.setProcessStatus(ProcessStatusEnum.BE_BACKED.getCode()); - // declaredProject.setUpdateOn(LocalDateTime.now()); - // declaredProject.setUpdateBy(userId); - // projectService.updateById(declaredProject); - // // TODO 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 - // String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); - // UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); - // WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); - // WflowModels wflowModels = getLastWflowModels(task); - // String formName = wflowModels.getFormName(); - // String msg = String.format(BACK_MSG_TEMPLATE, projectName, formName); - // zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); - // - //} - - /** * 查询流程表单数据及审批的进度步骤 * @param instanceId 流程实例ID * @return 流程进度及表单详情 From 22842ce94671c5b5fe1de90458b263fe740ebce7 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Thu, 23 Feb 2023 10:27:14 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E5=BA=93=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=B8=93=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/GeneratorCodeKingbaseConfig.java | 2 +- .../expert/assembler/ExpertInfoCmdAssembler.java | 226 +++++++++++++++++++++ .../expert/constant/ExpertAccountStatusEnum.java | 44 ++++ .../expert/constant/ExpertUserInfoStepEnum.java | 31 +++ .../controller/ExpertAvoidCompanyController.java | 20 ++ .../pmapi/expert/controller/ExpertController.java | 26 ++- .../pmapi/expert/entity/ExpertAvoidCompany.java | 36 ++++ .../pmapi/expert/entity/ExpertUserFullInfo.java | 4 +- .../pmapi/expert/helper/ExpertManageHelper.java | 113 +++++++++++ .../pmapi/expert/manage/ExpertManage.java | 78 +++++++ .../expert/mapper/ExpertAvoidCompanyMapper.java | 16 ++ .../expert/mapper/ExpertAvoidCompanyMapper.xml | 5 + .../pmapi/expert/model/DictionaryFieldInfo.java | 34 ++++ .../pmapi/expert/model/ExpertAvoidCompanyInfo.java | 22 ++ .../pmapi/expert/model/ExpertBasicInfo.java | 147 ++++++++++++++ .../pmapi/expert/model/ExpertEduInfo.java | 66 ++++++ .../pmapi/expert/model/ExpertJobInfo.java | 91 +++++++++ .../pmapi/expert/model/ExpertOtherInfo.java | 22 ++ .../pmapi/expert/model/ExpertProfessionalInfo.java | 56 +++++ .../pmapi/expert/model/ExpertRecommendInfo.java | 25 +++ .../pmapi/expert/model/FileBasicInfo.java | 24 +++ .../pmapi/expert/model/TagFieldInfo.java | 24 +++ .../expert/model/cmd/ExpertFullInfoSaveCmd.java | 32 +++ .../expert/model/dto/ExpertAvoidCompanyDTO.java | 20 ++ .../expert/model/dto/ExpertDictionaryDTO.java | 30 +++ .../pmapi/expert/model/dto/ExpertRegionDTO.java | 14 ++ .../pmapi/expert/model/dto/ExpertTagDTO.java | 21 ++ .../expert/model/dto/ExpertUserFullInfoDTO.java | 205 +++++++++++++++++++ .../req/ExpertUserBasicInfoSubmitRequest.java | 36 ++++ .../pmapi/expert/service/ExpertInfoService.java | 14 ++ .../expert/service/IExpertAvoidCompanyService.java | 16 ++ .../expert/service/IExpertUserFullInfoService.java | 8 + .../impl/ExpertAvoidCompanyServiceImpl.java | 20 ++ .../expert/service/impl/ExpertInfoServiceImpl.java | 219 ++++++++++++++++++++ .../impl/ExpertUserFullInfoServiceImpl.java | 11 + 35 files changed, 1752 insertions(+), 6 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertInfoCmdAssembler.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertAccountStatusEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoStepEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertAvoidCompany.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.xml create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/DictionaryFieldInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAvoidCompanyInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertBasicInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertEduInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertOtherInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertProfessionalInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertRecommendInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/FileBasicInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/TagFieldInfo.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertFullInfoSaveCmd.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAvoidCompanyDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertDictionaryDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertRegionDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertTagDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertUserFullInfoDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertUserBasicInfoSubmitRequest.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAvoidCompanyServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index 49bc070..2f0c620 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -56,7 +56,7 @@ public class GeneratorCodeKingbaseConfig { } public static void main(String[] args) { - generate("Liuxinxin", "expert", PATH_LXX, "expert_intention_work_region"); + generate("Liuxinxin", "expert", PATH_LXX, "expert_avoid_company"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertInfoCmdAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertInfoCmdAssembler.java new file mode 100644 index 0000000..8e712d0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/assembler/ExpertInfoCmdAssembler.java @@ -0,0 +1,226 @@ +package com.ningdatech.pmapi.expert.assembler; + + +import com.ningdatech.pmapi.expert.model.*; +import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; +import com.ningdatech.pmapi.expert.model.dto.*; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; +import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/22 下午5:19 + */ + +public class ExpertInfoCmdAssembler { + + public static ExpertFullInfoSaveCmd buildExpertFullInfoSaveCmd(Long userId + , ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo + , ExpertJobInfo expertJobInfo, ExpertProfessionalInfo expertProfessionalInfo) { + + ExpertFullInfoSaveCmd expertFullInfoSaveCmd = new ExpertFullInfoSaveCmd(); + ExpertUserFullInfoDTO expertUserInfoDTO = buildExpertUserFullInfoDTO( + expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null, null); + List expertDictionaryList = + buildExpertDictionaryList(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null); + List expertTagList = buildExpertTagList(expertProfessionalInfo, expertBasicInfo, null); + // 专家履职意向(区域编码) + List expertIntentionWorkRegionInfo = buildExpertRegionList(expertBasicInfo); + List expertAvoidCompanyList = buildExpertAvoidCompanyList(expertProfessionalInfo); + + expertFullInfoSaveCmd.setUserId(userId); + expertFullInfoSaveCmd.setExpertUserInfoDTO(expertUserInfoDTO); + expertFullInfoSaveCmd.setExpertDictionaryList(expertDictionaryList); + expertFullInfoSaveCmd.setExpertTagList(expertTagList); + expertFullInfoSaveCmd.setExpertIntentionWorkRegionInfo(expertIntentionWorkRegionInfo); + expertFullInfoSaveCmd.setExpertAvoidCompanyList(expertAvoidCompanyList); + + return expertFullInfoSaveCmd; + } + + + + + private static List buildExpertAvoidCompanyList(ExpertProfessionalInfo professionalInfo) { + List expertAvoidCompanyList = new ArrayList<>(); + List avoidCompanyList = professionalInfo.getAvoidCompanyList(); + if (CollectionUtils.isNotEmpty(avoidCompanyList)) { + expertAvoidCompanyList = avoidCompanyList.stream().map(r -> { + ExpertAvoidCompanyDTO expertAvoidCompanyDTO = new ExpertAvoidCompanyDTO(); + expertAvoidCompanyDTO.setCompanyName(r.getCompanyName()); + expertAvoidCompanyDTO.setCompanyUniqCode(r.getCompanyUniqCode()); + return expertAvoidCompanyDTO; + }).collect(Collectors.toList()); + } + return expertAvoidCompanyList; + } + + private static List buildExpertRegionList(ExpertBasicInfo basicInfo) { + List expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions(); + if (CollectionUtils.isEmpty(expertIntentionWorkRegions)) { + return new ArrayList<>(); + } + return expertIntentionWorkRegions.stream().map(r -> { + ExpertRegionDTO expertRegionDTO = new ExpertRegionDTO(); + expertRegionDTO.setRegionCode(r.getRegionCode()); + expertRegionDTO.setRegionLevel(r.getRegionLevel()); + return expertRegionDTO; + }).collect(Collectors.toList()); + } + + private static List buildExpertTagList(ExpertProfessionalInfo professionalInfo + , ExpertBasicInfo basicInfo, ExpertOtherInfo otherInfo) { + List goodAt = professionalInfo.getGoodAt(); + List technicalExpertise = professionalInfo.getTechnicalExpertise(); + List industrySector = professionalInfo.getIndustrySector(); + List expertSource = basicInfo.getExpertSource(); + List other = new ArrayList<>(); + if (Objects.nonNull(otherInfo)) { + other = otherInfo.getOther(); + } + List tagFieldInfoList = new ArrayList<>(); + assemblerTagExpertInfoFieldName(tagFieldInfoList, goodAt, ExpertTagEnum.GOOD_AT); + assemblerTagExpertInfoFieldName(tagFieldInfoList, technicalExpertise, ExpertTagEnum.TECHNICAL_EXPERTISE); + assemblerTagExpertInfoFieldName(tagFieldInfoList, industrySector, ExpertTagEnum.INDUSTRY_SECTOR); + assemblerTagExpertInfoFieldName(tagFieldInfoList, expertSource, ExpertTagEnum.EXPERT_SOURCE); + assemblerTagExpertInfoFieldName(tagFieldInfoList, other, ExpertTagEnum.OTHER); + + return tagFieldInfoList.stream().map(r -> { + ExpertTagDTO expertTagDTO = new ExpertTagDTO(); + expertTagDTO.setTagCode(r.getTagCode()); + expertTagDTO.setExpertInfoField(r.getTagFieldName()); + return expertTagDTO; + }).collect(Collectors.toList()); + } + + private static void assemblerTagExpertInfoFieldName(List allTagFieldInfoList + , List originalTagFieldInfoList, ExpertTagEnum tagExpertInfoFieldEnum) { + if (CollectionUtils.isNotEmpty(originalTagFieldInfoList)) { + originalTagFieldInfoList = originalTagFieldInfoList.stream().map(r -> { + r.setTagFieldName(tagExpertInfoFieldEnum.getKey()); + return r; + }).collect(Collectors.toList()); + allTagFieldInfoList.addAll(originalTagFieldInfoList); + } + } + + private static List buildExpertDictionaryList(ExpertBasicInfo basicInfo, ExpertEduInfo eduInfo + , ExpertJobInfo jobInfo, ExpertProfessionalInfo professionalInfo, ExpertRecommendInfo recommendInfo) { + List political = basicInfo.getPolitical(); + List expertType = basicInfo.getExpertType(); + List edu = eduInfo.getEdu(); + List degree = eduInfo.getDegree(); + List jobStatus = jobInfo.getJobStatus(); + List companyAttribute = jobInfo.getCompanyAttribute(); + List administrativeRank = jobInfo.getAdministrativeRank(); + List titleLevel = professionalInfo.getTitleLevel(); + + List recommendedWay = new ArrayList<>(); + if (Objects.nonNull(recommendInfo)) { + recommendedWay = recommendInfo.getRecommendedWay(); + } + List dictionaryFieldInfoList = new ArrayList<>(); + assemblerDictionaryFieldName(dictionaryFieldInfoList, political, DictExpertInfoTypeEnum.POLITICAL); + assemblerDictionaryFieldName(dictionaryFieldInfoList, expertType, DictExpertInfoTypeEnum.EXPERT_TYPE); + assemblerDictionaryFieldName(dictionaryFieldInfoList, edu, DictExpertInfoTypeEnum.EDU); + assemblerDictionaryFieldName(dictionaryFieldInfoList, degree, DictExpertInfoTypeEnum.DEGREE); + assemblerDictionaryFieldName(dictionaryFieldInfoList, jobStatus, DictExpertInfoTypeEnum.JOB_STATUS); + assemblerDictionaryFieldName(dictionaryFieldInfoList, companyAttribute, DictExpertInfoTypeEnum.COMPANY_ATTRIBUTE); + assemblerDictionaryFieldName(dictionaryFieldInfoList, administrativeRank, DictExpertInfoTypeEnum.ADMINISTRATIVE_RANK); + assemblerDictionaryFieldName(dictionaryFieldInfoList, titleLevel, DictExpertInfoTypeEnum.TITLE_LEVEL); + assemblerDictionaryFieldName(dictionaryFieldInfoList, recommendedWay, DictExpertInfoTypeEnum.RECOMMENDED_WAY); + + return dictionaryFieldInfoList.stream().map(r -> { + ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); + expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); + expertDictionaryDTO.setExpertInfoField(r.getDictionaryFieldName()); + return expertDictionaryDTO; + }).collect(Collectors.toList()); + } + + private static void assemblerDictionaryFieldName( + List allDictionaryFieldInfoList, List originalDictionaryFieldInfoList + , DictExpertInfoTypeEnum dictExpertInfoTypeEnum) { + if (CollectionUtils.isNotEmpty(originalDictionaryFieldInfoList)) { + originalDictionaryFieldInfoList = originalDictionaryFieldInfoList.stream().map(r -> { + r.setDictionaryFieldName(dictExpertInfoTypeEnum.getKey()); + return r; + }).collect(Collectors.toList()); + allDictionaryFieldInfoList.addAll(originalDictionaryFieldInfoList); + } + } + + private static ExpertUserFullInfoDTO buildExpertUserFullInfoDTO(ExpertBasicInfo basicInfo, ExpertEduInfo eduInfo + , ExpertJobInfo jobInfo, ExpertProfessionalInfo professionalInfo, ExpertRecommendInfo recommendInfo, ExpertOtherInfo otherInfo) { + ExpertUserFullInfoDTO expertUserFullInfoDTO = new ExpertUserFullInfoDTO(); + + expertUserFullInfoDTO.setIsDingUser(basicInfo.getIsDingUser()); + expertUserFullInfoDTO.setPhoneNo(basicInfo.getPhoneNo()); + expertUserFullInfoDTO.setGender(basicInfo.getGender()); + expertUserFullInfoDTO.setName(basicInfo.getName()); + if (Objects.nonNull(basicInfo.getAvatarFile())) { + expertUserFullInfoDTO.setAvatarFileId(basicInfo.getAvatarFile().getFileId()); + } + expertUserFullInfoDTO.setIdCard(basicInfo.getIdCard()); + expertUserFullInfoDTO.setOfficePhone(basicInfo.getOfficePhone()); + expertUserFullInfoDTO.setBirth(basicInfo.getBirth()); + expertUserFullInfoDTO.setBankNo(basicInfo.getBankNo()); + expertUserFullInfoDTO.setBank(basicInfo.getBank()); + expertUserFullInfoDTO.setEmail(basicInfo.getEmail()); + expertUserFullInfoDTO.setHometown(basicInfo.getHometown()); + expertUserFullInfoDTO.setNationality(basicInfo.getNationality()); + if (Objects.nonNull(otherInfo)) { + expertUserFullInfoDTO.setRemark(otherInfo.getRemark()); + } + expertUserFullInfoDTO.setSchool(eduInfo.getSchool()); + expertUserFullInfoDTO.setGraduatedAt(eduInfo.getGraduatedAt()); + expertUserFullInfoDTO.setAcademicTitle(eduInfo.getAcademicTitle()); + + if (CollectionUtils.isNotEmpty(eduInfo.getGraduationCertificateFile())) { + expertUserFullInfoDTO.setGraduationCertificateFileIdList(eduInfo.getGraduationCertificateFile().stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); + } + if (CollectionUtils.isNotEmpty(eduInfo.getDegreeCertificateFile())) { + + expertUserFullInfoDTO.setDegreeCertificateFileIdList(eduInfo.getDegreeCertificateFile().stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); + } + + expertUserFullInfoDTO.setRetiredAt(jobInfo.getRetiredAt()); + expertUserFullInfoDTO.setCompany(jobInfo.getCompany()); + expertUserFullInfoDTO.setLegalEntityCode(jobInfo.getLegalEntityCode()); + expertUserFullInfoDTO.setAdministrativeDuties(jobInfo.getAdministrativeDuties()); + expertUserFullInfoDTO.setStartWorkAt(jobInfo.getStartWorkAt()); + expertUserFullInfoDTO.setAddress(jobInfo.getAddress()); + expertUserFullInfoDTO.setExperience(jobInfo.getExperience()); + + expertUserFullInfoDTO.setTechnicalTitles(professionalInfo.getTechnicalTitles()); + if (CollectionUtils.isNotEmpty(professionalInfo.getTitleCertificateFile())) { + expertUserFullInfoDTO.setTitleCertificateFileIdList(professionalInfo.getTitleCertificateFile().stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); + } + expertUserFullInfoDTO.setAwards(professionalInfo.getAwards()); + expertUserFullInfoDTO.setRecognitionReward(professionalInfo.getRecognitionReward()); + + if (Objects.nonNull(basicInfo.getExpertRegionInfo())) { + expertUserFullInfoDTO.setRegionCode(basicInfo.getExpertRegionInfo().getRegionCode()); + expertUserFullInfoDTO.setRegionLevel(basicInfo.getExpertRegionInfo().getRegionLevel()); + } + // 推荐证明材料单独装配 + if (Objects.nonNull(recommendInfo)) { + List recommendationProofFile = recommendInfo.getRecommendationProofFile(); + if (CollectionUtils.isNotEmpty(recommendationProofFile)) { + expertUserFullInfoDTO + .setRecommendationProofFileIdList( + recommendationProofFile.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); + + } + } + return expertUserFullInfoDTO; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertAccountStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertAccountStatusEnum.java new file mode 100644 index 0000000..b0fccbb --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertAccountStatusEnum.java @@ -0,0 +1,44 @@ +package com.ningdatech.pmapi.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/7/22 下午4:21 + */ +@AllArgsConstructor +@Getter +public enum ExpertAccountStatusEnum { + + /** + * 可用 + */ + AVAILABLE("available"), + + /** + * 冻结中 + */ + FREEZE("freeze"), + + /** + * 已出库 + */ + DELIVERY("delivery"), + + /** + * 申请中 + */ + APPLYING("applying"); + + private final String key; + + public static ExpertAccountStatusEnum of(String key) { + for (ExpertAccountStatusEnum statusEnum : ExpertAccountStatusEnum.values()) { + if (statusEnum.key.equals(key)) { + return statusEnum; + } + } + throw new IllegalArgumentException(String.format("Illegal ExpertAccountStatusEnum = %s", key)); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoStepEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoStepEnum.java new file mode 100644 index 0000000..0d176b8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/constant/ExpertUserInfoStepEnum.java @@ -0,0 +1,31 @@ +package com.ningdatech.pmapi.expert.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/7/26 上午9:26 + */ +@AllArgsConstructor +@Getter +public enum ExpertUserInfoStepEnum { + + /** + * 待提交信息 + */ + INFORMATION_TO_BE_SUBMITTED("information_to_be_submitted"), + + /** + * 已提交基本信息 + */ + BASIC_INFORMATION_SUBMITTED("basic_information_submitted"), + + /** + * 已提交证明材料 + */ + EVIDENCE_HAS_BEEN_SUBMITTED("evidence_has_been_submitted"); + + private final String key; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java new file mode 100644 index 0000000..e078e71 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertAvoidCompanyController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.expert.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2023-02-23 + */ +@Controller +@RequestMapping("/pmapi.expert/expert-avoid-company") +public class ExpertAvoidCompanyController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java index d778372..5f9b29f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java @@ -1,20 +1,40 @@ package com.ningdatech.pmapi.expert.controller; +import com.ningdatech.pmapi.expert.manage.ExpertManage; +import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; +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.stereotype.Controller; +import javax.validation.Valid; /** *

- * 前端控制器 + * 前端控制器 *

* * @author Liuxinxin * @since 2023-02-22 */ -@Controller +@RestController +@Api(tags = "专家管理相关接口") @RequestMapping("/api/v1/expert") +@RequiredArgsConstructor public class ExpertController { + private final ExpertManage expertManage; + + @PostMapping("/basic-info-submit") + @ApiOperation("填写基本信息接口(专家报名使用))") + public void expertBasicInfoSubmit(@Valid @RequestBody ExpertUserBasicInfoSubmitRequest request) { +// ExpertUserInfoValidator.expertUserBasicInfoSubmitRequestValidate(request); + expertManage.expertBasicInfoSubmit(request); + } + + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertAvoidCompany.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertAvoidCompany.java new file mode 100644 index 0000000..1e29c60 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertAvoidCompany.java @@ -0,0 +1,36 @@ +package com.ningdatech.pmapi.expert.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2023-02-23 + */ +@TableName("expert_avoid_company") +@ApiModel(value = "ExpertAvoidCompany对象", description = "") +@Data +public class ExpertAvoidCompany implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String companyName; + + private String companyUniqCode; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java index 26842c2..e89563e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertUserFullInfo.java @@ -45,7 +45,7 @@ public class ExpertUserFullInfo implements Serializable { private String expertName; - private String avatarFileId; + private Long avatarFileId; private String idCard; @@ -75,7 +75,7 @@ public class ExpertUserFullInfo implements Serializable { private String administrativeDuties; - private String startWorkAt; + private LocalDateTime startWorkAt; private String address; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java new file mode 100644 index 0000000..ec0ca9f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java @@ -0,0 +1,113 @@ +package com.ningdatech.pmapi.expert.helper; + +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.pmapi.expert.model.*; +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.sys.model.dto.RegionDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2023/2/23 上午9:18 + */ + +@Component +public class ExpertManageHelper { + +// @Autowired +// private RegionCache regionCache; + + @Autowired + private TagCache tagCache; + + @Autowired + private DictionaryCache dictionaryCache; + + + /** + * 校验区域code + * + * @param expertRegionInfo + */ + public void expertRegionInfoCheck(ExpertRegionInfo expertRegionInfo) { +// // todo 必须为叶子节点编码 +// String regionCode = expertRegionInfo.getRegionCode(); +// Integer regionLevel = expertRegionInfo.getRegionLevel(); +// RegionDTO regionDTO = regionCache.getByCodeAndLevel(regionCode, regionLevel); +// if (Objects.isNull(regionDTO)) { +// throw new BadRequestException("illegal regionInfo"); +// } + } + + + /** + * 校验标签code是否合法 + * + * @param expertProfessionalInfo + * @param expertBasicInfo + */ + public void tagFieldCheck(ExpertProfessionalInfo expertProfessionalInfo, ExpertBasicInfo expertBasicInfo) { + List goodAt = expertProfessionalInfo.getGoodAt(); + List technicalExpertise = expertProfessionalInfo.getTechnicalExpertise(); + List industrySector = expertProfessionalInfo.getIndustrySector(); + List expertSource = expertBasicInfo.getExpertSource(); + + List tagFieldInfoList = new ArrayList<>(); + tagFieldInfoList.addAll(goodAt); + tagFieldInfoList.addAll(technicalExpertise); + tagFieldInfoList.addAll(industrySector); + tagFieldInfoList.addAll(expertSource); + for (TagFieldInfo tagFieldInfo : tagFieldInfoList) { + String tagCode = tagFieldInfo.getTagCode(); + TagDTO tagCodeDTO = tagCache.getByTagCode(tagCode); + if (Objects.isNull(tagCodeDTO)) { + throw new BizException("illegal tagCode: tagField=" + tagFieldInfo.getTagFieldName() + ",tagCode=" + tagCode); + } + } + } + + + /** + * 校验字典code是否合法 + * + * @param expertBasicInfo + * @param expertEduInfo + * @param expertJobInfo + */ + public void dictionaryFieldCheck(ExpertBasicInfo expertBasicInfo, ExpertEduInfo expertEduInfo + , ExpertJobInfo expertJobInfo) { + List political = expertBasicInfo.getPolitical(); + List edu = expertEduInfo.getEdu(); + List degree = expertEduInfo.getDegree(); + List jobStatus = expertJobInfo.getJobStatus(); + List companyAttribute = expertJobInfo.getCompanyAttribute(); + List administrativeRank = expertJobInfo.getAdministrativeRank(); + + List dictionaryFieldInfoList = new ArrayList<>(); + dictionaryFieldInfoList.addAll(political); + dictionaryFieldInfoList.addAll(edu); + dictionaryFieldInfoList.addAll(degree); + dictionaryFieldInfoList.addAll(jobStatus); + dictionaryFieldInfoList.addAll(companyAttribute); + dictionaryFieldInfoList.addAll(administrativeRank); + + for (DictionaryFieldInfo dictionaryFieldInfo : dictionaryFieldInfoList) { + String dictionaryFieldName = dictionaryFieldInfo.getDictionaryFieldName(); + String dictionaryCode = dictionaryFieldInfo.getDictionaryCode(); + DictionaryDTO dictionaryDTO = dictionaryCache.getByCode(dictionaryCode); + if (Objects.isNull(dictionaryDTO)) { + throw new BizException("illegal dictionaryCode: dictionaryFieldName=" + dictionaryFieldName + ",dictionaryCode=" + dictionaryCode); + } + } + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java new file mode 100644 index 0000000..f9b55dd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java @@ -0,0 +1,78 @@ +package com.ningdatech.pmapi.expert.manage; + +import com.ningdatech.pmapi.expert.assembler.ExpertInfoCmdAssembler; +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.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.cmd.ExpertFullInfoSaveCmd; +import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; +import com.ningdatech.pmapi.expert.service.ExpertInfoService; +import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; +import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import com.ningdatech.pmapi.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2023/2/23 上午8:55 + */ + +@Component +@RequiredArgsConstructor +public class ExpertManage { + + private final ExpertManageHelper expertManageHelper; + + private final IExpertUserFullInfoService iExpertUserFullInfoService; + + private final ExpertInfoService expertInfoService; + + + /** + * 填写基本信息,只有专家自己可用 + * + * @param request + */ + public void expertBasicInfoSubmit(ExpertUserBasicInfoSubmitRequest request) { + // 用户id + Long userId = LoginUserUtil.getUserId(); + ExpertBasicInfo basicInfo = request.getBasicInfo(); + // 校验区域编码合法性 校验履职意向编码合法性 + ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo(); + expertManageHelper.expertRegionInfoCheck(expertRegionInfo); + List expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions(); + for (ExpertRegionInfo expertIntentionWorkRegion : expertIntentionWorkRegions) { + expertManageHelper.expertRegionInfoCheck(expertIntentionWorkRegion); + } + ExpertEduInfo eduInfo = request.getEduInfo(); + ExpertJobInfo jobInfo = request.getJobInfo(); + ExpertProfessionalInfo professionalInfo = request.getProfessionalInfo(); + // 校验标签字段 + expertManageHelper.tagFieldCheck(professionalInfo, basicInfo); + // 校验字典字段 + expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo); + // 判断专家提交状态,判断是否可以进行此操作 + ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); + + boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo) + || (ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) + && !ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep())); + if (submitBasicInfoStatusEnable) { + // 新建 保存 + ExpertFullInfoSaveCmd expertFullInfoSaveCmd = ExpertInfoCmdAssembler + .buildExpertFullInfoSaveCmd(userId, basicInfo, eduInfo, jobInfo, professionalInfo); + expertInfoService.saveExpertInfo(expertFullInfoSaveCmd); + } + } + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.java new file mode 100644 index 0000000..53050a3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.expert.mapper; + +import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2023-02-23 + */ +public interface ExpertAvoidCompanyMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.xml new file mode 100644 index 0000000..cbb557d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/mapper/ExpertAvoidCompanyMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/DictionaryFieldInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/DictionaryFieldInfo.java new file mode 100644 index 0000000..a01f4bd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/DictionaryFieldInfo.java @@ -0,0 +1,34 @@ +package com.ningdatech.pmapi.expert.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:03 + * 专家信息字典字段信息 + */ +@Data +@ApiModel("字典字段信息") +public class DictionaryFieldInfo { + + /** + * 字段名称 + */ + @NotBlank + @ApiModelProperty("字典字段名称") + private String dictionaryFieldName; + + /** + * 字典code + */ + @ApiModelProperty(value = "字典code") + private String dictionaryCode; + + + @ApiModelProperty(value = "字典code含义", required = false) + private String dictionaryName; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAvoidCompanyInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAvoidCompanyInfo.java new file mode 100644 index 0000000..83286a5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertAvoidCompanyInfo.java @@ -0,0 +1,22 @@ +package com.ningdatech.pmapi.expert.model; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:16 + */ +@Data +public class ExpertAvoidCompanyInfo { + + @NotBlank + @ApiModelProperty("公司名称") + private String companyName; + + @ApiModelProperty("公司唯一标识 即 调用获取组织架构的树状结构(单位筛选列表) 接口是对应公司的 organizationCode") + private String companyUniqCode; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertBasicInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertBasicInfo.java new file mode 100644 index 0000000..5687d1e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertBasicInfo.java @@ -0,0 +1,147 @@ +package 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.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:44 + * 专家信息中的基本信息一栏 + */ +@Data +@ApiModel(value = "ExpertBasicInfo", description = "专家基本信息") +public class ExpertBasicInfo { + + /** + * 是否浙政钉用户Y/N + */ + @NotNull + @ApiModelProperty(value = "是否浙政钉用户Y/N") + private Boolean isDingUser; + + /** + * 手机号 + */ + @NotBlank + @ApiModelProperty(value = "手机号") + private String phoneNo; + + /** + * 专家姓名 + */ + @NotBlank + @ApiModelProperty(value = "专家姓名") + private String name; + + /** + * 免冠照图片地址 + */ + @NotBlank + @ApiModelProperty(value = "免冠照图片文件") + private FileBasicInfo avatarFile; + + /** + * 性别 0,1:女,男 + */ + @NotBlank + @ApiModelProperty(value = "性别 0,1:女,男") + private String gender; + + /** + * 政治面貌(字典code) + */ + @NotNull + @ApiModelProperty(value = "政治面貌(字典code)") + private List political; + + /** + * 身份证号码 + */ + @NotBlank + @ApiModelProperty(value = "身份证号码") + private String idCard; + + /** + * 办公电话 + */ + @ApiModelProperty(value = "办公电话") + private String officePhone; + + /** + * 出生日期 + */ + @NotNull + @ApiModelProperty(value = "出生日期") + private LocalDateTime birth; + + /** + * 开户银行 + */ + @NotBlank + @ApiModelProperty(value = "开户银行") + private String bank; + + /** + * 银行卡号 + */ + @NotBlank + @ApiModelProperty(value = "银行卡号") + private String bankNo; + + /** + * 电子邮箱 + */ + @NotBlank + @ApiModelProperty(value = "电子邮箱") + @Email + private String email; + + /** + * 专家来源(标签code) + */ + @NotNull + @ApiModelProperty(value = "专家来源(标签code)") + private List expertSource; + + /** + * 专家层级 + */ + @NotNull + @ApiModelProperty(value = "专家层级") + private ExpertRegionInfo expertRegionInfo; + + /** + * 履职意向 + */ + @NotEmpty + @ApiModelProperty(value = "履职意向") + private List expertIntentionWorkRegions; + + /** + * 专家类型(内外围) + */ + @ApiModelProperty(value = "专家类型(内外围)") + private List expertType; + + /** + * 籍贯 + */ + @ApiModelProperty(value = "籍贯") + private String hometown; + + /** + * 民族 + */ + @ApiModelProperty(value = "民族") + private String nationality; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertEduInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertEduInfo.java new file mode 100644 index 0000000..00dda08 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertEduInfo.java @@ -0,0 +1,66 @@ +package com.ningdatech.pmapi.expert.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:50 + */ +@Data +@ApiModel(value = "ExpertEduInfo", description = "学历信息") +public class ExpertEduInfo { + + /** + * 毕业院校 + */ + @NotBlank + @ApiModelProperty("毕业院校") + private String school; + + /** + * 毕业时间 + */ + @NotNull + @ApiModelProperty("毕业时间") + private LocalDateTime graduatedAt; + + /** + * 所学专业 + */ + @NotBlank + @ApiModelProperty("所学专业") + private String academicTitle; + + /** + * 学历(字典code) + */ + @NotNull + @ApiModelProperty("学历(字典code)") + private List edu; + + /** + * 毕业证附件信息 + */ + @ApiModelProperty("毕业证附件信息") + private List graduationCertificateFile; + + /** + * 学位(字典code) + */ + @NotNull + @ApiModelProperty("学位(字典code)") + private List degree; + + /** + * 学位证附件信息 + */ + @ApiModelProperty("学位证附件信息") + private List degreeCertificateFile; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java new file mode 100644 index 0000000..ae5c920 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertJobInfo.java @@ -0,0 +1,91 @@ +package com.ningdatech.pmapi.expert.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:58 + */ +@Data +@ApiModel(value = "ExpertJobInfo", description = "职业信息") +public class ExpertJobInfo { + + /** + * 在职状态(字典code) + */ + @NotNull + @ApiModelProperty("在职状态(字典code)") + private List jobStatus; + + /** + * 退休时间 + */ + @ApiModelProperty("退休时间") + private LocalDateTime retiredAt; + + /** + * 工作单位 + */ + @NotBlank + @ApiModelProperty("工作单位,组织结构name") + private String company; + + @ApiModelProperty("工作单位,前端使用标识") + private String companyUniqCode; + + /** + * 单位法人编号 + */ + @NotBlank + @ApiModelProperty(" 单位法人编号") + private String legalEntityCode; + + /** + * 行政职务 + */ + @NotBlank + @ApiModelProperty("行政职务") + private String administrativeDuties; + + /** + * 开始工作时间 + */ + @NotNull + @ApiModelProperty("开始工作时间") + private LocalDateTime startWorkAt; + + /** + * 行政职级(字典code) + */ + @NotNull + @ApiModelProperty("行政职级(字典code)") + private List administrativeRank; + + /** + * 单位类型(字典code) + */ + @NotNull + @ApiModelProperty("单位类型(字典code)") + private List companyAttribute; + + /** + * 工作地址 + */ + @NotBlank + @ApiModelProperty("工作地址") + private String address; + + /** + * 工作经历 + */ + @NotBlank + @ApiModelProperty("工作经历") + private String experience; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertOtherInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertOtherInfo.java new file mode 100644 index 0000000..b23ad75 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertOtherInfo.java @@ -0,0 +1,22 @@ +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/8/19 下午6:43 + */ +@Data +@ApiModel(description = "其他信息") +public class ExpertOtherInfo { + + @ApiModelProperty(value = "其他标签(标签code)") + private List other; + + @ApiModelProperty(value = "备注") + private String remark; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertProfessionalInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertProfessionalInfo.java new file mode 100644 index 0000000..6c0ed92 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertProfessionalInfo.java @@ -0,0 +1,56 @@ +package com.ningdatech.pmapi.expert.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:07 + */ +@Data +@ApiModel(description = "专业信息") +public class ExpertProfessionalInfo { + + @NotBlank + @ApiModelProperty(value = "技术职称") + private String technicalTitles; + + @NotNull + @ApiModelProperty(value = "职称级别") + private List titleLevel; + + @ApiModelProperty(value = "职称证明") + private List titleCertificateFile; + + @NotNull + @ApiModelProperty(value = "擅长方向(标签code)") + private List goodAt; + + @NotNull + @ApiModelProperty(value = "技术专长(标签code)") + private List technicalExpertise; + + @NotBlank + @ApiModelProperty(value = " 获奖情况") + private String awards; + + @NotNull + @ApiModelProperty(value = "行业领域(标签code)") + private List industrySector; + + @NotBlank + @ApiModelProperty(value = "表彰奖励") + private String recognitionReward; + + @ApiModelProperty(value = "回避单位列表") + private List avoidCompanyList; + + @ApiModelProperty(value = "其他标签") + private List other; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertRecommendInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertRecommendInfo.java new file mode 100644 index 0000000..86056aa --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/ExpertRecommendInfo.java @@ -0,0 +1,25 @@ +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 上午11:52 + */ +@Data +@ApiModel(description = "推荐信息") +public class ExpertRecommendInfo { + + /** + * 推荐方式 + */ + @ApiModelProperty("推荐方式") + private List recommendedWay; + + @ApiModelProperty("推荐证明材料") + private List recommendationProofFile; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/FileBasicInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/FileBasicInfo.java new file mode 100644 index 0000000..8a3ffb4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/FileBasicInfo.java @@ -0,0 +1,24 @@ +package com.ningdatech.pmapi.expert.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:55 + * 用于包装使用 + */ +@Data +@ApiModel("文件信息基类") +public class FileBasicInfo { + + @ApiModelProperty("文件id") + private Long fileId; + + @ApiModelProperty("文件url") + private String url; + + @ApiModelProperty("文件名") + private String fileName; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/TagFieldInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/TagFieldInfo.java new file mode 100644 index 0000000..63cde0f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/TagFieldInfo.java @@ -0,0 +1,24 @@ +package com.ningdatech.pmapi.expert.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:12 + */ +@Data +@ApiModel("标签信息") +public class TagFieldInfo { + + @ApiModelProperty("标签字段名称") + private String tagFieldName; + + @ApiModelProperty("标签字段code") + private String tagCode; + + @ApiModelProperty(value = "标签code含义", required = false) + private String tagName; +} + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertFullInfoSaveCmd.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertFullInfoSaveCmd.java new file mode 100644 index 0000000..c2d0b51 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/cmd/ExpertFullInfoSaveCmd.java @@ -0,0 +1,32 @@ +package com.ningdatech.pmapi.expert.model.cmd; + +import com.ningdatech.pmapi.expert.model.dto.*; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午4:41 + */ +@Data +public class ExpertFullInfoSaveCmd { + + private Long userId; + + private ExpertUserFullInfoDTO expertUserInfoDTO; + + private List expertDictionaryList; + + private List expertTagList; + + /** + * 专家履职意向(区域编码) + */ + private List expertIntentionWorkRegionInfo; + + /** + * 回避单位列表 + */ + private List expertAvoidCompanyList; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAvoidCompanyDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAvoidCompanyDTO.java new file mode 100644 index 0000000..d1b6a5d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertAvoidCompanyDTO.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.expert.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/25 下午5:14 + */ +@Data +public class ExpertAvoidCompanyDTO { + /** + * 公司名称 + */ + private String companyName; + + /** + * 公司唯一标识 + */ + private String companyUniqCode; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertDictionaryDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertDictionaryDTO.java new file mode 100644 index 0000000..865332c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertDictionaryDTO.java @@ -0,0 +1,30 @@ +package com.ningdatech.pmapi.expert.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 下午5:13 + */ +@Data +public class ExpertDictionaryDTO { + + /** + * 字典编码 + */ + private String dictionaryCode; + + /** + * 手机对应专家信息字段号 + * 政治面貌 political + * 专家来源 expert_source + * 学历 edu + * 学位 degree + * 在职状态 job_status + * 行政职级 administrative_rank + * 内外围(专家类型) expert_type + * 单位类型 company_attribute + * 职称级别 title_level + */ + private String expertInfoField; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertRegionDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertRegionDTO.java new file mode 100644 index 0000000..8b3f3a7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertRegionDTO.java @@ -0,0 +1,14 @@ +package com.ningdatech.pmapi.expert.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 下午5:10 + */ +@Data +public class ExpertRegionDTO { + + private String regionCode; + private Integer regionLevel; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertTagDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertTagDTO.java new file mode 100644 index 0000000..f5e048e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertTagDTO.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.expert.model.dto; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/22 下午5:13 + */ +@Data +public class ExpertTagDTO { + + /** + * 标签code + */ + private String tagCode; + + /** + * 对应专家信息字段 + */ + private String expertInfoField; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertUserFullInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertUserFullInfoDTO.java new file mode 100644 index 0000000..60fca6e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/dto/ExpertUserFullInfoDTO.java @@ -0,0 +1,205 @@ +package com.ningdatech.pmapi.expert.model.dto; + +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 下午4:43 + */ +@Data +public class ExpertUserFullInfoDTO { + + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 专家账号状态 + */ + private String expertAccountStatus; + + /** + * 是否浙政钉用户Y/N + */ + private Boolean isDingUser; + + /** + * 专家信息提交步骤 + * 0,1,2 + * 0 :待提交信息
1: 已提交基本信息
2:已提交推荐证明 + */ + private Integer userInfoStep; + + /** + * 手机号 + */ + private String phoneNo; + + /** + * 性别 + * 0,1
女,男 + */ + private String gender; + + /** + * 姓名 + */ + private String name; + + /** + * 免冠照图片文件地址 + */ + private Long avatarFileId; + + /** + * 身份证号码 + */ + private String idCard; + + /** + * 办公电话 + */ + private String officePhone; + + /** + * 出生日期 + */ + private LocalDateTime birth; + + /** + * 银行卡号 + */ + private String bankNo; + + /** + * 开户银行 + */ + private String bank; + + /** + * 电子邮箱 + */ + private String email; + + /** + * 毕业院校 + */ + private String school; + + /** + * 毕业时间 + */ + private LocalDateTime graduatedAt; + + /** + * 所学专业 + */ + private String academicTitle; + + /** + * 毕业证 文件id + */ + private List graduationCertificateFileIdList; + + /** + * 学位证 文件id + */ + private List degreeCertificateFileIdList; + + /** + * 退休时间 + */ + private LocalDateTime retiredAt; + + /** + * 工作单位 + */ + private String company; + + /** + * 工作单位前端使用标识 + */ + private String companyUniqCode; + + /** + * 单位法人编号 + */ + private String legalEntityCode; + + /** + * 行政职务 + */ + private String administrativeDuties; + + /** + * 开始工作时间 + */ + private LocalDateTime startWorkAt; + + /** + * 工作地址 + */ + private String address; + + /** + * 工作经历 + */ + private String experience; + + /** + * 技术职称 + */ + private String technicalTitles; + + /** + * 职称证明 + * 文件id + */ + private List titleCertificateFileIdList; + + /** + * 获奖情况 + */ + private String awards; + + /** + * 表彰奖励 + */ + private String recognitionReward; + + /** + * 推荐证明材料文件id + */ + private List recommendationProofFileIdList; + + /** + * 专家层级(区域编码) + */ + private String regionCode; + + /** + * 区域级别 + */ + private Integer regionLevel; + + /** + * 专家管理员审核备注 + */ + private String remark; + + /** + * 籍贯 + */ + private String hometown; + + /** + * 民族 + */ + private String nationality; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertUserBasicInfoSubmitRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertUserBasicInfoSubmitRequest.java new file mode 100644 index 0000000..7e8c894 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertUserBasicInfoSubmitRequest.java @@ -0,0 +1,36 @@ +package com.ningdatech.pmapi.expert.model.req; + +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:21 + */ +@Data +@ApiModel(value = "ExpertUserBasicInfoSubmitRequest", description = "专家基本信息填写入参") +public class ExpertUserBasicInfoSubmitRequest { + + @NotNull + @ApiModelProperty("基本信息") + private ExpertBasicInfo basicInfo; + + @NotNull + @ApiModelProperty("学历信息") + private ExpertEduInfo eduInfo; + + @NotNull + @ApiModelProperty("职业信息") + private ExpertJobInfo jobInfo; + + @NotNull + @ApiModelProperty("专业信息") + private ExpertProfessionalInfo professionalInfo; +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java new file mode 100644 index 0000000..fba707d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/ExpertInfoService.java @@ -0,0 +1,14 @@ +package com.ningdatech.pmapi.expert.service; + +import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; + +/** + * @author liuxinxin + * @date 2022/7/22 下午4:39 + */ + +public interface ExpertInfoService { + + void saveExpertInfo(ExpertFullInfoSaveCmd cmd); + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java new file mode 100644 index 0000000..18b3a5a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.expert.service; + +import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2023-02-23 + */ +public interface IExpertAvoidCompanyService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java index 5003a20..7b5960a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertUserFullInfoService.java @@ -13,4 +13,12 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IExpertUserFullInfoService extends IService { + + /** + * 查询用户信息 + * + * @param userId 用户ID + * @return / + **/ + ExpertUserFullInfo getByUserId(Long userId); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAvoidCompanyServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAvoidCompanyServiceImpl.java new file mode 100644 index 0000000..4caa943 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertAvoidCompanyServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.expert.service.impl; + +import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; +import com.ningdatech.pmapi.expert.mapper.ExpertAvoidCompanyMapper; +import com.ningdatech.pmapi.expert.service.IExpertAvoidCompanyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2023-02-23 + */ +@Service +public class ExpertAvoidCompanyServiceImpl extends ServiceImpl implements IExpertAvoidCompanyService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java new file mode 100644 index 0000000..8da61e5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java @@ -0,0 +1,219 @@ +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.toolkit.Wrappers; +import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; +import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; +import com.ningdatech.pmapi.expert.constant.ExpertUserInfoStepEnum; +import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; +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.meta.model.entity.ExpertDictionary; +import com.ningdatech.pmapi.meta.model.entity.ExpertTag; +import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; +import com.ningdatech.pmapi.meta.service.IExpertTagService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/7/22 下午4:39 + */ +@Component +@RequiredArgsConstructor +public class ExpertInfoServiceImpl implements ExpertInfoService { + + private final IExpertUserFullInfoService iExpertUserFullInfoService; + + private final IExpertTagService iExpertTagService; + + private final IExpertDictionaryService iExpertDictionaryService; + + private final IExpertAvoidCompanyService iExpertAvoidCompanyService; + + + /** + * 用户第一次申请修改,仅在专家用户状态为applying 状态时调用 + * + * @param cmd + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveExpertInfo(ExpertFullInfoSaveCmd cmd) { + Long userId = cmd.getUserId(); + List expertAvoidCompanyList = cmd.getExpertAvoidCompanyList(); + List expertDictionaryList = cmd.getExpertDictionaryList(); + List expertIntentionWorkRegionInfoList = cmd.getExpertIntentionWorkRegionInfo(); + List expertTagList = cmd.getExpertTagList(); + ExpertUserFullInfoDTO expertUserInfoDTO = cmd.getExpertUserInfoDTO(); + + ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); + + ExpertUserFullInfo saveExpertUserFullInfo = buildSaveExpertUserFullInfo(expertUserInfoDTO); + if (Objects.nonNull(expertUserFullInfo)) { + // 专家信息审核通过之前,所有信息无需备份 + iExpertUserFullInfoService.removeById(expertUserFullInfo.getId()); + // 删除所有专家标签字段 + LambdaQueryWrapper expertTagRemove = Wrappers.lambdaQuery(ExpertTag.class) + .eq(ExpertTag::getUserId, userId); + iExpertTagService.remove(expertTagRemove); + // 删除所有专家字典字段 + LambdaQueryWrapper expertDictionaryRemove = Wrappers.lambdaQuery(ExpertDictionary.class) + .eq(ExpertDictionary::getUserId, userId); + iExpertDictionaryService.remove(expertDictionaryRemove); + // 删除所有专家履职意向申请 + // TODO 补充审核逻辑 +// LambdaQueryWrapper 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 expertAvoidCompanyRemove = Wrappers.lambdaQuery(ExpertAvoidCompany.class) + .eq(ExpertAvoidCompany::getUserId, userId); + iExpertAvoidCompanyService.remove(expertAvoidCompanyRemove); + } + saveExpertUserFullInfo.setUserId(userId); + saveExpertUserFullInfo.setExpertAccountStatus(ExpertAccountStatusEnum.APPLYING.getKey()); + saveExpertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.BASIC_INFORMATION_SUBMITTED.getKey()); + saveExpertUserFullInfo.setUpdateOn(LocalDateTime.now()); + saveExpertUserFullInfo.setCreateOn(LocalDateTime.now()); + iExpertUserFullInfoService.save(saveExpertUserFullInfo); + // 保存所有专家标签字段 + List saveExpertTagList = buildSaveExpertTagList(userId, expertTagList); + if (CollectionUtils.isNotEmpty(saveExpertTagList)) { + iExpertTagService.saveBatch(saveExpertTagList); + } + // 保存所有专家字典字段 + List saveExpertDictionaryList = buildSaveExpertDictionaryList(userId, expertDictionaryList); + if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { + iExpertDictionaryService.saveBatch(saveExpertDictionaryList); + } + // 保存所有专家履职意向申请 + + // TODO 补充审核逻辑 +// List saveExpertIntentionWorkRegionApplyList = buildSaveExpertIntentionWorkRegionApplyList(userId, expertIntentionWorkRegionInfoList); +// if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { +// iExpertMetaApplyService.saveBatch(saveExpertIntentionWorkRegionApplyList); +// } + // 保存所有专家回避单位 + List saveExpertAvoidCompanyList = buildSaveExpertAvoidCompanyList(userId, expertAvoidCompanyList); + if (CollectionUtils.isNotEmpty(saveExpertAvoidCompanyList)) { + iExpertAvoidCompanyService.saveBatch(saveExpertAvoidCompanyList); + } + } + + + private ExpertUserFullInfo buildSaveExpertUserFullInfo(ExpertUserFullInfoDTO expertUserInfoDTO) { + ExpertUserFullInfo expertUserFullInfo = new ExpertUserFullInfo(); + if (Objects.nonNull(expertUserInfoDTO.getIsDingUser())) { + expertUserFullInfo.setIsDingUser(expertUserInfoDTO.getIsDingUser() ? BoolDisplayEnum.Y.name() : BoolDisplayEnum.N.name()); + } + expertUserFullInfo.setPhoneNo(expertUserInfoDTO.getPhoneNo()); + expertUserFullInfo.setGender(expertUserInfoDTO.getGender()); + expertUserFullInfo.setExpertName(expertUserInfoDTO.getName()); + expertUserFullInfo.setAvatarFileId(expertUserInfoDTO.getAvatarFileId()); + expertUserFullInfo.setIdCard(expertUserInfoDTO.getIdCard()); + expertUserFullInfo.setOfficePhone(expertUserInfoDTO.getOfficePhone()); + expertUserFullInfo.setBirth(expertUserInfoDTO.getBirth()); + expertUserFullInfo.setBankNo(expertUserInfoDTO.getBankNo()); + expertUserFullInfo.setBank(expertUserInfoDTO.getBank()); + expertUserFullInfo.setEmail(expertUserInfoDTO.getEmail()); + expertUserFullInfo.setHometown(expertUserInfoDTO.getHometown()); + expertUserFullInfo.setNationality(expertUserInfoDTO.getNationality()); + + expertUserFullInfo.setSchool(expertUserInfoDTO.getSchool()); + expertUserFullInfo.setGraduatedAt(expertUserInfoDTO.getGraduatedAt()); + expertUserFullInfo.setAcademicTitle(expertUserInfoDTO.getAcademicTitle()); + + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getGraduationCertificateFileIdList())) { + expertUserFullInfo.setGraduationCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getGraduationCertificateFileIdList())); + } + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getDegreeCertificateFileIdList())) { + expertUserFullInfo.setDegreeCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getDegreeCertificateFileIdList())); + } + expertUserFullInfo.setRetiredAt(expertUserInfoDTO.getRetiredAt()); + expertUserFullInfo.setCompany(expertUserInfoDTO.getCompany()); + expertUserFullInfo.setLegalEntityCode(expertUserInfoDTO.getLegalEntityCode()); + expertUserFullInfo.setAdministrativeDuties(expertUserInfoDTO.getAdministrativeDuties()); + expertUserFullInfo.setStartWorkAt(expertUserInfoDTO.getStartWorkAt()); + expertUserFullInfo.setAddress(expertUserInfoDTO.getAddress()); + expertUserFullInfo.setExperience(expertUserInfoDTO.getExperience()); + + expertUserFullInfo.setTechnicalTitles(expertUserInfoDTO.getTechnicalTitles()); + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getTitleCertificateFileIdList())) { + expertUserFullInfo.setTitleCertificateFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getTitleCertificateFileIdList())); + } + expertUserFullInfo.setAwards(expertUserInfoDTO.getAwards()); + expertUserFullInfo.setRecognitionReward(expertUserInfoDTO.getRecognitionReward()); + + expertUserFullInfo.setRegionCode(expertUserInfoDTO.getRegionCode()); + expertUserFullInfo.setRegionLevel(expertUserInfoDTO.getRegionLevel()); + if (CollectionUtils.isNotEmpty(expertUserInfoDTO.getRecommendationProofFileIdList())) { + expertUserFullInfo.setRecommendationProofFileIdList(JSONObject.toJSONString(expertUserInfoDTO.getRecommendationProofFileIdList())); + } + expertUserFullInfo.setRemark(expertUserInfoDTO.getRemark()); + return expertUserFullInfo; + } + + + private List buildSaveExpertTagList(Long userId, List expertTagList) { + if (CollectionUtils.isEmpty(expertTagList)) { + return new ArrayList<>(); + } + return expertTagList.stream().map(r -> { + ExpertTag expertTag = new ExpertTag(); + expertTag.setExpertInfoField(r.getExpertInfoField()); + expertTag.setTagCode(r.getTagCode()); + expertTag.setCreateOn(LocalDateTime.now()); + expertTag.setUpdateOn(LocalDateTime.now()); + expertTag.setUserId(userId); + return expertTag; + }).collect(Collectors.toList()); + } + + private List buildSaveExpertDictionaryList(Long userId, List expertDictionaryList) { + if (CollectionUtils.isEmpty(expertDictionaryList)) { + return new ArrayList<>(); + } + return expertDictionaryList.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()); + } + + + private List buildSaveExpertAvoidCompanyList(Long userId, List expertAvoidCompanyList) { + if (CollectionUtils.isEmpty(expertAvoidCompanyList)) { + return new ArrayList<>(); + } + return expertAvoidCompanyList.stream().map(r -> { + ExpertAvoidCompany expertAvoidCompany = new ExpertAvoidCompany(); + expertAvoidCompany.setCompanyName(r.getCompanyName()); + expertAvoidCompany.setUserId(userId); + expertAvoidCompany.setCompanyUniqCode(r.getCompanyUniqCode()); + expertAvoidCompany.setCreateOn(LocalDateTime.now()); + expertAvoidCompany.setUpdateOn(LocalDateTime.now()); + return expertAvoidCompany; + }).collect(Collectors.toList()); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java index 580d087..4b22e1f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertUserFullInfoServiceImpl.java @@ -1,11 +1,17 @@ package com.ningdatech.pmapi.expert.service.impl; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; import com.ningdatech.pmapi.expert.mapper.NdExpertUserFullInfoMapper; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.util.List; + /** *

* 服务实现类 @@ -17,4 +23,9 @@ import org.springframework.stereotype.Service; @Service public class ExpertUserFullInfoServiceImpl extends ServiceImpl implements IExpertUserFullInfoService { + @Override + public ExpertUserFullInfo getByUserId(Long userId) { + return getOne(Wrappers.lambdaQuery().eq(ExpertUserFullInfo::getUserId, userId)); + } + } From 458026a4af7d70531b8901404840c5366a51c06c Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 23 Feb 2023 11:48:52 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8F=91=E9=80=81?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E9=80=9A=E7=9F=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/todocenter/manage/TodoCenterManage.java | 3 +- .../ningdatech/pmapi/beanconfig/BeanConfig.java | 41 ++++++++++++ .../pmapi/todocenter/TodoCenterTest.java | 74 ++++++++++++++++++++-- 3 files changed, 111 insertions(+), 7 deletions(-) create mode 100644 pmapi/src/test/java/com/ningdatech/pmapi/beanconfig/BeanConfig.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 46fd699..07df6a0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -402,7 +402,8 @@ public class TodoCenterManage { String organizationName = dingOrganization.getOrganizationName(); workNoticeInfo.setOrganizationName(organizationName); // 构建唯一的消息ID - String bizMsgId = "ZD_WORK_NOTICE_" + StrUtil.UNDERLINE + organizationCode + StrUtil.UNDERLINE + organizationName + accountId; + String bizMsgId = "ZD_WORK_NOTICE_" + StrUtil.UNDERLINE + organizationCode + StrUtil.UNDERLINE + + organizationName + accountId + StrUtil.UNDERLINE + System.currentTimeMillis(); workNoticeInfo.setBizMsgId(bizMsgId); String receiverUserId = String.valueOf(accountId); workNoticeInfo.setReceiverUserId(receiverUserId); diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/beanconfig/BeanConfig.java b/pmapi/src/test/java/com/ningdatech/pmapi/beanconfig/BeanConfig.java new file mode 100644 index 0000000..d5e6c05 --- /dev/null +++ b/pmapi/src/test/java/com/ningdatech/pmapi/beanconfig/BeanConfig.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.beanconfig; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.task.TaskExecutor; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Component; + +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 发送工作通知线程池配置 + * + * @author CMM + * @since 2023/02/23 09:53 + */ +@EnableAsync +@Configuration +public class BeanConfig { + @Bean + public TaskExecutor executor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + + // 设置核心线程数 + executor.setCorePoolSize(50); + // 设置最大线程数 + executor.setMaxPoolSize(200); + // 设置队列容量 + executor.setQueueCapacity(200); + // 设置线程活跃时间(秒) + executor.setKeepAliveSeconds(800); + // 设置默认线程名称 + executor.setThreadNamePrefix("task-"); + // 设置拒绝策略 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + // 等待所有任务结束后再关闭线程池 + executor.setWaitForTasksToCompleteOnShutdown(true); + return executor; + } +} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java index 4ecc55e..21104b5 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java @@ -1,13 +1,27 @@ package com.ningdatech.pmapi.todocenter; +import com.ningdatech.basic.exception.BizException; import com.ningdatech.pmapi.AppTests; +import com.ningdatech.pmapi.beanconfig.BeanConfig; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; import com.ningdatech.pmapi.user.entity.UserInfo; +import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.zwdd.client.ZwddClient; +import liquibase.pro.packaged.U; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.core.task.TaskExecutor; + +import javax.annotation.Resource; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.function.Supplier; import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.PASS_MSG_TEMPLATE; @@ -21,16 +35,64 @@ import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.PASS_MSG_TEMPL public class TodoCenterTest extends AppTests { @Autowired + private TaskExecutor taskExecutor; + + @Autowired private TodoCenterManage todoCenterManage; @Autowired + private IUserInfoService userInfoService; + + @Autowired private ZwddClient zwddClient; @Test - public void sendWorkNoticeTest(){ - String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0216-7-测试项目"); - log.info("开始发送工作通知"); - zwddClient.sendWorkNotice("846085","0216-8",msg); - // zwddClient.sendWorkNotice("829728","0216-5",msg); - log.info("发送工作通知结束"); + public void sendWorkNoticeTest() { + //String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-00-测试项目"); + //log.info("开始发送工作通知"); + //zwddClient.sendWorkNotice("846085", "0223-00", msg); + //// zwddClient.sendWorkNotice("829728","0216-5",msg); + //log.info("发送工作通知结束"); + + //ApplicationContext ac = new AnnotationConfigApplicationContext(BeanConfig.class); + // + ////若没有指定属性名,则默认为方法名 + //TaskExecutor taskExecutor = (TaskExecutor) ac.getBean("executor"); + + Long userId = 4L; + UserInfo auditUserInfo = userInfoService.getById(userId); + // 获取发送浙政钉工作通知必要信息 + WorkNoticeInfo workNoticeInfo = todoCenterManage.getSendWorkNoticeInfo(auditUserInfo); + String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-01-测试项目"); + + // 先创建1个活动线程的线程池 + ExecutorService executor = Executors.newFixedThreadPool(1); + + // 将发送工作通知交给异步任务Future + CompletableFuture future = CompletableFuture.supplyAsync(() -> { + // 调用浙政钉的接口发送工作通知 + try { + long startTime = System.currentTimeMillis(); + zwddClient.sendWorkNotice(workNoticeInfo.getReceiverUserId(), workNoticeInfo.getBizMsgId(), msg); + log.info("异步任务执行完成, " + workNoticeInfo.getBizMsgId() + " 当前线程:" + Thread.currentThread().getName()); + long endTime = System.currentTimeMillis(); + log.info("方法执行完成返回,耗时:" + (endTime - startTime)); + } catch (Exception e) { + throw new BizException("发送工作通知失败!"); + } + return "task finished!"; + }, executor); + + executor.shutdown(); + + while (executor.isTerminated()) { + String result = null; + try { + result = future.get(); + } catch (Exception e) { + throw new RuntimeException(e); + } + log.info(result); + log.info("发送工作通知成功!"); + } } }