From a981c07d34edd0975b9d556d97c1f851ce79974c Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期三, 04 十二月 2024 13:40:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java |   54 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
index 6aa2f8b..f28c7ca 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
@@ -2,6 +2,7 @@
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.page.TableDataInfo;
@@ -12,17 +13,14 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-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.List;
 
 /**
  * <p>
- *  前端控制器
+ * 前端控制器
  * </p>
  *
  * @author luodangjia
@@ -41,11 +39,21 @@
     @GetMapping("/list")
     @ApiOperation(value = "预约列表", notes = "预约列表", tags = {"小程序-个人中心-门店管理-预约列表"})
     public TableDataInfo list(@ApiParam(value = "状态") @RequestParam Integer status,
-                              @ApiParam(value = "门店id") @RequestParam Long shopId){
+                              @ApiParam(value = "门店id") @RequestParam Long shopId) {
         startPage();
         List<TechnicianSubscribeVO> list = technicianSubscribeService
-                .getTechnicianSubscribeByUserAndShop(SecurityUtils.getUserId(),shopId);
+                .getTechnicianSubscribeByUserAndShop(SecurityUtils.getUserId(), shopId);
         return getDataTable(list);
+    }
+
+    /**
+     * 预约技师
+     */
+    @PostMapping("/subscribe")
+    @ApiOperation(value = "预约技师", notes = "预约技师", tags = {"小程序-个人中心-门店管理-预约列表-预约技师"})
+    public R<Void> subscribe(@RequestBody TechnicianSubscribe technicianSubscribe) {
+        technicianSubscribeService.subscribe(technicianSubscribe, technicianSubscribe.getTechnicianId());
+        return R.ok();
     }
 
     /**
@@ -53,12 +61,12 @@
      */
     @GetMapping("/cancel")
     @ApiOperation(value = "取消服务", notes = "取消服务", tags = {"小程序-个人中心-门店管理-预约列表-取消服务"})
-    public R<Void> cancel(@ApiParam(value = "预约id") @RequestParam Long id){
+    public R<Void> cancel(@ApiParam(value = "预约id") @RequestParam Long id) {
 
         TechnicianSubscribe subscribe = technicianSubscribeService.getOne(new LambdaQueryWrapper<TechnicianSubscribe>()
                 .eq(TechnicianSubscribe::getId, id)
                 .eq(TechnicianSubscribe::getStatus, 0));
-        if (null == subscribe){
+        if (null == subscribe) {
             return R.fail("不满足取消条件");
         }
         subscribe.setStatus(2);
@@ -66,5 +74,33 @@
         return R.ok();
     }
 
+    /**
+     * 更新技师预约状态
+     *
+     * @param status
+     */
+    @PutMapping("/updateStatus")
+    @ApiOperation(value = "更新技师预约状态", notes = "更新技师预约状态", tags = {"后台-技师预约管理-更新技师预约状态"})
+    public R<Void> updateStatus(@ApiParam @RequestParam Integer status, @ApiParam @RequestParam Long subscribeId) {
+        boolean update = technicianSubscribeService.update(new LambdaUpdateWrapper<TechnicianSubscribe>()
+                .eq(TechnicianSubscribe::getId, subscribeId)
+                .set(TechnicianSubscribe::getStatus, status));
+        if (!update) {
+            return R.fail("更新失败");
+        }
+        return R.ok();
+    }
+
+
+    @GetMapping("/home/list")
+    @ApiOperation(value = "列表", notes = "列表", tags = {"小程序-个人中心-我的预约"})
+    public TableDataInfo homelist(@ApiParam(value = "状态 0=待服务,1=已服务,2=已取消 4 已到期") @RequestParam Integer status) {
+        startPage();
+        List<TechnicianSubscribeVO> list = technicianSubscribeService
+                .getTechnicianSubscribeByUser(SecurityUtils.getUserId(), status);
+        return getDataTable(list);
+    }
+
+
 }
 

--
Gitblit v1.7.1