fix (farm):
- 种植中心 - 药物分类字典
This commit is contained in:
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
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;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.farmingrecord.vo.FarmingRecordPageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.farmingrecord.vo.FarmingRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.farmingrecord.vo.FarmingRecordRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.farmingrecord.vo.FarmingRecordRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.farmingrecord.vo.FarmingRecordSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.farmingrecord.vo.FarmingRecordSaveReqVO;
|
||||||
@@ -40,14 +41,11 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|||||||
public class CropFarmingCenterController {
|
public class CropFarmingCenterController {
|
||||||
|
|
||||||
private final CropFarmingCenterService cropFarmingCenterService;
|
private final CropFarmingCenterService cropFarmingCenterService;
|
||||||
private final ProductionPlanService productionPlanService;
|
|
||||||
private final FarmingRecordService farmingRecordService;
|
private final FarmingRecordService farmingRecordService;
|
||||||
|
|
||||||
public CropFarmingCenterController(CropFarmingCenterService cropFarmingCenterService,
|
public CropFarmingCenterController(CropFarmingCenterService cropFarmingCenterService,
|
||||||
ProductionPlanService productionPlanService,
|
|
||||||
FarmingRecordService farmingRecordService) {
|
FarmingRecordService farmingRecordService) {
|
||||||
this.cropFarmingCenterService = cropFarmingCenterService;
|
this.cropFarmingCenterService = cropFarmingCenterService;
|
||||||
this.productionPlanService = productionPlanService;
|
|
||||||
this.farmingRecordService = farmingRecordService;
|
this.farmingRecordService = farmingRecordService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,9 +54,9 @@ public class CropFarmingCenterController {
|
|||||||
// 生产计划
|
// 生产计划
|
||||||
@GetMapping("/production-plan/page")
|
@GetMapping("/production-plan/page")
|
||||||
@Operation(summary = "生产计划-分页")
|
@Operation(summary = "生产计划-分页")
|
||||||
public CommonResult<PageResult<ProductionPlanRespVO>> getProductionPlanPage(@Valid ProductionPlanPageReqVO pageReqVO) {
|
public CommonResult<PageResult<cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO>> getProductionPlanPage(@Valid cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanPageReqVO pageReqVO) {
|
||||||
PageResult<ProductionPlanDO> pageResult = productionPlanService.getProductionPlanPage(pageReqVO);
|
PageResult<cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO> pageResult = cropFarmingCenterService.getProductionPlanPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, ProductionPlanRespVO.class));
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/production-plan/get/{id}")
|
@GetMapping("/production-plan/get/{id}")
|
||||||
@@ -77,15 +75,12 @@ public class CropFarmingCenterController {
|
|||||||
|
|
||||||
@PutMapping("/production-plan/update")
|
@PutMapping("/production-plan/update")
|
||||||
@Operation(summary = "生产计划-编辑")
|
@Operation(summary = "生产计划-编辑")
|
||||||
public CommonResult<Boolean> updateProductionPlan(@Valid @RequestBody ProductionPlanSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateProductionPlan(@Valid @RequestBody ProductionPlanUpdateReqVO updateReqVO) {
|
||||||
productionPlanService.updateProductionPlan(updateReqVO);
|
cropFarmingCenterService.updateProductionPlan(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 农事记录
|
// 农事记录
|
||||||
@GetMapping("/farming-record/page")
|
@GetMapping("/farming-record/page")
|
||||||
@Operation(summary = "农事记录-分页")
|
@Operation(summary = "农事记录-分页")
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
package cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo;
|
package cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 分页请求实体
|
* @description: 分页请求实体
|
||||||
@@ -8,11 +15,19 @@ import lombok.Data;
|
|||||||
* @date: 2025/8/20 17:58
|
* @date: 2025/8/20 17:58
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class ProductionPlanPageReqVO {
|
public class ProductionPlanPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "基地id", example = "29734")
|
||||||
|
private String baseId;
|
||||||
|
|
||||||
|
@Schema(description = "地块ID", example = "19246")
|
||||||
|
private String plotId;
|
||||||
|
|
||||||
|
@Schema(description = "排产开始日期")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDate[] productionStartDate;
|
||||||
|
|
||||||
|
@Schema(description = "计划执行状态")
|
||||||
|
private Integer planStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ public class ProductionPlanRespVO {
|
|||||||
|
|
||||||
@Schema(description = "计划执行状态")
|
@Schema(description = "计划执行状态")
|
||||||
private Integer planStatus;
|
private Integer planStatus;
|
||||||
|
@Schema(description = "计划执行状态-名称")
|
||||||
|
private String planStatusName;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "租户ID")
|
@Schema(description = "租户ID")
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputLibraryDO;
|
|||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.speciesclassifylibrary.SpeciesClassifyLibraryDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.speciesclassifylibrary.SpeciesClassifyLibraryDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibraryDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibraryDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.sysDict.SysDictDO;
|
import cn.iocoder.yudao.module.farm.dal.mysql.sysDict.SysDictDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||||
import cn.iocoder.yudao.module.farm.service.disasterdata.DisasterDataService;
|
import cn.iocoder.yudao.module.farm.service.disasterdata.DisasterDataService;
|
||||||
import cn.iocoder.yudao.module.farm.service.farmingnamemaintenance.FarmingNameMaintenanceService;
|
import cn.iocoder.yudao.module.farm.service.farmingnamemaintenance.FarmingNameMaintenanceService;
|
||||||
import cn.iocoder.yudao.module.farm.service.farmingtypemaintenance.FarmingTypeMaintenanceService;
|
import cn.iocoder.yudao.module.farm.service.farmingtypemaintenance.FarmingTypeMaintenanceService;
|
||||||
@@ -36,13 +37,15 @@ import cn.iocoder.yudao.module.farm.service.speciesclassifylibrary.SpeciesClassi
|
|||||||
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
||||||
import cn.iocoder.yudao.module.farm.service.sysDict.SysDictService;
|
import cn.iocoder.yudao.module.farm.service.sysDict.SysDictService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.redisson.misc.Hash;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@@ -190,9 +193,6 @@ public class DictController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 物种类别维护 todo 后续
|
|
||||||
|
|
||||||
|
|
||||||
// 投入品维护
|
// 投入品维护
|
||||||
@Operation(summary = "字典数据维护-投入品-分页")
|
@Operation(summary = "字典数据维护-投入品-分页")
|
||||||
@GetMapping("/invest-goods/page")
|
@GetMapping("/invest-goods/page")
|
||||||
@@ -275,10 +275,35 @@ public class DictController {
|
|||||||
@Operation(summary = "字典数据维护-下拉框列表-物种类别")
|
@Operation(summary = "字典数据维护-下拉框列表-物种类别")
|
||||||
@GetMapping("/list/species-classify-library")
|
@GetMapping("/list/species-classify-library")
|
||||||
public CommonResult<List<SpeciesClassifyLibraryRespVO>> getSpeciesClassifyLibraryList() {
|
public CommonResult<List<SpeciesClassifyLibraryRespVO>> getSpeciesClassifyLibraryList() {
|
||||||
List<SpeciesClassifyLibraryDO> res = speciesClassifyLibraryService.getSpeciesClassifyLibraryList();
|
|
||||||
return success(BeanUtils.toBean(res, SpeciesClassifyLibraryRespVO.class));
|
List<SysDictDO> list = sysDictService.getByTypeCode(CommonConstants.DICT_TYPE_CODE_3);
|
||||||
|
Map<String, String> parentMap = list.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
SysDictDO::getField1Code, // key: field1Code
|
||||||
|
SysDictDO::getField1Name, // value: field1Name
|
||||||
|
(existing, replacement) -> existing // 处理重复key,保留现有值
|
||||||
|
));
|
||||||
|
|
||||||
|
List<SpeciesClassifyLibraryRespVO> parentList = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, String> entry : parentMap.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
SpeciesClassifyLibraryRespVO pVO = new SpeciesClassifyLibraryRespVO(key, entry.getValue());
|
||||||
|
|
||||||
|
List<SpeciesClassifyLibraryRespVO> childList = new ArrayList<>();
|
||||||
|
for (SysDictDO e : list) {
|
||||||
|
if (e.getField1Code().equals(key)) {
|
||||||
|
childList.add(new SpeciesClassifyLibraryRespVO(e.getField2Code(),e.getField2Name()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pVO.setChildren(childList);
|
||||||
|
parentList.add(pVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
return success(parentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "字典数据维护-下拉框列表-通用字典分类查询")
|
@Operation(summary = "字典数据维护-下拉框列表-通用字典分类查询")
|
||||||
@GetMapping("/list/{dictTypeCode}")
|
@GetMapping("/list/{dictTypeCode}")
|
||||||
public CommonResult<List<SysDictRespVO>> getSysDictList(@PathVariable("dictTypeCode") String dictTypeCode) {
|
public CommonResult<List<SysDictRespVO>> getSysDictList(@PathVariable("dictTypeCode") String dictTypeCode) {
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package cn.iocoder.yudao.module.farm.controller.admin.dict.vo;
|
package cn.iocoder.yudao.module.farm.controller.admin.dict.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 物种分类
|
* @description: 物种分类
|
||||||
@@ -9,17 +13,22 @@ import lombok.Data;
|
|||||||
* @date: 2025/8/17 16:43
|
* @date: 2025/8/17 16:43
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class SpeciesClassifyLibraryRespVO {
|
public class SpeciesClassifyLibraryRespVO {
|
||||||
@Schema(description = "ID")
|
@Schema(description = "ID")
|
||||||
private String id;
|
private String id;
|
||||||
@Schema(description = "一级分类-编码")
|
@Schema(description = "一级分类-编码")
|
||||||
private String primaryClassCode;
|
private String SpeciesClassCode;
|
||||||
@Schema(description = "一级分类-名称")
|
@Schema(description = "一级分类-名称")
|
||||||
private String primaryClassName;
|
private String SpeciesClassName;
|
||||||
@Schema(description = "二级分类-编码")
|
|
||||||
private String secondaryClassCode;
|
|
||||||
@Schema(description = "二级分类-名称")
|
|
||||||
private String secondaryClassName;
|
|
||||||
@Schema(description = "使用状态")
|
@Schema(description = "使用状态")
|
||||||
private String useStatus;
|
private String useStatus;
|
||||||
|
|
||||||
|
private List<SpeciesClassifyLibraryRespVO> children;
|
||||||
|
|
||||||
|
public SpeciesClassifyLibraryRespVO(String speciesClassCode, String speciesClassName) {
|
||||||
|
SpeciesClassCode = speciesClassCode;
|
||||||
|
SpeciesClassName = speciesClassName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,20 +18,27 @@ public interface ProductionPlanMapper extends BaseMapperX<ProductionPlanDO> {
|
|||||||
|
|
||||||
Double getTotalArea(Long tenantId);
|
Double getTotalArea(Long tenantId);
|
||||||
|
|
||||||
// default PageResult<ProductionPlanDO> selectPage(ProductionPlanPageReqVO reqVO) {
|
default PageResult<ProductionPlanDO> selectPage(ProductionPlanPageReqVO reqVO) {
|
||||||
// return selectPage(reqVO, new LambdaQueryWrapperX<ProductionPlanDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<ProductionPlanDO>()
|
||||||
// .eqIfPresent(ProductionPlanDO::getPlantSpecies, reqVO.getPlantSpecies())
|
.betweenIfPresent(ProductionPlanDO::getProductionStartDate, reqVO.getProductionStartDate())
|
||||||
// .eqIfPresent(ProductionPlanDO::getSpeciesModel, reqVO.getSpeciesModel())
|
.betweenIfPresent(ProductionPlanDO::getProductionEndDate, reqVO.getProductionEndDate())
|
||||||
// .betweenIfPresent(ProductionPlanDO::getProductionStartDate, reqVO.getProductionStartDate())
|
.betweenIfPresent(ProductionPlanDO::getHarvestStartDate, reqVO.getHarvestStartDate())
|
||||||
// .betweenIfPresent(ProductionPlanDO::getProductionEndDate, reqVO.getProductionEndDate())
|
.eqIfPresent(ProductionPlanDO::getBaseId, reqVO.getBaseId())
|
||||||
// .betweenIfPresent(ProductionPlanDO::getHarvestStartDate, reqVO.getHarvestStartDate())
|
.likeIfPresent(ProductionPlanDO::getBaseName, reqVO.getBaseName())
|
||||||
// .eqIfPresent(ProductionPlanDO::getCultivationAreaId, reqVO.getCultivationAreaId())
|
.eqIfPresent(ProductionPlanDO::getPlotId, reqVO.getPlotId())
|
||||||
// .eqIfPresent(ProductionPlanDO::getBaseId, reqVO.getBaseId())
|
.likeIfPresent(ProductionPlanDO::getPlotName, reqVO.getPlotName())
|
||||||
// .likeIfPresent(ProductionPlanDO::getBaseName, reqVO.getBaseName())
|
.betweenIfPresent(ProductionPlanDO::getCreateTime, reqVO.getCreateTime())
|
||||||
// .eqIfPresent(ProductionPlanDO::getPlotId, reqVO.getPlotId())
|
.orderByDesc(ProductionPlanDO::getCreateTime)
|
||||||
// .likeIfPresent(ProductionPlanDO::getPlotName, reqVO.getPlotName())
|
);
|
||||||
// .betweenIfPresent(ProductionPlanDO::getCreateTime, reqVO.getCreateTime())
|
}
|
||||||
// .orderByDesc(ProductionPlanDO::getCreateTime));
|
|
||||||
// }
|
default PageResult<ProductionPlanDO> selectPage2(cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<ProductionPlanDO>()
|
||||||
|
.betweenIfPresent(ProductionPlanDO::getProductionStartDate, reqVO.getProductionStartDate())
|
||||||
|
.eqIfPresent(ProductionPlanDO::getBaseId, reqVO.getBaseId())
|
||||||
|
.eqIfPresent(ProductionPlanDO::getPlotId, reqVO.getPlotId())
|
||||||
|
.orderByDesc(ProductionPlanDO::getCreateTime)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package cn.iocoder.yudao.module.farm.enums;
|
package cn.iocoder.yudao.module.farm.enums;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 通用常量
|
* @description: 通用常量
|
||||||
* @author: binda
|
* @author: binda
|
||||||
@@ -20,12 +23,24 @@ public class CommonConstants {
|
|||||||
public final static Integer PLAN_STATUS_3 = 3;
|
public final static Integer PLAN_STATUS_3 = 3;
|
||||||
public final static Integer PLAN_STATUS_4 = 4;
|
public final static Integer PLAN_STATUS_4 = 4;
|
||||||
|
|
||||||
|
public static Map<Integer, String> PLAN_MAP = new HashMap<>();
|
||||||
|
static{
|
||||||
|
PLAN_MAP.put(1, "未开始");
|
||||||
|
PLAN_MAP.put(2, "进行中");
|
||||||
|
PLAN_MAP.put(3, "已完成");
|
||||||
|
PLAN_MAP.put(4, "逾期");
|
||||||
|
}
|
||||||
|
|
||||||
// 模型类型 (1:模型模板; 2:引用案例)
|
// 模型类型 (1:模型模板; 2:引用案例)
|
||||||
public final static Integer MODEL_TYPE_1 = 1;
|
public final static Integer MODEL_TYPE_1 = 1;
|
||||||
public final static Integer MODEL_TYPE_2 = 1;
|
public final static Integer MODEL_TYPE_2 = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
public final static String DICT_TYPE_CODE_1 = "common_disaster";
|
* 字典类型名称
|
||||||
|
*/
|
||||||
|
public final static String DICT_TYPE_CODE_1 = "common_disaster"; // 一般灾害
|
||||||
|
public final static String DICT_TYPE_CODE_2 = "weather_disaster"; // 气象灾害
|
||||||
|
public final static String DICT_TYPE_CODE_3 = "species_classify_library"; // 物种类别
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.cropFarmingCenter;
|
package cn.iocoder.yudao.module.farm.service.cropFarmingCenter;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanUpdateReqVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 种植中心
|
* @description: 种植中心
|
||||||
@@ -13,7 +16,8 @@ public interface CropFarmingCenterService {
|
|||||||
/**
|
/**
|
||||||
* 生产计划-新增
|
* 生产计划-新增
|
||||||
* 1份生产计划 -> n种植区域 (区域: 一个基地的某个地块,划分为多亩地,交叉种植)
|
* 1份生产计划 -> n种植区域 (区域: 一个基地的某个地块,划分为多亩地,交叉种植)
|
||||||
* -> 1模型案例(可以修改,不影响原有模版)
|
* -> 1模型案例(可以修改,不影响原有模版)
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -21,7 +25,10 @@ public interface CropFarmingCenterService {
|
|||||||
|
|
||||||
ProductionPlanRespVO getProductionPlan(String id);
|
ProductionPlanRespVO getProductionPlan(String id);
|
||||||
|
|
||||||
void updateProductionPlan(ProductionPlanSaveReqVO updateReqVO);
|
void updateProductionPlan(ProductionPlanUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
|
PageResult<ProductionPlanRespVO> getProductionPlanPage(ProductionPlanPageReqVO reqVO);
|
||||||
|
|
||||||
|
|
||||||
int getCropCount(Long tenantId);
|
int getCropCount(Long tenantId);
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.cropFarmingCenter;
|
package cn.iocoder.yudao.module.farm.service.cropFarmingCenter;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.modelmanagement.vo.ModelManagementRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.modelmanagement.vo.ModelManagementRespVO;
|
||||||
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.dal.mysql.productionplan.ProductionPlanMapper;
|
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.cultivationarea.CultivationAreaService;
|
|
||||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
|
||||||
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
||||||
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,7 +20,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||||
|
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.PRODUCTION_PLAN_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 种植中心
|
* @description: 种植中心
|
||||||
@@ -30,14 +33,10 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||||
|
|
||||||
private final CultivationAreaService cultivationAreaService;
|
|
||||||
private final ProductionPlanService productionPlanService;
|
|
||||||
private final ProductionPlanMapper productionPlanMapper;
|
private final ProductionPlanMapper productionPlanMapper;
|
||||||
private final ModelManagementService modelManagementService;
|
private final ModelManagementService modelManagementService;
|
||||||
|
|
||||||
public CropFarmingCenterServiceImpl(CultivationAreaService cultivationAreaService, ProductionPlanService productionPlanService, ProductionPlanMapper productionPlanMapper, ModelManagementService modelManagementService) {
|
public CropFarmingCenterServiceImpl(ProductionPlanMapper productionPlanMapper, ModelManagementService modelManagementService) {
|
||||||
this.cultivationAreaService = cultivationAreaService;
|
|
||||||
this.productionPlanService = productionPlanService;
|
|
||||||
this.productionPlanMapper = productionPlanMapper;
|
this.productionPlanMapper = productionPlanMapper;
|
||||||
this.modelManagementService = modelManagementService;
|
this.modelManagementService = modelManagementService;
|
||||||
}
|
}
|
||||||
@@ -80,7 +79,6 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
obj.setPlotName(e.getPlotName());
|
obj.setPlotName(e.getPlotName());
|
||||||
obj.setTenantId(e.getTenantId());
|
obj.setTenantId(e.getTenantId());
|
||||||
|
|
||||||
|
|
||||||
// 随机字符串 + 地块名称
|
// 随机字符串 + 地块名称
|
||||||
obj.setPlanNumber(StrHelperUtil.generate() +"-"+ e.getPlotName());
|
obj.setPlanNumber(StrHelperUtil.generate() +"-"+ e.getPlotName());
|
||||||
obj.setId(taskId);
|
obj.setId(taskId);
|
||||||
@@ -110,8 +108,24 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateProductionPlan(ProductionPlanSaveReqVO updateReqVO) {
|
public void updateProductionPlan(ProductionPlanUpdateReqVO updateReqVO) {
|
||||||
|
validateProductionPlanExists(updateReqVO.getId());
|
||||||
|
productionPlanMapper.updateById(BeanUtils.toBean(updateReqVO, ProductionPlanDO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ProductionPlanRespVO> getProductionPlanPage(ProductionPlanPageReqVO reqVO) {
|
||||||
|
|
||||||
|
PageResult<ProductionPlanDO> productionPlanDOPageResult = productionPlanMapper.selectPage2(reqVO);
|
||||||
|
PageResult<ProductionPlanRespVO> result = BeanUtils.toBean(productionPlanDOPageResult, ProductionPlanRespVO.class);
|
||||||
|
result.getList().forEach(e -> {
|
||||||
|
|
||||||
|
ModelManagementRespVO modelManagementRespVO = modelManagementService.getModelManagement(e.getSpeciesModelId());
|
||||||
|
e.setModelManagementRespVO(modelManagementRespVO);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -123,4 +137,10 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
public Double getTotalArea(Long tenantId) {
|
public Double getTotalArea(Long tenantId) {
|
||||||
return productionPlanMapper.getTotalArea(tenantId);
|
return productionPlanMapper.getTotalArea(tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateProductionPlanExists(String id) {
|
||||||
|
if (productionPlanMapper.selectById(id) == null) {
|
||||||
|
throw exception(PRODUCTION_PLAN_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ProductionPlanDO> getProductionPlanPage(ProductionPlanPageReqVO pageReqVO) {
|
public PageResult<ProductionPlanDO> getProductionPlanPage(ProductionPlanPageReqVO pageReqVO) {
|
||||||
// productionPlanMapper.selectPage(pageReqVO);
|
productionPlanMapper.selectPage(pageReqVO);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user