From fd9ee9caa17d4d722532f6536d53ce40254fa722 Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期一, 09 十二月 2024 18:02:02 +0800
Subject: [PATCH] 1.

---
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java                      |    3 +
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java       |   12 +++++-
 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml                     |    3 +
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java    |    4 +-
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java             |    2 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java             |    2 -
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java    |    1 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java              |    3 +
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java         |   11 ++++-
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java      |    6 +-
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java |   10 ++++-
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java               |    2 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java        |    3 +
 13 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java
index 4157b44..f3a4662 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java
@@ -80,4 +80,7 @@
     @ApiModelProperty(value = "门店id")
     private Integer shopId;
 
+    @ApiModelProperty(value = "技师名称")
+    private String technicianName;
+
 }
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java
index 4aeac0a..bb331c4 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java
@@ -87,5 +87,8 @@
     @TableField(exist = false)
     private String goodsImg;
 
+    @TableField(exist = false)
+    private String idStr;
+
 
 }
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java
index f926ef7..e0574ab 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java
@@ -74,6 +74,9 @@
     @TableField(exist = false)
     private Long orderId;
 
+    @TableField(exist = false)
+    private String idStr;
+
 
 
 }
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java
index 686b418..bcec36a 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java
@@ -5,15 +5,15 @@
 import com.ruoyi.other.api.domain.Technician;
 import com.ruoyi.other.api.factory.TechnicianClientFallbackFactory;
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
 @FeignClient(contextId = "TechnicianClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = TechnicianClientFallbackFactory.class)
 public interface TechnicianClient {
 
-    @PostMapping("/technician/shop/detail")
-    R<Technician> shopdetail(@RequestParam("techId") Integer techId);
+    @GetMapping("/technician/getById")
+    R<Technician> shopdetail(@RequestParam("id") Integer techId);
 
     @PutMapping("/technician-subscribe/updateStatus")
     R<Void> updateStatus(@RequestParam("status") Integer status, @RequestParam("subscribeId") Integer subscribeId);
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
index 70e238b..e70dea6 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -22,7 +22,6 @@
 import com.ruoyi.order.vo.OrderGoodsVO;
 import com.ruoyi.order.vo.OrderVO;
 import com.ruoyi.other.api.domain.*;
-import com.ruoyi.other.api.feignClient.GoodsClient;
 import com.ruoyi.other.api.feignClient.ShopClient;
 import com.ruoyi.other.api.feignClient.TechnicianClient;
 import com.ruoyi.system.api.model.LoginUser;
@@ -128,9 +127,14 @@
             orderDetailVO.setDistributionMode(goods.getDistributionMode());
         }
 
+        R<Technician> shopdetail = technicianClient.shopdetail(order.getTechnicianId());
+        if (shopdetail.getCode() != R.SUCCESS){
+            throw new ServiceException("获取技师信息失败");
+        }
+        Technician technician = shopdetail.getData();
+
+
         Shop shop = shopR.getData();
-
-
         orderDetailVO.setId(order.getId());
         orderDetailVO.setOrderStatus(order.getOrderStatus());
         orderDetailVO.setPoint(order.getPoint());
@@ -153,6 +157,7 @@
         orderDetailVO.setLongitude(shop.getLongitude());
         orderDetailVO.setLatitude(shop.getLatitude());
         orderDetailVO.setShopId(shop.getId());
+        orderDetailVO.setTechnicianName(technician.getName());
         return orderDetailVO;
     }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
index 273c58b..fb99589 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -44,6 +44,7 @@
             AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
             goodsEvaluate.setUserName(appUserById.getName());
             goodsEvaluate.setAvatar(appUserById.getAvatar());
+            goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId()));
         }
         return R.ok(list);
     }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
index f846e47..39cf8ce 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -6,12 +6,10 @@
 import com.ruoyi.account.api.model.AppUser;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.web.controller.BaseController;
-import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.other.api.domain.Shop;
 import com.ruoyi.other.api.domain.ShopScore;
