|
|
@@ -3,18 +3,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.yingyangfly.core.domain.GameTaskDetail;
|
|
|
-import com.yingyangfly.core.domain.GameUser;
|
|
|
-import com.yingyangfly.core.domain.SysDictData;
|
|
|
+import com.yingyangfly.core.domain.*;
|
|
|
import com.yingyangfly.core.dto.AppCurrentLoginUser;
|
|
|
import com.yingyangfly.core.dto.CurrentLoginUser;
|
|
|
import com.yingyangfly.core.dto.GameDto;
|
|
|
import com.yingyangfly.core.enums.StatusEnums;
|
|
|
import com.yingyangfly.core.mapper.GameMapper;
|
|
|
-import com.yingyangfly.core.domain.Game;
|
|
|
import com.yingyangfly.core.mapper.GameTaskDetailMapper;
|
|
|
import com.yingyangfly.core.mapper.GameUserMapper;
|
|
|
import com.yingyangfly.core.security.util.TokenUtil;
|
|
|
+import com.yingyangfly.core.service.GamePastRecordsService;
|
|
|
import com.yingyangfly.core.service.GamePlayRecordService;
|
|
|
import com.yingyangfly.core.service.GameService;
|
|
|
import com.yingyangfly.redis.client.RedisClient;
|
|
|
@@ -22,7 +20,9 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -50,6 +50,9 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
@Autowired
|
|
|
private GameTaskDetailMapper gameTaskDetailMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private GamePastRecordsService gamePastRecordsService;
|
|
|
+
|
|
|
@Override
|
|
|
public Game selectByGameCode(String gameCode) {
|
|
|
CurrentLoginUser currentUser = tokenUtil.getCurrentUser();
|
|
|
@@ -136,6 +139,19 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
|
|
|
return saveOrUpdate(game);
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public boolean delGame(Long gameId) {
|
|
|
+ Game game = getById(gameId);
|
|
|
+ // 新增历史游戏
|
|
|
+ GamePastRecords gamePastRecords = new GamePastRecords();
|
|
|
+ BeanUtils.copyProperties(game,gamePastRecords);
|
|
|
+ gamePastRecords.setId(IdWorker.getId());
|
|
|
+ gamePastRecordsService.save(gamePastRecords);
|
|
|
+ // 删除游戏
|
|
|
+ return removeById(gameId);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|