package com.dsh.other.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.other.entity.*; import com.dsh.other.feignclient.model.AdvertisementChangeStateDTO; import com.dsh.other.feignclient.model.AdvertisementQuery; import com.dsh.other.model.BannerVo; import com.dsh.other.model.dto.siteDto.GameDataQuery; import com.dsh.other.service.*; import com.dsh.other.util.ResultUtil; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import io.swagger.models.auth.In; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * @author zhibing.pu * @date 2023/7/11 17:48 */ @RestController @RequestMapping("") public class BallController { @Autowired private GameService gameService; @Autowired private TGameRecordService gameRecordService; // 数据统计 @ResponseBody @PostMapping("/student/getData") public List getData(@RequestBody GameDataQuery query){ if (query.getStoreId()==null){ // 获取到游戏ids List gameIds = gameService.list(new QueryWrapper().eq("operationId", query.getObjectId())) .stream().map(Game::getId).collect(Collectors.toList()); // 根据游戏ids查询智慧球场支付记录 QueryWrapper wrapper = new QueryWrapper().eq("status", 1) .ne("payType", 3) .ne("payType", 4); if(gameIds.size() > 0){ wrapper.in("gameId", gameIds); } List list = gameRecordService.list(wrapper); return list; }else{ List gameIds = gameService.list(new QueryWrapper().eq("storeId", query.getStoreId())) .stream().map(Game::getId).collect(Collectors.toList()); QueryWrapper wrapper = new QueryWrapper().eq("status", 1).eq("payType", 1).eq("payType", 2); if(gameIds.size() > 0){ wrapper.in("gameId", gameIds); } List list = gameRecordService.list(wrapper); return list; } } @ResponseBody @PostMapping("/student/webStudentList") public List list(@RequestBody BallQueryDto ballQueryDto) { List games = gameService.queryAll(ballQueryDto); return games; } // 根据门店ids 获取游戏记录 @ResponseBody @PostMapping("/game/getGameByStoreIds") public List getGameByStoreIds(@RequestBody List storeIds) { // 游戏id List gamesId = gameService.list(new QueryWrapper().in("storeId", storeIds)) .stream().map(Game::getId).collect(Collectors.toList()); if (gamesId.size() == 0) { return new ArrayList<>(); } else { // 根据游戏id获取游戏记录 获取用户Ids List userId = gameRecordService.list(new QueryWrapper().in("gameId", gamesId)) .stream().map(TGameRecord::getUserId).collect(Collectors.toList()); return userId; } } @Autowired private IRegionService regionService; @ResponseBody @PostMapping("/save") public Integer save(@RequestBody Game game) { if (game.getCityCode() != null) { Region city = regionService.getOne(new QueryWrapper().eq("code", game.getCityCode())); game.setCity(city.getName()); Region province = regionService.getOne(new QueryWrapper().eq("code", game.getProvinceCode())); game.setProvince(province.getName()); } gameService.saveOrUpdate(game); System.out.println("===========" + game); return game.getId(); } @Autowired private TGameConfigService config; @ResponseBody @PostMapping("/saveConfig") public void saveConfig(@RequestBody List gameConfigList) { System.out.println("=======gameConfigList====" + gameConfigList); config.saveOrUpdateBatch(gameConfigList); // return game.getId(); } @ResponseBody @PostMapping("/queryGame") public Game queryGame(@RequestParam Integer id) { return gameService.getById(id); // return game.getId(); } @ResponseBody @PostMapping("/listorder") public List> listorder(@RequestBody BookingQuery bookingQuery) { System.out.println("===bookingQuery====" + bookingQuery); return gameService.orderlist(bookingQuery); // return game.getId(); } }