Commit c05e4f16 authored by Quxl's avatar Quxl

x

parent f1ec877a
......@@ -6,6 +6,10 @@ public interface VoteService {
* 进入下一个审片环节
* @param member_film_id
*/
void toNextRound(Long member_film_id, Integer enroll_type_id);
void toFirstRound(Long member_film_id, Integer enroll_type_id);
void toNextRound(Integer review_id);
void tryNextRound(Integer review_id);
}
package com.egolm.film.api.service.impl;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -9,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.film.api.service.VoteService;
import com.egolm.film.bean.Fc_review;
import com.egolm.film.bean.Fc_review_record;
@Service
public class VoteServiceImpl implements VoteService {
......@@ -18,13 +23,8 @@ public class VoteServiceImpl implements VoteService {
@Override
@Transactional
public void toNextRound(Long member_film_id, Integer enroll_type_id) {
public void toFirstRound(Long member_film_id, Integer enroll_type_id) {
Date now = new Date();
try {
Fc_review review = jdbcTemplate.queryForBean("select * from fc_review where film_id = ? and enroll_type_id = ?", Fc_review.class, member_film_id, enroll_type_id);
Integer count = jdbcTemplate.queryForInt("select count(*) from fc_review_record where review_id = ?", review.getId());
jdbcTemplate.executeUpdate("update fc_review set review_round = review_round + 1, review_state = ?, push_time = ? where review_id = ?", count > 0 ? 1 : 0, now, review.getId());
} catch (Exception e) {
Fc_review review = new Fc_review();
review.setEnroll_type_id(enroll_type_id);
review.setFilm_id(member_film_id.intValue());
......@@ -34,6 +34,78 @@ public class VoteServiceImpl implements VoteService {
review.setCreate_time(now);
jdbcTemplate.save(review);
}
@Override
@Transactional
public void toNextRound(Integer review_id) {
Integer count = jdbcTemplate.queryForInt("select count(*) from fc_review_record where review_id = ?", review_id);
jdbcTemplate.executeUpdate("update fc_review set review_round = review_round + 1, review_state = ?, push_time = ? where id = ?", count > 0 ? 1 : 0, new Date(), review_id);
}
private Integer reviewStateElection(List<Fc_review_record> records) {
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for(Fc_review_record record : records) {
Integer review_state = record.getReview_state();;
if(review_state.intValue() <= 1) {
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) {
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;
}
}
return null;
}
/**
* 1剧情
* 2纪录
* 3动画
* 4短片
*/
@Override
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 = ?", Fc_review_record.class, review.getId());
Integer enroll_type_id = review.getEnroll_type_id();
Integer review_round = review.getReview_round();
Integer review_state = this.reviewStateElection(records);
if(review_state != null) {
if(review_round == 1) {
}
} else {
//TODO 审片结论有争议,打标记 后续增加评委后再审
}
if(enroll_type_id.intValue() == 1) {//金爵奖国际影片评选
if(review_round.intValue() == 1) {
}
} else if(enroll_type_id.intValue() == 2) {//亚洲新人奖国际影片评选
} else if(enroll_type_id.intValue() == 3) {//电影频道传媒关注
} else if(enroll_type_id.intValue() == 4) {//国际电影展映
}
}
}
......@@ -42,7 +42,6 @@ public class FilmController {
List<Fc_member_film_issuer> issuerList = memberFilmService.queryMemberFilmIssuerList(memberFilm.getId());
List<Fc_member_film_playactor> playactorList = memberFilmService.queryMemberFilmPlayactorList(memberFilm.getId());
List<Fc_member_film_show> showList = memberFilmService.queryMemberFilmShowList(memberFilm.getId());
return Rjx.jsonOk()
.setData(memberFilm)
.set("issuerList", issuerList)
......
......@@ -121,7 +121,7 @@ public class AdminFirstController {
memberFilmService.pass(member_film_id);
List<Fc_member_film_enroll> enrolls = memberFilmService.queryFilmEnrollList(member_film_id);
for(Fc_member_film_enroll enroll : enrolls) {
voteService.toNextRound(member_film_id, enroll.getEnroll_type_id());
voteService.toFirstRound(member_film_id, enroll.getEnroll_type_id());
}
Fc_member_film memberFilm = memberFilmService.queryMemberFilmById(member_film_id);
Fc_member member = memberService.getMemberById(memberFilm.getMember_id());
......
......@@ -18,6 +18,7 @@ import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.FilmService;
import com.egolm.film.api.service.ReviewService;
import com.egolm.film.api.service.UserTokenService;
import com.egolm.film.api.service.VoteService;
import com.egolm.film.bean.Fc_review_doubtful;
import com.egolm.film.bean.Fc_review_record;
import com.egolm.film.bean.Fc_review_record_ext;
......@@ -43,6 +44,9 @@ public class UserReviewController {
@Autowired
FilmService filmService;
@Autowired
VoteService voteService;
@ResponseBody
@PostMapping("review_list")
@ApiOperation("审核列表")
......@@ -131,7 +135,7 @@ public class UserReviewController {
ru.setReview_text_3(review_text_3);
ru.setReview_text_4(review_text_4);
List<Fc_review_record_ext> exts = new ArrayList<Fc_review_record_ext>();
if(enroll_ext_id.length == enroll_ext_score.length && enroll_ext_score.length == enroll_ext_text.length) {
if(enroll_ext_id != null && enroll_ext_score != null && enroll_ext_text != null && enroll_ext_id.length == enroll_ext_score.length && enroll_ext_score.length == enroll_ext_text.length) {
for(int i = 0; i < enroll_ext_id.length; i++) {
Fc_review_record_ext ext = new Fc_review_record_ext();
ext.setRecord_id(ru.getId());
......@@ -144,6 +148,7 @@ public class UserReviewController {
throw new XException("评奖项目参数数量错误");
}
service.saveReviewRecord(ru, exts);
voteService.tryNextRound(review_id);
return Rjx.jsonOk();
}
......
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