From 616f788090c83156ac5cc0d4cd38b9de344ee3b7 Mon Sep 17 00:00:00 2001
From: lisy <linlangsur163@163.com>
Date: 星期五, 18 八月 2023 10:18:29 +0800
Subject: [PATCH] 管理后台:完善核销功能

---
 cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
index b176c57..e6b0397 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -474,7 +474,10 @@
 
     @PostMapping("/base/pointMerchars/updateDetailsUserPointMercase")
     public void updateDetailsUserPointMercase(@RequestBody UserPointsMerchandise merchandise){
-        upmseService.updateById(merchandise);
+        upmseService.update(merchandise,new LambdaQueryWrapper<UserPointsMerchandise>()
+                .eq(UserPointsMerchandise::getUserId,merchandise.getUserId())
+                .eq(UserPointsMerchandise::getId,merchandise.getId()));
+
     }
 
     @PostMapping("/base/pointMerchars/queryUserPointMerchaseByCode")
@@ -524,7 +527,9 @@
         if (list.size() > 0 ){
             for (UserPointsMerchandise pointsMerchandise : list) {
                 pointsMerchandise.setState(2);
-                upmseService.updateById(pointsMerchandise);
+                upmseService.update(pointsMerchandise,new LambdaQueryWrapper<UserPointsMerchandise>()
+                        .eq(UserPointsMerchandise::getUserId,pointsMerchandise.getUserId())
+                        .eq(UserPointsMerchandise::getId,pointsMerchandise.getId()));
             }
         }
 
@@ -669,7 +674,7 @@
         if (list.size() > 0 ){
             for (UserPointsMerchandise pointsMerchandise : list) {
                 Map<String, Object> map = new HashMap<>();
-                map.put("id",pointsMerchandise.getId());
+                map.put("id",pointsMerchandise.getId().toString());
                 map.put("userId",pointsMerchandise.getUserId());
                 map.put("status", pointsMerchandise.getStatus());
                 mapList.add(map);
@@ -679,4 +684,28 @@
         return mapList;
     }
 
+    @ResponseBody
+    @PostMapping("/base/pointMerchars/writeOffGoodsStatus")
+    public boolean writeOffGoodsStatus(@RequestBody Map<String, Object> map){
+        try {
+            String o = (String) map.get("goodsId");
+            Integer managerId = (Integer) map.get("managerId");
+            UserPointsMerchandise byId = upmseService.getOne(new LambdaQueryWrapper<UserPointsMerchandise>()
+                    .eq(UserPointsMerchandise::getId,Long.parseLong(o) ));
+            if (byId.getStatus() == 2){
+                return false;
+            }
+            byId.setStatus(2);
+            byId.setVerificationUserId(managerId);
+            byId.setVerificationTime(new Date());
+            upmseService.update(byId,new LambdaQueryWrapper<UserPointsMerchandise>()
+                    .eq(UserPointsMerchandise::getUserId,byId.getUserId())
+                    .eq(UserPointsMerchandise::getId,byId.getId()));
+            System.out.println(byId);
+            return true;
+        }catch (Exception e){
+            return false;
+        }
+    }
+
 }

--
Gitblit v1.7.1