From 242725f795b4cca830421c07f714a3ec36af0add Mon Sep 17 00:00:00 2001
From: hjl <1657978663@qq.com>
Date: 星期二, 02 七月 2024 13:59:39 +0800
Subject: [PATCH] feat: 代码初始化、腾讯云短信SDK

---
 ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/ChangeDispatchController.java |   43 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/ChangeDispatchController.java b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/ChangeDispatchController.java
index 40b74a0..be6ad9f 100644
--- a/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/ChangeDispatchController.java
+++ b/ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/ChangeDispatchController.java
@@ -20,10 +20,7 @@
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.Arrays;
@@ -80,6 +77,17 @@
     /**
      * 订单改派详情
      *
+     * @param changeDispatch 订单改派信息
+     */
+    @ApiOperation(value = "新增订单改派", tags = {"后台-系统设置-订单改派管理"})
+    @PostMapping(value = "/save")
+    public R<Boolean> save(@RequestBody ChangeDispatch changeDispatch) {
+        return R.ok(changeDispatchService.save(changeDispatch));
+    }
+
+    /**
+     * 订单改派详情
+     *
      * @param id 订单改派id
      */
     @RequiresPermissions("reassignment_apply")
@@ -90,6 +98,23 @@
     })
     public R<ChangeDispatch> detail(@RequestParam Integer id) {
         return R.ok(changeDispatchService.getById(id));
+    }
+
+    /**
+     * 订单改派详情 远程调用
+     *
+     * @param id 订单id
+     */
+    @GetMapping(value = "/one")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "订单改派id", name = "id", dataType = "Integer", required = true)
+    })
+    public R<ChangeDispatch> one(@RequestParam("id") Integer id) {
+        ChangeDispatch changeDispatch = changeDispatchService.lambdaQuery()
+                .eq(ChangeDispatch::getOrderId, id)
+                .eq(ChangeDispatch::getState, Constants.ZERO)
+                .one();
+        return R.ok(changeDispatch);
     }
 
     /**
@@ -113,7 +138,7 @@
     /**
      * 订单改派师傅
      *
-     * @param orderId  订单id
+     * @param changeId 改派订单id
      * @param workerId 师傅id
      */
     @RequiresPermissions("reassignment_apply")
@@ -121,16 +146,16 @@
     @GetMapping(value = "/changeWorker")
     @ApiImplicitParams({
             @ApiImplicitParam(value = "改派订单id", name = "changeId", dataType = "Integer", required = true),
-            @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "Integer", required = true),
             @ApiImplicitParam(value = "师傅id", name = "workerId", dataType = "Integer", required = true)
     })
-    public R<String> changeWorker(@RequestParam Integer changeId, @RequestParam Integer orderId, @RequestParam Integer workerId) {
+    public R<String> changeWorker(@RequestParam Integer changeId, @RequestParam Integer workerId) {
         ChangeDispatch changeDispatch = changeDispatchService.lambdaQuery().eq(ChangeDispatch::getId, changeId)
                 .eq(ChangeDispatch::getIsDelete, 0).one();
         if (null == changeDispatch || Constants.ONE.equals(changeDispatch.getState())) {
             throw new GlobalException("改派申请不存在或已改派!");
         }
-        Order order = orderService.lambdaQuery().eq(Order::getId, orderId).eq(Order::getIsDelete, 0).one();
+        Order order = orderService.lambdaQuery().eq(Order::getId, changeDispatch.getOrderId())
+                .eq(Order::getIsDelete, 0).one();
         if (null == order) {
             throw new GlobalException("订单不存在!");
         }
@@ -144,7 +169,7 @@
         if (null == masterWorker) {
             throw new GlobalException("服务人员信息异常!");
         }
-        // 原订单状态改为 6:已改派
+        // 原订单状态改为 5:已改派
         order.setState(Constants.FIVE);
         boolean orderUpdate = orderService.updateById(order);
         // 生成新订单信息

--
Gitblit v1.7.1