| | |
| | | // 使用 Stream + 手动拷贝提升性能和可读性(或使用 MapStruct) |
| | | vipDetailVOS = list.stream().map(vipDetail -> { |
| | | VipDetailVO vo = new VipDetailVO(); |
| | | BeanUtils.copyProperties(vo, vipDetail); // 注意参数顺序是否正确 |
| | | BeanUtils.copyProperties(vipDetail, vo); // 注意参数顺序是否正确 |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | List<Coupon> coupons = couponService.list(); |
| | |
| | | @PostMapping("/base/coupon/updateType") |
| | | public void updateType(@RequestBody Long id) { |
| | | couponService.updateType(id); |
| | | UserCoupon userCoupon = userCouponService.getById(id); |
| | | if (userCoupon.getIsVipGrant()!=null&& userCoupon.getIsVipGrant()==1){ |
| | | VipDetail vipDetailServiceById = vipDetailService.getById(userCoupon.getVipDetailId()); |
| | | vipDetailServiceById.setUseTime(new Date()); |
| | | vipDetailServiceById.setStatus(2); |
| | | } |
| | | |
| | | } |
| | | } |