From efd19163edb5ac760e6debab4fd6b79c794308c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=BE=E5=AF=8C=E6=96=8C?= Date: Mon, 25 Aug 2025 16:31:55 +0800 Subject: [PATCH] =?UTF-8?q?feat=20(farm):=20=E5=AE=9A=E6=97=B6=E5=99=A8:?= =?UTF-8?q?=20=E7=A7=8D=E6=A4=8D=E4=B8=AD=E5=BF=83-=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新任务状态 - 更新地块面积 - 创建农事记录 --- .../framework/tenant/core/job/TenantJob.java | 2 +- .../module/farm/enums/CommonConstants.java | 1 + .../farm/scheduled/ProductionPlanJob.java | 66 +++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/scheduled/ProductionPlanJob.java diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/job/TenantJob.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/job/TenantJob.java index 23474bbe..f638e67e 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/job/TenantJob.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/job/TenantJob.java @@ -8,7 +8,7 @@ import java.lang.annotation.Target; /** * 多租户 Job 注解 */ -@Target({ElementType.METHOD}) +@Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface TenantJob { } diff --git a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/enums/CommonConstants.java b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/enums/CommonConstants.java index 14051dc2..f2ce4523 100644 --- a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/enums/CommonConstants.java +++ b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/enums/CommonConstants.java @@ -29,6 +29,7 @@ public class CommonConstants { PLAN_MAP.put(2, "进行中"); PLAN_MAP.put(3, "已完成"); PLAN_MAP.put(4, "逾期"); + PLAN_MAP.put(5, "已结束"); } // 模型类型 (1:模型模板; 2:引用案例) diff --git a/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/scheduled/ProductionPlanJob.java b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/scheduled/ProductionPlanJob.java new file mode 100644 index 00000000..7b1febda --- /dev/null +++ b/yudao-module-farm/src/main/java/cn/iocoder/yudao/module/farm/scheduled/ProductionPlanJob.java @@ -0,0 +1,66 @@ +package cn.iocoder.yudao.module.farm.scheduled; + +import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; +import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; +import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService; +import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * @description: 生产计划 + * 表关系 + * 模型管理: farm_model_management + * 模型管理-管理周期: farm_model_cycle + * 模型管理-管理周期-环境指标: farm_model_environment_index + * 模型管理-管理周期-病虫草害: farm_model_pest_disease_weed + * 模型管理-管理周期-气象灾害: farm_model_weather_disaster + * 模型管理-管理周期-农事事操: farm_model_farming_operation + * 模型管理-管理周期-农事操作-投入品: farm_model_farming_operation_input + * @author: binda + * @date: 2025/8/22 17:12 + */ +@Component +@TenantJob +@Slf4j +public class ProductionPlanJob implements JobHandler { + + private final ProductionPlanService productionPlanService; + private final FarmingRecordService farmingRecordService; + + public ProductionPlanJob(ProductionPlanService productionPlanService, FarmingRecordService farmingRecordService) { + this.productionPlanService = productionPlanService; + this.farmingRecordService = farmingRecordService; + } + + /** + * 1. 更新任务状态 + * 2. 更新地块面积 + * 3. 创建农事记录 + * + * @param param 参数 + * @return + * @throws Exception + */ + @Override + public String execute(String param) throws Exception { + this.updatePlanStatusHandler(); + this.updatePlanAreaHandler(); + this.insertRecordHandler(); + return "success"; + } + + private void updatePlanStatusHandler() { + + } + + + private void updatePlanAreaHandler() { + + } + + private void insertRecordHandler() { + + } + +} \ No newline at end of file