|
@@ -10,16 +10,20 @@ import com.zanxiang.erp.base.ErpServer;
|
|
|
import com.zanxiang.erp.base.rpc.ISysUserRpc;
|
|
|
import com.zanxiang.erp.security.util.SecurityUtil;
|
|
|
import com.zanxiang.game.module.base.pojo.enums.DeleteEnum;
|
|
|
+import com.zanxiang.game.module.manage.constant.RedisKeyConstant;
|
|
|
import com.zanxiang.game.module.manage.pojo.dto.GameDTO;
|
|
|
import com.zanxiang.game.module.manage.pojo.dto.GameGiftPackConditionDTO;
|
|
|
import com.zanxiang.game.module.manage.pojo.params.GameGiftPackLinkAddParam;
|
|
|
import com.zanxiang.game.module.manage.pojo.params.GameGiftPackLinkListParam;
|
|
|
import com.zanxiang.game.module.manage.pojo.params.GameGiftPackLinkUpdateParam;
|
|
|
import com.zanxiang.game.module.manage.pojo.vo.GameGiftPackLinkVO;
|
|
|
+import com.zanxiang.game.module.manage.service.IGameGiftPackCodeService;
|
|
|
import com.zanxiang.game.module.manage.service.IGameGiftPackConfigService;
|
|
|
import com.zanxiang.game.module.manage.service.IGameGiftPackLinkService;
|
|
|
import com.zanxiang.game.module.manage.service.IGameService;
|
|
|
+import com.zanxiang.game.module.manage.utils.RedisUtil;
|
|
|
import com.zanxiang.game.module.mybatis.entity.Game;
|
|
|
+import com.zanxiang.game.module.mybatis.entity.GameGiftPackCode;
|
|
|
import com.zanxiang.game.module.mybatis.entity.GameGiftPackConfig;
|
|
|
import com.zanxiang.game.module.mybatis.entity.GameGiftPackLink;
|
|
|
import com.zanxiang.game.module.mybatis.mapper.GameGiftPackLinkMapper;
|
|
@@ -58,6 +62,12 @@ public class GameGiftPackLinkServiceImpl extends ServiceImpl<GameGiftPackLinkMap
|
|
|
@Autowired
|
|
|
private IGameService gameService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil<String> redisUtil;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGameGiftPackCodeService gameGiftPackCodeService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IGameGiftPackConfigService gameGiftPackConfigService;
|
|
|
|
|
@@ -133,13 +143,23 @@ public class GameGiftPackLinkServiceImpl extends ServiceImpl<GameGiftPackLinkMap
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean deleteById(Long id) {
|
|
|
- return super.update(new LambdaUpdateWrapper<GameGiftPackLink>()
|
|
|
+ //链接里存在可用的未被领取的礼包码, 禁止删除
|
|
|
+ assert gameGiftPackCodeService.count(new LambdaUpdateWrapper<GameGiftPackCode>()
|
|
|
+ .eq(GameGiftPackCode::getLinkId, id)
|
|
|
+ .eq(GameGiftPackCode::getEnabled, Boolean.TRUE)
|
|
|
+ .eq(GameGiftPackCode::getIsSend, Boolean.FALSE)
|
|
|
+ ) <= 0 : "礼包码链接中存在未被领取的礼包码, 禁止删除";
|
|
|
+ //删除链接
|
|
|
+ super.update(new LambdaUpdateWrapper<GameGiftPackLink>()
|
|
|
.set(GameGiftPackLink::getIsDelete, DeleteEnum.YES.getCode())
|
|
|
.set(GameGiftPackLink::getUpdateBy, SecurityUtil.getUserId())
|
|
|
.set(GameGiftPackLink::getUpdateTime, LocalDateTime.now())
|
|
|
.eq(GameGiftPackLink::getId, id)
|
|
|
);
|
|
|
+ //删除缓存
|
|
|
+ return redisUtil.deleteCache(RedisKeyConstant.GAME_GIFT_PACK_CODE + id);
|
|
|
}
|
|
|
|
|
|
@Override
|