Commit fc015f76 authored by Quxl's avatar Quxl

增加部分审片接口

parent 7502085e
package com.egolm.film.api.user;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.member.MemberApplyController;
import com.egolm.film.api.user.service.UserReviewService;
import com.egolm.film.api.user.service.UserTokenService;
import com.egolm.film.model.LoginToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api
@Controller
@RequestMapping("user/review")
public class UserReviewController {
@Autowired
private UserTokenService tokenService;
@Autowired
private UserReviewService reviewService;
@ResponseBody
@PostMapping("review_list")
@ApiOperation("已审核列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "long", required = false, name = "index", value="分页页码"),
@ApiImplicitParam(paramType = "query", dataType = "long", required = false, name = "limit", value="分页大小"),
@ApiImplicitParam(paramType = "query", dataType = "string", required = false, name = "limitKey", value="分页排序", allowMultiple=true),
})
public Object getReviewList(Long index, Long limit, String[] limitKey) {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
LoginToken loginToken = tokenService.getToken();
Integer user_id = (Integer)loginToken.getId();
Page page = new Page(index, limit, limitKey);
List<Map<String, Object>> list = reviewService.limitReviewByUserId(user_id, page);
return Rjx.jsonOk().setData(list).setPage(page);
}
@ResponseBody
@PostMapping("unview_list")
@ApiOperation("未审核列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "long", required = false, name = "index", value="分页页码"),
@ApiImplicitParam(paramType = "query", dataType = "long", required = false, name = "limit", value="分页大小"),
@ApiImplicitParam(paramType = "query", dataType = "string", required = false, name = "limitKey", value="分页排序", allowMultiple=true),
})
public Object getUnviewList(Long index, Long limit, String[] limitKey) {
LoginToken loginToken = tokenService.getToken();
Integer user_id = (Integer)loginToken.getId();
Page page = new Page(index, limit, limitKey);
List<Map<String, Object>> list = reviewService.limitUnviewByUserId(user_id, page);
return Rjx.jsonOk().setData(list).setPage(page);
}
@ResponseBody
@PostMapping("allot_detail")
@ApiOperation("影片信息详情")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", dataType = "long", required = true, name = "film_id", value="影片ID"),
})
public Object getAllotDetail(Long film_id) {
Map<String, Object> map = reviewService.queryAllotDetailByFilmId(film_id);
Long member_film_id = reviewService.queryMemberFilmIdByFilmId(film_id);
return Rjx.jsonOk().setData(map).set("member_film_id", member_film_id);
}
@Autowired
MemberApplyController memberApplyController;
@ResponseBody
@PostMapping("member_film_detail")
@ApiOperation("获取全部申报信息")
@ApiImplicitParams({@ApiImplicitParam(paramType="query", dataType="long", required=true, name="member_film_id", value="申报影片ID")})
public Object getMemberFilmDetail(Long member_film_id) {
return memberApplyController.getDetail(member_film_id);
}
}
package com.egolm.film.api.user.service;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.Page;
public interface UserReviewService {
List<Map<String, Object>> limitReviewByUserId(Integer user_id, Page page);
List<Map<String, Object>> limitUnviewByUserId(Integer user_id, Page page);
Map<String, Object> queryAllotDetailByFilmId(Long film_id);
Long queryMemberFilmIdByFilmId(Long film_id);
}
package com.egolm.film.api.user.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.user.service.UserReviewService;
@Service
public class UserReviewServiceImpl implements UserReviewService {
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public List<Map<String, Object>> limitReviewByUserId(Integer user_id, Page page) {
String sql = ""
+ " select "
+ "film.*, "
+ "allot.uid, "
+ "allot.review_round, "
+ "allot.film_id, "
+ "review.is_save, "
+ "review.state review_state, "
+ "review.save_state "
+ "from "
+ "fc_film_allot allot "
+ "left join fc_film film on film.id = allot.film_id "
+ "left join fc_film_review review on review.film_id = allot.film_id and review.uid = allot.uid and review.round = allot.review_round "
+ "where "
+ "allot.uid = ? "
+ "and review.state > 0";
return jdbcTemplate.limit(sql, page, user_id);
}
@Override
public List<Map<String, Object>> limitUnviewByUserId(Integer user_id, Page page) {
String sql = ""
+ " select "
+ "film.*, "
+ "allot.uid, "
+ "allot.review_round, "
+ "allot.film_id, "
+ "review.is_save, "
+ "review.state review_state, "
+ "review.save_state "
+ "from "
+ "fc_film_allot allot "
+ "left join fc_film film on film.id = allot.film_id "
+ "left join fc_film_review review on review.film_id = allot.film_id and review.uid = allot.uid and review.round = allot.review_round "
+ "where "
+ "allot.uid = ? "
+ "and review.state is null";
return jdbcTemplate.limit(sql, page, user_id);
}
@Override
public Map<String, Object> queryAllotDetailByFilmId(Long film_id) {
String sql = ""
+ "SELECT "
+ "allot.*, "
+ "review.round, "
+ "review.review_time, "
+ "review.state, "
+ "review.veto, "
+ "review.video_intro, "
+ "review.video_features, "
+ "review.select_result, "
+ "review.award_1_score, "
+ "review.award_2_score, "
+ "review.award_3_score, "
+ "review.award_4_score, "
+ "review.award_5_score, "
+ "user.realname "
+ "FROM fc_film_allot as allot "
+ "LEFT JOIN fc_film_review as review on allot.film_id = review.film_id and allot.review_round = review.round and allot.uid = review.uid "
+ "LEFT JOIN fc_user as user on allot.uid = user.uid "
+ "WHERE "
+ "allot.film_id = '?'";
return jdbcTemplate.queryForMap(sql, film_id);
}
@Override
public Long queryMemberFilmIdByFilmId(Long film_id) {
String sql = "select mf.id from fc_member_film mf, fc_film f where mf.film_no = f.film_no and f.id = ?";
return jdbcTemplate.queryForLong(sql, film_id);
}
}
...@@ -32,8 +32,8 @@ public class UserTokenServiceImpl implements UserTokenService { ...@@ -32,8 +32,8 @@ public class UserTokenServiceImpl implements UserTokenService {
Map<String,Object> map = list.get(0); Map<String,Object> map = list.get(0);
Integer state = (Integer)map.get("state"); Integer state = (Integer)map.get("state");
if(state == 1) { if(state == 1) {
Integer adminid = (Integer)map.get("adminid"); Integer uid = (Integer)map.get("uid");
LoginToken token = new LoginToken(adminid); LoginToken token = new LoginToken(uid);
session.setAttribute(TOKEN_NAME, token); session.setAttribute(TOKEN_NAME, token);
return token; return token;
} else if(state == 2) { } else if(state == 2) {
......
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