-import com.ruoyi.other.api.domain.Technician;
 import com.ruoyi.other.enums.ShopStatus;
 import com.ruoyi.other.service.ShopScoreService;
 import com.ruoyi.other.service.ShopService;
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
index f35126a..17f892f 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -6,6 +6,7 @@
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.other.api.domain.Technician;
 import com.ruoyi.other.api.domain.TechnicianScore;
 import com.ruoyi.other.service.TechnicianScoreService;
 import com.ruoyi.other.service.TechnicianService;
@@ -99,9 +100,16 @@
      */
     @GetMapping("/technicianListByShopId")
     @ApiOperation(value = "技师列表", tags = {"技师列表-小程序"})
-    public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId) {
+    public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId,@ApiParam("技师姓名") String name) {
         startPage();
-        return R.ok(getDataTable(technicianService.getTechnicianListByShopId(shopId)));
+        return R.ok(getDataTable(technicianService.getTechnicianListByShopId(shopId,name)));
+    }
+
+    @GetMapping("/getById")
+    @ApiOperation(value = "技师详情", tags = {"技师详情-小程序"})
+    public R<Technician> getById(@RequestParam("id") Integer id){
+        Technician byId = technicianService.getById(id);
+        return R.ok(byId);
     }
 
     /**
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java
index c3b24f7..1ca3e83 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java
@@ -17,7 +17,7 @@
  */
 public interface TechnicianMapper extends BaseMapper<Technician> {
 
-    List<TechnicianVO> selectTechnicianListByShopId(Long shopId);
+    List<TechnicianVO> selectTechnicianListByShopId(Long shopId, String name);
 
     TechnicianDetailVO selectTechnicianDetail(Long technicianId);
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java
index 7be2cbc..9e245e6 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java
@@ -16,7 +16,7 @@
  * @since 2024-11-20
  */
 public interface TechnicianService extends IService<Technician> {
-    List<TechnicianVO> getTechnicianListByShopId(Long shopId);
+    List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name);
 
     TechnicianDetailVO technicianDetail(Long technicianId);
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java
index d7f8633..1a2de9a 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java
@@ -3,6 +3,7 @@
 import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
 import com.ruoyi.order.model.Order;
 import com.ruoyi.other.mapper.GoodsEvaluateMapper;
@@ -29,13 +30,18 @@
     private RemoteOrderGoodsClient remoteOrderGoodsClient;
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public void addGoodsEvaluate(GoodsEvaluateVO goodsEvaluateVO) {
         List<GoodsEvaluate> evaluates = goodsEvaluateVO.getEvaluates();
         for (GoodsEvaluate goodsEvaluate : evaluates) {
             goodsEvaluate.setStatus(2);
+            if (StringUtils.isNotEmpty(goodsEvaluate.getIdStr())){
+                goodsEvaluate.setId(Long.valueOf(goodsEvaluate.getIdStr()));
+                saveOrUpdate(goodsEvaluate);
+            }else {
+                save(goodsEvaluate);
+            }
         }
-        this.saveOrUpdateBatch(evaluates);
         if (CollectionUtil.isNotEmpty(evaluates)){
             Order order = new Order();
             order.setId(goodsEvaluateVO.getEvaluates().get(0).getOrderId());
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java
index 26d1b4a..049adcb 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java
@@ -39,8 +39,8 @@
     private TechnicianScoreService technicianScoreService;
 
     @Override
-    public List<TechnicianVO> getTechnicianListByShopId(Long shopId) {
-        return technicianMapper.selectTechnicianListByShopId(shopId);
+    public List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name) {
+        return technicianMapper.selectTechnicianListByShopId(shopId,name);
     }
 
     @Override
diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
index e63668b..8ac6d57 100644
--- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
+++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
@@ -17,6 +17,9 @@
           tt.`status` = 2
           AND tt.del_flag = 0
           AND tt.shop_id = #{shopId}
+        <if test="name != null and name != ''">
+            AND tt.`name` LIKE concat('%', #{name}, '%')
+        </if>
         GROUP BY
             tt.id,
             tt.`name`,

--
Gitblit v1.7.1