Commit 707a014ec83ab7d573188ca5452622ad16ee0ffb

Authored by liwei2917
1 parent 1d35f645

增加频道审核

src/main/java/com/cnlive/shenhe/api/ChannelControllerApi.java 0 → 100644
  1 +package com.cnlive.shenhe.api;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.cnlive.shenhe.bean.ErrorEnum;
  5 +import com.cnlive.shenhe.bean.ResponseBean;
  6 +import com.cnlive.shenhe.entity.ShyChannel;
  7 +import com.cnlive.shenhe.serviceImpl.ChannelServiceImpl;
  8 +import com.cnlive.shenhe.utils.AuditPass;
  9 +import com.cnlive.shenhe.utils.CommonConst;
  10 +import com.cnlive.shenhe.utils.CommonUtils;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.stereotype.Controller;
  15 +import org.springframework.web.bind.annotation.PostMapping;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.ResponseBody;
  18 +
  19 +import java.util.List;
  20 +
  21 +@Controller
  22 +@RequestMapping("/api/channel")
  23 +public class ChannelControllerApi {
  24 + private static Logger logger = LoggerFactory.getLogger(ChannelControllerApi.class);
  25 + @Autowired
  26 + AuditPass Pass;
  27 + @Autowired
  28 + ChannelServiceImpl channelService;
  29 +
  30 + /**
  31 + * @Auther: liwei
  32 + * @Date: 2019/08/17 11:17
  33 + * @Description: 频道送审接口
  34 + */
  35 + @PostMapping("/import")
  36 + @ResponseBody
  37 + public ResponseBean impotChannel(String param) {
  38 + logger.info("频道入库,param=====" + param);
  39 + JSONObject json = JSONObject.parseObject(param);
  40 + //判断是否存在
  41 + ShyChannel shyChannel = new ShyChannel();
  42 + shyChannel.setChannel_id(json.getString("channelId"));
  43 + List<ShyChannel> channelList = channelService.findshyChannel(shyChannel);
  44 +
  45 + Integer sp_id=null;
  46 + try {
  47 + sp_id=json.getInteger("spId");
  48 + } catch (Exception e) {
  49 + sp_id=null;
  50 + }
  51 + //存在则更新
  52 + if (channelList.size() > 0) {
  53 + ShyChannel shyChannel1 = channelList.get(0);
  54 + shyChannel1.setShenhe_status(CommonConst.AUDIT_INTT);
  55 + shyChannel1.setChannel_name(json.getString("channelName"));
  56 + shyChannel1.setChannel_img(json.getString("face"));
  57 + shyChannel1.setCallback(json.getString("callback"));
  58 + shyChannel1.setSp_id(sp_id);
  59 + shyChannel1.setOffline(0);//是否下线 0表示正常 1表示下线
  60 + shyChannel1.setUpdated_at(CommonUtils.getCurrentTime());
  61 + boolean YorN = channelService.updateshyChannel(shyChannel1);
  62 + if (YorN == true) {
  63 + return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(),"审核请求收到成功");
  64 + } else {
  65 + return new ResponseBean(ErrorEnum.ERROR.getErrorCode(),"审核请求收到失败(更新)");
  66 + }
  67 + }
  68 + //如果不存在直接插入
  69 + shyChannel.setShenhe_status(CommonConst.AUDIT_INTT);
  70 + shyChannel.setChannel_name(json.getString("channelName"));
  71 + shyChannel.setChannel_img(json.getString("face"));
  72 + shyChannel.setCallback(json.getString("callback"));
  73 + shyChannel.setSp_id(sp_id);
  74 + shyChannel.setOffline(0);//是否下线 0表示正常 1表示下线
  75 + shyChannel.setCreated_at(CommonUtils.getCurrentTime());
  76 + shyChannel.setUpdated_at(CommonUtils.getCurrentTime());
  77 + channelService.getShenheType(shyChannel);
  78 + boolean YorN = channelService.impotChannel(shyChannel);
  79 + if (YorN == true) {
  80 + return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(),"审核请求收到成功");
  81 + } else {
  82 + return new ResponseBean(ErrorEnum.ERROR.getErrorCode(),"审核请求收到失败(新增)");
  83 + }
  84 + }
  85 +
  86 +}
