feat (farm): 农场首页

- 接口实现
This commit is contained in:
达富斌
2025-09-01 15:35:41 +08:00
parent efada41b2f
commit 0a981206a5
10 changed files with 301 additions and 61 deletions

View File

@@ -21,7 +21,7 @@ public class HomeInfo {
@Schema(description = "基地统计信息概述")
private BaseOverviewInfo baseOverviewInfo;
@Schema(description = "基地弹框信息")
private BasePopupFrame basePopupFrame;
private List<PlotPopupFrame> plotPopupFrames;
@Schema(description = "地块集合")
private List<PlotInfo> plotInfos;
@Schema(description = "计划集合")
@@ -67,7 +67,7 @@ public class HomeInfo {
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class BasePopupFrame {
public static class PlotPopupFrame {
@Schema(description = "在种面积")
private String beingBaseArea;
@Schema(description = "基地负责人")
@@ -84,8 +84,12 @@ public class HomeInfo {
private String baseId;
@Schema(description = "基地名称")
private String baseName;
@Schema(description = "基地面积")
private BigDecimal baseArea;
@Schema(description = "地块ID")
private String plotId;
@Schema(description = "地块名称")
private String plotName;
@Schema(description = "地块面积")
private BigDecimal plotArea;
@Schema(description = "基地负责人")
private String manager;
@Schema(description = "基地坐标")
@@ -105,6 +109,10 @@ public class HomeInfo {
private String baseId;
@Schema(description = "基地名称")
private String baseName;
@Schema(description = "地块ID")
private String plotId;
@Schema(description = "地块名称")
private String plotName;
@Schema(description = "种植状态 (1: 在种; 2: 未种;)")
private String growFlag;
@Schema(description = "种植面积")
@@ -131,11 +139,15 @@ public class HomeInfo {
private String baseId;
@Schema(description = "基地名称")
private String baseName;
@Schema(description = "地块ID")
private String plotId;
@Schema(description = "地块名称")
private String plotName;
@Schema(description = "基地负责人")
private String manager;
@Schema(description = "物种名称")
private String plantSpeciesCode;
private String plantSpeciesName;
@Schema(description = "计划编号")
private String planNumber;
@Schema(description = "管理周期名称")

View File

@@ -75,4 +75,8 @@ public class CommonConstants {
public final static Boolean DHTMLX_GANTT_OPEN_FALSE = false;
public final static String GROW_FLAG_1 = "在种";
public final static String GROW_FLAG_2 = "空闲";
}

View File

@@ -143,7 +143,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
List<BaseNameRespVO.PlotInfoVO> childList = new ArrayList<>();
for (PlotInfoDO aDo : plotInfoDOS) {
if (aDo.getBaseId().equals(key)) {
double remainingArea = productionPlanService.getRemainingArea(aDo.getBaseId());
double remainingArea = productionPlanService.getPredictedArea(aDo.getBaseId());
childList.add(new BaseNameRespVO.PlotInfoVO(aDo.getPlotId(), aDo.getPlotName(), aDo.getPlotArea(),remainingArea));
}
}

View File

@@ -11,9 +11,11 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlan
import cn.iocoder.yudao.module.farm.service.baseinfo.BaseInfoService;
import cn.iocoder.yudao.module.farm.service.cropFarmingCenter.CropFarmingCenterService;
import cn.iocoder.yudao.module.farm.service.deviceplotrelation.DevicePlotRelationService;
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagementService;
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -23,6 +25,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.*;
/**
* @description: 首页信息实现类
@@ -38,101 +41,138 @@ public class HomeServiceImpl implements HomeService {
private final DevicePlotRelationService driverPropertyInfoService;
private final CropFarmingCenterService cropFarmingCenterService;
private final PersonnelManagementService personnelManagementService;
private final ModelManagementService modelManagementService;
public HomeServiceImpl(BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, DevicePlotRelationService driverPropertyInfoService, CropFarmingCenterService cropFarmingCenterService, PersonnelManagementService personnelManagementService) {
public HomeServiceImpl(BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, DevicePlotRelationService driverPropertyInfoService, CropFarmingCenterService cropFarmingCenterService, PersonnelManagementService personnelManagementService, ModelManagementService modelManagementService) {
this.baseInfoService = baseInfoService;
this.plotInfoService = plotInfoService;
this.productionPlanService = productionPlanService;
this.driverPropertyInfoService = driverPropertyInfoService;
this.cropFarmingCenterService = cropFarmingCenterService;
this.personnelManagementService = personnelManagementService;
this.modelManagementService = modelManagementService;
}
@Override
public HomeInfo getHomeInfo(String baseId) {
// 员工集合 <id,name>
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
BaseInfoDO baseObj = baseInfoService.getBaseInfo(baseId);
BaseOverviewInfo baseOverviewInfo = this.getBaseOverviewInfo(baseId);
BasePopupFrame basePopupFrame = this.getBasePopupFrame(baseId);
List<PlotInfo> plotInfos = this.getPlotInfoList(baseId);
List<PlanInfo> planInfos = this.getPlanInfoList("");
return new HomeInfo(baseOverviewInfo,basePopupFrame,plotInfos,planInfos,null);
BaseOverviewInfo baseOverviewInfo = this.getBaseOverviewInfo(baseObj, employeeNameMap);
List<PlotPopupFrame> plotPopupFrames = this.getPlotPopupFrame(baseObj, employeeNameMap);
List<PlotInfo> plotInfos = this.getPlotInfoList(baseId,employeeNameMap);
List<PlanInfo> planInfos = this.getPlanInfoList(baseId,"",null);
StatisticalInfo statisticalInfo = this.getStatisticalInfo(baseId);
return new HomeInfo(baseOverviewInfo, plotPopupFrames, plotInfos, planInfos, statisticalInfo);
}
private BaseOverviewInfo getBaseOverviewInfo(String baseId) {
BaseInfoDO aDo = baseInfoService.getBaseInfo(baseId);
private StatisticalInfo getStatisticalInfo(String baseId) {
Integer taskCount = 0; // TODO: 2025/9/1 今日任务数量
Integer warningCount = 0; // TODO: 2025/9/1 告警数量
Integer iotCount = 0; // TODO: 2025/9/1 物联设备数量
return new StatisticalInfo(taskCount,warningCount,iotCount);
}
private BaseOverviewInfo getBaseOverviewInfo(BaseInfoDO baseObj, Map<String, String> employeeNameMap) {
String employeeName= personnelManagementService.getEmployeeNameMap(employeeNameMap,baseObj.getManager());
int growingPlotCount = productionPlanService.getGrowingPlotCount(baseObj.getId());
int growingCropCount = productionPlanService.getGrowingCropCount(baseObj.getId());
BaseOverviewInfo res = new BaseOverviewInfo();
res.setBaseId(aDo.getId());
res.setBaseName(aDo.getName());
res.setBaseArea(aDo.getArea());
res.setManager(aDo.getManager()); // TODO: 2025/8/31 code 转 name
res.setPointName(""); // TODO: 2025/8/31 应该取不到
res.setPoint(aDo.getPoint());
res.setBeingPlot(0); // TODO: 2025/8/31 在种地块数量
res.setBeingCrop(0); // TODO: 2025/8/31 在种作物数量
res.setBaseId(baseObj.getId());
res.setBaseName(baseObj.getName());
res.setBaseArea(baseObj.getArea());
res.setManager(employeeName);
res.setPoint(baseObj.getPoint());
res.setPointName(""); // TODO: 2025/8/31 需要前端传入,才能获取
res.setBeingPlot(growingPlotCount);
res.setBeingCrop(growingCropCount);
return res;
}
private BasePopupFrame getBasePopupFrame(String baseId) {
BasePopupFrame res = new BasePopupFrame();
res.setBeingBaseArea(""); // TODO: 2025/8/31 在种面积 : 300/350亩
res.setManager(""); // TODO: 2025/8/31 code 转 name
res.setBeingCropName(""); // TODO: 2025/8/31 在种物种名称
return res;
private List<PlotPopupFrame> getPlotPopupFrame(BaseInfoDO baseObj, Map<String, String> employeeNameMap) {
List<PlotPopupFrame> targetList = new ArrayList<>();
List<PlotInfoDO> plotList = plotInfoService.getPlotInfos(baseObj.getId());
for (PlotInfoDO e : plotList) {
String employeeName = personnelManagementService.getEmployeeNameMap(employeeNameMap, e.getEmployeeId());
String beingPlotArea = productionPlanService.getBeingPlotArea(e.getId(), e.getPlotArea());
String beingCropName = productionPlanService.getBeingCropName(e.getId());
targetList.add(new PlotPopupFrame(beingPlotArea,employeeName,beingCropName));
}
return targetList;
}
private List<PlotInfo> getPlotInfoList(String baseId) {
private List<PlotInfo> getPlotInfoList(String baseId,Map<String, String> employeeNameMap) {
List<PlotInfo> targetList = new ArrayList<>();
List<PlotInfoDO> plotList = plotInfoService.getPlotInfos(baseId);
for (PlotInfoDO e : plotList) {
String employeeName = personnelManagementService.getEmployeeNameMap(employeeNameMap, e.getEmployeeId());
PlotOrCropInfo plotOrCropInfo = this.getPlotOrCropInfoList(e,"地块详情",employeeName);
PlotInfo t = new PlotInfo();
t.setBaseId(e.getBaseId());
t.setBaseName(e.getPlotName());
t.setBaseArea(e.getPlotArea());
t.setManager(e.getEmployeeId()); // TODO: 2025/8/31 code -> name
t.setBaseName(e.getBaseName());
t.setPlotId(e.getPlotId());
t.setPlotName(e.getPlotName());
t.setPlotArea(e.getPlotArea());
t.setManager(employeeName);
t.setPoint(e.getPoint());
PlotOrCropInfo plotOrCropInfo = this.getPlotOrCropInfoList(baseId,"地块详情"); // TODO: 2025/8/31
t.setPlotOrCropInfo(plotOrCropInfo);
targetList.add(t);
}
return targetList;
}
private PlotOrCropInfo getPlotOrCropInfoList(String baseId,String label) {
BaseInfoDO b = baseInfoService.getBaseInfo(baseId);
private PlotOrCropInfo getPlotOrCropInfoList(PlotInfoDO e ,String label,String employeeName) {
Double predictedArea = productionPlanService.getBeingPlotArea(e.getPlotId());
if (ObjectUtils.isEmpty(predictedArea)) {
predictedArea = 0.00;
}
String growFlag = ObjectUtils.isEmpty(predictedArea) ? GROW_FLAG_2 : GROW_FLAG_1;
int growingCropCount = productionPlanService.getGrowingCropCount(e.getBaseId(), e.getPlotId());
PlotOrCropInfo t = new PlotOrCropInfo();
t.setLabel(label);
t.setBaseId(b.getId());
t.setBaseName(b.getName());
t.setGrowFlag("在种"); // TODO: 2025/8/31
t.setGrowArea(0.00); // TODO: 2025/8/31 种植面积
t.setBeingCrop(0); // TODO: 2025/8/31 在种作物数量
t.setBaseId(e.getBaseId());
t.setPlotId(e.getPlotId());
t.setPlotName(e.getPlotName());
t.setGrowFlag(growFlag);
t.setGrowArea(predictedArea);
t.setBeingCrop(growingCropCount);
t.setTaskCount(0); // TODO: 2025/8/31 农事任务数量
t.setLotCount(0); // TODO: 2025/8/31 物联设备数量
t.setManager(""); // TODO: 2025/8/31 地块负责人
t.setManager(employeeName);
t.setQrCodeUrl(""); // TODO: 2025/8/31 暂无
t.setPlanInfos(this.getPlanInfoList("")); // TODO: 2025/8/31 plotId
t.setPlanInfos(this.getPlanInfoList(e.getBaseId(),e.getPlotId(),employeeName));
return t;
}
private List<PlanInfo> getPlanInfoList(String plotId) {
private List<PlanInfo> getPlanInfoList(String baseId,String plotId,String employeeName) {
List<PlanInfo> targetList = new ArrayList<>();
List<ProductionPlanDO> plans = productionPlanService.getProductionPlans(plotId);
for (ProductionPlanDO aDo : plans) {
List<ProductionPlanDO> plans = productionPlanService.getProductionPlans(baseId,plotId);
for (ProductionPlanDO e : plans) {
String beingCropName = productionPlanService.getPlantSpeciesCodeForName(e.getPlantSpeciesCode());
String cycleName = modelManagementService.getModelCycleName(e.getSpeciesModelId()); // TODO: 2025/9/1
String beingPlotArea = productionPlanService.getBeingPlotArea(e.getPlotId(), null);
PlanInfo target = new PlanInfo();
target.setBaseId("");
target.setBaseName("");
target.setManager("");
target.setPlantSpeciesCode("");
target.setPlanNumber("");
target.setCycleName("");
target.setProgressBar("");
target.setPredictedArea(0.0);
target.setPredictedYields(0);
target.setPlanStatus(0);
target.setPlanStatusName("");
target.setPlanSubStatus(0);
target.setPlanSubStatusName("");
target.setBaseId(e.getBaseId());
target.setBaseName(e.getBaseName());
target.setPlotId(e.getPlotId());
target.setPlotName(e.getPlotName());
target.setManager(employeeName);
target.setPlantSpeciesName(beingCropName);
target.setPlanNumber(e.getPlanNumber());
target.setCycleName(cycleName);
target.setProgressBar("0/10"); // TODO: 2025/9/1
target.setPredictedArea(Double.valueOf(beingPlotArea));
target.setPredictedYields(e.getPredictedYields());
target.setPlanStatus(e.getPlanStatus());
target.setPlanStatusName(PLAN_MAP.getOrDefault(e.getPlanStatus(),"未开始"));
target.setPlanSubStatus(e.getPlanSubStatus());
target.setPlanSubStatusName(PLAN_MAP.getOrDefault(e.getPlanSubStatus(),"逾期未开始"));
targetList.add(target);
}
return targetList;

View File

@@ -74,4 +74,11 @@ public interface ModelManagementService {
Map<String, String> getCount();
/**
* 生命周期-名称
* @param planId => task_id
* @return
*/
String getModelCycleName(String planId);
}

View File

@@ -450,4 +450,8 @@ public class ModelManagementServiceImpl implements ModelManagementService {
return map;
}
@Override
public String getModelCycleName(String planId) {
return null;
}
}

View File

@@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.Personnel
import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* 人员管理 Service 接口
@@ -65,4 +66,14 @@ public interface PersonnelManagementService {
void reset(@Valid PersonnelManagementSaveReqVO updateReqVO);
List<PersonnelManagementDO> getList(@Valid PersonnelManagementPageReqVO pageReqVO);
/**
* 获取员工集合
* key: id
* value: name
* @return
*/
Map<String, String> getEmployeeNameMap();
String getEmployeeNameMap(Map<String, String> employeeName, String employeeId);
}

View File

@@ -15,11 +15,15 @@ import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.SystemUserMapp
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.SystemUserRoleMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
@@ -200,4 +204,41 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
private String encodePassword(String password) {
return passwordEncoder.encode(password);
}
@Override
public Map<String, String> getEmployeeNameMap() {
LoginUser loginUser = getLoginUser();
if (ObjectUtils.isEmpty(loginUser)) {
return Collections.emptyMap();
}
List<PersonnelManagementDO> personnelManagementDOS = personnelManagementMapper.selectList("tenant_id", loginUser.getTenantId());
return personnelManagementDOS.stream().collect(Collectors.toMap(PersonnelManagementDO::getId, PersonnelManagementDO::getName, (v1, v2) -> v1));
}
public String getEmployeeNameMap(Map<String, String> employeeNameMap,String employeeId) {
if (employeeId == null || employeeId.trim().isEmpty()) {
return "";
}
String[] employeeIds = employeeId.split(",");
if (employeeIds.length == 0) {
return "";
}
StringBuilder result = new StringBuilder();
for (int i = 0; i < employeeIds.length; i++) {
// 去除可能的空格,并使用getOrDefault提供默认值"系统"
String id = employeeIds[i].trim();
String name = employeeNameMap.getOrDefault(id, "系统");
// 拼接姓名,用逗号分隔
if (i > 0) {
result.append(",");
}
result.append(name);
}
return result.toString();
}
}

View File

@@ -61,6 +61,7 @@ public interface ProductionPlanService {
* @return
*/
List<ProductionPlanDO> getProductionPlans(String plotId);
List<ProductionPlanDO> getProductionPlans(String baseId,String plotId);
/**
* 获得种植中心-生产计划-生产计划分页
@@ -113,10 +114,36 @@ public interface ProductionPlanService {
*/
int getGrowingPlotCount(String baseId);
/**
* 获取在种作物数量
* @param baseId
* @return
*/
int getGrowingCropCount(String baseId);
int getGrowingCropCount(String baseId,String plotId);
/**
* 计算在种地块面积
* @param baseId
* @return
*/
double getRemainingArea(String baseId);
double getPredictedArea(String baseId);
/**
* 获取在种地块面积
* @param baseId
* @return
*/
String getBeingPlotArea(String plotId,BigDecimal plotArea);
Double getBeingPlotArea(String plotId);
/**
* 获取在种作物
* @param plotId
* @return
*/
String getBeingCropName(String plotId);
String getPlantSpeciesCodeForName(String plantSpeciesCode);
}

View File

@@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.farm.controller.admin.baseinfo.vo.BaseNamePlanRespVO;
import cn.iocoder.yudao.module.farm.controller.admin.productionplan.vo.ProductionPlanPageReqVO;
import cn.iocoder.yudao.module.farm.controller.admin.productionplan.vo.ProductionPlanSaveReqVO;
import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibraryDO;
import cn.iocoder.yudao.module.farm.dal.mysql.specieslibrary.SpeciesLibraryMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
@@ -41,6 +43,8 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
@Resource
private ProductionPlanMapper productionPlanMapper;
@Resource
private SpeciesLibraryMapper speciesLibraryMapper;
@Override
public String createProductionPlan(ProductionPlanSaveReqVO createReqVO) {
@@ -101,6 +105,14 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
return productionPlanMapper.selectList(qw);
}
@Override
public List<ProductionPlanDO> getProductionPlans(String baseId, String plotId) {
LambdaQueryWrapperX<ProductionPlanDO> qw = new LambdaQueryWrapperX<>();
qw.eqIfPresent(ProductionPlanDO::getBaseId, baseId);
qw.eqIfPresent(ProductionPlanDO::getPlotId, plotId);
return productionPlanMapper.selectList(qw);
}
@Override
public PageResult<ProductionPlanDO> getProductionPlanPage(ProductionPlanPageReqVO pageReqVO) {
productionPlanMapper.selectPage(pageReqVO);
@@ -206,7 +218,34 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
}
@Override
public double getRemainingArea(String baseId) {
public int getGrowingCropCount(String baseId) {
List<ProductionPlanDO> planList = productionPlanMapper.selectList("base_id", baseId);
return (int) planList.stream()
.filter(Objects::nonNull)
.filter(plan -> Objects.equals(plan.getPlanStatus(), PLAN_STATUS_2))
.map(ProductionPlanDO::getPlantSpeciesCode)
.filter(Objects::nonNull)
.distinct()
.count();
}
@Override
public int getGrowingCropCount(String baseId, String plotId) {
QueryWrapper<ProductionPlanDO> qw = new QueryWrapper<>();
qw.eq("base_id", baseId);
qw.eq("plot_id", plotId);
List<ProductionPlanDO> planList = productionPlanMapper.selectList(qw);
return (int) planList.stream()
.filter(Objects::nonNull)
.filter(plan -> Objects.equals(plan.getPlanStatus(), PLAN_STATUS_2))
.map(ProductionPlanDO::getPlantSpeciesCode)
.filter(Objects::nonNull)
.distinct()
.count();
}
@Override
public double getPredictedArea(String baseId) {
List<ProductionPlanDO> planList = productionPlanMapper.selectList("base_id", baseId);
return planList.stream()
@@ -214,4 +253,59 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
.mapToDouble(ProductionPlanDO::getPredictedArea)
.sum();
}
@Override
public String getBeingPlotArea(String plotId, BigDecimal plotArea) {
List<ProductionPlanDO> planList = productionPlanMapper.selectList("plot_id", plotId);
if (ObjectUtils.isEmpty(planList)) {
return null;
}
double totalArea = planList.stream()
.filter(Objects::nonNull)
.filter(plan -> Objects.equals(plan.getPlanStatus(), PLAN_STATUS_2) || Objects.equals(plan.getPlanStatus(), PLAN_STATUS_6))
.mapToDouble(ProductionPlanDO::getPredictedArea)
.sum();
if (plotArea == null) {
return String.valueOf(totalArea);
}
return totalArea + "/" + plotArea + "亩";
}
@Override
public Double getBeingPlotArea(String plotId) {
List<ProductionPlanDO> planList = productionPlanMapper.selectList("plot_id", plotId);
if (ObjectUtils.isEmpty(planList)) {
return null;
}
return planList.stream()
.filter(Objects::nonNull)
.filter(plan -> Objects.equals(plan.getPlanStatus(), PLAN_STATUS_2) || Objects.equals(plan.getPlanStatus(), PLAN_STATUS_6))
.mapToDouble(ProductionPlanDO::getPredictedArea)
.sum();
}
@Override
public String getBeingCropName(String plotId) {
List<ProductionPlanDO> planList = productionPlanMapper.selectList("plot_id", plotId);
List<String> distinctSpeciesCodes = planList.stream()
.filter(Objects::nonNull)
.filter(plan -> Objects.equals(plan.getPlanStatus(), PLAN_STATUS_2) || Objects.equals(plan.getPlanStatus(), PLAN_STATUS_6))
.map(ProductionPlanDO::getPlantSpeciesCode)
.filter(code -> code != null && !code.trim().isEmpty())
.distinct()
.collect(Collectors.toList());
Map<String, String> cultivarNameMap = speciesLibraryMapper.selectList().stream().collect(Collectors.toMap(SpeciesLibraryDO::getId, SpeciesLibraryDO::getCultivarName, (v1, v2) -> v1));
return distinctSpeciesCodes.stream().map(cultivarNameMap::get).filter(Objects::nonNull).collect(Collectors.joining(","));
}
@Override
public String getPlantSpeciesCodeForName(String plantSpeciesCode) {
Map<String, String> cultivarNameMap = speciesLibraryMapper.selectList().stream().collect(Collectors.toMap(SpeciesLibraryDO::getId, SpeciesLibraryDO::getCultivarName, (v1, v2) -> v1));
return cultivarNameMap.getOrDefault(plantSpeciesCode,"");
}
}