diff --git a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/digitalcockpit/DigitalCockpit.java b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/digitalcockpit/DigitalCockpit.java index 9f06fb34..a008c646 100644 --- a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/digitalcockpit/DigitalCockpit.java +++ b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/digitalcockpit/DigitalCockpit.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; /** * @description: 大屏驾驶舱 @@ -83,12 +84,13 @@ public class DigitalCockpit { @Operation(summary = "基地统计信息") @Parameter(name = "baseId", description = "基地ID", required = true) public CommonResult getBaseStatisticsInfo(@RequestParam("baseId") String baseId) { - BaseStatisticsInfoRespVO res = new BaseStatisticsInfoRespVO(); - res.setTotalArea(0); - res.setTotalCropSpecies(0); - res.setTotalCropPlot(0); - res.setTotalPlot(0); - return success(res); + + int totalArea = baseInfoService.getBaseTotalArea(baseId, getLoginUser().getTenantId().toString()); + int totalCropSpecies = productionPlanService.getGrowingCropCount(baseId); + int totalCropPlot = productionPlanService.getGrowingPlotCount(baseId); + int totalPlot = plotInfoService.countPlot(baseId); + + return success(new BaseStatisticsInfoRespVO(totalArea,totalCropSpecies,totalCropPlot,totalPlot)); } @GetMapping("/base-name/list") diff --git a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/baseinfo/BaseInfoService.java b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/baseinfo/BaseInfoService.java index df79519e..d40fd16b 100644 --- a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/baseinfo/BaseInfoService.java +++ b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/baseinfo/BaseInfoService.java @@ -98,6 +98,7 @@ public interface BaseInfoService { * @return */ Double getBaseTotalArea(String tenantId); + Integer getBaseTotalArea(String baseId,String tenantId); Integer getBaseTotalCount(String tenantId); diff --git a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/baseinfo/BaseInfoServiceImpl.java b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/baseinfo/BaseInfoServiceImpl.java index 942160ac..8b9c7ec9 100644 --- a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/baseinfo/BaseInfoServiceImpl.java +++ b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/baseinfo/BaseInfoServiceImpl.java @@ -360,6 +360,15 @@ public class BaseInfoServiceImpl implements BaseInfoService { return d.doubleValue(); } + @Override + public Integer getBaseTotalArea(String baseId, String tenantId) { + BigDecimal d = baseInfoMapper.getTotalBaseArea(baseId,Long.valueOf(tenantId)); + if (d == null) { + return 0; + } + return d.intValue(); + } + @Override public Integer getBaseTotalCount(String tenantId) { return baseInfoMapper.getBaseCount(Long.valueOf(tenantId)); diff --git a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/plotinfo/PlotInfoService.java b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/plotinfo/PlotInfoService.java index 97cd38cc..42727605 100644 --- a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/plotinfo/PlotInfoService.java +++ b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/plotinfo/PlotInfoService.java @@ -100,4 +100,6 @@ public interface PlotInfoService { * @return */ List getRegularPlotInfoList(); + + int countPlot(String baseId); } \ No newline at end of file diff --git a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/plotinfo/PlotInfoServiceImpl.java b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/plotinfo/PlotInfoServiceImpl.java index 356bafbe..e81694fc 100644 --- a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/plotinfo/PlotInfoServiceImpl.java +++ b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/service/plotinfo/PlotInfoServiceImpl.java @@ -203,4 +203,9 @@ public class PlotInfoServiceImpl implements PlotInfoService { }).toList(); } + @Override + public int countPlot(String baseId) { + Long count = plotInfoMapper.selectCount(PlotInfoDO::getBaseId, baseId); + return count.intValue(); + } } \ No newline at end of file