src/main/java/com/cnlive/shenhe/controller/ChannelController.java 0 → 100644
  1 +package com.cnlive.shenhe.controller;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.cnlive.shenhe.bean.ErrorEnum;
  5 +import com.cnlive.shenhe.bean.ResponseBean;
  6 +import com.cnlive.shenhe.bean.SessionUser;
  7 +import com.cnlive.shenhe.entity.ShyChannel;
  8 +import com.cnlive.shenhe.entity.ShyContent;
  9 +import com.cnlive.shenhe.entity.ShySites;
  10 +import com.cnlive.shenhe.entity.ShyUsers;
  11 +import com.cnlive.shenhe.entity.ShyVideos;
  12 +import com.cnlive.shenhe.serviceImpl.ChannelServiceImpl;
  13 +import com.cnlive.shenhe.serviceImpl.ContentServiceImpl;
  14 +import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
  15 +import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
  16 +import com.cnlive.shenhe.utils.AuditPass;
  17 +import com.cnlive.shenhe.utils.CommonConst;
  18 +import com.cnlive.shenhe.utils.CommonUtils;
  19 +import com.github.pagehelper.PageInfo;
  20 +import org.slf4j.Logger;
  21 +import org.slf4j.LoggerFactory;
  22 +import org.springframework.beans.factory.annotation.Autowired;
  23 +import org.springframework.stereotype.Controller;
  24 +import org.springframework.ui.Model;
  25 +import org.springframework.web.bind.annotation.*;
  26 +
  27 +import javax.servlet.http.HttpSession;
  28 +import java.util.Date;
  29 +import java.util.List;
  30 +
  31 +
  32 +@Controller
  33 +@RequestMapping("/channel")
  34 +public class ChannelController {
  35 + private static Logger logger = LoggerFactory.getLogger(ChannelController.class);
  36 + @Autowired
  37 + AuditPass Pass;
  38 + @Autowired
  39 + ChannelServiceImpl channelService;
  40 +
  41 + @Autowired
  42 + UsersServiceImpl usersService;
  43 +
  44 + @Autowired
  45 + SitesServiceImpl sitesService;
  46 +
  47 + /**
  48 + * 评论列表页
  49 + *
  50 + * @param model
  51 + * @param channelId
  52 + * @param channelName
  53 + * @param offline
  54 + * @param start_date
  55 + * @param end_date
  56 + * @param state
  57 + * @param sp_desc
  58 + * @param page
  59 + * @param pageSize
  60 + * @param orderByClause
  61 + * @param session
  62 + * @return
  63 + */
  64 + @GetMapping("/page")
  65 + public String getPage(Model model, String channel_id, String channel_name, Integer receive,
  66 + String start_date, String end_date,Integer shenhe_status, String sp_desc,
  67 + Integer page, Integer pageSize, String orderByClause, HttpSession session) {
  68 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  69 + if(CommonUtils.isNull(sessionUser)){
  70 + return "redirect:/users/login";
  71 + }
  72 + Integer spid = sessionUser.getSpid();
  73 + String userId = sessionUser.getUserId();
  74 + if (CommonUtils.isNull(page)) page = 1;
  75 + if (CommonUtils.isNull(pageSize)) pageSize = 10;
  76 + if (CommonUtils.isNotEmpty(sp_desc) && spid == 0) {
  77 + ShySites shySite=sitesService.findspidBySpdesc(sp_desc);
  78 + if(CommonUtils.isNotNull(shySite)){
  79 + spid = shySite.getSpid();
  80 + }else{
  81 + return "page/sitesError.html";
  82 + }
  83 + } else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
  84 + spid = null;
  85 + }
  86 + Date sDate = null;
  87 + Date eDate = null;
  88 +
  89 + if (CommonUtils.isNotEmpty(start_date)) {
  90 + try {
  91 + sDate = CommonUtils.parseDate(start_date, "yyyy-MM-dd");
  92 + } catch (Exception e) {
  93 + }
  94 + }
  95 + if (CommonUtils.isNotEmpty(end_date)) {
  96 + try {
  97 + eDate = CommonUtils.parseDate(end_date, "yyyy-MM-dd");
  98 + } catch (Exception e) {
  99 + }
  100 + }
  101 + PageInfo<ShyChannel> channelPage = channelService.getPage(channel_id, channel_name, receive, sDate, eDate, shenhe_status, null, page, pageSize, orderByClause, spid, userId);
  102 + List<ShyChannel> list = channelPage.getList();
  103 + if (!list.isEmpty()) {
  104 + for (ShyChannel channel : list) {
  105 + if (channel.getShenhe_status() != CommonConst.AUDIT_INTT) {
  106 + String updater = CommonUtils.isEmpty(channel.getUpdater()) || "null".equals(channel.getUpdater())? "白名单":channel.getUpdater();
  107 + String auditor_id = channel.getAuditor();
  108 + if (CommonUtils.isNotEmpty(auditor_id)) {
  109 + ShyUsers user = new ShyUsers();
  110 + user.setUser_id(auditor_id);
  111 + user = usersService.select(user);
  112 + if (CommonUtils.isNotNull(user)) {
  113 + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
  114 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
  115 + updater = userName ;
  116 + }
  117 + }
  118 + channel.setUpdater(updater);
  119 + }
  120 + if(null!=channel.getSp_id()){
  121 + //显示spid简称
  122 + ShySites shySites = sitesService.findspidDescByspid(channel.getSp_id());
  123 + if (CommonUtils.isNotNull(shySites)) {
  124 + channel.setSp_desc(shySites.getName());
  125 + }
  126 + }else{
  127 + channel.setSp_desc("sp无法显示");
  128 + }
  129 +
  130 + }
  131 + }
  132 + /* 获取参数值给前台 用来判断是否需要把查看显示出来 state recive*/
  133 + String state1 = shenhe_status == null ? "" : shenhe_status.toString();
  134 + model.addAttribute("state1", state1);
  135 + model.addAttribute("pageSize", pageSize);
  136 + model.addAttribute("channelPage", channelPage);
  137 + return "page/channel.html";
  138 + }
  139 +
  140 + /**
  141 + * 评论详情
  142 + *
  143 + * @param id
  144 + * @return
  145 + */
  146 + @GetMapping("/details/{id}")
  147 + public String getDetailsChannel(@PathVariable Integer id, Model model) {
  148 + ShyChannel comment = channelService.getDetailsComment(id);
  149 + model.addAttribute("comment", comment);
  150 + return "page/commentDetail.html";
  151 + }
  152 +
  153 +
  154 + /**
  155 + * 审核通过
  156 + *
  157 + * @param ids
  158 + * @return
  159 + */
  160 + @PostMapping("/pass")
  161 + @ResponseBody
  162 + public ResponseBean pass(String ids, HttpSession session) {
  163 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  164 + String userId = sessionUser.getUserId();
  165 + boolean success = channelService.updateState(ids, CommonConst.AUDIT_SUCCESS, userId,"","审核通过");
  166 + if (success) {
  167 + return new ResponseBean();
  168 + } else {
  169 + return new ResponseBean(ErrorEnum.ERROR);
  170 + }
  171 + }
  172 +
  173 + /**
  174 + * 审核拒绝
  175 + *
  176 + * @param ids
  177 + * @return
  178 + */
  179 + @PostMapping("/refuse")
  180 + @ResponseBody
  181 + public ResponseBean refuse(String ids, HttpSession session) {
  182 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  183 + String userId = sessionUser.getUserId();
  184 + boolean success = channelService.updateState(ids, CommonConst.AUDIT_REFUSE, userId,"","审核拒绝");
  185 + if (success) {
  186 + return new ResponseBean();
  187 + } else {
  188 + return new ResponseBean(ErrorEnum.ERROR);
  189 + }
  190 +
  191 + }
  192 +
  193 +
  194 + /**
  195 + * 打回(审核拒绝,应要求不加权限、状态等限制)
  196 + *
  197 + * @param ids
  198 + * @param msg
  199 + * @param session
  200 + * @return
  201 + */
  202 + @PostMapping("/repulse")
  203 + @ResponseBody
  204 + public ResponseBean repulse(String ids, String msg, HttpSession session) {
  205 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  206 + String userId = sessionUser.getUserId();
  207 + ResponseBean responseBean = new ResponseBean();
  208 + String[] channelIds = ids.split(",");
  209 + String showMsg = "";
  210 + for (String channelId : channelIds) {
  211 + ShyChannel channel = channelService.selectByPrimaryKey(Integer.parseInt(channelId));
  212 + JSONObject result = null;
  213 + JSONObject json = new JSONObject();
  214 + json.put("channel_id", channel.getChannel_id());
  215 + json.put("state", 4);
  216 + json.put("attr_tags", "");
  217 + json.put("msg", msg);
  218 + try {
  219 + result = Pass.commentPass(json, channel.getCallback());
  220 + } catch (Exception e) {
  221 + logger.error("评论回调失败,activity_id:{}", channel.getChannel_id());
  222 + showMsg = showMsg + "," + channel.getChannel_name() + "的评论拒绝请求失败";
  223 + break;
  224 + }
  225 + if (result == null) {
  226 + logger.error("评论回调错误,且无返回信息。activity_id:{}", channel.getChannel_id());
  227 + showMsg = showMsg + "," + channel.getChannel_name() + "的评论拒绝请求失败";
  228 + break;
  229 + } else {
  230 + Integer code = result.getInteger("errorCode");
  231 + if (code != 0) {
  232 + logger.error("评论回调错误,activity_id:{},errorCode:{},errorMessage:{}", channel.getChannel_id(), code, result.getString("errorMessage"));
  233 + showMsg = showMsg + "," + channel.getChannel_name() + "的评论拒绝请求失败";
  234 + break;
  235 + }
  236 + channel.setShenhe_status(2);
  237 + channel.setAuditor(userId);
  238 + channel.setShenhe_msg(msg);
  239 + int i = channelService.updateByPrimaryKeySelective(channel);
  240 + if (i != 1) {
  241 + logger.error("评论回调失败,修改结果为0条activity_id:{}", channel.getChannel_id());
  242 + showMsg = showMsg + "," + channel.getChannel_name() + "的评论拒绝请求失败";
  243 + }
  244 + }
  245 + }
  246 + if (CommonUtils.isNotEmpty(showMsg)) {
  247 + responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode());
  248 + responseBean.setErrorMessage(showMsg);
  249 + }
  250 + return responseBean;
  251 + }
  252 +}
