@@ -14,7 +14,7 @@ import org.springframework.stereotype.Controller; | |||||
* @since 2023-02-22 | * @since 2023-02-22 | ||||
*/ | */ | ||||
@Controller | @Controller | ||||
@RequestMapping("/pmapi.expert/nd-expert-user-full-info") | |||||
public class ExpertUserFullInfoController { | |||||
@RequestMapping("/api/v1/expert") | |||||
public class ExpertController { | |||||
} | } |
@@ -3,7 +3,7 @@ package com.ningdatech.pmapi.meta.assembler; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; | import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; | ||||
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | 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 | * @author liuxinxin | ||||
@@ -23,14 +23,14 @@ public class MetaDictionaryAssembler { | |||||
return dictionaryDTO; | 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; | |||||
} | } | ||||
} | } |
@@ -3,7 +3,7 @@ package com.ningdatech.pmapi.meta.assembler; | |||||
import com.ningdatech.pmapi.meta.model.entity.MetaTag; | import com.ningdatech.pmapi.meta.model.entity.MetaTag; | ||||
import com.ningdatech.pmapi.meta.model.dto.TagDTO; | import com.ningdatech.pmapi.meta.model.dto.TagDTO; | ||||
import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; | 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 org.apache.commons.collections4.CollectionUtils; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
@@ -43,20 +43,20 @@ public class MetaTagAssembler { | |||||
return tagTreeDTO; | return tagTreeDTO; | ||||
} | } | ||||
public static List<TagTreeVO> toTagTreeVOList(List<TagTreeDTO> tagTreeDTOList) { | |||||
List<TagTreeVO> tagTreeVOList = new ArrayList<>(); | |||||
public static List<ResTagTreeVO> toTagTreeVOList(List<TagTreeDTO> tagTreeDTOList) { | |||||
List<ResTagTreeVO> resTagTreeVOList = new ArrayList<>(); | |||||
for (TagTreeDTO tagTreeDTO : tagTreeDTOList) { | 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())) { | 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; | |||||
} | } | ||||
} | } |
@@ -1,20 +0,0 @@ | |||||
package com.ningdatech.pmapi.meta.controller; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.stereotype.Controller; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Controller | |||||
@RequestMapping("/pmapi.dictionary/expert-dictionary") | |||||
public class ExpertDictionaryController { | |||||
} |
@@ -1,20 +0,0 @@ | |||||
package com.ningdatech.pmapi.meta.controller; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.stereotype.Controller; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Controller | |||||
@RequestMapping("/pmapi.tag/expert-tag") | |||||
public class ExpertTagController { | |||||
} |
@@ -1,20 +0,0 @@ | |||||
package com.ningdatech.pmapi.meta.controller; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.stereotype.Controller; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Controller | |||||
@RequestMapping("/pmapi.dictionary/meta-dictionary") | |||||
public class MetaDictionaryController { | |||||
} |
@@ -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; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @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<ResDictionaryListVO> expertDictList(@RequestBody ReqDictionaryListPO request) { | |||||
DictionaryRequestValidator.dictionaryRequestValidator(request); | |||||
return metaManage.getDictionaryList(request); | |||||
} | |||||
@PostMapping("/common/list") | |||||
@ApiOperation("通用字典筛选数据返回") | |||||
public List<ResDictionaryListVO> 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); | |||||
} | |||||
} |
@@ -1,20 +0,0 @@ | |||||
package com.ningdatech.pmapi.meta.controller; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.stereotype.Controller; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-02-22 | |||||
*/ | |||||
@Controller | |||||
@RequestMapping("/pmapi.tag/meta-tag") | |||||
public class MetaTagController { | |||||
} |
@@ -2,12 +2,12 @@ package com.ningdatech.pmapi.meta.controller; | |||||
import com.ningdatech.pmapi.meta.manage.MetaManage; | 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.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 com.ningdatech.pmapi.meta.validate.TagListRequestValidator; | ||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
@@ -46,7 +46,7 @@ public class MetaTagManageController { | |||||
@PostMapping("/tag") | @PostMapping("/tag") | ||||
@ApiOperation("获取专家标签的树状结构") | @ApiOperation("获取专家标签的树状结构") | ||||
public List<TagTreeVO> getRegionTree(HttpServletResponse response, @RequestBody ReqTagListPO request) { | |||||
public List<ResTagTreeVO> getRegionTree(HttpServletResponse response, @RequestBody ReqTagListPO request) { | |||||
response.setHeader("Cache-Control", MAX_AGE_STR); | response.setHeader("Cache-Control", MAX_AGE_STR); | ||||
TagListRequestValidator.tagListRequestValidator(request); | TagListRequestValidator.tagListRequestValidator(request); | ||||
return metaManage.getTagTree(request); | return metaManage.getTagTree(request); | ||||
@@ -54,19 +54,19 @@ public class MetaTagManageController { | |||||
@PostMapping("/tag/query") | @PostMapping("/tag/query") | ||||
@ApiOperation("标签查询接口") | @ApiOperation("标签查询接口") | ||||
public List<TagListVO> tagQuery(@Valid @RequestBody TagQueryRequest tagQueryRequest) { | |||||
return metaManage.tagQuery(tagQueryRequest); | |||||
public List<ResTagListVO> tagQuery(@Valid @RequestBody ReqTagQueryPO reqTagQueryPO) { | |||||
return metaManage.tagQuery(reqTagQueryPO); | |||||
} | } | ||||
@PostMapping("/tag-tyoe/list") | @PostMapping("/tag-tyoe/list") | ||||
@ApiOperation("获取标签分类列表") | @ApiOperation("获取标签分类列表") | ||||
public List<TagTypeVO> tagTypeList() { | |||||
public List<ResTagTypeVO> tagTypeList() { | |||||
return metaManage.tagTypeList(); | return metaManage.tagTypeList(); | ||||
} | } | ||||
@PostMapping("/add/tag-type") | @PostMapping("/add/tag-type") | ||||
@ApiOperation("新增标签分类") | @ApiOperation("新增标签分类") | ||||
public void addTagType(@Valid @RequestBody AddTagTypeRequest request) { | |||||
public void addTagType(@Valid @RequestBody ReqAddTagTypePO request) { | |||||
metaManage.addTagType(request); | metaManage.addTagType(request); | ||||
} | } | ||||
@@ -10,24 +10,24 @@ import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; | import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; | ||||
import com.ningdatech.pmapi.common.util.BizUtils; | 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.MetaDictionaryAssembler; | ||||
import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; | import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler; | ||||
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; | import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; | ||||
import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; | import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; | ||||
import com.ningdatech.pmapi.meta.constant.TagConst; | 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.DictionaryCache; | ||||
import com.ningdatech.pmapi.meta.helper.TagCache; | import com.ningdatech.pmapi.meta.helper.TagCache; | ||||
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | ||||
import com.ningdatech.pmapi.meta.model.dto.TagTreeDTO; | 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.po.*; | ||||
import com.ningdatech.pmapi.meta.model.vo.*; | 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.IExpertTagService; | ||||
import com.ningdatech.pmapi.meta.service.IMetaDictionaryService; | |||||
import com.ningdatech.pmapi.meta.service.IMetaTagService; | import com.ningdatech.pmapi.meta.service.IMetaTagService; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
@@ -45,7 +45,6 @@ import java.util.stream.Collectors; | |||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
public class MetaManage { | public class MetaManage { | ||||
// private final RegionCache regionCache; | |||||
private final DictionaryCache dictionaryCache; | private final DictionaryCache dictionaryCache; | ||||
private final TagCache tagCache; | private final TagCache tagCache; | ||||
private final IMetaDictionaryService metaDictionaryManageService; | private final IMetaDictionaryService metaDictionaryManageService; | ||||
@@ -53,40 +52,35 @@ public class MetaManage { | |||||
private final IMetaTagService iMetaTagManageService; | private final IMetaTagService iMetaTagManageService; | ||||
private final IExpertTagService iExpertTagService; | private final IExpertTagService iExpertTagService; | ||||
// public List<RegionTreeVO> getRegionTree() { | |||||
// List<RegionTreeDTO> regionTreeDtos = regionCache.getAll(); | |||||
// return MetaRegionAssembler.toRegionTreeVOList(regionTreeDtos); | |||||
// } | |||||
public List<DictionaryListVO> getDictionaryList(DictionaryListRequest request) { | |||||
public List<ResDictionaryListVO> getDictionaryList(ReqDictionaryListPO request) { | |||||
List<String> dictionaryTypeList = request.getDictionaryTypeList(); | List<String> dictionaryTypeList = request.getDictionaryTypeList(); | ||||
if (CollectionUtils.isEmpty(dictionaryTypeList)) { | if (CollectionUtils.isEmpty(dictionaryTypeList)) { | ||||
dictionaryTypeList = DictExpertInfoTypeEnum.getAll(); | dictionaryTypeList = DictExpertInfoTypeEnum.getAll(); | ||||
} | } | ||||
List<DictionaryListVO> dictionaryListVos = new ArrayList<>(); | |||||
List<ResDictionaryListVO> resDictionaryListVos = new ArrayList<>(); | |||||
for (String dictionaryType : dictionaryTypeList) { | for (String dictionaryType : dictionaryTypeList) { | ||||
DictionaryListVO dictionaryListVO = new DictionaryListVO(); | |||||
dictionaryListVO.setDictionaryName(dictionaryType); | |||||
ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); | |||||
resDictionaryListVO.setDictionaryName(dictionaryType); | |||||
List<DictionaryDTO> dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); | List<DictionaryDTO> dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); | ||||
List<DictionaryVO> dictionaryVOList = dictionaryList.stream() | |||||
List<ResDictionaryVO> resDictionaryVOList = dictionaryList.stream() | |||||
.map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); | .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); | ||||
dictionaryListVO.setDictionaryList(dictionaryVOList); | |||||
dictionaryListVos.add(dictionaryListVO); | |||||
resDictionaryListVO.setDictionaryList(resDictionaryVOList); | |||||
resDictionaryListVos.add(resDictionaryListVO); | |||||
} | } | ||||
return dictionaryListVos; | |||||
return resDictionaryListVos; | |||||
} | } | ||||
public List<DictionaryListVO> commonDictList(DictionaryListRequest request) { | |||||
List<DictionaryListVO> result = new ArrayList<>(); | |||||
public List<ResDictionaryListVO> commonDictList(ReqDictionaryListPO request) { | |||||
List<ResDictionaryListVO> result = new ArrayList<>(); | |||||
if (request.getAllDict()) { | if (request.getAllDict()) { | ||||
Map<String, List<MetaDictionary>> groupByType = CollUtils.group(metaDictionaryManageService.list(), MetaDictionary::getDictionaryType); | Map<String, List<MetaDictionary>> groupByType = CollUtils.group(metaDictionaryManageService.list(), MetaDictionary::getDictionaryType); | ||||
groupByType.forEach((k, v) -> { | groupByType.forEach((k, v) -> { | ||||
DictionaryListVO dictionaryListVO = new DictionaryListVO(); | |||||
dictionaryListVO.setDictionaryName(k); | |||||
List<DictionaryVO> dictionaryVOList = v.stream() | |||||
ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); | |||||
resDictionaryListVO.setDictionaryName(k); | |||||
List<ResDictionaryVO> resDictionaryVOList = v.stream() | |||||
.map(w -> { | .map(w -> { | ||||
DictionaryVO vo = new DictionaryVO(); | |||||
ResDictionaryVO vo = new ResDictionaryVO(); | |||||
vo.setDescribe(w.getDictionaryDescribe()); | vo.setDescribe(w.getDictionaryDescribe()); | ||||
vo.setDictionaryCode(w.getDictionaryCode()); | vo.setDictionaryCode(w.getDictionaryCode()); | ||||
vo.setDictionaryType(w.getDictionaryType()); | vo.setDictionaryType(w.getDictionaryType()); | ||||
@@ -95,25 +89,25 @@ public class MetaManage { | |||||
vo.setSortValue(w.getSortValue()); | vo.setSortValue(w.getSortValue()); | ||||
return vo; | return vo; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
dictionaryListVO.setDictionaryList(dictionaryVOList); | |||||
result.add(dictionaryListVO); | |||||
resDictionaryListVO.setDictionaryList(resDictionaryVOList); | |||||
result.add(resDictionaryListVO); | |||||
}); | }); | ||||
} else { | } else { | ||||
List<String> dictionaryTypeList = request.getDictionaryTypeList(); | List<String> dictionaryTypeList = request.getDictionaryTypeList(); | ||||
for (String dictionaryType : dictionaryTypeList) { | for (String dictionaryType : dictionaryTypeList) { | ||||
DictionaryListVO dictionaryListVO = new DictionaryListVO(); | |||||
dictionaryListVO.setDictionaryName(dictionaryType); | |||||
ResDictionaryListVO resDictionaryListVO = new ResDictionaryListVO(); | |||||
resDictionaryListVO.setDictionaryName(dictionaryType); | |||||
List<DictionaryDTO> dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); | List<DictionaryDTO> dictionaryList = dictionaryCache.getDictionaryListByDictionaryType(dictionaryType); | ||||
List<DictionaryVO> dictionaryVOList = dictionaryList.stream() | |||||
List<ResDictionaryVO> resDictionaryVOList = dictionaryList.stream() | |||||
.map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); | .map(MetaDictionaryAssembler::toDictionaryVO).collect(Collectors.toList()); | ||||
dictionaryListVO.setDictionaryList(dictionaryVOList); | |||||
result.add(dictionaryListVO); | |||||
resDictionaryListVO.setDictionaryList(resDictionaryVOList); | |||||
result.add(resDictionaryListVO); | |||||
} | } | ||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
public List<TagTreeVO> getTagTree(ReqTagListPO request) { | |||||
public List<ResTagTreeVO> getTagTree(ReqTagListPO request) { | |||||
List<String> rootTagCodeList = request.getRootTagCodeList(); | List<String> rootTagCodeList = request.getRootTagCodeList(); | ||||
if (CollectionUtils.isEmpty(rootTagCodeList)) { | if (CollectionUtils.isEmpty(rootTagCodeList)) { | ||||
rootTagCodeList = ExpertTagEnum.getAll(); | rootTagCodeList = ExpertTagEnum.getAll(); | ||||
@@ -132,17 +126,17 @@ public class MetaManage { | |||||
/** | /** | ||||
* 专家管理员才能调用 | * 专家管理员才能调用 | ||||
* | * | ||||
* @param addDictionaryRequest | |||||
* @param reqAddDictionaryPO | |||||
*/ | */ | ||||
@Transactional(rollbackFor = Exception.class) | @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); | boolean contains = DictExpertInfoTypeEnum.contains(dictionaryType); | ||||
if (!contains) { | if (!contains) { | ||||
throw BizException.wrap("无效的专家字典类型:%s", dictionaryType); | throw BizException.wrap("无效的专家字典类型:%s", dictionaryType); | ||||
} | } | ||||
String name = addDictionaryRequest.getName(); | |||||
Integer sortValue = addDictionaryRequest.getSortValue(); | |||||
String name = reqAddDictionaryPO.getName(); | |||||
Integer sortValue = reqAddDictionaryPO.getSortValue(); | |||||
LambdaQueryWrapper<MetaDictionary> eq = Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType); | LambdaQueryWrapper<MetaDictionary> eq = Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType); | ||||
List<MetaDictionary> dictionaryManageList = metaDictionaryManageService.list(eq); | List<MetaDictionary> dictionaryManageList = metaDictionaryManageService.list(eq); | ||||
@@ -187,7 +181,7 @@ public class MetaManage { | |||||
metaDictionaryManageService.removeById(one); | metaDictionaryManageService.removeById(one); | ||||
} | } | ||||
public void addTagType(AddTagTypeRequest request) { | |||||
public void addTagType(ReqAddTagTypePO request) { | |||||
String tagName = request.getTagName(); | String tagName = request.getTagName(); | ||||
LambdaQueryWrapper<MetaTag> in = Wrappers.lambdaQuery(MetaTag.class) | LambdaQueryWrapper<MetaTag> in = Wrappers.lambdaQuery(MetaTag.class) | ||||
.in(MetaTag::getTagName, tagName) | .in(MetaTag::getTagName, tagName) | ||||
@@ -225,21 +219,21 @@ public class MetaManage { | |||||
} | } | ||||
} | } | ||||
public List<TagTypeVO> tagTypeList() { | |||||
public List<ResTagTypeVO> tagTypeList() { | |||||
LambdaQueryWrapper<MetaTag> eq = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); | LambdaQueryWrapper<MetaTag> eq = Wrappers.lambdaQuery(MetaTag.class).eq(MetaTag::getParentCode, TagConst.TAG_ROOT_PARENT_CODE); | ||||
List<MetaTag> list = iMetaTagManageService.list(eq); | List<MetaTag> list = iMetaTagManageService.list(eq); | ||||
return list.stream().map(r -> { | 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()); | }).collect(Collectors.toList()); | ||||
} | } | ||||
public List<TagListVO> tagQuery(TagQueryRequest tagQueryRequest) { | |||||
String parentCode = tagQueryRequest.getParentCode(); | |||||
public List<ResTagListVO> tagQuery(ReqTagQueryPO reqTagQueryPO) { | |||||
String parentCode = reqTagQueryPO.getParentCode(); | |||||
if (StringUtils.isBlank(parentCode)) { | if (StringUtils.isBlank(parentCode)) { | ||||
parentCode = TagConst.TAG_ROOT_PARENT_CODE; | parentCode = TagConst.TAG_ROOT_PARENT_CODE; | ||||
} | } | ||||
@@ -263,27 +257,27 @@ public class MetaManage { | |||||
Map<String, List<MetaTag>> finalHasChildrenMap = hasChildrenMap; | Map<String, List<MetaTag>> finalHasChildrenMap = hasChildrenMap; | ||||
Map<String, List<ExpertTag>> finalUseFrequencyMap = useFrequencyMap; | Map<String, List<ExpertTag>> finalUseFrequencyMap = useFrequencyMap; | ||||
return list.stream().map(r -> { | 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<MetaTag> metaTagManages = finalHasChildrenMap.get(r.getTagCode()); | List<MetaTag> metaTagManages = finalHasChildrenMap.get(r.getTagCode()); | ||||
if (CollUtil.isNotEmpty(metaTagManages)) { | if (CollUtil.isNotEmpty(metaTagManages)) { | ||||
tagListVO.setIsLeaf(false); | |||||
tagListVO.setHasChildren(true); | |||||
resTagListVO.setIsLeaf(false); | |||||
resTagListVO.setHasChildren(true); | |||||
} else { | } else { | ||||
tagListVO.setIsLeaf(true); | |||||
tagListVO.setHasChildren(false); | |||||
resTagListVO.setIsLeaf(true); | |||||
resTagListVO.setHasChildren(false); | |||||
} | } | ||||
long useFrequency = 0; | long useFrequency = 0; | ||||
List<ExpertTag> expertTagList = finalUseFrequencyMap.get(r.getTagCode()); | List<ExpertTag> expertTagList = finalUseFrequencyMap.get(r.getTagCode()); | ||||
if (CollUtil.isNotEmpty(expertTagList)) { | if (CollUtil.isNotEmpty(expertTagList)) { | ||||
useFrequency = expertTagList.size(); | useFrequency = expertTagList.size(); | ||||
} | } | ||||
tagListVO.setUseFrequency(useFrequency); | |||||
return tagListVO; | |||||
resTagListVO.setUseFrequency(useFrequency); | |||||
return resTagListVO; | |||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
} | } | ||||
} | } |
@@ -1,11 +1,11 @@ | |||||
package com.ningdatech.pmapi.meta.mapper; | package com.ningdatech.pmapi.meta.mapper; | ||||
import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
import com.ningdatech.pmapi.meta.model.entity.MetaDictionary; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* Mapper 接口 | |||||
* Mapper 接口 | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author Liuxinxin | * @author Liuxinxin | ||||
@@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull; | |||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel("新增字典值") | @ApiModel("新增字典值") | ||||
public class AddDictionaryRequest { | |||||
public class ReqAddDictionaryPO { | |||||
@ApiModelProperty(value = "字典类型") | @ApiModelProperty(value = "字典类型") | ||||
@NotBlank | @NotBlank |
@@ -12,7 +12,7 @@ import javax.validation.constraints.NotBlank; | |||||
*/ | */ | ||||
@ApiModel(description = "新增标签分类") | @ApiModel(description = "新增标签分类") | ||||
@Data | @Data | ||||
public class AddTagTypeRequest { | |||||
public class ReqAddTagTypePO { | |||||
@ApiModelProperty("标签分类名") | @ApiModelProperty("标签分类名") | ||||
@NotBlank | @NotBlank |
@@ -9,7 +9,7 @@ import java.util.List; | |||||
* @date 2022/7/21 下午6:05 | * @date 2022/7/21 下午6:05 | ||||
*/ | */ | ||||
@Data | @Data | ||||
public class DictionaryListRequest { | |||||
public class ReqDictionaryListPO { | |||||
private List<String> dictionaryTypeList; | private List<String> dictionaryTypeList; | ||||
@@ -10,7 +10,7 @@ import lombok.Data; | |||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel(description = "标签查询request") | @ApiModel(description = "标签查询request") | ||||
public class TagQueryRequest { | |||||
public class ReqTagQueryPO { | |||||
// | // | ||||
// @ApiModelProperty("标签类型") | // @ApiModelProperty("标签类型") | ||||
// private Long tagType; | // private Long tagType; |
@@ -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<String> rootTagCodeList; | |||||
} |
@@ -14,12 +14,12 @@ import java.util.List; | |||||
@Data | @Data | ||||
@ToString(callSuper = true) | @ToString(callSuper = true) | ||||
@ApiModel(value = "DictionaryListVO", description = "字典列表结构VO") | @ApiModel(value = "DictionaryListVO", description = "字典列表结构VO") | ||||
public class DictionaryListVO { | |||||
public class ResDictionaryListVO { | |||||
@ApiModelProperty(value = "字典名称") | @ApiModelProperty(value = "字典名称") | ||||
private String dictionaryName; | private String dictionaryName; | ||||
@ApiModelProperty(value = "字典选项名称") | @ApiModelProperty(value = "字典选项名称") | ||||
private List<DictionaryVO> dictionaryList; | |||||
private List<ResDictionaryVO> dictionaryList; | |||||
} | } |
@@ -10,7 +10,7 @@ import lombok.Data; | |||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel(value = "DictionaryListVO", description = "字典结构VO") | @ApiModel(value = "DictionaryListVO", description = "字典结构VO") | ||||
public class DictionaryVO { | |||||
public class ResDictionaryVO { | |||||
@ApiModelProperty(value = "字典类型") | @ApiModelProperty(value = "字典类型") |
@@ -12,7 +12,7 @@ import java.time.LocalDateTime; | |||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel(description = "标签列表展示") | @ApiModel(description = "标签列表展示") | ||||
public class TagListVO { | |||||
public class ResTagListVO { | |||||
@ApiModelProperty(value = "标签 编码") | @ApiModelProperty(value = "标签 编码") | ||||
private String tagCode; | private String tagCode; |
@@ -14,7 +14,7 @@ import java.util.List; | |||||
@Data | @Data | ||||
@ToString(callSuper = true) | @ToString(callSuper = true) | ||||
@ApiModel(value = "TagTreeVO", description = "标签树状结构VO") | @ApiModel(value = "TagTreeVO", description = "标签树状结构VO") | ||||
public class TagTreeVO { | |||||
public class ResTagTreeVO { | |||||
/** | /** | ||||
* 标签 编码 | * 标签 编码 | ||||
@@ -51,7 +51,7 @@ public class TagTreeVO { | |||||
private String parentCode; | private String parentCode; | ||||
@ApiModelProperty(value = "子节点标签") | @ApiModelProperty(value = "子节点标签") | ||||
private List<TagTreeVO> children; | |||||
private List<ResTagTreeVO> children; | |||||
@ApiModelProperty(value = "联合唯一字段方便页面使用(tagName##tagCode)") | @ApiModelProperty(value = "联合唯一字段方便页面使用(tagName##tagCode)") | ||||
private String unionCode; | private String unionCode; |
@@ -10,7 +10,7 @@ import lombok.Data; | |||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel(description = "标签类型VO") | @ApiModel(description = "标签类型VO") | ||||
public class TagTypeVO { | |||||
public class ResTagTypeVO { | |||||
@ApiModelProperty(value = "标签编码") | @ApiModelProperty(value = "标签编码") | ||||
private String tagCode; | private String tagCode; |
@@ -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<String> dictionaryTypeList = reqDictionaryListPO.getDictionaryTypeList(); | |||||
if (CollectionUtils.isNotEmpty(dictionaryTypeList)) { | |||||
for (String dictionaryType : dictionaryTypeList) { | |||||
if (!DictExpertInfoTypeEnum.contains(dictionaryType)) { | |||||
throw new BizException("Illegal dictionaryType: " + dictionaryType); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |