From 87d3a050867e17b0dd9b47263d59c496622e860a Mon Sep 17 00:00:00 2001
From: lisy <linlangsur163@163.com>
Date: 星期五, 18 八月 2023 15:52:27 +0800
Subject: [PATCH] 管理后台:积分商品的编辑模块

---
 cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java |   71 ++++++++++++++++++++++++++++++++++-
 1 files changed, 68 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..faff332 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()));
             }
         }
 
@@ -624,10 +629,13 @@
     public PointMercharsVo queryPointMerchaseDetailOfId(@RequestBody Integer pointMercharsId){
         PointMercharsVo vo = new PointMercharsVo();
         PointsMerchandise byId = pmdsService.getById(pointMercharsId);
+        List<UserPointsMerchandise> list = upmseService.list(new LambdaQueryWrapper<UserPointsMerchandise>()
+                .eq(UserPointsMerchandise::getPointsMerchandiseId, pointMercharsId));
         if (ToolUtil.isNotEmpty(byId)){
             vo.setName(byId.getName());
             vo.setCover(byId.getCover());
             vo.setPics(byId.getProductImages());
+            vo.setQuantityHas(list.size());
             vo.setQuantityIssued(byId.getQuantityIssued());
             vo.setPickUpQuantity(byId.getPickUpQuantity());
             vo.setSort(byId.getSort());
@@ -669,7 +677,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 +687,61 @@
         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;
+        }
+    }
+
+
+
+    @ResponseBody
+    @PostMapping("/base/pointMerchars/updateGoodsDetail")
+    public boolean updateGoodsDetail(@RequestBody Map<String, Object> map){
+        try {
+            Integer pointMerchandiseId = (Integer) map.get("pointMerchandiseId");
+            PointsMerchandise byId1 = pmdsService.getById(pointMerchandiseId);
+
+            Integer quantityIssued = (Integer) map.get("quantityIssued");
+            Integer pickUpQuantity = (Integer) map.get("pickUpQuantity");
+            String redemptionInstructions = (String) map.get("redemptionInstructions");
+            String cover = (String) map.get("cover");
+            String productImages = (String) map.get("productImages");
+            Integer sort = (Integer) map.get("sort");
+
+            byId1.setQuantityIssued(quantityIssued);
+            byId1.setPickUpQuantity(pickUpQuantity);
+            byId1.setRedemptionInstructions(redemptionInstructions);
+            if (ToolUtil.isNotEmpty(cover)){
+                byId1.setCover(cover);
+            }
+            if (ToolUtil.isNotEmpty(productImages)){
+                byId1.setProductImages(productImages);
+            }
+            byId1.setSort(sort);
+            pmdsService.updateById(byId1);
+            return true;
+        }catch (Exception e){
+            return false;
+        }
+    }
+
 }

--
Gitblit v1.7.1