Commit bdffb70e authored by Quxl's avatar Quxl

x

parent dd12f2f0
......@@ -12,5 +12,5 @@ public interface FilmReportService {
Map<String, Object> applyTypeReport();
List<Map<String, Object>> directorReport(String playactor_name, Page page);
Map<String, Object> directorDetail(String playactor_name);
Rjx queryFilmReport();
Rjx queryFilmReport(Integer user_id);
}
......@@ -177,11 +177,15 @@ public class FilmReportServiceImpl implements FilmReportService {
static BigDecimal NUM_100 = BigDecimal.valueOf(100);
@Override
public Rjx queryFilmReport() {
Integer count_quanbu = jdbcTemplate.queryForInt("select count(id) from fc_review");
Integer count_canzan = jdbcTemplate.queryForInt("select count(id) from fc_review where opt_state = 3 and (enroll_type_id = 4 and review_state = 1)");
Integer count_cansai = jdbcTemplate.queryForInt("select count(id) from fc_review where opt_state = 3 and ((enroll_type_id = 1 and review_state = 1) or (enroll_type_id = 2 and review_state = 1))");
Integer count_foujue = jdbcTemplate.queryForInt("select count(id) from fc_review where opt_state = 3 and review_state = 2");
public Rjx queryFilmReport(Integer user_id) {
String base = "select rr.*, r.enroll_type_id from fc_review_record rr left join fc_review r on r.id = rr.review_id";
Integer count_quanbu = jdbcTemplate.queryForInt("select count(t.*) from (" + base + ") t");
Integer count_canzan = jdbcTemplate.queryForInt("select count(t.*) from (" + base + ") t where review_state = 5 or (t.review_state = 1 and t.enroll_type_id == 4)");
Integer count_cansai = jdbcTemplate.queryForInt("select count(t.*) from (" + base + ") t where review_state = 3 or (t.review_state = 1 and (t.enroll_type_id == 1 or t.enroll_type_id == 2))");
Integer count_foujue = jdbcTemplate.queryForInt("select count(t.*) from (" + base + ") t where review_state = 2");
Integer count_csbx = jdbcTemplate.queryForInt("select count(t.*) from (" + base + ") t where review_state = 4");
BigDecimal count = new BigDecimal(count_quanbu);
......@@ -195,6 +199,11 @@ public class FilmReportServiceImpl implements FilmReportService {
count_cansai_map.put("count", count_cansai);
count_cansai_map.put("rate", (count.compareTo(BigDecimal.ZERO) == 0 ? "0.00" : new BigDecimal(count_cansai).multiply(NUM_100).divide(count, 2, BigDecimal.ROUND_HALF_UP)) + "%");
Map<String, Object> count_csbx_map = new HashMap<String, Object>();
count_csbx_map.put("title", "参赛备选");
count_csbx_map.put("count", count_csbx);
count_csbx_map.put("rate", (count.compareTo(BigDecimal.ZERO) == 0 ? "0.00" : new BigDecimal(count_csbx).multiply(NUM_100).divide(count, 2, BigDecimal.ROUND_HALF_UP)) + "%");
Map<String, Object> count_foujue_map = new HashMap<String, Object>();
count_foujue_map.put("title", "否决");
count_foujue_map.put("count", count_foujue);
......
......@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.FilmReportService;
import com.egolm.film.api.service.UserTokenService;
import com.egolm.film.model.LoginToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -84,11 +86,16 @@ public class ReportController {
return Rjx.jsonOk().setData(filmReportService.directorDetail(playactor_name));
}
@Autowired
UserTokenService userTokenService;
@ResponseBody
@PostMapping("film_report")
@ApiOperation("审片报表")
public Object directorDetail() {
return filmReportService.queryFilmReport();
LoginToken token = userTokenService.getToken();
Integer user_id = (Integer)token.getId();
return filmReportService.queryFilmReport(user_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