Commit b1d20437 authored by Quxl's avatar Quxl

x

parent 7b154f6a
...@@ -3,8 +3,14 @@ package com.egolm.film.api.service; ...@@ -3,8 +3,14 @@ package com.egolm.film.api.service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.egolm.common.jdbc.Page;
public interface CinemaService { public interface CinemaService {
List<Map<String, Object>> getCinemaListForSelected(String keyword); List<Map<String, Object>> getCinemaListForSelected(String keyword);
List<Map<String, Object>> getCinemaList(String keyword, Page page);
void setTmpData(Integer showtimeId);
} }
...@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service; ...@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
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.film.api.service.CinemaService; import com.egolm.film.api.service.CinemaService;
import com.egolm.film.util.SqlWhere; import com.egolm.film.util.SqlWhere;
...@@ -41,4 +42,22 @@ public class CinemaServiceImpl implements CinemaService { ...@@ -41,4 +42,22 @@ public class CinemaServiceImpl implements CinemaService {
return jdbcTemplate.queryForList(sql, where.getObjectArray()); return jdbcTemplate.queryForList(sql, where.getObjectArray());
} }
@Override
public List<Map<String, Object>> getCinemaList(String keyword, Page page) {
SqlWhere where = new SqlWhere().lk(new String[] {"cinema_no", "cinema_name", "cinema_en_name"}, keyword);
String sql = "select * from fc_cinema " + StringUtil.join(" and ", " where ", " ", " ", where.getStringList());
return jdbcTemplate.limit(sql, page, where.getObjectArray());
}
@Override
public void setTmpData(Integer showtimeId) {
String sql = "select cinema_id from fc_cinema_showtime where id = ?";
Integer cinema_id = jdbcTemplate.queryForInt(sql, showtimeId);
String sql_tmp_count_show = "select count(*) from fc_cinema_showtime where cinema_id = ? and showtime_no is not null and showtime_no != ''";
Integer tmp_count_show = jdbcTemplate.queryForInt(sql_tmp_count_show, cinema_id);
String sql_tmp_count_film = "select count(film_id) from fc_cinema_showtime where cinema_id = ? and film_id is not null group by film_id";
Integer tmp_count_film = jdbcTemplate.queryForInt(sql_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);
}
} }
...@@ -10,10 +10,16 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -10,10 +10,16 @@ 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.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.CinemaService; import com.egolm.film.api.service.CinemaService;
import com.egolm.film.bean.Fc_cinema; import com.egolm.film.api.service.CommonService;
import com.egolm.film.bean.Fc_cinema_showtime;
import com.egolm.film.bean.model.Fc_cinema_model;
import com.egolm.film.bean.model.Fc_cinema_showtime_model;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@Api @Api
...@@ -24,19 +30,53 @@ public class CinemaController { ...@@ -24,19 +30,53 @@ public class CinemaController {
@Autowired @Autowired
CinemaService service; CinemaService service;
@Autowired
CommonService common;
@ResponseBody @ResponseBody
@PostMapping("save") @PostMapping("saveOrUpdate")
@ApiOperation("保存影院影厅") @ApiOperation("保存影院影厅")
public Object save(Fc_cinema cinema) { public Object saveOrUpdate(Fc_cinema_model cinemaModel) {
common.save(cinemaModel);
return Rjx.jsonOk(); return Rjx.jsonOk();
} }
@ResponseBody @ResponseBody
@PostMapping("getCinemaListForSelected") @PostMapping("getCinemaListForSelected")
@ApiOperation("查询影院列表") @ApiOperation("查询影院列表(不包含影厅信息,且GroupBy去重),新增影院影厅信息的时候,影院信息可以通过下拉菜单选择,数据库中已存在的影院信息将显示再此列表中")
public Object getCinemaListForSelected(String keyword) { public Object getCinemaListForSelected(String keyword) {
List<Map<String, Object>> list = service.getCinemaListForSelected(keyword); List<Map<String, Object>> list = service.getCinemaListForSelected(keyword);
return Rjx.jsonOk().setData(list); return Rjx.jsonOk().setData(list);
} }
@ResponseBody
@PostMapping("getCinemaList")
@ApiOperation("查询影院列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", name="index", value="分页页码"),
@ApiImplicitParam(paramType="query", name="limit", value="每页显示条数"),
@ApiImplicitParam(paramType="query", name="limitKey", value="分页排序字段"),
})
public Object getCinemaList(String keyword, Page page) {
List<Map<String, Object>> list = service.getCinemaList(keyword, page);
return Rjx.jsonOk().setData(list).setPage(page);
}
@ResponseBody
@PostMapping("saveShowtime")
@ApiOperation("保存拍片时间")
public Object saveShowtime(Fc_cinema_showtime[] showtime) {
common.save(showtime);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("updateShowtime")
@ApiOperation("编辑场次")
public Object updateShowtime(Fc_cinema_showtime_model showtimeModel) {
common.update(showtimeModel);
service.setTmpData(showtimeModel.getId());
return Rjx.jsonOk();
}
} }
...@@ -18,7 +18,7 @@ public class Fc_cinema implements java.io.Serializable { ...@@ -18,7 +18,7 @@ public class Fc_cinema implements java.io.Serializable {
private Integer id; private Integer id;
@Column(columnDefinition="varchar(100) COMMENT '影院编号'") @Column(columnDefinition="varchar(100) COMMENT '影院编号'")
private String no; private String cinema_no;
@Column(columnDefinition="varchar(255) COMMENT '影院名称'") @Column(columnDefinition="varchar(255) COMMENT '影院名称'")
private String cinema_name; private String cinema_name;
...@@ -50,6 +50,12 @@ public class Fc_cinema implements java.io.Serializable { ...@@ -50,6 +50,12 @@ public class Fc_cinema implements java.io.Serializable {
@Column(columnDefinition="datetime COMMENT '创建时间'") @Column(columnDefinition="datetime COMMENT '创建时间'")
private Date create_time; private Date create_time;
@Column(columnDefinition="int(11) COMMENT '冗余,已排片影片数量'")
private Integer tmp_count_film;
@Column(columnDefinition="int(11) COMMENT '冗余,已设置厂数'")
private Integer tmp_count_show;
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
...@@ -59,12 +65,12 @@ public class Fc_cinema implements java.io.Serializable { ...@@ -59,12 +65,12 @@ public class Fc_cinema implements java.io.Serializable {
return id; return id;
} }
public void setNo(String no) { public void setCinema_no(String cinema_no) {
this.no = no; this.cinema_no = cinema_no;
} }
public String getNo() { public String getCinema_no() {
return no; return cinema_no;
} }
public void setCinema_name(String cinema_name) { public void setCinema_name(String cinema_name) {
...@@ -147,5 +153,21 @@ public class Fc_cinema implements java.io.Serializable { ...@@ -147,5 +153,21 @@ public class Fc_cinema implements java.io.Serializable {
return create_time; return create_time;
} }
public void setTmp_count_film(Integer tmp_count_film) {
this.tmp_count_film = tmp_count_film;
}
public Integer getTmp_count_film() {
return tmp_count_film;
}
public void setTmp_count_show(Integer tmp_count_show) {
this.tmp_count_show = tmp_count_show;
}
public Integer getTmp_count_show() {
return tmp_count_show;
}
} }
...@@ -17,7 +17,7 @@ public class Fc_cinema_showtime implements java.io.Serializable { ...@@ -17,7 +17,7 @@ public class Fc_cinema_showtime implements java.io.Serializable {
private Integer id; private Integer id;
@Column(columnDefinition="int(11) unsigned COMMENT '场次编号'") @Column(columnDefinition="int(11) unsigned COMMENT '场次编号'")
private Integer no; private Integer showtime_no;
@Column(columnDefinition="int(11) unsigned COMMENT '影院放映厅ID'") @Column(columnDefinition="int(11) unsigned COMMENT '影院放映厅ID'")
private Integer cinema_id; private Integer cinema_id;
...@@ -52,12 +52,12 @@ public class Fc_cinema_showtime implements java.io.Serializable { ...@@ -52,12 +52,12 @@ public class Fc_cinema_showtime implements java.io.Serializable {
return id; return id;
} }
public void setNo(Integer no) { public void setShowtime_no(Integer showtime_no) {
this.no = no; this.showtime_no = showtime_no;
} }
public Integer getNo() { public Integer getShowtime_no() {
return no; return showtime_no;
} }
public void setCinema_id(Integer cinema_id) { public void setCinema_id(Integer cinema_id) {
......
...@@ -70,4 +70,19 @@ public class WebApiInterceptor extends HandlerInterceptorAdapter { ...@@ -70,4 +70,19 @@ public class WebApiInterceptor extends HandlerInterceptorAdapter {
System.out.println("10.10.0.111:20002/film/webapi/getFilmList?timestamp=" + timestamp + "&sign=" + sign); System.out.println("10.10.0.111:20002/film/webapi/getFilmList?timestamp=" + timestamp + "&sign=" + sign);
} }
public String sign(Map<String, String> params) {
StringBuffer sb = new StringBuffer();
Map<String, String> sortMap =
new TreeMap<String, String>(params);
sortMap.remove("sign");
for(String key : sortMap.keySet()) {
String val = sortMap.get(key);
if(val != null) {
sb.append(val);
}
}
String sign_data = sb.toString() + md5key;
return StringUtil.toMD5HexString(sign_data);
}
} }
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