feat (farm): 业务功能
- 种植中心 - 生产计划 - 模型管理 - 引用模型案例
This commit is contained in:
@@ -63,9 +63,9 @@ public class CropFarmingCenterController {
|
||||
|
||||
@GetMapping("/production-plan/get/{id}")
|
||||
@Operation(summary = "生产计划-查看")
|
||||
public CommonResult<ProductionPlanRespVO> getProductionPlan(@PathVariable("id") String id) {
|
||||
ProductionPlanDO productionPlan = productionPlanService.getProductionPlan(id);
|
||||
return success(BeanUtils.toBean(productionPlan, ProductionPlanRespVO.class));
|
||||
public CommonResult<cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO> getProductionPlan(@PathVariable("id") String id) {
|
||||
cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO res = cropFarmingCenterService.getProductionPlan(id);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
@PostMapping("/production-plan/create")
|
||||
@@ -82,6 +82,10 @@ public class CropFarmingCenterController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 农事记录
|
||||
@GetMapping("/farming-record/page")
|
||||
@Operation(summary = "农事记录-分页")
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.modelmanagement.vo.ModelManagementRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: binda
|
||||
* @date: 2025/8/21 14:17
|
||||
*/
|
||||
@Data
|
||||
public class ProductionPlanRespVO {
|
||||
|
||||
@Schema(description = "ID")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "计划编号")
|
||||
private String planNumber;
|
||||
|
||||
@Schema(description = "种植物种-编码")
|
||||
private String plantSpeciesCode;
|
||||
|
||||
@Schema(description = "物种模型-ID")
|
||||
private String speciesModelId;
|
||||
|
||||
@Schema(description = "排产开始日期")
|
||||
private LocalDate productionStartDate;
|
||||
|
||||
@Schema(description = "排产结束日期")
|
||||
private LocalDate productionEndDate;
|
||||
|
||||
@Schema(description = "采收开始日期")
|
||||
private LocalDate harvestStartDate;
|
||||
|
||||
@Schema(description = "计划执行状态")
|
||||
private Integer planStatus;
|
||||
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private String tenantId;
|
||||
@Schema(description = "基地ID")
|
||||
private String baseId;
|
||||
@Schema(description = "基地名称")
|
||||
private String baseName;
|
||||
@Schema(description = "地块ID")
|
||||
private String plotId;
|
||||
@Schema(description = "地块名称")
|
||||
private String plotName;
|
||||
|
||||
/**
|
||||
* 种植区域信息
|
||||
*/
|
||||
@Schema(description = "种植日期")
|
||||
private LocalDate plantingDate;
|
||||
@Schema(description = "种植株数")
|
||||
private Integer plantingQuantity;
|
||||
@Schema(description = "预计产量")
|
||||
private Integer predictedYields;
|
||||
@Schema(description = "总面积")
|
||||
private Double totalArea;
|
||||
@Schema(description = "计划面积")
|
||||
private Double predictedArea;
|
||||
@Schema(description = "剩余面积")
|
||||
private Double remainingArea;
|
||||
@Schema(description = "占地面积")
|
||||
private Integer usagePercentage;
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "模型", example = "芋艿")
|
||||
private ModelManagementRespVO modelManagementRespVO;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @description: 更新
|
||||
* @author: binda
|
||||
* @date: 2025/8/21 14:55
|
||||
*/
|
||||
@Data
|
||||
public class ProductionPlanUpdateReqVO {
|
||||
|
||||
|
||||
@Schema(description = "ID")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "计划编号")
|
||||
private String planNumber;
|
||||
|
||||
@Schema(description = "种植物种-编码")
|
||||
private String plantSpeciesCode;
|
||||
|
||||
@Schema(description = "物种模型-ID")
|
||||
private String speciesModelId;
|
||||
|
||||
@Schema(description = "排产开始日期")
|
||||
private LocalDate productionStartDate;
|
||||
|
||||
@Schema(description = "排产结束日期")
|
||||
private LocalDate productionEndDate;
|
||||
|
||||
@Schema(description = "采收开始日期")
|
||||
private LocalDate harvestStartDate;
|
||||
|
||||
@Schema(description = "计划执行状态")
|
||||
private Integer planStatus;
|
||||
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private String tenantId;
|
||||
@Schema(description = "基地ID")
|
||||
private String baseId;
|
||||
@Schema(description = "基地名称")
|
||||
private String baseName;
|
||||
@Schema(description = "地块ID")
|
||||
private String plotId;
|
||||
@Schema(description = "地块名称")
|
||||
private String plotName;
|
||||
|
||||
/**
|
||||
* 种植区域信息
|
||||
*/
|
||||
@Schema(description = "种植日期")
|
||||
private LocalDate plantingDate;
|
||||
@Schema(description = "种植株数")
|
||||
private Integer plantingQuantity;
|
||||
@Schema(description = "预计产量")
|
||||
private Integer predictedYields;
|
||||
@Schema(description = "总面积")
|
||||
private Double totalArea;
|
||||
@Schema(description = "计划面积")
|
||||
private Double predictedArea;
|
||||
@Schema(description = "剩余面积")
|
||||
private Double remainingArea;
|
||||
@Schema(description = "占地面积")
|
||||
private Integer usagePercentage;
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.farm.service.cropFarmingCenter;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanSaveReqVO;
|
||||
|
||||
/**
|
||||
@@ -13,11 +14,14 @@ public interface CropFarmingCenterService {
|
||||
* 生产计划-新增
|
||||
* 1份生产计划 -> n种植区域 (区域: 一个基地的某个地块,划分为多亩地,交叉种植)
|
||||
* -> 1模型案例(可以修改,不影响原有模版)
|
||||
* @param createReqVO
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void createProductionPlan(ProductionPlanSaveReqVO createReqVO);
|
||||
|
||||
ProductionPlanRespVO getProductionPlan(String id);
|
||||
|
||||
void updateProductionPlan(ProductionPlanSaveReqVO updateReqVO);
|
||||
|
||||
int getCropCount(Long tenantId);
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package cn.iocoder.yudao.module.farm.service.cropFarmingCenter;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
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.modelmanagement.vo.ModelManagementRespVO;
|
||||
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;
|
||||
@@ -15,6 +19,8 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
|
||||
/**
|
||||
* @description: 种植中心
|
||||
* @author: binda
|
||||
@@ -40,7 +46,8 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
public void createProductionPlan(ProductionPlanSaveReqVO reqVO) {
|
||||
String taskId = IdUtil.fastUUID();
|
||||
String speciesModelId = reqVO.getSpeciesModelId();
|
||||
// 创建模型案例
|
||||
|
||||
// 创建模型案例 todo
|
||||
speciesModelId = modelManagementService.createModelManagementCase(speciesModelId,taskId);
|
||||
if (speciesModelId.equals("")) {
|
||||
return;
|
||||
@@ -75,7 +82,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
|
||||
|
||||
// 随机字符串 + 地块名称
|
||||
obj.setPlanNumber(StrHelperUtil.generate() + e.getPlotName());
|
||||
obj.setPlanNumber(StrHelperUtil.generate() +"-"+ e.getPlotName());
|
||||
obj.setId(taskId);
|
||||
list.add(obj);
|
||||
}
|
||||
@@ -83,6 +90,30 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductionPlanRespVO getProductionPlan(String id) {
|
||||
LoginUser user = getLoginUser();
|
||||
|
||||
ProductionPlanDO productionPlanDO = productionPlanMapper.selectOne(
|
||||
ProductionPlanDO::getId, id,
|
||||
ProductionPlanDO::getTenantId,user.getTenantId());
|
||||
|
||||
if (productionPlanDO == null) {
|
||||
return new ProductionPlanRespVO();
|
||||
}
|
||||
|
||||
ModelManagementRespVO modelManagementRespVO = modelManagementService.getModelManagement(productionPlanDO.getSpeciesModelId());
|
||||
|
||||
ProductionPlanRespVO productionPlanRespVO = BeanUtils.toBean(productionPlanDO, ProductionPlanRespVO.class);
|
||||
productionPlanRespVO.setModelManagementRespVO(modelManagementRespVO);
|
||||
return productionPlanRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProductionPlan(ProductionPlanSaveReqVO updateReqVO) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCropCount(Long tenantId) {
|
||||
return productionPlanMapper.getCropCount(tenantId);
|
||||
|
||||
@@ -84,8 +84,11 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
||||
return "";
|
||||
}
|
||||
|
||||
this.getModelManagement(modelManagementDO.getId());
|
||||
ModelManagementRespVO modelManagement = this.getModelManagement(modelManagementDO.getId());
|
||||
|
||||
|
||||
|
||||
// 将新建的的模型id返回
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
FROM farm_sys_dict t
|
||||
WHERE
|
||||
t.deleted = 0
|
||||
AND t.status = 1
|
||||
AND t.dict_type_code = #{dictTypeCode}
|
||||
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user