记得上下班打卡 | git大法好,push需谨慎

Commit 8584a795 authored by jiangxiulong's avatar jiangxiulong

演出日历增加城市名参数

parent 9a92c31a
......@@ -99,11 +99,14 @@ public class KylinPerformancesController {
@SneakyThrows
@GetMapping(value = "calendar")
@ApiOperation("演出日历")
@ApiImplicitParam(type = "query", dataType = "String", name = "yearMonth", value = "年月 2021-01", required = true)
public ResponseDto<List> performanceList(@RequestParam String yearMonth) throws ParseException {
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "yearMonth", value = "年月 2021-01", required = true),
@ApiImplicitParam(type = "query", dataType = "String", name = "cityName", value = "城市名称", required = true)
})
public ResponseDto<List> performanceList(@RequestParam String yearMonth, @RequestParam String cityName) throws ParseException {
List result = null;
try {
result = kylinPerformancesService.performanceCalendar(yearMonth);
result = kylinPerformancesService.performanceCalendar(yearMonth, cityName);
} catch (ParseException e) {
e.printStackTrace();
}
......
......@@ -344,14 +344,20 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM
return list;
}
public List performanceCalendar(String yearMonth) throws ParseException {
public List performanceCalendar(String yearMonth, String cityName) throws ParseException {
Document queryObject = new Document();
if (!cityName.isEmpty()) {
queryObject.put("cityName", Pattern.compile(cityName, Pattern.CASE_INSENSITIVE));
}
Query query = new BasicQuery(queryObject);
// 处理成正常格式
yearMonth = yearMonth.concat("-01 00:00:00");
// 获取此月开始结束时间
String monthStart = DateUtil.getMonthFirst(yearMonth);
String monthEnd = DateUtil.getMonthLast(yearMonth);
Query query = Query.query(Criteria.where("timeStart").gte(monthStart).lte(monthEnd));
query.addCriteria(Criteria.where("timeStart").gte(monthStart).lte(monthEnd));
query.fields().include("timeStart");
List<KylinPerformanceVo> list = mongoTemplate.find(query, KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment