fix (farm): 农场首页

- 调整相应参数
This commit is contained in:
达富斌
2025-09-01 18:37:48 +08:00
parent 8b589b8e76
commit 1a43342298
2 changed files with 24 additions and 24 deletions

View File

@@ -18,8 +18,6 @@ import java.util.List;
@NoArgsConstructor
public class HomeInfo {
@Schema(description = "租户信息概述")
private TenantInfo tenantInfo;
@Schema(description = "基地统计信息概述")
private BaseOverviewInfo baseOverviewInfo;
@Schema(description = "基地弹框信息")
@@ -31,22 +29,8 @@ public class HomeInfo {
@Schema(description = "统计信息")
private StatisticalInfo statisticalInfo;
public HomeInfo(TenantInfo tenantInfo) {
this.tenantInfo = tenantInfo;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class TenantInfo {
@Schema(description = "基地数量")
private Integer baseCount;
@Schema(description = "总面积")
private Integer cropCount;
@Schema(description = "在种作物数量")
private Double totalArea;
@Schema(description = "在职员工人数")
private Integer personnelCount;
public HomeInfo(BaseOverviewInfo baseOverviewInfo) {
this.baseOverviewInfo = baseOverviewInfo;
}
@Data
@@ -81,6 +65,23 @@ public class HomeInfo {
private Integer beingPlot;
@Schema(description = "在种作物数量")
private Integer beingCrop;
@Schema(description = "基地数量")
private Integer baseCount;
@Schema(description = "总面积")
private Integer cropCount;
@Schema(description = "在种作物数量")
private Double totalArea;
@Schema(description = "在职员工人数")
private Integer personnelCount;
public BaseOverviewInfo(String baseId, Integer baseCount, Integer cropCount, Double totalArea, Integer personnelCount) {
this.baseId = baseId;
this.baseCount = baseCount;
this.cropCount = cropCount;
this.totalArea = totalArea;
this.personnelCount = personnelCount;
}
}
@Data

View File

@@ -57,21 +57,20 @@ public class HomeServiceImpl implements HomeService {
public HomeInfo getHomeInfo(String baseId) {
if (baseId.trim().isEmpty()) {
return new HomeInfo(this.getCompanyInfo());
BaseOverviewInfo baseOverviewInfo = this.getCompanyInfo();
return new HomeInfo(baseOverviewInfo);
}
// 员工集合 <id,name>
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
BaseInfoDO baseObj = baseInfoService.getBaseInfo(baseId);
TenantInfo tenantInfo = this.getCompanyInfo();
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(tenantInfo, baseOverviewInfo, plotPopupFrames, plotInfos, planInfos, statisticalInfo);
return new HomeInfo(baseOverviewInfo, plotPopupFrames, plotInfos, planInfos, statisticalInfo);
}
private StatisticalInfo getStatisticalInfo(String baseId) {
@@ -216,12 +215,12 @@ public class HomeServiceImpl implements HomeService {
return map;
}
private TenantInfo getCompanyInfo() {
private BaseOverviewInfo getCompanyInfo() {
LoginUser user = getLoginUser();
int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量
int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数量
Double totalArea = cropFarmingCenterService.getTotalArea(user.getTenantId()); // 总面积
int personnelCount = personnelManagementService.personnelCount(user.getTenantId()); // 在职人员
return new TenantInfo(baseCount,cropCount,totalArea,personnelCount);
return new BaseOverviewInfo("",baseCount,cropCount,totalArea,personnelCount);
}
}