Commit cfb1f7e0aef648de1b9c6014a8e1ebb0174a68c6

Authored by 王言钊
2 parents 0ed74930 61d1ddab

Merge branch 'dev'

src/main/java/com/cnlive/shenhe/api/AvsampleCallBackControllerApi.java
... ... @@ -70,10 +70,8 @@ public class AvsampleCallBackControllerApi {
70 70 }
71 71 return result;
72 72 }
73   -
74   - @GetMapping("/getGame")
75   - public String getGame() {
76   - return "html/game.html";
77   - }
78   -
  73 + //@GetMapping("/getGame")
  74 + //public String getGame() {
  75 + // return "html/game.html";
  76 + //}
79 77 }
... ...
src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
... ... @@ -12,9 +12,11 @@ import org.slf4j.Logger;
12 12 import org.slf4j.LoggerFactory;
13 13 import org.springframework.beans.factory.annotation.Autowired;
14 14 import org.springframework.stereotype.Controller;
15   -import org.springframework.ui.Model;
16 15 import org.springframework.util.StringUtils;
17   -import org.springframework.web.bind.annotation.*;
  16 +import org.springframework.web.bind.annotation.PostMapping;
  17 +import org.springframework.web.bind.annotation.RequestBody;
  18 +import org.springframework.web.bind.annotation.RequestMapping;
  19 +import org.springframework.web.bind.annotation.ResponseBody;
18 20  
19 21 import java.util.Date;
20 22 import java.util.List;
... ... @@ -268,15 +270,12 @@ public class ContentControllerApi {
268 270 return new ResponseBean(ErrorEnum.ERROR);
269 271 }
270 272 }
271   -
272   - @GetMapping("/detail/{id}.html")
273   - public Object getContentDetail(Model model, @PathVariable Integer id) {
274   - System.out.println("数美送审页面开始进入");
275   - ShyContent content = contentService.selectByPrimaryKey(id);
276   - model.addAttribute("contentText", content.getContent_text());
277   - model.addAttribute("contentTitle", content.getTitle());
278   - return "html/contentPage.html";
279   - }
280   -
281   -
  273 + //@GetMapping("/detail/{id}.html")
  274 + //public Object getContentDetail(Model model, @PathVariable Integer id) {
  275 + // System.out.println("数美送审页面开始进入");
  276 + // ShyContent content = contentService.selectByPrimaryKey(id);
  277 + // model.addAttribute("contentText", content.getContent_text());
  278 + // model.addAttribute("contentTitle", content.getTitle());
  279 + // return "html/contentPage.html";
  280 + //}
