Commit 3ec94e07 authored by 张永's avatar 张永
parents e9def1e1 4eb36d3b
...@@ -53,7 +53,6 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -53,7 +53,6 @@ public class ReviewServiceImpl implements ReviewService {
Page page) { Page page) {
SqlWhere w1 = new SqlWhere() SqlWhere w1 = new SqlWhere()
.where("mf.film_type_name in (select agft.film_type_id from fc_admin_group_filmtype agft where agft.group_id = ?)", new Object[]{group_id}) .where("mf.film_type_name in (select agft.film_type_id from fc_admin_group_filmtype agft where agft.group_id = ?)", new Object[]{group_id})
.eq("mf.upload_state", 1)
.eq("mf.film_type_name", film_type_name) .eq("mf.film_type_name", film_type_name)
.eq("mf.film_type_name_short", film_type_name_short) .eq("mf.film_type_name_short", film_type_name_short)
.eq("mf.film_country", film_country) .eq("mf.film_country", film_country)
...@@ -89,7 +88,8 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -89,7 +88,8 @@ public class ReviewServiceImpl implements ReviewService {
+ "r.allot_state, " + "r.allot_state, "
+ "r.opt_state, " + "r.opt_state, "
+ "(select group_concat(fp.playactor_name) from fc_member_film_playactor fp where fp.film_id = mf.id and fp.playactor_type = 'director' group by fp.film_id, fp.playactor_type) director_name, " + "(select group_concat(fp.playactor_name) from fc_member_film_playactor fp where fp.film_id = mf.id and fp.playactor_type = 'director' group by fp.film_id, fp.playactor_type) director_name, "
+ "count(rr.id) user_count " + "count(rr.id) user_count, "
+ "count(case when rr.review_state is not null then rr.id end) user_review_count "
+ "from " + "from "
+ sql_film + " mf, " + sql_film + " mf, "
+ "fc_review r left join fc_review_record rr on rr.review_id = r.id and rr.review_round = r.review_round " + "fc_review r left join fc_review_record rr on rr.review_id = r.id and rr.review_round = r.review_round "
...@@ -309,39 +309,41 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -309,39 +309,41 @@ public class ReviewServiceImpl implements ReviewService {
jdbcTemplate.executeUpdate("update fc_review set review_round = ?, opt_state = 0, allot_state = ?, review_state = null, push_time = now() where id = ?", review_round, allot_state, review_id); jdbcTemplate.executeUpdate("update fc_review set review_round = ?, opt_state = 0, allot_state = ?, review_state = null, push_time = now() where id = ?", review_round, allot_state, review_id);
} }
private Integer toReviewState(List<Fc_review_record> records) { private int toReviewState(List<Fc_review_record> records) {
if(records != null && records.size() > 1) { Map<Integer, Integer> map = new HashMap<Integer, Integer>();
Map<Integer, Integer> map = new HashMap<Integer, Integer>(); for(Fc_review_record record : records) {
for(Fc_review_record record : records) { Integer review_state = record.getReview_state();;
Integer review_state = record.getReview_state();; if(review_state == null) {
if(review_state == null) { return 0;
return null;
}
map.put(review_state, map.get(review_state) == null ? 1 : (map.get(review_state) + 1));
}
Collection<Integer> ary = map.values();
Integer maxCount = 0;
for(Integer count : ary) {
maxCount = count > maxCount ? count : maxCount;
} }
if(maxCount > 0) { map.put(review_state, map.get(review_state) == null ? 1 : (map.get(review_state) + 1));
Integer i = 0; }
Integer review_state = null; Collection<Integer> ary = map.values();
for(Integer key : map.keySet()) { Integer maxCount = 0;
Integer value = map.get(key); for(Integer count : ary) {
if(value.intValue() == maxCount.intValue()) { maxCount = count > maxCount ? count : maxCount;
review_state = key; }
i++; if(maxCount > 0) {
} Integer i = 0;
} Integer review_state = null;
if(i.intValue() == 1) { for(Integer key : map.keySet()) {
return review_state; Integer value = map.get(key);
} else { if(value.intValue() == maxCount.intValue()) {
return -1; review_state = key;
i++;
} }
} }
if(i.intValue() == 1) {
return review_state;
} else {
return -1;
}
} }
return null; return 0;
}
private void closeFlow(int reviewState, int reviewId) {
jdbcTemplate.executeUpdate("update fc_review set opt_state = 3, review_state = ? where id = ?", reviewState, reviewId);
} }
@Override @Override
...@@ -349,29 +351,54 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -349,29 +351,54 @@ public class ReviewServiceImpl implements ReviewService {
public void tryNextRound(Integer review_id) { public void tryNextRound(Integer review_id) {
Fc_review review = jdbcTemplate.queryForBean("select * from fc_review where id = ?", Fc_review.class, review_id); Fc_review review = jdbcTemplate.queryForBean("select * from fc_review where id = ?", Fc_review.class, review_id);
List<Fc_review_record> records = jdbcTemplate.queryForBeans("select * from fc_review_record where review_id = ? and review_round = ?", Fc_review_record.class, review.getId(), review.getReview_round()); List<Fc_review_record> records = jdbcTemplate.queryForBeans("select * from fc_review_record where review_id = ? and review_round = ?", Fc_review_record.class, review.getId(), review.getReview_round());
Integer review_round = review.getReview_round(); int reviewRound = review.getReview_round().intValue();
Integer enroll_type_id = review.getEnroll_type_id(); int enrollType = review.getEnroll_type_id().intValue();
Integer review_state = this.toReviewState(records); int reviewState = this.toReviewState(records);
if(review_state == null) {//未完 if(reviewState == 0) {
return; return;
} }
if(review_state.intValue() == 2) {//否决 if(reviewState == 2) {//否决
jdbcTemplate.executeUpdate("update fc_review set opt_state = 3, review_state = 2 where id = ?", review.getId()); jdbcTemplate.executeUpdate("update fc_review set opt_state = 3, review_state = 2 where id = ?", review.getId());
} else if(review_state.intValue() == -1) {//争议 } else if(reviewState == -1) {//争议
jdbcTemplate.executeUpdate("update fc_review set opt_state = 1, allot_state = 0 where id = ?", review.getId()); jdbcTemplate.executeUpdate("update fc_review set opt_state = 1, allot_state = 0 where id = ?", review.getId());
} else { } else {
jdbcTemplate.executeUpdate("update fc_review set opt_state = 2, review_state = ? where id = ?", review_state, review.getId()); jdbcTemplate.executeUpdate("update fc_review set opt_state = 2, review_state = ? where id = ?", reviewState, review.getId());
if(enroll_type_id.intValue() == 2 && (review_round.intValue() == 2 || review_round.intValue() == 3)) { if(enrollType == 1) {
if(reviewRound == 6 && reviewState == 1) {
this.closeFlow(reviewState, review.getId());
} else if(reviewRound == 5 && reviewState == 5) {
this.toType4(review.getId());
this.closeFlow(1, review.getId());
} else if((reviewRound == 2 || reviewRound == 3) && reviewState == 5) {
this.toType4(review.getId());
this.toRound(review.getId(), 4);
}
} else if(enrollType == 2) {
if(reviewRound == 6 && reviewState == 1) {
this.closeFlow(reviewState, review.getId());
} else if(reviewRound == 5 && reviewState == 5) {
this.toType4(review.getId());
this.closeFlow(1, review.getId());
} else if(reviewRound == 2 && reviewState == 5) {
this.toType4(review.getId());
this.toRound(review.getId(), 4);
}
} else if(enrollType == 4) {
if((reviewRound == 4 || reviewRound == 5) && reviewState == 1) {
this.closeFlow(1, review.getId());
}
}
if(enrollType == 2 && (reviewRound == 2 || reviewRound == 3)) {
this.createAsiaNewReport(review.getId()); this.createAsiaNewReport(review.getId());
} }
} }
Integer opt_state = jdbcTemplate.queryForInt("select opt_state from fc_review where id = ?", review.getId()); Integer opt_state = jdbcTemplate.queryForInt("select opt_state from fc_review where id = ?", review.getId());
Fc_review_history history = new Fc_review_history(); Fc_review_history history = new Fc_review_history();
history.setReview_id(review.getId()); history.setReview_id(review.getId());
history.setEnroll_type_id(enroll_type_id); history.setEnroll_type_id(enrollType);
history.setFilm_id(review.getFilm_id()); history.setFilm_id(review.getFilm_id());
history.setReview_round(review_round); history.setReview_round(reviewRound);
history.setReview_state(review_state); history.setReview_state(reviewState);
history.setCreate_time(new Date()); history.setCreate_time(new Date());
history.setOpt_state(opt_state); history.setOpt_state(opt_state);
jdbcTemplate.save(history); jdbcTemplate.save(history);
...@@ -379,6 +406,24 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -379,6 +406,24 @@ public class ReviewServiceImpl implements ReviewService {
public void createAsiaNewReport(Integer review_id) { public void createAsiaNewReport(Integer review_id) {
Fc_review review = jdbcTemplate.queryForBean("select * from fc_review where id = ?", Fc_review.class, review_id); Fc_review review = jdbcTemplate.queryForBean("select * from fc_review where id = ?", Fc_review.class, review_id);
int round = review.getReview_round();
int enrollType = review.getEnroll_type_id();
if(enrollType == 2 && (round == 2 || round == 3)) {
}
//TODO 计算单个亚新影片得分
//TODO 计算单个亚新影片得分
//TODO 计算单个亚新影片得分
//TODO 计算单个亚新影片得分
//TODO 计算单个亚新影片得分
//TODO 计算单个亚新影片得分
//TODO 计算单个亚新影片得分
//TODO 计算单个亚新影片得分
//TODO 计算单个亚新影片得分
} }
...@@ -390,7 +435,7 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -390,7 +435,7 @@ public class ReviewServiceImpl implements ReviewService {
@Transactional @Transactional
public void saveReviewRecordIfNotExists(Integer review_id, Integer review_round, Integer[] user_id) { public void saveReviewRecordIfNotExists(Integer review_id, Integer review_round, Integer[] user_id) {
Integer count = jdbcTemplate.queryForInt("select count(*) from fc_review_record where review_id = ? and review_round = ?", review_id, review_round); Integer count = jdbcTemplate.queryForInt("select count(*) from fc_review_record where review_id = ? and review_round = ?", review_id, review_round);
if(count + user_id.length < 2) { if(count + user_id.length < 2 && review_round.intValue() != 5 && review_round.intValue() != 6) {
throw new XRException("请至少分配两个审片评委"); throw new XRException("请至少分配两个审片评委");
} }
String sql = "" String sql = ""
......
...@@ -257,36 +257,43 @@ public class AdminReviewController { ...@@ -257,36 +257,43 @@ public class AdminReviewController {
} else { } else {
throw new XRException("参数不平衡"); throw new XRException("参数不平衡");
} }
Integer toRoundNumber = review_round;
if(saveList.size() > 0) { if(saveList.size() > 0) {
reviewService.saveReviewRecordIfNotExists(review_id, review_round, saveList.toArray(new Integer[saveList.size()])); reviewService.saveReviewRecordIfNotExists(review_id, toRoundNumber, saveList.toArray(new Integer[saveList.size()]));
Fc_admin admin = Util.mapTo(tokenService.getTokenObj(), Fc_admin.class); Fc_admin admin = Util.mapTo(tokenService.getTokenObj(), Fc_admin.class);
newsService.sendAllotNews(review_id, review_round, user_id, admin); newsService.sendAllotNews(review_id, toRoundNumber, user_id, admin);
} }
if(cancelList.size() > 0) { if(cancelList.size() > 0) {
reviewService.deleteReviewRecord(review_id, review_round, cancelList.toArray(new Integer[cancelList.size()])); reviewService.deleteReviewRecord(review_id, toRoundNumber, cancelList.toArray(new Integer[cancelList.size()]));
} }
Fc_review review = reviewService.queryReviewById(review_id); Fc_review review = reviewService.queryReviewById(review_id);
if(review_round.intValue() == 5 int reviewRound = review.getReview_round();
|| (review_round.intValue() > review.getReview_round().intValue() && review.getOpt_state().intValue() == 2)) { int enrollType = review.getEnroll_type_id();
if(review.getOpt_state() != 2) { int optState = review.getOpt_state();
throw new XRException("当前审片结论不能分配下一环节评委"); if(toRoundNumber > reviewRound) {
} if(optState == 2) {
if(review.getEnroll_type_id().intValue() == 2) { if(enrollType == 2 && ((reviewRound <= 1 && reviewRound >= 3) || (reviewRound <= 2 && reviewRound >= 4))) {
if((review.getReview_round().intValue() <= 1 && review_round.intValue() >= 3) throw new XRException("亚新二选和三选评分步骤不能跳过");
|| (review.getReview_round().intValue() <= 2 && review_round.intValue() >= 4)) { }
throw new XRException("亚新二选和三选评分不能跳过"); if((enrollType == 2 || enrollType == 3) && toRoundNumber == 5) {
} throw new XRException("亚新金爵影片没有把关流程");
} }
if(review.getReview_state().intValue() == 5 && review.getEnroll_type_id().intValue() != 4) { if(enrollType == 4 && (toRoundNumber == 3 || toRoundNumber == 6)) {
reviewService.toType4(review.getId()); throw new XRException("展映影片没有三选和总局审片流程");
}
reviewService.toRound(review_id, toRoundNumber);
} else {
throw new XRException("当前审片状态为" + rounds[reviewRound] + opts[optState] + ",不能分配" + rounds[toRoundNumber] + "评委");
} }
reviewService.toRound(review_id, review_round); } else if(toRoundNumber < reviewRound) {
} else { throw new XRException("已审核环节不能再分配评委");
throw new XRException("审片流程不能后退");
} }
return Rjx.jsonOk(); return Rjx.jsonOk();
} }
static String[] rounds = new String[] {"", "一选", "二选", "三选", "影片把关", "选片委员会", "总局审片"};
static String[] opts = new String[] {"未审片", "有争议", "待分配", "已完成"};
@ResponseBody @ResponseBody
@Transactional @Transactional
@PostMapping("allot_show_user") @PostMapping("allot_show_user")
......
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