From fb6eee80334ae23a2eca8c37baeef05e86c919ed Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 10 十二月 2024 17:09:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java
index a18d4f0..2067116 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java
@@ -3,6 +3,7 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
 import com.ruoyi.other.api.domain.TechnicianSubscribe;
@@ -32,8 +33,8 @@
     private RemoteOrderGoodsClient orderGoodsClient;
 
     @Override
-    public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId) {
-        return technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(userId, shopId);
+    public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long shopId, Integer status) {
+        return technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(shopId,status);
     }
     @Override
     public IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status) {
@@ -42,16 +43,19 @@
 
     @Override
     public void subscribe(TechnicianSubscribe subscribe) {
-        // 创建技师预约单
-        Long userId = SecurityUtils.getUserId();
-        subscribe.setAppUserId(userId);
-        subscribe.setStatus(TechnicianStatus.UNSUBSCRIBE.getCode());
-        subscribe.setDelFlag(0);
-        subscribe.setCreateTime(LocalDateTime.now());
-        technicianSubscribeMapper.insert(subscribe);
-
+        if (StringUtils.isNotEmpty(subscribe.getIdStr())){
+            subscribe.setId(Long.parseLong(subscribe.getIdStr()));
+            technicianSubscribeMapper.updateById(subscribe);
+        }else {
+            Long userId = SecurityUtils.getUserId();
+            subscribe.setAppUserId(userId);
+            subscribe.setStatus(TechnicianStatus.UNSUBSCRIBE.getCode());
+            subscribe.setDelFlag(0);
+            subscribe.setCreateTime(LocalDateTime.now());
+            technicianSubscribeMapper.insert(subscribe);
+        }
         if (subscribe.getTechnicianId() != null){
-            orderGoodsClient.subscribe(subscribe.getOrderId(), Math.toIntExact(subscribe.getId()));
+            orderGoodsClient.subscribe(subscribe.getOrderId(), subscribe.getTechnicianId());
         }
 
     }

--
Gitblit v1.7.1