From f7042f313660010345f199d62afb6e3aeb8b5194 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 12 九月 2024 17:56:12 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
---
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java
index c38b1d6..1894f70 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java
@@ -48,19 +48,19 @@
public void giveVipCoupun(Long appUserId, Integer vipId,Long recordId,Integer monthNum) {
//如果不包含,则更新sendNum,并且赠送优惠卷
TAppUserVipDetail byId = tAppUserVipDetailService.getById(recordId);
- if (byId.getStartTime().toLocalDate().plusMonths(byId.getSendMonth()).compareTo(LocalDate.now())==0&&LocalDate.now().isBefore(byId.getEndTime().toLocalDate())){
+ if (byId.getStartTime().plusMonths(byId.getSendMonth()).toLocalDate().compareTo(LocalDate.now())==0&&LocalDate.now().isBefore(byId.getEndTime().toLocalDate())){
byId.setSendMonth(byId.getSendMonth()+1);
//给这个用户发放对应vip的优惠卷以及充电次数加满
-
- if (byId.getCouponIds()!=null) {
- String[] sendList = byId.getCouponIds().split(",");
- for (String sendCouponDto : sendList) {
- R<TCoupon> couponById = otherClient.getCouponById(Integer.valueOf(sendCouponDto));
+ List<SendCouponDto> javaList = JSON.parseArray(byId.getCouponIds()).toJavaList(SendCouponDto.class);
+ for (SendCouponDto sendCouponDto : javaList) {
+ Integer number = sendCouponDto.getNumber();
+ for (Integer i = 0; i < number; i++) {
+ R<TCoupon> couponById = otherClient.getCouponById(sendCouponDto.getId());
TCoupon coupon = couponById.getData();
//将该优惠卷添加到用户优惠卷中
TAppCoupon tAppCoupon = new TAppCoupon();
tAppCoupon.setAppUserId(appUserId);
- tAppCoupon.setCouponId(Integer.valueOf(sendCouponDto));
+ tAppCoupon.setCouponId(sendCouponDto.getId());
if (coupon.getValidityPeriodMode() == 1) {
tAppCoupon.setEndTime(coupon.getEndTime());
} else {
@@ -71,9 +71,11 @@
tAppCoupon.setCouponJson(JSON.toJSONString(coupon));
appCouponService.save(tAppCoupon);
}
+ }
+
}
byId.setChargeNum(byId.getSendChargeNum());
tAppUserVipDetailService.updateById(byId);
}
- }
+
}
--
Gitblit v1.7.1