|
@@ -101,6 +101,7 @@ public class GameGiftPackCodeServiceImpl extends ServiceImpl<GameGiftPackCodeMap
|
|
|
List<String> existCodeList = super.list(new LambdaQueryWrapper<GameGiftPackCode>()
|
|
|
.select(GameGiftPackCode::getCode)
|
|
|
.eq(GameGiftPackCode::getLinkId, param.getLinkId())
|
|
|
+ .eq(GameGiftPackCode::getEnabled, Boolean.TRUE)
|
|
|
.eq(GameGiftPackCode::getGameId, param.getGameId())
|
|
|
.in(GameGiftPackCode::getCode, param.getCodeList())
|
|
|
).stream().map(GameGiftPackCode::getCode).collect(Collectors.toList());
|
|
@@ -109,6 +110,7 @@ public class GameGiftPackCodeServiceImpl extends ServiceImpl<GameGiftPackCodeMap
|
|
|
.filter(code -> !existCodeList.contains(code))
|
|
|
.map(code -> this.transform(param, code))
|
|
|
.collect(Collectors.toList());
|
|
|
+ assert CollectionUtils.isNotEmpty(saveList) : "参数错误, 礼包码已存在, 禁止重复添加";
|
|
|
//保存返回
|
|
|
super.saveBatch(saveList);
|
|
|
//将礼包码主键添加到缓存
|
|
@@ -139,6 +141,8 @@ public class GameGiftPackCodeServiceImpl extends ServiceImpl<GameGiftPackCodeMap
|
|
|
.filter(id -> redisUtil.isMemberInSet(giftPackCodeKey, String.valueOf(id)))
|
|
|
.map(Object::toString)
|
|
|
.toArray(String[]::new);
|
|
|
+ //不存在缓存队列中, 不可以删除
|
|
|
+ assert giftPackCodeIdArray.length != 0 : "缓存队列中不存在可删除的礼包码";
|
|
|
//先从缓存中移除
|
|
|
redisUtil.removeOfSet(giftPackCodeKey, giftPackCodeIdArray);
|
|
|
List<Long> giftPackCodeIdList = Arrays.stream(giftPackCodeIdArray).map(Long::parseLong).collect(Collectors.toList());
|