Commit 2c1a25f5 authored by Quxl's avatar Quxl

x

parent a1fde6da
...@@ -457,21 +457,12 @@ public class FilmServiceImpl implements FilmService { ...@@ -457,21 +457,12 @@ public class FilmServiceImpl implements FilmService {
@Override @Override
@Transactional @Transactional
public void toNextRound(Long member_film_id, Integer enroll_type_id) { public void toNextRound(Long member_film_id, Integer enroll_type_id) {
Fc_review reviewTmp = null; Integer count = jdbcTemplate.executeUpdate("update fc_review set review_round = review_round + 1 where film_id = ? and enroll_type_id = ?", member_film_id, enroll_type_id);
Integer nextRound = null;
try {
reviewTmp = jdbcTemplate.queryForBean("select * from fc_review where film_id = ? and enroll_type_id = ?", Fc_review.class, member_film_id, enroll_type_id);
nextRound = reviewTmp.getReview_round() == null ? 1 : (reviewTmp.getReview_round()+1);
} catch (Exception e) {
nextRound = 1;
}
jdbcTemplate.executeUpdate("update fc_review set review_round = ? where film_id = ? and enroll_type_id = ?", nextRound, member_film_id, enroll_type_id);
Integer count = jdbcTemplate.queryForInt("select count(id) from fc_review where film_id = ? and review_round = ? and enroll_type_id = ?", member_film_id, nextRound, enroll_type_id);
if(count == 0) { if(count == 0) {
Fc_review review = new Fc_review(); Fc_review review = new Fc_review();
review.setEnroll_type_id(enroll_type_id); review.setEnroll_type_id(enroll_type_id);
review.setFilm_id(member_film_id.intValue()); review.setFilm_id(member_film_id.intValue());
review.setReview_round(nextRound); review.setReview_round(1);
review.setReview_state(0); review.setReview_state(0);
review.setCreate_time(new Date()); review.setCreate_time(new Date());
jdbcTemplate.save(review); jdbcTemplate.save(review);
......
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