lisy
2023-08-18 616f788090c83156ac5cc0d4cd38b9de344ee3b7
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;
        }
    }
}