feat (farm): 业务功能
- 种植中心 - 生产计划
This commit is contained in:
@@ -70,9 +70,9 @@ public class CropFarmingCenterController {
|
||||
|
||||
@PostMapping("/production-plan/create")
|
||||
@Operation(summary = "生产计划-创建")
|
||||
public CommonResult<String> createProductionPlan(@Valid @RequestBody cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanSaveReqVO createReqVO) {
|
||||
String res = cropFarmingCenterService.createProductionPlan(createReqVO);
|
||||
return success(res);
|
||||
public CommonResult<Boolean> createProductionPlan(@Valid @RequestBody cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanSaveReqVO createReqVO) {
|
||||
cropFarmingCenterService.createProductionPlan(createReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/production-plan/update")
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 分页请求实体
|
||||
* @author: binda
|
||||
* @date: 2025/8/20 17:58
|
||||
*/
|
||||
@Data
|
||||
public class ProductionPlanPageReqVO {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -14,11 +14,6 @@ import java.util.List;
|
||||
@Data
|
||||
public class ProductionPlanSaveReqVO {
|
||||
|
||||
@Schema(description = "UUID")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "计划编号")
|
||||
private String planNumber;
|
||||
|
||||
@Schema(description = "种植物种-编码")
|
||||
private String plantSpeciesCode;
|
||||
@@ -61,19 +56,23 @@ public class ProductionPlanSaveReqVO {
|
||||
/**
|
||||
* 种植区域信息
|
||||
*/
|
||||
|
||||
@Schema(description = "种植日期")
|
||||
private LocalDate plantingDate;
|
||||
@Schema(description = "种植株数")
|
||||
private LocalDate plantingQuantity;
|
||||
private Integer plantingQuantity;
|
||||
@Schema(description = "预计产量")
|
||||
private Long predictedYields;
|
||||
private Integer predictedYields;
|
||||
@Schema(description = "总面积")
|
||||
private Double totalArea;
|
||||
@Schema(description = "计划面积")
|
||||
private Long predictedArea;
|
||||
private Double predictedArea;
|
||||
@Schema(description = "剩余面积")
|
||||
private Long remainingArea;
|
||||
private Double remainingArea;
|
||||
@Schema(description = "占地面积")
|
||||
private Integer usagePercentage;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ import cn.iocoder.yudao.module.farm.controller.admin.productionplan.vo.Productio
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.productionplan.vo.ProductionPlanSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.farm.dal.dataobject.productionplan;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@@ -23,18 +24,22 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
public class ProductionPlanDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 基础id
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
private String id;
|
||||
/**
|
||||
* 计划编号
|
||||
*/
|
||||
private String planNumber;
|
||||
/**
|
||||
* 种植物种
|
||||
*/
|
||||
private String plantSpecies;
|
||||
private String plantSpeciesCode;
|
||||
/**
|
||||
* 物种模型
|
||||
*/
|
||||
private String speciesModel;
|
||||
private String speciesModelId;
|
||||
/**
|
||||
* 排产开始日期
|
||||
*/
|
||||
@@ -47,14 +52,44 @@ public class ProductionPlanDO extends BaseDO {
|
||||
* 采收开始日期
|
||||
*/
|
||||
private LocalDate harvestStartDate;
|
||||
/**
|
||||
* 执行状态
|
||||
*/
|
||||
private Integer planStatus;
|
||||
|
||||
/**
|
||||
* 种植日期
|
||||
*/
|
||||
private LocalDate plantingDate;
|
||||
/**
|
||||
* 种植株数
|
||||
*/
|
||||
private Integer plantingQuantity;
|
||||
/**
|
||||
* 预计产量
|
||||
*/
|
||||
private Integer estimatedOutput;
|
||||
private Integer predictedYields;
|
||||
/**
|
||||
* 种植区域ID
|
||||
* 总面积
|
||||
*/
|
||||
private String cultivationAreaId;
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 计划面积
|
||||
*/
|
||||
private Double predictedArea;
|
||||
/**
|
||||
* 剩余面积
|
||||
*/
|
||||
private Double remainingArea;
|
||||
/**
|
||||
* 占地面积
|
||||
*/
|
||||
private Integer usagePercentage;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 基地id
|
||||
*/
|
||||
@@ -71,6 +106,8 @@ public class ProductionPlanDO extends BaseDO {
|
||||
* 地块
|
||||
*/
|
||||
private String plotName;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
package cn.iocoder.yudao.module.farm.dal.mysql.disasterdata;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.disasterdata.vo.DisasterDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.disasterdata.DisasterDataDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -15,20 +15,20 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface ProductionPlanMapper extends BaseMapperX<ProductionPlanDO> {
|
||||
|
||||
default PageResult<ProductionPlanDO> selectPage(ProductionPlanPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ProductionPlanDO>()
|
||||
.eqIfPresent(ProductionPlanDO::getPlantSpecies, reqVO.getPlantSpecies())
|
||||
.eqIfPresent(ProductionPlanDO::getSpeciesModel, reqVO.getSpeciesModel())
|
||||
.betweenIfPresent(ProductionPlanDO::getProductionStartDate, reqVO.getProductionStartDate())
|
||||
.betweenIfPresent(ProductionPlanDO::getProductionEndDate, reqVO.getProductionEndDate())
|
||||
.betweenIfPresent(ProductionPlanDO::getHarvestStartDate, reqVO.getHarvestStartDate())
|
||||
.eqIfPresent(ProductionPlanDO::getCultivationAreaId, reqVO.getCultivationAreaId())
|
||||
.eqIfPresent(ProductionPlanDO::getBaseId, reqVO.getBaseId())
|
||||
.likeIfPresent(ProductionPlanDO::getBaseName, reqVO.getBaseName())
|
||||
.eqIfPresent(ProductionPlanDO::getPlotId, reqVO.getPlotId())
|
||||
.likeIfPresent(ProductionPlanDO::getPlotName, reqVO.getPlotName())
|
||||
.betweenIfPresent(ProductionPlanDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ProductionPlanDO::getCreateTime));
|
||||
}
|
||||
// default PageResult<ProductionPlanDO> selectPage(ProductionPlanPageReqVO reqVO) {
|
||||
// return selectPage(reqVO, new LambdaQueryWrapperX<ProductionPlanDO>()
|
||||
// .eqIfPresent(ProductionPlanDO::getPlantSpecies, reqVO.getPlantSpecies())
|
||||
// .eqIfPresent(ProductionPlanDO::getSpeciesModel, reqVO.getSpeciesModel())
|
||||
// .betweenIfPresent(ProductionPlanDO::getProductionStartDate, reqVO.getProductionStartDate())
|
||||
// .betweenIfPresent(ProductionPlanDO::getProductionEndDate, reqVO.getProductionEndDate())
|
||||
// .betweenIfPresent(ProductionPlanDO::getHarvestStartDate, reqVO.getHarvestStartDate())
|
||||
// .eqIfPresent(ProductionPlanDO::getCultivationAreaId, reqVO.getCultivationAreaId())
|
||||
// .eqIfPresent(ProductionPlanDO::getBaseId, reqVO.getBaseId())
|
||||
// .likeIfPresent(ProductionPlanDO::getBaseName, reqVO.getBaseName())
|
||||
// .eqIfPresent(ProductionPlanDO::getPlotId, reqVO.getPlotId())
|
||||
// .likeIfPresent(ProductionPlanDO::getPlotName, reqVO.getPlotName())
|
||||
// .betweenIfPresent(ProductionPlanDO::getCreateTime, reqVO.getCreateTime())
|
||||
// .orderByDesc(ProductionPlanDO::getCreateTime));
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -12,4 +12,13 @@ public class CommonConstants {
|
||||
|
||||
public final static Integer NO_CODE = 0;
|
||||
public final static String NO_NAME = "否";
|
||||
|
||||
|
||||
// 1:未开始;2:进行中;3:已完成;4:逾期
|
||||
public final static Integer PLAN_STATUS_1 = 1;
|
||||
public final static Integer PLAN_STATUS_2 = 2;
|
||||
public final static Integer PLAN_STATUS_3 = 3;
|
||||
public final static Integer PLAN_STATUS_4 = 4;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ public interface CropFarmingCenterService {
|
||||
|
||||
/**
|
||||
* 生产计划-新增
|
||||
* 1份生产计划 -> n种植区域 (区域: 一个基地的某个地块,划分为多亩地,交叉种植)
|
||||
* -> 1模型案例(可以修改,不影响原有模版)
|
||||
* @param createReqVO
|
||||
* @return
|
||||
*/
|
||||
String createProductionPlan(ProductionPlanSaveReqVO createReqVO);
|
||||
void createProductionPlan(ProductionPlanSaveReqVO createReqVO);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
package cn.iocoder.yudao.module.farm.service.cropFarmingCenter;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanSaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.service.cultivationarea.CultivationAreaService;
|
||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||
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.enums.CommonConstants;
|
||||
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @description: 种植中心
|
||||
* @author: binda
|
||||
* @date: 2025/8/19 11:34
|
||||
*/
|
||||
@@ -15,26 +21,50 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
|
||||
private final CultivationAreaService cultivationAreaService;
|
||||
private final ProductionPlanService productionPlanService;
|
||||
private final ProductionPlanMapper productionPlanMapper;
|
||||
|
||||
public CropFarmingCenterServiceImpl(CultivationAreaService cultivationAreaService, ProductionPlanService productionPlanService) {
|
||||
this.cultivationAreaService = cultivationAreaService;
|
||||
this.productionPlanService = productionPlanService;
|
||||
public CropFarmingCenterServiceImpl(ProductionPlanMapper productionPlanMapper) {
|
||||
this.productionPlanMapper = productionPlanMapper;
|
||||
}
|
||||
|
||||
|
||||
// 创建
|
||||
// 1份生产计划 -> n种植区域; 1个种植区域 -> 1基地的n个地块(种植区域)
|
||||
|
||||
|
||||
@Override
|
||||
public String createProductionPlan(ProductionPlanSaveReqVO createReqVO) {
|
||||
public void createProductionPlan(ProductionPlanSaveReqVO reqVO) {
|
||||
|
||||
List<ProductionPlanSaveReqVO.CultivationArea> cultivationAreaList = reqVO.getCultivationAreaList();
|
||||
|
||||
List<ProductionPlanDO> list = new ArrayList<>();
|
||||
cultivationAreaList.forEach(e -> {
|
||||
ProductionPlanDO obj = new ProductionPlanDO();
|
||||
obj.setPlantSpeciesCode(reqVO.getPlantSpeciesCode());
|
||||
obj.setSpeciesModelId(reqVO.getSpeciesModelId());
|
||||
obj.setProductionStartDate(reqVO.getProductionStartDate());
|
||||
obj.setProductionEndDate(reqVO.getProductionEndDate());
|
||||
obj.setHarvestStartDate(reqVO.getHarvestStartDate());
|
||||
obj.setPlanStatus(CommonConstants.PLAN_STATUS_1);
|
||||
|
||||
obj.setPlantingDate(e.getPlantingDate());
|
||||
obj.setPlantingQuantity(e.getPlantingQuantity());
|
||||
obj.setPredictedYields(e.getPredictedYields());
|
||||
obj.setTotalArea(e.getTotalArea());
|
||||
obj.setPredictedArea(e.getPredictedArea());
|
||||
obj.setRemainingArea(e.getRemainingArea());
|
||||
obj.setUsagePercentage(e.getUsagePercentage());
|
||||
obj.setRemark(e.getRemark());
|
||||
|
||||
obj.setBaseId(e.getBaseId());
|
||||
obj.setBaseName(e.getBaseName());
|
||||
obj.setPlotId(e.getPlotId());
|
||||
obj.setPlotName(e.getPlotName());
|
||||
obj.setTenantId(e.getTenantId());
|
||||
|
||||
// 随机字符串 + 地块名称
|
||||
obj.setId(IdUtil.fastUUID());
|
||||
obj.setPlanNumber(StrHelperUtil.generate() + e.getPlotName());
|
||||
list.add(obj);
|
||||
});
|
||||
productionPlanMapper.insertBatch(list);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -85,12 +85,12 @@ public class HomeServiceImpl implements HomeService {
|
||||
productionPlanInfos.forEach(ee -> {
|
||||
HomeInfoVO.ProductionPlanVO planVO = new HomeInfoVO.ProductionPlanVO();
|
||||
planVO.setId(ee.getId());
|
||||
planVO.setPlantSpecies(ee.getPlantSpecies());
|
||||
planVO.setCultivationAreaId(ee.getCultivationAreaId());
|
||||
// planVO.setPlantSpecies(ee.getPlantSpecies());
|
||||
// planVO.setCultivationAreaId(ee.getCultivationAreaId());
|
||||
planVO.setManagementCycleName(""); // todo 当前管理周期名称
|
||||
planVO.setManagementCyclePlan(""); // todo 当前管理周期计划进度
|
||||
planVO.setCultivatedArea(0); // todo 种植面积
|
||||
planVO.setEstimatedOutput(ee.getEstimatedOutput()); // todo 预产数量
|
||||
// planVO.setEstimatedOutput(ee.getEstimatedOutput()); // todo 预产数量
|
||||
planVO.setTaskCount(0); // todo 任务数量
|
||||
planVO.setManager(""); //
|
||||
plans.add(planVO); // todo 任务负责人
|
||||
|
||||
@@ -89,7 +89,8 @@ private void validateProductionPlanExists(String id) {
|
||||
|
||||
@Override
|
||||
public PageResult<ProductionPlanDO> getProductionPlanPage(ProductionPlanPageReqVO pageReqVO) {
|
||||
return productionPlanMapper.selectPage(pageReqVO);
|
||||
// productionPlanMapper.selectPage(pageReqVO);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user