fix (farm): 首页
- 展示网箱集合,修复取值范围bug
This commit is contained in:
@@ -218,6 +218,22 @@ public class HomeServiceImpl implements HomeService {
|
||||
List<PlanInfo> targetList = new ArrayList<>();
|
||||
PlotInfoDO plotObj = plotInfoService.getPlotInfoByPlotId(plotId);
|
||||
List<ProductionPlanDO> plans = productionPlanService.getProductionPlans(baseId,plotId);
|
||||
// 网格信息
|
||||
List<ProductionPlanGridRespVO> gridOverviewList = baseInfoService.getGridInfo(plotId);
|
||||
Map<String, List<ProductionPlanGridRespVO>> gridOverviewMap = gridOverviewList.stream()
|
||||
.collect(Collectors.groupingBy(item -> {
|
||||
String planNumber = item.getPlanNumber();
|
||||
if (planNumber == null) {
|
||||
return "null";
|
||||
}
|
||||
// 按 "(" 截取,取第一部分,并去空格
|
||||
int index = planNumber.indexOf("(");
|
||||
if (index != -1) {
|
||||
return planNumber.substring(0, index).trim();
|
||||
}
|
||||
return planNumber.trim();
|
||||
}));
|
||||
|
||||
for (ProductionPlanDO e : plans) {
|
||||
SpeciesLibraryDO speciesLibrary = speciesLibraryService.getSpeciesLibrary(e.getPlantSpeciesCode());
|
||||
if (ObjectUtils.isEmpty(speciesLibrary)) {
|
||||
@@ -233,8 +249,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
int progressBarDenominator = modelManagementService.getFarmRecordCount(e.getSpeciesModelId());
|
||||
// 任务进度
|
||||
String progressBar = progressBarNumerator +"/"+progressBarDenominator;
|
||||
// 网格信息
|
||||
List<ProductionPlanGridRespVO> gridOverviewList = baseInfoService.getGridInfo(plotId);
|
||||
|
||||
|
||||
PlanInfo target = new PlanInfo();
|
||||
target.setBaseId(e.getBaseId());
|
||||
@@ -257,7 +272,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
String pointsInPolygon = LeafletjsUtil.generateRandomPointsInPolygon(plotObj.getPoint());
|
||||
target.setPlanModelPoint(pointsInPolygon);
|
||||
target.setPlanModelImage(speciesLibrary.getImageList());
|
||||
target.setGridOverviewList(gridOverviewList);
|
||||
target.setGridOverviewList(gridOverviewMap.get(e.getPlanNumber()));
|
||||
targetList.add(target);
|
||||
}
|
||||
return targetList;
|
||||
|
||||
Reference in New Issue
Block a user