mitao
2025-11-04 270a3c0208001e2db9577cb6d7d4fd7ec646dfd8
cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
@@ -125,7 +125,10 @@
                .le(StringUtils.hasLength(vipDetailDto.getUseEndTime()), VipDetail::getUseTime, vipDetailDto.getUseEndTime())
                .eq(vipDetailDto.getOperatorId() != null, VipDetail::getOperatorId, vipDetailDto.getOperatorId())
                .eq(vipDetailDto.getType() != null, VipDetail::getType, vipDetailDto.getType())
                .eq(vipDetailDto.getStatus() != null, VipDetail::getStatus, vipDetailDto.getStatus()).list();
                .eq(vipDetailDto.getStatus() != null, VipDetail::getStatus, vipDetailDto.getStatus())
                .orderByDesc(VipDetail::getInsertTime)
                .list();
        // 使用 Stream + 手动拷贝提升性能和可读性(或使用 MapStruct)
        vipDetailVOS = list.stream().map(vipDetail -> {
@@ -751,8 +754,19 @@
                        coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints()));
                        break;
                    case 2:
                        coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints()));
                        coupon.setCash(dataVo.getRequiredCash());
                        if (dataVo.getRequiredCash() != null){
                            coupon.setCash(dataVo.getRequiredCash());
                        }else{
                            coupon.setCash(BigDecimal.ZERO);
                        }
                        if (dataVo.getRequiredPoints() != null){
                            coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints()));
                        }else{
                            coupon.setIntegral(BigDecimal.ZERO);
                        }
                        break;
                    case 3:
                        coupon.setCash(dataVo.getRequiredCash());
@@ -952,6 +966,26 @@
            VipDetail vipDetailServiceById = vipDetailService.getById(userCoupon.getVipDetailId());
            vipDetailServiceById.setUseTime(new Date());
            vipDetailServiceById.setStatus(2);
            vipDetailServiceById.setOperatorId(0);
            vipDetailService.updateById(vipDetailServiceById);
        }
    }
    @GetMapping("/base/coupon/updateTypeOther/{id}/{operatorId}/{storeId}/{siteId}")
    void updateTypeOther(@PathVariable("id")Long id,@PathVariable("operatorId")Integer operatorId,
                         @PathVariable("storeId")Integer storeId,@PathVariable("siteId")Integer siteId){
        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);
            vipDetailServiceById.setOperatorId(operatorId);
            vipDetailServiceById.setUseStoreId(storeId);
            if (siteId!=0){
                vipDetailServiceById.setUseSiteId(siteId);
            }
            vipDetailService.updateById(vipDetailServiceById);
        }
    }