From 000d46e4702e6c9465c2dc3e67c23f30de385154 Mon Sep 17 00:00:00 2001 From: wangzhijiang <12345678> Date: Wed, 6 Jul 2022 14:22:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=95=E8=A7=84=E6=84=8F=E8=A7=81=E6=94=B6?= =?UTF-8?q?=E9=9B=86=EF=BC=8C=E5=88=97=E8=A1=A8=E5=9B=9E=E6=98=BE=E6=8A=80?= =?UTF-8?q?=E6=9C=AF=E9=A2=86=E5=9F=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/LawsOpinionGatherEO.java | 3 ++ .../impl/LawsOpinionGatherEOServiceImpl.java | 44 +++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsOpinionGather/entity/LawsOpinionGatherEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsOpinionGather/entity/LawsOpinionGatherEO.java index f3bdee2c6..54bdb668d 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsOpinionGather/entity/LawsOpinionGatherEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsOpinionGather/entity/LawsOpinionGatherEO.java @@ -73,6 +73,9 @@ public class LawsOpinionGatherEO implements Serializable { @Excel(name = "技术领域", width = 15) @ApiModelProperty(value = "技术领域") private String technologyTerritory; + @TableField(exist = false) + /**技术领域展示字段*/ + private String technologyTerritoryShow; /**收集结果*/ @Excel(name = "收集结果", width = 15) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsOpinionGather/service/impl/LawsOpinionGatherEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsOpinionGather/service/impl/LawsOpinionGatherEOServiceImpl.java index da95056f0..241da71dc 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsOpinionGather/service/impl/LawsOpinionGatherEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/lawsOpinionGather/service/impl/LawsOpinionGatherEOServiceImpl.java @@ -2,6 +2,7 @@ package com.jero.modules.lawsOpinionGather.service.impl; import com.alibaba.fastjson.JSONObject; import com.jero.common.api.vo.Result; +import com.jero.common.constant.enums.CutEnum; import com.jero.common.exception.JeroBootException; import com.jero.modules.lawsOpinionGather.entity.LawsOpinionGatherEO; import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum; @@ -9,11 +10,16 @@ import com.jero.modules.lawsOpinionGather.mapper.LawsOpinionGatherEOMapper; import com.jero.modules.lawsOpinionGather.service.ILawsOpinionGatherEOService; import com.jero.modules.project.enums.OperatorTypeEnum; import com.jero.modules.project.enums.RequestSourceEnum; +import com.jero.modules.system.entity.SysCategory; +import com.jero.modules.system.service.impl.SysCategoryServiceImpl; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Date; +import java.util.stream.Collectors; + import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** @@ -25,6 +31,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class LawsOpinionGatherEOServiceImpl extends ServiceImpl implements ILawsOpinionGatherEOService { + @Autowired + private SysCategoryServiceImpl sysCategoryService; + /** * 保存 * @@ -130,11 +139,46 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl lawsOpinionGatherEOList,String cut) { if(CollectionUtils.isNotEmpty(lawsOpinionGatherEOList)){ + //树形数据字典 + List technologyTerritoryList = sysCategoryService.list(); lawsOpinionGatherEOList.forEach(lawsOpinionGather -> { if(StringUtils.isNotEmpty(lawsOpinionGather.getGatherResult())){ lawsOpinionGather.setGatherResultShow(GatherResultEnum.getTextByValue(lawsOpinionGather.getGatherResult(),cut)); } + if(StringUtils.isNotEmpty(lawsOpinionGather.getTechnologyTerritory())){ + String technologyTerritoryShow = disposeTechnologyTerritory(technologyTerritoryList, lawsOpinionGather.getTechnologyTerritory(), cut); + lawsOpinionGather.setTechnologyTerritoryShow(technologyTerritoryShow); + } }); } } + + /** + * 处理技术领域展示字段 + * @param technologyTerritoryList + * @param technologyTerritory + * @param cut + * @return + */ + public String disposeTechnologyTerritory(List technologyTerritoryList,String technologyTerritory,String cut){ + String result = ""; + // technology_territory + if(StringUtils.isNotEmpty(technologyTerritory)){ + StringBuilder sb = new StringBuilder(); + for (String technologyTerritoryId : technologyTerritory.split(",")) { + List collect = technologyTerritoryList.stream().filter(e -> e.getId().equals(technologyTerritoryId)).collect(Collectors.toList()); + if(collect.size() != 0){ + if(CutEnum.CN.getValue().equals(cut)){ + sb.append(collect.get(0).getName()+","); + }else{ + sb.append(collect.get(0).getEnName()+","); + } + } + } + if(StringUtils.isNotEmpty(sb)){ + result = sb.substring(0, sb.length() - 1); + } + } + return result; + } }