opt: 把 LMS/WMS 重复的执行逻辑下沉到 starter
This commit is contained in:
@@ -0,0 +1,115 @@
|
|||||||
|
package cn.code.nl.framework.execute.biz.api;
|
||||||
|
|
||||||
|
import cn.code.nl.framework.common.exception.ServiceException;
|
||||||
|
import cn.code.nl.framework.common.pojo.CommonResult;
|
||||||
|
import cn.code.nl.framework.execute.biz.dto.TaskStatusCallApiReqDTO;
|
||||||
|
import cn.code.nl.framework.execute.biz.vo.AcsApplyActionRespVO;
|
||||||
|
import cn.code.nl.framework.execute.core.AbstractTask;
|
||||||
|
import cn.code.nl.framework.execute.core.TaskFactory;
|
||||||
|
import cn.code.nl.framework.execute.core.dto.TaskExecuteDTO;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务通用 API 公共实现
|
||||||
|
*
|
||||||
|
* @author liyongde
|
||||||
|
*/
|
||||||
|
public abstract class AbstractTaskCommonApiImpl implements TaskCommonApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务处理器工厂
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private TaskFactory taskFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理取货完成
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CommonResult<AcsApplyActionRespVO> doHandlePicked(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
|
return execute(taskStatusCallApiReqDTO, (task, taskExecuteDTO) -> {
|
||||||
|
task.doHandlePicked(taskExecuteDTO);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理二次请求
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CommonResult<AcsApplyActionRespVO> doHandleApplyAgain(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
|
return execute(taskStatusCallApiReqDTO, AbstractTask::againApply);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理请求放货
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CommonResult<AcsApplyActionRespVO> doHandleRequestRelease(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
|
return execute(taskStatusCallApiReqDTO, AbstractTask::requestPutAway);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理请求取货
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CommonResult<AcsApplyActionRespVO> doHandleRequestPick(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
|
return execute(taskStatusCallApiReqDTO, AbstractTask::requestPickGoods);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理请求离开
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CommonResult<AcsApplyActionRespVO> doHandleRequestLeave(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
|
return execute(taskStatusCallApiReqDTO, AbstractTask::requestOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理请求进入
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CommonResult<AcsApplyActionRespVO> doHandleRequestEnter(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
|
return execute(taskStatusCallApiReqDTO, AbstractTask::requestIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 handleCode 路由到具体任务处理器
|
||||||
|
*/
|
||||||
|
private CommonResult<AcsApplyActionRespVO> execute(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO,
|
||||||
|
TaskActionInvoker taskActionInvoker) {
|
||||||
|
AbstractTask task = taskFactory.getTask(taskStatusCallApiReqDTO.getHandleCode());
|
||||||
|
if (task == null) {
|
||||||
|
throw new ServiceException(500, "未找到任务处理器:" + taskStatusCallApiReqDTO.getHandleCode());
|
||||||
|
}
|
||||||
|
Object data = taskActionInvoker.invoke(task, buildTaskExecuteDTO(taskStatusCallApiReqDTO));
|
||||||
|
|
||||||
|
AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
||||||
|
respVO.setTaskId(taskStatusCallApiReqDTO.getTaskId());
|
||||||
|
respVO.setTaskCode(taskStatusCallApiReqDTO.getTaskCode());
|
||||||
|
respVO.setData(data);
|
||||||
|
return CommonResult.success(respVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建任务执行参数
|
||||||
|
*/
|
||||||
|
private TaskExecuteDTO buildTaskExecuteDTO(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
|
return TaskExecuteDTO.builder()
|
||||||
|
.taskId(taskStatusCallApiReqDTO.getTaskId())
|
||||||
|
.payload(taskStatusCallApiReqDTO.getPayload())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务动作调用器
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
private interface TaskActionInvoker {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用任务动作
|
||||||
|
*/
|
||||||
|
Object invoke(AbstractTask task, TaskExecuteDTO taskExecuteDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,8 @@ import cn.code.nl.framework.common.pojo.CommonResult;
|
|||||||
import cn.code.nl.framework.execute.biz.dto.TaskStatusCallApiReqDTO;
|
import cn.code.nl.framework.execute.biz.dto.TaskStatusCallApiReqDTO;
|
||||||
import cn.code.nl.framework.execute.biz.vo.AcsApplyActionRespVO;
|
import cn.code.nl.framework.execute.biz.vo.AcsApplyActionRespVO;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -16,25 +16,25 @@ public interface TaskCommonApi {
|
|||||||
|
|
||||||
@Operation(summary = "请求取货")
|
@Operation(summary = "请求取货")
|
||||||
@PostMapping("/do-handle-picked")
|
@PostMapping("/do-handle-picked")
|
||||||
CommonResult<AcsApplyActionRespVO> doHandlePicked(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
CommonResult<AcsApplyActionRespVO> doHandlePicked(@RequestBody TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
||||||
|
|
||||||
@Operation(summary = "二次请求")
|
@Operation(summary = "二次请求")
|
||||||
@PostMapping("/do-handle-apply-again")
|
@PostMapping("/do-handle-apply-again")
|
||||||
CommonResult<AcsApplyActionRespVO> doHandleApplyAgain(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
CommonResult<AcsApplyActionRespVO> doHandleApplyAgain(@RequestBody TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
||||||
|
|
||||||
@Operation(summary = "处理请求放货")
|
@Operation(summary = "处理请求放货")
|
||||||
@PostMapping("/do-handle-request-release")
|
@PostMapping("/do-handle-request-release")
|
||||||
CommonResult<AcsApplyActionRespVO> doHandleRequestRelease(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
CommonResult<AcsApplyActionRespVO> doHandleRequestRelease(@RequestBody TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
||||||
|
|
||||||
@Operation(summary = "处理请求取货")
|
@Operation(summary = "处理请求取货")
|
||||||
@PostMapping("/do-handle-request-pick")
|
@PostMapping("/do-handle-request-pick")
|
||||||
CommonResult<AcsApplyActionRespVO> doHandleRequestPick(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
CommonResult<AcsApplyActionRespVO> doHandleRequestPick(@RequestBody TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
||||||
|
|
||||||
@Operation(summary = "处理请求离开")
|
@Operation(summary = "处理请求离开")
|
||||||
@PostMapping("/do-handle-request-leave")
|
@PostMapping("/do-handle-request-leave")
|
||||||
CommonResult<AcsApplyActionRespVO> doHandleRequestLeave(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
CommonResult<AcsApplyActionRespVO> doHandleRequestLeave(@RequestBody TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
||||||
|
|
||||||
@Operation(summary = "处理请求进入")
|
@Operation(summary = "处理请求进入")
|
||||||
@PostMapping("/do-handle-request-enter")
|
@PostMapping("/do-handle-request-enter")
|
||||||
CommonResult<AcsApplyActionRespVO> doHandleRequestEnter(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
CommonResult<AcsApplyActionRespVO> doHandleRequestEnter(@RequestBody TaskStatusCallApiReqDTO taskStatusCallApiReqDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
* @Author: liyongde
|
* @Author: liyongde
|
||||||
* @Date: 2026/7/15 14:39
|
* @Date: 2026/7/15 14:39
|
||||||
*/
|
*/
|
||||||
@FeignClient(name = RpcConstants.LMS_NAME, path = "/lms", primary = false) // TODO 芋艿:fallbackFactory =
|
@FeignClient(name = RpcConstants.LMS_NAME, path = RpcConstants.RPC_API_PREFIX + "/lms", primary = false) // TODO 芋艿:fallbackFactory =
|
||||||
@Tag(name = "RPC 服务 - lms任务")
|
@Tag(name = "RPC 服务 - lms任务")
|
||||||
public interface LmsTaskCommonApi extends TaskCommonApi {
|
public interface LmsTaskCommonApi extends TaskCommonApi {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
* @Author: liyongde
|
* @Author: liyongde
|
||||||
* @Date: 2026/7/15 14:48
|
* @Date: 2026/7/15 14:48
|
||||||
*/
|
*/
|
||||||
@FeignClient(name = RpcConstants.WMS_NAME, path = "/wms", primary = false) // TODO 芋艿:fallbackFactory =
|
@FeignClient(name = RpcConstants.WMS_NAME, path = RpcConstants.RPC_API_PREFIX + "/wms", primary = false) // TODO 芋艿:fallbackFactory =
|
||||||
@Tag(name = "RPC 服务 - wms任务")
|
@Tag(name = "RPC 服务 - wms任务")
|
||||||
public interface WmsTaskCommonApi extends TaskCommonApi {
|
public interface WmsTaskCommonApi extends TaskCommonApi {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package cn.code.nl.framework.execute.biz.vo;
|
package cn.code.nl.framework.execute.biz.vo;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,5 +24,5 @@ public class AcsApplyActionRespVO {
|
|||||||
/**
|
/**
|
||||||
* 数据
|
* 数据
|
||||||
*/
|
*/
|
||||||
private JSONObject data;
|
private Object data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ package cn.code.nl.framework.execute.core.dto;
|
|||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -12,6 +15,9 @@ import java.util.Map;
|
|||||||
* @Date: 2026/7/16 14:57
|
* @Date: 2026/7/16 14:57
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class TaskExecuteDTO {
|
public class TaskExecuteDTO {
|
||||||
|
|
||||||
@Schema(description = "任务id")
|
@Schema(description = "任务id")
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package cn.code.nl.module.lms.api;
|
||||||
|
|
||||||
|
import cn.code.nl.framework.execute.biz.api.AbstractTaskCommonApiImpl;
|
||||||
|
import cn.code.nl.framework.execute.biz.api.lms.LmsTaskCommonApi;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LMS 任务通用 API 实现
|
||||||
|
*
|
||||||
|
* @author liyongde
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Validated
|
||||||
|
@Primary
|
||||||
|
public class LmsTaskExecuteApiImpl extends AbstractTaskCommonApiImpl implements LmsTaskCommonApi {
|
||||||
|
}
|
||||||
@@ -1,80 +1,80 @@
|
|||||||
package cn.code.nl.module.lms.demo;
|
//package cn.code.nl.module.lms.demo;
|
||||||
|
//
|
||||||
import cn.code.nl.framework.common.pojo.CommonResult;
|
//import cn.code.nl.framework.common.pojo.CommonResult;
|
||||||
import cn.code.nl.framework.execute.biz.api.lms.LmsTaskCommonApi;
|
//import cn.code.nl.framework.execute.biz.api.lms.LmsTaskCommonApi;
|
||||||
import cn.code.nl.framework.execute.biz.dto.TaskStatusCallApiReqDTO;
|
//import cn.code.nl.framework.execute.biz.dto.TaskStatusCallApiReqDTO;
|
||||||
import cn.code.nl.framework.execute.biz.vo.AcsApplyActionRespVO;
|
//import cn.code.nl.framework.execute.biz.vo.AcsApplyActionRespVO;
|
||||||
import com.alibaba.fastjson.JSON;
|
//import com.alibaba.fastjson.JSON;
|
||||||
import org.springframework.validation.annotation.Validated;
|
//import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
//import org.springframework.web.bind.annotation.RestController;
|
||||||
|
//
|
||||||
import static cn.code.nl.framework.common.pojo.CommonResult.success;
|
//import static cn.code.nl.framework.common.pojo.CommonResult.success;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
*
|
// *
|
||||||
* @Author: liyongde
|
// * @Author: liyongde
|
||||||
* @Date: 2026/7/15 15:25
|
// * @Date: 2026/7/15 15:25
|
||||||
*/
|
// */
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
//@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@Validated
|
//@Validated
|
||||||
public class DemoApi implements LmsTaskCommonApi {
|
//public class DemoApi implements LmsTaskCommonApi {
|
||||||
@Override
|
// @Override
|
||||||
public CommonResult<AcsApplyActionRespVO> doHandlePicked(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
// public CommonResult<AcsApplyActionRespVO> doHandlePicked(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
// 构建外层VO
|
// // 构建外层VO
|
||||||
AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
// AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
||||||
respVO.setTaskId(10001L);
|
// respVO.setTaskId(10001L);
|
||||||
respVO.setTaskCode("ACS20260716001");
|
// respVO.setTaskCode("ACS20260716001");
|
||||||
// 内层data赋值 "success"
|
// // 内层data赋值 "success"
|
||||||
return success(respVO);
|
// return success(respVO);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public CommonResult<AcsApplyActionRespVO> doHandleApplyAgain(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
// public CommonResult<AcsApplyActionRespVO> doHandleApplyAgain(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
DemoRespVO demoRespVO = new DemoRespVO();
|
// DemoRespVO demoRespVO = new DemoRespVO();
|
||||||
demoRespVO.setTargetPoint("A_10001");
|
// demoRespVO.setTargetPoint("A_10001");
|
||||||
|
//
|
||||||
// 构建外层VO
|
// // 构建外层VO
|
||||||
AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
// AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
||||||
respVO.setTaskId(10001L);
|
// respVO.setTaskId(10001L);
|
||||||
respVO.setTaskCode("ACS20260716001");
|
// respVO.setTaskCode("ACS20260716001");
|
||||||
// 内层data赋值 "success"
|
// // 内层data赋值 "success"
|
||||||
respVO.setData(JSON.parseObject(JSON.toJSONString(demoRespVO)));
|
// respVO.setData(JSON.parseObject(JSON.toJSONString(demoRespVO)));
|
||||||
return success(respVO);
|
// return success(respVO);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public CommonResult<AcsApplyActionRespVO> doHandleRequestRelease(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
// public CommonResult<AcsApplyActionRespVO> doHandleRequestRelease(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
// 构建外层VO
|
// // 构建外层VO
|
||||||
AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
// AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
||||||
respVO.setTaskId(10001L);
|
// respVO.setTaskId(10001L);
|
||||||
respVO.setTaskCode("ACS20260716001");
|
// respVO.setTaskCode("ACS20260716001");
|
||||||
return success(respVO);
|
// return success(respVO);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public CommonResult<AcsApplyActionRespVO> doHandleRequestPick(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
// public CommonResult<AcsApplyActionRespVO> doHandleRequestPick(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
// 构建外层VO
|
// // 构建外层VO
|
||||||
AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
// AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
||||||
respVO.setTaskId(10001L);
|
// respVO.setTaskId(10001L);
|
||||||
respVO.setTaskCode("ACS20260716001");
|
// respVO.setTaskCode("ACS20260716001");
|
||||||
return success(respVO);
|
// return success(respVO);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public CommonResult<AcsApplyActionRespVO> doHandleRequestLeave(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
// public CommonResult<AcsApplyActionRespVO> doHandleRequestLeave(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
// 构建外层VO
|
// // 构建外层VO
|
||||||
AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
// AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
||||||
respVO.setTaskId(10001L);
|
// respVO.setTaskId(10001L);
|
||||||
respVO.setTaskCode("ACS20260716001");
|
// respVO.setTaskCode("ACS20260716001");
|
||||||
return success(respVO);
|
// return success(respVO);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public CommonResult<AcsApplyActionRespVO> doHandleRequestEnter(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
// public CommonResult<AcsApplyActionRespVO> doHandleRequestEnter(TaskStatusCallApiReqDTO taskStatusCallApiReqDTO) {
|
||||||
// 构建外层VO
|
// // 构建外层VO
|
||||||
AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
// AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
||||||
respVO.setTaskId(10001L);
|
// respVO.setTaskId(10001L);
|
||||||
respVO.setTaskCode("ACS20260716001");
|
// respVO.setTaskCode("ACS20260716001");
|
||||||
return success(respVO);
|
// return success(respVO);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* @Author: liyongde
|
||||||
|
* @Date: 2026/7/23 14:41
|
||||||
|
*/
|
||||||
|
package cn.code.nl.module.lms.manage;
|
||||||
@@ -11,7 +11,6 @@ import cn.code.nl.module.task.dal.mysql.transporttask.TransportTaskMapper;
|
|||||||
import cn.code.nl.module.task.dto.AcsFeedbackReqDTO;
|
import cn.code.nl.module.task.dto.AcsFeedbackReqDTO;
|
||||||
import cn.code.nl.module.task.enums.AcsBusinessOperationTypeEnum;
|
import cn.code.nl.module.task.enums.AcsBusinessOperationTypeEnum;
|
||||||
import cn.code.nl.module.task.enums.TransportTaskStatusEnum;
|
import cn.code.nl.module.task.enums.TransportTaskStatusEnum;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -104,68 +103,63 @@ public class TransportTaskBusinessOperationManager {
|
|||||||
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
||||||
CommonResult<AcsApplyActionRespVO> result =
|
CommonResult<AcsApplyActionRespVO> result =
|
||||||
serverApi.doHandlePicked(buildReq(task, reqDTO));
|
serverApi.doHandlePicked(buildReq(task, reqDTO));
|
||||||
return result.getData();
|
return result.getCheckedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理二次请求
|
* 处理二次请求
|
||||||
*/
|
*/
|
||||||
private AcsApplyActionRespVO handleApplyAgain(TransportTaskDO task, AcsFeedbackReqDTO reqDTO) {
|
private AcsApplyActionRespVO handleApplyAgain(TransportTaskDO task, AcsFeedbackReqDTO reqDTO) {
|
||||||
// TODO 二次请求业务待开发
|
log.info("二次请求, taskId={}", task.getTaskId());
|
||||||
log.info("二次请求业务待开发, taskId={}", task.getTaskId());
|
|
||||||
// 调用具体的服务去执行取货完成操作。
|
// 调用具体的服务去执行取货完成操作。
|
||||||
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
||||||
CommonResult<AcsApplyActionRespVO> result =
|
CommonResult<AcsApplyActionRespVO> result =
|
||||||
serverApi.doHandleApplyAgain(buildReq(task, reqDTO));
|
serverApi.doHandleApplyAgain(buildReq(task, reqDTO));
|
||||||
return result.getData();
|
return result.getCheckedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理请求放货
|
* 处理请求放货
|
||||||
*/
|
*/
|
||||||
private Object handleRequestRelease(TransportTaskDO task, AcsFeedbackReqDTO reqDTO) {
|
private Object handleRequestRelease(TransportTaskDO task, AcsFeedbackReqDTO reqDTO) {
|
||||||
// TODO 请求放货业务待开发
|
log.info("请求放货, taskId={}", task.getTaskId());
|
||||||
log.info("请求放货业务待开发, taskId={}", task.getTaskId());
|
|
||||||
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
||||||
CommonResult<AcsApplyActionRespVO> result =
|
CommonResult<AcsApplyActionRespVO> result =
|
||||||
serverApi.doHandleRequestRelease(buildReq(task, reqDTO));
|
serverApi.doHandleRequestRelease(buildReq(task, reqDTO));
|
||||||
return result.getData();
|
return result.getCheckedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理请求取货
|
* 处理请求取货
|
||||||
*/
|
*/
|
||||||
private Object handleRequestPick(TransportTaskDO task, AcsFeedbackReqDTO reqDTO) {
|
private Object handleRequestPick(TransportTaskDO task, AcsFeedbackReqDTO reqDTO) {
|
||||||
// TODO 请求取货业务待开发
|
log.info("请求取货, taskId={}", task.getTaskId());
|
||||||
log.info("请求取货业务待开发, taskId={}", task.getTaskId());
|
|
||||||
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
||||||
CommonResult<AcsApplyActionRespVO> result =
|
CommonResult<AcsApplyActionRespVO> result =
|
||||||
serverApi.doHandleRequestPick(buildReq(task, reqDTO));
|
serverApi.doHandleRequestPick(buildReq(task, reqDTO));
|
||||||
return result.getData();
|
return result.getCheckedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理请求离开
|
* 处理请求离开
|
||||||
*/
|
*/
|
||||||
private Object handleRequestLeave(TransportTaskDO task, AcsFeedbackReqDTO reqDTO) {
|
private Object handleRequestLeave(TransportTaskDO task, AcsFeedbackReqDTO reqDTO) {
|
||||||
// TODO 请求离开业务待开发
|
log.info("请求离开, taskId={}", task.getTaskId());
|
||||||
log.info("请求离开业务待开发, taskId={}", task.getTaskId());
|
|
||||||
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
||||||
CommonResult<AcsApplyActionRespVO> result =
|
CommonResult<AcsApplyActionRespVO> result =
|
||||||
serverApi.doHandleRequestLeave(buildReq(task, reqDTO));
|
serverApi.doHandleRequestLeave(buildReq(task, reqDTO));
|
||||||
return result.getData();
|
return result.getCheckedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理请求进入
|
* 处理请求进入
|
||||||
*/
|
*/
|
||||||
private Object handleRequestEnter(TransportTaskDO task, AcsFeedbackReqDTO reqDTO) {
|
private Object handleRequestEnter(TransportTaskDO task, AcsFeedbackReqDTO reqDTO) {
|
||||||
// TODO 请求进入业务待开发
|
log.info("请求进入, taskId={}", task.getTaskId());
|
||||||
log.info("请求进入业务待开发, taskId={}", task.getTaskId());
|
|
||||||
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
TaskCommonApi serverApi = taskCommonApiFactory.getByServerName(task.getOwnerService());
|
||||||
CommonResult<AcsApplyActionRespVO> result =
|
CommonResult<AcsApplyActionRespVO> result =
|
||||||
serverApi.doHandleRequestEnter(buildReq(task, reqDTO));
|
serverApi.doHandleRequestEnter(buildReq(task, reqDTO));
|
||||||
return result.getData();
|
return result.getCheckedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -175,7 +169,7 @@ public class TransportTaskBusinessOperationManager {
|
|||||||
AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
AcsApplyActionRespVO respVO = new AcsApplyActionRespVO();
|
||||||
respVO.setTaskId(task.getTaskId());
|
respVO.setTaskId(task.getTaskId());
|
||||||
respVO.setTaskCode(task.getTaskCode());
|
respVO.setTaskCode(task.getTaskCode());
|
||||||
respVO.setData(JSON.parseObject(JSON.toJSONString(data)));
|
respVO.setData(data);
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -185,7 +179,7 @@ public class TransportTaskBusinessOperationManager {
|
|||||||
TaskStatusCallApiReqDTO req = new TaskStatusCallApiReqDTO();
|
TaskStatusCallApiReqDTO req = new TaskStatusCallApiReqDTO();
|
||||||
req.setTaskId(task.getTaskId());
|
req.setTaskId(task.getTaskId());
|
||||||
req.setTaskCode(task.getTaskCode());
|
req.setTaskCode(task.getTaskCode());
|
||||||
req.setStatus(TransportTaskStatusEnum.PICKED.getCode());
|
req.setStatus(reqDTO.getStatus());
|
||||||
req.setOwnerService(task.getOwnerService());
|
req.setOwnerService(task.getOwnerService());
|
||||||
req.setBizType(task.getBizType());
|
req.setBizType(task.getBizType());
|
||||||
req.setBizId(task.getBizId());
|
req.setBizId(task.getBizId());
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package cn.code.nl.module.wms.api;
|
||||||
|
|
||||||
|
import cn.code.nl.framework.execute.biz.api.AbstractTaskCommonApiImpl;
|
||||||
|
import cn.code.nl.framework.execute.biz.api.wms.WmsTaskCommonApi;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WMS 任务通用 API 实现
|
||||||
|
*
|
||||||
|
* @author liyongde
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Validated
|
||||||
|
@Primary
|
||||||
|
public class WmsTaskExecuteApiImpl extends AbstractTaskCommonApiImpl implements WmsTaskCommonApi {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user