Commit 4ca90b26 authored by Quxl's avatar Quxl

x

parent a262a66e
......@@ -3,7 +3,6 @@ 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 {
......@@ -12,5 +11,4 @@ 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(Integer user_id);
}
......@@ -135,5 +135,5 @@ public interface ReviewService {
boolean isBeginReview(Long film_id);
Map<String, Object> queryFilmReport(Integer user_id);
}
\ No newline at end of file
package com.egolm.film.api.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
......@@ -13,7 +12,6 @@ import org.springframework.stereotype.Service;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.FilmReportService;
......@@ -174,41 +172,4 @@ public class FilmReportServiceImpl implements FilmReportService {
return res;
}
static BigDecimal NUM_100 = BigDecimal.valueOf(100);
@Override
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 where rr.user_id = " + user_id;
Integer count_quanbu = jdbcTemplate.queryForInt("select count(*) from (" + base + ") t");
Integer count_canzan = jdbcTemplate.queryForInt("select count(*) from (" + base + ") t where t.review_state = 5 or (t.review_state = 1 and (t.enroll_type_id = 4))");
Integer count_cansai = jdbcTemplate.queryForInt("select count(*) from (" + base + ") t where t.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(*) from (" + base + ") t where t.review_state = 2");
Integer count_csbx = jdbcTemplate.queryForInt("select count(*) from (" + base + ") t where t.review_state = 4");
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).multiply(NUM_100).divide(count, 2, BigDecimal.ROUND_HALF_UP)) + "%");
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).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);
count_foujue_map.put("rate", (count.compareTo(BigDecimal.ZERO) == 0 ? "0.00" : new BigDecimal(count_foujue).multiply(NUM_100).divide(count, 2, BigDecimal.ROUND_HALF_UP)) + "%");
return Rjx.jsonOk().set("count", count_quanbu).setData(new Object[] {count_canzan_map, count_cansai_map, count_foujue_map});
}
}
......@@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSON;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.FilmService;
......@@ -683,4 +684,42 @@ public class ReviewServiceImpl implements ReviewService {
return jdbcTemplate.queryForInt("select count(rr.id) from fc_review_record rr, fc_review r where rr.review_id = r.id and r.film_id = " + film_id) > 0;
}
@Override
public Map<String, Object> queryFilmReport(Integer user_id) {
BigDecimal NUM_100 = BigDecimal.valueOf(100);
String base = "select rr.*, r.enroll_type_id from fc_review_record rr left join fc_review r on r.id = rr.review_id where rr.user_id = " + user_id;
Integer count_quanbu = jdbcTemplate.queryForInt("select count(*) from (" + base + ") t");
Integer count_canzan = jdbcTemplate.queryForInt("select count(*) from (" + base + ") t where t.review_state = 5 or (t.review_state = 1 and (t.enroll_type_id = 4))");
Integer count_cansai = jdbcTemplate.queryForInt("select count(*) from (" + base + ") t where t.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(*) from (" + base + ") t where t.review_state = 2");
Integer count_csbx = jdbcTemplate.queryForInt("select count(*) from (" + base + ") t where t.review_state = 4");
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).multiply(NUM_100).divide(count, 2, BigDecimal.ROUND_HALF_UP)) + "%");
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).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);
count_foujue_map.put("rate", (count.compareTo(BigDecimal.ZERO) == 0 ? "0.00" : new BigDecimal(count_foujue).multiply(NUM_100).divide(count, 2, BigDecimal.ROUND_HALF_UP)) + "%");
return Rjx.json().set("count", count_quanbu).setData(new Object[] {count_canzan_map, count_cansai_map, count_foujue_map});
}
}
\ No newline at end of file
......@@ -12,8 +12,6 @@ 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;
......@@ -86,16 +84,4 @@ public class ReportController {
return Rjx.jsonOk().setData(filmReportService.directorDetail(playactor_name));
}
@Autowired
UserTokenService userTokenService;
@ResponseBody
@PostMapping("film_report")
@ApiOperation("审片报表")
public Object directorDetail() {
LoginToken token = userTokenService.getToken();
Integer user_id = (Integer)token.getId();
return filmReportService.queryFilmReport(user_id);
}
}
package com.egolm.film.api.web.user;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.bean.Rjx;
import com.egolm.film.api.service.ReviewService;
import com.egolm.film.api.service.UserTokenService;
import com.egolm.film.model.LoginToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api
@RestController
@RequestMapping("/user/report")
public class UserReportController {
@Autowired
ReviewService reviewService;
@Autowired
UserTokenService userTokenService;
@ResponseBody
@PostMapping("film_report")
@ApiOperation("审片报表")
public Object directorDetail() {
LoginToken token = userTokenService.getToken();
Integer user_id = (Integer)token.getId();
Map<String, Object> map = reviewService.queryFilmReport(user_id);
Rjx rjx = Rjx.jsonOk();
rjx.putAll(map);
return rjx;
}
}
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