Commit 43b77d5285afe6e0ee7212b3c28dddbc54e2dec9

Authored by liwei2917
1 parent 4c5fbfc5

增加直播同步接口

src/main/java/com/cnlive/shenhe/config/MyInterceptor.java 0 → 100644
  1 +package com.cnlive.shenhe.config;
  2 +
  3 +import org.omg.PortableInterceptor.Interceptor;
  4 +import org.springframework.stereotype.Component;
  5 +import org.springframework.web.servlet.HandlerInterceptor;
  6 +import org.springframework.web.servlet.ModelAndView;
  7 +
  8 +import com.cnlive.shenhe.bean.SessionUser;
  9 +import com.cnlive.shenhe.utils.CommonUtils;
  10 +
  11 +import javax.servlet.http.HttpServletRequest;
  12 +import javax.servlet.http.HttpServletResponse;
  13 +import javax.servlet.http.HttpSession;
  14 +
  15 +@Component
  16 +public class MyInterceptor implements HandlerInterceptor {
  17 + @Override
  18 + public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
  19 + HttpSession httpSession=httpServletRequest.getSession();
  20 + SessionUser sessionUser = (SessionUser)httpSession.getAttribute(SessionUser.getSessionKey());
  21 + if(CommonUtils.isNull(sessionUser)){
  22 + httpServletRequest.getRequestDispatcher("/users/login").forward(httpServletRequest, httpServletResponse);
  23 + return false;
  24 + }
  25 +
  26 + return true;
  27 + }
  28 +
  29 + @Override
  30 + public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
  31 +
  32 + }
  33 +
  34 + @Override
  35 + public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
  36 +
  37 + }
  38 +}
src/main/java/com/cnlive/shenhe/config/SessionFilter.java 0 → 100644
  1 +package com.cnlive.shenhe.config;
  2 +import org.slf4j.LoggerFactory;
  3 +import org.springframework.web.context.request.RequestContextHolder;
  4 +import org.springframework.web.context.request.ServletRequestAttributes;
  5 +
  6 +import com.cnlive.shenhe.bean.SessionUser;
  7 +
  8 +import javax.servlet.*;
  9 +import javax.servlet.http.HttpServletRequest;
  10 +import javax.servlet.http.HttpServletResponse;
  11 +import javax.servlet.http.HttpSession;
  12 +import java.io.IOException;
  13 +import java.util.ArrayList;
  14 +import java.util.List;
  15 +import java.util.regex.Matcher;
  16 +import java.util.regex.Pattern;
  17 +
  18 +/**
  19 + * Created by liwei on 2018/08/28.
  20 + *
  21 + * 过滤器
  22 + */
  23 +public class SessionFilter implements Filter {
  24 + private static final org.slf4j.Logger logger = LoggerFactory.getLogger(SessionFilter.class);
  25 + HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
  26 + HttpServletResponse response = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse();
  27 + /**
  28 + * 封装,不需要过滤的list列表
  29 + */
  30 + protected static List<Pattern> patterns = new ArrayList<Pattern>();
  31 +
  32 + @Override
  33 + public void init(FilterConfig filterConfig) throws ServletException {
  34 +
  35 + }
  36 +
  37 + @Override
  38 + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
  39 + HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;
  40 + HttpServletResponse httpResponse = (HttpServletResponse) servletResponse;
  41 + logger.info("进入过滤器");
  42 + String url = httpRequest.getRequestURI().substring(httpRequest.getContextPath().length());
  43 + if (url.startsWith("/") && url.length() > 1) {
  44 + url = url.substring(1);
  45 + }
  46 +
  47 + if (isInclude(url)){
  48 + chain.doFilter(httpRequest, httpResponse);
  49 + return;
  50 + } else {
  51 + HttpSession session = httpRequest.getSession();
  52 + if (session.getAttribute(SessionUser.getSessionKey()) != null){
  53 + // session存在
  54 + chain.doFilter(httpRequest, httpResponse);
  55 + return;
  56 + } else {
  57 + // session不存在 准备跳转失败
  58 + RequestDispatcher dispatcher = request.getRequestDispatcher("/users/login");
  59 + dispatcher.forward(request, response);
  60 +// chain.doFilter(httpRequest, httpResponse);
  61 + return;
  62 + }
  63 + }
  64 +
  65 +
  66 + }
  67 +
  68 + @Override
  69 + public void destroy() {
  70 +
  71 + }
  72 +
  73 +
  74 + /**
  75 + * 是否需要过滤
  76 + * @param url
  77 + * @return
  78 + */
  79 + private boolean isInclude(String url) {
  80 + for (Pattern pattern : patterns) {
  81 + Matcher matcher = pattern.matcher(url);
  82 + if (matcher.matches()) {
  83 + return true;
  84 + }
  85 + }
  86 + return false;
  87 + }
  88 +
  89 +}
