VideosServiceImpl.java 24.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557
package com.cnlive.shenhe.serviceImpl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cnlive.shenhe.bean.ErrorEnum;
import com.cnlive.shenhe.bean.ResponseBean;
import com.cnlive.shenhe.dto.VideosDTO;
import com.cnlive.shenhe.entity.ShyUsers;
import com.cnlive.shenhe.entity.ShyUsersfree;
import com.cnlive.shenhe.entity.ShyVideos;
import com.cnlive.shenhe.entity.ShyYidun;
import com.cnlive.shenhe.mapper.ShyUsersMapper;
import com.cnlive.shenhe.mapper.ShyVideosMapper;
import com.cnlive.shenhe.utils.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.session.RowBounds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;

import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * @Auther: chenhao
 * @Date: 2018/11/30 14:23
 * @Description:
 */
@Service
public class VideosServiceImpl {

    private static Logger logger = LoggerFactory.getLogger(VideosServiceImpl.class);
    @Autowired
    private ShyVideosMapper shyVideosMapper;
    @Autowired
    private ShyUsersMapper shyUsersMapper;

    @Autowired
    private VideosServiceImpl videosService;
    @Autowired
    private SitesServiceImpl sitesService;

    @Autowired
    private UsersfreeServiceImpl usersfreeServiceImpl;

    @Autowired
    private YiDunServiceImpl yiDunServiceImpl;
    @Autowired
    private ShyActivityImpl shyActivityImpl;

    @Value("${qn_domain}")
    private String qn_domain;

    @Value("${ks_domain}")
    private String ks_domain;

    @Autowired
    private AuditPass pass;

    @Autowired
    private ShyLogServiceImpl shyLogService;

    public boolean impotVideo(ShyVideos shyVideos) {
        int result = shyVideosMapper.insertSelective(shyVideos);
        if (result == 0) {
            return false;
        }
        return true;
    }

