Commit cbb05486e4dca251d37d760ab257440ef68f35ac
1 parent
1add0887
优化活动管理模块及点播模块
Showing
5 changed files
with
88 additions
and
74 deletions
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/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/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; |
| ... | ... | @@ -457,53 +459,42 @@ public class VideosServiceImpl { |
| 457 | 459 | public void getShenheType(ShyVideos shyVideo) { |
| 458 | 460 | //获取点播免审sp |
| 459 | 461 | 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()); | |
| 462 | + // List<Integer> shyActivities = shyActivityImpl.selectByExample(CommonConst.AUDIT_TYPE_FREE); | |
| 463 | + logger.info("====sites:{}", sites.toString()); | |
| 462 | 464 | String source = shyVideo.getSource(); |
| 465 | + // 根据source 查询审核类型 | |
| 466 | + Integer shType = shyActivityImpl.selectBySource(StringUtils.isEmpty(source) ? 0 : Integer.valueOf(source)); | |
| 467 | + | |
| 468 | + ShyUsersfree shyUserfree = null; | |
| 469 | + //如果用户id存在 | |
| 470 | + if (CommonUtils.isNotEmpty(shyVideo.getVideo_user_id())) { | |
| 471 | + shyUserfree = usersfreeServiceImpl.selectUser(shyVideo.getSpid(), shyVideo.getCategory(), shyVideo.getVideo_user_id()); | |
| 472 | + } | |
| 463 | 473 | //初始化一个审核状态 |
| 464 | 474 | //审核类型,1:免审,2:机审,3:人工审 |
| 465 | 475 | 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))) { | |
| 476 | + //如果当前sp是免审sp source有传空的时候 默认给0 //如果存在免审用户 | |
| 477 | + if (sites.contains(shyVideo.getSpid()) || shType.equals(CommonConst.AUDIT_TYPE_FREE) || CommonUtils.isNotNull(shyUserfree)) { | |
| 468 | 478 | logger.info("进入已经免审渠道:{}", source); |
| 469 | 479 | //免审 |
| 470 | 480 | shenheType = CommonConst.AUDIT_TYPE_FREE; |
| 471 | - } else if ("10000".equals(source)) { | |
| 472 | - //机审 | |
| 473 | - shenheType = CommonConst.AUDIT_TYPE_MACHANE; | |
| 474 | - } else { | |
| 481 | + } else { | |
| 475 | 482 | //如果栏目是“目击者” |
| 476 | 483 | 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 | - //给审核变量 赋值人工审核 | |
| 496 | - shenheType = CommonConst.AUDIT_TYPE_USER; | |
| 484 | + // 机审 | |
| 485 | + shenheType = CommonConst.AUDIT_TYPE_MACHANE; | |
| 486 | + // 如果是人工审 | |
| 487 | + if (shType.equals(CommonConst.AUDIT_TYPE_USER)){ | |
| 488 | + shenheType = shType; | |
| 497 | 489 | } |
| 498 | - } | |
| 499 | - //如果栏目是朋友圈 | |
| 500 | - if (CommonUtils.isNotEmpty(shyVideo.getCategory()) && shyVideo.getCategory().equals(CommonConst.CATEGORY_MOMENT)) { | |
| 501 | - //免审 | |
| 490 | + // 如果栏目是朋友圈 | |
| 491 | + } else if (CommonUtils.isNotEmpty(shyVideo.getCategory()) && shyVideo.getCategory().equals(CommonConst.CATEGORY_MOMENT)) { | |
| 492 | + // 免审 | |
| 502 | 493 | shenheType = CommonConst.AUDIT_TYPE_FREE; |
| 494 | + }else { | |
| 495 | + shenheType = shType; | |
| 503 | 496 | } |
| 504 | 497 | } |
| 505 | - | |
| 506 | - | |
| 507 | 498 | logger.info("id : {} 审核类型: {}", shyVideo.getVideo_id(), shenheType); |
| 508 | 499 | shyVideo.setShenhe_type(shenheType); |
| 509 | 500 | } |
| ... | ... | @@ -514,15 +505,15 @@ public class VideosServiceImpl { |
| 514 | 505 | * @param shyVideo |
| 515 | 506 | * @return |
| 516 | 507 | */ |
| 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 | - } | |
| 508 | + //public boolean manualReview(ShyVideos shyVideo) { | |
| 509 | + // String[] list = {"41", "42", "43", "44", "45", "46", "47","515","516","517","518"}; | |
| 510 | + // List<String> asList = Arrays.asList(list); | |
| 511 | + // if (asList.contains(shyVideo.getSource())) { | |
| 512 | + // //人工审 返回true | |
| 513 | + // return true; | |
| 514 | + // } | |
| 515 | + // return false; | |
| 516 | + //} | |
| 526 | 517 | |
| 527 | 518 | /** |
| 528 | 519 | * 人工审核拒绝方法 | ... | ... |
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"); | ... | ... |