fix (farm): 微服务API
- 数字驾驶舱-统计图-种植计划完成情况
This commit is contained in:
@@ -44,7 +44,6 @@ public class ApiController {
|
||||
* @param req 根据租户id、开始时间、结束时间 ,已完成状态
|
||||
* @return 种植计划id、种植计划名称
|
||||
*/
|
||||
@PermitAll
|
||||
@PostMapping("/production-plan/page")
|
||||
@Operation(summary = "生产计划-分页")
|
||||
public CommonResult<PageResult<FarmProductionPlanRespVO>> getPageForFarmProductionPlan(@Valid @RequestBody FarmProductionPlanReqVO req) {
|
||||
@@ -59,14 +58,12 @@ public class ApiController {
|
||||
* @param req 根据租户id、种植计划id
|
||||
* @return 种植计划id、种植计划名称、种植开始时间、种植结束时间、计划所属的基地图片、基地简介、基地中心坐标点
|
||||
*/
|
||||
@PermitAll
|
||||
@PostMapping("/production-plan/get")
|
||||
@Operation(summary = "生产计划-详情")
|
||||
public CommonResult<FarmProductionPlanDetailRespVO> getDetailForFarmProductionPlan(@Valid @RequestBody FarmProductionPlanDetailReqVO req) {
|
||||
return productionPlanService.getDetailForFarmProductionPlan(req);
|
||||
}
|
||||
|
||||
@PermitAll
|
||||
@PostMapping("/digital-cockpit/get")
|
||||
@Operation(summary = "数字驾驶舱-基地概要信息")
|
||||
public CommonResult<FarmBaseOverviewRespVO> getBaseOverview(@Valid @RequestBody FarmBaseOverviewReqVO req) {
|
||||
@@ -74,35 +71,30 @@ public class ApiController {
|
||||
}
|
||||
|
||||
// TODO: 2025/9/4 地图展示信息 - 设备坐标
|
||||
@PermitAll
|
||||
@PostMapping("/digital-cockpit/list")
|
||||
@Operation(summary = "数字驾驶舱-基地信息列表")
|
||||
public CommonResult<List<FarmBaseInfoRespVO>> getBaseInfoList(@Valid @RequestBody FarmBaseInfoReqVO req) {
|
||||
return baseInfoService.getBaseInfoList(req);
|
||||
}
|
||||
|
||||
@PermitAll
|
||||
@PostMapping("/digital-cockpit/chart/yield-comparison")
|
||||
@Operation(summary = "数字驾驶舱-生产数据-产量对比")
|
||||
public CommonResult<List<YieldComparisonChartRespVO>> getYieldComparisonChart(@Valid @RequestBody YieldComparisonChartReqVO req) {
|
||||
return productionPlanService.getYieldComparisonChart(req);
|
||||
}
|
||||
|
||||
@PermitAll
|
||||
@PostMapping("/digital-cockpit/chart/planting-plan-completion")
|
||||
@Operation(summary = "数字驾驶舱-生产数据-种植计划完成情况")
|
||||
public CommonResult<PlantingPlanCompletionRespVO> getPlantingPlanCompletionChart(@Valid @RequestBody PlantingPlanCompletionReqVO req) {
|
||||
return productionPlanService.getPlantingPlanCompletionChart(req);
|
||||
}
|
||||
|
||||
@PermitAll
|
||||
@PostMapping("/digital-cockpit/chart/disaster-statistics")
|
||||
@Operation(summary = "数字驾驶舱-灾害统计-灾害分析")
|
||||
public CommonResult<List<DisasterAnalysisRespVO>> getDisasterStatisticsChart(@Valid @RequestBody DisasterAnalysisReqVO req) {
|
||||
return productionPlanService.getDisasterStatisticsChart(req); // TODO: 2025/9/4 未实现
|
||||
}
|
||||
|
||||
@PermitAll
|
||||
@PostMapping("/digital-cockpit/chart/farming-distribution")
|
||||
@Operation(summary = "数字驾驶舱-灾害统计-农事分布")
|
||||
public CommonResult<List<FarmingDistributionRespVO>> getFarmingDistributionChart(@Valid @RequestBody FarmingDistributionReqVO req) {
|
||||
|
||||
@@ -6,6 +6,8 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description: 数字驾驶舱-统计图-对比产量 请求实体
|
||||
* @author: binda
|
||||
@@ -22,5 +24,7 @@ public class YieldComparisonChartReqVO {
|
||||
@Schema(description = "租户ID")
|
||||
@NotNull(message = "租户ID: 不能为空")
|
||||
private String tenantId;
|
||||
@Schema(description = "日期 (yyyy)")
|
||||
private List<Integer> yieldDate;
|
||||
|
||||
}
|
||||
|
||||
@@ -46,18 +46,22 @@
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.api.vo.YieldComparisonChartRespVO">
|
||||
|
||||
SELECT
|
||||
YEAR(production_end_date) AS date,
|
||||
SUM(predicted_yields) AS predictedYields,
|
||||
SUM(practical_yields) AS practicalYields
|
||||
YEAR(production_start_date) AS date,
|
||||
COALESCE(SUM(predicted_yields), 0) AS predictedYields,
|
||||
COALESCE(SUM(practical_yields), 0) AS practicalYields
|
||||
FROM farm_production_plan
|
||||
<where>
|
||||
plan_status = 3
|
||||
AND deleted = 0
|
||||
AND production_end_date IS NOT NULL
|
||||
AND production_start_date IS NOT NULL
|
||||
<if test="tenantId != null and tenantId != ''">AND tenant_id = #{tenantId}</if>
|
||||
<if test="baseId != null and baseId != ''">AND base_id = #{baseId}</if>
|
||||
<!-- 添加年份范围筛选 -->
|
||||
<if test="yieldDate != null and yieldDate.size() == 2">
|
||||
AND YEAR(production_start_date) BETWEEN #{yieldDate[0]} AND #{yieldDate[1]}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY YEAR(production_end_date)
|
||||
GROUP BY YEAR(production_start_date)
|
||||
ORDER BY date
|
||||
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user