修改礼品卡新增数量判空

This commit is contained in:
齐天大圣 2023-11-01 14:07:27 +08:00
parent 245b425a9e
commit cd9f03a59c

View File

@ -45,6 +45,7 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
cardGift.setBatchNumber(dateFormat.format(new Date()) + String.format("%05d", new Random().nextInt(100000)));
//生成数量
if (ObjectUtils.isNotEmpty(cardGift.getQuantity())) {
for (int i = 0; i < cardGift.getQuantity(); i++) {
//礼品卡编号
cardGift.setNumber(String.format("%08d", new Random().nextInt(100000000)));
@ -52,6 +53,7 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
cardGift.setCardPassword(String.format("%09d", new Random().nextInt(1000000000)) + "-LjZhYz");
save = save(cardGift);
}
}
return save;
}