diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AppointRuleVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AppointRuleVO.java index 411b696..b4f918e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AppointRuleVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AppointRuleVO.java @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Collection; import java.util.List; /** @@ -22,6 +23,6 @@ public class AppointRuleVO { private String inviteDesc; @ApiModelProperty("指定邀请专家") - private List experts; + private Collection experts; } \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AvoidInfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AvoidInfoVO.java index 5a86e35..f7c71b8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AvoidInfoVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/AvoidInfoVO.java @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Collection; import java.util.List; /** @@ -37,6 +38,6 @@ public class AvoidInfoVO { private Integer weekInviteCount; @ApiModelProperty("回避专家") - private List experts; + private Collection experts; } \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java index cf0f3f7..6f1dfaa 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java @@ -584,33 +584,32 @@ public class MeetingManage { InviteRuleDetailVO result = new InviteRuleDetailVO(); List inviteRules = inviteRuleService.listByMeetingId(meetingId); result.setRandomRules(new ArrayList<>()); - Map> groupByType = CollUtils.group(inviteRules, w -> ExpertInviteTypeEnum.getByCode(w.getInviteType())); + Map> groupByType = CollUtils.group(inviteRules, + w -> ExpertInviteTypeEnum.getByCode(w.getInviteType())); List randoms = groupByType.get(ExpertInviteTypeEnum.RANDOM); if (CollUtil.isNotEmpty(randoms)) { randoms.forEach(random -> { RandomInviteRuleVO randomRule = JSON.parseObject(random.getInviteRule(), RandomInviteRuleVO.class); randomRule.setId(random.getId()); - if (randomRule.getExpertTags() != null) { - randomRule.getExpertTags().forEach(w -> { - List tagNames = CollUtils.convert(w.getTagCodes(), tagCode -> tagCache.getByTagCode(tagCode).getTagName()); - w.setTagCodes(tagNames); - }); - } - if (randomRule.getExpertDicts() != null) { - randomRule.getExpertDicts().forEach(w -> { - List dictNames = CollUtils.convert(w.getDictCodes(), this::getDictName); - w.setDictCodes(dictNames); - }); - } - if (StrUtil.isNotEmpty(randomRule.getIntentionRegionCode())) { - List intentionRegions = regionCache.listParents(randomRule.getIntentionRegionCode(), randomRule.getIntentionRegionLevel()); + BizUtils.notEmpty(randomRule.getExpertTags(), tags -> tags.forEach(w -> { + List tagNames = CollUtils.convert(w.getTagCodes(), + tagCode -> tagCache.getByTagCode(tagCode).getTagName()); + w.setTagCodes(tagNames); + })); + BizUtils.notEmpty(randomRule.getExpertDicts(), dicts -> dicts.forEach(w -> { + List dictNames = CollUtils.convert(w.getDictCodes(), this::getDictName); + w.setDictCodes(dictNames); + })); + Integer intentionRegionLevel = randomRule.getIntentionRegionLevel(); + BizUtils.notBlank(randomRule.getIntentionRegionCode(), regionCode -> { + List intentionRegions = regionCache.listParents(regionCode, intentionRegionLevel); randomRule.setIntentionRegions(intentionRegions); - } - if (CollUtil.isNotEmpty(randomRule.getExpertRegionList())) { - List regions = CollUtils.convert(randomRule.getExpertRegionList(), + }); + BizUtils.notEmpty(randomRule.getExpertRegionList(), expertRegionList -> { + List regions = CollUtils.convert(expertRegionList, w -> regionCache.getByCodeAndLevel(w.getRegionCode(), w.getRegionLevel())); randomRule.setExpertRegions(regions); - } + }); result.getRandomRules().add(randomRule); }); AvoidRuleDTO avoidInfo = inviteAvoidRuleService.getAvoidInfo(meetingId); @@ -626,7 +625,7 @@ public class MeetingManage { vo.setAvoidUnits(dingOrganizationService.listNameByCodes(avoidInfo.getAvoidUnitIdList())); } if (CollUtil.isNotEmpty(avoidInfo.getExpertIds())) { - vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(avoidInfo.getExpertIds()).values())); + vo.setExperts(meetingManageHelper.getExpertBasicInfo(avoidInfo.getExpertIds()).values()); } result.setAvoidInfo(vo); } else { @@ -637,7 +636,7 @@ public class MeetingManage { appointRule.setId(appoint.getId()); AppointRuleVO vo = new AppointRuleVO(); vo.setInviteDesc(appointRule.getInviteDesc()); - vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(appointRule.getExpertIdList()).values())); + vo.setExperts(meetingManageHelper.getExpertBasicInfo(appointRule.getExpertIdList()).values()); result.setAppointRule(vo); } }