Commit ee1a644f authored by Quxl's avatar Quxl

x

parent ac05a510
......@@ -3,6 +3,7 @@ package com.egolm.film.api.service;
import java.util.List;
import java.util.Map;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
public interface FilmReportService {
......@@ -11,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);
Object queryFilmReport();
Rjx queryFilmReport();
}
......@@ -177,21 +177,29 @@ public class FilmReportServiceImpl implements FilmReportService {
static BigDecimal NUM_100 = BigDecimal.valueOf(100);
@Override
public Object queryFilmReport() {
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");
Map<String, Object> count_canzan_map = new HashMap<String, Object>();
Map<String, Object> count_cansai_map = new HashMap<String, Object>();
Map<String, Object> count_foujue_map = new HashMap<String, Object>();
BigDecimal count = new BigDecimal(count_quanbu);
Map<String, Object> count_canzan_map = new HashMap<String, Object>();
count_canzan_map.put("title", "参展");
count_canzan_map.put("count", count_canzan);
count_canzan_map.put("rate", (count.compareTo(BigDecimal.ZERO) == 0 ? "0.00" : new BigDecimal(count_canzan).divide(count).multiply(NUM_100).setScale(2)) + "%");
Map<String, Object> count_cansai_map = new HashMap<String, Object>();
count_cansai_map.put("title", "参赛");
count_cansai_map.put("count", count_cansai);
count_cansai_map.put("rate", (count.compareTo(BigDecimal.ZERO) == 0 ? "0.00" : new BigDecimal(count_cansai).divide(count).multiply(NUM_100).setScale(2)) + "%");
Map<String, Object> count_foujue_map = new HashMap<String, Object>();
count_foujue_map.put("title", "否决");
count_foujue_map.put("count", count_foujue);
count_foujue_map.put("rate", (count.compareTo(BigDecimal.ZERO) == 0 ? "0.00" : new BigDecimal(count_foujue).divide(count).multiply(NUM_100).setScale(2)) + "%");
return Rjx.jsonOk().set("count", count_quanbu).set("cansai", count_cansai_map).set("canzhan", count_canzan_map).set("foujue", count_foujue_map);
return Rjx.jsonOk().set("count", count_quanbu).setData(new Object[] {count_canzan_map, count_cansai_map, count_foujue_map});
}
}
......@@ -88,7 +88,7 @@ public class FilmReportController {
@PostMapping("film_report")
@ApiOperation("影片报表")
public Object filmReport() {
return Rjx.jsonOk().setData(filmReportService.queryFilmReport());
return filmReportService.queryFilmReport();
}
......
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