From ad874184c813d500b90b4d7513641c19462a6faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=BE=E5=AF=8C=E6=96=8C?= Date: Thu, 11 Sep 2025 15:22:17 +0800 Subject: [PATCH] =?UTF-8?q?fix=20(farm):=20=E9=9B=86=E6=88=90=E6=B5=8B?= =?UTF-8?q?=E8=AF=95,=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 首页统计 --- .../farm/service/home/HomeServiceImpl.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/home/HomeServiceImpl.java b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/home/HomeServiceImpl.java index 8ea847c8..b825ba09 100644 --- a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/home/HomeServiceImpl.java +++ b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/home/HomeServiceImpl.java @@ -71,16 +71,14 @@ public class HomeServiceImpl implements HomeService { // 员工集合 Map employeeNameMap = personnelManagementService.getEmployeeNameMap(); - BaseOverviewInfo baseOverviewInfo = new BaseOverviewInfo(); - StatisticalInfo statisticalInfo = new StatisticalInfo(); + BaseOverviewInfo baseOverviewInfo = null; if (StringUtils.isEmpty(baseId)) { baseOverviewInfo = this.getCompanyInfo(); - statisticalInfo = this.getStatisticalInfo(baseId); } else { BaseInfoDO baseObj = baseInfoService.getBaseInfo(baseId); baseOverviewInfo = this.getBaseOverviewInfo(baseObj, employeeNameMap); - statisticalInfo = this.getStatisticalInfo(baseId); } + StatisticalInfo statisticalInfo = this.getStatisticalInfo(baseId); List baseList = new ArrayList<>(); for (BaseInfoDO baseInfoDO : baseInfoService.getBaseInfosById(baseId)) { @@ -198,13 +196,14 @@ public class HomeServiceImpl implements HomeService { PlotInfoDO plotObj = plotInfoService.getPlotInfoByPlotId(plotId); List plans = productionPlanService.getProductionPlans(baseId,plotId); for (ProductionPlanDO e : plans) { - String beingCropName = productionPlanService.getPlantSpeciesCodeForName(e.getPlantSpeciesCode()); - String cycleName = modelManagementService.getModelCycleName(e.getSpeciesModelId()); - String beingPlotArea = productionPlanService.getBeingPlotArea(e.getPlotId(), null); SpeciesLibraryDO speciesLibrary = speciesLibraryService.getSpeciesLibrary(e.getPlantSpeciesCode()); if (ObjectUtils.isEmpty(speciesLibrary)) { continue; } + String beingCropName = productionPlanService.getPlantSpeciesCodeForName(e.getPlantSpeciesCode()); + String beingPlotArea = productionPlanService.getBeingPlotArea(e.getPlotId(), null); + // 模型管理-管理周期名称 + String cycleName = modelManagementService.getModelCycleName(e.getSpeciesModelId()); PlanInfo target = new PlanInfo(); target.setBaseId(e.getBaseId()); @@ -268,7 +267,11 @@ public class HomeServiceImpl implements HomeService { int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量 int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数量 Double temp = cropFarmingCenterService.getTotalArea(user.getTenantId()); // 总面积 - int totalArea = (int) Math.round(temp); + int totalArea = 0; + if (!ObjectUtils.isEmpty(temp)) { + totalArea = (int) Math.round(temp); + } + int personnelCount = personnelManagementService.personnelCount(user.getTenantId()); // 在职人员 return new BaseOverviewInfo("",baseCount,cropCount,totalArea,personnelCount); }