Commit 720eb6f6 authored by Quxl's avatar Quxl

x

parent 53b66d44
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.egolm.common.jdbc.Page; import com.egolm.common.jdbc.Page;
import com.egolm.film.bean.Fc_admin;
public interface NewsService { public interface NewsService {
...@@ -19,4 +20,6 @@ public interface NewsService { ...@@ -19,4 +20,6 @@ public interface NewsService {
List<Map<String, Object>> queryListForUser(Integer uid, Integer gid, Page page); List<Map<String, Object>> queryListForUser(Integer uid, Integer gid, Page page);
void sendAllotNews(Integer review_id, Integer review_round, Integer[] user_id, Fc_admin admin);
} }
package com.egolm.film.api.service.impl; package com.egolm.film.api.service.impl;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.common.jdbc.JdbcTemplate; import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page; import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.NewsService; import com.egolm.film.api.service.NewsService;
import com.egolm.film.bean.Fc_admin;
import com.egolm.film.bean.Fc_news;
import com.egolm.film.bean.Fc_news_sender;
@Service @Service
public class NewsServiceImpl implements NewsService { public class NewsServiceImpl implements NewsService {
...@@ -49,4 +57,47 @@ public class NewsServiceImpl implements NewsService { ...@@ -49,4 +57,47 @@ public class NewsServiceImpl implements NewsService {
return jdbcTemplate.limit(sql, page, uid, uid, gid); return jdbcTemplate.limit(sql, page, uid, uid, gid);
} }
static String[] rounds = new String[] {"一选", "二选", "三选", "把关", "选片委员会", "总局审片"};
static Map<Integer, String> map = new HashMap<Integer, String>();
static {
map.put(1, "金爵奖国际影片评选");
map.put(2, "亚洲新人奖国际影片评选");
map.put(3, "国际电影展映");
}
@Override
@Transactional
public void sendAllotNews(Integer review_id, Integer review_round, Integer[] user_id, Fc_admin admin) {
Map<String, Object> film = jdbcTemplate.queryForMap("select mf.*, r.enroll_type_id from fc_member_film mf, fc_review r where mf.id = r.film_id and r.id = ?", review_id);
String cn_name = (String)film.get("cn_name");
String en_name = (String)film.get("en_name");
Integer enroll_type_id = ((Number)film.get("enroll_type_id")).intValue();
String enroll_type_name = map.get(enroll_type_id);
String round = rounds[review_round-1];
String content = "管理员 [{0}] 已经为您分配了新的审片任务 [{1} {2}] {3} {4},请按时处理.";
content = MessageFormat.format(content, admin.getRealname(), cn_name, en_name, enroll_type_name, round);
String title = "审片任务: [{1} {2}] {3} {4}";
title = MessageFormat.format(title, cn_name, en_name, enroll_type_name, round);
Fc_news news = new Fc_news();
news.setTitle(title);
news.setContent(content);
news.setCreate_time(new Date());
news.setCreator(admin.getAdminid());
news.setLevel(1);
news.setType("TEXT");
news.setUpdater(admin.getAdminid());
news.setLast_update_time(news.getCreate_time());
jdbcTemplate.save(news);
List<Fc_news_sender> senders = new ArrayList<Fc_news_sender>();
for(Integer uid : user_id) {
Fc_news_sender sender = new Fc_news_sender();
sender.setNews_id(news.getId());
sender.setSend_time(news.getCreate_time());
sender.setSender(admin.getAdminid());
sender.setUser_id(uid);
senders.add(sender);
}
jdbcTemplate.batchSave(senders);
}
} }
...@@ -644,8 +644,6 @@ public class ReviewServiceImpl implements ReviewService { ...@@ -644,8 +644,6 @@ public class ReviewServiceImpl implements ReviewService {
} }
objs2[i] = new Object[]{gid, review_id, review_round, user_id[i]}; objs2[i] = new Object[]{gid, review_id, review_round, user_id[i]};
} }
jdbcTemplate.batchUpdate("update fc_review_record set user_group_id = ? where review_id = ? and review_round = ? and user_id = ?", objs2); jdbcTemplate.batchUpdate("update fc_review_record set user_group_id = ? where review_id = ? and review_round = ? and user_id = ?", objs2);
jdbcTemplate.executeUpdate("update fc_review set allot_state = 1, opt_state = 0 where id = ? and review_round = ?", review_id, review_round); jdbcTemplate.executeUpdate("update fc_review set allot_state = 1, opt_state = 0 where id = ? and review_round = ?", review_id, review_round);
} }
......
...@@ -18,6 +18,7 @@ import com.egolm.common.jdbc.Page; ...@@ -18,6 +18,7 @@ import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.AdminTokenService; import com.egolm.film.api.service.AdminTokenService;
import com.egolm.film.api.service.AdminUserService; import com.egolm.film.api.service.AdminUserService;
import com.egolm.film.api.service.FilmService; import com.egolm.film.api.service.FilmService;
import com.egolm.film.api.service.NewsService;
import com.egolm.film.api.service.ReviewService; import com.egolm.film.api.service.ReviewService;
import com.egolm.film.bean.Fc_admin; import com.egolm.film.bean.Fc_admin;
import com.egolm.film.bean.Fc_review; import com.egolm.film.bean.Fc_review;
...@@ -48,6 +49,9 @@ public class AdminReviewController { ...@@ -48,6 +49,9 @@ public class AdminReviewController {
@Autowired @Autowired
AdminUserService adminUserService; AdminUserService adminUserService;
@Autowired
NewsService newsService;
@ResponseBody @ResponseBody
@PostMapping("list") @PostMapping("list")
@ApiOperation("查询选片列表") @ApiOperation("查询选片列表")
...@@ -208,6 +212,8 @@ public class AdminReviewController { ...@@ -208,6 +212,8 @@ public class AdminReviewController {
} }
if(saveList.size() > 0) { if(saveList.size() > 0) {
reviewService.saveReviewRecordIfNotExists(review_id, review_round, saveList.toArray(new Integer[saveList.size()])); reviewService.saveReviewRecordIfNotExists(review_id, review_round, saveList.toArray(new Integer[saveList.size()]));
Fc_admin admin = Util.mapTo(tokenService.getTokenObj(), Fc_admin.class);
newsService.sendAllotNews(review_id, review_round, user_id, admin);
} }
if(cancelList.size() > 0) { if(cancelList.size() > 0) {
reviewService.deleteReviewRecord(review_id, review_round, cancelList.toArray(new Integer[cancelList.size()])); reviewService.deleteReviewRecord(review_id, review_round, cancelList.toArray(new Integer[cancelList.size()]));
......
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