Commit 1bc39bc7 authored by Quxl's avatar Quxl

x

parent 028835df
......@@ -8,6 +8,7 @@ import com.egolm.common.jdbc.Page;
import com.egolm.film.bean.Fc_review;
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;
public interface ReviewService {
......@@ -21,6 +22,8 @@ public interface ReviewService {
List<Map<String, Object>> queryDoubtfulListByFilmId(Integer film_id, Integer user_id);
void saveReviewRecord(Fc_review_record ru);
Fc_review_record queryReviewRecord(Integer user_id, Integer review_id);
void saveReviewRecord(Fc_review_record ru, List<Fc_review_record_ext> exts);
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
......@@ -15,6 +16,7 @@ import com.egolm.film.api.service.ReviewService;
import com.egolm.film.bean.Fc_review;
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;
import com.egolm.film.util.SqlWhere;
@Service
......@@ -83,9 +85,16 @@ public class ReviewServiceImpl implements ReviewService {
}
@Override
public void saveReviewRecord(Fc_review_record ru) {
jdbcTemplate.save(ru);
public Fc_review_record queryReviewRecord(Integer user_id, Integer review_id) {
return jdbcTemplate.queryForBean("select * from fc_review_record where user_id = ? and review_id = ?", Fc_review_record.class, user_id, review_id);
}
@Override
@Transactional
public void saveReviewRecord(Fc_review_record ru, List<Fc_review_record_ext> exts) {
jdbcTemplate.update(ru);
jdbcTemplate.executeUpdate("delete from fc_review_record_ext where record_id = ?", ru.getId());
jdbcTemplate.batchSave(exts);
}
}
package com.egolm.film.api.web.user;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -19,6 +20,8 @@ import com.egolm.film.api.service.ReviewService;
import com.egolm.film.api.service.UserTokenService;
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;
import com.egolm.film.config.XException;
import com.egolm.film.model.LoginToken;
import io.swagger.annotations.Api;
......@@ -101,13 +104,13 @@ public class UserReviewController {
@ResponseBody
@Transactional
@PostMapping("user_review")
@PostMapping("doReview")
@ApiOperation("评委审片")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "int", required = false, name = "review_id", value="审片ID"),
@ApiImplicitParam(paramType = "query", dataType = "int", required = false, name = "review_state", value="审片结论(2通过,3否决,4参赛,5参赛备选,6参展)"),
@ApiImplicitParam(paramType = "query", dataType = "double", required = false, name = "review_score", value="评分"),
@ApiImplicitParam(paramType = "query", dataType = "string", required = false, name = "review_text", value="评语"),
@ApiImplicitParam(paramType = "query", dataType = "string", required = false, name = "review_text", value="评语"),
@ApiImplicitParam(paramType = "query", dataType = "string", required = false, name = "review_text_1", value="评语1"),
@ApiImplicitParam(paramType = "query", dataType = "string", required = false, name = "review_text_2", value="评语2"),
@ApiImplicitParam(paramType = "query", dataType = "string", required = false, name = "review_text_3", value="评语3"),
......@@ -116,12 +119,10 @@ public class UserReviewController {
@ApiImplicitParam(paramType = "query", dataType = "double", required = false, allowMultiple=true, name = "enroll_ext_score", value="才赛奖项得分"),
@ApiImplicitParam(paramType = "query", dataType = "string", required = false, allowMultiple=true, name = "enroll_ext_text", value="才赛奖项评语"),
})
public Object saveReviewRecord(Integer review_id, Integer review_state, Double review_score, String review_text, String review_text_1, String review_text_2, String review_text_3, String review_text_4, Integer[] enroll_ext_id, Double[]enroll_ext_score, String[] enroll_ext_text) {
public Object doReview(Integer review_id, Integer review_state, Double review_score, String review_text, String review_text_1, String review_text_2, String review_text_3, String review_text_4, Integer[] enroll_ext_id, Double[]enroll_ext_score, String[] enroll_ext_text) {
LoginToken token = tokenService.getToken();
Integer user_id = (Integer)token.getId();
Fc_review_record ru = new Fc_review_record();
ru.setReview_id(review_id);
ru.setUser_id(user_id);
Fc_review_record ru = service.queryReviewRecord(user_id, review_id);
ru.setReview_score(review_score);
ru.setReview_state(review_state);
ru.setReview_text(review_text_4);
......@@ -129,9 +130,20 @@ public class UserReviewController {
ru.setReview_text_2(review_text_2);
ru.setReview_text_3(review_text_3);
ru.setReview_text_4(review_text_4);
service.saveReviewRecord(ru);
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) {
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());
ext.setEnroll_ext_id(enroll_ext_id[i]);
ext.setEnroll_ext_score(enroll_ext_score[i]);
ext.setEnroll_ext_text(enroll_ext_text[i]);
exts.add(ext);
}
} else {
throw new XException("评奖项目参数数量错误");
}
service.saveReviewRecord(ru, exts);
return Rjx.jsonOk();
}
......
......@@ -19,16 +19,9 @@ public class Fc_review_record_ext implements java.io.Serializable {
private Integer id;
/**
* 影片性质
* 评委评审记录ID
*/
@Id
private Integer review_id;
/**
* 评委ID
*/
@Id
private Integer user_id;
private Integer record_id;
/**
* 影片申报奖项ID
......@@ -56,16 +49,14 @@ public class Fc_review_record_ext implements java.io.Serializable {
/**
* 全参数构造方法
* @param id 影片ID
* @param review_id 影片性质
* @param user_id 评委ID
* @param record_id 评委评审记录ID
* @param enroll_ext_id 影片申报奖项ID
* @param enroll_ext_score 影片申报奖项评分
* @param enroll_ext_text 评委审片结论
*/
public Fc_review_record_ext(Integer id, Integer review_id, Integer user_id, Integer enroll_ext_id, Double enroll_ext_score, String enroll_ext_text) {
public Fc_review_record_ext(Integer id, Integer record_id, Integer enroll_ext_id, Double enroll_ext_score, String enroll_ext_text) {
this.id = id;
this.review_id = review_id;
this.user_id = user_id;
this.record_id = record_id;
this.enroll_ext_id = enroll_ext_id;
this.enroll_ext_score = enroll_ext_score;
this.enroll_ext_text = enroll_ext_text;
......@@ -79,20 +70,12 @@ public class Fc_review_record_ext implements java.io.Serializable {
return id;
}
public void setReview_id(Integer review_id) {
this.review_id = review_id;
}
public Integer getReview_id() {
return review_id;
}
public void setUser_id(Integer user_id) {
this.user_id = user_id;
public void setRecord_id(Integer record_id) {
this.record_id = record_id;
}
public Integer getUser_id() {
return user_id;
public Integer getRecord_id() {
return record_id;
}
public void setEnroll_ext_id(Integer enroll_ext_id) {
......
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