Commit 386c3e5b authored by Quxl's avatar Quxl

x

parent 224a34f1
...@@ -13,4 +13,6 @@ public interface CinemaService { ...@@ -13,4 +13,6 @@ public interface CinemaService {
void setTmpData(Integer showtimeId); void setTmpData(Integer showtimeId);
List<Map<String, Object>> queryShowtimeList();
} }
package com.egolm.film.api.service.impl; package com.egolm.film.api.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.common.jdbc.JdbcTemplate; import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page; import com.egolm.common.jdbc.Page;
...@@ -60,4 +62,11 @@ public class CinemaServiceImpl implements CinemaService { ...@@ -60,4 +62,11 @@ public class CinemaServiceImpl implements CinemaService {
jdbcTemplate.executeUpdate("update fc_cinema set tmp_count_show = ?, tmp_count_film = ? where id = ?", tmp_count_show, tmp_count_film, cinema_id); jdbcTemplate.executeUpdate("update fc_cinema set tmp_count_show = ?, tmp_count_film = ? where id = ?", tmp_count_show, tmp_count_film, cinema_id);
} }
@Override
public List<Map<String, Object>> queryShowtimeList() {
Date dodayStart = DateUtil.start(new Date());
String sql = "select * from fc_cinema_showtime where show_date >= ?";
return jdbcTemplate.queryForList(sql, dodayStart);
}
} }
package com.egolm.film.api.web.admin; package com.egolm.film.api.web.admin;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
...@@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.DateUtil;
import com.egolm.common.Util;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page; import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.CinemaService; import com.egolm.film.api.service.CinemaService;
...@@ -104,4 +108,27 @@ public class CinemaController { ...@@ -104,4 +108,27 @@ public class CinemaController {
return Rjx.jsonOk(); return Rjx.jsonOk();
} }
@ResponseBody
@PostMapping("updateShowtime")
@ApiOperation("编辑场次")
public Object getShowtimeList() {
List<Map<String, Object>> list = service.queryShowtimeList();
for(Map<String, Object> map : list) {
Date date = (Date)map.get("show_date");
map.put("show_date", DateUtil.format(date, "yyyy-MM-dd"));
}
Map<String, List<Map<String, Object>>> datas = Util.listToML(list, "show_date");
for(String key : datas.keySet()) {
List<Map<String, Object>> dataList = datas.get(key);
dataList.sort(new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
String show_time1 = (String)o1.get("show_time");
String show_time2 = (String)o2.get("show_time");
return show_time1.compareTo(show_time2);
}
});
}
return Rjx.jsonOk().setData(new TreeMap<String, List<Map<String, Object>>>(datas));
}
} }
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