fix (farm): 集成测试,修复bug

- 首页统计
This commit is contained in:
达富斌
2025-09-11 15:22:17 +08:00
parent ad8dd9797b
commit ad874184c8

View File

@@ -71,16 +71,14 @@ public class HomeServiceImpl implements HomeService {
// 员工集合 <id,name> // 员工集合 <id,name>
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap(); Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
BaseOverviewInfo baseOverviewInfo = new BaseOverviewInfo(); BaseOverviewInfo baseOverviewInfo = null;
StatisticalInfo statisticalInfo = new StatisticalInfo();
if (StringUtils.isEmpty(baseId)) { if (StringUtils.isEmpty(baseId)) {
baseOverviewInfo = this.getCompanyInfo(); baseOverviewInfo = this.getCompanyInfo();
statisticalInfo = this.getStatisticalInfo(baseId);
} else { } else {
BaseInfoDO baseObj = baseInfoService.getBaseInfo(baseId); BaseInfoDO baseObj = baseInfoService.getBaseInfo(baseId);
baseOverviewInfo = this.getBaseOverviewInfo(baseObj, employeeNameMap); baseOverviewInfo = this.getBaseOverviewInfo(baseObj, employeeNameMap);
statisticalInfo = this.getStatisticalInfo(baseId);
} }
StatisticalInfo statisticalInfo = this.getStatisticalInfo(baseId);
List<HomeInfo.BaseInfo> baseList = new ArrayList<>(); List<HomeInfo.BaseInfo> baseList = new ArrayList<>();
for (BaseInfoDO baseInfoDO : baseInfoService.getBaseInfosById(baseId)) { for (BaseInfoDO baseInfoDO : baseInfoService.getBaseInfosById(baseId)) {
@@ -198,13 +196,14 @@ public class HomeServiceImpl implements HomeService {
PlotInfoDO plotObj = plotInfoService.getPlotInfoByPlotId(plotId); PlotInfoDO plotObj = plotInfoService.getPlotInfoByPlotId(plotId);
List<ProductionPlanDO> plans = productionPlanService.getProductionPlans(baseId,plotId); List<ProductionPlanDO> plans = productionPlanService.getProductionPlans(baseId,plotId);
for (ProductionPlanDO e : plans) { 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()); SpeciesLibraryDO speciesLibrary = speciesLibraryService.getSpeciesLibrary(e.getPlantSpeciesCode());
if (ObjectUtils.isEmpty(speciesLibrary)) { if (ObjectUtils.isEmpty(speciesLibrary)) {
continue; continue;
} }
String beingCropName = productionPlanService.getPlantSpeciesCodeForName(e.getPlantSpeciesCode());
String beingPlotArea = productionPlanService.getBeingPlotArea(e.getPlotId(), null);
// 模型管理-管理周期名称
String cycleName = modelManagementService.getModelCycleName(e.getSpeciesModelId());
PlanInfo target = new PlanInfo(); PlanInfo target = new PlanInfo();
target.setBaseId(e.getBaseId()); target.setBaseId(e.getBaseId());
@@ -268,7 +267,11 @@ public class HomeServiceImpl implements HomeService {
int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量 int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量
int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数量 int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数量
Double temp = cropFarmingCenterService.getTotalArea(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()); // 在职人员 int personnelCount = personnelManagementService.personnelCount(user.getTenantId()); // 在职人员
return new BaseOverviewInfo("",baseCount,cropCount,totalArea,personnelCount); return new BaseOverviewInfo("",baseCount,cropCount,totalArea,personnelCount);
} }