From 1167fdf256c7b53d2f305ecc7d5ca785c0b028e6 Mon Sep 17 00:00:00 2001 From: chenlong Date: Sat, 12 Oct 2024 10:43:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8B=86=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/OrderSplitAllTaskStateConstant.java | 6 +- .../DistributionSplitOrderTaskController.java | 83 +++++++++++-------- .../dto/splitOrder/AddPackageCodeDTO.java | 14 ++++ .../dto/splitOrder/AddTaskDTO.java | 12 +++ .../dto/splitOrder/CancelPackageCodeDTO.java | 7 ++ .../distribution/dto/splitOrder/TaskId.java | 10 +++ ...DistributionSplitOrderTaskServiceImpl.java | 14 ++-- 7 files changed, 101 insertions(+), 45 deletions(-) create mode 100644 blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddPackageCodeDTO.java create mode 100644 blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddTaskDTO.java create mode 100644 blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/CancelPackageCodeDTO.java create mode 100644 blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/TaskId.java diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/order/OrderSplitAllTaskStateConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/order/OrderSplitAllTaskStateConstant.java index 531180361..b116d106e 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/order/OrderSplitAllTaskStateConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/order/OrderSplitAllTaskStateConstant.java @@ -10,9 +10,9 @@ import lombok.Getter; @Getter public enum OrderSplitAllTaskStateConstant { - InProgress("未完成",0), - finish("已完成",1), - cancel("已撤销",2); + InProgress("未完成",1), + finish("已完成",2), + cancel("已撤销",3); private final String name; private final Integer value; diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java index ba5b5b666..eabf84f66 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java @@ -2,17 +2,19 @@ package com.logpm.distribution.controller; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.logpm.distribution.dto.splitOrder.DistributionSplitAllTaskSearchDTO; -import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO; +import com.logpm.distribution.dto.splitOrder.*; import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity; import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; import com.logpm.distribution.service.IDistributionSplitOrderTaskService; import com.logpm.distribution.vo.SplitPackageOrderVO; import lombok.AllArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; @RestController @@ -23,8 +25,8 @@ public class DistributionSplitOrderTaskController { @PostMapping("/add-package-code") - public R addPackageCode(Long taskId, List packageCodes) { - return distributionSplitOrderTaskService.addPackageCode(taskId, packageCodes); + public R addPackageCode(@RequestBody AddPackageCodeDTO addPackageCodeDTO) { + return distributionSplitOrderTaskService.addPackageCode(addPackageCodeDTO.getTaskId(), addPackageCodeDTO.getPackageCodes()); } @GetMapping("/all-task-list") @@ -33,81 +35,92 @@ public class DistributionSplitOrderTaskController { } @PostMapping("/batch-create-task") - public R batchCreateTask(@RequestBody List distributionSplitOrderTaskList) { + public R batchCreateTask(@RequestBody ArrayList distributionSplitOrderTaskList) { return distributionSplitOrderTaskService.batchCreateTask(distributionSplitOrderTaskList); } @PostMapping("/add-task") - public R addTask(Long allTaskId, List task) { - return distributionSplitOrderTaskService.addTask(allTaskId, task); + public R addTask(@RequestBody AddTaskDTO addTaskDTO) { + return distributionSplitOrderTaskService.addTask(addTaskDTO.getAllTaskId(), addTaskDTO.getTask()); } @PostMapping("/cancel-all-task") - public R cancelAllTask(Long allTaskId) { - return distributionSplitOrderTaskService.cancelAllTask(allTaskId); + public R cancelAllTask(@RequestBody TaskId allTaskId) { + return distributionSplitOrderTaskService.cancelAllTask(allTaskId.getAllTaskId()); } - @RequestMapping("/cancel-package-code") - public R cancelPackageCode(Long taskId, List packageCodes) { - return distributionSplitOrderTaskService.cancelPackageCode(taskId, packageCodes); + @PostMapping("/cancel-package-code") + public R cancelPackageCode(@RequestBody CancelPackageCodeDTO cancelPackageCodeDTO) { + return distributionSplitOrderTaskService.cancelPackageCode(cancelPackageCodeDTO.getTaskId(), cancelPackageCodeDTO.getPackageCodes()); } - @RequestMapping("/cancel-task") - public R cancelTask(Long taskId) { - return distributionSplitOrderTaskService.cancelTask(taskId); + @PostMapping("/cancel-task") + public R cancelTask(@RequestBody TaskId taskId) { + return distributionSplitOrderTaskService.cancelTask(taskId.getTaskId()); } + /** + * 用不着 + * @param distributionSplitOrderTaskEntity + * @param packageCodeList + * @return + */ @RequestMapping("/create-task") - public R createTask(DistributionSplitOrderTaskEntity distributionSplitOrderTaskEntity, List packageCodeList) { + public R createTask(DistributionSplitOrderTaskEntity distributionSplitOrderTaskEntity, ArrayList packageCodeList) { return distributionSplitOrderTaskService.createTask(distributionSplitOrderTaskEntity, packageCodeList); } - @RequestMapping("/delete-all-task") - public R deleteAllTask(Long allTaskId) { - return distributionSplitOrderTaskService.deleteAllTask(allTaskId); + @PostMapping("/delete-all-task") + public R deleteAllTask(@RequestBody TaskId allTaskId) { + return distributionSplitOrderTaskService.deleteAllTask(allTaskId.getAllTaskId()); } - @RequestMapping("/delete-task") - public R deleteTask(Long taskId) { - return distributionSplitOrderTaskService.deleteTask(taskId); + @PostMapping("/delete-task") + public R deleteTask(@RequestBody TaskId taskId) { + return distributionSplitOrderTaskService.deleteTask(taskId.getTaskId()); } - @RequestMapping("/finish-all-task") - public R finishAllTask(Long allTaskId) { - return distributionSplitOrderTaskService.finishAllTask(allTaskId); + @PostMapping("/finish-all-task") + public R finishAllTask(@RequestBody TaskId allTaskId) { + return distributionSplitOrderTaskService.finishAllTask(allTaskId.getAllTaskId()); } - @RequestMapping("/finish-task") - public R finishTask(Long taskId) { - return distributionSplitOrderTaskService.finishTask(taskId); + @PostMapping("/finish-task") + public R finishTask(@RequestBody TaskId taskId) { + return distributionSplitOrderTaskService.finishTask(taskId.getTaskId()); } - @RequestMapping("/get-task-detail") + @GetMapping("/get-task-detail") public R getTaskDetail(Long taskId) { return distributionSplitOrderTaskService.getTaskDetail(taskId); } - @RequestMapping("/task-list") + @GetMapping("/task-list") public R> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) { return distributionSplitOrderTaskService.taskList(query, distributionSplitTaskSearchDTO); } - @RequestMapping("/update-task") - public R updateTask(DistributionSplitOrderTaskEntity distributionSplitOrderTaskEntity) { + @PostMapping("/update-task") + public R updateTask(@RequestBody DistributionSplitOrderTaskEntity distributionSplitOrderTaskEntity) { return distributionSplitOrderTaskService.updateTask(distributionSplitOrderTaskEntity); } - @RequestMapping("/check-order-code") + /** + * 检查是否已经被拆单 + * @param orderCode + * @return + */ + @GetMapping("/check-order-code") public R checkOrderCode(String orderCode) { return distributionSplitOrderTaskService.checkOrderCode(orderCode); } - @RequestMapping("/get-package-code-by-order-code") + @GetMapping("/get-package-code-by-order-code") public R> getPackageCodeByOrderCode(Query query, String orderCode) { return distributionSplitOrderTaskService.getPackageCodeByOrderCode(query, orderCode); } - @RequestMapping("/get-package-code-by-task-id") + @GetMapping("/get-package-code-by-task-id") public R> getPackageCodeByTaskId(Long taskId) { return distributionSplitOrderTaskService.getPackageCodeByTaskId( taskId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddPackageCodeDTO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddPackageCodeDTO.java new file mode 100644 index 000000000..1b3387838 --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddPackageCodeDTO.java @@ -0,0 +1,14 @@ +package com.logpm.distribution.dto.splitOrder; + +import lombok.Data; + +import java.util.List; + +@Data +public class AddPackageCodeDTO { + + private Long taskId; + + private List packageCodes; +} + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddTaskDTO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddTaskDTO.java new file mode 100644 index 000000000..bbdf83d78 --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/AddTaskDTO.java @@ -0,0 +1,12 @@ +package com.logpm.distribution.dto.splitOrder; + +import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; +import lombok.Data; + +import java.util.List; + +@Data +public class AddTaskDTO { + private Long allTaskId; + private List task; +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/CancelPackageCodeDTO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/CancelPackageCodeDTO.java new file mode 100644 index 000000000..db9c75f1a --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/CancelPackageCodeDTO.java @@ -0,0 +1,7 @@ +package com.logpm.distribution.dto.splitOrder; + + +public class CancelPackageCodeDTO extends AddPackageCodeDTO{ + +} + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/TaskId.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/TaskId.java new file mode 100644 index 000000000..cf30b249a --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/splitOrder/TaskId.java @@ -0,0 +1,10 @@ +package com.logpm.distribution.dto.splitOrder; + +import lombok.Data; + +@Data +public class TaskId { + private Long taskId; + + private Long allTaskId; +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java index 483640402..f041664ac 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java @@ -26,6 +26,7 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.order.OrderSplitAllTaskStateConstant; import org.springblade.common.constant.order.OrderSplitStateConstant; +import org.springblade.common.constant.order.OrderStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageSplitStateConstant; import org.springblade.common.exception.CustomerException; @@ -80,6 +81,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl page = Condition.getPage(query); List list = list(page, queryWrapper); page.setRecords(list); @@ -113,7 +115,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl details = distributionSplitOrderDetailService.list( Wrappers.lambdaQuery() .eq(DistributionSplitOrderDetailEntity::getSplitOrderTaskId, taskId) + .eq(DistributionSplitOrderDetailEntity::getState, OrderPackageSplitStateConstant.finish.getValue()) ); List res = new ArrayList<>(); if (!details.isEmpty()){