fix (farm): 大屏数据维护

- 基地统计
This commit is contained in:
达富斌
2025-09-24 19:30:38 +08:00
parent 78c3631435
commit 8823d549c6
5 changed files with 25 additions and 6 deletions

View File

@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
/** /**
* @description: 大屏驾驶舱 * @description: 大屏驾驶舱
@@ -83,12 +84,13 @@ public class DigitalCockpit {
@Operation(summary = "基地统计信息") @Operation(summary = "基地统计信息")
@Parameter(name = "baseId", description = "基地ID", required = true) @Parameter(name = "baseId", description = "基地ID", required = true)
public CommonResult<BaseStatisticsInfoRespVO> getBaseStatisticsInfo(@RequestParam("baseId") String baseId) { public CommonResult<BaseStatisticsInfoRespVO> getBaseStatisticsInfo(@RequestParam("baseId") String baseId) {
BaseStatisticsInfoRespVO res = new BaseStatisticsInfoRespVO();
res.setTotalArea(0); int totalArea = baseInfoService.getBaseTotalArea(baseId, getLoginUser().getTenantId().toString());
res.setTotalCropSpecies(0); int totalCropSpecies = productionPlanService.getGrowingCropCount(baseId);
res.setTotalCropPlot(0); int totalCropPlot = productionPlanService.getGrowingPlotCount(baseId);
res.setTotalPlot(0); int totalPlot = plotInfoService.countPlot(baseId);
return success(res);
return success(new BaseStatisticsInfoRespVO(totalArea,totalCropSpecies,totalCropPlot,totalPlot));
} }
@GetMapping("/base-name/list") @GetMapping("/base-name/list")

View File

@@ -98,6 +98,7 @@ public interface BaseInfoService {
* @return * @return
*/ */
Double getBaseTotalArea(String tenantId); Double getBaseTotalArea(String tenantId);
Integer getBaseTotalArea(String baseId,String tenantId);
Integer getBaseTotalCount(String tenantId); Integer getBaseTotalCount(String tenantId);

View File

@@ -360,6 +360,15 @@ public class BaseInfoServiceImpl implements BaseInfoService {
return d.doubleValue(); 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 @Override
public Integer getBaseTotalCount(String tenantId) { public Integer getBaseTotalCount(String tenantId) {
return baseInfoMapper.getBaseCount(Long.valueOf(tenantId)); return baseInfoMapper.getBaseCount(Long.valueOf(tenantId));

View File

@@ -100,4 +100,6 @@ public interface PlotInfoService {
* @return * @return
*/ */
List<RegularPlotInfoRespVO> getRegularPlotInfoList(); List<RegularPlotInfoRespVO> getRegularPlotInfoList();
int countPlot(String baseId);
} }

View File

@@ -203,4 +203,9 @@ public class PlotInfoServiceImpl implements PlotInfoService {
}).toList(); }).toList();
} }
@Override
public int countPlot(String baseId) {
Long count = plotInfoMapper.selectCount(PlotInfoDO::getBaseId, baseId);
return count.intValue();
}
} }