src/main/java/com/cnlive/shenhe/entity/ShyChannel.java 0 → 100644
  1 +package com.cnlive.shenhe.entity;
  2 +
  3 +import java.util.Date;
  4 +import javax.persistence.*;
  5 +
  6 +@Table(name = "shy_channel")
  7 +public class ShyChannel {
  8 + @Id
  9 + private Integer id;
  10 +
  11 + /**
  12 + * spId
  13 + */
  14 + private Integer sp_id;
  15 +
  16 + /**
  17 + * 频道id
  18 + */
  19 + private String channel_id;
  20 +
  21 + /**
  22 + * 频道名称
  23 + */
  24 + private String channel_name;
  25 +
  26 + /**
  27 + * 频道图片地址
  28 + */
  29 + private String channel_img;
  30 +
  31 + /**
  32 + * 回调地址
  33 + */
  34 + private String callback;
  35 +
  36 + /**
  37 + * 更新着
  38 + */
  39 + private String updater;
  40 +
  41 + /**
  42 + * 审核员id
  43 + */
  44 + private String auditor;
  45 +
  46 + /**
  47 + * 审核类型 1:免审 3:人工审
  48 + */
  49 + private Integer shenhe_type;
  50 +
  51 + /**
  52 + * 审核状态 0:未审,1:已审通过 2:已审拒绝
  53 + */
  54 + private Integer shenhe_status;
  55 +
  56 + /**
  57 + * 审核消息
  58 + */
  59 + private String shenhe_msg;
  60 +
  61 + /**
  62 + * 是否下线 0表示正常 1表示下线
  63 + */
  64 + private Integer offline;
  65 +
  66 + /**
  67 + * 创建时间
  68 + */
  69 + private Date created_at;
  70 +
  71 + /**
  72 + * 更新时间
  73 + */
  74 + private Date updated_at;
  75 +
  76 + /**
  77 + * sp昵称
  78 + */
  79 + @Transient
  80 + private String sp_desc;
  81 +
  82 + /**
  83 + * @return id
  84 + */
  85 + public Integer getId() {
  86 + return id;
  87 + }
  88 +
  89 + /**
  90 + * @param id
  91 + */
  92 + public void setId(Integer id) {
  93 + this.id = id;
  94 + }
  95 +
  96 + /**
  97 + * 获取spId
  98 + *
  99 + * @return sp_id - spId
  100 + */
  101 + public Integer getSp_id() {
  102 + return sp_id;
  103 + }
  104 +
  105 + /**
  106 + * 设置spId
  107 + *
  108 + * @param sp_id spId
  109 + */
  110 + public void setSp_id(Integer sp_id) {
  111 + this.sp_id = sp_id;
  112 + }
  113 +
  114 + /**
  115 + * 获取频道id
  116 + *
  117 + * @return channel_id - 频道id
  118 + */
  119 + public String getChannel_id() {
  120 + return channel_id;
  121 + }
  122 +
  123 + /**
  124 + * 设置频道id
  125 + *
  126 + * @param channel_id 频道id
  127 + */
  128 + public void setChannel_id(String channel_id) {
  129 + this.channel_id = channel_id;
  130 + }
  131 +
  132 + /**
  133 + * 获取频道名称
  134 + *
  135 + * @return channel_name - 频道名称
  136 + */
  137 + public String getChannel_name() {
  138 + return channel_name;
  139 + }
  140 +
  141 + /**
  142 + * 设置频道名称
  143 + *
  144 + * @param channel_name 频道名称
  145 + */
  146 + public void setChannel_name(String channel_name) {
  147 + this.channel_name = channel_name;
  148 + }
  149 +
  150 + /**
  151 + * 获取频道图片地址
  152 + *
  153 + * @return channel_img - 频道图片地址
  154 + */
  155 + public String getChannel_img() {
  156 + return channel_img;
  157 + }
  158 +
  159 + /**
  160 + * 设置频道图片地址
  161 + *
  162 + * @param channel_img 频道图片地址
  163 + */
  164 + public void setChannel_img(String channel_img) {
  165 + this.channel_img = channel_img;
  166 + }
  167 +
  168 + /**
  169 + * 获取回调地址
  170 + *
  171 + * @return callback - 回调地址
  172 + */
  173 + public String getCallback() {
  174 + return callback;
  175 + }
  176 +
  177 + /**
  178 + * 设置回调地址
  179 + *
  180 + * @param callback 回调地址
  181 + */
  182 + public void setCallback(String callback) {
  183 + this.callback = callback;
  184 + }
  185 +
  186 + /**
  187 + * 获取更新着
  188 + *
  189 + * @return updater - 更新着
  190 + */
  191 + public String getUpdater() {
  192 + return updater;
  193 + }
  194 +
  195 + /**
  196 + * 设置更新着
  197 + *
  198 + * @param updater 更新着
  199 + */
  200 + public void setUpdater(String updater) {
  201 + this.updater = updater;
  202 + }
  203 +
  204 + /**
  205 + * 获取审核员id
  206 + *
  207 + * @return auditor - 审核员id
  208 + */
  209 + public String getAuditor() {
  210 + return auditor;
  211 + }
  212 +
  213 + /**
  214 + * 设置审核员id
  215 + *
  216 + * @param auditor 审核员id
  217 + */
  218 + public void setAuditor(String auditor) {
  219 + this.auditor = auditor;
  220 + }
  221 +
  222 + /**
  223 + * 获取审核类型 1:免审 3:人工审
  224 + *
  225 + * @return shenhe_type - 审核类型 1:免审 3:人工审
  226 + */
  227 + public Integer getShenhe_type() {
  228 + return shenhe_type;
  229 + }
  230 +
  231 + /**
  232 + * 设置审核类型 1:免审 3:人工审
  233 + *
  234 + * @param shenhe_type 审核类型 1:免审 3:人工审
  235 + */
  236 + public void setShenhe_type(Integer shenhe_type) {
  237 + this.shenhe_type = shenhe_type;
  238 + }
  239 +
  240 + /**
  241 + * 获取审核状态 0:未审,1:已审通过 2:已审拒绝
  242 + *
  243 + * @return shenhe_status - 审核状态 0:未审,1:已审通过 2:已审拒绝
  244 + */
  245 + public Integer getShenhe_status() {
  246 + return shenhe_status;
  247 + }
  248 +
  249 + /**
  250 + * 设置审核状态 0:未审,1:已审通过 2:已审拒绝
  251 + *
  252 + * @param shenhe_status 审核状态 0:未审,1:已审通过 2:已审拒绝
  253 + */
  254 + public void setShenhe_status(Integer shenhe_status) {
  255 + this.shenhe_status = shenhe_status;
  256 + }
  257 +
  258 + /**
  259 + * 获取审核消息
  260 + *
  261 + * @return shenhe_msg - 审核消息
  262 + */
  263 + public String getShenhe_msg() {
  264 + return shenhe_msg;
  265 + }
  266 +
  267 + /**
  268 + * 设置审核消息
  269 + *
  270 + * @param shenhe_msg 审核消息
  271 + */
  272 + public void setShenhe_msg(String shenhe_msg) {
  273 + this.shenhe_msg = shenhe_msg;
  274 + }
  275 +
  276 + /**
  277 + * 获取是否下线 0表示正常 1表示下线
  278 + *
  279 + * @return offline - 是否下线 0表示正常 1表示下线
  280 + */
  281 + public Integer getOffline() {
  282 + return offline;
  283 + }
  284 +
  285 + /**
  286 + * 设置是否下线 0表示正常 1表示下线
  287 + *
  288 + * @param offline 是否下线 0表示正常 1表示下线
  289 + */
  290 + public void setOffline(Integer offline) {
  291 + this.offline = offline;
  292 + }
  293 +
  294 + /**
  295 + * 获取创建时间
  296 + *
  297 + * @return created_at - 创建时间
  298 + */
  299 + public Date getCreated_at() {
  300 + return created_at;
  301 + }
  302 +
  303 + /**
  304 + * 设置创建时间
  305 + *
  306 + * @param created_at 创建时间
  307 + */
  308 + public void setCreated_at(Date created_at) {
  309 + this.created_at = created_at;
  310 + }
  311 +
  312 + /**
  313 + * 获取更新时间
  314 + *
  315 + * @return updated_at - 更新时间
  316 + */
  317 + public Date getUpdated_at() {
  318 + return updated_at;
  319 + }
  320 +
  321 + /**
  322 + * 设置更新时间
  323 + *
  324 + * @param updated_at 更新时间
  325 + */
  326 + public void setUpdated_at(Date updated_at) {
  327 + this.updated_at = updated_at;
  328 + }
  329 +
  330 + public String getSp_desc() {
  331 + return sp_desc;
  332 + }
  333 +
  334 + public void setSp_desc(String sp_desc) {
  335 + this.sp_desc = sp_desc;
  336 + }
  337 +
  338 +}
0 \ No newline at end of file 339 \ No newline at end of file
src/main/java/com/cnlive/shenhe/mapper/ShyChannelMapper.java 0 → 100644
  1 +package com.cnlive.shenhe.mapper;
  2 +
  3 +import com.cnlive.shenhe.entity.ShyChannel;
  4 +import tk.mybatis.mapper.common.Mapper;
  5 +
  6 +public interface ShyChannelMapper extends Mapper<ShyChannel> {
  7 +}
