From b5ead35c1d955f2a0e2e10da79254860d0ba95e9 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 23 五月 2025 14:50:27 +0800
Subject: [PATCH] 大屏接口bug修改

---
 ruoyi-service/ruoyi-user/src/main/java/com/ruoyi/user/controller/OrderController.java |   70 ++++++++++++++++++++++++-----------
 1 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/ruoyi-service/ruoyi-user/src/main/java/com/ruoyi/user/controller/OrderController.java b/ruoyi-service/ruoyi-user/src/main/java/com/ruoyi/user/controller/OrderController.java
index 0334ea9..4acf1bf 100644
--- a/ruoyi-service/ruoyi-user/src/main/java/com/ruoyi/user/controller/OrderController.java
+++ b/ruoyi-service/ruoyi-user/src/main/java/com/ruoyi/user/controller/OrderController.java
@@ -22,17 +22,20 @@
 import com.ruoyi.user.service.OrderService;
 import com.ruoyi.user.service.RecoveryServePriceService;
 import com.ruoyi.user.service.RecoveryServeService;
+import com.ruoyi.user.service.UserService;
 import com.ruoyi.user.vo.OrderDetailVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.stream.Collectors;
 
@@ -86,6 +89,7 @@
             Map<Integer, String> map = serveList.stream().collect(Collectors.toMap(RecoveryServe::getId,
                     mw -> Optional.ofNullable(mw.getCover()).orElse("")));
             for (Order order : data.getRecords()) {
+
                 Integer serveId = order.getServeId();
                 order.setCover(map.get(serveId));
             }
@@ -101,21 +105,21 @@
     })
     public R<BigDecimal> estimate(@RequestParam String orderId, String city) {
         Order order = orderClient.detail(orderId).getData();
-        RecoveryServe recoveryServe = recoveryServeService.lambdaQuery()
-                .eq(RecoveryServe::getId, order.getServeId())
-                .eq(RecoveryServe::getIsDelete, 0).one();
-        BigDecimal money = recoveryServe.getDefaultPrice();
-        if (StringUtils.isNotBlank(city)) {
-            CityInfoVO info = GaoDeMapUtil.getAddressInfo(city).getDatas();
-            RecoveryServePrice price = recoveryServePriceService.lambdaQuery()
-                    .eq(RecoveryServePrice::getRecoveryServeId, recoveryServe.getId())
-                    .eq(RecoveryServePrice::getCityCode, info.getCode())
-                    .eq(RecoveryServePrice::getIsDelete, Constants.ZERO).one();
-            if (null != price) {
-                money = price.getRecoveryPrice();
-            }
-        }
-        return R.ok(money);
+//        RecoveryServe recoveryServe = recoveryServeService.lambdaQuery()
+//                .eq(RecoveryServe::getId, order.getServeId())
+//                .eq(RecoveryServe::getIsDelete, 0).one();
+//        BigDecimal money = recoveryServe.getDefaultPrice();
+//        if (StringUtils.isNotBlank(city)) {
+//            CityInfoVO info = GaoDeMapUtil.getAddressInfo(city).getDatas();
+//            RecoveryServePrice price = recoveryServePriceService.lambdaQuery()
+//                    .eq(RecoveryServePrice::getRecoveryServeId, recoveryServe.getId())
+//                    .eq(RecoveryServePrice::getCity, info.getCode())
+//                    .eq(RecoveryServePrice::getIsDelete, Constants.ZERO).one();
+//            if (null != price) {
+//                money = price.getRecoveryPrice();
+//            }
+//        }
+        return R.ok(order.getServePrice());
     }
 
     @GetMapping("/detail")
@@ -135,6 +139,8 @@
                 orderDetail.setPhoto(serveRecord.getPhoto());
             }
         }
+        R<String> workPic = adminClient.getWorkPic(order.getServerId());
+        orderDetail.setWorkPic(workPic.getMsg());
         return R.ok(orderDetail);
     }
 
@@ -145,8 +151,8 @@
      */
     @GetMapping("/prizeList")
     @ApiOperation(value = "获取奖品列表", tags = {"用户端-订单"})
-    public R<List<Prize>> prizeList() {
-        return R.ok(adminClient.prizeList().getData());
+    public R<List<Prize>> prizeList(@RequestParam("serveId") String serveId) {
+        return R.ok(adminClient.prizeList(Integer.valueOf(serveId)).getData());
     }
 
     /**
@@ -156,8 +162,8 @@
      */
     @GetMapping("/allowance")
     @ApiOperation(value = "抽奖获取津贴", tags = {"用户端-订单"})
-    public R<Object> obtainAllowance() {
-        return R.ok(orderService.obtainAllowance(adminClient.prizeList().getData()));
+    public R<Object> obtainAllowance(@RequestParam("serveId") String serveId) {
+        return R.ok(orderService.obtainAllowance(adminClient.prizeList(Integer.valueOf(serveId)).getData()));
     }
 
     /**
@@ -167,14 +173,18 @@
      */
     @GetMapping("/allowanceMoney")
     @ApiOperation(value = "补充订单津贴金额", tags = {"用户端-订单"})
-    public R<Object> allowanceMoney(@RequestParam("orderId") String orderId, @RequestParam("prizeId") String prizeId) {
+    public R<Object> allowanceMoney(@RequestParam("orderId") String orderId,
+                                    @RequestParam("prizeId") String prizeId,
+                                    @RequestParam("serveId") String serveId) {
         Prize data = adminClient.prizeDetail(prizeId).getData();
         if (null == data) {
             return R.fail(adminClient.prizeDetail(prizeId).getMsg());
         }
         String prizeMoney;
-        if (data.getPrizeName().contains(Constants.SUBSIDY_MONEY)) {
-            prizeMoney = data.getPrizeName().substring(Constants.ONE);
+        if (data.getPrizeType() == 1) {
+            // 查询服务回收补贴金
+            RecoveryServe recoveryServe = recoveryServeService.getById(serveId);
+            prizeMoney = recoveryServe.getRecycleSubsidy().toString();
         } else {
             prizeMoney = "0";
         }
@@ -203,4 +213,20 @@
         return result ? R.ok() : R.fail();
     }
 
+    /**
+     * 领取补贴金
+     *
+     */
+    @GetMapping("/receivingSubsidies")
+    @ApiOperation(value = "领取补贴金", tags = {"用户端-订单-领取补贴金[2.0]"})
+    public R<Object> receivingSubsidies(@RequestParam("serveId") String serveId,@RequestParam("orderId") String orderId) {
+        // 查询补贴金
+        RecoveryServe recoveryServe = recoveryServeService.getById(serveId);
+        if (Objects.isNull(recoveryServe)) {
+            return R.fail("该服务不存在!");
+        }
+        orderClient.receiving(orderId,recoveryServe.getRecycleSubsidy());
+        return R.ok();
+    }
+
 }

--
Gitblit v1.7.1