    public ShyVideos selectByPrimaryKey(Integer id) {
        ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id);
        return shyVideos;
    }

    public List<ShyVideos> findshyVideo(ShyVideos shyVideos) {
        List<ShyVideos> shyVideoslist = shyVideosMapper.selectByRowBounds(shyVideos, new RowBounds(0, 100));
        return shyVideoslist;
    }

    public boolean updateshyVideos(ShyVideos shyVideos) {
        int i = shyVideosMapper.updateByPrimaryKeySelective(shyVideos);
        if (i == 0) {
            return false;
        }
        return true;
    }

    public int updateVideo(Integer id, String auditor_id, String updater, String attr_tags, Integer state, String msg) {
        ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id);
        shyVideos.setAuditor_id(auditor_id);
        shyVideos.setState(state);
        if (CommonUtils.isNotEmpty(attr_tags)) {
            shyVideos.setAttr_tags(attr_tags);
        }
        if (CommonUtils.isNotEmpty(msg)) {
            shyVideos.setMsg(msg);
        }
        shyVideos.setUpdater(updater);
        if (CommonUtils.isNotEmpty(auditor_id)) {
            shyVideos.setReceive(CommonConst.RECEIVE_AFTER);
            shyVideos.setReceive_user_id(auditor_id);
            shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
        }
        return shyVideosMapper.updateByPrimaryKey(shyVideos);
    }

    public PageInfo<ShyVideos> getListContent(VideosDTO videosDTO) {
        logger.info("接受点播列表为,VideosDTO:{}", JSON.toJSONString(videosDTO));
        Example example = new Example(ShyVideos.class);
        Example.Criteria criteria = example.createCriteria();
        Example.Criteria criteria2 = example.createCriteria();
        if (CommonUtils.isNotEmpty(videosDTO.getOrderByClause())) {
            example.setOrderByClause(videosDTO.getOrderByClause());
        }
        if (CommonUtils.isNotEmpty(videosDTO.getStart_date()) && CommonUtils.isNotEmpty(videosDTO.getEnd_date())) {

            try {
                videosDTO.setStart_date(String.valueOf(CommonUtils.parseDate(videosDTO.getStart_date(), "yyyy-MM-dd")));
                videosDTO.setEnd_date(String.valueOf(CommonUtils.parseDate(videosDTO.getEnd_date(), "yyyy-MM-dd")));
            } catch (ParseException e) {
                e.printStackTrace();
            }
            criteria.andGreaterThanOrEqualTo("created_at", videosDTO.getStart_date());
            criteria2.andGreaterThanOrEqualTo("created_at", videosDTO.getStart_date());
            criteria.andLessThanOrEqualTo("created_at", videosDTO.getEnd_date());
            criteria2.andLessThanOrEqualTo("created_at", videosDTO.getEnd_date());
        }
        if (CommonUtils.isNotEmpty(videosDTO.getVideo_title())) {
            criteria.andLike("video_title", "%" + videosDTO.getVideo_title() + "%");
            criteria2.andLike("video_title", "%" + videosDTO.getVideo_title() + "%");
        }

        if (CommonUtils.isNotEmpty(videosDTO.getVideo_priority())) {
            criteria.andEqualTo("video_priority", videosDTO.getVideo_priority());
            criteria2.andEqualTo("video_priority", videosDTO.getVideo_priority());
        }

        if (CommonUtils.isNotEmpty(videosDTO.getVideo_id())) {
            criteria.andEqualTo("video_id", videosDTO.getVideo_id());
            criteria2.andEqualTo("video_id", videosDTO.getVideo_id());
        }

        if (CommonUtils.isNotEmpty(videosDTO.getShen_auditor_id())) {
            if ("白名单".equals(videosDTO.getShen_auditor_id()) || "自动审核".equals(videosDTO.getShen_auditor_id())) {
                criteria.andEqualTo("updater", videosDTO.getShen_auditor_id());
                criteria2.andEqualTo("updater", videosDTO.getShen_auditor_id());
            } else {
                criteria.andEqualTo("auditor_id", videosDTO.getShen_auditor_id());
                criteria2.andEqualTo("auditor_id", videosDTO.getShen_auditor_id());
            }
        }

        if (CommonUtils.isNotEmpty(videosDTO.getSource()) && !"22".equals(videosDTO.getSource()) && !"102".equals(videosDTO.getSource())) {
            criteria.andEqualTo("source", videosDTO.getSource());
            criteria2.andEqualTo("source", videosDTO.getSource());
        } else if (CommonUtils.isNotEmpty(videosDTO.getSource()) && "22".equals(videosDTO.getSource())) {
            criteria.andEqualTo("category", "moment");
            criteria2.andEqualTo("category", "moment");
        } else if (CommonUtils.isNotEmpty(videosDTO.getSource()) && "102".equals(videosDTO.getSource())) {
            criteria.andEqualTo("source", "102".equals(videosDTO.getSource()) ? "0" : videosDTO.getSource());
            criteria2.andEqualTo("source", "102".equals(videosDTO.getSource()) ? "0" : videosDTO.getSource());
        }

        if (CommonUtils.isNotEmpty(videosDTO.getVideo_user_id())) {
            criteria.andEqualTo("video_user_id", videosDTO.getVideo_user_id());
            criteria2.andEqualTo("video_user_id", videosDTO.getVideo_user_id());
        }

        if (CommonUtils.isNotNull(videosDTO.getSpid())) {
            criteria.andEqualTo("spid", videosDTO.getSpid());
            criteria2.andEqualTo("spid", videosDTO.getSpid());
        } else if (CommonUtils.isNotEmpty(videosDTO.getSp_Id())) {
            criteria.andEqualTo("spid", videosDTO.getSp_Id());
            criteria2.andEqualTo("spid", videosDTO.getSp_Id());
        }

        if (CommonUtils.isNotNull(videosDTO.getReceive())) {
            criteria.andEqualTo("receive", videosDTO.getReceive());
            criteria2.andEqualTo("receive", videosDTO.getReceive());
            if (videosDTO.getReceive().equals(CommonConst.RECEIVE_AFTER)) {
                criteria.andEqualTo("receive_user_id", videosDTO.getUserId());
                criteria2.andEqualTo("receive_user_id", videosDTO.getUserId());
            }
        }
        if (CommonUtils.isNotNull(videosDTO.getState()) && videosDTO.getState() != 3) {
            criteria.andEqualTo("state", videosDTO.getState());
        } else if (CommonUtils.isNotNull(videosDTO.getState()) && videosDTO.getState() == 3) {
            criteria.andEqualTo("state", 1);
            criteria2.andEqualTo("state", 2);
            example.or(criteria2);
        }
        //默认按上传时间倒序排序
        example.setOrderByClause("created_at desc");
        logger.info("获取点播列表封装对象:{}", JSON.toJSONString(videosDTO));
        PageHelper.startPage(videosDTO.getPage(), videosDTO.getPageSize(), true);
        List<ShyVideos> shyVideosList = shyVideosMapper.selectByExample(example);
        PageInfo<ShyVideos> pageInfo = new PageInfo<>(shyVideosList);
        return pageInfo;
    }

    public ShyVideos getDetailsContent(Integer id) {
        ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id);
        if (!shyVideos.getState().equals(CommonConst.AUDIT_INTT)) {
            String updater = CommonUtils.isEmpty(shyVideos.getUpdater()) || "null".equals(shyVideos.getUpdater()) ? "白名单" : shyVideos.getUpdater();
            String auditorId = shyVideos.getAuditor_id();
            if (CommonUtils.isNotEmpty(auditorId)) {
                ShyUsers user = new ShyUsers();
                user.setUser_id(auditorId);
                user = shyUsersMapper.selectOne(user);
                String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
                String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
                updater = userName;
            }
            shyVideos.setUpdater(updater);
        }
        return shyVideos;
    }

    public Integer receive(String ids, Integer num, String userId, Integer spid) {
        Integer n = 0;
        if (CommonUtils.isNotEmpty(ids)) {
            String[] cids = ids.split(",");
            for (String cid : cids) {
                ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(Integer.parseInt(cid));
                if (CommonUtils.isNotNull(shyVideos) && shyVideos.getState().equals(CommonConst.AUDIT_INTT) && shyVideos.getReceive().equals(CommonConst.RECEIVE_BEFORE)) {
                    shyVideos.setReceive_user_id(userId);
                    shyVideos.setReceive(CommonConst.RECEIVE_AFTER);
                    shyVideosMapper.updateByPrimaryKeySelective(shyVideos);
                    n++;
                }
            }
        } else if (CommonUtils.isNotNull(num) && num > 0) {
            Example example = new Example(ShyVideos.class);
            example.setOrderByClause("created_at desc");
            example.and().andEqualTo("state", CommonConst.AUDIT_INTT);
            example.and().andEqualTo("receive", CommonConst.RECEIVE_BEFORE);
            if (CommonUtils.isNotNull(spid) && spid != 0) {
                example.and().andEqualTo("spid", spid);
            }
            List<ShyVideos> shyCommentsList = shyVideosMapper.selectByExampleAndRowBounds(example, new RowBounds(0, num));
            if (!shyCommentsList.isEmpty()) {
                for (ShyVideos shyComments : shyCommentsList) {
                    shyComments.setReceive_user_id(userId);
                    shyComments.setReceive(CommonConst.RECEIVE_AFTER);
                    shyVideosMapper.updateByPrimaryKeySelective(shyComments);
                    n++;
                }
            }
        }
        return n;
    }

    public ResponseBean retReceive(String ids, String userId) {
        String[] cids = ids.split(",");
        for (String cid : cids) {
            ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(Integer.parseInt(cid));
            if (shyVideos.getState().equals(CommonConst.AUDIT_INTT) && shyVideos.getReceive().equals(CommonConst.RECEIVE_AFTER) && shyVideos.getReceive_user_id().equals(userId)) {
                shyVideos.setReceive(CommonConst.RECEIVE_BEFORE);
                shyVideos.setReceive_user_id(null);
                int i = shyVideosMapper.updateByPrimaryKey(shyVideos);
                if (i != 1) {
                    return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "退领失败,请重试");
                }
            } else {
                return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "退领失败,您选中的内容包含已退领的或已经审核的");
            }
        }
        return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "已退领");
    }

    /**
     * 根据条件导出数据excel
     *
     * @param videosDTO
     * @return
     */
    public List<ShyVideos> findByCondition(VideosDTO videosDTO) {
        Example example = new Example(ShyVideos.class);
        Example.Criteria criteria = example.createCriteria();
        if (CommonUtils.isNotEmpty(videosDTO.getOrderByClause())) {
            example.setOrderByClause(videosDTO.getOrderByClause());
        }
        if (CommonUtils.isNotEmpty(videosDTO.getStart_date()) && CommonUtils.isNotEmpty(videosDTO.getEnd_date())) {

            try {
                videosDTO.setStart_date(String.valueOf(CommonUtils.parseDate(videosDTO.getStart_date(), "yyyy-MM-dd")));
                videosDTO.setEnd_date(String.valueOf(CommonUtils.parseDate(videosDTO.getEnd_date(), "yyyy-MM-dd")));
            } catch (ParseException e) {
                e.printStackTrace();
            }
            criteria.andGreaterThanOrEqualTo("created_at", videosDTO.getStart_date());
            criteria.andLessThanOrEqualTo("created_at", videosDTO.getEnd_date());
        }
        if (CommonUtils.isNotEmpty(videosDTO.getVideo_title())) {
            criteria.andLike("video_title", "%" + videosDTO.getVideo_title() + "%");
        }
        if (CommonUtils.isNotNull(videosDTO.getState())) {
            criteria.andEqualTo("state", videosDTO.getState());
        }
        if (CommonUtils.isNotEmpty(videosDTO.getVideo_priority())) {
            criteria.andEqualTo("video_priority", videosDTO.getVideo_priority());
        }
        if (CommonUtils.isNotEmpty(videosDTO.getVideo_user_id())) {
            criteria.andEqualTo("video_user_id", videosDTO.getVideo_user_id());
        }

        if (videosDTO.getSource() != null) {
            criteria.andEqualTo("source", videosDTO.getSource());
        }

        if (CommonUtils.isNotNull(videosDTO.getSpid())) {
            criteria.andEqualTo("spid", videosDTO.getSpid());
        }

        if (CommonUtils.isNotNull(videosDTO.getReceive())) {
            criteria.andEqualTo("receive", videosDTO.getReceive());
            if (videosDTO.getReceive().equals(CommonConst.RECEIVE_AFTER)) {
                criteria.andEqualTo("receive_user_id", videosDTO.getUserId());
            }
        }
        //默认按上传时间倒序排序
        List<ShyVideos> shyVideosList = shyVideosMapper.selectByExample(example);
        return shyVideosList;
    }

    /**
     * 易盾视频(图片)过滤
     * type:1:文本 2:图片 3.网页 4:点播音频
     *
     * @param cid 审核云中视频的id
     * @return
     */
    public int videoFilter(Integer cid) {
        ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(cid);
        shyVideos.setUpdater("自动审核");
        Integer plat = shyVideos.getPlat();
        String yuming = "";
        if (plat.equals(CommonConst.QINIU_PLAT)) {
            yuming = qn_domain + "/";
        } else if (plat.equals(CommonConst.KS_PLAT)) {
            yuming = ks_domain + "/";
        }
        String url = "";
        JSONArray jsonArray = new JSONArray();
        List<String> imgList = JSONArray.parseArray(shyVideos.getAvsample_imgs(), String.class);
        for (String imgStr : imgList) {
            String imgUrl = yuming + imgStr;
            JSONObject image = new JSONObject();
            String uuid = UUID.randomUUID().toString();
            image.put("name", uuid);
            image.put("type", 1);
            image.put("data", imgUrl);
            jsonArray.add(image);
            url = url + "(" + uuid + ")";
        }
        //易盾返回结果的类型
        //调用易盾智能图片审核接口
        JSONObject imagesFilter = YiDunAntiFraudUtil.getImagesFilter(jsonArray.toJSONString());
        //易盾返回结果的类型
        String type = imagesFilter.getString("type");
        //易盾失败结果的详情
        String desc = imagesFilter.getString("desc");
        if (type.toLowerCase().equals(CommonConst.PASS)) {
            shyVideos.setMsg(desc);
            //修改点播云视频状态
            videosService.updateDianboAndShenhe(shyVideos, CommonConstStates.TONGGUO);
        } else if (type.toLowerCase().equals(CommonConst.REJECT)) {
            //审核类型改为人工审核
            shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
            //拒绝原因
            shyVideos.setMsg(desc);
            videosService.updateshyVideos(shyVideos);
        }
        try {
            ShyYidun shyYidun = new ShyYidun();
            shyYidun.setId(UUID.randomUUID().toString());
            shyYidun.setContent_id(cid.toString());
            shyYidun.setUrl(url);
            shyYidun.setDesc_msg(desc);
            //校验图片类型
            shyYidun.setCheck_type(CommonConstStates.TUPIAN);
            shyYidun.setDuration(shyVideos.getDuration());
            shyYidun.setCreate_time(new Date());

            yiDunServiceImpl.addYiDunMsg(shyYidun);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }

    /**
     * 更新点播和审核的视频状态
     *
     * @param video
     * @param dianboState 视频状态,1通过,2不通过
     * @return
     */
    public int updateDianboAndShenhe(ShyVideos video, int dianboState) {
        //修改点播云的视频状态
        JSONObject result = pass.auditPass(video.getVideo_id(), dianboState, video.getMsg(), video.getMsg(), video.getCallback());
        logger.error("点播回调result:{}", result);
        Integer code = result.getInteger("code");
        String errorCode = result.getString("errorCode");
        Integer shenheState = CommonConst.AUDIT_REFUSE;
        String callback = video.getCallback();
        if (callback.contains("bc.cnlive.com")) {
            if ("0".equals(errorCode)) {
                if (dianboState == CommonConstStates.TONGGUO) {
                    shenheState = CommonConst.AUDIT_SUCCESS;
                }
                //修改审核云的视频状态
                int i = videosService.updateVideo(video.getId(), null, video.getUpdater(), "", shenheState, video.getMsg());
                if (i != 1) {
                    logger.error("点播视频更改失败,activity_id:{}", video.getVideo_id());
                }
                return i;
            } else {
                video.setMsg("点播视频回调失败," + video.getMsg());
                videosService.updateVideo(video.getId(), null, video.getUpdater(), "", CommonConst.AUDIT_CALLBACK_FAIL, video.getMsg());
                logger.error("点播视频回调失败,activity_id:{},code:{},msg:{}", video.getVideo_id(), code, result.getString("msg"));
            }
        } else {
            if (0 == code) {
                if (dianboState == CommonConstStates.TONGGUO) {
                    shenheState = CommonConst.AUDIT_SUCCESS;
                }
                //修改审核云的视频状态
                int i = videosService.updateVideo(video.getId(), null, video.getUpdater(), "", shenheState, video.getMsg());
                if (i != 1) {
                    logger.error("点播视频更改失败,activity_id:{}", video.getVideo_id());
                }
                return i;
            } else {
                video.setMsg("点播视频回调失败," + video.getMsg());
                videosService.updateVideo(video.getId(), null, video.getUpdater(), "", CommonConst.AUDIT_CALLBACK_FAIL, video.getMsg());
                logger.error("点播视频回调失败,activity_id:{},code:{},msg:{}", video.getVideo_id(), code, result.getString("msg"));
            }
        }
        return 0;
    }


    /**
     * 根据sp、栏目、用户id来判断审核类型
     *
     * @param shyVideo
     */
    public void getShenheType(ShyVideos shyVideo) {
        //获取点播免审sp
        List<Integer> sites = sitesService.getBusinessList(CommonConst.BUSINESS_VIDEO);
        // List<Integer> shyActivities = shyActivityImpl.selectByExample(CommonConst.AUDIT_TYPE_FREE);
        logger.info("====sites:{}", sites.toString());
        String source = shyVideo.getSource();
        // 根据source 查询审核类型
        Integer shType = shyActivityImpl.selectBySource(StringUtils.isEmpty(source) ? 0 : Integer.valueOf(source));

        ShyUsersfree shyUserfree = null;
        //如果用户id存在
        if (CommonUtils.isNotEmpty(shyVideo.getVideo_user_id())) {
            shyUserfree = usersfreeServiceImpl.selectUser(shyVideo.getSpid(), shyVideo.getCategory(), shyVideo.getVideo_user_id());
        }
        //初始化一个审核状态
        //审核类型,1:免审,2:机审,3:人工审
        Integer shenheType = CommonConst.AUDIT_TYPE_USER;
        //如果当前sp是免审sp  source有传空的时候 默认给0                                             //如果存在免审用户
        if (sites.contains(shyVideo.getSpid()) || shType.equals(CommonConst.AUDIT_TYPE_FREE) || CommonUtils.isNotNull(shyUserfree)) {
            logger.info("进入已经免审渠道:{}", source);
            //免审
            shenheType = CommonConst.AUDIT_TYPE_FREE;
        }  else {
            //如果栏目是“目击者”
            if (CommonUtils.isNotEmpty(shyVideo.getCategory()) && shyVideo.getCategory().equals(CommonConst.CATEGORY_WITNESS)) {
                // 机审
                shenheType = CommonConst.AUDIT_TYPE_MACHANE;
                // 如果是人工审
                if (shType.equals(CommonConst.AUDIT_TYPE_USER)){
                    shenheType = shType;
                }
                // 如果栏目是朋友圈
            } else if (CommonUtils.isNotEmpty(shyVideo.getCategory()) && shyVideo.getCategory().equals(CommonConst.CATEGORY_MOMENT)) {
                // 免审
                shenheType = CommonConst.AUDIT_TYPE_FREE;
            }else {
                shenheType = shType;
            }
        }
        logger.info("id : {}  审核类型: {}", shyVideo.getVideo_id(), shenheType);
        shyVideo.setShenhe_type(shenheType);
    }

    /**
     * 以下参数为人工审核
     *
     * @param shyVideo
     * @return
     */
    //public boolean manualReview(ShyVideos shyVideo) {
    //    String[] list = {"41", "42", "43", "44", "45", "46", "47","515","516","517","518"};
    //    List<String> asList = Arrays.asList(list);
    //    if (asList.contains(shyVideo.getSource())) {
    //        //人工审 返回true
    //        return true;
    //    }
    //    return false;
    //}

    /**
     * 人工审核拒绝方法
     *
     * @param shyVideoId
     * @param msg
     * @param userId
     * @param
     * @return
     */
    public String repulse(String shyVideoId, String msg, String userId) {
        String showMsg = "";
        ShyVideos shyVideos = videosService.selectByPrimaryKey(Integer.parseInt(shyVideoId));
        JSONObject result = null;
        try {
            result = pass.auditPass(shyVideos.getVideo_id(), 4, msg, msg, shyVideos.getCallback());
        } catch (Exception e) {
            logger.error("视频审核失败,id==" + shyVideoId, e);
            showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";
            return showMsg;
        }
        if (result == null) {
            logger.error("视频审核失败且接口错误没有返回信息,id==" + shyVideoId);
            showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败";
            return showMsg;
        }
        Integer code = result.getInteger("code");
        if (code != 0) {
            logger.error("视频审核失败,id:{},code:{}", shyVideoId, code);
            showMsg = showMsg + "," + shyVideos.getVideo_title() + " " + result.getString("msg");
            return showMsg;
        }
        int i = videosService.updateVideo(Integer.parseInt(shyVideoId), userId, null, "", 2, msg);
        if (i == 0) {
            showMsg = showMsg + "," + shyVideos.getVideo_title() + " 更新失败";
            return showMsg;
        }
        return showMsg;
    }

}