0 \ No newline at end of file 8 \ No newline at end of file
src/main/java/com/cnlive/shenhe/serviceImpl/ChannelServiceImpl.java 0 → 100644
  1 +package com.cnlive.shenhe.serviceImpl;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.cnlive.shenhe.entity.ShyChannel;
  5 +import com.cnlive.shenhe.entity.ShyChannel;
  6 +import com.cnlive.shenhe.entity.ShySites;
  7 +import com.cnlive.shenhe.entity.ShyUsers;
  8 +import com.cnlive.shenhe.entity.ShyUsersfree;
  9 +import com.cnlive.shenhe.entity.ShyVideos;
  10 +import com.cnlive.shenhe.mapper.ShyChannelMapper;
  11 +import com.cnlive.shenhe.mapper.ShyChannelMapper;
  12 +import com.cnlive.shenhe.mapper.ShySitesMapper;
  13 +import com.cnlive.shenhe.mapper.ShyUsersMapper;
  14 +import com.cnlive.shenhe.utils.AuditPass;
  15 +import com.cnlive.shenhe.utils.CommonConst;
  16 +import com.cnlive.shenhe.utils.CommonUtils;
  17 +import com.github.pagehelper.PageHelper;
  18 +import com.github.pagehelper.PageInfo;
  19 +import org.apache.ibatis.session.RowBounds;
  20 +import org.slf4j.Logger;
  21 +import org.slf4j.LoggerFactory;
  22 +import org.springframework.beans.factory.annotation.Autowired;
  23 +import org.springframework.stereotype.Service;
  24 +import tk.mybatis.mapper.entity.Example;
  25 +
  26 +import java.sql.Timestamp;
  27 +import java.text.ParseException;
  28 +import java.util.Date;
  29 +import java.util.List;
  30 +
  31 +/**
  32 + * @Auther: chenhao
  33 + * @Date: 2018/12/4 17:30
  34 + * @Description:
  35 + */
  36 +@Service
  37 +public class ChannelServiceImpl {
  38 +
  39 + private static Logger logger = LoggerFactory.getLogger(ChannelServiceImpl.class);
  40 + @Autowired
  41 + ShyChannelMapper shyChannelMapper;
  42 + @Autowired
  43 + ShySitesMapper shySitesMapper;
  44 + @Autowired
  45 + ShyUsersMapper shyUsersMapper;
  46 + @Autowired
  47 + AuditPass Pass;
  48 +
  49 + @Autowired
  50 + SitesServiceImpl sitesService;
  51 +
  52 + public List<ShySites> getBusiness(ShySites shySites) {
  53 + List<ShySites> sitesList = shySitesMapper.select(shySites);
  54 + return sitesList;
  55 + }
  56 +
  57 + //**************************************
  58 + public List<ShyChannel> findshyChannel(ShyChannel shyChannel) {
  59 + List<ShyChannel> channelList = shyChannelMapper.selectByRowBounds(shyChannel, new RowBounds(0, 100));
  60 + return channelList;
  61 + }
  62 +
  63 + public boolean updateshyChannel(ShyChannel shyChannel) {
  64 + int result = shyChannelMapper.updateByPrimaryKey(shyChannel);
  65 + if (result == 0) {
  66 + return false;
  67 + }
  68 + return true;
  69 + }
  70 +
  71 + public boolean impotChannel(ShyChannel shyChannel) {
  72 + int result = shyChannelMapper.insertSelective(shyChannel);
  73 + if (result == 0) {
  74 + return false;
  75 + }
  76 + return true;
  77 + }
  78 +
  79 + public int updateChannel(Integer id, Integer state, String msg) {
  80 + ShyChannel shyChannel = shyChannelMapper.selectByPrimaryKey(id);
  81 + shyChannel.setShenhe_status(state);
  82 + shyChannel.setShenhe_msg(msg);
  83 + return shyChannelMapper.updateByPrimaryKeySelective(shyChannel);
  84 + }
  85 +
  86 + public PageInfo<ShyChannel> getPage(String channelId, String channelName, Integer receive, Date start_date, Date end_date, Integer shenhe_status, String updater, Integer page, Integer pageSize, String orderByClause, Integer spid, String userId) {
  87 + Example example = new Example(ShyChannel.class);
  88 + Example.Criteria criteria = example.createCriteria();
  89 + if (CommonUtils.isNotEmpty(orderByClause)) {
  90 + example.setOrderByClause(orderByClause);
  91 + } else {
  92 + example.setOrderByClause("created_at desc");
  93 + }
  94 + if (CommonUtils.isNotNull(start_date) ) {
  95 + criteria.andGreaterThanOrEqualTo("created_at", start_date);
  96 + }
  97 + if (CommonUtils.isNotNull(end_date)) {
  98 + criteria.andLessThanOrEqualTo("created_at", end_date);
  99 + }
  100 + if (CommonUtils.isNotEmpty(channelName)) {
  101 + criteria.andLike("channel_name", "%" + channelName + "%");
  102 + }
  103 + if (CommonUtils.isNotEmpty(updater)) {
  104 + criteria.andEqualTo("updater", updater);
  105 + }
  106 + if (CommonUtils.isNotNull(spid)) {
  107 + criteria.andEqualTo("spid", spid);
  108 + }
  109 +
  110 + if (CommonUtils.isNotEmpty(channelId)) {
  111 + criteria.andLike("channel_id", "%" + channelId + "%");
  112 + }
  113 +
  114 + if (CommonUtils.isNotNull(receive)&& receive==1) {//已认领 加上用户id
  115 + criteria.andEqualTo("auditor", userId);
  116 + }
  117 + if (CommonUtils.isNotNull(shenhe_status) && shenhe_status != 3) {//不是 我的已审 进来的,只查一种状态
  118 + criteria.andEqualTo("shenhe_status", shenhe_status);
  119 + } else if (CommonUtils.isNotNull(shenhe_status) && shenhe_status == 3) {//是 我的已审,查通过和拒绝的两种状态
  120 + Example.Criteria criteria1 = example.createCriteria();
  121 + criteria1.orEqualTo("shenhe_status", 1);
  122 + criteria1.orEqualTo("shenhe_status", 2);
  123 + example.and(criteria1);
  124 + }
  125 +
  126 + PageHelper.startPage(page, pageSize, true);
  127 + List<ShyChannel> channelList = shyChannelMapper.selectByExample(example);
  128 + PageInfo<ShyChannel> pageInfo = new PageInfo<>(channelList);
  129 + return pageInfo;
  130 + }
  131 +
  132 + public ShyChannel getDetailsComment(Integer id) {
  133 + ShyChannel comment = shyChannelMapper.selectByPrimaryKey(id);
  134 + if (comment.getShenhe_status() != CommonConst.AUDIT_INTT) {
  135 + String updater = CommonUtils.isEmpty(comment.getUpdater()) || "null".equals(comment.getUpdater())? "白名单":comment.getUpdater();
  136 + String auditor_id = comment.getAuditor();
  137 + if (CommonUtils.isNotEmpty(auditor_id)) {
  138 + ShyUsers user = new ShyUsers();
  139 + user.setUser_id(auditor_id);
  140 + user = shyUsersMapper.selectOne(user);
  141 + String email = CommonUtils.isEmpty(user.getEmail())|| "null".equals(user.getEmail()) ? "" : user.getEmail();
  142 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
  143 + updater = userName ;
  144 + }
  145 + comment.setUpdater(updater);
  146 + }
  147 + return comment;
  148 + }
  149 +
  150 + public boolean updateState(String ids, Integer state, String userId,String updater,String msg) {
  151 + boolean success = true;
  152 + String[] channelIds = ids.split(",");
  153 + for (String channelId : channelIds) {
  154 + ShyChannel channel = shyChannelMapper.selectByPrimaryKey(Integer.parseInt(channelId));
  155 +
  156 + JSONObject json = new JSONObject();
  157 + json.put("state", state + 2);
  158 + json.put("channel_id", channel.getChannel_id());
  159 + json.put("msg", msg);
  160 + JSONObject result = new JSONObject();
  161 + try {
  162 + result = Pass.commentPass(json, channel.getCallback());
  163 + } catch (Exception e) {
  164 + logger.error("频道回调失败,id:{},channel_id:{}",channel.getId(), channel.getChannel_id());
  165 + success = false;
  166 + break;
  167 + }
  168 + if (result == null) {
  169 + logger.error("频道回调错误,且无返回信息。id:{},channel_id:{}",channel.getId(), channel.getChannel_id());
  170 + success = false;
  171 + break;
  172 + } else {
  173 + Integer code = result.getInteger("errorCode");
  174 + if (code != 0) {
  175 + logger.error("频道回调错误,id:{},channel_id:{},errorCode:{},errorMessage:{}", channel.getId(), channel.getChannel_id(), code, result.getString("errorMessage"));
  176 + success = false;
  177 + break;
  178 + }
  179 + channel.setShenhe_status(state);
  180 + channel.setShenhe_msg(msg);
  181 + if(CommonUtils.isEmpty(userId)){
  182 + channel.setUpdater(updater);
  183 + }else{
  184 + channel.setAuditor(userId);
  185 + }
  186 + int i = shyChannelMapper.updateByPrimaryKeySelective(channel);
  187 + if (i != 1) {
  188 + success = false;
  189 + }
  190 + }
  191 +
  192 + }
  193 + return success;
  194 + }
  195 +
  196 + public ShyChannel selectByPrimaryKey(Integer id) {
  197 + ShyChannel shyChannel = shyChannelMapper.selectByPrimaryKey(id);
  198 + return shyChannel;
  199 + }
  200 + public int updateByPrimaryKeySelective(ShyChannel channel) {
  201 + return shyChannelMapper.updateByPrimaryKeySelective(channel);
  202 + }
  203 +
  204 + /**
  205 + * 获得审核类型
  206 + * @param shyChannel
  207 + */
  208 + public void getShenheType(ShyChannel shyChannel){
  209 +
  210 + //获取直播频道免审sp
  211 + List<Integer> sites = sitesService.getBusinessList(CommonConst.BUSINESS_CHANNEL);
  212 + //初始化一个审核状态
  213 + Integer shenheType=3;//审核类型,1:免审,2:机审,3:人工审
  214 + //如果当前sp是免审sp
  215 + if(sites.contains(shyChannel.getSp_id())){
  216 + shenheType=1;//免审
  217 + }
  218 + shyChannel.setShenhe_type(shenheType);
  219 + }
  220 +
  221 +}
  222 +
  223 +
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
@@ -79,7 +79,7 @@ public class AuditPass { @@ -79,7 +79,7 @@ public class AuditPass {
79 } 79 }
80 80
81 /** 81 /**
82 - * 评论打回回调 82 + * 评论审核回调
83 * @param json 83 * @param json
84 * @param callBack 84 * @param callBack
85 * @return 85 * @return
@@ -92,6 +92,19 @@ public class AuditPass { @@ -92,6 +92,19 @@ public class AuditPass {
92 } 92 }
93 93
94 /** 94 /**
  95 + * 频道审核回调
  96 + * @param json
  97 + * @param callBack
  98 + * @return
  99 + */
  100 + public JSONObject channelPass(JSONObject json, String callBack) {
  101 + Map<String, String> map = new HashMap<>();
  102 + map.put("param", json.toJSONString());
  103 + String result = HttpUtil.form(callBack, map);
  104 + return JSONObject.parseObject(result);
  105 + }
  106 +
  107 + /**
95 * 图文审核回调 108 * 图文审核回调
96 * @param ids 109 * @param ids
97 * @param type 1(fabu),2(xiaxian),3(shanchu) 110 * @param type 1(fabu),2(xiaxian),3(shanchu)
src/main/java/com/cnlive/shenhe/utils/CommonConst.java
@@ -72,13 +72,19 @@ public class CommonConst { @@ -72,13 +72,19 @@ public class CommonConst {
72 * 白名单业务:评论 72 * 白名单业务:评论
73 */ 73 */
74 public static Integer BUSINESS_COMMENT = 2; 74 public static Integer BUSINESS_COMMENT = 2;
75 - 75 +
76 /** 76 /**
77 * 白名单业务:图文 77 * 白名单业务:图文
78 */ 78 */
79 public static Integer BUSINESS_CONTENT = 3; 79 public static Integer BUSINESS_CONTENT = 3;
80 80
81 - public static JSONObject BUSINESS = JSONObject.parseObject("{\"1\":\"点播业务\",\"2\":\"评论业务\",\"3\":\"图文业务\"}"); 81 + /**
  82 + * 白名单业务:频道
  83 + */
  84 + public static Integer BUSINESS_CHANNEL = 4;
  85 +
  86 +
  87 + public static JSONObject BUSINESS = JSONObject.parseObject("{\"1\":\"点播业务\",\"2\":\"评论业务\",\"3\":\"图文业务\",\"4\":\"直播频道\"}");
