Commit 44ff3a6e authored by Quxl's avatar Quxl

x

parent b0002450
...@@ -92,6 +92,8 @@ public interface ReviewService { ...@@ -92,6 +92,8 @@ public interface ReviewService {
void tryNextRound(Integer review_id); void tryNextRound(Integer review_id);
void createAsiaNewReport(int review_id, int review_round);
void save(Object obj); void save(Object obj);
void saveReviewRecordIfNotExists(Integer review_id, Integer review_round, Integer[] user_id); void saveReviewRecordIfNotExists(Integer review_id, Integer review_round, Integer[] user_id);
......
...@@ -393,7 +393,7 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -393,7 +393,7 @@ public class ReviewServiceImpl implements ReviewService {
} }
} }
if(enrollType == 2 && (reviewRound == 2 || reviewRound == 3)) { if(enrollType == 2 && (reviewRound == 2 || reviewRound == 3)) {
this.createAsiaNewReport(review.getId()); this.createAsiaNewReport(review.getId().intValue(), reviewRound);
} }
} }
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());
...@@ -408,23 +408,22 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -408,23 +408,22 @@ public class ReviewServiceImpl implements ReviewService {
jdbcTemplate.save(history); jdbcTemplate.save(history);
} }
public void createAsiaNewReport(Integer review_id) { public void createAsiaNewReport(int review_id, int review_round) {
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(); int enrollType = review.getEnroll_type_id();
int optState = review.getOpt_state(); int optState = review.getOpt_state();
if(enrollType == 2 && (round == 2 || round == 3) && optState == 2) { if(enrollType == 2 && optState == 2) {
Fc_member_film film = filmService.queryMemberFilmById(review.getFilm_id().longValue()); Fc_member_film film = filmService.queryMemberFilmById(review.getFilm_id().longValue());
Fc_report_asia_new asiaNew = new Fc_report_asia_new(); Fc_report_asia_new asiaNew = new Fc_report_asia_new();
asiaNew.setReview_id(review_id); asiaNew.setReview_id(review_id);
asiaNew.setReview_round(round); asiaNew.setReview_round(review_round);
asiaNew.setFilm_id(review.getFilm_id()); asiaNew.setFilm_id(review.getFilm_id());
asiaNew.setCn_name(film.getCn_name()); asiaNew.setCn_name(film.getCn_name());
asiaNew.setEn_name(film.getEn_name()); asiaNew.setEn_name(film.getEn_name());
asiaNew.setOriginal_name(film.getOrigion_name()); asiaNew.setOriginal_name(film.getOrigion_name());
Map<String, Object> fields = new HashMap<String, Object>(); Map<String, Object> fields = new HashMap<String, Object>();
String sql = "select rr.user_group_id, rre.ext_type, rre.ext_name, avg(rre.ext_score) ext_score from fc_review_record rr, fc_review_record_ext rre where rre.record_id = rr.id and rr.review_id = " + review_id + " group by rr.user_group_id, rre.ext_type, rre.ext_name"; String sql = "select rr.user_group_id, rre.ext_type, rre.ext_name, avg(rre.ext_score) ext_score from fc_review_record rr, fc_review_record_ext rre where rre.record_id = rr.id and rr.review_id = " + review_id + " and rr.review_round = " + review_round + " group by rr.user_group_id, rre.ext_type, rre.ext_name";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
for(Map<String, Object> map : list) { for(Map<String, Object> map : list) {
Integer user_group_id = (Integer)map.get("user_group_id"); Integer user_group_id = (Integer)map.get("user_group_id");
......
...@@ -28,6 +28,7 @@ import com.egolm.film.bean.Fc_admin; ...@@ -28,6 +28,7 @@ import com.egolm.film.bean.Fc_admin;
import com.egolm.film.bean.Fc_logs_ext; import com.egolm.film.bean.Fc_logs_ext;
import com.egolm.film.bean.Fc_member_film; import com.egolm.film.bean.Fc_member_film;
import com.egolm.film.bean.Fc_member_film_enroll; import com.egolm.film.bean.Fc_member_film_enroll;
import com.egolm.film.bean.Fc_review;
import com.egolm.film.config.XRException; import com.egolm.film.config.XRException;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -173,4 +174,22 @@ public class WebUtilController { ...@@ -173,4 +174,22 @@ public class WebUtilController {
return Rjx.jsonOk(); return Rjx.jsonOk();
} }
@ResponseBody
@Transactional
@PostMapping("initAsiaNewBest")
@ApiOperation("初始化亚新榜单")
public Object initAsiaNewBest() {
this.verifyAuth();
List<Fc_review> reviews = jdbcTemplate.queryForBeans("select * from fc_review where enroll_type_id = 2 and review_round >= 2", Fc_review.class);
for(Fc_review review : reviews) {
if(review.getReview_round().intValue() >= 2) {
service.createAsiaNewReport(review.getId(), 2);
}
if(review.getReview_round().intValue() >= 3) {
service.createAsiaNewReport(review.getId(), 3);
}
}
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