282 281 }
... ...
src/main/java/com/cnlive/shenhe/api/LiveApplyControllerApi.java
... ... @@ -61,9 +61,9 @@ public class LiveApplyControllerApi {
61 61 //直播主题
62 62 String theme = json.getString("theme");
63 63 //商务模式:0免费 1收费
64   - Integer businessModel = Integer.parseInt(json.getString("businessModel"));
  64 + Integer businessModel = json.getInteger("businessModel");
65 65 //内容属性:1商业类活动 0非商业活动
66   - Integer contentProperty = Integer.parseInt(json.getString("contentProperty"));
  66 + Integer contentProperty = json.getInteger("contentProperty");
67 67 //内容简述
68 68 String simpleContent = json.getString("simpleContent");
69 69 //直播类型
... ...
src/main/java/com/cnlive/shenhe/api/LiveControllerApi.java
1 1 package com.cnlive.shenhe.api;
2 2  
3   -import com.alibaba.fastjson.JSON;
4 3 import com.alibaba.fastjson.JSONObject;
5 4 import com.cnlive.shenhe.entity.ShyLive;
6 5 import com.cnlive.shenhe.serviceImpl.LiveServiceImpl;
7 6 import com.cnlive.shenhe.utils.CommonConst;
8 7 import com.cnlive.shenhe.utils.CommonConstStates;
9 8 import com.cnlive.shenhe.utils.CommonUtils;
10   -import org.apache.commons.lang3.StringUtils;
11 9 import org.slf4j.Logger;
12 10 import org.slf4j.LoggerFactory;
13 11 import org.springframework.beans.factory.annotation.Autowired;
14 12 import org.springframework.stereotype.Controller;
15   -import org.springframework.web.bind.annotation.*;
  13 +import org.springframework.web.bind.annotation.PostMapping;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.ResponseBody;
16 16  
17 17 import java.sql.Timestamp;
18 18 import java.util.Date;
... ... @@ -47,7 +47,7 @@ public class LiveControllerApi {
47 47 //直播活动名称
48 48 String activityName = json.getString("activityName");
49 49 //直播活动状态
50   - Integer activityStatus = Integer.parseInt(json.getString("activityStatus"));
  50 + Integer activityStatus = json.getInteger("activityStatus");
51 51 //直播频道id
52 52 String channelId = json.getString("channelId");
53 53 //直播频道id
... ... @@ -57,13 +57,11 @@ public class LiveControllerApi {
57 57 //m3u8直播流
58 58 String hlsUrl = json.getString("hlsUrl");
59 59 //spid
60   - Integer spId = Integer.parseInt(json.getString("spId"));
  60 + Integer spId = json.getInteger("spId");
61 61 //回调地址
62 62 String callback = json.getString("callback");
63   -
64   -
65 63 //优先级
66   - Integer isHot = Integer.parseInt(json.getString("priority"));
  64 + Integer isHot = json.getInteger("priority");
67 65 //封面
68 66 String coverImgUrl = json.getString("coverImgUrl");
69 67 //活动描述
... ... @@ -279,30 +277,27 @@ public class LiveControllerApi {
279 277 }
280 278 return map;
281 279 }
282   -
283   -
284   - @RequestMapping(value = "callbackLiveResult", method = RequestMethod.POST)
285   - @ResponseBody
286   - public void getFilterVideoResult(@RequestBody String json) {
287   - logger.info("数美视频过滤回调,json:{}", json);
288   - if (StringUtils.isNotEmpty(json)) {
289   - JSONObject jsonObj = JSON.parseObject(json);
290   - JSONObject resultObj = jsonObj.getJSONObject("result");
291   - Integer code = resultObj.getInteger("code");
292   - if (code != null && code == 1100) {
293   - String riskLevel = resultObj.getString("riskLevel");
294   - if ("PASS".equals(riskLevel)) {
295   -
296   - }
297   - if ("REJECT".equals(riskLevel)) {
298   - JSONObject detail = resultObj.getJSONObject("detail");
299   - logger.info("数美视频回调--REJECT,detail:{}", detail);
300   - }
301   - if ("REVIEW".equals(riskLevel)) {
302   - }
303   - } else {
304   - }
305   - }
306   - }
307   -
  280 + //@RequestMapping(value = "callbackLiveResult", method = RequestMethod.POST)
  281 + //@ResponseBody
  282 + //public void getFilterVideoResult(@RequestBody String json) {
  283 + // logger.info("数美视频过滤回调,json:{}", json);
  284 + // if (StringUtils.isNotEmpty(json)) {
  285 + // JSONObject jsonObj = JSON.parseObject(json);
  286 + // JSONObject resultObj = jsonObj.getJSONObject("result");
  287 + // Integer code = resultObj.getInteger("code");
  288 + // if (code != null && code == 1100) {
  289 + // String riskLevel = resultObj.getString("riskLevel");
  290 + // if ("PASS".equals(riskLevel)) {
  291 + //
  292 + // }
  293 + // if ("REJECT".equals(riskLevel)) {
  294 + // JSONObject detail = resultObj.getJSONObject("detail");
  295 + // logger.info("数美视频回调--REJECT,detail:{}", detail);
  296 + // }
  297 + // if ("REVIEW".equals(riskLevel)) {
  298 + // }
  299 + // } else {
  300 + // }
  301 + // }
  302 + //}
308 303 }
... ...
src/main/java/com/cnlive/shenhe/mapper/ShyActivityMapper.java
... ... @@ -22,4 +22,11 @@ public interface ShyActivityMapper extends Mapper<ShyActivity> {
22 22 * @return
23 23 */
24 24 ShyActivity selectById(@Param("id")Integer id);
  25 +
  26 + /**
  27 + * 根据 source 查询审核类型
  28 + * @param id
  29 + * @return
  30 + */
  31 + Integer selectBySource(@Param("id")Integer id);
25 32 }
26 33 \ No newline at end of file
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/AudioServiceImpl.java
... ... @@ -210,51 +210,38 @@ public class AudioServiceImpl {
210 210 public PageInfo<ShyAudio> getListContent(AudioDTO audioDTO) {
211 211 Example example = new Example(ShyAudio.class);
212 212 Example.Criteria criteria = example.createCriteria();
213   - Example.Criteria criteria2 = example.createCriteria();
214 213 if (CommonUtils.isNotEmpty(audioDTO.getOrderByClause())) {
215 214 example.setOrderByClause(audioDTO.getOrderByClause());
216 215 }
217 216 if (CommonUtils.isNotEmpty(audioDTO.getStart_date()) && CommonUtils.isNotEmpty(audioDTO.getEnd_date())) {
218 217 criteria.andGreaterThanOrEqualTo("createTime", audioDTO.getStart_date());
219   - criteria2.andGreaterThanOrEqualTo("createTime", audioDTO.getStart_date());
220 218 criteria.andLessThanOrEqualTo("createTime", audioDTO.getEnd_date());
221   - criteria2.andLessThanOrEqualTo("createTime", audioDTO.getEnd_date());
222 219 }
223 220 if (CommonUtils.isNotEmpty(audioDTO.getVideo_title())) {
224 221 criteria.andLike("audioTitle", "%" + audioDTO.getVideo_title() + "%");
225   - criteria2.andLike("audioTitle", "%" + audioDTO.getVideo_title() + "%");
226 222 }
227   -
228 223 if (CommonUtils.isNotEmpty(audioDTO.getVideo_priority())) {
229 224 criteria.andEqualTo("priority", audioDTO.getVideo_priority());
230   - criteria2.andEqualTo("priority", audioDTO.getVideo_priority());
231 225 }
232   -
233 226 if (CommonUtils.isNotNull(audioDTO.getSpid())) {
234 227 criteria.andEqualTo("spId", audioDTO.getSpid());
235   - criteria2.andEqualTo("spId", audioDTO.getSpid());
236 228 } else if (CommonUtils.isNotEmpty(audioDTO.getSp_Id())) {
237 229 criteria.andEqualTo("spId", audioDTO.getSp_Id());
238   - criteria2.andEqualTo("spId", audioDTO.getSp_Id());
239 230 }
240   -
241 231 //领取状态 0-未领取 1-已领取
242 232 if (CommonUtils.isNotNull(audioDTO.getReceive())) {
243 233 criteria.andEqualTo("receive", audioDTO.getReceive());
244   - criteria2.andEqualTo("receive", audioDTO.getReceive());
245 234 if (audioDTO.getReceive().equals(CommonConst.RECEIVE_AFTER)) {
246 235 criteria.andEqualTo("receive_user_id", audioDTO.getUserId());
247   - criteria2.andEqualTo("receive_user_id", audioDTO.getUserId());
248 236 }
249 237 }
250   -
251   - //审核状态 0-未审核 1-已审核 2-拒绝
  238 + //审核状态 0-未审核 1-已审核 2-拒绝 3-我的已审
  239 + //不是 我的已审 进来的,只查一种状态
252 240 if (CommonUtils.isNotNull(audioDTO.getState()) && audioDTO.getState() != 3) {
253 241 criteria.andEqualTo("state", audioDTO.getState());
  242 + //是 我的已审,查通过和拒绝的两种状态
254 243 } else if (CommonUtils.isNotNull(audioDTO.getState()) && audioDTO.getState() == 3) {
255   - criteria.andEqualTo("state", 1);
256   - criteria2.andEqualTo("state", 2);
257   - example.or(criteria2);
  244 + criteria.andBetween("state", CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
258 245 }
259 246  
260 247 //默认按上传时间倒序排序
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/ChannelServiceImpl.java
... ... @@ -99,10 +99,7 @@ public class ChannelServiceImpl {
99 99 criteria.andEqualTo("shenhe_status", channelDTO.getShenhe_status());
100 100 //是 我的已审,查通过和拒绝的两种状态
101 101 } else if (CommonUtils.isNotNull(channelDTO.getShenhe_status()) && channelDTO.getShenhe_status() == 3) {
102   - Example.Criteria criteria1 = example.createCriteria();
103   - criteria1.orEqualTo("shenhe_status", CommonConst.AUDIT_SUCCESS);
104   - criteria1.orEqualTo("shenhe_status", CommonConst.AUDIT_REFUSE);
105   - example.and(criteria1);
  102 + criteria.andBetween("shenhe_status",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
106 103 }
107 104  
108 105 PageHelper.startPage(channelDTO.getPage(), channelDTO.getPageSize(), true);
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
... ... @@ -123,10 +123,7 @@ public class CommentsServiceImpl {
123 123 if (CommonUtils.isNotNull(commentsDTO.getState()) && commentsDTO.getState() != 3) {
124 124 criteria.andEqualTo("state", commentsDTO.getState());
125 125 } else if (CommonUtils.isNotNull(commentsDTO.getState()) && commentsDTO.getState() == 3) {
126   - Example.Criteria criteria1 = example.createCriteria();
127   - criteria1.orEqualTo("state", CommonConst.AUDIT_SUCCESS);
128   - criteria1.orEqualTo("state", CommonConst.AUDIT_REFUSE);
129   - example.and(criteria1);
  126 + criteria.andBetween("state",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
130 127 }
131 128  
132 129 PageHelper.startPage(commentsDTO.getPage(), commentsDTO.getPageSize(), true);
... ... @@ -173,14 +170,12 @@ public class CommentsServiceImpl {
173 170 criteria.andEqualTo("receive_user_id", commentsDTO.getUserId());
174 171 }
175 172 }
176   -
  173 + //不是 我的已审 进来的,只查一种状态
177 174 if (CommonUtils.isNotNull(commentsDTO.getState()) && commentsDTO.getState() != 3) {
178 175 criteria.andEqualTo("state", commentsDTO.getState());
  176 + //是 我的已审,查通过和拒绝的两种状态
179 177 } else if (CommonUtils.isNotNull(commentsDTO.getState()) && commentsDTO.getState() == 3) {
180   - Example.Criteria criteria1 = example.createCriteria();
181   - criteria1.orEqualTo("state", CommonConst.AUDIT_SUCCESS);
182   - criteria1.orEqualTo("state", CommonConst.AUDIT_REFUSE);
183   - example.and(criteria1);
  178 + criteria.andBetween("state",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
184 179 }
185 180  
186 181 List<ShyComments> commentsList = shyCommentsMapper.selectByExample(example);
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
... ... @@ -65,14 +65,15 @@ public class ContentServiceImpl {
65 65  
66 66 public List<ShyContent> findShyContentWithWebPage() {
67 67 List checkParamList = new ArrayList();
68   - checkParamList.add("content");
  68 + //checkParamList.add("content");
69 69 checkParamList.add("moment");
70 70 Example example = new Example(ShyContent.class);
71 71 Example.Criteria criteria = example.createCriteria();
72 72 criteria.andNotIn("content_tag", checkParamList);
73 73 criteria.andEqualTo("shenhe_type", CommonConst.AUDIT_TYPE_MACHANE);
74 74 criteria.andEqualTo("receive_status", CommonConst.RECEIVE_BEFORE);
75   - return shyContentMapper.selectByExampleAndRowBounds(example, new RowBounds(0, 100));
  75 + List<ShyContent> ShyContent = shyContentMapper.selectByExampleAndRowBounds(example, new RowBounds(0, 100));
  76 + return ShyContent;
76 77 }
77 78  
78 79 //***************************
... ... @@ -242,7 +243,6 @@ public class ContentServiceImpl {
242 243 success = false;
243 244 return success;
244 245 }
245   -
246 246 //如果当前图文是朋友圈的视频,通知点播云
247 247 if (CommonUtils.isNotEmpty(content.getContent_tag())
248 248 && "moment".equals(content.getContent_tag())
... ... @@ -260,7 +260,6 @@ public class ContentServiceImpl {
260 260 }
261 261 }
262 262 }
263   -
264 263 // 设置图文状态为审核后的状态
265 264 content.setContent_status(state);
266 265 // 领取状态为已审核
... ... @@ -281,7 +280,6 @@ public class ContentServiceImpl {
281 280 success = false;
282 281 }
283 282 }
284   -
285 283 return success;
286 284 }
287 285  
... ... @@ -358,22 +356,16 @@ public class ContentServiceImpl {
358 356 //获取图文免审sp
359 357 List<Integer> sites = sitesService.getBusinessList(CommonConst.BUSINESS_CONTENT);
360 358 //初始化一个审核状态
361   - //审核类型,1:免审,2:机审,3:人工审
  359 + //审核类型,1:免审,2:机审,3:人工审 默认人工审
362 360 Integer shenheType = CommonConst.AUDIT_TYPE_USER;
363 361 //如果当前sp是免审sp
364 362 if (sites.contains(spId)) {
365 363 //免审
366 364 shenheType = CommonConst.AUDIT_TYPE_FREE;
367 365 } else {
368   - if ("content".equals(ContentTag)) {
369   - //免审
370   - shenheType = CommonConst.AUDIT_TYPE_FREE;
371   - } else if (ContentTag.startsWith("cms_") || ContentTag.startsWith("edu_")) {
  366 + if ("content".equals(ContentTag) || ContentTag.startsWith("cms_") || ContentTag.startsWith("edu_")) {
372 367 //机审
373 368 shenheType = CommonConst.AUDIT_TYPE_MACHANE;
374   - } else {
375   - //人工审
376   - shenheType = CommonConst.AUDIT_TYPE_USER;
377 369 }
378 370 }
379 371 return shenheType;
... ... @@ -382,6 +374,7 @@ public class ContentServiceImpl {
382 374 /**
383 375 * 易盾网站过滤
384 376 * 送审类型:1:文本 2:图片 3.网页 4:点播音频
  377 + *
385 378 * @param shyContent
386 379 * @return
387 380 */
... ... @@ -391,7 +384,14 @@ public class ContentServiceImpl {
391 384 logger.info("审核云向易盾网站检测接口提交的url:{}", contentUrl);
392 385 //调用易盾网站检测接口
393 386 JSONObject jsonObject = YiDunAntiFraudUtil.submitYiDunUrl(contentUrl);
  387 +
394 388 if (jsonObject != null) {
  389 + Integer code = jsonObject.getInteger("code");
  390 + String msg = jsonObject.getString("msg");
  391 + if (code != 200) {
  392 + // |0待发布 |1已发布 |2已下线
  393 + boolean flag = callback(shyContent.getContent_id(), "易盾机审未通过:"+msg, CommonConst.AUDIT_REFUSE, shyContent.getAuditor_id(), shyContent.getUpdater());
  394 + }
395 395 JSONObject result = jsonObject.getJSONObject("result");
396 396 String dataId = result.getString("dataId");
397 397 String taskId = result.getString("taskId");
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/LiveApplyServiceImpl.java
... ... @@ -127,10 +127,12 @@ public class LiveApplyServiceImpl {
127 127 if (CommonUtils.isNotNull(liveApplyDTO.getSpid())) {
128 128 criteria.andEqualTo("sp_id", liveApplyDTO.getSpid());
129 129 }
  130 + //不是 我的已审 进来的,只查一种状态
130 131 if (CommonUtils.isNotNull(liveApplyDTO.getShenhe_state()) && liveApplyDTO.getShenhe_state() != 3) {
131 132 criteria.andEqualTo("shenhe_state", liveApplyDTO.getShenhe_state());
  133 + //是 我的已审,查通过和拒绝的两种状态
132 134 } else if (CommonUtils.isNotNull(liveApplyDTO.getShenhe_state()) && liveApplyDTO.getShenhe_state() == 3) {
133   - criteria.andNotEqualTo("shenhe_state", 0);
  135 + criteria.andBetween("shenhe_state",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
134 136 }
135 137 if (CommonUtils.isNotNull(liveApplyDTO.getReceive())) {
136 138 criteria.andEqualTo("receive", liveApplyDTO.getReceive());
... ... @@ -262,10 +264,12 @@ public class LiveApplyServiceImpl {
262 264 if (CommonUtils.isNotNull(liveApplyDTO.getSpid())) {
263 265 criteria.andEqualTo("sp_id", liveApplyDTO.getSpid());
264 266 }
  267 + //不是 我的已审 进来的,只查一种状态
265 268 if (CommonUtils.isNotNull(liveApplyDTO.getShenhe_state()) && liveApplyDTO.getShenhe_state() != 3) {
266 269 criteria.andEqualTo("shenhe_state", liveApplyDTO.getShenhe_state());
  270 + //是 我的已审,查通过和拒绝的两种状态
267 271 } else if (CommonUtils.isNotNull(liveApplyDTO.getShenhe_state()) && liveApplyDTO.getShenhe_state() == 3) {
268   - criteria.andNotEqualTo("shenhe_state", 0);
  272 + criteria.andBetween("shenhe_state",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
269 273 }
270 274 if (CommonUtils.isNotNull(liveApplyDTO.getReceive())) {
271 275 criteria.andEqualTo("receive", liveApplyDTO.getReceive());
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/ShyActivityImpl.java
... ... @@ -40,7 +40,7 @@ public class ShyActivityImpl {
40 40 Date date = new Date();
41 41 shyActivity.setCreate_time(date);
42 42 shyActivity.setUpdate_time(date);
43   - shyActivity.setExempt_from_trial(0);
  43 + shyActivity.setExempt_from_trial(3);
44 44 int i = shyActivityMapper.insertSelective(shyActivity);
45 45 return i;
46 46 }
... ... @@ -123,12 +123,21 @@ public class ShyActivityImpl {
123 123 List<ShyActivity> shyActivities = shyActivityMapper.selectAll();
124 124 return shyActivities;
125 125 }
  126 +
126 127 /**
127 128 * 根据id查询单个对象
128 129 */
129   - public ShyActivity selectById(Integer id){
  130 + public ShyActivity selectById(Integer id) {
130 131 ShyActivity shyActivity = shyActivityMapper.selectById(id);
131 132 return shyActivity;
132 133 }
133 134  
  135 + /**
  136 + * 根据source查询审核类型
  137 + */
  138 + public Integer selectBySource(Integer id) {
  139 + Integer shtype = shyActivityMapper.selectBySource(id);
  140 + return shtype;
  141 + }
  142 +
134 143 }
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/TopicServiceImpl.java
... ... @@ -122,12 +122,8 @@ public class TopicServiceImpl {
122 122 criteria.andEqualTo("shenhe_status", topicDTO.getShenhe_status());
123 123 //是 我的已审,查通过和拒绝的两种状态
124 124 } else if (CommonUtils.isNotNull(topicDTO.getShenhe_status()) && topicDTO.getShenhe_status() == 3) {
125   - Example.Criteria criteria1 = example.createCriteria();
126   - criteria1.orEqualTo("shenhe_status", 1);
127   - criteria1.orEqualTo("shenhe_status", 2);
128   - example.and(criteria1);
  125 + criteria.andBetween("shenhe_status",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
129 126 }
130   -
131 127 PageHelper.startPage(topicDTO.getPage(), topicDTO.getPageSize(), true);
132 128 List<ShyTopic> topicList = shyTopicMapper.selectByExample(example);
133 129 PageInfo<ShyTopic> pageInfo = new PageInfo<>(topicList);
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
... ... @@ -6,7 +6,10 @@ import com.alibaba.fastjson.JSONObject;
6 6 import com.cnlive.shenhe.bean.ErrorEnum;
7 7 import com.cnlive.shenhe.bean.ResponseBean;
8 8 import com.cnlive.shenhe.dto.VideosDTO;
9   -import com.cnlive.shenhe.entity.*;
  9 +import com.cnlive.shenhe.entity.ShyUsers;
  10 +import com.cnlive.shenhe.entity.ShyUsersfree;
  11 +import com.cnlive.shenhe.entity.ShyVideos;
  12 +import com.cnlive.shenhe.entity.ShyYidun;
10 13 import com.cnlive.shenhe.mapper.ShyUsersMapper;
11 14 import com.cnlive.shenhe.mapper.ShyVideosMapper;
12 15 import com.cnlive.shenhe.utils.*;
... ... @@ -22,7 +25,6 @@ import org.springframework.util.StringUtils;
22 25 import tk.mybatis.mapper.entity.Example;
23 26  
24 27 import java.text.ParseException;
25   -import java.util.Arrays;
26 28 import java.util.Date;
27 29 import java.util.List;
28 30 import java.util.UUID;
... ... @@ -115,7 +117,6 @@ public class VideosServiceImpl {
115 117 logger.info("接受点播列表为,VideosDTO:{}", JSON.toJSONString(videosDTO));
116 118 Example example = new Example(ShyVideos.class);
117 119 Example.Criteria criteria = example.createCriteria();
118   - Example.Criteria criteria2 = example.createCriteria();
119 120 if (CommonUtils.isNotEmpty(videosDTO.getOrderByClause())) {
120 121 example.setOrderByClause(videosDTO.getOrderByClause());
121 122 }
... ... @@ -128,73 +129,58 @@ public class VideosServiceImpl {
128 129 e.printStackTrace();
129 130 }
130 131 criteria.andGreaterThanOrEqualTo("created_at", videosDTO.getStart_date());
131   - criteria2.andGreaterThanOrEqualTo("created_at", videosDTO.getStart_date());
132 132 criteria.andLessThanOrEqualTo("created_at", videosDTO.getEnd_date());
133   - criteria2.andLessThanOrEqualTo("created_at", videosDTO.getEnd_date());
134 133 }
135 134 if (CommonUtils.isNotEmpty(videosDTO.getVideo_title())) {
136 135 criteria.andLike("video_title", "%" + videosDTO.getVideo_title() + "%");
137   - criteria2.andLike("video_title", "%" + videosDTO.getVideo_title() + "%");
138 136 }
139 137  
140 138 if (CommonUtils.isNotEmpty(videosDTO.getVideo_priority())) {
141 139 criteria.andEqualTo("video_priority", videosDTO.getVideo_priority());
142   - criteria2.andEqualTo("video_priority", videosDTO.getVideo_priority());
143 140 }
144 141  
145 142 if (CommonUtils.isNotEmpty(videosDTO.getVideo_id())) {
146 143 criteria.andEqualTo("video_id", videosDTO.getVideo_id());
147   - criteria2.andEqualTo("video_id", videosDTO.getVideo_id());
148 144 }
149 145  
150 146 if (CommonUtils.isNotEmpty(videosDTO.getShen_auditor_id())) {
151 147 if ("白名单".equals(videosDTO.getShen_auditor_id()) || "自动审核".equals(videosDTO.getShen_auditor_id())) {
152 148 criteria.andEqualTo("updater", videosDTO.getShen_auditor_id());
153   - criteria2.andEqualTo("updater", videosDTO.getShen_auditor_id());
154 149 } else {
155 150 criteria.andEqualTo("auditor_id", videosDTO.getShen_auditor_id());
156   - criteria2.andEqualTo("auditor_id", videosDTO.getShen_auditor_id());
157 151 }
158 152 }
159 153  
160 154 if (CommonUtils.isNotEmpty(videosDTO.getSource()) && !"22".equals(videosDTO.getSource()) && !"102".equals(videosDTO.getSource())) {
161 155 criteria.andEqualTo("source", videosDTO.getSource());
162   - criteria2.andEqualTo("source", videosDTO.getSource());
163 156 } else if (CommonUtils.isNotEmpty(videosDTO.getSource()) && "22".equals(videosDTO.getSource())) {
164 157 criteria.andEqualTo("category", "moment");
165   - criteria2.andEqualTo("category", "moment");
166 158 } else if (CommonUtils.isNotEmpty(videosDTO.getSource()) && "102".equals(videosDTO.getSource())) {
167 159 criteria.andEqualTo("source", "102".equals(videosDTO.getSource()) ? "0" : videosDTO.getSource());
168   - criteria2.andEqualTo("source", "102".equals(videosDTO.getSource()) ? "0" : videosDTO.getSource());
169 160 }
170 161  
171 162 if (CommonUtils.isNotEmpty(videosDTO.getVideo_user_id())) {
172 163 criteria.andEqualTo("video_user_id", videosDTO.getVideo_user_id());
173   - criteria2.andEqualTo("video_user_id", videosDTO.getVideo_user_id());
174 164 }
175 165  
176 166 if (CommonUtils.isNotNull(videosDTO.getSpid())) {
177 167 criteria.andEqualTo("spid", videosDTO.getSpid());
178   - criteria2.andEqualTo("spid", videosDTO.getSpid());
179 168 } else if (CommonUtils.isNotEmpty(videosDTO.getSp_Id())) {
180 169 criteria.andEqualTo("spid", videosDTO.getSp_Id());
181   - criteria2.andEqualTo("spid", videosDTO.getSp_Id());
182 170 }
183 171  
184 172 if (CommonUtils.isNotNull(videosDTO.getReceive())) {
185 173 criteria.andEqualTo("receive", videosDTO.getReceive());
186   - criteria2.andEqualTo("receive", videosDTO.getReceive());
187 174 if (videosDTO.getReceive().equals(CommonConst.RECEIVE_AFTER)) {
188 175 criteria.andEqualTo("receive_user_id", videosDTO.getUserId());
189   - criteria2.andEqualTo("receive_user_id", videosDTO.getUserId());
190 176 }
191 177 }
  178 + //不是 我的已审 进来的,只查一种状态
192 179 if (CommonUtils.isNotNull(videosDTO.getState()) && videosDTO.getState() != 3) {
193 180 criteria.andEqualTo("state", videosDTO.getState());
  181 + //是 我的已审,查通过和拒绝的两种状态
194 182 } else if (CommonUtils.isNotNull(videosDTO.getState()) && videosDTO.getState() == 3) {
195   - criteria.andEqualTo("state", 1);
196   - criteria2.andEqualTo("state", 2);
197   - example.or(criteria2);
  183 + criteria.andBetween("state", CommonConst.AUDIT_SUCCESS, CommonConst.AUDIT_REFUSE);
198 184 }
199 185 //默认按上传时间倒序排序
200 186 example.setOrderByClause("created_at desc");
... ... @@ -288,7 +274,6 @@ public class VideosServiceImpl {
288 274 example.setOrderByClause(videosDTO.getOrderByClause());
289 275 }
290 276 if (CommonUtils.isNotEmpty(videosDTO.getStart_date()) && CommonUtils.isNotEmpty(videosDTO.getEnd_date())) {
291   -
292 277 try {
293 278 videosDTO.setStart_date(String.valueOf(CommonUtils.parseDate(videosDTO.getStart_date(), "yyyy-MM-dd")));
294 279 videosDTO.setEnd_date(String.valueOf(CommonUtils.parseDate(videosDTO.getEnd_date(), "yyyy-MM-dd")));
... ... @@ -457,53 +442,45 @@ public class VideosServiceImpl {
457 442 public void getShenheType(ShyVideos shyVideo) {
458 443 //获取点播免审sp
459 444 List<Integer> sites = sitesService.getBusinessList(CommonConst.BUSINESS_VIDEO);
460   - List<Integer> shyActivities = shyActivityImpl.selectByExample(CommonConst.AUDIT_TYPE_FREE);
461   - logger.info("免审渠道列表:{}====sites:{}", JSON.toJSONString(shyActivities), sites.toString());
  445 + // List<Integer> shyActivities = shyActivityImpl.selectByExample(CommonConst.AUDIT_TYPE_FREE);
  446 + logger.info("====sites:{}", sites.toString());
462 447 String source = shyVideo.getSource();
  448 + // 根据source 查询审核类型 source有传空的时候 默认给0
  449 + Integer shType = shyActivityImpl.selectBySource(StringUtils.isEmpty(source) ? 0 : Integer.valueOf(source));
  450 + logger.info("审核类型为:{}", shType);
  451 + ShyUsersfree shyUserfree = null;
  452 + //如果用户id存在
  453 + if (CommonUtils.isNotEmpty(shyVideo.getVideo_user_id())) {
  454 + shyUserfree = usersfreeServiceImpl.selectUser(shyVideo.getSpid(), shyVideo.getCategory(), shyVideo.getVideo_user_id());
  455 + }
463 456 //初始化一个审核状态
464 457 //审核类型,1:免审,2:机审,3:人工审
465 458 Integer shenheType = CommonConst.AUDIT_TYPE_USER;
466   - //如果当前sp是免审sp source有传空的时候 默认给0
467   - if (sites.contains(shyVideo.getSpid()) || shyActivities.contains(StringUtils.isEmpty(source) ? "0" : Integer.valueOf(source))) {
  459 + //如果当前sp是免审sp //如果审核类型为免审 //如果存在免审用户
  460 + if (sites.contains(shyVideo.getSpid()) || (CommonUtils.isNotNull(shType) && CommonConst.AUDIT_TYPE_FREE.equals(shType)) || CommonUtils.isNotNull(shyUserfree)) {
468 461 logger.info("进入已经免审渠道:{}", source);
469 462 //免审
470 463 shenheType = CommonConst.AUDIT_TYPE_FREE;
471   - } else if ("10000".equals(source)) {
472   - //机审
473   - shenheType = CommonConst.AUDIT_TYPE_MACHANE;
474 464 } else {
475 465 //如果栏目是“目击者”
476 466 if (CommonUtils.isNotEmpty(shyVideo.getCategory()) && shyVideo.getCategory().equals(CommonConst.CATEGORY_WITNESS)) {
477   - //如果用户id存在
478   - if (CommonUtils.isNotEmpty(shyVideo.getVideo_user_id())) {
479   - ShyUsersfree shyUserfree = usersfreeServiceImpl.selectUser(shyVideo.getSpid(), shyVideo.getCategory(), shyVideo.getVideo_user_id());
480   - //如果存在免审用户
481   - if (CommonUtils.isNotNull(shyUserfree)) {
482   - //免审
483   - shenheType = CommonConst.AUDIT_TYPE_FREE;
484   - } else {
485   - //用户不免审
486   - //机审
487   - shenheType = CommonConst.AUDIT_TYPE_MACHANE;
488   - }
489   - } else {
490   - //如果用户id不存在
491   - //机审
492   - shenheType = CommonConst.AUDIT_TYPE_MACHANE;
493   - }
494   - if (manualReview(shyVideo)) {
495   - //给审核变量 赋值人工审核
  467 + // 机审
  468 + shenheType = CommonConst.AUDIT_TYPE_MACHANE;
  469 + // 如果是人工审
  470 + if (CommonConst.AUDIT_TYPE_USER.equals(shType)) {
496 471 shenheType = CommonConst.AUDIT_TYPE_USER;
497 472 }
498   - }
499   - //如果栏目是朋友圈
500   - if (CommonUtils.isNotEmpty(shyVideo.getCategory()) && shyVideo.getCategory().equals(CommonConst.CATEGORY_MOMENT)) {
501   - //免审
  473 + // 如果栏目是朋友圈
  474 + } else if (CommonUtils.isNotEmpty(shyVideo.getCategory()) && shyVideo.getCategory().equals(CommonConst.CATEGORY_MOMENT)) {
  475 + // 免审
502 476 shenheType = CommonConst.AUDIT_TYPE_FREE;
  477 + } else {
  478 + if (shType != null) {
  479 + // 机审或者是人工审
  480 + shenheType = shType;
  481 + }
503 482 }
504 483 }
505   -
506   -
507 484 logger.info("id : {} 审核类型: {}", shyVideo.getVideo_id(), shenheType);
508 485 shyVideo.setShenhe_type(shenheType);
509 486 }
... ... @@ -514,15 +491,15 @@ public class VideosServiceImpl {
514 491 * @param shyVideo
515 492 * @return
516 493 */
517   - public boolean manualReview(ShyVideos shyVideo) {
518   - String[] list = {"41", "42", "43", "44", "45", "46", "47","515","516","517","518"};
519   - List<String> asList = Arrays.asList(list);
520   - if (asList.contains(shyVideo.getSource())) {
521   - //人工审 返回true
522   - return true;
523   - }
524   - return false;
525   - }
  494 + //public boolean manualReview(ShyVideos shyVideo) {
  495 + // String[] list = {"41", "42", "43", "44", "45", "46", "47","515","516","517","518"};
  496 + // List<String> asList = Arrays.asList(list);
  497 + // if (asList.contains(shyVideo.getSource())) {
  498 + // //人工审 返回true
  499 + // return true;
  500 + // }
  501 + // return false;
  502 + //}
526 503  
527 504 /**
528 505 * 人工审核拒绝方法
... ...
src/main/resources/mapper/ShyActivityMapper.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3 <mapper namespace="com.cnlive.shenhe.mapper.ShyActivityMapper">
4   - <resultMap id="BaseResultMap" type="com.cnlive.shenhe.entity.ShyActivity">
5   - <!--
6   - WARNING - @mbg.generated
7   - -->
8   - <id column="id" jdbcType="INTEGER" property="id" />
9   - <result column="activity" jdbcType="VARCHAR" property="activity" />
10   - <result column="create_time" jdbcType="TIMESTAMP" property="create_time" />
11   - <result column="update_time" jdbcType="TIMESTAMP" property="update_time" />
12   - <result column="exempt_from_trial" jdbcType="INTEGER" property="exempt_from_trial" />
13   - </resultMap>
14   - <select id="selectAllByExempt_from_trial" resultType="java.lang.Integer">
15   - select id from shy_activity where exempt_from_trial=${exempt_from_trial};
16   - </select>
  4 + <resultMap id="BaseResultMap" type="com.cnlive.shenhe.entity.ShyActivity">
  5 + <!--
  6 + WARNING - @mbg.generated
  7 + -->
  8 + <id column="id" jdbcType="INTEGER" property="id"/>
  9 + <result column="activity" jdbcType="VARCHAR" property="activity"/>
  10 + <result column="create_time" jdbcType="TIMESTAMP" property="create_time"/>
  11 + <result column="update_time" jdbcType="TIMESTAMP" property="update_time"/>
  12 + <result column="exempt_from_trial" jdbcType="INTEGER" property="exempt_from_trial"/>
  13 + </resultMap>
  14 + <select id="selectAllByExempt_from_trial" resultType="java.lang.Integer">
  15 + select id from shy_activity where exempt_from_trial=${exempt_from_trial};
  16 + </select>
17 17 <select id="selectById" resultType="com.cnlive.shenhe.entity.ShyActivity">
18   - select * from shy_activity where id=${id}
  18 + select * from shy_activity where id=${id}
  19 + </select>
  20 + <select id="selectBySource" resultType="java.lang.Integer">
  21 + select exempt_from_trial from shy_activity where id=${id};
19 22 </select>
20 23  
21 24  
... ...
src/main/resources/templates/page/activity.html
... ... @@ -114,13 +114,17 @@
114 114 </div>
115 115 <div class="col-md-5 pull-right" style="padding: 0; width: 15%;">
116 116 <label for="sp_id" class="control-label cb-toolbar"
117   - style="font-size: 15px; top: 8px; font-weight: 100;">是否审核:</label>
  117 + style="font-size: 15px; top: 8px; font-weight: 100;">审核类型:</label>
118 118 <div class="col-sm-7" style="padding: 0;">
119 119 <select class="form-control" id="exempt_from_trial_query"
120 120 name="exempt_from_trial">
121   - <option value="">--全部免审类型--</option>
122   - <option value="0" name="非免审" th:selected="${exempt_from_trial ==0}" >非免审</option>
123   - <option value="1" name="免审" th:selected="${exempt_from_trial ==1}" >免审</option>
  121 + <option value="">--审核类型--</option>
  122 + <option value="1" name="免审" th:selected="${exempt_from_trial ==1}">免审
  123 + </option>
  124 + <option value="2" name="机审" th:selected="${exempt_from_trial ==2}">机审
  125 + </option>
  126 + <option value="3" name="人工审" th:selected="${exempt_from_trial ==3}">人工审
  127 + </option>
124 128 </select>
125 129 </div>
126 130 </div>
... ... @@ -188,10 +192,10 @@
188 192 14:27:17
189 193 </td>
190 194  
191   - <td style="text-align: center; width: 12%;"
192   - th:text="${ShyActivity.exempt_from_trial} == 1 ? 免审 : 非免审">
193   - 2016-08-03
194   - 14:27:17
  195 + <td style="text-align: center; width: 12%;">
  196 + <span th:if="${ShyActivity.exempt_from_trial==1}">免审</span>
  197 + <span th:if="${ShyActivity.exempt_from_trial==2}">机审</span>
  198 + <span th:if="${ShyActivity.exempt_from_trial==3}">人工审</span>
195 199 </td>
196 200  
197 201 <td style="text-align: center; width: 10%;">
... ... @@ -219,8 +223,7 @@
219 223 <option value="10" th:selected="${ShyActivitylist.pageSize==10}">10</option>
220 224 <option value="20" th:selected="${ShyActivitylist.pageSize==20}">20</option>
221 225 <option value="50" th:selected="${ShyActivitylist.pageSize==50}">50</option>
222   - <option value="100" th:selected="${ShyActivitylist.pageSize==100}">100
223   - </option>
  226 + <option value="100" th:selected="${ShyActivitylist.pageSize==100}">100</option>
224 227 </select> <span class="pagination-info">条记录</span>
225 228 </div>
226 229 <div class="pull-right pagination">
... ... @@ -306,8 +309,9 @@
306 309  
307 310 <select class="" id="exempt_from_trial" name="exempt_from_trial">
308 311 <option value="" name="-选择审核类型-">-选择审核类型-</option>
309   - <option value="0" name="非免审">非免审</option>
310   - <option value="1" name="免审">免审</option>
  312 + <option value="1" name="非免审">免审</option>
  313 + <option value="2" name="免审">机审</option>
  314 + <option value="3" name="免审">人工审</option>
311 315 </select>
312 316 </div>
313 317 </div>
... ... @@ -396,7 +400,7 @@
396 400  
397 401 //打开编辑窗口
398 402 function edit(Id, activity, exempt_from_trial) {
399   - $("#myModalLabel").text("编辑活动名称是否免审");
  403 + $("#myModalLabel").text("编辑活动审核类型");
400 404 $("#id").val(Id);
401 405 $("#activity").val(activity);
402 406 $("#activity").attr("readonly", "true");
... ...