82 88
83 /** 89 /**
84 * 抽帧状态:未抽帧 90 * 抽帧状态:未抽帧
src/main/resources/mapper/ShyChannelMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.cnlive.shenhe.mapper.ShyChannelMapper">
  4 + <resultMap id="BaseResultMap" type="com.cnlive.shenhe.entity.ShyChannel">
  5 + <!--
  6 + WARNING - @mbg.generated
  7 + -->
  8 + <id column="id" jdbcType="INTEGER" property="id" />
  9 + <result column="sp_id" jdbcType="INTEGER" property="sp_id" />
  10 + <result column="channel_id" jdbcType="VARCHAR" property="channel_id" />
  11 + <result column="channel_name" jdbcType="VARCHAR" property="channel_name" />
  12 + <result column="channel_img" jdbcType="VARCHAR" property="channel_img" />
  13 + <result column="callback" jdbcType="VARCHAR" property="callback" />
  14 + <result column="updater" jdbcType="VARCHAR" property="updater" />
  15 + <result column="auditor" jdbcType="VARCHAR" property="auditor" />
  16 + <result column="shenhe_type" jdbcType="INTEGER" property="shenhe_type" />
  17 + <result column="shenhe_status" jdbcType="INTEGER" property="shenhe_status" />
  18 + <result column="shenhe_msg" jdbcType="VARCHAR" property="shenhe_msg" />
  19 + <result column="offline" jdbcType="INTEGER" property="offline" />
  20 + <result column="created_at" jdbcType="TIMESTAMP" property="created_at" />
  21 + <result column="updated_at" jdbcType="TIMESTAMP" property="updated_at" />
  22 + </resultMap>
  23 +</mapper>
0 \ No newline at end of file 24 \ No newline at end of file
src/main/resources/templates/common/frame.html
@@ -72,6 +72,7 @@ line-height: 2em; margin: 0 auto;font-size: 2em&quot; th:text=&quot;${session.sessionUser. @@ -72,6 +72,7 @@ line-height: 2em; margin: 0 auto;font-size: 2em&quot; th:text=&quot;${session.sessionUser.
72 <li><a href="/live/page?shenhe_state=0" id="/live/page"> 直播审核</a></li> 72 <li><a href="/live/page?shenhe_state=0" id="/live/page"> 直播审核</a></li>
73 <li><a href="/comments/page?state=0&receive=0" id="/comments/page"> 评论审核</a></li> 73 <li><a href="/comments/page?state=0&receive=0" id="/comments/page"> 评论审核</a></li>
74 <li><a href="/content/page?receive_status=0" id="/content/page"> 图文审核</a></li> 74 <li><a href="/content/page?receive_status=0" id="/content/page"> 图文审核</a></li>
  75 + <li><a href="/channel/page?shenhe_status=0&receive=0" id="/channel/page"> 频道审核</a></li>
75 </ul> 76 </ul>
76 </li> 77 </li>
77 <li class="treeview" th:if="${session.sessionUser.spid==0 or session.sessionUser.master}"> 78 <li class="treeview" th:if="${session.sessionUser.spid==0 or session.sessionUser.master}">
src/main/resources/templates/page/channel.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org">
  3 +<head th:replace="../templates/common/head::head"></head>
  4 +
  5 +<body class="skin-blue sidebar-mini">
  6 +
  7 +<div class="wrapper">
  8 +
  9 + <div th:replace="../templates/common/frame::frame"></div>
  10 +
  11 + <div class="content-wrapper" style="min-height: 788px;">
  12 + <section class="content-header">
  13 + <h1>
  14 + 频道审核
  15 + </h1>
  16 + <ol class="breadcrumb">
  17 + <li>首页</li>
  18 + <li class="active">频道审核</li>
  19 + </ol>
  20 + </section>
  21 + <section class="content">
  22 + <div class="row">
  23 + <div class="col-md-12">
  24 + <div class="box box-info">
  25 + <div class="box-body">
  26 + <div class="clearfix">
  27 + <div class="btn-group margin-bottom pull-left">
  28 + <div class="btn-group margin-bottom hide" id="hide_select_area">
  29 + <button type="button" class="btn btn-success btn-sm margin-r-5 action_bottom"
  30 + id="more_pass">批量通过
  31 + </button>
  32 + <button type="button" class="btn btn-danger btn-sm margin-r-5 action_bottom"
  33 + id="more_reject">批量拒绝
  34 + </button>
  35 + </div>
  36 +
  37 + <div class="btn-group margin-bottom hide" id="receive_select">
  38 + <button type="button" class="btn btn-success btn-sm margin-r-5 action_bottom"
  39 + onclick="receive(0);">认领
  40 + </button>
  41 + <button type="button" class="btn btn-success btn-sm margin-r-5 action_bottom"
  42 + onclick="receive(10);">认领10条
  43 + </button>
  44 + <button type="button" class="btn btn-success btn-sm margin-r-5 action_bottom"
  45 + onclick="receive(100);">认领100条
  46 + </button>
  47 + <button type="button" class="btn btn-warning btn-sm margin-r-5 action_bottom"
  48 + onclick="retReceive();">退领
  49 + </button>
  50 + <button type="button" class="btn btn-danger btn-sm margin-r-5 action claim"
  51 + value="2" data="claim1000" id="claim1000" data-toggle="modal"
  52 + data-target="#modal" onclick="repulse();">拒绝
  53 + </button>
  54 + <button type="button" class="btn btn-success btn-sm margin-r-5 action_bottom"
  55 + id="morePass" onclick="morePass();">批量通过
  56 + </button>
  57 + </div>
  58 +
  59 + </div>
  60 +
  61 + <div class="btn-group margin-bottom pull-right">
  62 + <div class="btn-group margin-bottom">
  63 + <button type="button" id="quanbu"
  64 + class="btn btn-sm margin-r-5 action_bottom"
  65 + th:onclick="'javascript:quanbu()'">全部
  66 + </button>
  67 + <button type="button" id="daishen"
  68 + class="btn btn-sm margin-r-5 action_bottom"
  69 + >全部待领
  70 + </button>
  71 + <button type="button" id="Mydaishen"
  72 + class="btn btn-sm margin-r-5 action_bottom hide"
  73 + >我的待审
  74 + </button>
  75 + <button type="button" id="yishen"
  76 + class="btn btn-sm margin-r-5 action_bottom"
  77 + >我的已审
  78 + </button>
  79 + </div>
  80 + <button type="button" class="btn btn-primary btn-sm margin-r-5" id="query"
  81 + onclick="openOrClose(&#39;forms&#39;)">高级查询
  82 + <span id="a_up">▼</span><span id="a_down" style="display: none;">▲</span>
  83 + </button>
  84 + </div>
  85 + </div>
  86 +
  87 +
  88 + <div class="form-horizontal form-group-sm" id="forms" style="display: none;">
  89 + <form id="channelForm">
  90 + <div class="btn-group margin-bottom col-md-6" style="padding: 0;">
  91 + <div class="col-md-5" style="padding: 0">
  92 + <label for="channel_id" class="control-label cb-toolbar">频道id:</label>
  93 + <div class="col-sm-8" style="padding: 0;">
  94 + <input class="form-control" name="channel_id" type="text"
  95 + id="channel_id" >
  96 + </div>
  97 + </div>
  98 + <div class="col-md-4" style="padding: 0">
  99 + <label for="channel_name" class="control-label cb-toolbar">频道名称:</label>
  100 + <div class="col-sm-8" style="padding: 0;">
  101 + <input class="form-control" name="channel_name" type="text" id="channel_name"
  102 + >
  103 + </div>
  104 + </div>
  105 + <div class="col-md-3" style="padding: 0">
  106 + <label for="shenhe_status" class="control-label cb-toolbar">审核状态:</label>
  107 + <div class="col-sm-6" style="padding: 0;">
  108 + <select class="form-control col-sm-2" id="shenhe_status" name="shenhe_status">
  109 + <option value="">全部</option>
  110 + <option value="0" >未审核</option>
  111 + <option value="1" >已通过</option>
  112 + <option value="2" >已拒绝</option>
  113 + </select>
  114 + </div>
  115 + </div>
  116 + </div>
  117 +
  118 + <div class="btn-group margin-bottom col-md-6 pull-right" style="padding: 0">
  119 + <div class="col-md-11" style="width: 88%;padding: 0;">
  120 + <div class="col-md-6" style="padding: 0;width: 45%;">
  121 + <label for="start_date" class="control-label cb-toolbar">时间:</label>
  122 + <div class="input-group col-md-9 date">
  123 + <input class="form-control date" name="start_date" type="text"
  124 + id="start_date" >
  125 + <span class="input-group-addon">
  126 + <span class="glyphicon glyphicon-calendar"></span>
  127 + </span>
  128 + </div>
  129 + </div>
  130 + <div class="col-md-6" style="padding: 0;width: 45%;">
  131 + <label for="start_date" class="control-label cb-toolbar">至</label>
  132 + <div class="input-group col-md-9 date">
  133 + <input class="form-control date" name="end_date" type="text"
  134 + id="end_date" >
  135 + <span class="input-group-addon">
  136 + <span class="glyphicon glyphicon-calendar"></span>
  137 + </span>
  138 + </div>
  139 + </div>
  140 + </div>
  141 + </div>
  142 + </form>
  143 +
  144 + </div>
  145 +
  146 + <div class="bootstrap-table">
  147 + <div class="fixed-table-toolbar"></div>
  148 + <div class="fixed-table-container" style="padding-bottom: 0px;">
  149 + <div class="fixed-table-header" style="display: none;">
  150 + <table></table>
  151 + </div>
  152 + <div class="fixed-table-body">
  153 + <table id="table" data-toggle="table"
  154 + class="table table-hover coma-base-table fixed_headers table-striped"
  155 + style="word-break:break-all;">
  156 + <thead>
  157 + <tr>
  158 + <th class="bs-checkbox " style="width: 3%; " data-field="state"
  159 + tabindex="0">
  160 + <div class="th-inner "><input name="btSelectAll" type="checkbox"
  161 + id="select_all">
  162 + </div>
  163 + <div class="fht-cell"></div>
  164 + </th>
  165 + <th style="text-align: center; width: 6%; " data-field="sp_id_brief"
  166 + tabindex="0">
  167 + <div class="th-inner ">sp简称</div>
  168 + <div class="fht-cell"></div>
  169 + </th>
  170 + <th style="text-align: center; width: 6%; "
  171 + data-field="channel_user_name" tabindex="0">
  172 + <div class="th-inner ">频道ID</div>
  173 + <div class="fht-cell"></div>
  174 + </th>
  175 + <th style="text-align: center; width: 16%; "
  176 + data-field="channel_user_avatar" tabindex="0">
  177 + <div class="th-inner ">频道名称
  178 + </div>
  179 + <div class="fht-cell"></div>
  180 + </th>
  181 + <th style="text-align: center; width: 6%; " data-field="channel_user_ip"
  182 + tabindex="0">
  183 + <div class="th-inner ">频道封面图</div>
  184 + <div class="fht-cell"></div>
  185 + </th>
  186 + <th style="text-align: center; width: 3%; " data-field="content"
  187 + tabindex="0">
  188 + <div class="th-inner ">审核类型
  189 + </div>
  190 + <div class="fht-cell"></div>
  191 + </th>
  192 + <th style="text-align: center; width: 3%; " data-field="updater"
  193 + tabindex="0">
  194 + <div class="th-inner ">审核状态</div>
  195 + <div class="fht-cell"></div>
  196 + </th>
  197 + <th style="text-align: center; width: 6%; " data-field="channel_title"
  198 + tabindex="0">
  199 + <div class="th-inner ">审核员
  200 + </div>
  201 + <div class="fht-cell"></div>
  202 + </th>
  203 +
  204 + <th style="text-align: center; width: 12%; " data-field="is_hot_name"
  205 + tabindex="0">
  206 + <div class="th-inner ">审核消息</div>
  207 + <div class="fht-cell"></div>
  208 + </th>
  209 +<!-- <th style="text-align: center; width: 5%; " -->
  210 +<!-- data-field="state_name_short" tabindex="0"> -->
  211 +<!-- <div class="th-inner ">是否下线 -->
  212 +<!-- </div> -->
  213 +<!-- <div class="fht-cell"></div> -->
  214 +<!-- </th> -->
  215 + <th style="text-align: center; width: 6%; " data-field="channel_time"
  216 + tabindex="0">
  217 + <div class="th-inner ">频道创建时间</div>
  218 + <div class="fht-cell"></div>
  219 + </th>
  220 + <th style="text-align: center; width: 6%; " data-field="channel_time"
  221 + tabindex="0">
  222 + <div class="th-inner ">频道审核时间</div>
  223 + <div class="fht-cell"></div>
  224 + </th>
  225 + <th style="text-align: center; width: 12%; " data-field="action"
  226 + tabindex="0">
  227 + <div class="th-inner ">操作
  228 + </div>
  229 + <div class="fht-cell"></div>
  230 + </th>
  231 + </tr>
  232 + </thead>
  233 + <tbody>
  234 + <tr th:data-index="${channelStat.index}"
  235 + th:each="channel : ${channelPage.list}">
  236 + <td class="bs-checkbox ">
  237 + <input data-index="0" name="btSelectItem" type="checkbox"
  238 + th:value="${channel.id}"></td>
  239 + <td style="text-align: center; width: 6%;"
  240 + th:text="${channel.sp_desc}">网加加
  241 + </td>
  242 + <td style="text-align: center; width: 6%;"
  243 + th:text="${channel.channel_id}">1083_00014
  244 + </td>
  245 + <td style="text-align: center; width: 15%;"
  246 + th:text="${channel.channel_name}">优秀传统文化与现代幼儿教育 教师研修班
  247 + </td>
  248 + <td style="text-align: center; width: 6%;">
  249 + <div width="60px" height="60px"><img
  250 + th:src="@{${channel.channel_img}}" width="60px"
  251 + alt="频道封面图"></div>
  252 + </td>
  253 + <td style="text-align: center; width: 3%;">
  254 + <span th:if="${channel.shenhe_type==1}">免审</span>
  255 + <span th:if="${channel.shenhe_type==2}">机审</span>
  256 + <span th:if="${channel.shenhe_type==3}">人工审</span>
  257 + </td>
  258 + <td style="text-align: center; width: 3%;">
  259 + <span class="btn btn-sm btn-warning"
  260 + th:if="${channel.shenhe_status==0}">待审核</span>
  261 + <span class="btn btn-sm btn-success"
  262 + th:if="${channel.shenhe_status==1}">已通过</span>
  263 + <span class="btn btn-sm btn-danger"
  264 + th:if="${channel.shenhe_status==2}">已拒绝</span>
  265 + </td>
  266 + <td style="text-align: center; width: 6%;" th:text="${channel.updater}">
  267 + openadmin9@cnlive.com
  268 + </td>
  269 + <td style="text-align: center; width: 12%;"
  270 + th:text="${channel.shenhe_msg}">审核消息
  271 + </td>
  272 +<!-- <td style="text-align: center; width: 3%;"> -->
  273 +<!-- <span th:if="${channel.offline==0}">正常</span> -->
  274 +<!-- <span th:if="${channel.offline==1}">下线</span> -->
  275 +<!-- </td> -->
  276 + <td style="text-align: center; width: 6%;"
  277 + th:text="${#dates.format(channel.created_at, 'yyyy-MM-dd HH:mm:ss')}">
  278 + 2018-11-28 16:08:00
  279 + </td>
  280 + <td style="text-align: center; width: 6%;"
  281 + th:text="${#dates.format(channel.updated_at, 'yyyy-MM-dd HH:mm:ss')}">
  282 + 2018-11-28 16:08:00
  283 + </td>
  284 + <td style="text-align: center; width: 12%;">
  285 + <span> &nbsp;</span>
  286 + <a class="pass_one" th:href="@{'javascript:channel('+${channel.id}+',1)'}">
  287 + <button class="btn btn-success btn-sm">通过</button>
  288 + </a>
  289 + <span> &nbsp;</span>
  290 + <a class="failed_one" th:href="@{'javascript:channel('+${channel.id}+',2)'}">
  291 + <button class="btn btn-danger btn-sm">拒绝</button>
  292 + </a>
  293 + </td>
  294 + </tr>
  295 + </tbody>
  296 + </table>
  297 + </div>
  298 + <div class="fixed-table-footer" style="display: none;">
  299 + <table>
  300 + <tbody>
  301 + <tr></tr>
  302 + </tbody>
  303 + </table>
  304 + </div>
  305 + <div class="fixed-table-pagination" style="display: block;">
  306 + <div class="pull-left pagination-detail">
  307 + <span class="pagination-info" th:text="'共 '+${channelPage.total}+' 条记录,每页显示'">总共 0 条记录</span>
  308 + <select class="" id="pageSize" name="pageSize" onchange="selectPageSize()">
  309 + <option value="10" th:selected="${pageSize==10}">10</option>
  310 + <option value="20" th:selected="${pageSize==20}">20</option>
  311 + <option value="50" th:selected="${pageSize==50}">50</option>
  312 + <option value="100" th:selected="${pageSize==100}">100</option>
  313 + </select>
  314 + <span class="pagination-info" >条记录</span>
  315 + </div>
  316 + <div class="pull-right pagination">
  317 + <ul class="pagination" th:if="${channelPage.pages>1}">
  318 + <li class="page-pre"><a th:href="'javascript:fanye(1);'">‹‹</a></li>
  319 + <li class="page-pre" th:if="${!channelPage.isFirstPage}"><a
  320 + th:onclick="'javascript:fanye(\''+${channelPage.pageNum-1}+'\');'">‹</a>
  321 + </li>
  322 +
  323 + <li class="page-number" th:if="${channelPage.pageNum-3>=1}"><a
  324 + th:onclick="'javascript:fanye(\''+${channelPage.pageNum-3}+'\');'"
  325 + th:text="${channelPage.pageNum-3}">2</a></li>
  326 + <li class="page-number" th:if="${channelPage.pageNum-2>=1}"><a
  327 + th:onclick="'javascript:fanye(\''+${channelPage.pageNum-2}+'\');'"
  328 + th:text="${channelPage.pageNum-2}">2</a></li>
  329 + <li class="page-number" th:if="${channelPage.pageNum-1>=1}"><a
  330 + th:onclick="'javascript:fanye(\''+${channelPage.pageNum-1}+'\');'"
  331 + th:text="${channelPage.pageNum-1}">2</a></li>
  332 + <li class="page-number active"><a href="javaScript:void(0);"
  333 + th:text="${channelPage.pageNum}">2</a></li>
  334 + <li class="page-number" th:if="${channelPage.pageNum+1<=channelPage.pages}"><a
  335 + th:onclick="'javascript:fanye(\''+${channelPage.pageNum+1}+'\');'"
  336 + th:text="${channelPage.pageNum+1}">2</a></li>
  337 + <li class="page-number" th:if="${channelPage.pageNum+2<=channelPage.pages}"><a
  338 + th:onclick="'javascript:fanye(\''+${channelPage.pageNum+2}+'\');'"
  339 + th:text="${channelPage.pageNum+2}">2</a></li>
  340 + <li class="page-number" th:if="${channelPage.pageNum+3<=channelPage.pages}"><a
  341 + th:onclick="'javascript:fanye(\''+${channelPage.pageNum+3}+'\');'"
  342 + th:text="${channelPage.pageNum+3}">2</a></li>
  343 +
  344 + <li class="page-next" th:if="${!channelPage.isLastPage}"><a
  345 + th:onclick="'javascript:fanye(\''+${channelPage.pageNum+1}+'\');'">›</a>
  346 + </li>
  347 + <li class="page-next"><a
  348 + th:onclick="'javascript:fanye(\''+${channelPage.pages}+'\');'">››</a>
  349 + </li>
  350 + </ul>
  351 + </div>
  352 + </div>
  353 + </div>
  354 + </div>
  355 + <div class="clearfix"></div>
  356 +
  357 + </div>
  358 + </div>
  359 + </div>
  360 + </div>
  361 +
  362 +
  363 + </section><!-- /.content -->
  364 + </div>
  365 + <!-- /.content-wrapper -->
  366 + <!-- 模态框(Modal) -->
  367 + <div class="modal fade" id="msgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  368 + <div class="modal-dialog">
  369 + <div class="modal-content" style="margin-top: 30%;">
  370 + <div class="modal-header">
  371 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  372 + <h4 class="modal-title" id="myModalLabel">审核意见</h4>
  373 + </div>
  374 + <div class="modal-body">
  375 + <div class="form-group" style="margin-bottom: 0;">
  376 + <textarea id="reviewMsg" style="width: 100%;height: 80px;"></textarea>
  377 + </div>
  378 + <div class="form-group">
  379 + </div>
  380 + </div>
  381 + <div class="modal-footer">
  382 + <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  383 + <button type="button" class="btn btn-primary" onclick="javascript:repulseSubmit();">提交</button>
  384 + </div>
  385 + </div><!-- /.modal-content -->
  386 + </div><!-- /.modal-dialog -->
  387 + </div>
  388 + <!-- /.modal -->
  389 + <script th:inline="javascript">
  390 + $(function () {
  391 + //按钮颜色设置
  392 + var state = [[${param.shenhe_status}]] ? [[${param.shenhe_status}]][0] : null;
  393 + var receive = [[${param.receive}]] ? [[${param.receive}]][0] : null;
  394 + var stateIsNull = $.trim(state) == "";
  395 + var receiveIsNull = $.trim(receive) == "";
  396 + if ( receive == '0' && stateIsNull) {
  397 + $("#quanbu").addClass("btn-info");
  398 + } else if (state == '0' && receive == '0') {
  399 + $("#daishen").addClass("btn-warning");
  400 + } else if (state != '0' && receive == '1') {
  401 + $("#yishen").addClass("btn-danger");
  402 + }
  403 +
  404 + })
  405 +
  406 + //选择每页数量触发函数
  407 + function selectPageSize(){
  408 + var pageSize=$("#pageSize").val();
  409 + var param = location.search;
  410 + if (param.indexOf("pageSize=") != -1) {
  411 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  412 + var split = se.split("&");
  413 + var h = "";
  414 + for (var i = 0; i < split.length; i++) {
  415 + var s = split[i];
  416 + if (s.indexOf("pageSize=") < 0 &&s.indexOf("page=") < 0) h = h + "&" + split[i];
  417 + }
  418 + h = h.substring(1, h.length);
  419 + window.location.href = "/channel/page?" + h + "&pageSize=" + pageSize;
  420 + } else {
  421 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  422 + var split = se.split("&");
  423 + var h = "";
  424 + for (var i = 0; i < split.length; i++) {
  425 + var s = split[i];
  426 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
  427 + }
  428 + h = h.substring(1, h.length);
  429 + window.location.href = "/channel/page?" + h + "&pageSize=" + pageSize;
  430 + }
  431 + }
  432 +
  433 + //翻页函数
  434 + function fanye(page) {
  435 + var param = location.search;
  436 + if (param.indexOf("page=") != -1) {
  437 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  438 + var split = se.split("&");
  439 + var h = "";
  440 + for (var i = 0; i < split.length; i++) {
  441 + var s = split[i];
  442 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
  443 + }
  444 + h = h.substring(1, h.length);
  445 + window.location.href = "/channel/page?" + h + "&page=" + page;
  446 + } else {
  447 + param = param.substring(1, param.length);
  448 + window.location.href = "/channel/page?" + param + "&page=" + page;
  449 + }
  450 + }
  451 +
  452 + var channel_id ="";//频道id
  453 + var channel_name = "";//频道名称
  454 + var shenhe_status ="";//审核状态
  455 + var start_date ="";//开始时间
  456 + var end_date = "";//结束时间
  457 + var count = "";//每页显示数量
  458 + var receive ="";//领取状态,用来区分是否是自己审核的内容
  459 +
  460 + function query(){
  461 + channel_id = $("#channel_id").val();
  462 + channel_name = $("#channel_name").val();
  463 + start_date = $("#start_date").val();
  464 + end_date = $("#end_date").val();
  465 + count = $("#pageSize").val();
  466 + window.location.href = "/channel/page?channel_id=" + channel_id + "&start_date=" + start_date + "&end_date=" + end_date + "&channel_name=" + channel_name + "&pageSize="+count+"&shenhe_status="+shenhe_status+"&receive="+receive;
  467 + }
  468 +
  469 + //全部
  470 + function quanbu() {
  471 + shenhe_status = $("#shenhe_status").val();
  472 + query();
  473 + }
  474 +
  475 + //全部待领
  476 + $('#daishen').click(function () {
  477 + shenhe_status = $("#shenhe_status").val();
  478 + if($.trim(shenhe_status) == '') shenhe_status=0;
  479 + receive = 0;
  480 + query();
  481 + });
  482 + //我的已审核
  483 + $('#yishen').click(function () {
  484 + shenhe_status = $("#shenhe_status").val();
  485 + if($.trim(shenhe_status) == '') shenhe_status=3;//审核状态,3代表通过和拒绝都查询
  486 + receive = 1;
  487 + query();
  488 + });
  489 +
  490 + /*全选的操作*/
  491 + $('#select_all').click(function () {
  492 + if ($("[name=btSelectItem]:checkbox:not(:checked)").length > 0) {
  493 + $("#select_all").prop('checked', true);
  494 + $("[name=btSelectItem]:checkbox").each(function () {
  495 + $(this).prop('checked', true);
  496 + });
  497 + } else {
  498 + $("#select_all").prop('checked', false);
  499 + $("[name=btSelectItem]:checkbox").each(function () {
  500 + $(this).prop('checked', false);
  501 + });
  502 + }
  503 + });
  504 +
  505 + //批量通过
  506 + $('#more_pass').click(function () {
  507 + var rows = $("[name=btSelectItem]:checkbox:checked");
  508 + if (rows.length > 0) {
  509 + var r = confirm("您确定通过选中的" + rows.length + "条评论吗?");
  510 + if (r == true) {
  511 + var ids = "";
  512 + rows.each(function (i, e) {
  513 + ids = ids + "," + e.value;
  514 + })
  515 + ids = ids.substring(1);
  516 + channel(ids, 1);
  517 + }
  518 + } else {
  519 + alert("没有选中的数据!");
  520 + }
  521 +
  522 + });
  523 + //批量拒绝
  524 + $('#more_reject').click(function () {
  525 + var rows = $("[name=btSelectItem]:checkbox:checked");
  526 + if (rows.length > 0) {
  527 + var r = confirm("您确定拒绝选中的" + rows.length + "条评论吗?");
  528 + if (r == true) {
  529 + var ids = "";
  530 + rows.each(function (i, e) {
  531 + ids = ids + "," + e.value;
  532 + })
  533 + ids = ids.substring(1);
  534 + channel(ids, 2);
  535 + }
  536 + } else {
  537 + alert("没有选中的数据!");
  538 + }
  539 + });
  540 +
  541 + //审核操作,status=1为通过
  542 + function channel(ids, status) {
  543 + if (status == 1) {
  544 + $.post("/channel/pass?ids=" + ids, function (data) {
  545 + if (data.errorCode == 0) {
  546 + alert(data.errorMessage);
  547 + location.href = location.href;
  548 + } else {
  549 + alert(data.errorMessage);
  550 + }
  551 + })
  552 + } else {
  553 + $.post("/channel/refuse?ids=" + ids, function (data) {
  554 + if (data.errorCode == 0) {
  555 + alert(data.errorMessage);
  556 + location.href = location.href;
  557 + } else {
  558 + alert(data.errorMessage);
  559 + }
  560 + })
  561 + }
  562 +
  563 + }
  564 +
  565 + /*查询样式*/
  566 + function openOrClose(id_name_str) {
  567 + var id_name = '#' + id_name_str;
  568 + if ($(id_name).css('display') == 'block') {
  569 + $(id_name).slideUp(350);
  570 + $('#a_up').show();
  571 + $('#a_down').hide();
  572 + } else {
  573 + $(id_name).slideDown(350);
  574 + $('#a_up').hide();
  575 + $('#a_down').show();
  576 + }
  577 + }
  578 +
  579 + /**
  580 + * 认领
  581 + */
  582 + function receive(n) {
  583 + if (n > 0) {
  584 + applyReceiveNum(n);
  585 + } else {
  586 + var rows = $("[name=btSelectItem]:checkbox:checked");
  587 + if (rows.length > 0) {
  588 + var ids = "";
  589 + rows.each(function (i, e) {
  590 + ids = ids + "," + e.value;
  591 + })
  592 + ids = ids.substring(1);
  593 + applyReceive(ids);
  594 + } else {
  595 + alert("请选择要认领的内容!");
  596 + }
  597 + }
  598 + }
  599 +
  600 + //认领选中请求
  601 + function applyReceive(ids) {
  602 + $.post("/channels/receive?ids=" + ids, function (data) {
  603 + if (data.errorCode == 0) {
  604 + alert(data.errorMessage);
  605 + location.href = location.href;
  606 + } else {
  607 + alert(data.errorMessage);
  608 + }
  609 + })
  610 + }
  611 +
  612 + //认领多条请求
  613 + function applyReceiveNum(num) {
  614 + $.post("/channels/receive?num=" + num, function (data) {
  615 + if (data.errorCode == 0) {
  616 + alert(data.errorMessage);
  617 + location.href = location.href;
  618 + } else {
  619 + alert(data.errorMessage);
  620 + }
  621 + })
  622 + }
  623 +
  624 + //退领选中内容
  625 + function retReceive() {
  626 + var rows = $("[name=btSelectItem]:checkbox:checked");
  627 + if (rows.length > 0) {
  628 + var r = confirm("您确定退领选中的" + rows.length + "条评论吗?");
  629 + if (r == true) {
  630 + var ids = "";
  631 + rows.each(function (i, e) {
  632 + ids = ids + "," + e.value;
  633 + })
  634 + ids = ids.substring(1);
  635 + applyRetReceive(ids);
  636 + }
  637 + } else {
  638 + alert("没有选中的数据!");
  639 + }
  640 + }
  641 +
  642 + //退领
  643 + function applyRetReceive(ids) {
  644 + $.post("/channels/retReceive?ids=" + ids, function (data) {
  645 + if (data.errorCode == 0) {
  646 + alert(data.errorMessage);
  647 + location.href = location.href;
  648 + } else {
  649 + alert(data.errorMessage);
  650 + }
  651 + })
  652 + }
  653 +
  654 + //拒绝(打回)
  655 + function repulse() {
  656 + var rows = $("[name=btSelectItem]:checkbox:checked");
  657 + if (rows.length > 0) {
  658 + var r = confirm("您确定拒绝选中的" + rows.length + "条内容吗?");
  659 + if (r == true) {
  660 + $('#msgModal').modal('show');
  661 + }
  662 + } else {
  663 + alert("没有选中的数据!");
  664 + }
  665 + }
  666 +
  667 + //提交打回
  668 + function repulseSubmit() {
  669 + var rows = $("[name=btSelectItem]:checkbox:checked");
  670 + var ids = "";
  671 + rows.each(function (i, e) {
  672 + ids = ids + "," + e.value;
  673 + })
  674 + ids = ids.substring(1);
  675 + var msg = $("#reviewMsg").val();
  676 + $.post("/channels/repulse?ids=" + ids + "&msg=" + msg, function (data) {
  677 + if (data.errorCode == 0) {
  678 + alert(data.errorMessage);
  679 + location.href = location.href;
  680 + } else {
  681 + alert(data.errorMessage);
  682 + }
  683 + })
  684 + }
  685 + //批量提交
  686 + function morePass() {
  687 + var rows = $("[name=btSelectItem]:checkbox:checked");
  688 + if (rows.length > 0) {
  689 + var r = confirm("您确定通过选中的" + rows.length + "条内容吗?");
  690 + if (r == true) {
  691 + var ids = "";
  692 + rows.each(function (i, e) {
  693 + ids = ids + "," + e.value;
  694 + })
  695 + ids = ids.substring(1);
  696 + $.post("/channels/pass?ids=" + ids, function (data) {
  697 + if (data.errorCode == 0) {
  698 + alert(data.errorMessage);
  699 + location.href = location.href;
  700 + } else {
  701 + alert(data.errorMessage);
  702 + }
  703 + })
  704 + }
  705 + } else {
  706 + alert("没有选中的数据!");
  707 + }
  708 + }
  709 + </script>
  710 + <script>
  711 + /*时间插件*/
  712 + $('.date').datetimepicker({
  713 +// format: 'YYYY-MM-DD HH:mm:ss',
  714 + format: 'YYYY-MM-DD',
  715 + locale: "zh-CN",
  716 + toolbarPlacement: 'bottom',
  717 + showClear: true,
  718 + });
  719 + $(function () {
  720 + $("[data-toggle='tooltip']").tooltip();
  721 + });
  722 + </script>
  723 +
  724 + <footer th:replace="../templates/common/foot::foot"></footer>
  725 +
  726 + <!-- Add the sidebar's background. This div must be placed
  727 + immediately after the control sidebar -->
  728 + <div class="control-sidebar-bg" style="position: fixed; height: auto;"></div>
  729 +
  730 +</div><!-- ./wrapper -->
  731 +
  732 +
  733 +<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  734 +<script type="text/javascript">
  735 + $('div.alert').not('.alert-danger').delay(3000).slideUp(300);
  736 +</script>
  737 +
  738 +<!-- AdminLTE App -->
  739 +<script src="../../static/js/app.min.js"></script>
  740 +<!-- AdminLTE for demo purposes -->
  741 +<script src="../../static/js/sidebar.js"></script>
  742 +
  743 +
  744 +</body>
  745 +</html>
0 \ No newline at end of file 746 \ No newline at end of file