@@ -63,7 +63,7 @@ public abstract class AbstractRegionCacheHelper implements InitializingBean { | |||||
return RegionConverter.toRegionDTO(region); | return RegionConverter.toRegionDTO(region); | ||||
}); | }); | ||||
// 初始化所有区域数据到缓存 | // 初始化所有区域数据到缓存 | ||||
// initRegionCache(); | |||||
initRegionCache(); | |||||
} | } | ||||
} | } |
@@ -52,16 +52,16 @@ public class MeetingController { | |||||
return meetingManage.expertCountOnChange(po); | return meetingManage.expertCountOnChange(po); | ||||
} | } | ||||
@ApiOperation("专家抽取员会议列表") | |||||
@GetMapping("/meetingListByManager") | |||||
@WebLog(value = "专家抽取员事务列表") | |||||
public PageVo<MeetingByManagerVO> meetingListByManager(MeetingListReq po) { | |||||
return meetingManage.meetingListByManager(po); | |||||
@ApiOperation("管理员会议列表") | |||||
@GetMapping("/manager/meetingList") | |||||
@WebLog(value = "管理员会议列表") | |||||
public PageVo<MeetingByManagerVO> meetingListByManager(MeetingListReq req) { | |||||
return meetingManage.meetingListByManager(req); | |||||
} | } | ||||
@ApiOperation("履职记录 | 专家会议列表") | |||||
@GetMapping("/meetingListByExpert") | |||||
@WebLog(value = "履职记录 | 专家会议列表") | |||||
@ApiOperation("专家会议列表") | |||||
@GetMapping("/expert/meetingList") | |||||
@WebLog(value = "专家会议列表") | |||||
public PageVo<MeetingByManagerVO> meetingListByExpert(MeetingListReq po) { | public PageVo<MeetingByManagerVO> meetingListByExpert(MeetingListReq po) { | ||||
return meetingManage.meetingListByExpert(po); | return meetingManage.meetingListByExpert(po); | ||||
} | } | ||||
@@ -62,8 +62,8 @@ public class Meeting implements Serializable { | |||||
private Integer status; | private Integer status; | ||||
@ApiModelProperty("是否停止随机邀请") | |||||
private Boolean inviteStopped; | |||||
@ApiModelProperty("抽取状态") | |||||
private Boolean inviteStatus; | |||||
@ApiModelProperty("是否确认名单") | @ApiModelProperty("是否确认名单") | ||||
private Boolean confirmedRoster; | private Boolean confirmedRoster; | ||||
@@ -22,28 +22,28 @@ import java.time.LocalDateTime; | |||||
@EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||
public class MeetingListReq extends PagePo { | public class MeetingListReq extends PagePo { | ||||
@ApiModelProperty("事务名称") | |||||
@ApiModelProperty("会议名称") | |||||
private String name; | private String name; | ||||
@ApiModelProperty("事务开始时间") | |||||
@ApiModelProperty("会议开始时间") | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||||
private LocalDateTime startTime; | private LocalDateTime startTime; | ||||
@ApiModelProperty("事务结束时间") | |||||
@ApiModelProperty("会议结束时间") | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||||
private LocalDateTime endTime; | private LocalDateTime endTime; | ||||
@ApiModelProperty("地点") | |||||
private String address; | |||||
@ApiModelProperty("事务状态:1 未完成、2 已完成、3 已取消\n" + | @ApiModelProperty("事务状态:1 未完成、2 已完成、3 已取消\n" + | ||||
"专家参与状态:1 待参加、2 已参加、3 已请假") | "专家参与状态:1 待参加、2 已参加、3 已请假") | ||||
private Integer status; | private Integer status; | ||||
@ApiModelProperty("事务类型") | |||||
private String type; | |||||
@ApiModelProperty("会议类型") | |||||
private String meetingType; | |||||
@ApiModelProperty("专家ID") | @ApiModelProperty("专家ID") | ||||
private Long expertId; | private Long expertId; | ||||
@ApiModelProperty("项目名称") | |||||
private String projectName; | |||||
} | } |
@@ -26,51 +26,39 @@ public class MeetingByManagerVO { | |||||
public MeetingByManagerVO() { | public MeetingByManagerVO() { | ||||
} | } | ||||
@ApiModelProperty("事务ID") | |||||
private Long id; | |||||
@ApiModelProperty("会议ID") | |||||
private Long meetingId; | |||||
@ApiModelProperty("事务状态") | |||||
private Integer status; | |||||
@ApiModelProperty("会议参加状态:1 待参加、2 已参加、3 已请假") | |||||
private Integer attendStatus; | |||||
@ApiModelProperty("事务名称") | |||||
private String name; | |||||
@ApiModelProperty("联系人") | |||||
private String connecter; | |||||
@ApiModelProperty("联系方式") | |||||
private String contact; | |||||
@ApiModelProperty("会议地址详情") | |||||
private String meetingAddress; | |||||
@ApiModelProperty("事务类型编码") | |||||
private String dateType; | |||||
@ApiModelProperty("事务类型名称") | |||||
private String dateTypeName; | |||||
@ApiModelProperty("事务开始时间") | |||||
@ApiModelProperty("会议开始时间") | |||||
@JSONField(format = "yyyy-MM-dd HH:mm") | @JSONField(format = "yyyy-MM-dd HH:mm") | ||||
private LocalDateTime startTime; | private LocalDateTime startTime; | ||||
@ApiModelProperty("事务结束时间") | |||||
@ApiModelProperty("会议结束时间") | |||||
@JSONField(format = "yyyy-MM-dd HH:mm") | @JSONField(format = "yyyy-MM-dd HH:mm") | ||||
private LocalDateTime endTime; | private LocalDateTime endTime; | ||||
@ApiModelProperty("邀请人数") | |||||
private Integer inviteCount; | |||||
@ApiModelProperty("会议状态") | |||||
private Integer status; | |||||
@ApiModelProperty("抽取类型") | |||||
private Integer inviteType; | |||||
@ApiModelProperty("抽取状态") | |||||
private Boolean inviteStatus; | |||||
@ApiModelProperty("名单确认状态") | |||||
private Boolean confirmedRoster; | |||||
@ApiModelProperty("会议参加状态:1 待参加、2 已参加、3 已请假") | |||||
private Integer attendStatus; | |||||
@ApiModelProperty("确认人数") | |||||
private Integer confirmCount; | |||||
@ApiModelProperty("会议名称") | |||||
private String meetingName; | |||||
@ApiModelProperty("是否进行了专家抽取:true 是、false 否") | |||||
private Boolean invited; | |||||
@ApiModelProperty("会议类型编码") | |||||
private String meetingType; | |||||
@ApiModelProperty("抽取单位") | |||||
private String holdOrg; | |||||
@ApiModelProperty("会议类型名称") | |||||
private String meetingTypeName; | |||||
} | } |
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.pmapi.common.util.BizUtils; | import com.ningdatech.pmapi.common.util.BizUtils; | ||||
import com.ningdatech.pmapi.common.util.StrUtils; | |||||
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; | import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; | ||||
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; | import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; | ||||
import com.ningdatech.pmapi.expert.service.ExpertInfoService; | import com.ningdatech.pmapi.expert.service.ExpertInfoService; | ||||
@@ -24,14 +25,12 @@ import com.ningdatech.pmapi.meeting.service.IExpertInviteAvoidRuleService; | |||||
import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService; | import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService; | ||||
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; | import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; | ||||
import com.ningdatech.pmapi.meta.helper.DictionaryCache; | import com.ningdatech.pmapi.meta.helper.DictionaryCache; | ||||
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO; | |||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import org.apache.commons.collections4.CollectionUtils; | import org.apache.commons.collections4.CollectionUtils; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.util.Collection; | |||||
import java.util.Comparator; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.*; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -73,32 +72,39 @@ public class MeetingManageHelper { | |||||
} | } | ||||
public MeetingByManagerVO buildByMeeting(Meeting meeting) { | public MeetingByManagerVO buildByMeeting(Meeting meeting) { | ||||
DictionaryDTO dict = dictionaryCache.getByCode(meeting.getType()); | |||||
return MeetingByManagerVO.builder() | return MeetingByManagerVO.builder() | ||||
.id(meeting.getId()) | |||||
.dateTypeName(dictionaryCache.getByCode(meeting.getType()).getName()) | |||||
.meetingAddress(meeting.getMeetingAddress()) | |||||
.name(meeting.getName()) | |||||
.meetingId(meeting.getId()) | |||||
.meetingTypeName(dict == null ? "" : dict.getName()) | |||||
.meetingName(meeting.getName()) | |||||
.startTime(meeting.getStartTime()) | .startTime(meeting.getStartTime()) | ||||
.endTime(meeting.getEndTime()) | .endTime(meeting.getEndTime()) | ||||
.connecter(meeting.getConnecter()) | |||||
.contact(meeting.getContact()) | |||||
.inviteType(meeting.getInviteType()) | |||||
.confirmedRoster(meeting.getConfirmedRoster()) | |||||
.inviteStatus(meeting.getInviteStatus()) | |||||
.status(meeting.getStatus()) | .status(meeting.getStatus()) | ||||
.holdOrg(meeting.getHoldOrg()) | |||||
.build(); | .build(); | ||||
} | } | ||||
public void buildMeetingQuery(LambdaQueryWrapper<Meeting> query, MeetingListReq po) { | |||||
if (StrUtil.isNotBlank(po.getName())) { | |||||
query.like(Meeting::getName, po.getName()); | |||||
public void buildMeetingQuery(LambdaQueryWrapper<Meeting> query, MeetingListReq req) { | |||||
if (StrUtil.isNotBlank(req.getName())) { | |||||
query.like(Meeting::getName, req.getName()); | |||||
} | } | ||||
if (StrUtil.isNotBlank(po.getType())) { | |||||
query.eq(Meeting::getType, po.getType()); | |||||
if (StrUtil.isNotBlank(req.getMeetingType())) { | |||||
query.eq(Meeting::getType, req.getMeetingType()); | |||||
} | } | ||||
if (po.getStartTime() != null) { | |||||
query.ge(Meeting::getStartTime, po.getStartTime()); | |||||
if (req.getStartTime() != null) { | |||||
query.ge(Meeting::getStartTime, req.getStartTime()); | |||||
} | } | ||||
if (po.getEndTime() != null) { | |||||
query.le(Meeting::getEndTime, po.getEndTime()); | |||||
if (req.getEndTime() != null) { | |||||
query.le(Meeting::getEndTime, req.getEndTime()); | |||||
} | |||||
if (StrUtils.isNotBlank(req.getProjectName())) { | |||||
String projectName = "%" + req.getProjectName() + "%"; | |||||
query.and(q1 -> q1.exists("select 1 from nd_project np inner join meeting_inner_project mip on mip.project_id = np.id" + | |||||
" where mip.meeting_id = meeting.id and np.project_name like {0}", projectName) | |||||
.or(q2 -> q2.exists("select 1 from meeting_outer_project mop where mop.meeting_id = meeting.id" + | |||||
"and mop.project_name like {0}", projectName))); | |||||
} | } | ||||
} | } | ||||
@@ -111,7 +111,7 @@ public class MeetingManage { | |||||
meeting.setHoldOrgCode(userDetail.getOrganizationCode()); | meeting.setHoldOrgCode(userDetail.getOrganizationCode()); | ||||
meeting.setRegionCode(userDetail.getRegionCode()); | meeting.setRegionCode(userDetail.getRegionCode()); | ||||
meeting.setCreator(userDetail.getUsername()); | meeting.setCreator(userDetail.getUsername()); | ||||
meeting.setInviteStopped(Boolean.FALSE); | |||||
meeting.setInviteStatus(Boolean.FALSE); | |||||
meeting.setConfirmedRoster(Boolean.FALSE); | meeting.setConfirmedRoster(Boolean.FALSE); | ||||
meeting.setInviteType(inviteRule.getInviteType()); | meeting.setInviteType(inviteRule.getInviteType()); | ||||
meetingService.save(meeting); | meetingService.save(meeting); | ||||
@@ -166,7 +166,7 @@ public class MeetingManage { | |||||
expertInviteManage.expertRandomInviteByMeetingCreate(meeting, randomRules, avoidInfo); | expertInviteManage.expertRandomInviteByMeetingCreate(meeting, randomRules, avoidInfo); | ||||
expertInviteTask.addInviteExpertTaskByMeetingCreate(meeting.getId(), 5); | expertInviteTask.addInviteExpertTaskByMeetingCreate(meeting.getId(), 5); | ||||
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class); | LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class); | ||||
update.set(Meeting::getInviteStopped, false); | |||||
update.set(Meeting::getInviteStatus, false); | |||||
update.eq(Meeting::getId, meeting.getId()); | update.eq(Meeting::getId, meeting.getId()); | ||||
meetingService.update(update); | meetingService.update(update); | ||||
// 回避规则 | // 回避规则 | ||||
@@ -271,37 +271,26 @@ public class MeetingManage { | |||||
/** | /** | ||||
* 管理员会议列表 | * 管理员会议列表 | ||||
* | * | ||||
* @param po 查询参数 | |||||
* @param req 查询参数 | |||||
* @return 会议列表 | * @return 会议列表 | ||||
* @author WendyYang | * @author WendyYang | ||||
*/ | */ | ||||
public PageVo<MeetingByManagerVO> meetingListByManager(MeetingListReq po) { | |||||
public PageVo<MeetingByManagerVO> meetingListByManager(MeetingListReq req) { | |||||
LambdaQueryWrapper<Meeting> query = new LambdaQueryWrapper<Meeting>() | LambdaQueryWrapper<Meeting> query = new LambdaQueryWrapper<Meeting>() | ||||
.orderByDesc(Meeting::getCreateOn); | .orderByDesc(Meeting::getCreateOn); | ||||
// 补充逻辑 如果拥有超级管理员权限可以看到所有事务 | // 补充逻辑 如果拥有超级管理员权限可以看到所有事务 | ||||
if (!permissionCheckHelper.isSuperAdmin()) { | if (!permissionCheckHelper.isSuperAdmin()) { | ||||
query.eq(Meeting::getCreateBy, LoginUserUtil.getUserId()); | query.eq(Meeting::getCreateBy, LoginUserUtil.getUserId()); | ||||
} | } | ||||
query.eq(po.getStatus() != null, Meeting::getStatus, po.getStatus()); | |||||
meetingManageHelper.buildMeetingQuery(query, po); | |||||
Page<Meeting> page = meetingService.page(po.page(), query); | |||||
query.eq(req.getStatus() != null, Meeting::getStatus, req.getStatus()); | |||||
meetingManageHelper.buildMeetingQuery(query, req); | |||||
Page<Meeting> page = meetingService.page(req.page(), query); | |||||
if (page.getTotal() == 0) { | if (page.getTotal() == 0) { | ||||
return PageVo.empty(); | return PageVo.empty(); | ||||
} | } | ||||
PageVo<MeetingByManagerVO> result = new PageVo<>(new ArrayList<>(), page.getTotal()); | PageVo<MeetingByManagerVO> result = new PageVo<>(new ArrayList<>(), page.getTotal()); | ||||
Map<Long, CountConfirmByMeetingIdDTO> countConfirmMap = new HashMap<>(16); | |||||
List<Long> meetingIds = CollUtils.fieldList(page.getRecords(), Meeting::getId); | |||||
countConfirmMap.putAll(meetingExpertService.countConfirmedByMeetingIds(meetingIds)); | |||||
page.getRecords().forEach(meeting -> { | page.getRecords().forEach(meeting -> { | ||||
MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting); | MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting); | ||||
CountConfirmByMeetingIdDTO confirm = countConfirmMap.get(meeting.getId()); | |||||
if (confirm == null) { | |||||
item.setInviteCount(0); | |||||
item.setConfirmCount(0); | |||||
} else { | |||||
item.setInviteCount(confirm.getTotal()); | |||||
item.setConfirmCount(confirm.getConfirmed()); | |||||
} | |||||
result.getRecords().add(item); | result.getRecords().add(item); | ||||
}); | }); | ||||
return result; | return result; | ||||
@@ -354,7 +343,7 @@ public class MeetingManage { | |||||
throw BizException.wrap("该会议信息不存在"); | throw BizException.wrap("该会议信息不存在"); | ||||
} | } | ||||
ExpertInviteDetailVO result = new ExpertInviteDetailVO(); | ExpertInviteDetailVO result = new ExpertInviteDetailVO(); | ||||
result.setInvitedStopped(meeting.getInviteStopped()); | |||||
result.setInvitedStopped(meeting.getInviteStatus()); | |||||
result.setConfirmedRoster(meeting.getConfirmedRoster()); | result.setConfirmedRoster(meeting.getConfirmedRoster()); | ||||
List<MeetingExpert> experts = meetingExpertService.listByMeetingId(meetingId); | List<MeetingExpert> experts = meetingExpertService.listByMeetingId(meetingId); | ||||
if (experts.isEmpty()) { | if (experts.isEmpty()) { | ||||
@@ -27,7 +27,7 @@ public class MeetingServiceImpl extends ServiceImpl<MeetingMapper, Meeting> impl | |||||
public void stopRandomInvite(Long meetingId) { | public void stopRandomInvite(Long meetingId) { | ||||
Meeting meeting = new Meeting(); | Meeting meeting = new Meeting(); | ||||
meeting.setId(meetingId); | meeting.setId(meetingId); | ||||
meeting.setInviteStopped(Boolean.TRUE); | |||||
meeting.setInviteStatus(Boolean.TRUE); | |||||
baseMapper.updateById(meeting); | baseMapper.updateById(meeting); | ||||
} | } | ||||
@@ -156,7 +156,7 @@ public class ExpertInviteTask { | |||||
addInviteExpertTask(meetingId, false, properties.getInviteDelay()); | addInviteExpertTask(meetingId, false, properties.getInviteDelay()); | ||||
log.info("重置会议的随机抽取状态:{}", meetingId); | log.info("重置会议的随机抽取状态:{}", meetingId); | ||||
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class); | LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class); | ||||
update.set(Meeting::getInviteStopped, false); | |||||
update.set(Meeting::getInviteStatus, false); | |||||
update.set(Meeting::getUpdateBy, LoginUserUtil.getUserId()); | update.set(Meeting::getUpdateBy, LoginUserUtil.getUserId()); | ||||
update.set(Meeting::getUpdateOn, LocalDateTime.now()); | update.set(Meeting::getUpdateOn, LocalDateTime.now()); | ||||
update.eq(Meeting::getId, meetingId); | update.eq(Meeting::getId, meetingId); | ||||
@@ -24,19 +24,19 @@ public abstract class AbstractDictionaryCache implements InitializingBean, Dicti | |||||
@Autowired | @Autowired | ||||
private IMetaDictionaryService iMetaDictionaryService; | private IMetaDictionaryService iMetaDictionaryService; | ||||
protected Map<String, DictionaryDTO> dictionaryMap; | |||||
protected Map<String, DictionaryDTO> dictionaryMap = new ConcurrentHashMap<>(); | |||||
protected LoadingCache<String, List<DictionaryDTO>> dictionaryCacheHelper; | protected LoadingCache<String, List<DictionaryDTO>> dictionaryCacheHelper; | ||||
@Override | @Override | ||||
public void afterPropertiesSet() { | public void afterPropertiesSet() { | ||||
// dictionaryCacheHelper = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) | |||||
// .refreshAfterWrite(5, TimeUnit.MINUTES).build(key -> { | |||||
// List<DictionaryDTO> dictionaryDTOList = iMetaDictionaryService.queryAll(); | |||||
// dictionaryMap = buildCateMap(dictionaryDTOList); | |||||
// Map<String, List<DictionaryDTO>> dictionaryTypeListMap = dictionaryDTOList.stream().collect(Collectors.groupingBy(DictionaryDTO::getDictionaryType)); | |||||
// return dictionaryTypeListMap.get(key); | |||||
// }); | |||||
// warmUp(); | |||||
dictionaryCacheHelper = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) | |||||
.refreshAfterWrite(5, TimeUnit.MINUTES).build(key -> { | |||||
List<DictionaryDTO> dictionaryDTOList = iMetaDictionaryService.queryAll(); | |||||
dictionaryMap = buildCateMap(dictionaryDTOList); | |||||
Map<String, List<DictionaryDTO>> dictionaryTypeListMap = dictionaryDTOList.stream().collect(Collectors.groupingBy(DictionaryDTO::getDictionaryType)); | |||||
return dictionaryTypeListMap.get(key); | |||||
}); | |||||
warmUp(); | |||||
} | } | ||||
private Map<String, DictionaryDTO> buildCateMap(List<DictionaryDTO> dictionaryDTOList) { | private Map<String, DictionaryDTO> buildCateMap(List<DictionaryDTO> dictionaryDTOList) { | ||||
@@ -34,25 +34,24 @@ public abstract class AbstractTagsCache implements InitializingBean, TagCache { | |||||
@Override | @Override | ||||
public void afterPropertiesSet() { | public void afterPropertiesSet() { | ||||
// tagsCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) | |||||
// .refreshAfterWrite(5, TimeUnit.MINUTES) | |||||
// .build(key -> { | |||||
// // 查询全部 | |||||
// List<TagDTO> tagDTOList = iMetaTagService.queryAll(); | |||||
// // TODO 临时关闭校验 | |||||
//// Assert.isTrue(CollectionUtils.isNotEmpty(tagDTOList), "MetaTags queryAll is Empty"); | |||||
// tagDtoMap = buildCateMap(tagDTOList); | |||||
// List<TagDTO> tagInLevel = tagDTOList.stream().filter(tagDto -> { | |||||
// // 只过滤出小于等于level的tag | |||||
// if (Objects.isNull(tagDto.getTagLevel())) { | |||||
// return false; | |||||
// } | |||||
// return Integer.parseInt(key) >= tagDto.getTagLevel(); | |||||
// }).collect(Collectors.toList()); | |||||
// List<TagTreeDTO> treeDtos = MetaTagAssembler.toTagTreeDTOList(tagInLevel); | |||||
// return toTreeStructure(treeDtos); | |||||
// }); | |||||
// warmUp(); | |||||
tagsCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES) | |||||
.refreshAfterWrite(5, TimeUnit.MINUTES) | |||||
.build(key -> { | |||||
// 查询全部 | |||||
List<TagDTO> tagDTOList = iMetaTagService.queryAll(); | |||||
Assert.isTrue(CollectionUtils.isNotEmpty(tagDTOList), "MetaTags queryAll is Empty"); | |||||
tagDtoMap = buildCateMap(tagDTOList); | |||||
List<TagDTO> tagInLevel = tagDTOList.stream().filter(tagDto -> { | |||||
// 只过滤出小于等于level的tag | |||||
if (Objects.isNull(tagDto.getTagLevel())) { | |||||
return false; | |||||
} | |||||
return Integer.parseInt(key) >= tagDto.getTagLevel(); | |||||
}).collect(Collectors.toList()); | |||||
List<TagTreeDTO> treeDtos = MetaTagAssembler.toTagTreeDTOList(tagInLevel); | |||||
return toTreeStructure(treeDtos); | |||||
}); | |||||
warmUp(); | |||||
} | } | ||||
private Map<String, TagDTO> buildCateMap(List<TagDTO> tagDTOList) { | private Map<String, TagDTO> buildCateMap(List<TagDTO> tagDTOList) { | ||||
@@ -0,0 +1,26 @@ | |||||
package com.ningdatech.pmapi.common.helper; | |||||
import com.ningdatech.pmapi.AppTests; | |||||
import org.junit.jupiter.api.Test; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import static org.junit.jupiter.api.Assertions.*; | |||||
/** | |||||
* <p> | |||||
* RegionCacheHelperTest | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 15:52 2023/3/7 | |||||
*/ | |||||
class RegionCacheHelperTest extends AppTests { | |||||
@Autowired | |||||
private RegionCacheHelper regionCacheHelper; | |||||
@Test | |||||
void listChildren() { | |||||
regionCacheHelper.listChildren("331100", 2).forEach(System.out::println); | |||||
} | |||||
} |