fix (farm): 农事报表
- 农事任务统计 - 投入品金额统计 - 投入品金额趋势统计
This commit is contained in:
@@ -8,10 +8,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.Farmin
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordCreateReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.FarmTypeChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.PlantingAreaChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.*;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingrecord.FarmingRecordDO;
|
||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||
import cn.iocoder.yudao.module.farm.service.cropFarmingCenter.CropFarmingCenterService;
|
||||
@@ -29,10 +26,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.FARMING_RECORD_STATUS_2;
|
||||
@@ -265,6 +260,8 @@ public class CropFarmingCenterController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
// 农事报表
|
||||
@Operation(summary = "农事报表")
|
||||
@GetMapping("/farming-report/1")
|
||||
public CommonResult<List<FarmingReport1RespVO>> getFarmReport(ChartCommonReqVO req) {
|
||||
@@ -272,25 +269,61 @@ public class CropFarmingCenterController {
|
||||
return success(res);
|
||||
}
|
||||
|
||||
@Operation(summary = "农事报表-农事任务分类统计")
|
||||
@GetMapping("/farming-report/chart/farm-type")
|
||||
public CommonResult<List<FarmTypeChartRespVO>> getFarmTypeChart(ChartCommonReqVO req) {
|
||||
List<FarmTypeChartRespVO> res = cropFarmingCenterService.getFarmTypeChart(req);
|
||||
return success(res);
|
||||
}
|
||||
// @Operation(summary = "农事报表-农事任务分类统计")
|
||||
// @GetMapping("/farming-report/chart/farm-type")
|
||||
// public CommonResult<List<FarmTypeChartRespVO>> getFarmTypeChart(ChartCommonReqVO req) {
|
||||
// List<FarmTypeChartRespVO> res = cropFarmingCenterService.getFarmTypeChart(req);
|
||||
// return success(res);
|
||||
// }
|
||||
|
||||
@Operation(summary = "农事报表-种植类信息")
|
||||
@GetMapping("/farming-report/chart/species")
|
||||
public CommonResult<List<PlantingAreaChartRespVO>> getPlantingAreaChart(ChartCommonReqVO req) {
|
||||
List<PlantingAreaChartRespVO> res = cropFarmingCenterService.getPlantingAreaChart(req);
|
||||
@GetMapping("/farming-report/chart/species/plant")
|
||||
public CommonResult<List<PlantChartRespVO>> getPlantChart(ChartCommonReqVO req) {
|
||||
List<PlantChartRespVO> res = cropFarmingCenterService.getPlantChart(req);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
@Operation(summary = "农事报表-投入品分类统计")
|
||||
@Operation(summary = "农事报表-养殖类信息")
|
||||
@GetMapping("/farming-report/chart/species/breed")
|
||||
public CommonResult<List<BreedChartRespVO>> getBreedChart(ChartCommonReqVO req) {
|
||||
List<BreedChartRespVO> res = cropFarmingCenterService.getBreedChart(req);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
@Operation(summary = "农事报表-投入品类型统计")
|
||||
@GetMapping("/farming-report/chart/input-type")
|
||||
public CommonResult<List<InputUsageChartRespVO>> getInputUsageChart(ChartCommonReqVO req) {
|
||||
List<InputUsageChartRespVO> res = cropFarmingCenterService.getInputUsageChart(req);
|
||||
public CommonResult<List<InputUsageByTypeChartRespVO>> getInputUsageByTypeChart(ChartCommonReqVO req) {
|
||||
List<InputUsageByTypeChartRespVO> res = cropFarmingCenterService.getInputUsageByTypeChart(req);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
@Operation(summary = "农事报表-投入品名称统计")
|
||||
@GetMapping("/farming-report/chart/input-name")
|
||||
public CommonResult<List<InputUsageByNameChartRespVO>> getInputUsageByNameChart(ChartCommonReqVO req) {
|
||||
List<InputUsageByNameChartRespVO> res = cropFarmingCenterService.getInputUsageByNameChart(req);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
@Operation(summary = "农事报表-农事记录农事类型统计")
|
||||
@GetMapping("/farming-report/chart/farm-type")
|
||||
public CommonResult<List<FarmRecordForFarmTypeChartRespVO>> getFarmRecord4FarmTypeChart(ChartCommonReqVO req) {
|
||||
List<FarmRecordForFarmTypeChartRespVO> res = cropFarmingCenterService.getFarmRecord4FarmTypeChart(req);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
@Operation(summary = "农事报表-农事记录农事名称统计")
|
||||
@GetMapping("/farming-report/chart/farm-name")
|
||||
public CommonResult<List<FarmRecordForFarmNameChartRespVO>> getFarmRecord4FarmNameChart(ChartCommonReqVO req) {
|
||||
List<FarmRecordForFarmNameChartRespVO> res = cropFarmingCenterService.getFarmRecord4FarmNameChart(req);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
@Operation(summary = "(5年内)金额统计趋势")
|
||||
@GetMapping("/farming-report/chart/input-trend")
|
||||
public CommonResult<List<InputUsageTrendChartRespVO>> getInputUsageTrendChart(ChartCommonReqVO req) {
|
||||
List<InputUsageTrendChartRespVO> res = cropFarmingCenterService.getInputUsageTrendChart(req);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: 养殖
|
||||
* @author: binda
|
||||
* @date: 2025/11/9 17:01
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BreedChartRespVO {
|
||||
@Schema(description = "物种名称")
|
||||
private String speciesName;
|
||||
@Schema(description = "计划网箱数量")
|
||||
private Integer predictedGridNumber;
|
||||
@Schema(description = "总网箱数量")
|
||||
private Integer plotGridNumber;
|
||||
}
|
||||
@@ -18,4 +18,9 @@ public class ChartCommonReqVO {
|
||||
private Integer yearDate;
|
||||
private String state;
|
||||
private String tenantId;
|
||||
|
||||
// 农事类型ID
|
||||
private String farmTypeId;
|
||||
// 投入品-类型ID
|
||||
private String inputTypeId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: 农事记录 - 农事名称 统计
|
||||
* @author: binda
|
||||
* @date: 2025/11/8 16:21
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FarmRecordForFarmNameChartRespVO {
|
||||
@Schema(description = "农事名称")
|
||||
private String farmName;
|
||||
@Schema(description = "农事记录数量")
|
||||
private String farmRecordCount;
|
||||
}
|
||||
@@ -8,29 +8,23 @@ import lombok.NoArgsConstructor;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @description: 投入品 - 名称
|
||||
* @author: binda
|
||||
* @date: 2025/10/27 00:10
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class InputUsageChartRespVO {
|
||||
@Schema(description = "投入品名称")
|
||||
public class InputUsageByNameChartRespVO {
|
||||
@Schema(description = "投入品类型名称")
|
||||
private String inputName;
|
||||
|
||||
@Schema(description = "用量")
|
||||
private Integer usageAmount;
|
||||
@Schema(description = "总用量")
|
||||
private BigDecimal usageAmount;
|
||||
|
||||
private Integer currentSpecType;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private Integer unit;
|
||||
private String unitName;
|
||||
|
||||
@Schema(description = "单价金额")
|
||||
@Schema(description = "平均单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@Schema(description = "总金额")
|
||||
@Schema(description = "总价格")
|
||||
private BigDecimal totalPrice;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description: 投入品 - 类型
|
||||
* @author: binda
|
||||
* @date: 2025/10/27 00:10
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class InputUsageByTypeChartRespVO {
|
||||
|
||||
@Schema(description = "投入品类型ID")
|
||||
private String inputTypeId;
|
||||
|
||||
@Schema(description = "投入品类型名称")
|
||||
private String inputTypeName;
|
||||
|
||||
@Schema(description = "总用量")
|
||||
private BigDecimal usageAmount;
|
||||
|
||||
@Schema(description = "平均单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@Schema(description = "总价格")
|
||||
private BigDecimal totalPrice;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author: binda
|
||||
* @date: 2025/11/9 20:02
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class InputUsageTrendChartRespVO {
|
||||
@Schema(description = "年份")
|
||||
private Integer year;
|
||||
|
||||
@Schema(description = "总金额")
|
||||
private BigDecimal totalPrice;
|
||||
}
|
||||
@@ -6,14 +6,14 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @description: 种植
|
||||
* @author: binda
|
||||
* @date: 2025/10/26 22:19
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PlantingAreaChartRespVO {
|
||||
public class PlantChartRespVO {
|
||||
@Schema(description = "物种名称")
|
||||
private String speciesName;
|
||||
@Schema(description = "种植数量")
|
||||
@@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmingDistributionR
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmingDistributionRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.FarmRecordForFarmNameChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.FarmRecordForFarmTypeChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.FarmTypeChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingrecord.FarmingRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -47,4 +49,8 @@ public interface FarmingRecordMapper extends BaseMapperX<FarmingRecordDO> {
|
||||
FarmingDistributionRespVO getFarmingDistributionChart(FarmingDistributionReqVO req);
|
||||
|
||||
List<FarmTypeChartRespVO> getFarmTypeChart(ChartCommonReqVO req);
|
||||
|
||||
List<FarmRecordForFarmTypeChartRespVO> getFarmRecord4FarmTypeChart(ChartCommonReqVO req);
|
||||
|
||||
List<FarmRecordForFarmNameChartRespVO> getFarmRecord4FarmNameChart(ChartCommonReqVO req);
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingReport1RespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageByNameChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageByTypeChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageTrendChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputUsageRecordsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -33,7 +35,11 @@ public interface InputUsageRecordsMapper extends BaseMapperX<InputUsageRecordsDO
|
||||
.orderByDesc(InputUsageRecordsDO::getCreateTime));
|
||||
}
|
||||
|
||||
List<InputUsageChartRespVO> getInputUsageChart(ChartCommonReqVO req);
|
||||
|
||||
List<FarmingReport1RespVO> getFarmReport(ChartCommonReqVO req);
|
||||
|
||||
|
||||
List<InputUsageByTypeChartRespVO> getInputUsageByTypeChart(ChartCommonReqVO req);
|
||||
List<InputUsageByNameChartRespVO> getInputUsageByNameChart(ChartCommonReqVO req);
|
||||
|
||||
List<InputUsageTrendChartRespVO> getInputUsageTrendChart(ChartCommonReqVO req);
|
||||
}
|
||||
@@ -7,8 +7,9 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.*;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.ProductionPlanPage2ReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.ProductionPlanRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.BreedChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.PlantingAreaChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.PlantChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.productionplan.ProductionPlanPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo.CropStatisticsRespVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlanDO;
|
||||
@@ -89,5 +90,7 @@ public interface ProductionPlanMapper extends BaseMapperX<ProductionPlanDO> {
|
||||
|
||||
List<CropStatisticsRespVO> getCultivatingAreaInfo(@Param("baseId") String baseId, @Param("year") String year);
|
||||
|
||||
List<PlantingAreaChartRespVO> getPlantingAreaChart(ChartCommonReqVO req);
|
||||
List<PlantChartRespVO> getPlantChart(ChartCommonReqVO req);
|
||||
|
||||
List<BreedChartRespVO> getBreedChart(ChartCommonReqVO req);
|
||||
}
|
||||
@@ -6,10 +6,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.Farmin
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.FarmTypeChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.PlantingAreaChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.*;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingrecord.FarmingRecordDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
@@ -79,7 +76,26 @@ public interface CropFarmingCenterService {
|
||||
|
||||
List<FarmTypeChartRespVO> getFarmTypeChart(ChartCommonReqVO req);
|
||||
|
||||
List<PlantingAreaChartRespVO> getPlantingAreaChart(ChartCommonReqVO req);
|
||||
/**
|
||||
* 种植类统计图
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
List<PlantChartRespVO> getPlantChart(ChartCommonReqVO req);
|
||||
|
||||
List<InputUsageChartRespVO> getInputUsageChart(ChartCommonReqVO req);
|
||||
/**
|
||||
* 养殖类统计图
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
List<BreedChartRespVO> getBreedChart(ChartCommonReqVO req);
|
||||
|
||||
List<InputUsageByTypeChartRespVO> getInputUsageByTypeChart(ChartCommonReqVO req);
|
||||
List<InputUsageByNameChartRespVO> getInputUsageByNameChart(ChartCommonReqVO req);
|
||||
|
||||
List<FarmRecordForFarmTypeChartRespVO> getFarmRecord4FarmTypeChart(ChartCommonReqVO req);
|
||||
|
||||
List<FarmRecordForFarmNameChartRespVO> getFarmRecord4FarmNameChart(ChartCommonReqVO req);
|
||||
|
||||
List<InputUsageTrendChartRespVO> getInputUsageTrendChart(ChartCommonReqVO req);
|
||||
}
|
||||
|
||||
@@ -12,10 +12,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.Farmin
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.farmingrecordinput.vo.FarmingRecordInputSaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.FarmTypeChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.PlantingAreaChartRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.*;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.grid.ProductionPlanGridRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelcycle.vo.ModelCycleRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelfarmingoperation.vo.ModelFarmingOperationRespVO;
|
||||
@@ -747,29 +744,46 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlantingAreaChartRespVO> getPlantingAreaChart(ChartCommonReqVO req) {
|
||||
public List<PlantChartRespVO> getPlantChart(ChartCommonReqVO req) {
|
||||
req.setTenantId(getLoginUser().getTenantId().toString());
|
||||
return productionPlanMapper.getPlantingAreaChart(req);
|
||||
return productionPlanMapper.getPlantChart(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InputUsageChartRespVO> getInputUsageChart(ChartCommonReqVO req) {
|
||||
public List<BreedChartRespVO> getBreedChart(ChartCommonReqVO req) {
|
||||
req.setTenantId(getLoginUser().getTenantId().toString());
|
||||
|
||||
Map<String, String> itemsNameMap = this.getDictTypeMap(ITEMS_UNIT);
|
||||
Map<String, String> specificationNameMap = this.getDictTypeMap(SPECIFICATION_PRICE);
|
||||
|
||||
List<InputUsageChartRespVO> list = inputUsageRecordsMapper.getInputUsageChart(req);
|
||||
for (InputUsageChartRespVO i : list) {
|
||||
if (i.getCurrentSpecType() == 1) {
|
||||
i.setUnitName(itemsNameMap.get(i.getUnit().toString()));
|
||||
} else {
|
||||
i.setUnitName(specificationNameMap.get(i.getUnit().toString()));
|
||||
}
|
||||
return productionPlanMapper.getBreedChart(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InputUsageByTypeChartRespVO> getInputUsageByTypeChart(ChartCommonReqVO req) {
|
||||
req.setTenantId(getLoginUser().getTenantId().toString());
|
||||
List<InputUsageByTypeChartRespVO> list = inputUsageRecordsMapper.getInputUsageByTypeChart(req);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InputUsageByNameChartRespVO> getInputUsageByNameChart(ChartCommonReqVO req) {
|
||||
req.setTenantId(getLoginUser().getTenantId().toString());
|
||||
return inputUsageRecordsMapper.getInputUsageByNameChart(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FarmRecordForFarmTypeChartRespVO> getFarmRecord4FarmTypeChart(ChartCommonReqVO req) {
|
||||
return farmingRecordMapper.getFarmRecord4FarmTypeChart(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FarmRecordForFarmNameChartRespVO> getFarmRecord4FarmNameChart(ChartCommonReqVO req) {
|
||||
return farmingRecordMapper.getFarmRecord4FarmNameChart(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InputUsageTrendChartRespVO> getInputUsageTrendChart(ChartCommonReqVO req) {
|
||||
req.setTenantId(getLoginUser().getTenantId().toString());
|
||||
return inputUsageRecordsMapper.getInputUsageTrendChart(req);
|
||||
}
|
||||
|
||||
private ProductionPlanReportRespVO.Models convertToModel(ProductionPlanDO plan, Map<String, String> speciesName) {
|
||||
String plantSpeciesName = speciesName.get(plan.getPlantSpeciesCode());
|
||||
String planStatusName = PLAN_MAP.get(plan.getPlanStatus());
|
||||
|
||||
@@ -52,6 +52,68 @@
|
||||
ORDER BY recordCount DESC
|
||||
</select>
|
||||
|
||||
<select id="getFarmRecord4FarmTypeChart"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.FarmRecordForFarmTypeChartRespVO">
|
||||
SELECT
|
||||
fftm.id AS farmTypeId,
|
||||
fftm.farming_name AS farmTypeName,
|
||||
COUNT(ffr.id) AS farmRecordCount
|
||||
FROM farm_farming_type_maintenance fftm
|
||||
LEFT JOIN farm_farming_record ffr ON fftm.id = ffr.task_type
|
||||
AND ffr.deleted = 0
|
||||
<if test="baseId != null and baseId != ''">
|
||||
AND ffr.base_id = #{baseId}
|
||||
</if>
|
||||
<if test="plotId != null and plotId != ''">
|
||||
AND ffr.plot_id = #{plotId}
|
||||
</if>
|
||||
<if test="yearDate != null">
|
||||
AND YEAR(ffr.task_start_date) = #{yearDate}
|
||||
</if>
|
||||
<if test="state != null and state != ''">
|
||||
AND ffr.task_status = #{state}
|
||||
</if>
|
||||
WHERE fftm.deleted = 0 AND fftm.use_status = 1
|
||||
GROUP BY farmTypeId, farmTypeName
|
||||
ORDER BY farmRecordCount DESC
|
||||
</select>
|
||||
|
||||
<select id="getFarmRecord4FarmNameChart"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.FarmRecordForFarmNameChartRespVO">
|
||||
SELECT
|
||||
ffnm.farming_name AS farmName,
|
||||
COUNT(ffr.id) AS farmRecordCount
|
||||
FROM farm_farming_name_maintenance ffnm
|
||||
LEFT JOIN farm_farming_record ffr ON ffnm.id = ffr.task_name
|
||||
AND ffr.deleted = 0
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND ffr.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="baseId != null and baseId != ''">
|
||||
AND ffr.base_id = #{baseId}
|
||||
</if>
|
||||
<if test="plotId != null and plotId != ''">
|
||||
AND ffr.plot_id = #{plotId}
|
||||
</if>
|
||||
<if test="yearDate != null">
|
||||
AND YEAR(ffr.task_start_date) = #{yearDate}
|
||||
</if>
|
||||
<if test="state != null and state != ''">
|
||||
AND ffr.task_status = #{state}
|
||||
</if>
|
||||
|
||||
<where>
|
||||
ffnm.deleted = 0 AND ffnm.use_status = 1
|
||||
<if test="farmTypeId != null and farmTypeId != ''">
|
||||
AND ffnm.farming_type_code = #{farmTypeId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
GROUP BY ffnm.id, ffnm.farming_name
|
||||
ORDER BY farmRecordCount DESC
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -9,44 +9,44 @@
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="getInputUsageChart"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageChartRespVO">
|
||||
<!-- <select id="getInputUsageChart"-->
|
||||
<!-- parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"-->
|
||||
<!-- resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageByTypeChartRespVO">-->
|
||||
|
||||
SELECT
|
||||
fiur.input_name AS inputName,
|
||||
SUM(fiur.usage_amount) AS usageAmount,
|
||||
CASE
|
||||
WHEN fiur.current_spec_type = 1 THEN fiur.unit
|
||||
WHEN fiur.current_spec_type = 2 THEN fiur.spec
|
||||
ELSE fiur.unit
|
||||
END AS unit,
|
||||
fiur.current_spec_type AS currentSpecType,
|
||||
AVG(fiur.unit_price) AS unitPrice,
|
||||
SUM(fiur.total_price) AS totalPrice
|
||||
FROM farm_input_usage_records fiur
|
||||
<where>
|
||||
fiur.deleted = 0
|
||||
<if test="tenantId != null">
|
||||
AND fiur.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="baseId != null and baseId != ''">
|
||||
AND fiur.base_id = #{baseId}
|
||||
</if>
|
||||
<if test="plotId != null and plotId != ''">
|
||||
AND fiur.plot_id = #{plotId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY fiur.input_name,
|
||||
CASE
|
||||
WHEN fiur.current_spec_type = 1 THEN fiur.unit
|
||||
WHEN fiur.current_spec_type = 2 THEN fiur.spec
|
||||
ELSE fiur.unit
|
||||
END,
|
||||
fiur.current_spec_type
|
||||
ORDER BY usageAmount DESC
|
||||
<!-- SELECT-->
|
||||
<!-- fiur.input_name AS inputName,-->
|
||||
<!-- SUM(fiur.usage_amount) AS usageAmount,-->
|
||||
<!-- CASE-->
|
||||
<!-- WHEN fiur.current_spec_type = 1 THEN fiur.unit-->
|
||||
<!-- WHEN fiur.current_spec_type = 2 THEN fiur.spec-->
|
||||
<!-- ELSE fiur.unit-->
|
||||
<!-- END AS unit,-->
|
||||
<!-- fiur.current_spec_type AS currentSpecType,-->
|
||||
<!-- AVG(fiur.unit_price) AS unitPrice,-->
|
||||
<!-- SUM(fiur.total_price) AS totalPrice-->
|
||||
<!-- FROM farm_input_usage_records fiur-->
|
||||
<!-- <where>-->
|
||||
<!-- fiur.deleted = 0-->
|
||||
<!-- <if test="tenantId != null">-->
|
||||
<!-- AND fiur.tenant_id = #{tenantId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="baseId != null and baseId != ''">-->
|
||||
<!-- AND fiur.base_id = #{baseId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="plotId != null and plotId != ''">-->
|
||||
<!-- AND fiur.plot_id = #{plotId}-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
<!-- GROUP BY fiur.input_name,-->
|
||||
<!-- CASE-->
|
||||
<!-- WHEN fiur.current_spec_type = 1 THEN fiur.unit-->
|
||||
<!-- WHEN fiur.current_spec_type = 2 THEN fiur.spec-->
|
||||
<!-- ELSE fiur.unit-->
|
||||
<!-- END,-->
|
||||
<!-- fiur.current_spec_type-->
|
||||
<!-- ORDER BY usageAmount DESC-->
|
||||
|
||||
</select>
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="getFarmReport"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||
@@ -88,4 +88,91 @@
|
||||
ORDER BY ffr.task_start_date DESC
|
||||
</select>
|
||||
|
||||
<select id="getInputUsageByTypeChart"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageByTypeChartRespVO">
|
||||
SELECT
|
||||
sdd.value AS inputTypeId,
|
||||
sdd.label AS inputTypeName,
|
||||
COALESCE(SUM(fiur.usage_amount), 0) AS usageAmount,
|
||||
ROUND(COALESCE(AVG(fiur.unit_price), 0), 2) AS unitPrice,
|
||||
ROUND(COALESCE(SUM(fiur.total_price), 0), 2) AS totalPrice
|
||||
FROM system_dict_data sdd
|
||||
LEFT JOIN farm_inputs fi ON CONVERT(sdd.value USING utf8mb4) COLLATE utf8mb4_unicode_ci = fi.input_type
|
||||
AND fi.input_category = 2
|
||||
AND fi.deleted = 0
|
||||
LEFT JOIN farm_input_usage_records fiur ON fi.id = fiur.input_id
|
||||
AND fiur.deleted = 0
|
||||
<if test="baseId != null and baseId != ''">
|
||||
AND fiur.base_id = #{baseId}
|
||||
</if>
|
||||
<if test="plotId != null and plotId != ''">
|
||||
AND fiur.plot_id = #{plotId}
|
||||
</if>
|
||||
<if test="yearDate != null">
|
||||
AND YEAR(fiur.create_time) = #{yearDate}
|
||||
</if>
|
||||
WHERE sdd.dict_type = 'asset_type'
|
||||
AND sdd.deleted = 0
|
||||
AND sdd.status = 0
|
||||
GROUP BY sdd.id, sdd.label, sdd.value
|
||||
ORDER BY totalPrice DESC
|
||||
</select>
|
||||
|
||||
<select id="getInputUsageByNameChart"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageByNameChartRespVO">
|
||||
SELECT
|
||||
fi.input_name AS inputName,
|
||||
COALESCE(SUM(fiur.usage_amount), 0) AS usageAmount,
|
||||
ROUND(COALESCE(AVG(fiur.unit_price), 0), 2) AS unitPrice,
|
||||
ROUND(COALESCE(SUM(fiur.total_price), 0), 2) AS totalPrice
|
||||
FROM farm_inputs fi
|
||||
LEFT JOIN farm_input_usage_records fiur ON fi.id = fiur.input_id
|
||||
AND fiur.deleted = 0
|
||||
<if test="baseId != null and baseId != ''">
|
||||
AND fiur.base_id = #{baseId}
|
||||
</if>
|
||||
<if test="plotId != null and plotId != ''">
|
||||
AND fiur.plot_id = #{plotId}
|
||||
</if>
|
||||
<if test="yearDate != null">
|
||||
AND YEAR(fiur.create_time) = #{yearDate}
|
||||
</if>
|
||||
WHERE fi.input_category = 2
|
||||
AND fi.deleted = 0
|
||||
<if test="inputTypeId != null and inputTypeId != ''">
|
||||
AND fi.input_type = #{inputTypeId}
|
||||
</if>
|
||||
GROUP BY fi.id, fi.input_name
|
||||
ORDER BY totalPrice DESC
|
||||
</select>
|
||||
|
||||
<select id="getInputUsageTrendChart"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageTrendChartRespVO">
|
||||
SELECT
|
||||
year_range.year AS year,
|
||||
ROUND(COALESCE(SUM(fiur.total_price), 0), 2) AS totalPrice
|
||||
FROM (
|
||||
SELECT YEAR(CURDATE()) - 4 AS year
|
||||
UNION SELECT YEAR(CURDATE()) - 3
|
||||
UNION SELECT YEAR(CURDATE()) - 2
|
||||
UNION SELECT YEAR(CURDATE()) - 1
|
||||
UNION SELECT YEAR(CURDATE())
|
||||
) year_range
|
||||
LEFT JOIN farm_input_usage_records fiur ON YEAR(fiur.create_time) = year_range.year
|
||||
AND fiur.deleted = 0
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND fiur.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="baseId != null and baseId != ''">
|
||||
AND fiur.base_id = #{baseId}
|
||||
</if>
|
||||
<if test="plotId != null and plotId != ''">
|
||||
AND fiur.plot_id = #{plotId}
|
||||
</if>
|
||||
GROUP BY year_range.year
|
||||
ORDER BY year_range.year ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -111,9 +111,9 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getPlantingAreaChart"
|
||||
<select id="getPlantChart"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.PlantingAreaChartRespVO">
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.PlantChartRespVO">
|
||||
|
||||
SELECT
|
||||
fsl.cultivar_name AS speciesName,
|
||||
@@ -161,4 +161,55 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getBreedChart"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.BreedChartRespVO">
|
||||
|
||||
SELECT
|
||||
fsl.cultivar_name AS speciesName,
|
||||
SUM(fpp.predicted_grid_number) AS predictedGridNumber,
|
||||
CASE
|
||||
WHEN #{plotId} IS NOT NULL AND #{plotId} != '' THEN
|
||||
MAX(fpp.plot_grid_number)
|
||||
WHEN #{baseId} IS NOT NULL AND #{baseId} != '' AND (#{plotId} IS NULL OR #{plotId} = '') THEN
|
||||
(
|
||||
SELECT SUM(plot_grid_number)
|
||||
FROM farm_production_plan
|
||||
WHERE base_id = #{baseId}
|
||||
AND tenant_id = #{tenantId}
|
||||
AND deleted = 0
|
||||
)
|
||||
ELSE
|
||||
(
|
||||
SELECT SUM(plot_grid_number)
|
||||
FROM farm_production_plan
|
||||
WHERE tenant_id = #{tenantId}
|
||||
AND deleted = 0
|
||||
)
|
||||
END AS plotGridNumber
|
||||
FROM farm_production_plan fpp
|
||||
LEFT JOIN farm_species_library fsl ON fpp.plant_species_code = fsl.id
|
||||
WHERE
|
||||
fpp.deleted = 0
|
||||
AND fsl.deleted = 0
|
||||
<if test="tenantId != null">
|
||||
AND fpp.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="yearDate != null">
|
||||
AND YEAR(fpp.production_start_date) = #{yearDate}
|
||||
</if>
|
||||
<if test="baseId != null and baseId != ''">
|
||||
AND fpp.base_id = #{baseId}
|
||||
</if>
|
||||
<if test="plotId != null and plotId != ''">
|
||||
AND fpp.plot_id = #{plotId}
|
||||
</if>
|
||||
<if test="state != null and state != ''">
|
||||
AND fpp.plan_status = #{state}
|
||||
</if>
|
||||
GROUP BY fsl.cultivar_name
|
||||
ORDER BY predictedGridNumber DESC
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user