fix:任务拆解

This commit is contained in:
2026-07-15 14:59:05 +08:00
parent a066ec3637
commit 90c4a9e8e9
16 changed files with 206 additions and 9 deletions

View File

@@ -43,4 +43,28 @@ public interface RpcConstants {
*/
String TASK_PREFIX = RPC_API_PREFIX + "/task";
/**
* lms 服务名
*
* 注意,需要保证和 spring.application.name 保持一致
*/
String LMS_NAME = "lms-server";
/**
* lms 服务的前缀
*/
String LMS_PREFIX = RPC_API_PREFIX + "/lms";
/**
* wms 服务名
*
* 注意,需要保证和 spring.application.name 保持一致
*/
String WMS_NAME = "wms-server";
/**
* wms 服务的前缀
*/
String WMS_PREFIX = RPC_API_PREFIX + "/wms";
}

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.nl.cloud</groupId>
<artifactId>nl-framework</artifactId>
<version>${revision}</version>
</parent>
<artifactId>nl-spring-boot-starter-execute</artifactId>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>cn.nl.cloud</groupId>
<artifactId>nl-common</artifactId>
</dependency>
<!-- Spring 核心 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<optional>true</optional>
</dependency>
<!-- Spring 核心 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- RPC 远程调用相关 -->
<dependency>
<groupId>cn.nl.cloud</groupId>
<artifactId>nl-spring-boot-starter-rpc</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<scope>provided</scope> <!-- 设置为 provided主要是 PageParam 使用到 -->
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,10 @@
package cn.code.nl.framework.execute.biz;
/**
*
* @Author: liyongde
* @Date: 2026/7/15 14:54
*/
public interface TaskCommonApi {
void doHandlePicked();
}

View File

@@ -0,0 +1,16 @@
package cn.code.nl.framework.execute.biz.lms;
import cn.code.nl.framework.common.enums.RpcConstants;
import cn.code.nl.framework.execute.biz.TaskCommonApi;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
/**
* lms通用API
* @Author: liyongde
* @Date: 2026/7/15 14:39
*/
@FeignClient(name = RpcConstants.LMS_NAME, primary = false) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - lms任务")
public interface LmsTaskCommonApi extends TaskCommonApi {
}

View File

@@ -0,0 +1,6 @@
/**
* 业务实现的API
* @Author: liyongde
* @Date: 2026/7/15 14:38
*/
package cn.code.nl.framework.execute.biz;

View File

@@ -0,0 +1,16 @@
package cn.code.nl.framework.execute.biz.wms;
import cn.code.nl.framework.common.enums.RpcConstants;
import cn.code.nl.framework.execute.biz.TaskCommonApi;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
/**
*
* @Author: liyongde
* @Date: 2026/7/15 14:48
*/
@FeignClient(name = RpcConstants.WMS_NAME, primary = false) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - wms任务")
public interface WmsTaskCommonApi extends TaskCommonApi {
}

View File

@@ -0,0 +1,28 @@
package cn.code.nl.framework.execute.core;
/**
* 抽象类任务契约
* LMS/WMS子类遵守
*
* @Author: liyongde
* @Date: 2026/7/15 11:21
*/
public abstract class AbstractTask {
// ========== 取货完成、完成、取消的逻辑 ==========
public void doHandlePicked(Long taskId) {
// 子类实现取货完成业务
}
public abstract void doHandleFinish(Long taskId);
public abstract void doHandleCancel(Long taskId);
/**
* 二次请求
* @param taskId任务id
*/
public Long againApply(Long taskId) {
return null;
}
}

View File

@@ -0,0 +1,6 @@
/**
* 任务模板父类
* @Author: liyongde
* @Date: 2026/7/15 11:03
*/
package cn.code.nl.framework.execute;

View File

@@ -30,6 +30,7 @@
<module>nl-spring-boot-starter-biz-tenant</module>
<module>nl-spring-boot-starter-biz-data-permission</module>
<module>nl-spring-boot-starter-biz-ip</module>
<module>nl-spring-boot-starter-execute</module>
</modules>
<artifactId>nl-framework</artifactId>