fix (farm): 大屏数据维护
- 基地统计
This commit is contained in:
@@ -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<BaseStatisticsInfoRespVO> 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")
|
||||
|
||||
@@ -98,6 +98,7 @@ public interface BaseInfoService {
|
||||
* @return
|
||||
*/
|
||||
Double getBaseTotalArea(String tenantId);
|
||||
Integer getBaseTotalArea(String baseId,String tenantId);
|
||||
|
||||
Integer getBaseTotalCount(String tenantId);
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -100,4 +100,6 @@ public interface PlotInfoService {
|
||||
* @return
|
||||
*/
|
||||
List<RegularPlotInfoRespVO> getRegularPlotInfoList();
|
||||
|
||||
int countPlot(String baseId);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user