feat (farm):
- 基地,地块新增 编码字段 - 户主导入/出 重构 - 修复部分bug
This commit is contained in:
@@ -158,6 +158,17 @@
|
|||||||
<!-- <artifactId>spring-boot-starter-validation</artifactId>-->
|
<!-- <artifactId>spring-boot-starter-validation</artifactId>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.apache.poi</groupId>-->
|
||||||
|
<!-- <artifactId>poi</artifactId>-->
|
||||||
|
<!-- <version>5.2.3</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.apache.poi</groupId>-->
|
||||||
|
<!-- <artifactId>poi-scratchpad</artifactId>-->
|
||||||
|
<!-- <version>5.2.3</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ public class FarmingRecordSaveReqVO {
|
|||||||
@Schema(description = "任务计划 (1: 开始; 2: 结束;)")
|
@Schema(description = "任务计划 (1: 开始; 2: 结束;)")
|
||||||
private Integer taskStatus;
|
private Integer taskStatus;
|
||||||
|
|
||||||
@Schema(description = "所属地块", example = "10480")
|
|
||||||
private String plotId;
|
|
||||||
|
|
||||||
@Schema(description = "生产计划ID", example = "24782")
|
@Schema(description = "生产计划ID", example = "24782")
|
||||||
private String productionPlanId;
|
private String productionPlanId;
|
||||||
@@ -70,11 +69,17 @@ public class FarmingRecordSaveReqVO {
|
|||||||
@Schema(description = "基地", example = "李四")
|
@Schema(description = "基地", example = "李四")
|
||||||
private String baseName;
|
private String baseName;
|
||||||
|
|
||||||
|
@Schema(description = "所属地块", example = "10480")
|
||||||
|
private String plotId;
|
||||||
|
|
||||||
@Schema(description = "地块", example = "赵六")
|
@Schema(description = "地块", example = "赵六")
|
||||||
private String plotName;
|
private String plotName;
|
||||||
|
|
||||||
@Schema(description = "租户id", example = "23744")
|
@Schema(description = "租户id", example = "23744")
|
||||||
private String tenantId;
|
private String tenantId;
|
||||||
|
|
||||||
|
@Schema(description = "引用类型投入品id集合 (逗号分隔)")
|
||||||
|
private String inputsIds;
|
||||||
|
|
||||||
private List<FarmingRecordInputDO> investGoodsList;
|
private List<FarmingRecordInputDO> investGoodsList;
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,10 @@ import java.time.LocalDate;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class FarmingReport1RespVO {
|
public class FarmingReport1RespVO {
|
||||||
|
|
||||||
private String baseId;
|
@Schema(description = "农事记录ID")
|
||||||
|
private String farmRecordId;
|
||||||
|
|
||||||
|
@Schema(description = "基地名称")
|
||||||
private String baseName;
|
private String baseName;
|
||||||
|
|
||||||
@Schema(description = "计划编号")
|
@Schema(description = "计划编号")
|
||||||
@@ -35,18 +38,7 @@ public class FarmingReport1RespVO {
|
|||||||
@Schema(description = "持续天数")
|
@Schema(description = "持续天数")
|
||||||
private Integer intervalDays;
|
private Integer intervalDays;
|
||||||
|
|
||||||
@Schema(description = "投入品ID")
|
|
||||||
private String inputId;
|
|
||||||
private String inputName;
|
|
||||||
|
|
||||||
@Schema(description = "投入品总价")
|
@Schema(description = "投入品总价")
|
||||||
private Double inputTotalPrice;
|
private Double inputTotalPrice;
|
||||||
|
|
||||||
@Schema(description = "详情-用量")
|
|
||||||
private Integer usageAmount;
|
|
||||||
|
|
||||||
private Integer currentSpecType;
|
|
||||||
@Schema(description = "详情-单位")
|
|
||||||
private Integer unit;
|
|
||||||
private String unitName;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,14 @@ public class InputUsageChartRespVO {
|
|||||||
@Schema(description = "用量")
|
@Schema(description = "用量")
|
||||||
private Integer usageAmount;
|
private Integer usageAmount;
|
||||||
|
|
||||||
|
private Integer currentSpecType;
|
||||||
|
|
||||||
@Schema(description = "单位")
|
@Schema(description = "单位")
|
||||||
private Integer unit;
|
private Integer unit;
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
@Schema(description = "单价金额")
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
@Schema(description = "总金额")
|
@Schema(description = "总金额")
|
||||||
private BigDecimal totalPrice;
|
private BigDecimal totalPrice;
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ import lombok.NoArgsConstructor;
|
|||||||
public class PlantingAreaChartRespVO {
|
public class PlantingAreaChartRespVO {
|
||||||
@Schema(description = "物种名称")
|
@Schema(description = "物种名称")
|
||||||
private String speciesName;
|
private String speciesName;
|
||||||
|
@Schema(description = "种植数量")
|
||||||
|
private Integer plantingQuantity;
|
||||||
@Schema(description = "种植面积")
|
@Schema(description = "种植面积")
|
||||||
private Double plantingArea;
|
private Integer plantingArea;
|
||||||
@Schema(description = "种植面积占比")
|
@Schema(description = "总面积")
|
||||||
private String areaPercentage;
|
private Integer totalArea;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,9 @@ public class BaseInfoController {
|
|||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
public CommonResult<BaseInfoRespVO> getBaseInfo(@RequestParam("id") String id) {
|
public CommonResult<BaseInfoRespVO> getBaseInfo(@RequestParam("id") String id) {
|
||||||
BaseInfoDO baseInfo = baseInfoService.getBaseInfo(id);
|
BaseInfoDO baseInfo = baseInfoService.getBaseInfo(id);
|
||||||
return success(BeanUtils.toBean(baseInfo, BaseInfoRespVO.class));
|
BaseInfoRespVO res = BeanUtils.toBean(baseInfo, BaseInfoRespVO.class);
|
||||||
|
res.setUpdateStateForCode(1);
|
||||||
|
return success(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
|
|||||||
@@ -120,10 +120,10 @@ public class PlotInfoController {
|
|||||||
@Parameters({
|
@Parameters({
|
||||||
@Parameter(name = "file", description = "Excel 文件", required = true),
|
@Parameter(name = "file", description = "Excel 文件", required = true),
|
||||||
})
|
})
|
||||||
public CommonResult<Boolean> importPlotLesseeInfoExcel(@RequestParam("file") MultipartFile file) throws IOException {
|
public CommonResult<PlotLesseeImportRespVO> importPlotLesseeInfoExcel(@RequestParam("file") MultipartFile file) throws IOException {
|
||||||
List<PlotLesseeForImportExcelRespVO> list = ExcelUtils.read(file, PlotLesseeForImportExcelRespVO.class);
|
List<PlotLesseeForImportExcelRespVO> list = ExcelUtils.read(file, PlotLesseeForImportExcelRespVO.class);
|
||||||
plotInfoService.setPlotLesseeInfo(list);
|
PlotLesseeImportRespVO res = plotInfoService.setPlotLesseeInfo(list);
|
||||||
return success(true);
|
return success(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,11 @@ public class BaseInfoRespVO {
|
|||||||
@ExcelProperty("基地id")
|
@ExcelProperty("基地id")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "基地编号")
|
||||||
|
private String code;
|
||||||
|
@Schema(description = "基地编号-可修改状态 (1: 可以; 2: 不可以)")
|
||||||
|
private Integer updateStateForCode;
|
||||||
|
|
||||||
@Schema(description = "基地名称", example = "张三")
|
@Schema(description = "基地名称", example = "张三")
|
||||||
@ExcelProperty("基地名称")
|
@ExcelProperty("基地名称")
|
||||||
private String name;
|
private String name;
|
||||||
@@ -89,6 +94,8 @@ public class BaseInfoRespVO {
|
|||||||
private String plotPoint;
|
private String plotPoint;
|
||||||
private Integer plotLeaseStatus;
|
private Integer plotLeaseStatus;
|
||||||
private String plotLeaseStatusName;
|
private String plotLeaseStatusName;
|
||||||
|
@Schema(description = "网格数量")
|
||||||
|
private Integer gridNumber;
|
||||||
@Schema(description = "网格信息")
|
@Schema(description = "网格信息")
|
||||||
private List<GridInfo> gridOverviewList;
|
private List<GridInfo> gridOverviewList;
|
||||||
@Schema(description = "户主流转信息")
|
@Schema(description = "户主流转信息")
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ public class BaseInfoSaveReqVO {
|
|||||||
@Schema(description = "基地id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13189")
|
@Schema(description = "基地id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13189")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "基地编号")
|
||||||
|
private String code;
|
||||||
|
@Schema(description = "基地编号-可修改状态 (1: 可以; 2: 不可以)")
|
||||||
|
private Integer updateStateForCode;
|
||||||
|
|
||||||
@Schema(description = "基地名称", example = "张三")
|
@Schema(description = "基地名称", example = "张三")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ public class PlotInfoRespVO {
|
|||||||
@ExcelProperty("id")
|
@ExcelProperty("id")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "地块编号")
|
||||||
|
private String code;
|
||||||
|
@Schema(description = "地块编号-可修改状态 (1: 可以; 2: 不可以)")
|
||||||
|
private Integer updateStateForCode;
|
||||||
|
|
||||||
@Schema(description = "所属基地ID")
|
@Schema(description = "所属基地ID")
|
||||||
@ExcelProperty("所属基地ID")
|
@ExcelProperty("所属基地ID")
|
||||||
private String baseId;
|
private String baseId;
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ public class PlotInfoSaveReqVO {
|
|||||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11262")
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11262")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "地块编号")
|
||||||
|
private String code;
|
||||||
|
@Schema(description = "地块编号-可修改状态 (1: 可以; 2: 不可以)")
|
||||||
|
private Integer updateStateForCode;
|
||||||
|
|
||||||
@Schema(description = "基地ID", example = "1431")
|
@Schema(description = "基地ID", example = "1431")
|
||||||
private String baseId;
|
private String baseId;
|
||||||
|
|
||||||
@@ -42,6 +47,9 @@ public class PlotInfoSaveReqVO {
|
|||||||
@Schema(description = " 租赁状态 (1: 已租; 0: 未租;)")
|
@Schema(description = " 租赁状态 (1: 已租; 0: 未租;)")
|
||||||
private Integer plotLeaseStatus;
|
private Integer plotLeaseStatus;
|
||||||
|
|
||||||
|
@Schema(description = "网格数量")
|
||||||
|
private Integer gridNumber;
|
||||||
|
|
||||||
@Schema(description = "租赁人信息")
|
@Schema(description = "租赁人信息")
|
||||||
private PlotLesseeSaveReqVO plotLessee;
|
private PlotLesseeSaveReqVO plotLessee;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 地块户主 - 导出")
|
@Schema(description = "管理后台 - 地块户主 - 导出")
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -15,10 +17,18 @@ import lombok.NoArgsConstructor;
|
|||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class PlotLesseeForExportExcelRespVO {
|
public class PlotLesseeForExportExcelRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "基地编号")
|
||||||
|
@ExcelProperty("基地编号")
|
||||||
|
private String baseCode;
|
||||||
|
|
||||||
@Schema(description = "基地名称")
|
@Schema(description = "基地名称")
|
||||||
@ExcelProperty("基地名称")
|
@ExcelProperty("基地名称")
|
||||||
private String baseName;
|
private String baseName;
|
||||||
|
|
||||||
|
@Schema(description = "地块编码")
|
||||||
|
@ExcelProperty("地块编码")
|
||||||
|
private String plotCode;
|
||||||
|
|
||||||
@Schema(description = "地块名称")
|
@Schema(description = "地块名称")
|
||||||
@ExcelProperty("地块名称")
|
@ExcelProperty("地块名称")
|
||||||
private String plotName;
|
private String plotName;
|
||||||
@@ -38,15 +48,26 @@ public class PlotLesseeForExportExcelRespVO {
|
|||||||
@Schema(description = "租赁开始日期")
|
@Schema(description = "租赁开始日期")
|
||||||
@ExcelProperty("租赁开始日期 (yyyy-MM-dd)")
|
@ExcelProperty("租赁开始日期 (yyyy-MM-dd)")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private String leaseStartDate;
|
private LocalDate leaseStartDate;
|
||||||
|
|
||||||
@Schema(description = "租赁接口日期")
|
@Schema(description = "租赁结束日期")
|
||||||
@ExcelProperty("租赁接口日期 (yyyy-MM-dd)")
|
@ExcelProperty("租赁结束日期 (yyyy-MM-dd)")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private String leaseEndDate;
|
private LocalDate leaseEndDate;
|
||||||
|
|
||||||
public PlotLesseeForExportExcelRespVO(String baseName, String plotName) {
|
@Schema(description = "租赁剩余天数")
|
||||||
|
@ExcelProperty("租赁剩余天数")
|
||||||
|
private Long expirationDays;
|
||||||
|
|
||||||
|
@Schema(description = "是否修改 (是/否)")
|
||||||
|
@ExcelProperty("是否修改 (是/否))")
|
||||||
|
private String isModified;
|
||||||
|
|
||||||
|
public PlotLesseeForExportExcelRespVO(String baseCode, String baseName, String plotCode, String plotName,String isModified) {
|
||||||
|
this.baseCode = baseCode;
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
|
this.plotCode = plotCode;
|
||||||
this.plotName = plotName;
|
this.plotName = plotName;
|
||||||
|
this.isModified = isModified;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,10 +18,18 @@ import java.time.LocalDate;
|
|||||||
@Accessors(chain = false)
|
@Accessors(chain = false)
|
||||||
public class PlotLesseeForImportExcelRespVO {
|
public class PlotLesseeForImportExcelRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "基地编号")
|
||||||
|
@ExcelProperty("基地编号")
|
||||||
|
private String baseCode;
|
||||||
|
|
||||||
@Schema(description = "基地名称")
|
@Schema(description = "基地名称")
|
||||||
@ExcelProperty("基地名称")
|
@ExcelProperty("基地名称")
|
||||||
private String baseName;
|
private String baseName;
|
||||||
|
|
||||||
|
@Schema(description = "地块编码")
|
||||||
|
@ExcelProperty("地块编码")
|
||||||
|
private String plotCode;
|
||||||
|
|
||||||
@Schema(description = "地块名称")
|
@Schema(description = "地块名称")
|
||||||
@ExcelProperty("地块名称")
|
@ExcelProperty("地块名称")
|
||||||
private String plotName;
|
private String plotName;
|
||||||
@@ -43,13 +51,16 @@ public class PlotLesseeForImportExcelRespVO {
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private LocalDate leaseStartDate;
|
private LocalDate leaseStartDate;
|
||||||
|
|
||||||
@Schema(description = "租赁接口日期")
|
@Schema(description = "租赁结束日期")
|
||||||
@ExcelProperty("租赁接口日期 (yyyy-MM-dd)")
|
@ExcelProperty("租赁结束日期 (yyyy-MM-dd)")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private LocalDate leaseEndDate;
|
private LocalDate leaseEndDate;
|
||||||
|
|
||||||
public PlotLesseeForImportExcelRespVO(String baseName, String plotName) {
|
@Schema(description = "租赁剩余天数")
|
||||||
this.baseName = baseName;
|
@ExcelProperty("租赁剩余天数)")
|
||||||
this.plotName = plotName;
|
private Long expirationDays;
|
||||||
}
|
|
||||||
|
@Schema(description = "是否修改 (是/否)")
|
||||||
|
@ExcelProperty("是否修改 (是/否))")
|
||||||
|
private String isModified;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 导入结果反馈
|
||||||
|
* @author: binda
|
||||||
|
* @date: 2025/10/27 23:21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class PlotLesseeImportRespVO {
|
||||||
|
|
||||||
|
private Integer total;
|
||||||
|
private Integer successCount;
|
||||||
|
private Integer failuresCount;
|
||||||
|
private Integer unmodifiedCount;
|
||||||
|
private List<Row> failuresList;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class Row {
|
||||||
|
private String plotCode;
|
||||||
|
private String plotName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -26,6 +26,12 @@ public class PlotLesseeInfoRespVO {
|
|||||||
@ExcelProperty("地块ID")
|
@ExcelProperty("地块ID")
|
||||||
private String plotId;
|
private String plotId;
|
||||||
|
|
||||||
|
@Schema(description = "地块编号")
|
||||||
|
private String code;
|
||||||
|
@Schema(description = "地块编号-可修改状态 (1: 可以; 2: 不可以)")
|
||||||
|
private Integer updateStateForCode;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "地块名称")
|
@Schema(description = "地块名称")
|
||||||
@ExcelProperty("地块名称")
|
@ExcelProperty("地块名称")
|
||||||
private String plotName;
|
private String plotName;
|
||||||
@@ -61,6 +67,9 @@ public class PlotLesseeInfoRespVO {
|
|||||||
private Integer plotLeaseStatus;
|
private Integer plotLeaseStatus;
|
||||||
private String plotLeaseStatusName;
|
private String plotLeaseStatusName;
|
||||||
|
|
||||||
|
@Schema(description = "网格数量")
|
||||||
|
private Integer gridNumber;
|
||||||
|
|
||||||
@Schema(description = "租赁人信息")
|
@Schema(description = "租赁人信息")
|
||||||
private PlotLesseeDetailsRespVO plotLessee;
|
private PlotLesseeDetailsRespVO plotLessee;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanag
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
@@ -39,17 +41,14 @@ public class ModelCycleController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ModelCycleService modelCycleService;
|
private ModelCycleService modelCycleService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建模型管理-管理周期")
|
@Operation(summary = "创建模型管理-管理周期")
|
||||||
|
|
||||||
public CommonResult<String> createModelCycle(@Valid @RequestBody ModelCycleSaveReqVO createReqVO) {
|
public CommonResult<String> createModelCycle(@Valid @RequestBody ModelCycleSaveReqVO createReqVO) {
|
||||||
return success(modelCycleService.createModelCycle(createReqVO));
|
return success(modelCycleService.createModelCycle(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新模型管理-管理周期")
|
@Operation(summary = "更新模型管理-管理周期")
|
||||||
|
|
||||||
public CommonResult<Boolean> updateModelCycle(@Valid @RequestBody ModelCycleSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateModelCycle(@Valid @RequestBody ModelCycleSaveReqVO updateReqVO) {
|
||||||
modelCycleService.updateModelCycle(updateReqVO);
|
modelCycleService.updateModelCycle(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -58,7 +57,6 @@ public class ModelCycleController {
|
|||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除模型管理-管理周期")
|
@Operation(summary = "删除模型管理-管理周期")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
|
||||||
public CommonResult<Boolean> deleteModelCycle(@RequestParam("id") String id) {
|
public CommonResult<Boolean> deleteModelCycle(@RequestParam("id") String id) {
|
||||||
modelCycleService.deleteModelCycle(id);
|
modelCycleService.deleteModelCycle(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -67,7 +65,6 @@ public class ModelCycleController {
|
|||||||
@DeleteMapping("/delete-list")
|
@DeleteMapping("/delete-list")
|
||||||
@Parameter(name = "ids", description = "编号", required = true)
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
@Operation(summary = "批量删除模型管理-管理周期")
|
@Operation(summary = "批量删除模型管理-管理周期")
|
||||||
|
|
||||||
public CommonResult<Boolean> deleteModelCycleList(@RequestParam("ids") List<String> ids) {
|
public CommonResult<Boolean> deleteModelCycleList(@RequestParam("ids") List<String> ids) {
|
||||||
modelCycleService.deleteModelCycleListByIds(ids);
|
modelCycleService.deleteModelCycleListByIds(ids);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -76,15 +73,15 @@ public class ModelCycleController {
|
|||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得模型管理-管理周期")
|
@Operation(summary = "获得模型管理-管理周期")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
|
||||||
public CommonResult<ModelCycleRespVO> getModelCycle(@RequestParam("id") String id) {
|
public CommonResult<ModelCycleRespVO> getModelCycle(@RequestParam("id") String id) {
|
||||||
ModelCycleDO modelCycle = modelCycleService.getModelCycle(id);
|
ModelCycleDO modelCycle = modelCycleService.getModelCycle(id);
|
||||||
return success(BeanUtils.toBean(modelCycle, ModelCycleRespVO.class));
|
ModelCycleRespVO res = BeanUtils.toBean(modelCycle, ModelCycleRespVO.class);
|
||||||
|
res.setStageImageList(Arrays.asList(res.getStageImage()));
|
||||||
|
return success(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得模型管理-管理周期分页")
|
@Operation(summary = "获得模型管理-管理周期分页")
|
||||||
|
|
||||||
public CommonResult<PageResult<ModelCycleRespVO>> getModelCyclePage(@Valid ModelCyclePageReqVO pageReqVO) {
|
public CommonResult<PageResult<ModelCycleRespVO>> getModelCyclePage(@Valid ModelCyclePageReqVO pageReqVO) {
|
||||||
PageResult<ModelCycleDO> pageResult = modelCycleService.getModelCyclePage(pageReqVO);
|
PageResult<ModelCycleDO> pageResult = modelCycleService.getModelCyclePage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, ModelCycleRespVO.class));
|
return success(BeanUtils.toBean(pageResult, ModelCycleRespVO.class));
|
||||||
@@ -92,7 +89,6 @@ public class ModelCycleController {
|
|||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出模型管理-管理周期 Excel")
|
@Operation(summary = "导出模型管理-管理周期 Excel")
|
||||||
|
|
||||||
@ApiAccessLog(operateType = EXPORT)
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
public void exportModelCycleExcel(@Valid ModelCyclePageReqVO pageReqVO,
|
public void exportModelCycleExcel(@Valid ModelCyclePageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ public class BaseInfoDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableId(type = IdType.INPUT)
|
@TableId(type = IdType.INPUT)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基地编码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
/**
|
/**
|
||||||
* 基地名称
|
* 基地名称
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -71,4 +71,9 @@ public class PlotInfoDO extends BaseDO {
|
|||||||
* 租赁状态 (1: 已租; 0: 未租;)
|
* 租赁状态 (1: 已租; 0: 未租;)
|
||||||
*/
|
*/
|
||||||
private Integer plotLeaseStatus;
|
private Integer plotLeaseStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网格数量
|
||||||
|
*/
|
||||||
|
private Integer gridNumber;
|
||||||
}
|
}
|
||||||
@@ -3,17 +3,16 @@ package cn.iocoder.yudao.module.farm.job;
|
|||||||
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingRecordSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingrecordinput.FarmingRecordInputDO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelfarmingoperation.ModelFarmingOperationDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.modelfarmingoperation.ModelFarmingOperationDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelfarmingoperationinput.ModelFarmingOperationInputDO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlanDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlanDO;
|
||||||
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
|
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.inputlibrary.InputUsageRecordsService;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.inputlibrary.InputsService;
|
||||||
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
||||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -56,14 +55,19 @@ public class FarmingRecordJob implements JobHandler {
|
|||||||
if (taskTime.length != 2) {
|
if (taskTime.length != 2) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
LocalDate startDate = LocalDate.parse(taskTime[0]);
|
LocalDate startDate = LocalDate.parse(taskTime[0]);
|
||||||
LocalDate endDate = LocalDate.parse(taskTime[1]);
|
LocalDate endDate = LocalDate.parse(taskTime[1]);
|
||||||
if (startDate.isEqual(LocalDate.now())) {
|
boolean isStartToday = startDate.isEqual(today);
|
||||||
|
boolean isEndToday = endDate.isEqual(today);
|
||||||
|
|
||||||
|
if (isStartToday) {
|
||||||
// 开始日期在今天
|
// 开始日期在今天
|
||||||
e.setTaskStatus(FARMING_RECORD_STATUS_1);
|
e.setTaskStatus(FARMING_RECORD_STATUS_1);
|
||||||
farmingRecordService.createFarmingRecord(e);
|
farmingRecordService.createFarmingRecordForJob(e);
|
||||||
}
|
}
|
||||||
if (endDate.isEqual(LocalDate.now())) {
|
if (isEndToday) {
|
||||||
// 结束日期在今天
|
// 结束日期在今天
|
||||||
e.setTaskStatus(FARMING_RECORD_STATUS_2);
|
e.setTaskStatus(FARMING_RECORD_STATUS_2);
|
||||||
farmingRecordService.updateFarmingRecord(e);
|
farmingRecordService.updateFarmingRecord(e);
|
||||||
@@ -104,18 +108,19 @@ public class FarmingRecordJob implements JobHandler {
|
|||||||
LocalDate startDate = productionStartDate.plusDays(startingPeriod-1);
|
LocalDate startDate = productionStartDate.plusDays(startingPeriod-1);
|
||||||
// 农事记录结束日期
|
// 农事记录结束日期
|
||||||
LocalDate endDate = startDate.plusDays(used);
|
LocalDate endDate = startDate.plusDays(used);
|
||||||
String taskTime = startDate.toString() + "," + endDate.toString();
|
String taskTime = startDate + "," + endDate;
|
||||||
|
|
||||||
FarmingRecordSaveReqVO saveObj = new FarmingRecordSaveReqVO();
|
FarmingRecordSaveReqVO saveObj = new FarmingRecordSaveReqVO();
|
||||||
saveObj.setTaskType(e.getFarmingId());
|
saveObj.setTaskType(e.getFarmingId());
|
||||||
saveObj.setTaskName(e.getFarmingName());
|
saveObj.setTaskName(e.getFarmingName());
|
||||||
saveObj.setTaskScope(p.getPlanNumber());
|
saveObj.setTaskScope(p.getPlanNumber());
|
||||||
saveObj.setTaskTime(taskTime);
|
saveObj.setTaskTime(taskTime);
|
||||||
|
saveObj.setTaskStartDate(startDate);
|
||||||
|
saveObj.setTaskEndDate(endDate);
|
||||||
saveObj.setProductionPlanId(p.getId());
|
saveObj.setProductionPlanId(p.getId());
|
||||||
saveObj.setModelFarmingOperationId(e.getId());
|
saveObj.setModelFarmingOperationId(e.getId());
|
||||||
saveObj.setExecutor("系统");
|
saveObj.setExecutor("系统");
|
||||||
saveObj.setActualLaborCost(e.getUsed());
|
saveObj.setActualLaborCost(e.getUsed());
|
||||||
saveObj.setActualInputId(""); // TODO: 2025/9/2
|
|
||||||
saveObj.setFeedbackNotes(e.getDescription());
|
saveObj.setFeedbackNotes(e.getDescription());
|
||||||
saveObj.setFeedbackImageUrl("");
|
saveObj.setFeedbackImageUrl("");
|
||||||
saveObj.setFeedbackImageUrlList(e.getSketchList());
|
saveObj.setFeedbackImageUrlList(e.getSketchList());
|
||||||
@@ -125,28 +130,8 @@ public class FarmingRecordJob implements JobHandler {
|
|||||||
saveObj.setPlotName(p.getPlotName());
|
saveObj.setPlotName(p.getPlotName());
|
||||||
saveObj.setTenantId(p.getTenantId());
|
saveObj.setTenantId(p.getTenantId());
|
||||||
saveObj.setModelFarmingOperationId(e.getId());
|
saveObj.setModelFarmingOperationId(e.getId());
|
||||||
|
saveObj.setInputsIds(e.getInputsIds());
|
||||||
|
|
||||||
List<FarmingRecordInputDO> inputDOList = new ArrayList<>();
|
|
||||||
for (ModelFarmingOperationInputDO m : e.getInvestGoodsList()) {
|
|
||||||
FarmingRecordInputDO target = new FarmingRecordInputDO();
|
|
||||||
target.setInputParentCategory(m.getInputsId());
|
|
||||||
target.setInputChildCategory(m.getInputsId());
|
|
||||||
target.setDilutionRatio(m.getDiluted());
|
|
||||||
target.setSingleUseOption(m.getUnitName());
|
|
||||||
target.setSingleUseValue(BigDecimal.ZERO);
|
|
||||||
target.setSingleUseUnit(""); // TODO: 2025/9/2
|
|
||||||
target.setApplicationScope(""); // TODO: 2025/9/2
|
|
||||||
target.setDosage(m.getDose());
|
|
||||||
target.setUsage(m.getUsage());
|
|
||||||
|
|
||||||
target.setBaseId(p.getBaseId());
|
|
||||||
target.setBaseName(p.getBaseName());
|
|
||||||
target.setPlotId(p.getPlotId());
|
|
||||||
target.setPlotName(p.getPlotName());
|
|
||||||
target.setTenantId(p.getTenantId());
|
|
||||||
inputDOList.add(target);
|
|
||||||
}
|
|
||||||
saveObj.setInvestGoodsList(inputDOList);
|
|
||||||
return saveObj;
|
return saveObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
|
|||||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||||
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
||||||
import cn.iocoder.yudao.module.farm.utils.BigDecimalUtil;
|
import cn.iocoder.yudao.module.farm.utils.BigDecimalUtil;
|
||||||
|
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
@@ -93,6 +94,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
// 插入
|
// 插入
|
||||||
BaseInfoDO baseInfo = BeanUtils.toBean(createReqVO, BaseInfoDO.class);
|
BaseInfoDO baseInfo = BeanUtils.toBean(createReqVO, BaseInfoDO.class);
|
||||||
baseInfo.setId(IdUtil.fastUUID());
|
baseInfo.setId(IdUtil.fastUUID());
|
||||||
|
baseInfo.setCode(createReqVO.getCode());
|
||||||
baseInfo.setTenantId(String.valueOf(user.getTenantId()));
|
baseInfo.setTenantId(String.valueOf(user.getTenantId()));
|
||||||
// 解析坐标中心坐标
|
// 解析坐标中心坐标
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
@@ -315,9 +317,20 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
List<PlotLesseeDetailsRespVO> lesseeList = plotInfoService.getPlotLesseeList2(aDo.getId());
|
List<PlotLesseeDetailsRespVO> lesseeList = plotInfoService.getPlotLesseeList2(aDo.getId());
|
||||||
String plotManager = employeeMap.getOrDefault(aDo.getEmployeeId(), "系统");
|
String plotManager = employeeMap.getOrDefault(aDo.getEmployeeId(), "系统");
|
||||||
String typeName = PLOT_TYPE_NAME_MAP.get(Integer.valueOf(aDo.getType()));
|
String typeName = PLOT_TYPE_NAME_MAP.get(Integer.valueOf(aDo.getType()));
|
||||||
BaseInfoRespVO.PlotInfo target = new BaseInfoRespVO.PlotInfo(Integer.valueOf(aDo.getType()),typeName,aDo.getId(), aDo.getPlotName(), aDo.getPlotColor(),
|
BaseInfoRespVO.PlotInfo target = new BaseInfoRespVO.PlotInfo(
|
||||||
BigDecimalUtil.roundedViaMath( aDo.getPlotArea()), plotManager, aDo.getPoint(),
|
Integer.valueOf(aDo.getType()),
|
||||||
aDo.getPlotLeaseStatus(), LEASE_STATUS_MAP.get(aDo.getPlotLeaseStatus()),gridInfos,lesseeList);
|
typeName,
|
||||||
|
aDo.getId(),
|
||||||
|
aDo.getPlotName(),
|
||||||
|
aDo.getPlotColor(),
|
||||||
|
BigDecimalUtil.roundedViaMath( aDo.getPlotArea()),
|
||||||
|
plotManager,
|
||||||
|
aDo.getPoint(),
|
||||||
|
aDo.getPlotLeaseStatus(),
|
||||||
|
LEASE_STATUS_MAP.get(aDo.getPlotLeaseStatus()),
|
||||||
|
aDo.getGridNumber(),
|
||||||
|
gridInfos,
|
||||||
|
lesseeList);
|
||||||
targetList.add(target);
|
targetList.add(target);
|
||||||
}
|
}
|
||||||
return targetList;
|
return targetList;
|
||||||
|
|||||||
@@ -576,9 +576,9 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
ProductionPlanRespVO.PlanOverview source = productionPlanMapper.getPlanOverview(baseId, tenantId.toString());
|
ProductionPlanRespVO.PlanOverview source = productionPlanMapper.getPlanOverview(baseId, tenantId.toString());
|
||||||
return new BasePlanOverviewRespVO().setTotalArea(BigDecimalUtil.roundedViaMath(totalArea))
|
return new BasePlanOverviewRespVO().setTotalArea(BigDecimalUtil.roundedViaMath(totalArea))
|
||||||
.setPlanCount(source.getPlanCount())
|
.setPlanCount(source.getPlanCount())
|
||||||
.setPlanCompletedCount(source.getPlanCompletedCount())
|
.setPlanCompletedCount(ObjectUtils.defaultIfNull(source.getPlanCompletedCount(),0))
|
||||||
.setPlanInProgressCount(source.getPlanInProgressCount())
|
.setPlanInProgressCount(ObjectUtils.defaultIfNull(source.getPlanInProgressCount(),0))
|
||||||
.setPlanOverdueCount(source.getPlanOverdueCount());
|
.setPlanOverdueCount(ObjectUtils.defaultIfNull(source.getPlanOverdueCount(),0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -718,33 +718,39 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FarmingReport1RespVO> getFarmReport(ChartCommonReqVO req) {
|
public List<FarmingReport1RespVO> getFarmReport(ChartCommonReqVO req) {
|
||||||
Map<String, String> itemsNameMap = this.getDictTypeMap(ITEMS_UNIT);
|
req.setTenantId(getLoginUser().getTenantId().toString());
|
||||||
Map<String, String> specificationNameMap = this.getDictTypeMap(SPECIFICATION_PRICE);
|
|
||||||
|
|
||||||
List<FarmingReport1RespVO> list = inputUsageRecordsMapper.getFarmReport(req);
|
List<FarmingReport1RespVO> list = inputUsageRecordsMapper.getFarmReport(req);
|
||||||
for (FarmingReport1RespVO f : list) {
|
|
||||||
if (f.getCurrentSpecType() == 1) {
|
|
||||||
f.setUnitName(itemsNameMap.get(f.getUnit().toString()));
|
|
||||||
} else {
|
|
||||||
f.setUnitName(specificationNameMap.get(f.getUnit().toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FarmTypeChartRespVO> getFarmTypeChart(ChartCommonReqVO req) {
|
public List<FarmTypeChartRespVO> getFarmTypeChart(ChartCommonReqVO req) {
|
||||||
|
req.setTenantId(getLoginUser().getTenantId().toString());
|
||||||
return farmingRecordMapper.getFarmTypeChart(req);
|
return farmingRecordMapper.getFarmTypeChart(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlantingAreaChartRespVO> getPlantingAreaChart(ChartCommonReqVO req) {
|
public List<PlantingAreaChartRespVO> getPlantingAreaChart(ChartCommonReqVO req) {
|
||||||
|
req.setTenantId(getLoginUser().getTenantId().toString());
|
||||||
return productionPlanMapper.getPlantingAreaChart(req);
|
return productionPlanMapper.getPlantingAreaChart(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<InputUsageChartRespVO> getInputUsageChart(ChartCommonReqVO req) {
|
public List<InputUsageChartRespVO> getInputUsageChart(ChartCommonReqVO req) {
|
||||||
return inputUsageRecordsMapper.getInputUsageChart(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 list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProductionPlanReportRespVO.Models convertToModel(ProductionPlanDO plan,Map<String, String> speciesName) {
|
private ProductionPlanReportRespVO.Models convertToModel(ProductionPlanDO plan,Map<String, String> speciesName) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public interface FarmingRecordService {
|
|||||||
* @return 编号
|
* @return 编号
|
||||||
*/
|
*/
|
||||||
String createFarmingRecord(@Valid FarmingRecordSaveReqVO createReqVO);
|
String createFarmingRecord(@Valid FarmingRecordSaveReqVO createReqVO);
|
||||||
|
void createFarmingRecordForJob(@Valid FarmingRecordSaveReqVO createReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建种植中心-农事基地-农事记录(新格式)
|
* 创建种植中心-农事基地-农事记录(新格式)
|
||||||
|
|||||||
@@ -14,17 +14,23 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.farmingnamemaintenance.Farmin
|
|||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingrecord.FarmingRecordDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingrecord.FarmingRecordDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingrecordinput.FarmingRecordInputDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingrecordinput.FarmingRecordInputDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingtypemaintenance.FarmingTypeMaintenanceDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingtypemaintenance.FarmingTypeMaintenanceDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputsDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlanDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.farmingnamemaintenance.FarmingNameMaintenanceMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.farmingnamemaintenance.FarmingNameMaintenanceMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.farmingrecord.FarmingRecordMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.farmingrecord.FarmingRecordMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.farmingrecordinput.FarmingRecordInputMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.farmingrecordinput.FarmingRecordInputMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.farmingtypemaintenance.FarmingTypeMaintenanceMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.farmingtypemaintenance.FarmingTypeMaintenanceMapper;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.mysql.productionplan.ProductionPlanMapper;
|
||||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.inputlibrary.InputUsageRecordsService;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.inputlibrary.InputsService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -51,6 +57,12 @@ public class FarmingRecordServiceImpl implements FarmingRecordService {
|
|||||||
private FarmingTypeMaintenanceMapper farmingTypeMaintenanceMapper;
|
private FarmingTypeMaintenanceMapper farmingTypeMaintenanceMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private FarmingNameMaintenanceMapper farmingNameMaintenanceMapper;
|
private FarmingNameMaintenanceMapper farmingNameMaintenanceMapper;
|
||||||
|
@Resource
|
||||||
|
private ProductionPlanMapper productionPlanMapper;
|
||||||
|
@Resource
|
||||||
|
private InputUsageRecordsService inputUsageRecordsService;
|
||||||
|
@Resource
|
||||||
|
private InputsService inputsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createFarmingRecord(FarmingRecordSaveReqVO createReqVO) {
|
public String createFarmingRecord(FarmingRecordSaveReqVO createReqVO) {
|
||||||
@@ -76,6 +88,18 @@ public class FarmingRecordServiceImpl implements FarmingRecordService {
|
|||||||
return farmingRecord.getId();
|
return farmingRecord.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createFarmingRecordForJob(FarmingRecordSaveReqVO createReqVO) {
|
||||||
|
// 1. 新增农事记录
|
||||||
|
String frId = this.createFarmingRecord(createReqVO);
|
||||||
|
// 2. 新增投入品使用记录
|
||||||
|
String inputsIds = createReqVO.getInputsIds();
|
||||||
|
String[] inputIds = inputsIds.split(",");
|
||||||
|
|
||||||
|
List<InputsDO> iList = inputsService.getInputsByIds(Arrays.stream(inputIds).toList());
|
||||||
|
inputUsageRecordsService.createInputUsageRecords(frId,iList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateFarmingRecord(FarmingRecordSaveReqVO updateReqVO) {
|
public void updateFarmingRecord(FarmingRecordSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
@@ -165,6 +189,8 @@ public class FarmingRecordServiceImpl implements FarmingRecordService {
|
|||||||
LoginUser user = getLoginUser();
|
LoginUser user = getLoginUser();
|
||||||
String taskScope = createReqVO.getTaskScope();
|
String taskScope = createReqVO.getTaskScope();
|
||||||
|
|
||||||
|
ProductionPlanDO pp = productionPlanMapper.selectOne(ProductionPlanDO::getPlanNumber, taskScope);
|
||||||
|
|
||||||
// 转换时间格式:取第一个时间作为任务时间
|
// 转换时间格式:取第一个时间作为任务时间
|
||||||
String taskTime = null;
|
String taskTime = null;
|
||||||
if (createReqVO.getTaskTime() != null && !createReqVO.getTaskTime().isEmpty()) {
|
if (createReqVO.getTaskTime() != null && !createReqVO.getTaskTime().isEmpty()) {
|
||||||
@@ -203,35 +229,12 @@ public class FarmingRecordServiceImpl implements FarmingRecordService {
|
|||||||
saveReqVO.setActualLaborCost(createReqVO.getActualLaborCost());
|
saveReqVO.setActualLaborCost(createReqVO.getActualLaborCost());
|
||||||
saveReqVO.setFeedbackNotes(createReqVO.getFeedbackNotes());
|
saveReqVO.setFeedbackNotes(createReqVO.getFeedbackNotes());
|
||||||
saveReqVO.setFeedbackImageUrlList(createReqVO.getFeedbackImageUrlList());
|
saveReqVO.setFeedbackImageUrlList(createReqVO.getFeedbackImageUrlList());
|
||||||
saveReqVO.setBaseId(createReqVO.getBaseId());
|
saveReqVO.setBaseId(pp.getBaseId());
|
||||||
saveReqVO.setBaseName(createReqVO.getBaseName());
|
saveReqVO.setBaseName(pp.getBaseName());
|
||||||
saveReqVO.setPlotName(createReqVO.getPlotName());
|
saveReqVO.setPlotId(pp.getPlotId());
|
||||||
|
saveReqVO.setPlotName(pp.getPlotName());
|
||||||
saveReqVO.setTenantId(createReqVO.getTenantId());
|
saveReqVO.setTenantId(createReqVO.getTenantId());
|
||||||
|
|
||||||
// 转换投入品列表
|
|
||||||
// if (createReqVO.getInvestGoodsList() != null && !createReqVO.getInvestGoodsList().isEmpty()) {
|
|
||||||
// List<FarmingRecordInputDO> inputList = createReqVO.getInvestGoodsList().stream()
|
|
||||||
// .map(item -> {
|
|
||||||
// FarmingRecordInputDO input = new FarmingRecordInputDO();
|
|
||||||
// input.setId(IdUtil.fastUUID());
|
|
||||||
// input.setDosage(item.getDose());
|
|
||||||
// input.setUsage(item.getUsage());
|
|
||||||
// input.setInputParentCategory(item.getAssetType()); // 投入品-父类
|
|
||||||
// input.setInputChildCategory(item.getInputsId()); // 投入品-子类
|
|
||||||
// input.setSingleUseOption(item.getUnit()); // 单位用量
|
|
||||||
// input.setSingleUseUnit(item.getPackageUnit()); // 单件单位
|
|
||||||
// input.setDilutionRatio(item.getDiluted()); // 稀释倍液
|
|
||||||
//
|
|
||||||
// input.setBaseId(createReqVO.getBaseId());
|
|
||||||
// input.setBaseName(createReqVO.getBaseName());
|
|
||||||
// input.setPlotId(createReqVO.getPlotId());
|
|
||||||
// input.setPlotName(createReqVO.getPlotName());
|
|
||||||
// input.setTenantId(createReqVO.getTenantId());
|
|
||||||
// return input;
|
|
||||||
// }).collect(Collectors.toList());
|
|
||||||
// saveReqVO.setInvestGoodsList(inputList);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 调用原有的创建方法
|
// 调用原有的创建方法
|
||||||
return createFarmingRecord(saveReqVO);
|
return createFarmingRecord(saveReqVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.*;
|
|||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsPageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputUsageRecordsDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputUsageRecordsDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputsDO;
|
||||||
import jakarta.validation.*;
|
import jakarta.validation.*;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ public interface InputUsageRecordsService {
|
|||||||
* @return 编号
|
* @return 编号
|
||||||
*/
|
*/
|
||||||
String createInputUsageRecords(@Valid InputUsageRecordsSaveReqVO createReqVO);
|
String createInputUsageRecords(@Valid InputUsageRecordsSaveReqVO createReqVO);
|
||||||
|
void createInputUsageRecords(String frId,@Valid List<InputsDO> createReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新投入品使用记录
|
* 更新投入品使用记录
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ import cn.hutool.core.util.IdUtil;
|
|||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsPageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputUsageRecordsDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputUsageRecordsDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputsDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputUsageRecordsMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputUsageRecordsMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
@@ -38,6 +41,33 @@ public class InputUsageRecordsServiceImpl implements InputUsageRecordsService {
|
|||||||
return inputUsageRecords.getId();
|
return inputUsageRecords.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createInputUsageRecords(String frId, List<InputsDO> createReqVO) {
|
||||||
|
|
||||||
|
for (InputsDO i : createReqVO) {
|
||||||
|
|
||||||
|
String unit = i.getCurrentSpecType() == 1 ? i.getInputUnit() : i.getSpecUnit();
|
||||||
|
Integer inputUsage = i.getInputUsage();
|
||||||
|
BigDecimal inputPrice = i.getInputPrice();
|
||||||
|
BigDecimal totalPrice = inputPrice.multiply(BigDecimal.valueOf(inputUsage));
|
||||||
|
|
||||||
|
InputUsageRecordsSaveReqVO req = new InputUsageRecordsSaveReqVO();
|
||||||
|
String id = IdUtil.fastUUID();
|
||||||
|
req.setId(id);
|
||||||
|
req.setInputId(i.getId());
|
||||||
|
req.setFarmRecordId(frId);
|
||||||
|
req.setCurrentSpecType(i.getCurrentSpecType());
|
||||||
|
req.setUsageAmount(inputUsage);
|
||||||
|
req.setUnitPrice(inputPrice);
|
||||||
|
req.setSpec(Integer.valueOf(i.getInputSpec()));
|
||||||
|
req.setUnit(Integer.valueOf(unit));
|
||||||
|
req.setTotalPrice(totalPrice);
|
||||||
|
this.createInputUsageRecords(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateInputUsageRecords(InputUsageRecordsSaveReqVO updateReqVO) {
|
public void updateInputUsageRecords(InputUsageRecordsSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.farm.service.modelcycle;
|
|||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelcycle.vo.ModelCyclePageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelcycle.vo.ModelCyclePageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelcycle.vo.ModelCycleSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelcycle.vo.ModelCycleSaveReqVO;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -53,9 +54,12 @@ public class ModelCycleServiceImpl implements ModelCycleService {
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
validateModelCycleExists(updateReqVO.getId());
|
validateModelCycleExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
|
if (!ObjectUtils.isEmpty(updateReqVO.getStageImageList())) {
|
||||||
for (String image : updateReqVO.getStageImageList()) {
|
for (String image : updateReqVO.getStageImageList()) {
|
||||||
updateReqVO.setStageImage(image);
|
updateReqVO.setStageImage(image);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ModelCycleDO updateObj = BeanUtils.toBean(updateReqVO, ModelCycleDO.class);
|
ModelCycleDO updateObj = BeanUtils.toBean(updateReqVO, ModelCycleDO.class);
|
||||||
modelCycleMapper.updateById(updateObj);
|
modelCycleMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
|||||||
List<ModelCycleDO> list = modelCycleMapper.selectListByModelId(id);
|
List<ModelCycleDO> list = modelCycleMapper.selectListByModelId(id);
|
||||||
list.forEach(cycle -> {
|
list.forEach(cycle -> {
|
||||||
ModelCycleRespVO vo = BeanUtils.toBean(cycle, ModelCycleRespVO.class);
|
ModelCycleRespVO vo = BeanUtils.toBean(cycle, ModelCycleRespVO.class);
|
||||||
vo.setStageImageList(cycle.getImageList());
|
vo.setStageImageList(Arrays.asList(vo.getStageImage()));
|
||||||
//环境指标
|
//环境指标
|
||||||
List<ModelEnvironmentIndexDO> environmentIndexDO = modelEnvironmentIndexMapper.selectByCycleId(cycle.getId());
|
List<ModelEnvironmentIndexDO> environmentIndexDO = modelEnvironmentIndexMapper.selectByCycleId(cycle.getId());
|
||||||
vo.setEnvironmentIndexDOS(environmentIndexDO);
|
vo.setEnvironmentIndexDOS(environmentIndexDO);
|
||||||
@@ -340,14 +340,6 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
|||||||
List<ModelFarmingOperationRespVO> respVOS = new ArrayList<>();
|
List<ModelFarmingOperationRespVO> respVOS = new ArrayList<>();
|
||||||
farmingOperationDO.forEach(e -> {
|
farmingOperationDO.forEach(e -> {
|
||||||
ModelFarmingOperationRespVO respVO = BeanUtils.toBean(e, ModelFarmingOperationRespVO.class);
|
ModelFarmingOperationRespVO respVO = BeanUtils.toBean(e, ModelFarmingOperationRespVO.class);
|
||||||
// List<ModelFarmingOperationInputDO> farmingOperationInputDOS = modelFarmingOperationInputMapper.selectByFarmingId(e.getId());
|
|
||||||
// for (ModelFarmingOperationInputDO aDo : farmingOperationInputDOS) {
|
|
||||||
// InputLibraryDO inputLibrary = inputLibraryService.getInputLibrary(aDo.getInputsId());
|
|
||||||
// aDo.setInputsName(inputLibrary.getAssetName());
|
|
||||||
// aDo.setUnitName(DictFrameworkUtils.parseDictDataLabel("asset_unit", aDo.getUnit()));
|
|
||||||
// aDo.setPackageUnitName(DictFrameworkUtils.parseDictDataLabel("asset_price", aDo.getPackageUnit()));
|
|
||||||
// }
|
|
||||||
// respVO.setFarmingOperationInputDOS(farmingOperationInputDOS);
|
|
||||||
List<InputsRespVO> inputs = inputsManager.getInputsPageForReferenceType(respVO.getId());
|
List<InputsRespVO> inputs = inputsManager.getInputsPageForReferenceType(respVO.getId());
|
||||||
respVO.setFarmingOperationInputVOS(inputs);
|
respVO.setFarmingOperationInputVOS(inputs);
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public interface PlotInfoService {
|
|||||||
*/
|
*/
|
||||||
List<PlotLesseeForExportExcelRespVO> getPlotLesseeInfo();
|
List<PlotLesseeForExportExcelRespVO> getPlotLesseeInfo();
|
||||||
|
|
||||||
void setPlotLesseeInfo(List<PlotLesseeForImportExcelRespVO> req);
|
PlotLesseeImportRespVO setPlotLesseeInfo(List<PlotLesseeForImportExcelRespVO> req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过基地ID获取地块集合
|
* 通过基地ID获取地块集合
|
||||||
|
|||||||
@@ -18,15 +18,16 @@ import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagem
|
|||||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||||
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.google.common.primitives.ImmutableIntArray;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.time.LocalDate;
|
||||||
import java.util.Map;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.Set;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
@@ -67,7 +68,7 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
// 插入
|
// 插入
|
||||||
PlotInfoDO plotInfo = BeanUtils.toBean(createReqVO, PlotInfoDO.class);
|
PlotInfoDO plotInfo = BeanUtils.toBean(createReqVO, PlotInfoDO.class);
|
||||||
plotInfo.setId(IdUtil.fastUUID());
|
plotInfo.setId(IdUtil.fastUUID());
|
||||||
plotInfo.setPlotId(StrHelperUtil.generate());
|
plotInfo.setPlotId(createReqVO.getCode());
|
||||||
plotInfo.setTenantId(String.valueOf(user.getTenantId()));
|
plotInfo.setTenantId(String.valueOf(user.getTenantId()));
|
||||||
plotInfoMapper.insert(plotInfo);
|
plotInfoMapper.insert(plotInfo);
|
||||||
|
|
||||||
@@ -189,59 +190,223 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
plotLesseeDetailsRespVO.setTypeName(PLOT_TYPE_NAME_MAP.get(plotLesseeDetailsRespVO.getType()));
|
plotLesseeDetailsRespVO.setTypeName(PLOT_TYPE_NAME_MAP.get(plotLesseeDetailsRespVO.getType()));
|
||||||
plotLesseeDetailsRespVO.setPlotLessee(subLesseeInfo);
|
plotLesseeDetailsRespVO.setPlotLessee(subLesseeInfo);
|
||||||
plotLesseeDetailsRespVO.setPlotLeaseStatusName(LEASE_STATUS_MAP.get(plotLesseeDetailsRespVO.getPlotLeaseStatus()));
|
plotLesseeDetailsRespVO.setPlotLeaseStatusName(LEASE_STATUS_MAP.get(plotLesseeDetailsRespVO.getPlotLeaseStatus()));
|
||||||
|
plotLesseeDetailsRespVO.setCode(plotInfoDO.getPlotId());
|
||||||
|
plotLesseeDetailsRespVO.setUpdateStateForCode(NO_CODE);
|
||||||
return plotLesseeDetailsRespVO;
|
return plotLesseeDetailsRespVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlotLesseeForExportExcelRespVO> getPlotLesseeInfo() {
|
public List<PlotLesseeForExportExcelRespVO> getPlotLesseeInfo() {
|
||||||
|
|
||||||
Map<String, String> baseNameMap = baseInfoMapper.selectList().stream().collect(Collectors.toMap(BaseInfoDO::getId, BaseInfoDO::getName, (v1, v2) -> v1));
|
List<BaseInfoDO> bList = baseInfoMapper.selectList();
|
||||||
List<PlotInfoDO> plotInfoDOS = plotInfoMapper.selectList(PlotInfoDO::getPlotLeaseStatus, CommonConstants.NO_CODE);
|
Map<String, String> baseNameMap = bList.stream().collect(Collectors.toMap(BaseInfoDO::getId, BaseInfoDO::getName, (v1, v2) -> v1));
|
||||||
return plotInfoDOS.stream().map(p -> new PlotLesseeForExportExcelRespVO(baseNameMap.get(p.getBaseId()), p.getPlotName())).toList();
|
Map<String, String> baseCodeMap = bList.stream().collect(Collectors.toMap(BaseInfoDO::getId, BaseInfoDO::getCode, (v1, v2) -> v1));
|
||||||
|
|
||||||
|
List<PlotInfoDO> pList = plotInfoMapper.selectList();
|
||||||
|
Map<String, String> plotCodeMap = pList.stream().collect(Collectors.toMap(PlotInfoDO::getId, PlotInfoDO::getPlotId, (v1, v2) -> v1));
|
||||||
|
|
||||||
|
LambdaQueryWrapperX<PlotLesseeDO> x = new LambdaQueryWrapperX<>();
|
||||||
|
x.eq(PlotLesseeDO::getLeaseStatus, YES_CODE);
|
||||||
|
List<PlotLesseeDO> lList = plotLesseeMapper.selectList(x);
|
||||||
|
Map<String, PlotLesseeDO> lesObjMap = lList.stream().collect(Collectors.toMap(PlotLesseeDO::getPlotId, e -> e, (v1, v2) -> v1));
|
||||||
|
|
||||||
|
List<PlotInfoDO> plotInfoDOS = plotInfoMapper.selectList();
|
||||||
|
return plotInfoDOS.stream().map(p -> {
|
||||||
|
PlotLesseeForExportExcelRespVO target = new PlotLesseeForExportExcelRespVO(
|
||||||
|
baseCodeMap.get(p.getBaseId()), baseNameMap.get(p.getBaseId()),
|
||||||
|
plotCodeMap.get(p.getId()), p.getPlotName(), NO_NAME);
|
||||||
|
|
||||||
|
if (p.getPlotLeaseStatus() == 1 && lesObjMap.containsKey(p.getId())) {
|
||||||
|
// 已租状态,计算租赁剩余天数
|
||||||
|
PlotLesseeDO l = lesObjMap.get(p.getId());
|
||||||
|
target.setLeaseName(l.getLeaseName());
|
||||||
|
target.setLeaseIdCard(l.getLeaseIdCard());
|
||||||
|
target.setLeasePhone(l.getLeasePhone());
|
||||||
|
target.setLeaseStartDate(l.getLeaseStartDate());
|
||||||
|
target.setLeaseEndDate(l.getLeaseEndDate());
|
||||||
|
target.setExpirationDays(getDaysUntilLeaseEnd(l.getLeaseEndDate()));
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDaysUntilLeaseEnd(LocalDate leaseEndDate) {
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
return ChronoUnit.DAYS.between(today, leaseEndDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPlotLesseeInfo(List<PlotLesseeForImportExcelRespVO> req) {
|
public PlotLesseeImportRespVO setPlotLesseeInfo(List<PlotLesseeForImportExcelRespVO> req) {
|
||||||
|
|
||||||
Map<String, String> baseNameMap = baseInfoMapper.selectList().stream().collect(Collectors.toMap(BaseInfoDO::getId, BaseInfoDO::getName, (v1, v2) -> v1));
|
Map<String, String> baseNameMap = baseInfoMapper.selectList().stream().collect(Collectors.toMap(BaseInfoDO::getId, BaseInfoDO::getName, (v1, v2) -> v1));
|
||||||
Map<String, String> plotNameMap = plotInfoMapper.selectList().stream().collect(Collectors.toMap(PlotInfoDO::getPlotName, PlotInfoDO::getId, (v1, v2) -> v1));
|
Map<String, String> plotNameMap = plotInfoMapper.selectList().stream().collect(Collectors.toMap(PlotInfoDO::getPlotName, PlotInfoDO::getId, (v1, v2) -> v1));
|
||||||
for (PlotLesseeForImportExcelRespVO e : req) {
|
|
||||||
|
|
||||||
if (ObjectUtils.isEmpty(e.getLeaseName()) || ObjectUtils.isEmpty(e.getLeaseIdCard())
|
PlotLesseeImportRespVO res = new PlotLesseeImportRespVO();
|
||||||
|| ObjectUtils.isEmpty(e.getLeasePhone() ) || ObjectUtils.isEmpty(e.getLeaseStartDate()) || ObjectUtils.isEmpty(e.getLeaseEndDate())) {
|
res.setTotal(req.size());
|
||||||
|
|
||||||
|
List<PlotLesseeForImportExcelRespVO> targetList = req.stream().filter(vo -> YES_NAME.equals(vo.getIsModified())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
int successCount = 0;
|
||||||
|
int failuresCount = 0;
|
||||||
|
int unmodifiedCount = req.size() - targetList.size();
|
||||||
|
List<PlotLesseeImportRespVO.Row> row = new ArrayList<>();
|
||||||
|
for (PlotLesseeForImportExcelRespVO pl : targetList) {
|
||||||
|
|
||||||
|
PlotInfoDO p = plotInfoMapper.selectOne(PlotInfoDO::getPlotName, pl.getPlotName());
|
||||||
|
if (ObjectUtils.isEmpty(p)) {
|
||||||
|
failuresCount++;
|
||||||
|
row.add(new PlotLesseeImportRespVO.Row(pl.getPlotCode(), pl.getPlotName()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotInfoDO plotInfoDO = plotInfoMapper.selectOne(PlotInfoDO::getPlotName, e.getPlotName());
|
PlotLesseeDO sourcePObj = plotLesseeMapper.selectOne(
|
||||||
|
PlotLesseeDO::getPlotName, pl.getPlotName(),
|
||||||
|
PlotLesseeDO::getLeaseStatus, YES_CODE);
|
||||||
|
|
||||||
if (ObjectUtils.isEmpty(plotInfoDO)) {
|
if (ObjectUtils.isEmpty(sourcePObj)) {
|
||||||
|
// 租户表不存在, 说明从未添加过户主信息, 直接录入即可
|
||||||
|
// 1. 更新地块
|
||||||
|
p.setPlotLeaseStatus(YES_CODE);
|
||||||
|
plotInfoMapper.updateById(p);
|
||||||
|
// 2. 录入户主表
|
||||||
|
this.pInsert(p,pl,baseNameMap);
|
||||||
|
|
||||||
|
successCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新地块信息
|
if (compareObj(sourcePObj,pl)) {
|
||||||
plotInfoDO.setPlotLeaseStatus(YES_CODE);
|
unmodifiedCount++;
|
||||||
plotInfoMapper.updateById(plotInfoDO);
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 插入户主信息
|
if (this.isEmpty(pl)) {
|
||||||
|
p.setPlotLeaseStatus(NO_CODE);
|
||||||
|
plotInfoMapper.updateById(p);
|
||||||
|
|
||||||
|
sourcePObj.setLeaseStatus(NO_CODE);
|
||||||
|
plotLesseeMapper.updateById(sourcePObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 更新原地块户主信息
|
||||||
|
sourcePObj.setLeaseStatus(NO_CODE);
|
||||||
|
plotLesseeMapper.updateById(sourcePObj);
|
||||||
|
|
||||||
|
// 2. 录入新地块户主信息
|
||||||
|
this.pInsert(p,pl,baseNameMap);
|
||||||
|
successCount++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
res.setSuccessCount(successCount);
|
||||||
|
res.setFailuresCount(failuresCount);
|
||||||
|
res.setUnmodifiedCount(unmodifiedCount);
|
||||||
|
res.setFailuresList(row);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public PlotLesseeImportRespVO setPlotLesseeInfo(List<PlotLesseeForImportExcelRespVO> req) {
|
||||||
|
//
|
||||||
|
// Map<String, String> baseNameMap = baseInfoMapper.selectList().stream().collect(Collectors.toMap(BaseInfoDO::getId, BaseInfoDO::getName, (v1, v2) -> v1));
|
||||||
|
// Map<String, String> plotNameMap = plotInfoMapper.selectList().stream().collect(Collectors.toMap(PlotInfoDO::getPlotName, PlotInfoDO::getId, (v1, v2) -> v1));
|
||||||
|
//
|
||||||
|
// PlotLesseeImportRespVO res = new PlotLesseeImportRespVO();
|
||||||
|
// res.setTotal(req.size());
|
||||||
|
//
|
||||||
|
// int successCount = 0;
|
||||||
|
// int failuresCount = 0;
|
||||||
|
// int unmodifiedCount = 0;
|
||||||
|
// List<PlotLesseeImportRespVO.Row> row = new ArrayList<>();
|
||||||
|
// for (PlotLesseeForImportExcelRespVO pl : req) {
|
||||||
|
//
|
||||||
|
// PlotInfoDO p = plotInfoMapper.selectOne(PlotInfoDO::getPlotName, pl.getPlotName());
|
||||||
|
// if (ObjectUtils.isEmpty(p)) {
|
||||||
|
// failuresCount++;
|
||||||
|
// row.add(new PlotLesseeImportRespVO.Row(pl.getPlotCode(), pl.getPlotName()));
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// PlotLesseeDO sourcePObj = plotLesseeMapper.selectOne(
|
||||||
|
// PlotLesseeDO::getPlotName, pl.getPlotName(),
|
||||||
|
// PlotLesseeDO::getLeaseStatus, YES_CODE);
|
||||||
|
//
|
||||||
|
// if (ObjectUtils.isEmpty(sourcePObj)) {
|
||||||
|
// // 租户表不存在, 说明从未添加过户主信息, 直接录入即可
|
||||||
|
// // 1. 更新地块
|
||||||
|
// p.setPlotLeaseStatus(YES_CODE);
|
||||||
|
// plotInfoMapper.updateById(p);
|
||||||
|
// // 2. 录入户主表
|
||||||
|
// this.pInsert(p,pl,baseNameMap);
|
||||||
|
//
|
||||||
|
// successCount++;
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (compareObj(sourcePObj,pl)) {
|
||||||
|
// unmodifiedCount++;
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 1. 更新原地块户主信息
|
||||||
|
// sourcePObj.setLeaseStatus(NO_CODE);
|
||||||
|
// plotLesseeMapper.updateById(sourcePObj);
|
||||||
|
//
|
||||||
|
// // 2. 录入新地块户主信息
|
||||||
|
// this.pInsert(p,pl,baseNameMap);
|
||||||
|
// successCount++;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// res.setSuccessCount(successCount);
|
||||||
|
// res.setFailuresCount(failuresCount);
|
||||||
|
// res.setUnmodifiedCount(unmodifiedCount);
|
||||||
|
// res.setFailuresList(row);
|
||||||
|
// return res;
|
||||||
|
// }
|
||||||
|
|
||||||
|
private void pInsert(PlotInfoDO p,PlotLesseeForImportExcelRespVO pl,Map<String, String> baseNameMap) {
|
||||||
PlotLesseeDO target = new PlotLesseeDO();
|
PlotLesseeDO target = new PlotLesseeDO();
|
||||||
target.setLeaseName(e.getLeaseName());
|
target.setLeaseName(pl.getLeaseName());
|
||||||
target.setLeaseIdCard(e.getLeaseIdCard());
|
target.setLeaseIdCard(pl.getLeaseIdCard());
|
||||||
target.setLeasePhone(e.getLeasePhone());
|
target.setLeasePhone(pl.getLeasePhone());
|
||||||
target.setLeaseStartDate(e.getLeaseStartDate());
|
target.setLeaseStartDate(pl.getLeaseStartDate());
|
||||||
target.setLeaseEndDate(e.getLeaseEndDate());
|
target.setLeaseEndDate(pl.getLeaseEndDate());
|
||||||
|
|
||||||
target.setId(IdUtil.fastUUID());
|
target.setId(IdUtil.fastUUID());
|
||||||
target.setTenantId(String.valueOf(getLoginUser().getTenantId()));
|
target.setTenantId(String.valueOf(getLoginUser().getTenantId()));
|
||||||
target.setLeaseStatus(CommonConstants.YES_CODE);
|
target.setLeaseStatus(CommonConstants.YES_CODE);
|
||||||
|
|
||||||
target.setBaseId(plotInfoDO.getBaseId());
|
target.setBaseId(p.getBaseId());
|
||||||
target.setBaseName(baseNameMap.get(plotInfoDO.getBaseId()));
|
target.setBaseName(baseNameMap.get(p.getBaseId()));
|
||||||
target.setPlotId(plotInfoDO.getId());
|
target.setPlotId(p.getId());
|
||||||
target.setPlotName(plotInfoDO.getPlotName());
|
target.setPlotName(p.getPlotName());
|
||||||
plotLesseeMapper.insert(target);
|
plotLesseeMapper.insert(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对比结果一致返回: true
|
||||||
|
* 对比结果不一致返回: false
|
||||||
|
* @param s
|
||||||
|
* @param t
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean compareObj(PlotLesseeDO s , PlotLesseeForImportExcelRespVO t) {
|
||||||
|
return Objects.equals(s.getLeaseName(), t.getLeaseName()) &&
|
||||||
|
Objects.equals(s.getLeaseIdCard(), t.getLeaseIdCard()) &&
|
||||||
|
Objects.equals(s.getLeasePhone(), t.getLeasePhone()) &&
|
||||||
|
Objects.equals(s.getLeaseStartDate(), t.getLeaseStartDate()) &&
|
||||||
|
Objects.equals(s.getLeaseEndDate(), t.getLeaseEndDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isEmpty(PlotLesseeForImportExcelRespVO t) {
|
||||||
|
return Objects.equals(t.getLeaseName(), null) ||
|
||||||
|
Objects.equals(t.getLeaseIdCard(), null) ||
|
||||||
|
Objects.equals(t.getLeasePhone(), null) ||
|
||||||
|
Objects.equals(t.getLeaseStartDate(), null) ||
|
||||||
|
Objects.equals(t.getLeaseEndDate(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
WHEN fiur.current_spec_type = 2 THEN fiur.spec
|
WHEN fiur.current_spec_type = 2 THEN fiur.spec
|
||||||
ELSE fiur.unit
|
ELSE fiur.unit
|
||||||
END AS unit,
|
END AS unit,
|
||||||
|
fiur.current_spec_type AS currentSpecType,
|
||||||
|
AVG(fiur.unit_price) AS unitPrice,
|
||||||
SUM(fiur.total_price) AS totalPrice
|
SUM(fiur.total_price) AS totalPrice
|
||||||
FROM farm_input_usage_records fiur
|
FROM farm_input_usage_records fiur
|
||||||
<where>
|
<where>
|
||||||
@@ -40,7 +42,8 @@
|
|||||||
WHEN fiur.current_spec_type = 1 THEN fiur.unit
|
WHEN fiur.current_spec_type = 1 THEN fiur.unit
|
||||||
WHEN fiur.current_spec_type = 2 THEN fiur.spec
|
WHEN fiur.current_spec_type = 2 THEN fiur.spec
|
||||||
ELSE fiur.unit
|
ELSE fiur.unit
|
||||||
END
|
END,
|
||||||
|
fiur.current_spec_type
|
||||||
ORDER BY usageAmount DESC
|
ORDER BY usageAmount DESC
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
@@ -49,43 +52,39 @@
|
|||||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingReport1RespVO">
|
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingReport1RespVO">
|
||||||
SELECT
|
SELECT
|
||||||
fpp.base_id AS baseId,
|
ffr.id AS farmRecordId,
|
||||||
fpp.base_name AS baseName,
|
ffr.base_name AS baseName,
|
||||||
fpp.plan_number AS planNumber,
|
ffr.task_scope AS planNumber,
|
||||||
ffr.task_start_date AS taskStartDate,
|
ffr.task_start_date AS taskStartDate,
|
||||||
ffr.task_end_date AS taskEndDate,
|
ffr.task_end_date AS taskEndDate,
|
||||||
DATEDIFF(ffr.task_end_date, ffr.task_start_date) AS intervalDays,
|
DATEDIFF(ffr.task_end_date, ffr.task_start_date) AS intervalDays,
|
||||||
fiur.input_id AS inputId,
|
COALESCE(SUM(fiur.total_price), 0) AS inputTotalPrice
|
||||||
fiur.input_name AS inputName,
|
FROM farm_farming_record ffr
|
||||||
fiur.total_price AS inputTotalPrice,
|
LEFT JOIN farm_input_usage_records fiur ON ffr.id = fiur.farm_record_id AND fiur.deleted = 0
|
||||||
fiur.usage_amount AS usageAmount,
|
|
||||||
fiur.current_spec_type AS currentSpecType,
|
|
||||||
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
|
|
||||||
FROM farm_input_usage_records fiur
|
|
||||||
INNER JOIN farm_farming_record ffr ON fiur.farm_record_id = ffr.id
|
|
||||||
INNER JOIN farm_production_plan fpp ON ffr.production_plan_id = fpp.id
|
|
||||||
<where>
|
<where>
|
||||||
fiur.deleted = 0
|
ffr.deleted = 0
|
||||||
<if test="tenantId != null">
|
<if test="tenantId != null">
|
||||||
AND fiur.tenant_id = #{tenantId}
|
AND ffr.tenant_id = #{tenantId}
|
||||||
</if>
|
</if>
|
||||||
<if test="yearDate != null">
|
<if test="yearDate != null">
|
||||||
AND YEAR(ffr.task_start_date) = #{yearDate}
|
AND YEAR(ffr.task_start_date) = #{yearDate}
|
||||||
</if>
|
</if>
|
||||||
<if test="baseId != null and baseId != ''">
|
<if test="baseId != null and baseId != ''">
|
||||||
AND fiur.base_id = #{baseId}
|
AND ffr.base_id = #{baseId}
|
||||||
</if>
|
</if>
|
||||||
<if test="plotId != null and plotId != ''">
|
<if test="plotId != null and plotId != ''">
|
||||||
AND fiur.plot_id = #{plotId}
|
AND ffr.plot_id = #{plotId}
|
||||||
</if>
|
</if>
|
||||||
<if test="state != null and state != ''">
|
<if test="state != null and state != ''">
|
||||||
AND fpp.plan_status = #{state}
|
AND ffr.task_status = #{state}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
GROUP BY
|
||||||
|
ffr.id,
|
||||||
|
ffr.base_name,
|
||||||
|
ffr.task_scope,
|
||||||
|
ffr.task_start_date,
|
||||||
|
ffr.task_end_date
|
||||||
ORDER BY ffr.task_start_date DESC
|
ORDER BY ffr.task_start_date DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -110,37 +110,37 @@
|
|||||||
GROUP BY plant_species_code
|
GROUP BY plant_species_code
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPlantingAreaChart"
|
<select id="getPlantingAreaChart"
|
||||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
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.PlantingAreaChartRespVO">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
fsl.cultivar_name AS speciesName,
|
fsl.cultivar_name AS speciesName,
|
||||||
|
SUM(fpp.planting_quantity) AS plantingQuantity,
|
||||||
SUM(fpp.predicted_area) AS plantingArea,
|
SUM(fpp.predicted_area) AS plantingArea,
|
||||||
CASE
|
CASE
|
||||||
WHEN #{plotId} IS NOT NULL AND #{plotId} != '' THEN
|
WHEN #{plotId} IS NOT NULL AND #{plotId} != '' THEN
|
||||||
CONCAT(ROUND(SUM(fpp.predicted_area) / MAX(fpp.total_area) * 100, 2), '%')
|
MAX(fpp.total_area)
|
||||||
WHEN #{baseId} IS NOT NULL AND #{baseId} != '' AND (#{plotId} IS NULL OR #{plotId} = '') THEN
|
WHEN #{baseId} IS NOT NULL AND #{baseId} != '' AND (#{plotId} IS NULL OR #{plotId} = '') THEN
|
||||||
CONCAT(ROUND(SUM(fpp.predicted_area) / (
|
(
|
||||||
SELECT SUM(total_area)
|
SELECT SUM(total_area)
|
||||||
FROM farm_production_plan
|
FROM farm_production_plan
|
||||||
WHERE base_id = #{baseId}
|
WHERE base_id = #{baseId}
|
||||||
AND tenant_id = #{tenantId}
|
AND tenant_id = #{tenantId}
|
||||||
AND deleted = 0
|
AND deleted = 0
|
||||||
GROUP BY base_id
|
)
|
||||||
) * 100, 2), '%')
|
|
||||||
ELSE
|
ELSE
|
||||||
CONCAT(ROUND(SUM(fpp.predicted_area) / (
|
(SELECT SUM(total_area)
|
||||||
SELECT SUM(total_area)
|
|
||||||
FROM farm_production_plan
|
FROM farm_production_plan
|
||||||
WHERE tenant_id = #{tenantId}
|
WHERE tenant_id = #{tenantId}
|
||||||
AND deleted = 0
|
AND deleted = 0)
|
||||||
) * 100, 2), '%')
|
END AS totalArea
|
||||||
END AS areaPercentage
|
|
||||||
FROM farm_production_plan fpp
|
FROM farm_production_plan fpp
|
||||||
LEFT JOIN farm_species_library fsl ON fpp.plant_species_code = fsl.id
|
LEFT JOIN farm_species_library fsl ON fpp.plant_species_code = fsl.id
|
||||||
WHERE
|
WHERE
|
||||||
fpp.deleted = 0 AND fsl.deleted = 0
|
fpp.deleted = 0
|
||||||
|
AND fsl.deleted = 0
|
||||||
<if test="tenantId != null">
|
<if test="tenantId != null">
|
||||||
AND fpp.tenant_id = #{tenantId}
|
AND fpp.tenant_id = #{tenantId}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user