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 | 63 | Map<String,String> initParameters = new HashMap<String, String>(); |
| 64 | 64 | initParameters.put("casServerLoginUrl", CAS_SERVER_LOGIN_URL); |
| 65 | 65 | initParameters.put("service", SERVICE_LOGIN); |
| 66 | + initParameters.put("ignorePattern", "/api/*"); | |
| 66 | 67 | registration.setInitParameters(initParameters); |
| 67 | 68 | // 设定加载的顺序 |
| 68 | 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 | 17 | import java.util.Arrays; |
| 18 | 18 | import java.util.List; |
| 19 | 19 | @Controller |
| 20 | -@RequestMapping("/commentsApi") | |
| 20 | +@RequestMapping("/api/comments") | |
| 21 | 21 | public class CommentsControllerApi { |
| 22 | 22 | |
| 23 | 23 | @Autowired |
| ... | ... | @@ -51,7 +51,11 @@ public class CommentsControllerApi { |
| 51 | 51 | json1.put("state",CommonConst.AUDIT_SUCCESS); |
| 52 | 52 | json1.put("attr_tags",""); |
| 53 | 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 | 59 | }else { |
| 56 | 60 | shyComments.setState(CommonConst.AUDIT_INTT); |
| 57 | 61 | } | ... | ... |
src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
| 1 | 1 | package com.cnlive.shenhe.api; |
| 2 | + | |
| 2 | 3 | import com.alibaba.fastjson.JSONObject; |
| 3 | 4 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 4 | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| ... | ... | @@ -11,16 +12,21 @@ import com.cnlive.shenhe.utils.CommonConst; |
| 11 | 12 | import com.cnlive.shenhe.utils.CommonUtils; |
| 12 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | 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 | 20 | import java.util.Arrays; |
| 16 | 21 | import java.util.List; |
| 22 | + | |
| 17 | 23 | /** |
| 18 | 24 | * @Auther: chenhao |
| 19 | 25 | * @Date: 2018/12/6 11:17 |
| 20 | 26 | * @Description: 视频送审接口 |
| 21 | 27 | */ |
| 22 | 28 | @Controller |
| 23 | -@RequestMapping("/videosApi") | |
| 29 | +@RequestMapping("/api/videos") | |
| 24 | 30 | public class VideosControllerApi { |
| 25 | 31 | @Autowired |
| 26 | 32 | AuditPass Pass; |
| ... | ... | @@ -29,25 +35,28 @@ public class VideosControllerApi { |
| 29 | 35 | @Autowired |
| 30 | 36 | UsersServiceImpl usersService; |
| 31 | 37 | |
| 32 | - | |
| 33 | 38 | @PostMapping("/import") |
| 34 | 39 | @ResponseBody |
| 35 | - public ResponseBean impotVideo(@RequestBody JSONObject json){ | |
| 40 | + public ResponseBean impotVideo(@RequestBody JSONObject json) { | |
| 36 | 41 | ShySites shySites = new ShySites(); |
| 37 | 42 | ShyVideos shyVideos = new ShyVideos(); |
| 38 | 43 | shyVideos.setState(CommonConst.AUDIT_INTT); |
| 39 | 44 | //判断是否白名单 |
| 40 | 45 | shySites.setSpid(json.getInteger("spId")); |
| 41 | 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 | 49 | String write_business = shySitesList.get(0).getWrite_business(); |
| 45 | 50 | String[] business = write_business.split(","); |
| 46 | 51 | List<String> asList = Arrays.asList(business); |
| 47 | - if(asList.contains(CommonConst.BUSINESS_VIDEO+"")){ | |
| 52 | + if (asList.contains(CommonConst.BUSINESS_VIDEO + "")) { | |
| 48 | 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 | 60 | shyVideos.setState(CommonConst.AUDIT_INTT); |
| 52 | 61 | } |
| 53 | 62 | } |
| ... | ... | @@ -63,10 +72,10 @@ public class VideosControllerApi { |
| 63 | 72 | shyVideos.setCallback(json.getString("callback")); |
| 64 | 73 | shyVideos.setSpid(Integer.parseInt(json.getString("spId"))); |
| 65 | 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 | 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 | 4 | public enum ErrorEnum { |
| 11 | 5 | |
| 12 | 6 | SUCCESS(0, "success"), |
| 13 | 7 | ERROR(500, "服务异常"), |
| 14 | 8 | RECORD_NOT_EXIST(10001, "记录不存在"), |
| 15 | 9 | PARAM_ERROR(10002, "参数错误"), |
| 16 | - | |
| 17 | - | |
| 18 | 10 | NOT_LOGIN(4000, "登录失效或未登录"), |
| 19 | 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 | 13 | import org.springframework.web.bind.annotation.RequestBody; |
| 14 | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 15 | 15 | import org.springframework.web.bind.annotation.ResponseBody; |
| 16 | + | |
| 16 | 17 | import javax.servlet.http.HttpSession; |
| 17 | 18 | |
| 18 | 19 | |
| ... | ... | @@ -24,29 +25,33 @@ public class CommentsController { |
| 24 | 25 | @Autowired |
| 25 | 26 | CommentsServiceImpl commentsService; |
| 26 | 27 | |
| 27 | - | |
| 28 | - | |
| 29 | 28 | /** |
| 30 | 29 | * 评论修改状态接口 |
| 30 | + * | |
| 31 | 31 | * @param json |
| 32 | 32 | * @return |
| 33 | 33 | */ |
| 34 | 34 | @PostMapping("/shenheComment") |
| 35 | 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 | 42 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 39 | 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 | 48 | return new ResponseBean(ErrorEnum.SUCCESS); |
| 45 | 49 | } |
| 46 | 50 | } |
| 47 | 51 | |
| 48 | 52 | /** |
| 49 | 53 | * 评论列表页 |
| 54 | + * | |
| 50 | 55 | * @param activity_id |
| 51 | 56 | * @param content |
| 52 | 57 | * @param is_hot |
| ... | ... | @@ -61,22 +66,23 @@ public class CommentsController { |
| 61 | 66 | */ |
| 62 | 67 | @RequestMapping("/page") |
| 63 | 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 | 70 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 66 | 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 | 80 | * @param id |
| 75 | 81 | * @return |
| 76 | 82 | */ |
| 77 | 83 | @RequestMapping("/details") |
| 78 | 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
src/main/java/com/cnlive/shenhe/controller/VideosController.java
| 1 | 1 | package com.cnlive.shenhe.controller; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSONObject; | |
| 3 | 4 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 4 | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| 5 | 6 | import com.cnlive.shenhe.bean.SessionUser; |
| ... | ... | @@ -9,7 +10,9 @@ import com.cnlive.shenhe.utils.AuditPass; |
| 9 | 10 | import com.cnlive.shenhe.utils.CommonUtils; |
| 10 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 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 | 16 | import javax.servlet.http.HttpSession; |
| 14 | 17 | |
| 15 | 18 | @Controller |
| ... | ... | @@ -26,30 +29,33 @@ public class VideosController { |
| 26 | 29 | |
| 27 | 30 | /** |
| 28 | 31 | * 审核信息返回接口 |
| 32 | + * | |
| 29 | 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 | 37 | * @return |
| 34 | 38 | */ |
| 35 | 39 | @RequestMapping("/shenheVideo") |
| 36 | 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 | 42 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 39 | 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 | 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 | 59 | * @param video_title |
| 54 | 60 | * @param start_date |
| 55 | 61 | * @param end_date |
| ... | ... | @@ -61,26 +67,28 @@ public class VideosController { |
| 61 | 67 | */ |
| 62 | 68 | @RequestMapping("/page") |
| 63 | 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 | 71 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 66 | 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 | 84 | * @param id |
| 76 | 85 | * @return |
| 77 | 86 | */ |
| 78 | 87 | @RequestMapping("/details") |
| 79 | 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 | 22 | @Service |
| 23 | 23 | public class CommentsServiceImpl { |
| 24 | 24 | @Autowired |
| 25 | - ShyCommentsMapper shyCommentsMapper ; | |
| 25 | + ShyCommentsMapper shyCommentsMapper; | |
| 26 | 26 | @Autowired |
| 27 | 27 | ShySitesMapper shySitesMapper; |
| 28 | 28 | |
| 29 | 29 | |
| 30 | - public List<ShySites> getBusiness (ShySites shySites ) { | |
| 30 | + public List<ShySites> getBusiness(ShySites shySites) { | |
| 31 | 31 | List<ShySites> sitesList = shySitesMapper.select(shySites); |
| 32 | 32 | return sitesList; |
| 33 | 33 | } |
| 34 | - public int impotComments(ShyComments shyComments){ | |
| 34 | + | |
| 35 | + public int impotComments(ShyComments shyComments) { | |
| 35 | 36 | int result = shyCommentsMapper.insert(shyComments); |
| 36 | 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 | 42 | shyComments.setAuditor_id(auditor_id); |
| 42 | - shyComments.setActivity_id(json.getString("activity_id")); | |
| 43 | 43 | shyComments.setState(json.getInteger("state")); |
| 44 | 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 | 49 | Example example = new Example(ShyComments.class); |
| 50 | 50 | Example.Criteria criteria = example.createCriteria(); |
| 51 | 51 | if (CommonUtils.isNotEmpty(orderByClause)) { |
| 52 | 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 | 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 | 71 | criteria.andEqualTo("activity_id", activity_id); |
| 72 | 72 | } |
| 73 | 73 | //默认按上传时间倒序排序 |
| ... | ... | @@ -78,7 +78,7 @@ public class CommentsServiceImpl { |
| 78 | 78 | return pageInfo; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public Object getDetailsComment(Integer id){ | |
| 81 | + public Object getDetailsComment(Integer id) { | |
| 82 | 82 | ShyComments comment = shyCommentsMapper.selectByPrimaryKey(id); |
| 83 | 83 | return comment; |
| 84 | 84 | } | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | + | |
| 2 | 3 | import com.cnlive.shenhe.entity.ShySites; |
| 3 | 4 | import com.cnlive.shenhe.entity.ShyVideos; |
| 4 | 5 | import com.cnlive.shenhe.mapper.ShySitesMapper; |
| ... | ... | @@ -10,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 11 | import org.springframework.stereotype.Service; |
| 11 | 12 | import tk.mybatis.mapper.entity.Example; |
| 12 | 13 | |
| 13 | -import java.util.Date; | |
| 14 | 14 | import java.util.List; |
| 15 | 15 | |
| 16 | 16 | /** |
| ... | ... | @@ -25,42 +25,42 @@ public class VideosServiceImpl { |
| 25 | 25 | @Autowired |
| 26 | 26 | ShySitesMapper shySitesMapper; |
| 27 | 27 | |
| 28 | - public int impotVideo(ShyVideos shyVideos){ | |
| 28 | + public int impotVideo(ShyVideos shyVideos) { | |
| 29 | 29 | int result = shyVideosMapper.insert(shyVideos); |
| 30 | 30 | return result; |
| 31 | 31 | } |
| 32 | - public List<ShySites> getBusiness (ShySites shySites ){ | |
| 32 | + | |
| 33 | + public List<ShySites> getBusiness(ShySites shySites) { | |
| 33 | 34 | List<ShySites> sitesList = shySitesMapper.select(shySites); |
| 34 | 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 | 40 | shyVideos.setAuditor_id(auditor_id); |
| 40 | - shyVideos.setVideo_id(activity_id); | |
| 41 | 41 | shyVideos.setState(state); |
| 42 | 42 | shyVideos.setVideo_tags(attr_tags); |
| 43 | 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 | 48 | Example example = new Example(ShyVideos.class); |
| 49 | 49 | Example.Criteria criteria = example.createCriteria(); |
| 50 | 50 | if (CommonUtils.isNotEmpty(orderByClause)) { |
| 51 | 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 | 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 | 64 | criteria.andEqualTo("spid", spid); |
| 65 | 65 | } |
| 66 | 66 | //默认按上传时间倒序排序 |
| ... | ... | @@ -71,7 +71,7 @@ public class VideosServiceImpl { |
| 71 | 71 | return pageInfo; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public Object getDetailsContent(Integer id){ | |
| 74 | + public Object getDetailsContent(Integer id) { | |
| 75 | 75 | ShyVideos DetailsshyVideos = shyVideosMapper.selectByPrimaryKey(id); |
| 76 | 76 | return DetailsshyVideos; |
| 77 | 77 | } | ... | ... |
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
| 1 | 1 | package com.cnlive.shenhe.utils; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import org.apache.http.entity.StringEntity; | |
| 5 | 4 | import org.springframework.beans.factory.annotation.Value; |
| 6 | 5 | import org.springframework.stereotype.Component; |
| 7 | 6 | |
| ... | ... | @@ -35,7 +34,7 @@ public class AuditPass { |
| 35 | 34 | * @param msg |
| 36 | 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 | 38 | String token = null; |
| 40 | 39 | try { |
| 41 | 40 | token = CommonUtils.md5(url+platformKey+platformValue); |
| ... | ... | @@ -53,13 +52,13 @@ public class AuditPass { |
| 53 | 52 | String URL =url+"?platform="+platformKey+"&token="+token; |
| 54 | 53 | httpUtil.setParamMap(params); |
| 55 | 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 | 59 | HttpUtil httpUtil = HttpUtil.init(); |
| 62 | 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