Commit c601a456 authored by 曲欣红's avatar 曲欣红

1

parent 1ee4876c
package com.egolm.film.api.service;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.Page;
public interface FilmReportService {
Map<String, Object> uploadReport(String start_date, String end_date);
Map<String, Object> applyTypeReport();
List<Map<String, Object>> directorReport(String playactor_name, Page page);
Map<String, Object> directorDetail(String playactor_name);
}
......@@ -10,10 +10,14 @@ import java.util.Map.Entry;
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;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.FilmReportService;
import com.egolm.film.util.SqlWhere;
@Service
public class FilmReportServiceImpl implements FilmReportService {
......@@ -94,9 +98,6 @@ public class FilmReportServiceImpl implements FilmReportService {
res.put("list", dataLsit);
return res;
}
/**
* select ee.enroll_type enroll_type_id, ee.enroll_type_name enroll_type_name, fmfe.film_id film_id, fmf.cn_name cn_name from fc_member_film fmf, fc_member_film_enroll fmfe, enum_enroll ee where fmf.id = fmfe.film_id and fmfe.enroll_type_id = ee.enroll_type
*/
@Override
public Map<String, Object> applyTypeReport() {
......@@ -136,9 +137,62 @@ public class FilmReportServiceImpl implements FilmReportService {
res.put("show_type_group_list", showTypeGroup);
return res;
}
public static void main(String[] args) {
System.out.println(1D/99L);
@Override
public List<Map<String, Object>> directorReport(String playactor_name, Page page) {
String sql = "select * from (select count(1) count, t.playactor_name playactor_name, max(t.create_time) create_time from (select fmfp.playactor_name, fmf.create_time from fc_member_film_playactor fmfp, fc_member_film fmf where fmfp.film_id = fmf.id order by fmf.create_time desc) t group by t.playactor_name) t2 where t2.playactor_name like ? order by t2.create_time desc";
List<Map<String, Object>> res = jdbcTemplate.limit(sql, page, "%"+playactor_name+"%");
List<String> directors = new ArrayList<>();
for (Map<String, Object> map : res) {
directors.add("'"+(String)map.get("playactor_name")+"'");
}
String sql2 = "select "
+ "fmf.origion_name origion_name, "
+ "fmf.en_name en_name, "
+ "fmf.cn_name cn_name, "
+ "fmfp.playactor_name playactor_name "
+ "from "
+ "fc_member_film_playactor fmfp, "
+ "fc_member_film fmf "
+ "where "
+ "fmfp.film_id = fmf.id "
+ "and "
+ "fmfp.playactor_name "
+ "in ( "
+ StringUtil.join(", ", directors)
+ ")";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql2);
for (Map<String, Object> map : res) {
String playactoName = (String)map.get("playactor_name");
List<Map<String, Object>> itemList = new ArrayList<>();
for (Map<String, Object> map2 : list) {
if(map2.get("playactor_name").equals(playactoName)) {
itemList.add(map2);
}
}
map.put("film_list", itemList);
}
return res;
}
@Override
public Map<String, Object> directorDetail(String playactor_name) {
String sql = "select "
+ "fmf.origion_name origion_name, "
+ "fmf.en_name en_name, "
+ "fmf.cn_name cn_name, "
+ "fmfp.playactor_name playactor_name, "
+ "DATE_FORMAT(from_unixtime(fmf.create_time),'%Y') apply_year "
+ "from "
+ "fc_member_film_playactor fmfp, "
+ "fc_member_film fmf "
+ "where "
+ "fmfp.film_id = fmf.id "
+ "and "
+ "fmfp.playactor_name = ?";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, playactor_name);
Map<String, Object> res = new HashMap<>();
res.put("playactor_name", playactor_name);
res.put("list", list);
return res;
}
}
package com.egolm.film.api.web.report;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -9,6 +11,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
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 io.swagger.annotations.Api;
......@@ -40,7 +43,7 @@ public class FilmReportController {
@ResponseBody
@PostMapping("apply_type_report")
@ApiOperation("上传影片统计")
@ApiOperation("影片报名类型统计")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", dataType="string", name="i18n_language"),
})
......@@ -48,4 +51,37 @@ public class FilmReportController {
return Rjx.jsonOk()
.setData(filmReportService.applyTypeReport());
}
@ResponseBody
@PostMapping("director_peport")
@ApiOperation("导演统计")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", dataType="string", name="i18n_language"),
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="playactor_name", value="导演"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="index", value="分页编号"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="limit", value="分页大小"),
})
public Object directorList(String playactor_name, Long index, Long limit) {
index = index == null ? 1L : index;
limit = limit == null ? 20L : limit;
System.out.println(index);
System.out.println(limit);
Page page = new Page(index, limit);
playactor_name = playactor_name==null ? "" : playactor_name;
List<Map<String, Object>> list = filmReportService.directorReport(playactor_name, page);
return Rjx.jsonOk().setData(list).setPage(page);
}
@ResponseBody
@PostMapping("director_detail_peport")
@ApiOperation("导演历年详情")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", dataType="string", name="i18n_language"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="playactor_name", value="导演"),
})
public Object directorDetail(String playactor_name) {
return Rjx.jsonOk().setData(filmReportService.directorDetail(playactor_name));
}
}
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