Commit e97a3de612adaa5c556db1cd3b6b33296f8c563f
1 parent
4cfe4471
代码整理
Showing
11 changed files
with
123 additions
and
104 deletions
src/main/java/com/cnlive/shenhe/ShenheApplication.java
| @@ -63,6 +63,7 @@ public class ShenheApplication extends SpringBootServletInitializer { | @@ -63,6 +63,7 @@ public class ShenheApplication extends SpringBootServletInitializer { | ||
| 63 | Map<String,String> initParameters = new HashMap<String, String>(); | 63 | Map<String,String> initParameters = new HashMap<String, String>(); |
| 64 | initParameters.put("casServerLoginUrl", CAS_SERVER_LOGIN_URL); | 64 | initParameters.put("casServerLoginUrl", CAS_SERVER_LOGIN_URL); |
| 65 | initParameters.put("service", SERVICE_LOGIN); | 65 | initParameters.put("service", SERVICE_LOGIN); |
| 66 | + initParameters.put("ignorePattern", "/api/*"); | ||
| 66 | registration.setInitParameters(initParameters); | 67 | registration.setInitParameters(initParameters); |
| 67 | // 设定加载的顺序 | 68 | // 设定加载的顺序 |
| 68 | registration.setOrder(2); | 69 | registration.setOrder(2); |
src/main/java/com/cnlive/shenhe/api/CommentsControllerApi.java
| @@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.ResponseBody; | @@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.ResponseBody; | ||
| 17 | import java.util.Arrays; | 17 | import java.util.Arrays; |
| 18 | import java.util.List; | 18 | import java.util.List; |
| 19 | @Controller | 19 | @Controller |
| 20 | -@RequestMapping("/commentsApi") | 20 | +@RequestMapping("/api/comments") |
| 21 | public class CommentsControllerApi { | 21 | public class CommentsControllerApi { |
| 22 | 22 | ||
| 23 | @Autowired | 23 | @Autowired |
| @@ -51,7 +51,11 @@ public class CommentsControllerApi { | @@ -51,7 +51,11 @@ public class CommentsControllerApi { | ||
| 51 | json1.put("state",CommonConst.AUDIT_SUCCESS); | 51 | json1.put("state",CommonConst.AUDIT_SUCCESS); |
| 52 | json1.put("attr_tags",""); | 52 | json1.put("attr_tags",""); |
| 53 | json1.put("msg",""); | 53 | json1.put("msg",""); |
| 54 | - Pass.commentPass(json1); | 54 | + JSONObject result = Pass.commentPass(json1); |
| 55 | + Integer code = result.getInteger("errorCode"); | ||
| 56 | + if (code != 0) { | ||
| 57 | + return new ResponseBean(code, result.getString("errorMessage")); | ||
| 58 | + } | ||
| 55 | }else { | 59 | }else { |
| 56 | shyComments.setState(CommonConst.AUDIT_INTT); | 60 | shyComments.setState(CommonConst.AUDIT_INTT); |
| 57 | } | 61 | } |
src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
| 1 | package com.cnlive.shenhe.api; | 1 | package com.cnlive.shenhe.api; |
| 2 | + | ||
| 2 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 3 | import com.cnlive.shenhe.bean.ErrorEnum; | 4 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 4 | import com.cnlive.shenhe.bean.ResponseBean; | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| @@ -11,16 +12,21 @@ import com.cnlive.shenhe.utils.CommonConst; | @@ -11,16 +12,21 @@ import com.cnlive.shenhe.utils.CommonConst; | ||
| 11 | import com.cnlive.shenhe.utils.CommonUtils; | 12 | import com.cnlive.shenhe.utils.CommonUtils; |
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.stereotype.Controller; | 14 | import org.springframework.stereotype.Controller; |
| 14 | -import org.springframework.web.bind.annotation.*; | 15 | +import org.springframework.web.bind.annotation.PostMapping; |
| 16 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 18 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
| 19 | + | ||
| 15 | import java.util.Arrays; | 20 | import java.util.Arrays; |
| 16 | import java.util.List; | 21 | import java.util.List; |
| 22 | + | ||
| 17 | /** | 23 | /** |
| 18 | * @Auther: chenhao | 24 | * @Auther: chenhao |
| 19 | * @Date: 2018/12/6 11:17 | 25 | * @Date: 2018/12/6 11:17 |
| 20 | * @Description: 视频送审接口 | 26 | * @Description: 视频送审接口 |
| 21 | */ | 27 | */ |
| 22 | @Controller | 28 | @Controller |
| 23 | -@RequestMapping("/videosApi") | 29 | +@RequestMapping("/api/videos") |
| 24 | public class VideosControllerApi { | 30 | public class VideosControllerApi { |
| 25 | @Autowired | 31 | @Autowired |
| 26 | AuditPass Pass; | 32 | AuditPass Pass; |
| @@ -29,25 +35,28 @@ public class VideosControllerApi { | @@ -29,25 +35,28 @@ public class VideosControllerApi { | ||
| 29 | @Autowired | 35 | @Autowired |
| 30 | UsersServiceImpl usersService; | 36 | UsersServiceImpl usersService; |
| 31 | 37 | ||
| 32 | - | ||
| 33 | @PostMapping("/import") | 38 | @PostMapping("/import") |
| 34 | @ResponseBody | 39 | @ResponseBody |
| 35 | - public ResponseBean impotVideo(@RequestBody JSONObject json){ | 40 | + public ResponseBean impotVideo(@RequestBody JSONObject json) { |
| 36 | ShySites shySites = new ShySites(); | 41 | ShySites shySites = new ShySites(); |
| 37 | ShyVideos shyVideos = new ShyVideos(); | 42 | ShyVideos shyVideos = new ShyVideos(); |
| 38 | shyVideos.setState(CommonConst.AUDIT_INTT); | 43 | shyVideos.setState(CommonConst.AUDIT_INTT); |
| 39 | //判断是否白名单 | 44 | //判断是否白名单 |
| 40 | shySites.setSpid(json.getInteger("spId")); | 45 | shySites.setSpid(json.getInteger("spId")); |
| 41 | List<ShySites> shySitesList = videosService.getBusiness(shySites); | 46 | List<ShySites> shySitesList = videosService.getBusiness(shySites); |
| 42 | - if(!shySitesList.isEmpty()){ | ||
| 43 | - if(CommonUtils.isNotEmpty(shySitesList.get(0).getWrite_business())){ | 47 | + if (!shySitesList.isEmpty()) { |
| 48 | + if (CommonUtils.isNotEmpty(shySitesList.get(0).getWrite_business())) { | ||
| 44 | String write_business = shySitesList.get(0).getWrite_business(); | 49 | String write_business = shySitesList.get(0).getWrite_business(); |
| 45 | String[] business = write_business.split(","); | 50 | String[] business = write_business.split(","); |
| 46 | List<String> asList = Arrays.asList(business); | 51 | List<String> asList = Arrays.asList(business); |
| 47 | - if(asList.contains(CommonConst.BUSINESS_VIDEO+"")){ | 52 | + if (asList.contains(CommonConst.BUSINESS_VIDEO + "")) { |
| 48 | shyVideos.setState(CommonConst.AUDIT_SUCCESS); | 53 | shyVideos.setState(CommonConst.AUDIT_SUCCESS); |
| 49 | - Pass.auditPass(json.getString("videoId"),CommonConst.AUDIT_SUCCESS,"",""); | ||
| 50 | - }else { | 54 | + JSONObject result = Pass.auditPass(json.getString("videoId"), CommonConst.AUDIT_SUCCESS, "", ""); |
| 55 | + Integer code = result.getInteger("code"); | ||
| 56 | + if (code != 0) { | ||
| 57 | + return new ResponseBean(code, result.getString("msg")); | ||
| 58 | + } | ||
| 59 | + } else { | ||
| 51 | shyVideos.setState(CommonConst.AUDIT_INTT); | 60 | shyVideos.setState(CommonConst.AUDIT_INTT); |
| 52 | } | 61 | } |
| 53 | } | 62 | } |
| @@ -63,10 +72,10 @@ public class VideosControllerApi { | @@ -63,10 +72,10 @@ public class VideosControllerApi { | ||
| 63 | shyVideos.setCallback(json.getString("callback")); | 72 | shyVideos.setCallback(json.getString("callback")); |
| 64 | shyVideos.setSpid(Integer.parseInt(json.getString("spId"))); | 73 | shyVideos.setSpid(Integer.parseInt(json.getString("spId"))); |
| 65 | int i = videosService.impotVideo(shyVideos); | 74 | int i = videosService.impotVideo(shyVideos); |
| 66 | - if(i>0){ | ||
| 67 | - return new ResponseBean(ErrorEnum.SUCCESS); | ||
| 68 | - }else { | ||
| 69 | - return new ResponseBean(ErrorEnum.ERROR); | 75 | + if (i > 0) { |
| 76 | + return new ResponseBean(ErrorEnum.SUCCESS); | ||
| 77 | + } else { | ||
| 78 | + return new ResponseBean(ErrorEnum.ERROR); | ||
| 70 | } | 79 | } |
| 71 | } | 80 | } |
| 72 | } | 81 | } |
src/main/java/com/cnlive/shenhe/bean/ErrorEnum.java
| 1 | package com.cnlive.shenhe.bean; | 1 | package com.cnlive.shenhe.bean; |
| 2 | 2 | ||
| 3 | -/** | ||
| 4 | - * Created with IntelliJ IDEA. | ||
| 5 | - * Description: | ||
| 6 | - * User: fan xiao chun | ||
| 7 | - * Date: 2018-07-25 | ||
| 8 | - * Time: 18:25 | ||
| 9 | - */ | 3 | + |
| 10 | public enum ErrorEnum { | 4 | public enum ErrorEnum { |
| 11 | 5 | ||
| 12 | SUCCESS(0, "success"), | 6 | SUCCESS(0, "success"), |
| 13 | ERROR(500, "服务异常"), | 7 | ERROR(500, "服务异常"), |
| 14 | RECORD_NOT_EXIST(10001, "记录不存在"), | 8 | RECORD_NOT_EXIST(10001, "记录不存在"), |
| 15 | PARAM_ERROR(10002, "参数错误"), | 9 | PARAM_ERROR(10002, "参数错误"), |
| 16 | - | ||
| 17 | - | ||
| 18 | NOT_LOGIN(4000, "登录失效或未登录"), | 10 | NOT_LOGIN(4000, "登录失效或未登录"), |
| 19 | ACCESS_DENIED(40001, "没有权限"); | 11 | ACCESS_DENIED(40001, "没有权限"); |
| 20 | 12 |
src/main/java/com/cnlive/shenhe/controller/CommentsController.java
| @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping; | @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping; | ||
| 13 | import org.springframework.web.bind.annotation.RequestBody; | 13 | import org.springframework.web.bind.annotation.RequestBody; |
| 14 | import org.springframework.web.bind.annotation.RequestMapping; | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 15 | import org.springframework.web.bind.annotation.ResponseBody; | 15 | import org.springframework.web.bind.annotation.ResponseBody; |
| 16 | + | ||
| 16 | import javax.servlet.http.HttpSession; | 17 | import javax.servlet.http.HttpSession; |
| 17 | 18 | ||
| 18 | 19 | ||
| @@ -24,29 +25,33 @@ public class CommentsController { | @@ -24,29 +25,33 @@ public class CommentsController { | ||
| 24 | @Autowired | 25 | @Autowired |
| 25 | CommentsServiceImpl commentsService; | 26 | CommentsServiceImpl commentsService; |
| 26 | 27 | ||
| 27 | - | ||
| 28 | - | ||
| 29 | /** | 28 | /** |
| 30 | * 评论修改状态接口 | 29 | * 评论修改状态接口 |
| 30 | + * | ||
| 31 | * @param json | 31 | * @param json |
| 32 | * @return | 32 | * @return |
| 33 | */ | 33 | */ |
| 34 | @PostMapping("/shenheComment") | 34 | @PostMapping("/shenheComment") |
| 35 | @ResponseBody | 35 | @ResponseBody |
| 36 | - public ResponseBean shenheInfo(@RequestBody JSONObject json,Integer id,HttpSession session){ | ||
| 37 | - Pass.commentPass(json); | 36 | + public ResponseBean shenheInfo(@RequestBody JSONObject json, Integer id, HttpSession session) { |
| 37 | + JSONObject result = Pass.commentPass(json); | ||
| 38 | + Integer code = result.getInteger("errorCode"); | ||
| 39 | + if (code != 0) { | ||
| 40 | + return new ResponseBean(code, result.getString("errorMessage")); | ||
| 41 | + } | ||
| 38 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | 42 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 39 | String userId = sessionUser.getUserId(); | 43 | String userId = sessionUser.getUserId(); |
| 40 | - int i = commentsService.updateComment(json,id,userId); | ||
| 41 | - if(i==0){ | ||
| 42 | - return new ResponseBean(ErrorEnum.ERROR); | ||
| 43 | - }else { | 44 | + int i = commentsService.updateComment(json, id, userId); |
| 45 | + if (i == 0) { | ||
| 46 | + return new ResponseBean(ErrorEnum.ERROR); | ||
| 47 | + } else { | ||
| 44 | return new ResponseBean(ErrorEnum.SUCCESS); | 48 | return new ResponseBean(ErrorEnum.SUCCESS); |
| 45 | } | 49 | } |
| 46 | } | 50 | } |
| 47 | 51 | ||
| 48 | /** | 52 | /** |
| 49 | * 评论列表页 | 53 | * 评论列表页 |
| 54 | + * | ||
| 50 | * @param activity_id | 55 | * @param activity_id |
| 51 | * @param content | 56 | * @param content |
| 52 | * @param is_hot | 57 | * @param is_hot |
| @@ -61,22 +66,23 @@ public class CommentsController { | @@ -61,22 +66,23 @@ public class CommentsController { | ||
| 61 | */ | 66 | */ |
| 62 | @RequestMapping("/page") | 67 | @RequestMapping("/page") |
| 63 | @ResponseBody | 68 | @ResponseBody |
| 64 | - public Object getListComments(String activity_id, String content, Integer is_hot, String start_date, String end_date, Integer state, String auditor, Integer page, Integer pageSize, String orderByClause, HttpSession session){ | 69 | + public Object getListComments(String activity_id, String content, Integer is_hot, String start_date, String end_date, Integer state, String auditor, Integer page, Integer pageSize, String orderByClause, HttpSession session) { |
| 65 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | 70 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 66 | Integer spid = sessionUser.getSpid(); | 71 | Integer spid = sessionUser.getSpid(); |
| 67 | - if(CommonUtils.isNull(page))page=1; | ||
| 68 | - if(CommonUtils.isNull(pageSize))pageSize=10; | ||
| 69 | - return commentsService.getListComments(activity_id,content,is_hot,start_date,end_date,state,auditor,page,pageSize,orderByClause,spid); | 72 | + if (CommonUtils.isNull(page)) page = 1; |
| 73 | + if (CommonUtils.isNull(pageSize)) pageSize = 10; | ||
| 74 | + return commentsService.getListComments(activity_id, content, is_hot, start_date, end_date, state, auditor, page, pageSize, orderByClause, spid); | ||
| 70 | } | 75 | } |
| 71 | 76 | ||
| 72 | /** | 77 | /** |
| 73 | * 评论查看接口 | 78 | * 评论查看接口 |
| 79 | + * | ||
| 74 | * @param id | 80 | * @param id |
| 75 | * @return | 81 | * @return |
| 76 | */ | 82 | */ |
| 77 | @RequestMapping("/details") | 83 | @RequestMapping("/details") |
| 78 | @ResponseBody | 84 | @ResponseBody |
| 79 | - public Object getDetailsComments(Integer id){ | ||
| 80 | - return commentsService.getDetailsComment(id); | 85 | + public Object getDetailsComments(Integer id) { |
| 86 | + return commentsService.getDetailsComment(id); | ||
| 81 | } | 87 | } |
| 82 | } | 88 | } |
src/main/java/com/cnlive/shenhe/controller/UsersController.java
| @@ -58,7 +58,7 @@ public class UsersController { | @@ -58,7 +58,7 @@ public class UsersController { | ||
| 58 | return "page/head.html"; | 58 | return "page/head.html"; |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | - return "error.html"; | 61 | + return "page/error.html"; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | @RequestMapping("/logout") | 64 | @RequestMapping("/logout") |
src/main/java/com/cnlive/shenhe/controller/VideosController.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.ErrorEnum; | 4 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 4 | import com.cnlive.shenhe.bean.ResponseBean; | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| 5 | import com.cnlive.shenhe.bean.SessionUser; | 6 | import com.cnlive.shenhe.bean.SessionUser; |
| @@ -9,7 +10,9 @@ import com.cnlive.shenhe.utils.AuditPass; | @@ -9,7 +10,9 @@ import com.cnlive.shenhe.utils.AuditPass; | ||
| 9 | import com.cnlive.shenhe.utils.CommonUtils; | 10 | import com.cnlive.shenhe.utils.CommonUtils; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.stereotype.Controller; | 12 | import org.springframework.stereotype.Controller; |
| 12 | -import org.springframework.web.bind.annotation.*; | 13 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 14 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
| 15 | + | ||
| 13 | import javax.servlet.http.HttpSession; | 16 | import javax.servlet.http.HttpSession; |
| 14 | 17 | ||
| 15 | @Controller | 18 | @Controller |
| @@ -26,30 +29,33 @@ public class VideosController { | @@ -26,30 +29,33 @@ public class VideosController { | ||
| 26 | 29 | ||
| 27 | /** | 30 | /** |
| 28 | * 审核信息返回接口 | 31 | * 审核信息返回接口 |
| 32 | + * | ||
| 29 | * @param activity_id 视频id | 33 | * @param activity_id 视频id |
| 30 | - * @param state 状态码 | ||
| 31 | - * @param attr_tags 标签 | ||
| 32 | - * @param msg 备注信息 | 34 | + * @param state 状态码 |
| 35 | + * @param attr_tags 标签 | ||
| 36 | + * @param msg 备注信息 | ||
| 33 | * @return | 37 | * @return |
| 34 | */ | 38 | */ |
| 35 | @RequestMapping("/shenheVideo") | 39 | @RequestMapping("/shenheVideo") |
| 36 | @ResponseBody | 40 | @ResponseBody |
| 37 | - public ResponseBean shenheInfo(Integer id,String activity_id,Integer state,String attr_tags,String msg,HttpSession session){ | 41 | + public ResponseBean shenheInfo(Integer id, String activity_id, Integer state, String attr_tags, String msg, HttpSession session) { |
| 38 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | 42 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 39 | String userId = sessionUser.getUserId(); | 43 | String userId = sessionUser.getUserId(); |
| 40 | - String code = Pass.auditPass(activity_id, state, attr_tags, msg); | ||
| 41 | -// if(code.equals("-1")){ | ||
| 42 | -// return new ResponseBean(ErrorEnum.ERROR); | ||
| 43 | -// } | ||
| 44 | - int i = videosService.updateVideo(id,userId,activity_id, state, attr_tags, msg); | ||
| 45 | - if(i==0){ | 44 | + JSONObject result = Pass.auditPass(activity_id, state, attr_tags, msg); |
| 45 | + Integer code = result.getInteger("code"); | ||
| 46 | + if (code != 0) { | ||
| 47 | + return new ResponseBean(code, result.getString("msg")); | ||
| 48 | + } | ||
| 49 | + int i = videosService.updateVideo(id, userId, state, attr_tags, msg); | ||
| 50 | + if (i == 0) { | ||
| 46 | return new ResponseBean(ErrorEnum.ERROR); | 51 | return new ResponseBean(ErrorEnum.ERROR); |
| 47 | } | 52 | } |
| 48 | - return new ResponseBean(ErrorEnum.SUCCESS); | 53 | + return new ResponseBean(ErrorEnum.SUCCESS); |
| 49 | } | 54 | } |
| 50 | 55 | ||
| 51 | /** | 56 | /** |
| 52 | * 内容分页列表接口 | 57 | * 内容分页列表接口 |
| 58 | + * | ||
| 53 | * @param video_title | 59 | * @param video_title |
| 54 | * @param start_date | 60 | * @param start_date |
| 55 | * @param end_date | 61 | * @param end_date |
| @@ -61,26 +67,28 @@ public class VideosController { | @@ -61,26 +67,28 @@ public class VideosController { | ||
| 61 | */ | 67 | */ |
| 62 | @RequestMapping("/page") | 68 | @RequestMapping("/page") |
| 63 | @ResponseBody | 69 | @ResponseBody |
| 64 | - public Object getListVideos(String video_title, String start_date, String end_date, Integer state, Integer page, Integer pageSize, String orderByClause, HttpSession session){ | 70 | + public Object getListVideos(String video_title, String start_date, String end_date, Integer state, Integer page, Integer pageSize, String orderByClause, HttpSession session) { |
| 65 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | 71 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 66 | Integer spid = sessionUser.getSpid(); | 72 | Integer spid = sessionUser.getSpid(); |
| 67 | - if(CommonUtils.isNull(page))page=1; | ||
| 68 | - if(CommonUtils.isNull(pageSize))pageSize=10; | ||
| 69 | - if(CommonUtils.isNotNull(spid)&&spid==0){spid=82;} | ||
| 70 | - return videosService.getListContent(video_title,start_date,end_date,state,page,pageSize,orderByClause,spid); | 73 | + if (CommonUtils.isNull(page)) page = 1; |
| 74 | + if (CommonUtils.isNull(pageSize)) pageSize = 10; | ||
| 75 | + if (CommonUtils.isNotNull(spid) && spid == 0) { | ||
| 76 | + spid = 82; | ||
| 77 | + } | ||
| 78 | + return videosService.getListContent(video_title, start_date, end_date, state, page, pageSize, orderByClause, spid); | ||
| 71 | } | 79 | } |
| 72 | 80 | ||
| 73 | /** | 81 | /** |
| 74 | * 内容详情页接口(查看) | 82 | * 内容详情页接口(查看) |
| 83 | + * | ||
| 75 | * @param id | 84 | * @param id |
| 76 | * @return | 85 | * @return |
| 77 | */ | 86 | */ |
| 78 | @RequestMapping("/details") | 87 | @RequestMapping("/details") |
| 79 | @ResponseBody | 88 | @ResponseBody |
| 80 | - public Object getDetailsVideo(Integer id){ | ||
| 81 | - return videosService.getDetailsContent(id); | 89 | + public Object getDetailsVideo(Integer id) { |
| 90 | + return videosService.getDetailsContent(id); | ||
| 82 | } | 91 | } |
| 83 | 92 | ||
| 84 | 93 | ||
| 85 | - | ||
| 86 | } | 94 | } |
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
| @@ -22,52 +22,52 @@ import java.util.List; | @@ -22,52 +22,52 @@ import java.util.List; | ||
| 22 | @Service | 22 | @Service |
| 23 | public class CommentsServiceImpl { | 23 | public class CommentsServiceImpl { |
| 24 | @Autowired | 24 | @Autowired |
| 25 | - ShyCommentsMapper shyCommentsMapper ; | 25 | + ShyCommentsMapper shyCommentsMapper; |
| 26 | @Autowired | 26 | @Autowired |
| 27 | ShySitesMapper shySitesMapper; | 27 | ShySitesMapper shySitesMapper; |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | - public List<ShySites> getBusiness (ShySites shySites ) { | 30 | + public List<ShySites> getBusiness(ShySites shySites) { |
| 31 | List<ShySites> sitesList = shySitesMapper.select(shySites); | 31 | List<ShySites> sitesList = shySitesMapper.select(shySites); |
| 32 | return sitesList; | 32 | return sitesList; |
| 33 | } | 33 | } |
| 34 | - public int impotComments(ShyComments shyComments){ | 34 | + |
| 35 | + public int impotComments(ShyComments shyComments) { | ||
| 35 | int result = shyCommentsMapper.insert(shyComments); | 36 | int result = shyCommentsMapper.insert(shyComments); |
| 36 | return result; | 37 | return result; |
| 37 | } | 38 | } |
| 38 | - public int updateComment(JSONObject json,Integer id,String auditor_id){ | ||
| 39 | - ShyComments shyComments = new ShyComments(); | ||
| 40 | - shyComments.setId(id); | 39 | + |
| 40 | + public int updateComment(JSONObject json, Integer id, String auditor_id) { | ||
| 41 | + ShyComments shyComments = shyCommentsMapper.selectByPrimaryKey(id); | ||
| 41 | shyComments.setAuditor_id(auditor_id); | 42 | shyComments.setAuditor_id(auditor_id); |
| 42 | - shyComments.setActivity_id(json.getString("activity_id")); | ||
| 43 | shyComments.setState(json.getInteger("state")); | 43 | shyComments.setState(json.getInteger("state")); |
| 44 | shyComments.setMsg(json.getString("msg")); | 44 | shyComments.setMsg(json.getString("msg")); |
| 45 | - int result = shyCommentsMapper.updateByPrimaryKeySelective(shyComments); | ||
| 46 | - return result; | 45 | + return shyCommentsMapper.updateByPrimaryKeySelective(shyComments); |
| 47 | } | 46 | } |
| 48 | - public PageInfo<ShyComments> getListComments(String activity_id,String content,Integer is_hot,String start_date,String end_date,Integer state,String auditor,Integer page,Integer pageSize,String orderByClause,Integer spid){ | 47 | + |
| 48 | + public PageInfo<ShyComments> getListComments(String activity_id, String content, Integer is_hot, String start_date, String end_date, Integer state, String auditor, Integer page, Integer pageSize, String orderByClause, Integer spid) { | ||
| 49 | Example example = new Example(ShyComments.class); | 49 | Example example = new Example(ShyComments.class); |
| 50 | Example.Criteria criteria = example.createCriteria(); | 50 | Example.Criteria criteria = example.createCriteria(); |
| 51 | if (CommonUtils.isNotEmpty(orderByClause)) { | 51 | if (CommonUtils.isNotEmpty(orderByClause)) { |
| 52 | example.setOrderByClause(orderByClause); | 52 | example.setOrderByClause(orderByClause); |
| 53 | } | 53 | } |
| 54 | - if (CommonUtils.isNotEmpty(start_date)&&CommonUtils.isNotEmpty(end_date)) { | ||
| 55 | - criteria.andGreaterThanOrEqualTo("comment_time",start_date); | ||
| 56 | - criteria.andLessThanOrEqualTo("comment_time",end_date); | 54 | + if (CommonUtils.isNotEmpty(start_date) && CommonUtils.isNotEmpty(end_date)) { |
| 55 | + criteria.andGreaterThanOrEqualTo("comment_time", start_date); | ||
| 56 | + criteria.andLessThanOrEqualTo("comment_time", end_date); | ||
| 57 | } | 57 | } |
| 58 | - if (CommonUtils.isNotEmpty(content)){ | 58 | + if (CommonUtils.isNotEmpty(content)) { |
| 59 | criteria.andLike("comment_content", "%" + content + "%"); | 59 | criteria.andLike("comment_content", "%" + content + "%"); |
| 60 | } | 60 | } |
| 61 | - if (CommonUtils.isNotEmpty(auditor)){ | ||
| 62 | - criteria.andEqualTo("auditor", auditor ); | 61 | + if (CommonUtils.isNotEmpty(auditor)) { |
| 62 | + criteria.andEqualTo("auditor", auditor); | ||
| 63 | } | 63 | } |
| 64 | - if (CommonUtils.isNotNull(spid)){ | ||
| 65 | - criteria.andEqualTo("spid", spid ); | 64 | + if (CommonUtils.isNotNull(spid)) { |
| 65 | + criteria.andEqualTo("spid", spid); | ||
| 66 | } | 66 | } |
| 67 | - if (CommonUtils.isNotNull(is_hot)){ | ||
| 68 | - criteria.andEqualTo("is_hot", is_hot ); | 67 | + if (CommonUtils.isNotNull(is_hot)) { |
| 68 | + criteria.andEqualTo("is_hot", is_hot); | ||
| 69 | } | 69 | } |
| 70 | - if (CommonUtils.isNotEmpty(activity_id)){ | 70 | + if (CommonUtils.isNotEmpty(activity_id)) { |
| 71 | criteria.andEqualTo("activity_id", activity_id); | 71 | criteria.andEqualTo("activity_id", activity_id); |
| 72 | } | 72 | } |
| 73 | //默认按上传时间倒序排序 | 73 | //默认按上传时间倒序排序 |
| @@ -78,7 +78,7 @@ public class CommentsServiceImpl { | @@ -78,7 +78,7 @@ public class CommentsServiceImpl { | ||
| 78 | return pageInfo; | 78 | return pageInfo; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | - public Object getDetailsComment(Integer id){ | 81 | + public Object getDetailsComment(Integer id) { |
| 82 | ShyComments comment = shyCommentsMapper.selectByPrimaryKey(id); | 82 | ShyComments comment = shyCommentsMapper.selectByPrimaryKey(id); |
| 83 | return comment; | 83 | return comment; |
| 84 | } | 84 | } |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| 1 | package com.cnlive.shenhe.serviceImpl; | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | + | ||
| 2 | import com.cnlive.shenhe.entity.ShySites; | 3 | import com.cnlive.shenhe.entity.ShySites; |
| 3 | import com.cnlive.shenhe.entity.ShyVideos; | 4 | import com.cnlive.shenhe.entity.ShyVideos; |
| 4 | import com.cnlive.shenhe.mapper.ShySitesMapper; | 5 | import com.cnlive.shenhe.mapper.ShySitesMapper; |
| @@ -10,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -10,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 11 | import tk.mybatis.mapper.entity.Example; | 12 | import tk.mybatis.mapper.entity.Example; |
| 12 | 13 | ||
| 13 | -import java.util.Date; | ||
| 14 | import java.util.List; | 14 | import java.util.List; |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| @@ -25,42 +25,42 @@ public class VideosServiceImpl { | @@ -25,42 +25,42 @@ public class VideosServiceImpl { | ||
| 25 | @Autowired | 25 | @Autowired |
| 26 | ShySitesMapper shySitesMapper; | 26 | ShySitesMapper shySitesMapper; |
| 27 | 27 | ||
| 28 | - public int impotVideo(ShyVideos shyVideos){ | 28 | + public int impotVideo(ShyVideos shyVideos) { |
| 29 | int result = shyVideosMapper.insert(shyVideos); | 29 | int result = shyVideosMapper.insert(shyVideos); |
| 30 | return result; | 30 | return result; |
| 31 | } | 31 | } |
| 32 | - public List<ShySites> getBusiness (ShySites shySites ){ | 32 | + |
| 33 | + public List<ShySites> getBusiness(ShySites shySites) { | ||
| 33 | List<ShySites> sitesList = shySitesMapper.select(shySites); | 34 | List<ShySites> sitesList = shySitesMapper.select(shySites); |
| 34 | return sitesList; | 35 | return sitesList; |
| 35 | } | 36 | } |
| 36 | - public int updateVideo(Integer id,String auditor_id,String activity_id,Integer state,String attr_tags,String msg){ | ||
| 37 | - ShyVideos shyVideos = new ShyVideos(); | ||
| 38 | - shyVideos.setId(id); | 37 | + |
| 38 | + public int updateVideo(Integer id, String auditor_id, Integer state, String attr_tags, String msg) { | ||
| 39 | + ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id); | ||
| 39 | shyVideos.setAuditor_id(auditor_id); | 40 | shyVideos.setAuditor_id(auditor_id); |
| 40 | - shyVideos.setVideo_id(activity_id); | ||
| 41 | shyVideos.setState(state); | 41 | shyVideos.setState(state); |
| 42 | shyVideos.setVideo_tags(attr_tags); | 42 | shyVideos.setVideo_tags(attr_tags); |
| 43 | shyVideos.setMsg(msg); | 43 | shyVideos.setMsg(msg); |
| 44 | - return shyVideosMapper.updateByPrimaryKeySelective(shyVideos); | 44 | + return shyVideosMapper.updateByPrimaryKeySelective(shyVideos); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | - public PageInfo<ShyVideos> getListContent(String video_title, String start_date,String end_date,Integer state, Integer page, Integer pageSize, String orderByClause, Integer spid){ | 47 | + public PageInfo<ShyVideos> getListContent(String video_title, String start_date, String end_date, Integer state, Integer page, Integer pageSize, String orderByClause, Integer spid) { |
| 48 | Example example = new Example(ShyVideos.class); | 48 | Example example = new Example(ShyVideos.class); |
| 49 | Example.Criteria criteria = example.createCriteria(); | 49 | Example.Criteria criteria = example.createCriteria(); |
| 50 | if (CommonUtils.isNotEmpty(orderByClause)) { | 50 | if (CommonUtils.isNotEmpty(orderByClause)) { |
| 51 | example.setOrderByClause(orderByClause); | 51 | example.setOrderByClause(orderByClause); |
| 52 | } | 52 | } |
| 53 | - if (CommonUtils.isNotEmpty(start_date)&&CommonUtils.isNotEmpty(end_date)) { | ||
| 54 | - criteria.andGreaterThanOrEqualTo("video_upload_time",start_date); | ||
| 55 | - criteria.andLessThanOrEqualTo("video_upload_time",end_date); | 53 | + if (CommonUtils.isNotEmpty(start_date) && CommonUtils.isNotEmpty(end_date)) { |
| 54 | + criteria.andGreaterThanOrEqualTo("video_upload_time", start_date); | ||
| 55 | + criteria.andLessThanOrEqualTo("video_upload_time", end_date); | ||
| 56 | } | 56 | } |
| 57 | - if (CommonUtils.isNotEmpty(video_title)){ | 57 | + if (CommonUtils.isNotEmpty(video_title)) { |
| 58 | criteria.andLike("video_title", "%" + video_title + "%"); | 58 | criteria.andLike("video_title", "%" + video_title + "%"); |
| 59 | } | 59 | } |
| 60 | - if (CommonUtils.isNotNull(state)){ | ||
| 61 | - criteria.andEqualTo("state", state ); | 60 | + if (CommonUtils.isNotNull(state)) { |
| 61 | + criteria.andEqualTo("state", state); | ||
| 62 | } | 62 | } |
| 63 | - if (CommonUtils.isNotNull(spid)){ | 63 | + if (CommonUtils.isNotNull(spid)) { |
| 64 | criteria.andEqualTo("spid", spid); | 64 | criteria.andEqualTo("spid", spid); |
| 65 | } | 65 | } |
| 66 | //默认按上传时间倒序排序 | 66 | //默认按上传时间倒序排序 |
| @@ -71,7 +71,7 @@ public class VideosServiceImpl { | @@ -71,7 +71,7 @@ public class VideosServiceImpl { | ||
| 71 | return pageInfo; | 71 | return pageInfo; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | - public Object getDetailsContent(Integer id){ | 74 | + public Object getDetailsContent(Integer id) { |
| 75 | ShyVideos DetailsshyVideos = shyVideosMapper.selectByPrimaryKey(id); | 75 | ShyVideos DetailsshyVideos = shyVideosMapper.selectByPrimaryKey(id); |
| 76 | return DetailsshyVideos; | 76 | return DetailsshyVideos; |
| 77 | } | 77 | } |
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
| 1 | package com.cnlive.shenhe.utils; | 1 | package com.cnlive.shenhe.utils; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import org.apache.http.entity.StringEntity; | ||
| 5 | import org.springframework.beans.factory.annotation.Value; | 4 | import org.springframework.beans.factory.annotation.Value; |
| 6 | import org.springframework.stereotype.Component; | 5 | import org.springframework.stereotype.Component; |
| 7 | 6 | ||
| @@ -35,7 +34,7 @@ public class AuditPass { | @@ -35,7 +34,7 @@ public class AuditPass { | ||
| 35 | * @param msg | 34 | * @param msg |
| 36 | * @return | 35 | * @return |
| 37 | */ | 36 | */ |
| 38 | - public String auditPass(String activity_id,int state,String attr_tags,String msg){ | 37 | + public JSONObject auditPass(String activity_id,int state,String attr_tags,String msg){ |
| 39 | String token = null; | 38 | String token = null; |
| 40 | try { | 39 | try { |
| 41 | token = CommonUtils.md5(url+platformKey+platformValue); | 40 | token = CommonUtils.md5(url+platformKey+platformValue); |
| @@ -53,13 +52,13 @@ public class AuditPass { | @@ -53,13 +52,13 @@ public class AuditPass { | ||
| 53 | String URL =url+"?platform="+platformKey+"&token="+token; | 52 | String URL =url+"?platform="+platformKey+"&token="+token; |
| 54 | httpUtil.setParamMap(params); | 53 | httpUtil.setParamMap(params); |
| 55 | Map<String, String> post = httpUtil.post(URL); | 54 | Map<String, String> post = httpUtil.post(URL); |
| 56 | - String code = post.get("code"); | ||
| 57 | - return code; | 55 | + return JSONObject.parseObject(post.get("result")); |
| 58 | } | 56 | } |
| 59 | 57 | ||
| 60 | - public void commentPass(JSONObject json){ | 58 | + public JSONObject commentPass(JSONObject json){ |
| 61 | HttpUtil httpUtil = HttpUtil.init(); | 59 | HttpUtil httpUtil = HttpUtil.init(); |
| 62 | httpUtil.setStringParam(json.toJSONString()); | 60 | httpUtil.setStringParam(json.toJSONString()); |
| 63 | - httpUtil.post(commentUrl); | 61 | + Map<String, String> post = httpUtil.post(commentUrl); |
| 62 | + return JSONObject.parseObject(post.get("result")); | ||
| 64 | } | 63 | } |
| 65 | } | 64 | } |
src/main/resources/templates/error.html renamed to src/main/resources/templates/page/error.html