Commit 09aa1a0f authored by Quxl's avatar Quxl

x

parent 16d2232e
......@@ -98,4 +98,6 @@ public interface ReviewService {
Fc_review queryReview(int film_id);
public List<Map<String, Object>> queryUserGroupListByReviewRecord(int enroll_type_id, Integer review_round);
}
\ No newline at end of file
......@@ -133,7 +133,6 @@ public class ReviewServiceImpl implements ReviewService {
public List<Map<String, Object>> queryNewAsianRoundList(String keyword, Integer user_group_id, Integer review_state, Integer review_round, String ext_type, Page page) {
XRException.assertNotBlank("获奖类型不能未空", ext_type);
XRException.assertNotBlank("选片轮数不能为空", review_round);
if(review_round.intValue() == 3) {
String sql = ""
+ "select "
+ "rh.film_id, "
......@@ -142,6 +141,7 @@ public class ReviewServiceImpl implements ReviewService {
+ "rh.review_round, "
+ "rh.review_state, "
+ "rh.opt_state, "
+ "rr.group_id, "
+ "mf.cn_name, "
+ "mf.en_name, "
+ "mf.film_no, "
......@@ -150,11 +150,11 @@ public class ReviewServiceImpl implements ReviewService {
+ "avg(rre.ext_score) ext_score_avg "
+ "from "
+ "fc_review_record_ext rre, "
+ "fc_review_record rr, "
+ "fc_review_record rr left join fc_user u on rr.user_id = u.uid, "
+ "fc_review_history rh left join fc_member_film mf on mf.id = rh.film_id "
+ "where "
+ "rre.ext_type = '" + ext_type + "' "
+ "and rh.review_round = 3 "
+ "and rh.review_round = " + review_round + " "
+ "and rre.record_id = rr.id "
+ "and rr.review_id = rh.review_id "
+ "and rh.enroll_type_id = 2 "
......@@ -166,23 +166,26 @@ public class ReviewServiceImpl implements ReviewService {
+ "rh.review_round, "
+ "rh.review_state, "
+ "rh.opt_state, "
+ "rr.group_id, "
+ "mf.cn_name, "
+ "mf.en_name, "
+ "mf.film_no, "
+ "rre.ext_type, "
+ "rre.ext_name"
;
SqlWhere where = new SqlWhere().eq("t.review_state", review_state).lk(new String[] {"tt.cn_name", "tt.en_name", "tt.film_no", "tt.ext_name"}, keyword);
sql = "select @rownum:=@rownum+1 as rownum, t.* from (" + sql + ") t, (select @rownum:=0) row order by t.ext_score_avg desc";
sql = "select tt.* from (" + sql + ") tt " + StringUtil.join(" where ", " and ", "", "", where.getStringList()) + " order by tt.rownum";
return jdbcTemplate.limit(sql, page, where.getObjectArray());
} else if(review_round.intValue() == 2) {
throw new XRException("亚新二选榜单没有没有准备好");
sql = "select @rownum:=@rownum+1 as rownum, t.* from (" + sql + ") t, (select @rownum:=0) row where t.group_id = " + user_group_id + " order by t.ext_score_avg desc";
SqlWhere where = new SqlWhere().eq("tt.review_state", review_state);
if(StringUtil.isNotBlank(keyword)) {
String lkstr = "%" + keyword + "%";
if(keyword.matches("\\d+")) {
where.where("(tt.film_no = ? or tt.en_name like ? or tt.cn_name like ? or tt.ext_name like ?)", new Object[] {Integer.valueOf(keyword), lkstr, lkstr, lkstr});
} else {
throw new XRException("只能查询亚新2,3选榜单");
where.lk(new String[]{"tt.en_name", "tt.cn_name", "tt.ext_name"}, keyword);
}
}
sql = "select tt.* from (" + sql + ") tt " + StringUtil.join(" where ", " and ", "", "", where.getStringList()) + " order by tt.rownum";
return jdbcTemplate.limit(sql, page, where.getObjectArray());
}
public static void main(String[] args) {
String ext_type = "最佳男主角";
......@@ -690,4 +693,11 @@ public class ReviewServiceImpl implements ReviewService {
return null;
}
@Override
public List<Map<String, Object>> queryUserGroupListByReviewRecord(int enroll_type_id, Integer review_round) {
String sql = "select ug.group_id, ug.group_name from fc_user_group ug, fc_user u, fc_review_record rr, fc_review r where ug.group_id = u.group_id and u.uid = rr.user_id and rr.review_id = r.id and r.review_round = ? and r.enroll_type_id = ? group by ug.group_id, ug.group_name order by ug.group_id";
List<Map<String, Object>> ugList = jdbcTemplate.queryForList(sql, review_round, enroll_type_id);
return ugList;
}
}
\ No newline at end of file
......@@ -21,7 +21,6 @@ import com.egolm.film.api.service.ReviewService;
import com.egolm.film.bean.Fc_admin;
import com.egolm.film.bean.Fc_review_record;
import com.egolm.film.bean.Fc_review_record_ext;
import com.egolm.film.config.XException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -107,10 +106,13 @@ public class AdminReviewController {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
Page page = new Page(index, limit);
List<Map<String, Object>> list = null;//reviewService.queryNewAsianRoundList(keyword, review_state, review_round, ext_type, page);
return Rjx.jsonOk().setData(list).setPage(page);
List<Map<String, Object>> ugList = reviewService.queryUserGroupListByReviewRecord(2, review_round);
for(Map<String, Object> ugMap : ugList) {
Integer ugId = (Integer)ugMap.get("group_id");
List<Map<String, Object>> list = reviewService.queryNewAsianRoundList(keyword, ugId, review_state, review_round, ext_type, page);
ugMap.put("list", list);
}
return Rjx.jsonOk().setData(ugList).setPage(page);
}
......
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