普惠GO服务端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
puhui-go/cweb/src/main/java/com/cweb/controller/qianZhu/CinemaController.java

252 lines
9.4 KiB

package com.cweb.controller.qianZhu;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import com.hfkj.qianzhu.channel.CinemaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value="/cinema")
@Api(value="电影票数据")
public class CinemaController {
Logger log = LoggerFactory.getLogger(CinemaController.class);
@RequestMapping(value="/filmsPagedQuery",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据城市分页查询影片")
public ResponseData filmsPagedQuery(@RequestParam(value = "cityId", required = false) Integer cityId,
@RequestParam(value = "cityCode", required = false) String cityCode,
@RequestParam(value = "cinemaId", required = false) String cinemaId,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize
) {
try {
Map<String, Object> params = new HashMap<>();
if (cityId != null) {
params.put("cityId", cityId);
}
if (cityCode != null) {
params.put("cityCode", cityCode);
}
if (cinemaId != null) {
params.put("cinemaId", cinemaId);
}
params.put("pageIndex", pageNum);
params.put("pageSize", pageSize);
return ResponseMsgUtil.success(CinemaService.filmsPagedQuery(params));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/pagedQueryNotShownFilms",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "分页查询待上映影片")
public ResponseData pagedQueryNotShownFilms(
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize
) {
try {
Map<String, Object> params = new HashMap<>();
params.put("pageIndex", pageNum);
params.put("pageSize", pageSize);
return ResponseMsgUtil.success(CinemaService.pagedQueryNotShownFilms(params));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/cinemaBrands",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询所有影院品牌")
public ResponseData cinemaBrands(
) {
try {
return ResponseMsgUtil.success(CinemaService.cinemaBrands());
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/cinemasPagedQuery",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "分页查询城市影院")
public ResponseData cinemasPagedQuery(@RequestParam(value = "cityId", required = false) Integer cityId,
@RequestParam(value = "cityCode", required = false) String cityCode,
@RequestParam(value = "regionId", required = false) Integer regionId,
@RequestParam(value = "cinemaId", required = false) String cinemaId,
@RequestParam(value = "showDate", required = false) String showDate,
@RequestParam(value = "brandKeyword", required = false) String brandKeyword,
@RequestParam(name = "lon", required = true) BigDecimal lon,
@RequestParam(name = "lat", required = true) BigDecimal lat,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize
) {
try {
Map<String, Object> params = new HashMap<>();
if (cityId != null) {
params.put("cityId", cityId);
}
if (cityCode != null) {
params.put("cityCode", cityCode);
}
if (cinemaId != null) {
params.put("cinemaId", cinemaId);
}
if (regionId != null) {
params.put("regionId", regionId);
}
if (brandKeyword != null) {
params.put("brandKeyword", brandKeyword);
}
params.put("lon", lon);
params.put("lat", lat);
params.put("showDate", showDate);
params.put("pageIndex", pageNum);
params.put("pageSize", pageSize);
return ResponseMsgUtil.success(CinemaService.cinemasPagedQuery(params));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/listByCinemaId",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据影院id查询影片")
public ResponseData listByCinemaId(
@RequestParam(name = "cinemaId", required = true) Integer cinemaId
) {
try {
Map<String, Object> params = new HashMap<>();
params.put("cinemaId", cinemaId);
return ResponseMsgUtil.success(CinemaService.listByCinemaId(params));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/listByCinemaAndFilm",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据影院和影片查询场次")
public ResponseData listByCinemaAndFilm(
@RequestParam(name = "cinemaId", required = true) Integer cinemaId,
@RequestParam(name = "filmId", required = true) Integer filmId
) {
try {
Map<String, Object> params = new HashMap<>();
params.put("cinemaId", cinemaId);
params.put("filmId", filmId);
return ResponseMsgUtil.success(CinemaService.listByCinemaAndFilm(params));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/pagedQuery",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "分页查询场次")
public ResponseData pagedQuery(
@RequestParam(name = "cityId", required = false) Integer cityId,
@RequestParam(name = "cityCode", required = false) String cityCode,
@RequestParam(name = "cinemaId", required = false) Integer cinemaId,
@RequestParam(name = "filmId", required = false) Integer filmId,
@RequestParam(value = "showTimeBeginTime" , required = false) Long showTimeBeginTime,
@RequestParam(value = "showTimeEndTime" , required = false) Long showTimeEndTime,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize
) {
try {
Map<String, Object> params = new HashMap<>();
if (cityId != null) {
params.put("cityId", cityId);
}
if (cityCode != null) {
params.put("cityCode", cityCode);
}
if (cinemaId != null) {
params.put("cinemaId", cinemaId);
}
if (filmId != null) {
params.put("filmId", filmId);
}
if (showTimeBeginTime != null) {
params.put("showTimeBeginTime", showTimeBeginTime);
}
if (showTimeEndTime != null) {
params.put("showTimeEndTime", showTimeEndTime);
}
params.put("pageIndex", pageNum);
params.put("pageSize", pageSize);
return ResponseMsgUtil.success(CinemaService.pagedQuery(params));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getRealTimeSeatByShowId",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询场次实时座位")
public ResponseData getRealTimeSeatByShowId(
@RequestParam(name = "showId", required = true) Long showId
) {
try {
Map<String, Object> params = new HashMap<>();
params.put("showId", showId);
return ResponseMsgUtil.success(CinemaService.getRealTimeSeatByShowId(params));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}