Commit 8e2c4876 authored by Quxl's avatar Quxl

x

parent c49dee3b
......@@ -310,68 +310,98 @@ public class ReviewServiceImpl implements ReviewService {
}
private Integer toReviewState(List<Fc_review_record> records) {
if(records != null && records.size() > 1) {
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for(Fc_review_record record : records) {
Integer review_state = record.getReview_state();;
if(review_state == null) {
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;
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for(Fc_review_record record : records) {
Integer review_state = record.getReview_state();;
if(review_state == null) {
return null;
}
if(maxCount > 0) {
Integer i = 0;
Integer review_state = null;
for(Integer key : map.keySet()) {
Integer value = map.get(key);
if(value.intValue() == maxCount.intValue()) {
review_state = key;
i++;
}
}
if(i.intValue() == 1) {
return review_state;
} else {
return -1;
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) {
Integer i = 0;
Integer review_state = null;
for(Integer key : map.keySet()) {
Integer value = map.get(key);
if(value.intValue() == maxCount.intValue()) {
review_state = key;
i++;
}
}
if(i.intValue() == 1) {
return review_state;
} else {
return -1;
}
}
return null;
}
private void closeFlow(int reviewState, int reviewId) {
jdbcTemplate.executeUpdate("update fc_review set opt_state = 3, review_state = ? where id = ?", reviewState, reviewId);
}
@Override
@Transactional
public void tryNextRound(Integer 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());
Integer review_round = review.getReview_round();
Integer enroll_type_id = review.getEnroll_type_id();
Integer review_state = this.toReviewState(records);
if(review_state == null) {//未完
int reviewRound = review.getReview_round().intValue();
int enrollType = review.getEnroll_type_id().intValue();
int reviewState = 0;
try {
reviewState = this.toReviewState(records).intValue();
} catch (NullPointerException e) {
//未完成
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());
} 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());
} else {
jdbcTemplate.executeUpdate("update fc_review set opt_state = 2, review_state = ? where id = ?", review_state, review.getId());
if(enroll_type_id.intValue() == 2 && (review_round.intValue() == 2 || review_round.intValue() == 3)) {
jdbcTemplate.executeUpdate("update fc_review set opt_state = 2, review_state = ? where id = ?", reviewState, review.getId());
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());
}
}
Integer opt_state = jdbcTemplate.queryForInt("select opt_state from fc_review where id = ?", review.getId());
Fc_review_history history = new Fc_review_history();
history.setReview_id(review.getId());
history.setEnroll_type_id(enroll_type_id);
history.setEnroll_type_id(enrollType);
history.setFilm_id(review.getFilm_id());
history.setReview_round(review_round);
history.setReview_state(review_state);
history.setReview_round(reviewRound);
history.setReview_state(reviewState);
history.setCreate_time(new Date());
history.setOpt_state(opt_state);
jdbcTemplate.save(history);
......@@ -379,7 +409,25 @@ public class ReviewServiceImpl implements ReviewService {
public void createAsiaNewReport(Integer 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 计算单个亚新影片得分
}
public void save(Object obj) {
......@@ -390,7 +438,7 @@ public class ReviewServiceImpl implements ReviewService {
@Transactional
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);
if(count + user_id.length < 2) {
if(count + user_id.length < 2 && review_round.intValue() != 5 && review_round.intValue() != 6) {
throw new XRException("请至少分配两个审片评委");
}
String sql = ""
......
......@@ -257,36 +257,41 @@ public class AdminReviewController {
} else {
throw new XRException("参数不平衡");
}
Integer toRoundNumber = review_round;
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);
newsService.sendAllotNews(review_id, review_round, user_id, admin);
newsService.sendAllotNews(review_id, toRoundNumber, user_id, admin);
}
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);
if(review_round.intValue() == 5
|| (review_round.intValue() > review.getReview_round().intValue() && review.getOpt_state().intValue() == 2)) {
if(review.getOpt_state() != 2) {
throw new XRException("当前审片结论不能分配下一环节评委");
}
if(review.getEnroll_type_id().intValue() == 2) {
if((review.getReview_round().intValue() <= 1 && review_round.intValue() >= 3)
|| (review.getReview_round().intValue() <= 2 && review_round.intValue() >= 4)) {
int reviewRound = review.getReview_round();
int enrollType = review.getEnroll_type_id();
int optState = review.getOpt_state();
if(toRoundNumber > reviewRound) {
if(optState == 2) {
if(enrollType == 2 && ((reviewRound <= 1 && reviewRound >= 3) || (reviewRound <= 2 && reviewRound >= 4))) {
throw new XRException("亚新二选和三选评分不能跳过");
}
}
if(review.getReview_state().intValue() == 5 && review.getEnroll_type_id().intValue() != 4) {
reviewService.toType4(review.getId());
}
if((enrollType == 2 || enrollType == 3) && toRoundNumber == 5) {
throw new XRException("亚新金爵影片没有把关流程");
}
if(enrollType == 4 && (toRoundNumber == 3 || toRoundNumber == 6)) {
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 {
throw new XRException("审片流程不能后退");
}
return Rjx.jsonOk();
}
static String[] rounds = new String[] {"", "一选", "二选", "三选", "影片把关", "选片委员会", "总局审片"};
static String[] opts = new String[] {"未审片", "有争议", "待分配", "已完成"};
@ResponseBody
@Transactional
@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