|
@@ -22,8 +22,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
public class TbTbCouponUserServiceImpl extends ServiceImpl<TbCouponUserDao, TbCouponUser> implements TbCouponUserService {
|
|
public class TbTbCouponUserServiceImpl extends ServiceImpl<TbCouponUserDao, TbCouponUser> implements TbCouponUserService {
|
|
@@ -146,4 +148,26 @@ public class TbTbCouponUserServiceImpl extends ServiceImpl<TbCouponUserDao, TbCo
|
|
|
tbCouponUser.setShopId(0L);
|
|
tbCouponUser.setShopId(0L);
|
|
|
tbCouponUserDao.insert(tbCouponUser);
|
|
tbCouponUserDao.insert(tbCouponUser);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void batchAddAfterVipBuySuccess(Long userId, BigDecimal money, String expirationDays, String expirationTime, int count) {
|
|
|
|
|
+ List<TbCouponUser> couponList = new ArrayList<>();
|
|
|
|
|
+ for (int i = 0; i < count; i++) {
|
|
|
|
|
+ TbCouponUser tbCouponUser = new TbCouponUser();
|
|
|
|
|
+ tbCouponUser.setUserId(userId);
|
|
|
|
|
+ tbCouponUser.setCouponName("会员专属优惠券");
|
|
|
|
|
+ tbCouponUser.setCouponPicture("图片");
|
|
|
|
|
+ tbCouponUser.setCreateTime(VipExpirationUtil.formatCurrentTime());
|
|
|
|
|
+ tbCouponUser.setExpirationTime(expirationTime);
|
|
|
|
|
+ tbCouponUser.setMinMoney(BigDecimal.valueOf(0));
|
|
|
|
|
+ tbCouponUser.setGoodsType("0");
|
|
|
|
|
+ tbCouponUser.setMoney(money);
|
|
|
|
|
+ tbCouponUser.setStatus(0);
|
|
|
|
|
+ tbCouponUser.setEndTime(expirationDays);
|
|
|
|
|
+ tbCouponUser.setShopId(0L);
|
|
|
|
|
+ couponList.add(tbCouponUser);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 批量插入
|
|
|
|
|
+ this.saveBatch(couponList);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|