feat (farm): API接口

- 数字驾驶舱-灾害统计-灾害分析
- 数字驾驶舱-灾害统计-农事分布
This commit is contained in:
达富斌
2025-09-05 10:30:54 +08:00
parent 411adc861e
commit 55e043b8aa
12 changed files with 142 additions and 0 deletions

View File

@@ -69,6 +69,8 @@ public class ApiController {
return baseInfoService.getBaseOverview(req);
}
// TODO: 2025/9/4 地图展示信息 - 设备坐标
@GetMapping("/digital-cockpit/list")
@Operation(summary = "数字驾驶舱-基地信息列表")
public CommonResult<List<FarmBaseInfoRespVO>> getBaseInfoList(@Valid @RequestBody FarmBaseInfoReqVO req) {
@@ -87,4 +89,22 @@ public class ApiController {
return productionPlanService.getPlantingPlanCompletionChart(req);
}
@GetMapping("/digital-cockpit/chart/disaster-statistics")
@Operation(summary = "数字驾驶舱-灾害统计-灾害分析")
public CommonResult<List<DisasterAnalysisRespVO>> getDisasterStatisticsChart(@Valid @RequestBody DisasterAnalysisReqVO req) {
return productionPlanService.getDisasterStatisticsChart(req); // TODO: 2025/9/4 未实现
}
@GetMapping("/digital-cockpit/chart/farming-distribution")
@Operation(summary = "数字驾驶舱-灾害统计-农事分布")
public CommonResult<List<FarmingDistributionRespVO>> getFarmingDistributionChart(@Valid @RequestBody FarmingDistributionReqVO req) {
return productionPlanService.getFarmingDistributionChart(req); // TODO: 2025/9/4 未实现
}
// todo 设备监控
// todo 物候信息
// todo 设备总览
}

View File

@@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.farm.controller.admin.api.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 数字驾驶舱-统计图-灾害分析 请求实体
* @author: binda
* @date: 2025/9/4 22:22
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DisasterAnalysisReqVO {
private String id;
}

View File

@@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.farm.controller.admin.api.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 数字驾驶舱-统计图-灾害分析 响应实体
* @author: binda
* @date: 2025/9/4 22:23
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DisasterAnalysisRespVO {
private String id;
}

View File

@@ -28,6 +28,8 @@ public class FarmBaseOverviewRespVO {
private Double baseTotalArea;
@Schema(description = "基地总数量")
private Integer baseTotalCount;
@Schema(description = "地块总数量")
private Integer plotTotalCount;
@Schema(description = "品种总数量")
private Integer cropTotalCount;
@Schema(description = "物联网设备总数")

View File

@@ -28,6 +28,10 @@ public class FarmProductionPlanDetailRespVO {
@JsonFormat(pattern = "yyyy-MM-dd")
@Schema(description = "种植结束日期")
private LocalDate productionEndDate;
@Schema(description = "基地ID")
private String baseId;
@Schema(description = "基地名称")
private String baseName;
@Schema(description = "基地中心点坐标")
private String centrePoint;

View File

@@ -0,0 +1,17 @@
package cn.iocoder.yudao.module.farm.controller.admin.api.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 数字驾驶舱-统计图-农事分布 请求实体
* @author: binda
* @date: 2025/9/4 22:28
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FarmingDistributionReqVO {
private String id;
}

View File

@@ -0,0 +1,17 @@
package cn.iocoder.yudao.module.farm.controller.admin.api.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 数字驾驶舱-统计图-农事分布 响应实体
* @author: binda
* @date: 2025/9/4 22:30
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FarmingDistributionRespVO {
private String id;
}

View File

@@ -281,6 +281,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
tenantInfo.setTenantId(bDO.getTenantId());
tenantInfo.setBaseTotalArea(this.getBaseTotalArea(tenantId));
tenantInfo.setBaseTotalCount(this.getBaseTotalCount(tenantId));
tenantInfo.setPlotTotalCount(plotInfoService.getPlotTotalCount(tenantId));
tenantInfo.setCropTotalCount(speciesLibraryService.getCropTotalCount(tenantId));
tenantInfo.setIotDeviceTotalCount(0); // TODO: 2025/9/4

View File

@@ -69,4 +69,11 @@ public interface PlotInfoService {
* @param id
*/
void deleteByBaseId(String baseId);
/**
* 租户-地块总数
* @param tenantId
* @return
*/
Integer getPlotTotalCount(String tenantId);
}

View File

@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.farm.service.plotinfo;
import cn.hutool.core.util.IdUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoPageReqVO;
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoSaveReqVO;
@@ -10,6 +11,7 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
import cn.iocoder.yudao.module.farm.dal.mysql.baseinfo.BaseInfoMapper;
import cn.iocoder.yudao.module.farm.dal.mysql.plotinfo.PlotInfoMapper;
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -139,6 +141,15 @@ public class PlotInfoServiceImpl implements PlotInfoService {
plotInfoMapper.delete("base_id", baseId);
}
@Override
public Integer getPlotTotalCount(String tenantId) {
LambdaQueryWrapperX<PlotInfoDO> wrapperX = new LambdaQueryWrapperX<>();
wrapperX.eq(PlotInfoDO::getTenantId, tenantId);
wrapperX.eq(PlotInfoDO::getDeleted, CommonConstants.NO_CODE);
Long count = plotInfoMapper.selectCount(wrapperX);
return count.intValue();
}
/**
* 验证: 地块总面积不得大于基地面积
*

View File

@@ -188,4 +188,20 @@ public interface ProductionPlanService {
* @return
*/
CommonResult<List<PlantingPlanCompletionRespVO>> getPlantingPlanCompletionChart(PlantingPlanCompletionReqVO req);
/**
* api 接口
* 灾害统计-灾害分析
* @param req
* @return
*/
CommonResult<List<DisasterAnalysisRespVO>> getDisasterStatisticsChart(DisasterAnalysisReqVO req);
/**
* api 接口
* 灾害统计-农事分布
* @param req
* @return
*/
CommonResult<List<FarmingDistributionRespVO>> getFarmingDistributionChart(FarmingDistributionReqVO req);
}

View File

@@ -369,6 +369,8 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
res.setProductionPlanName(planDO.getPlanNumber());
res.setProductionStartDate(planDO.getProductionStartDate());
res.setProductionEndDate(planDO.getProductionEndDate());
res.setBaseId(baseDO.getId());
res.setBaseName(baseDO.getName());
res.setCentrePoint(baseDO.getCentrePoint());
return CommonResult.success(res);
@@ -386,4 +388,13 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
return CommonResult.success(res);
}
@Override
public CommonResult<List<DisasterAnalysisRespVO>> getDisasterStatisticsChart(DisasterAnalysisReqVO req) {
return null;
}
@Override
public CommonResult<List<FarmingDistributionRespVO>> getFarmingDistributionChart(FarmingDistributionReqVO req) {
return null;
}
}