src/main/java/com/cnlive/shenhe/config/WebConfiguration.java
@@ -16,10 +16,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -16,10 +16,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
16 @EnableScheduling 16 @EnableScheduling
17 public class WebConfiguration implements WebMvcConfigurer { 17 public class WebConfiguration implements WebMvcConfigurer {
18 18
19 - /* @Override 19 + @Override
20 public void addInterceptors(InterceptorRegistry registry) { 20 public void addInterceptors(InterceptorRegistry registry) {
21 - registry.addInterceptor(new LoginIntercept()).addPathPatterns("/**");  
22 - }*/ 21 + registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**").excludePathPatterns("/api/**","/users/login");
  22 + }
23 @Override 23 @Override
24 public void addResourceHandlers(ResourceHandlerRegistry registry) { 24 public void addResourceHandlers(ResourceHandlerRegistry registry) {
25 registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); 25 registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
src/main/java/com/cnlive/shenhe/controller/BaseController.java 0 → 100644
  1 +package com.cnlive.shenhe.controller;
  2 +
  3 +import java.io.IOException;
  4 +
  5 +import javax.servlet.http.HttpServletRequest;
  6 +import javax.servlet.http.HttpServletResponse;
  7 +import javax.servlet.http.HttpSession;
  8 +
  9 +import org.springframework.stereotype.Controller;
  10 +import org.springframework.web.bind.annotation.GetMapping;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.context.request.RequestContextHolder;
  13 +import org.springframework.web.context.request.ServletRequestAttributes;
  14 +import org.springframework.web.servlet.ModelAndView;
  15 +
  16 +import com.cnlive.shenhe.bean.SessionUser;
  17 +import com.cnlive.shenhe.utils.CommonUtils;
  18 +
  19 +@Controller
  20 +public class BaseController {
  21 +
  22 +
  23 + /**
  24 + * 得到request对象
  25 + */
  26 + public HttpServletRequest getRequest() {
  27 + HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
  28 + return request;
  29 + }
  30 + /**
  31 + * 得到response对象
  32 + */
  33 + public HttpServletResponse getResponse() {
  34 + HttpServletResponse response = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse();
  35 + return response;
  36 + }
  37 +
  38 + /**
  39 + * 得到session对象
  40 + */
  41 + public HttpSession getsession() {
  42 + HttpSession session = this.getRequest().getSession();
  43 + return session;
  44 + }
  45 +
  46 +
  47 + /**
  48 + * 获取session中的用户
  49 + * @return
  50 + */
  51 + public SessionUser getSessionUser(){
  52 + SessionUser sessionUser = (SessionUser) this.getsession().getAttribute(SessionUser.getSessionKey());
  53 + return sessionUser;
  54 + }
  55 +
  56 + /**
  57 + * 获取session中的用户id
  58 + * @return
  59 + */
  60 + public String getSessionUserId(){
  61 + SessionUser sessionUser = getSessionUser();
  62 + if(sessionUser != null) return sessionUser.getUserId();
  63 + return null;
  64 + }
  65 +
  66 +
  67 + /**
  68 + * 设置用户session
  69 + * @param teacher
  70 + */
  71 + public void setSessionUser(SessionUser sessionUser){
  72 + this.getsession().setAttribute("",null);
  73 + }
  74 +
  75 +
  76 +
  77 +}
src/main/java/com/cnlive/shenhe/controller/LiveController.java
@@ -295,6 +295,54 @@ public class LiveController { @@ -295,6 +295,54 @@ public class LiveController {
295 } 295 }
296 296
297 /** 297 /**
  298 + * 同步直播云信息
  299 + *
  300 + * @param ids
  301 + * @param msg
  302 + * @param session
  303 + * @return
  304 + */
  305 + @PostMapping("/syncLive")
  306 + @ResponseBody
  307 + public ResponseBean syncLive(String ids, HttpSession session) {
  308 + logger.info("同步直播云信息接口进入");
  309 + ResponseBean responseBean = new ResponseBean();
  310 + String[] shyLiveIds = ids.split(",");
  311 + String showMsg = "";
  312 + for (String shyLiveId : shyLiveIds) {
  313 + ShyLive shyLive = liveService.selectByPrimaryKey(Integer.parseInt(shyLiveId));
  314 + JSONObject result = null;
  315 + try {
  316 + result = Pass.syncLive(shyLive.getActivity_id());
  317 + } catch (Exception e) {
  318 + logger.error("直播云信息同步失败,id==" + shyLiveId, e);
  319 + showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败";
  320 + break;
  321 + }
  322 + if (result == null) {
  323 + logger.error("直播云信息同步失败且接口错误没有返回信息,id==" + shyLiveId);
  324 + showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败";
  325 + break;
  326 + }
  327 + Integer code = result.getInteger("errorCode");
  328 + if (code != 0) {
  329 + logger.error("直播云信息同步失败,id:{},code:{}", shyLiveId, code);
  330 + showMsg = result.getString("errorMessage");
  331 + break;
  332 + }
  333 + }
  334 + if (CommonUtils.isNotEmpty(showMsg)) {
  335 + responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode());
  336 + responseBean.setErrorMessage(showMsg);
  337 + }else{
  338 + showMsg="直播云信息同步成功";
  339 + responseBean.setErrorCode(ErrorEnum.SUCCESS.getErrorCode());
  340 + responseBean.setErrorMessage(showMsg);
  341 + }
  342 + return responseBean;
  343 + }
  344 +
  345 + /**
298 * 根据条件导出excel 346 * 根据条件导出excel
299 */ 347 */
300 @GetMapping("excel") 348 @GetMapping("excel")
src/main/java/com/cnlive/shenhe/controller/SitesController.java
@@ -45,6 +45,9 @@ public class SitesController { @@ -45,6 +45,9 @@ public class SitesController {
45 @GetMapping(value = "/page") 45 @GetMapping(value = "/page")
46 public String page(Model model, Integer page, Integer pageSize, String orderByClause, String keyword, HttpSession session) { 46 public String page(Model model, Integer page, Integer pageSize, String orderByClause, String keyword, HttpSession session) {
47 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 47 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  48 + if(CommonUtils.isNull(sessionUser)){
  49 + return "redirect:/users/login";
  50 + }
48 Integer spid = sessionUser.getSpid(); 51 Integer spid = sessionUser.getSpid();
49 if (!sessionUser.isMaster() && spid != 0) { 52 if (!sessionUser.isMaster() && spid != 0) {
50 return "page/error.html"; 53 return "page/error.html";
src/main/java/com/cnlive/shenhe/controller/UsersController.java
1 package com.cnlive.shenhe.controller; 1 package com.cnlive.shenhe.controller;
2 2
  3 +import com.alibaba.fastjson.JSONObject;
3 import com.cnlive.shenhe.bean.SessionUser; 4 import com.cnlive.shenhe.bean.SessionUser;
  5 +import com.cnlive.shenhe.entity.ShySites;
4 import com.cnlive.shenhe.entity.ShyUsers; 6 import com.cnlive.shenhe.entity.ShyUsers;
  7 +import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
5 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; 8 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
  9 +import com.cnlive.shenhe.utils.CommonConst;
6 import com.cnlive.shenhe.utils.CommonUtils; 10 import com.cnlive.shenhe.utils.CommonUtils;
  11 +import com.github.pagehelper.PageInfo;
  12 +
7 import org.jasig.cas.client.authentication.AttributePrincipal; 13 import org.jasig.cas.client.authentication.AttributePrincipal;
8 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Controller; 15 import org.springframework.stereotype.Controller;
  16 +import org.springframework.ui.Model;
10 import org.springframework.web.bind.annotation.GetMapping; 17 import org.springframework.web.bind.annotation.GetMapping;
11 import org.springframework.web.bind.annotation.PathVariable; 18 import org.springframework.web.bind.annotation.PathVariable;
12 import org.springframework.web.bind.annotation.RequestMapping; 19 import org.springframework.web.bind.annotation.RequestMapping;
13 import org.springframework.web.bind.annotation.ResponseBody; 20 import org.springframework.web.bind.annotation.ResponseBody;
14 21
  22 +import java.util.List;
  23 +
15 import javax.servlet.http.HttpServletRequest; 24 import javax.servlet.http.HttpServletRequest;
16 import javax.servlet.http.HttpSession; 25 import javax.servlet.http.HttpSession;
17 26
18 /** 27 /**
19 - * @Auther: 周伟鹏  
20 - * @Date: 2018/11/29 14:22 28 + * @Auther: liwei
  29 + * @Date: 2019/08/20 14:22
21 * @Description: 30 * @Description:
22 */ 31 */
23 @Controller 32 @Controller
@@ -26,6 +35,8 @@ public class UsersController { @@ -26,6 +35,8 @@ public class UsersController {
26 35
27 @Autowired 36 @Autowired
28 UsersServiceImpl usersService; 37 UsersServiceImpl usersService;
  38 + @Autowired
  39 + SitesServiceImpl sitesService;
29 40
30 @GetMapping(value = "/{id}") 41 @GetMapping(value = "/{id}")
31 @ResponseBody 42 @ResponseBody
@@ -65,5 +76,35 @@ public class UsersController { @@ -65,5 +76,35 @@ public class UsersController {
65 return "redirect:https://user.cnlive.com/OpenSSO2/logout?service=http://test.shen.cnlive.com/users/login"; 76 return "redirect:https://user.cnlive.com/OpenSSO2/logout?service=http://test.shen.cnlive.com/users/login";
66 } 77 }
67 78
  79 +
  80 + @GetMapping(value = "/page")
  81 + public String page(Model model, Integer page, Integer pageSize, String orderByClause,
  82 + String username, String mobile, Integer sp_id, String company_brief, HttpSession session) {
  83 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  84 + if(CommonUtils.isNull(sessionUser)){
  85 + return "redirect:/users/login";
  86 + }
  87 + Integer spid = sessionUser.getSpid();
  88 + if (!sessionUser.isMaster() && spid != 0) {
  89 + return "page/error.html";
  90 + }
  91 + if (spid == 0) spid = null;
  92 + if (CommonUtils.isNull(page)) page = 1;
  93 + if (CommonUtils.isNull(pageSize)) pageSize = 10;
  94 + PageInfo<ShyUsers> usersPage = usersService.getPage(page, pageSize, orderByClause, username,mobile,sp_id,company_brief);
  95 + List<ShyUsers> list = usersPage.getList();
  96 + if (!list.isEmpty()) {
  97 + for (ShyUsers users : list) {
  98 + //显示spid简称
  99 + ShySites shySites = sitesService.findspidDescByspid(users.getSp_id());
  100 + if (CommonUtils.isNotNull(shySites)) {
  101 + users.setSp_desc(shySites.getName());
  102 + }
  103 + }
  104 + }
  105 + model.addAttribute("usersPage", usersPage);
  106 + model.addAttribute("pageSize", pageSize);
  107 + return "page/users.html";
  108 + }
68 109
69 } 110 }
src/main/java/com/cnlive/shenhe/controller/VideosController.java
@@ -38,7 +38,7 @@ import java.util.List; @@ -38,7 +38,7 @@ import java.util.List;
38 38
39 @Controller 39 @Controller
40 @RequestMapping("/videos") 40 @RequestMapping("/videos")
41 -public class VideosController { 41 +public class VideosController extends BaseController {
42 private static Logger logger = LoggerFactory.getLogger(VideosController.class); 42 private static Logger logger = LoggerFactory.getLogger(VideosController.class);
43 @Autowired 43 @Autowired
44 AuditPass Pass; 44 AuditPass Pass;
src/main/java/com/cnlive/shenhe/entity/ShyUsers.java
@@ -63,6 +63,9 @@ public class ShyUsers { @@ -63,6 +63,9 @@ public class ShyUsers {
63 private Long tm; 63 private Long tm;
64 64
65 private String user_logo; 65 private String user_logo;
  66 +
  67 + @Transient
  68 + private String sp_desc;
66 69
67 /** 70 /**
68 * @return id 71 * @return id
@@ -299,4 +302,13 @@ public class ShyUsers { @@ -299,4 +302,13 @@ public class ShyUsers {
299 public void setUser_logo(String user_logo) { 302 public void setUser_logo(String user_logo) {
300 this.user_logo = user_logo; 303 this.user_logo = user_logo;
301 } 304 }
  305 +
  306 + public String getSp_desc() {
  307 + return sp_desc;
  308 + }
  309 +
  310 + public void setSp_desc(String sp_desc) {
  311 + this.sp_desc = sp_desc;
  312 + }
  313 +
302 } 314 }
303 \ No newline at end of file 315 \ No newline at end of file
src/main/java/com/cnlive/shenhe/logging/LoggingWSServer.java deleted 100644 → 0
1 -package com.cnlive.shenhe.logging;  
2 -  
3 -  
4 -import org.slf4j.Logger;  
5 -import org.slf4j.LoggerFactory;  
6 -import org.springframework.beans.factory.annotation.Value;  
7 -import org.springframework.stereotype.Component;  
8 -import org.thymeleaf.util.StringUtils;  
9 -  
10 -  
11 -import javax.websocket.*;  
12 -import javax.websocket.server.ServerEndpoint;  
13 -import java.io.BufferedReader;  
14 -import java.io.FileReader;  
15 -import java.io.IOException;  
16 -import java.text.SimpleDateFormat;  
17 -import java.util.Arrays;  
18 -import java.util.Date;  
19 -import java.util.Map;  
20 -import java.util.concurrent.ConcurrentHashMap;  
21 -  
22 -/**  
23 - * WebSocket获取实时日志并输出到Web页面  
24 - */  
25 -@Component  
26 -@ServerEndpoint(value = "/logging/websocket", configurator = MyEndpointConfigure.class)  
27 -public class LoggingWSServer {  
28 - private static Logger log = LoggerFactory.getLogger(LoggingWSServer.class);  
29 -  
30 - @Value("${spring.application.name}")  
31 - private String applicationName;  
32 -  
33 - @Value("${spring.application.home}")  
34 - private String applicationHome;  
35 -  
36 - /**  
37 - * 连接集合  
38 - */  
39 - private static Map<String, Session> sessionMap = new ConcurrentHashMap<String, Session>();  
40 - private static Map<String, Integer> lengthMap = new ConcurrentHashMap<String, Integer>();  
41 -  
42 - /**  
43 - * 连接建立成功调用的方法  
44 - */  
45 - @OnOpen  
46 - public void onOpen(Session session) {  
47 - //添加到集合中  
48 - sessionMap.put(session.getId(), session);  
49 - lengthMap.put(session.getId(), 1);//默认从第一行开始  
50 -  
51 - //获取日志信息  
52 - new Thread(() -> {  
53 - log.info("LoggingWebSocketServer 任务开始");  
54 - boolean first = true;  
55 - while (sessionMap.get(session.getId()) != null) {  
56 - BufferedReader reader = null;  
57 - try {  
58 - //日志文件路径,获取最新的  
59 -// String filePath = System.getProperty("user.home") + "/log/" + new SimpleDateFormat("yyyyMMdd").format(new Date()) + "/"+applicationName+".log";  
60 - String filePath = applicationHome+ "/" + new SimpleDateFormat("yyyyMMdd").format(new Date()) + "/"+applicationName+".log";  
61 -  
62 - //字符流  
63 - reader = new BufferedReader(new FileReader(filePath));  
64 - Object[] lines = reader.lines().toArray();  
65 -  
66 - //只取从上次之后产生的日志  
67 - Object[] copyOfRange = Arrays.copyOfRange(lines, lengthMap.get(session.getId()), lines.length);  
68 -  
69 - //对日志进行着色,更加美观 PS:注意,这里要根据日志生成规则来操作  
70 - for (int i = 0; i < copyOfRange.length; i++) {  
71 - String line = (String) copyOfRange[i];  
72 - //先转义  
73 - line = line.replaceAll("&", "&amp;")  
74 - .replaceAll("<", "&lt;")  
75 - .replaceAll(">", "&gt;")  
76 - .replaceAll("\"", "&quot;");  
77 -  
78 - //处理等级  
79 - line = line.replace("DEBUG", "<span style='color: blue;'>DEBUG</span>");  
80 - line = line.replace("INFO", "<span style='color: green;'>INFO</span>");  
81 - line = line.replace("WARN", "<span style='color: orange;'>WARN</span>");  
82 - line = line.replace("ERROR", "<span style='color: red;'>ERROR</span>");  
83 -  
84 - //处理类名  
85 - String[] split = line.split("]");  
86 - if (split.length >= 2) {  
87 - String[] split1 = split[1].split("-");  
88 - if (split1.length >= 2) {  
89 - line = split[0] + "]" + "<span style='color: #298a8a;'>" + split1[0] + "</span>" + "-" + split1[1];  
90 - }  
91 - }  
92 -  
93 - copyOfRange[i] = line;  
94 - }  
95 -  
96 - //存储最新一行开始  
97 - lengthMap.put(session.getId(), lines.length);  
98 -  
99 - //第一次如果太大,截取最新的200行就够了,避免传输的数据太大  
100 - if(first && copyOfRange.length > 200){  
101 - copyOfRange = Arrays.copyOfRange(copyOfRange, copyOfRange.length - 200, copyOfRange.length);  
102 - first = false;  
103 - }  
104 -  
105 - String result = StringUtils.join(copyOfRange, "<br/>");  
106 -  
107 - //发送  
108 - send(session, result);  
109 -  
110 - //休眠一秒  
111 - Thread.sleep(1000);  
112 - } catch (Exception e) {  
113 - //捕获但不处理  
114 - e.printStackTrace();  
115 - } finally {  
116 - try {  
117 - reader.close();  
118 - } catch (IOException ignored) {  
119 - }  
120 - }  
121 - }  
122 - log.info("LoggingWebSocketServer 任务结束");  
123 - }).start();  
124 - }  
125 -  
126 - /**  
127 - * 连接关闭调用的方法  
128 - */  
129 - @OnClose  
130 - public void onClose(Session session) {  
131 - //从集合中删除  
132 - sessionMap.remove(session.getId());  
133 - lengthMap.remove(session.getId());  
134 - }  
135 -  
136 - /**  
137 - * 发生错误时调用  
138 - */  
139 - @OnError  
140 - public void onError(Session session, Throwable error) {  
141 - error.printStackTrace();  
142 - }  
143 -  
144 - /**  
145 - * 服务器接收到客户端消息时调用的方法  
146 - */  
147 - @OnMessage  
148 - public void onMessage(String message, Session session) {  
149 -  
150 - }  
151 -  
152 - /**  
153 - * 封装一个send方法,发送消息到前端  
154 - */  
155 - private void send(Session session, String message) {  
156 - try {  
157 - session.getBasicRemote().sendText(message);  
158 - } catch (Exception e) {  
159 - e.printStackTrace();  
160 - }  
161 - }  
162 -}  
src/main/java/com/cnlive/shenhe/logging/MyEndpointConfigure.java deleted 100644 → 0
1 -package com.cnlive.shenhe.logging;  
2 -  
3 -import org.springframework.beans.BeansException;  
4 -import org.springframework.beans.factory.BeanFactory;  
5 -import org.springframework.context.ApplicationContext;  
6 -import org.springframework.context.ApplicationContextAware;  
7 -  
8 -import javax.websocket.server.ServerEndpointConfig;  
9 -  
10 -/**  
11 - * 解决注入其他类的问题,详情参考这篇帖子:webSocket无法注入其他类:https://blog.csdn.net/tornadojava/article/details/78781474  
12 - */  
13 -public class MyEndpointConfigure extends ServerEndpointConfig.Configurator implements ApplicationContextAware {  
14 -  
15 - private static volatile BeanFactory context;  
16 -  
17 - @Override  
18 - public <T> T getEndpointInstance(Class<T> clazz){  
19 - return context.getBean(clazz);  
20 - }  
21 -  
22 - @Override  
23 - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {  
24 - MyEndpointConfigure.context = applicationContext;  
25 - }  
26 -}  
src/main/java/com/cnlive/shenhe/logging/WebSocketConfig.java deleted 100644 → 0
1 -package com.cnlive.shenhe.logging;  
2 -  
3 -import org.springframework.context.annotation.Bean;  
4 -import org.springframework.context.annotation.Configuration;  
5 -import org.springframework.web.socket.server.standard.ServerEndpointExporter;  
6 -  
7 -/**  
8 - * WebSocket配置  
9 - */  
10 -@Configuration  
11 -public class WebSocketConfig {  
12 -  
13 -  
14 - /**  
15 - * 用途:扫描并注册所有携带@ServerEndpoint注解的实例。 @ServerEndpoint("/websocket")  
16 - * PS:如果使用外部容器 则无需提供ServerEndpointExporter。  
17 - */  
18 - @Bean  
19 - public ServerEndpointExporter serverEndpointExporter() {  
20 - return new ServerEndpointExporter();  
21 - }  
22 -  
23 - /**  
24 - * 支持注入其他类  
25 - */  
26 - @Bean  
27 - public MyEndpointConfigure newMyEndpointConfigure (){  
28 - return new MyEndpointConfigure ();  
29 - }  
30 -}  
src/main/java/com/cnlive/shenhe/logging/logging.java deleted 100644 → 0
1 -package com.cnlive.shenhe.logging;  
2 -  
3 -import org.slf4j.Logger;  
4 -import org.slf4j.LoggerFactory;  
5 -import org.springframework.beans.factory.annotation.Value;  
6 -import org.springframework.stereotype.Controller;  
7 -import org.springframework.ui.Model;  
8 -import org.springframework.web.bind.annotation.GetMapping;  
9 -import org.springframework.web.bind.annotation.RequestMapping;  
10 -import org.springframework.web.servlet.ModelAndView;  
11 -  
12 -  
13 -/**  
14 - * @Auther: 李伟  
15 - * @Date: 2019/08/13 10:43  
16 - * @Description:log实时日志  
17 - */  
18 -@Controller  
19 -@RequestMapping("/logging")  
20 -public class logging {  
21 - private final Logger logger = LoggerFactory.getLogger(this.getClass());  
22 - /**  
23 - * 端口  
24 - */  
25 - @Value("${server.port}")  
26 - private String port;  
27 -  
28 - /**  
29 - * 跳转实时日志  
30 - */  
31 - @GetMapping("/")  
32 - public ModelAndView logging( Model model) {  
33 - model.addAttribute("port", port);  
34 - return new ModelAndView("logging/logging.html");  
35 - }  
36 -}  
src/main/java/com/cnlive/shenhe/serviceImpl/UsersServiceImpl.java
1 package com.cnlive.shenhe.serviceImpl; 1 package com.cnlive.shenhe.serviceImpl;
2 2
  3 +import com.cnlive.shenhe.entity.ShySites;
3 import com.cnlive.shenhe.entity.ShyUsers; 4 import com.cnlive.shenhe.entity.ShyUsers;
4 import com.cnlive.shenhe.mapper.ShyUsersMapper; 5 import com.cnlive.shenhe.mapper.ShyUsersMapper;
  6 +import com.cnlive.shenhe.utils.CommonUtils;
  7 +import com.github.pagehelper.PageHelper;
  8 +import com.github.pagehelper.PageInfo;
  9 +
  10 +import java.util.List;
  11 +
5 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
7 import tk.mybatis.mapper.entity.Example; 14 import tk.mybatis.mapper.entity.Example;
@@ -15,6 +22,33 @@ import tk.mybatis.mapper.entity.Example; @@ -15,6 +22,33 @@ import tk.mybatis.mapper.entity.Example;
15 public class UsersServiceImpl { 22 public class UsersServiceImpl {
16 @Autowired 23 @Autowired
17 ShyUsersMapper shyUsersMapper; 24 ShyUsersMapper shyUsersMapper;
  25 +
  26 + public PageInfo<ShyUsers> getPage(Integer page, Integer pageSize, String orderByClause,
  27 + String username,String mobile,Integer sp_id,String company_brief) {
  28 + Example example = new Example(ShyUsers.class);
  29 + Example.Criteria criteria = example.createCriteria();
  30 + if (CommonUtils.isNotEmpty(orderByClause)) {
  31 + example.setOrderByClause(orderByClause);
  32 + }else{
  33 + example.setOrderByClause("created_at desc");
  34 + }
  35 + if (CommonUtils.isNotEmpty(username)) {
  36 + criteria.andLike("username", "%" + username + "%");
  37 + }
  38 + if(CommonUtils.isNotEmpty(mobile)){
  39 + criteria.andLike("mobile", "%" + mobile + "%" );
  40 + }
  41 + if(CommonUtils.isNotEmpty(company_brief)){
  42 + criteria.andLike("company_brief", "%" + company_brief + "%" );
  43 + }
  44 + if(CommonUtils.isNotNull(sp_id)){
  45 + criteria.andEqualTo("sp_id", sp_id );
  46 + }
  47 + PageHelper.startPage(page, pageSize, true);
  48 + List<ShyUsers> ShyUsersList = shyUsersMapper.selectByExample(example);
  49 + PageInfo<ShyUsers> pageInfo = new PageInfo<ShyUsers>(ShyUsersList);
  50 + return pageInfo;
  51 + }
18 52
19 public ShyUsers get(Integer id) { 53 public ShyUsers get(Integer id) {
20 return shyUsersMapper.selectByPrimaryKey(id); 54 return shyUsersMapper.selectByPrimaryKey(id);
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
@@ -23,6 +23,8 @@ public class AuditPass { @@ -23,6 +23,8 @@ public class AuditPass {
23 private String platformKey;//点播platformKey 23 private String platformKey;//点播platformKey
24 @Value("${platformValue}") 24 @Value("${platformValue}")
25 private String platformValue;//点播platformValue 25 private String platformValue;//点播platformValue
  26 + @Value("${live_url}")
  27 + private String live_url;//直播同步信息
26 28
27 /** 29 /**
28 * 点播视频回调 30 * 点播视频回调
@@ -77,6 +79,20 @@ public class AuditPass { @@ -77,6 +79,20 @@ public class AuditPass {
77 Map<String, String> post = httpUtil.post(callBack); 79 Map<String, String> post = httpUtil.post(callBack);
78 return JSONObject.parseObject(post.get("result")); 80 return JSONObject.parseObject(post.get("result"));
79 } 81 }
  82 +
  83 + /**
  84 + * 直播云信息同步
  85 + * @param json
  86 + * @param callBack
  87 + * @return
  88 + */
  89 + public JSONObject syncLive(String activity_id) {
  90 + logger.info("直播云信息同步:activity_id:{}", activity_id);
  91 + HttpUtil httpUtil = HttpUtil.init();
  92 + httpUtil.setParam("activityId", activity_id);
  93 + Map<String, String> post = httpUtil.post(live_url);
  94 + return JSONObject.parseObject(post.get("result"));
  95 + }
80 96
81 /** 97 /**
82 * 评论审核回调 98 * 评论审核回调
@@ -106,6 +122,7 @@ public class AuditPass { @@ -106,6 +122,7 @@ public class AuditPass {
106 return JSONObject.parseObject(result); 122 return JSONObject.parseObject(result);
107 } 123 }
108 124
  125 +
109 /** 126 /**
110 * 图文审核回调 127 * 图文审核回调
111 * @param ids 128 * @param ids
src/main/resources/application.properties
@@ -54,6 +54,9 @@ avsmple_appSecret=28ce1e1fbee311e7a2f0fa163e771cf92ea58ebfbee311e7a2f0fa163e771c @@ -54,6 +54,9 @@ avsmple_appSecret=28ce1e1fbee311e7a2f0fa163e771cf92ea58ebfbee311e7a2f0fa163e771c
54 avsmple_url=http://test.transcode.cnlive.com/api/request 54 avsmple_url=http://test.transcode.cnlive.com/api/request
55 avsmple_callback=http://test.shen.cnlive.com/api/avsample/callback 55 avsmple_callback=http://test.shen.cnlive.com/api/avsample/callback
56 56
  57 +#\u540c\u6b65\u76f4\u64ad\u4e91\u4fe1\u606f
  58 +live_url=http://test.bc.cnlive.com/bokong/activity/activityShenHe
  59 +
57 #\u62bd\u5e27\u5b58\u653ebucket\u548c\u57df\u540d 60 #\u62bd\u5e27\u5b58\u653ebucket\u548c\u57df\u540d
58 qn_bucket=cnlivetest 61 qn_bucket=cnlivetest
59 qn_domain=http://test.qnvod.cnlive.com 62 qn_domain=http://test.qnvod.cnlive.com
src/main/resources/templates/common/frame.html
@@ -75,11 +75,13 @@ line-height: 2em; margin: 0 auto;font-size: 2em&quot; th:text=&quot;${session.sessionUser. @@ -75,11 +75,13 @@ line-height: 2em; margin: 0 auto;font-size: 2em&quot; th:text=&quot;${session.sessionUser.
75 <li><a href="/channel/page?shenhe_status=0&receive=0" id="/channel/page"> 频道审核</a></li> 75 <li><a href="/channel/page?shenhe_status=0&receive=0" id="/channel/page"> 频道审核</a></li>
76 </ul> 76 </ul>
77 </li> 77 </li>
78 - <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}"> -->
  79 + <li class="treeview" th:if="${session.sessionUser.spid==0 }">
79 <a href="#"> 80 <a href="#">
80 <span class="menu-item-top">系统管理</span> 81 <span class="menu-item-top">系统管理</span>
81 </a> 82 </a>
82 <ul class="treeview-menu"> 83 <ul class="treeview-menu">
  84 + <li><a href="/users/page" id="/users/page"> 审核用户管理</a></li>
83 <li><a href="/sites/page" id="/sites/page"> 白名单管理</a></li> 85 <li><a href="/sites/page" id="/sites/page"> 白名单管理</a></li>
84 </ul> 86 </ul>
85 </li> 87 </li>
src/main/resources/templates/page/live.html
@@ -270,13 +270,7 @@ @@ -270,13 +270,7 @@
270 </button> 270 </button>
271 </div> 271 </div>
272 272
273 -<!-- <div class="width-10p pull-right padding-r-5"> -->  
274 -<!-- <button class="btn btn-primary btn-xs btn-block" -->  
275 -<!-- disabled="disabled" title="日志" -->  
276 -<!-- onclick="reject('38_09471046aa7f4835a734f1d6208249fc')"> -->  
277 -<!-- <i class="fa fa-bullseye"></i> -->  
278 -<!-- </button> -->  
279 -<!-- </div> --> 273 +
280 274
281 <div class="width-10p pull-right padding-r-5"> 275 <div class="width-10p pull-right padding-r-5">
282 <button class="btn btn-danger btn-xs btn-block" title="下线直播" 276 <button class="btn btn-danger btn-xs btn-block" title="下线直播"
@@ -286,14 +280,21 @@ @@ -286,14 +280,21 @@
286 <i class="fa fa-arrow-down"></i> 280 <i class="fa fa-arrow-down"></i>
287 </button> 281 </button>
288 </div> 282 </div>
289 -  
290 <div class="width-10p pull-right padding-r-5"> 283 <div class="width-10p pull-right padding-r-5">
291 - <button class="btn btn-danger btn-xs btn-block" title="下线主播"  
292 - th:onclick="'offline_anchor('+${live.id}+')'" data-toggle="tooltip"  
293 - data-placement="top">  
294 - <i class="glyphicon glyphicon-user"></i> 284 + <button class="btn btn-primary btn-xs btn-block" title="同步直播云"
  285 + th:onclick="'sync_live('+${live.id}+')'"
  286 + data-toggle="tooltip" data-placement="top">
  287 + <i class="fa fa-bullseye"></i>
295 </button> 288 </button>
296 </div> 289 </div>
  290 +
  291 +<!-- <div class="width-10p pull-right padding-r-5"> -->
  292 +<!-- <button class="btn btn-danger btn-xs btn-block" title="下线主播" -->
  293 +<!-- th:onclick="'offline_anchor('+${live.id}+')'" data-toggle="tooltip" -->
  294 +<!-- data-placement="top"> -->
  295 +<!-- <i class="glyphicon glyphicon-user"></i> -->
  296 +<!-- </button> -->
  297 +<!-- </div> -->
297 </div> 298 </div>
298 299
299 </div> 300 </div>
@@ -596,6 +597,20 @@ @@ -596,6 +597,20 @@
596 $("#action_note_id").val(id); 597 $("#action_note_id").val(id);
597 $('#modal_remove').attr('claim', 'claim'); 598 $('#modal_remove').attr('claim', 'claim');
598 } 599 }
  600 + /*同步直播云信息*/
  601 + function sync_live(id){
  602 + var r = confirm("您确定要同步直播云的最新数据吗?");
  603 + if (r == true) {
  604 + $.post("/live/syncLive?ids=" + id, function (data) {
  605 + if (data.errorCode == 0) {
  606 + alert(data.errorMessage);
  607 + location.href = location.href;
  608 + } else {
  609 + alert(data.errorMessage);
  610 + }
  611 + })
  612 + }
  613 + }
599 614
600 $("#action_note_no").click(function() { 615 $("#action_note_no").click(function() {
601 $("#action_note").hide(); 616 $("#action_note").hide();
src/main/resources/templates/page/users.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org">
  3 +
  4 +<head th:replace="../templates/common/head::head"></head>
  5 +<style>
  6 + .fixed-table-toolbar .bs-bars, .fixed-table-toolbar .columns, .fixed-table-toolbar .search{margin-top: 0px;}
  7 + .table{margin-bottom:0;}
  8 +
  9 +</style>
  10 +<body class="skin-blue sidebar-mini">
  11 +
  12 +<div class="wrapper">
  13 +
  14 + <div th:replace="../templates/common/frame::frame"></div>
  15 +
  16 + <div class="content-wrapper" style="min-height: 788px;">
  17 + <section class="content-header">
  18 + <h1>
  19 + 审核用户管理
  20 + </h1>
  21 + <ol class="breadcrumb">
  22 + <li>首页</li>
  23 + <li>系统管理</li>
  24 + <li class="active">审核用户管理</li>
  25 + </ol>
  26 + </section>
  27 + <section class="content">
  28 + <div class="row">
  29 + <div class="col-xs-12">
  30 + <div class="box box-info">
  31 + <div class="box-body">
  32 +<!-- <div class="bootstrap-table"> -->
  33 +<!-- <div class="fixed-table-toolbar"> -->
  34 +<!-- <div class="bs-bars pull-left"> -->
  35 +<!-- <div id="toolbar" class="btn-group"> -->
  36 +<!-- </div> -->
  37 +<!-- </div> -->
  38 +<!-- <div class="columns columns-right btn-group pull-right"> -->
  39 +<!-- <button class="btn btn-default" type="button" name="refresh" title="搜索" id="users_query">搜索</button> -->
  40 +<!-- </div> -->
  41 +<!-- </div> -->
  42 +<!-- <div class="pull-right search"> -->
  43 +<!-- <input class="form-control" type="text" placeholder="搜索" id="keyword" name="keyword" th:value="${param.keyword}"> -->
  44 +<!-- </div> -->
  45 +<!-- <div class="pull-right search"> -->
  46 +<!-- <input class="form-control" type="text" placeholder="搜索" id="keyword" name="keyword" th:value="${param.keyword}"> -->
  47 +<!-- </div> -->
  48 +<!-- </div> -->
  49 +
  50 + <div class="btn-group margin-bottom " style="padding: 0;width: 100%;float: left;">
  51 + <div class="col-md-5" style="padding: 0;width: 20%;">
  52 + <label for="sp_id" class="control-label cb-toolbar" style="font-size:15px;top:8px;font-weight:100;">spId:</label>
  53 + <div class="col-sm-9" style="padding: 0;">
  54 + <input class="form-control" type="text" value="" id="sp_id">
  55 + </div>
  56 + </div>
  57 + <div class="col-md-6" style="padding: 0;width: 25%;" >
  58 + <label for="company_brief" class="control-label cb-toolbar" style="font-size:15px;top:8px;font-weight:100;">公司简称:</label>
  59 + <div class="col-sm-8" style="padding: 0;">
  60 + <input class="form-control" type="text" th:value="${param.company_brief}" id="company_brief">
  61 + </div>
  62 + </div>
  63 + <div class="col-md-6" style="padding: 0;width: 20%;" >
  64 + <label for="username" class="control-label cb-toolbar" style="font-size:15px;top:8px;font-weight:100;">用户名:</label>
  65 + <div class="col-sm-8" style="padding: 0;">
  66 + <input class="form-control" type="text" value="" id="username">
  67 + </div>
  68 + </div>
  69 + <div class="col-md-6" style="padding: 0;width: 20%;" >
  70 + <label for="mobile" class="control-label cb-toolbar" style="font-size:15px;top:8px;font-weight:100;">手机号:</label>
  71 + <div class="col-sm-7" style="padding: 0;">
  72 + <input class="form-control" type="text" value="" id="mobile">
  73 + </div>
  74 + </div>
  75 + <div class="col-md-6" style="padding: 0;width: 15%;">
  76 + <button class="btn btn-default" type="button" name="refresh" title="搜索" id="users_query">搜索</button>
  77 + </div>
  78 + </div>
  79 +
  80 +
  81 + <div class="fixed-table-container" style="padding-bottom: 0px;">
  82 + <div class="fixed-table-body">
  83 + <table data-toggle="table" data-pagination="true"
  84 + data-search="false" data-show-refresh="true" data-show-toggle="true"
  85 + data-show-columns="true" data-toolbar="#toolbar"
  86 + class="table table-hover">
  87 + <thead>
  88 + <tr>
  89 + <th style="text-align: center; width: 5%; " data-field="sp_id"
  90 + tabindex="0">
  91 + <div class="th-inner ">spID</div>
  92 + <div class="fht-cell"></div>
  93 + </th>
  94 + <th style="text-align: center; width: 12%; " data-field="sp_id_brief"
  95 + tabindex="0">
  96 + <div class="th-inner ">公司简称</div>
  97 + <div class="fht-cell"></div>
  98 + </th>
  99 + <th style="text-align: center; width: 8%; " data-field="type"
  100 + tabindex="0">
  101 + <div class="th-inner ">用户名
  102 + </div>
  103 + <div class="fht-cell"></div>
  104 + </th>
  105 + <th style="text-align: center; width: 12%; " data-field="type"
  106 + tabindex="0">
  107 + <div class="th-inner ">邮箱
  108 + </div>
  109 + <div class="fht-cell"></div>
  110 + </th>
  111 + <th style="text-align: center; width: 10%; " data-field="type"
  112 + tabindex="0">
  113 + <div class="th-inner ">手机号
  114 + </div>
  115 + <div class="fht-cell"></div>
  116 + </th>
  117 + <th style="text-align: center; width: 6%; " data-field="type"
  118 + tabindex="0">
  119 + <div class="th-inner ">是否主账号
  120 + </div>
  121 + <div class="fht-cell"></div>
  122 + </th>
  123 + <th style="text-align: center; width: 6%; " data-field="type"
  124 + tabindex="0">
  125 + <div class="th-inner ">用户状态
  126 + </div>
  127 + <div class="fht-cell"></div>
  128 + </th>
  129 + <th style="text-align: center; width: 12%; " data-field="upload_time"
  130 + tabindex="0">
  131 + <div class="th-inner ">用户信息创建时间
  132 + </div>
  133 + <div class="fht-cell"></div>
  134 + </th>
  135 + <th style="text-align: center; width: 12%; " data-field="updated_at"
  136 + tabindex="0">
  137 + <div class="th-inner ">用户信息更新时间</div>
  138 + <div class="fht-cell"></div>
  139 + </th>
  140 + <th style="text-align: center; width: 10%; " data-field="action"
  141 + tabindex="0">
  142 + <div class="th-inner ">操作
  143 + </div>
  144 + <div class="fht-cell"></div>
  145 + </th>
  146 + </tr>
  147 + </thead>
  148 + <tbody>
  149 + <tr th:data-index="${usersStat.index}" th:each="users : ${usersPage.list}">
  150 + <td style="text-align: center; width: 5%;" th:text="${users.sp_id}">82</td>
  151 + <td style="text-align: center; width: 12%;" th:text="${users.company_brief}">视讯中国</td>
  152 + <td style="text-align: center; width: 8%;" th:text="${users.username}">用户名</td>
  153 + <td style="text-align: center; width: 12%;" th:text="${users.email}">邮箱</td>
  154 + <td style="text-align: center; width: 10%;" th:text="${users.mobile}">手机号</td>
  155 + <td style="text-align: center; width: 6%;" th:text="${users.master== true?'是':'否'}"></td>
  156 + <td style="text-align: center; width: 6%;" th:if="${users.state==true}">
  157 + <span class="label label-success">正常</span> </td>
  158 + <td style="text-align: center; width: 6%;" th:if="${users.state==false}">
  159 + <span class="label label-danger">禁用</span></td>
  160 + <td style="text-align: center; width: 12%;" th:text="${#dates.format(users.created_at, 'yyyy-MM-dd HH:mm:ss')}">2018-11-22 23:08:48</td>
  161 + <td style="text-align: center; width: 12%;" th:text="${#dates.format(users.updated_at, 'yyyy-MM-dd HH:mm:ss')}">2016-08-03 14:27:17</td>
  162 + <td style="text-align: center; width: 10%;"><span>&nbsp;</span><a
  163 + class="edit" th:href="'javascript:edit('+${users.id}+',\''+${users.company_brief}+'\',\''+${users.state} +'\')'">
  164 + <button class="btn btn-primary btn-xs">设置</button>
  165 + </a><span> </span><span>&nbsp;</span></td>
  166 + </tr>
  167 +
  168 + </tbody>
  169 + </table>
  170 + </div>
  171 +
  172 + <div class="fixed-table-pagination" style="display: block;">
  173 + <div class="pull-left pagination-detail">
  174 + <span class="pagination-info" th:text="'共 '+${usersPage.total}+' 条记录,每页显示'">共 0 条记录</span>
  175 + <select class="" id="pageSize" name="pageSize" onchange="selectPageSize()">
  176 + <option value="10" th:selected="${pageSize==10}">10</option>
  177 + <option value="20" th:selected="${pageSize==20}">20</option>
  178 + <option value="50" th:selected="${pageSize==50}">50</option>
  179 + <option value="100" th:selected="${pageSize==100}">100</option>
  180 + </select>
  181 + <span class="pagination-info" >条记录</span>
  182 + </div>
  183 + <div class="pull-right pagination">
  184 + <ul class="pagination" th:if="${usersPage.pages>1}">
  185 + <li class="page-pre"><a th:href="'javascript:fanye(1);'">‹‹</a></li>
  186 + <li class="page-pre" th:if="${!usersPage.isFirstPage}"><a
  187 + th:onclick="'javascript:fanye(\''+${usersPage.pageNum-1}+'\');'">‹</a>
  188 + </li>
  189 +
  190 + <li class="page-number" th:if="${usersPage.pageNum-3>=1}"><a
  191 + th:onclick="'javascript:fanye(\''+${usersPage.pageNum-3}+'\');'"
  192 + th:text="${usersPage.pageNum-3}">2</a></li>
  193 + <li class="page-number" th:if="${usersPage.pageNum-2>=1}"><a
  194 + th:onclick="'javascript:fanye(\''+${usersPage.pageNum-2}+'\');'"
  195 + th:text="${usersPage.pageNum-2}">2</a></li>
  196 + <li class="page-number" th:if="${usersPage.pageNum-1>=1}"><a
  197 + th:onclick="'javascript:fanye(\''+${usersPage.pageNum-1}+'\');'"
  198 + th:text="${usersPage.pageNum-1}">2</a></li>
  199 + <li class="page-number active"><a href="javaScript:void(0);"
  200 + th:text="${usersPage.pageNum}">2</a></li>
  201 + <li class="page-number" th:if="${usersPage.pageNum+1<=usersPage.pages}"><a
  202 + th:onclick="'javascript:fanye(\''+${usersPage.pageNum+1}+'\');'"
  203 + th:text="${usersPage.pageNum+1}">2</a></li>
  204 + <li class="page-number" th:if="${usersPage.pageNum+2<=usersPage.pages}"><a
  205 + th:onclick="'javascript:fanye(\''+${usersPage.pageNum+2}+'\');'"
  206 + th:text="${usersPage.pageNum+2}">2</a></li>
  207 + <li class="page-number" th:if="${usersPage.pageNum+3<=usersPage.pages}"><a
  208 + th:onclick="'javascript:fanye(\''+${usersPage.pageNum+3}+'\');'"
  209 + th:text="${usersPage.pageNum+3}">2</a></li>
  210 +
  211 + <li class="page-next" th:if="${!usersPage.isLastPage}"><a
  212 + th:onclick="'javascript:fanye(\''+${usersPage.pageNum+1}+'\');'">›</a>
  213 + </li>
  214 + <li class="page-next"><a
  215 + th:onclick="'javascript:fanye(\''+${usersPage.pages}+'\');'">››</a>
  216 + </li>
  217 + </ul>
  218 + </div>
  219 + </div>
  220 + </div>
  221 + </div>
  222 + <div class="clearfix"></div>
  223 + </div>
  224 + </div>
  225 + </div>
  226 + </div>
  227 + </section>
  228 + </div>
  229 +
  230 +<!-- 模态框(Modal) -->
  231 +<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  232 + <div class="modal-dialog">
  233 + <div class="modal-content" style="margin-top: 30%;">
  234 + <div class="modal-header">
  235 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  236 + <h4 class="modal-title" id="myModalLabel">编辑审核用户</h4>
  237 + </div>
  238 + <div class="modal-body">
  239 + <div class="form-group">
  240 + <label class="control-label col-sm-2" style="font-size: 15px;">sp简称:</label>
  241 + <div class="col-sm-10" style="margin-top: -5px;margin-bottom: 20px;">
  242 + <h5 id="edit_company">视讯中国</h5>
  243 + </div>
  244 + </div>
  245 +
  246 + <div class="form-group">
  247 + <label class="control-label col-sm-2" style="font-size: 15px;">:</label>
  248 + <form action="/users/write" method="post" id="editWrite">
  249 + <input type="text" name="siteId" value="" class="hide" id="edit_id"/>
  250 + <input type="text" name="redirect_url" value="" class="hide" id="redirect_url"/>
  251 + <div class="col-sm-10" style="float: left">
  252 + <div th:each="bu:${business}" style="padding-right: 30px;" class="write_check">
  253 + <span th:text="${bu.value}" style="font-size: 15px"></span>
  254 + <input type="checkbox" name="write_business" th:value="${bu.key}" th:id="'write_check_'+${bu.key}">
  255 + </div>
  256 + </div>
  257 + </form>
  258 + </div>
  259 +
  260 + </div>
  261 + <div class="modal-footer">
  262 + <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  263 +<!-- <button type="button" class="btn btn-primary" onclick="javascript:$('#editWrite').submit();">提交更改</button> -->
  264 + </div>
  265 + </div><!-- /.modal-content -->
  266 + </div><!-- /.modal-dialog -->
  267 +</div>
  268 +<!-- /.modal -->
  269 + <script>
  270 + //打开编辑窗口
  271 + function edit(id,company,write_business){
  272 + $("#edit_company").text(company);
  273 + $("#edit_id").val(id);
  274 + $("#redirect_url").val(location.pathname+location.search);
  275 + $(".write_check input").prop("checked",false);
  276 + if($.trim(write_business)!=''){
  277 + var array = write_business.split(",")
  278 + for (var i=0;i<array.length;i++){
  279 + $("#write_check_"+array[i]).prop("checked",true);
  280 + }
  281 + }
  282 + $('#editModal').modal('show');
  283 + }
  284 +
  285 + //翻页函数
  286 + function fanye(page) {
  287 + var param = location.search;
  288 + if (param.indexOf("page=") != -1) {
  289 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  290 + var split = se.split("&");
  291 + var h = "";
  292 + for (var i = 0; i < split.length; i++) {
  293 + var s = split[i];
  294 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
  295 + }
  296 + h = h.substring(1, h.length);
  297 + window.location.href = "/users/page?" + h + "&page=" + page;
  298 + } else {
  299 + param = param.substring(1, param.length);
  300 + window.location.href = "/users/page?" + param + "&page=" + page;
  301 + }
  302 + }
  303 +
  304 + //选择每页数量触发函数
  305 + function selectPageSize(){
  306 + var pageSize=$("#pageSize").val();
  307 + var param = location.search;
  308 + if (param.indexOf("pageSize=") != -1) {
  309 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  310 + var split = se.split("&");
  311 + var h = "";
  312 + for (var i = 0; i < split.length; i++) {
  313 + var s = split[i];
  314 + if (s.indexOf("pageSize=") < 0 &&s.indexOf("page=") < 0) h = h + "&" + split[i];
  315 + }
  316 + h = h.substring(1, h.length);
  317 + window.location.href = "/users/page?" + h + "&pageSize=" + pageSize;
  318 + } else {
  319 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  320 + var split = se.split("&");
  321 + var h = "";
  322 + for (var i = 0; i < split.length; i++) {
  323 + var s = split[i];
  324 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
  325 + }
  326 + h = h.substring(1, h.length);
  327 + window.location.href = "/users/page?" + h + "&pageSize=" + pageSize;
  328 + }
  329 + }
  330 +
  331 + //搜索
  332 + $('#users_query').click(function () {
  333 + var company_brief = $("#company_brief").val();
  334 + var username = $("#username").val();
  335 + var sp_id = $("#sp_id").val();
  336 + var mobile = $("#mobile").val();
  337 + var pageSize = $("#pageSize").val();
  338 + window.location.href = "/users/page?company_brief=" + company_brief + "&username=" + username+ "&sp_id=" + sp_id+ "&mobile=" + mobile+ "&pageSize=" + pageSize;
  339 + });
  340 +
  341 + </script>
  342 +
  343 + <footer th:replace="../templates/common/foot::foot" ></footer>
  344 +
  345 +
  346 + <!-- Add the sidebar's background. This div must be placed
  347 + immediately after the control sidebar -->
  348 + <div class="control-sidebar-bg" style="position: fixed; height: auto;"></div>
  349 +
  350 +</div><!-- ./wrapper -->
  351 +
  352 +
  353 +<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  354 +<script type="text/javascript">
  355 + $('div.alert').not('.alert-danger').delay(3000).slideUp(300);
  356 +</script>
  357 +
  358 +<!-- AdminLTE App -->
  359 +<script src="../../static/js/app.min.js"></script>
  360 +<!-- AdminLTE for demo purposes -->
  361 +<script src="../../static/js/sidebar.js"></script>
  362 +
  363 +
  364 +</body>
  365 +</html>
0 \ No newline at end of file 366 \ No newline at end of file