From caa2b51bb4133f5a2e59eac242e744fb57f864a0 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 10 九月 2024 13:01:44 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java
index 1f3fdde..a2eefca 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java
@@ -54,7 +54,16 @@
     @Autowired
     private AppCouponClient appCouponClient;
 
-
+    /**
+     * 远程调用 根据名称 查询优惠券ids
+     * @return
+     */
+    @PostMapping("/getCouponIdsByName/{name}")
+    public R<List<Integer>> getCouponIdsByName(@PathVariable("name")String name) {
+        List<Integer> collect = tCouponService.list(new QueryWrapper<TCoupon>()
+                .eq("name", name)).stream().map(TCoupon::getId).collect(Collectors.toList());
+        return R.ok(collect);
+    }
     @PostMapping("/saveGoods")
     @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券添加")
     public AjaxResult saveActivity(@RequestBody TCoupon dto) {
@@ -120,7 +129,7 @@
     @Autowired
     private IRegionService regionService;
     @ApiOperation(tags = {"管理后台-优惠券管理"},value = "发放优惠券")
-    @GetMapping(value = "/grantCoupon")
+    @PostMapping(value = "/grantCoupon")
     public AjaxResult grantCoupon(@RequestBody GrantCouponDto dto) {
         TCoupon byId = tCouponService.getById(dto.getCouponId());
         Integer waysToObtain = byId.getWaysToObtain();
@@ -188,5 +197,22 @@
         return R.ok(coupon);
     }
 
+    @PostMapping(value = "/getCouponById")
+    public R<TCoupon> getCouponById(@RequestParam("id") Integer id){
+        TCoupon coupon = tCouponService.getById(id);
+        return R.ok(coupon);
+    }
+    
+    
+    /**
+     * 修改优惠券
+     * @param coupon
+     * @return
+     */
+    @PostMapping(value = "/updateCoupon")
+    public R updateCoupon(@RequestBody TCoupon coupon){
+        tCouponService.updateById(coupon);
+        return R.ok();
+    }
 }
 

--
Gitblit v1.7.1