Commit 4cfe447159b30ce67c8578c1ab963f941549ddcd
1 parent
0827e287
对外接口拆分
Showing
5 changed files
with
162 additions
and
127 deletions
src/main/java/com/cnlive/shenhe/api/CommentsControllerApi.java
0 → 100644
| 1 | +package com.cnlive.shenhe.api; | |
| 2 | +import com.alibaba.fastjson.JSONObject; | |
| 3 | +import com.cnlive.shenhe.bean.ErrorEnum; | |
| 4 | +import com.cnlive.shenhe.bean.ResponseBean; | |
| 5 | +import com.cnlive.shenhe.entity.ShyComments; | |
| 6 | +import com.cnlive.shenhe.entity.ShySites; | |
| 7 | +import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; | |
| 8 | +import com.cnlive.shenhe.utils.AuditPass; | |
| 9 | +import com.cnlive.shenhe.utils.CommonConst; | |
| 10 | +import com.cnlive.shenhe.utils.CommonUtils; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.stereotype.Controller; | |
| 13 | +import org.springframework.web.bind.annotation.PostMapping; | |
| 14 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 15 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 16 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 17 | +import java.util.Arrays; | |
| 18 | +import java.util.List; | |
| 19 | +@Controller | |
| 20 | +@RequestMapping("/commentsApi") | |
| 21 | +public class CommentsControllerApi { | |
| 22 | + | |
| 23 | + @Autowired | |
| 24 | + AuditPass Pass; | |
| 25 | + @Autowired | |
| 26 | + CommentsServiceImpl commentsService; | |
| 27 | + /** | |
| 28 | + * @Auther: chenhao | |
| 29 | + * @Date: 2018/12/6 11:17 | |
| 30 | + * @Description: 评论送审接口 | |
| 31 | + */ | |
| 32 | + @PostMapping("/import") | |
| 33 | + @ResponseBody | |
| 34 | + public ResponseBean impotComment(@RequestBody JSONObject json){ | |
| 35 | + ShyComments shyComments = new ShyComments(); | |
| 36 | + ShySites shySites = new ShySites(); | |
| 37 | + shyComments.setState(CommonConst.AUDIT_INTT); | |
| 38 | + //判断是否白名单 | |
| 39 | + shySites.setSpid(json.getInteger("spId")); | |
| 40 | + List<ShySites> shySitesList = commentsService.getBusiness(shySites); | |
| 41 | + if(!shySitesList.isEmpty()){ | |
| 42 | + if(CommonUtils.isNotEmpty(shySitesList.get(0).getWrite_business())){ | |
| 43 | + String write_business = shySitesList.get(0).getWrite_business(); | |
| 44 | + String[] business = write_business.split(","); | |
| 45 | + List<String> asList = Arrays.asList(business); | |
| 46 | + if(asList.contains(CommonConst.BUSINESS_COMMENT+"")){ | |
| 47 | + shyComments.setState(CommonConst.AUDIT_SUCCESS); | |
| 48 | + //封装json数据传参进行回调 | |
| 49 | + JSONObject json1 = new JSONObject(); | |
| 50 | + json1.put("activity_id",json.getString("activityId")); | |
| 51 | + json1.put("state",CommonConst.AUDIT_SUCCESS); | |
| 52 | + json1.put("attr_tags",""); | |
| 53 | + json1.put("msg",""); | |
| 54 | + Pass.commentPass(json1); | |
| 55 | + }else { | |
| 56 | + shyComments.setState(CommonConst.AUDIT_INTT); | |
| 57 | + } | |
| 58 | + } | |
| 59 | + } | |
| 60 | + //封装数据入库 | |
| 61 | + shyComments.setProgram_id(json.getInteger("programId")); | |
| 62 | + shyComments.setComment_original_url(json.getString("originalUrl")); | |
| 63 | + shyComments.setComment_title(json.getString("commentTitle")); | |
| 64 | + shyComments.setComment_user_id(json.getInteger("commentUserId")); | |
| 65 | + shyComments.setComment_user_name(json.getString("commentUserName")); | |
| 66 | + shyComments.setComment_user_avatar(json.getString("commentUserAvatar")); | |
| 67 | + shyComments.setComment_user_ip(json.getString("commentUserIP")); | |
| 68 | + shyComments.setComment_content(json.getString("commentContent")); | |
| 69 | + shyComments.setComment_time(json.getDate("commentTime")); | |
| 70 | + shyComments.setSpid(json.getInteger("spId")); | |
| 71 | + shyComments.setApp_id(json.getString("appId")); | |
| 72 | + shyComments.setPlatform(json.getString("platform")); | |
| 73 | + shyComments.setActivity_id(json.getString("activityId")); | |
| 74 | + shyComments.setIs_hot(json.getBoolean("priority")); | |
| 75 | + shyComments.setCallback(json.getString("callback")); | |
| 76 | + int i = commentsService.impotComments(shyComments); | |
| 77 | + if(i>0){ | |
| 78 | + return new ResponseBean(ErrorEnum.SUCCESS); | |
| 79 | + }else { | |
| 80 | + return new ResponseBean(ErrorEnum.ERROR); | |
| 81 | + } | |
| 82 | + } | |
| 83 | + | |
| 84 | +} | ... | ... |
src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
0 → 100644
| 1 | +package com.cnlive.shenhe.api; | |
| 2 | +import com.alibaba.fastjson.JSONObject; | |
| 3 | +import com.cnlive.shenhe.bean.ErrorEnum; | |
| 4 | +import com.cnlive.shenhe.bean.ResponseBean; | |
| 5 | +import com.cnlive.shenhe.entity.ShySites; | |
| 6 | +import com.cnlive.shenhe.entity.ShyVideos; | |
| 7 | +import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | |
| 8 | +import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; | |
| 9 | +import com.cnlive.shenhe.utils.AuditPass; | |
| 10 | +import com.cnlive.shenhe.utils.CommonConst; | |
| 11 | +import com.cnlive.shenhe.utils.CommonUtils; | |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 13 | +import org.springframework.stereotype.Controller; | |
| 14 | +import org.springframework.web.bind.annotation.*; | |
| 15 | +import java.util.Arrays; | |
| 16 | +import java.util.List; | |
| 17 | +/** | |
| 18 | + * @Auther: chenhao | |
| 19 | + * @Date: 2018/12/6 11:17 | |
| 20 | + * @Description: 视频送审接口 | |
| 21 | + */ | |
| 22 | +@Controller | |
| 23 | +@RequestMapping("/videosApi") | |
| 24 | +public class VideosControllerApi { | |
| 25 | + @Autowired | |
| 26 | + AuditPass Pass; | |
| 27 | + @Autowired | |
| 28 | + VideosServiceImpl videosService; | |
| 29 | + @Autowired | |
| 30 | + UsersServiceImpl usersService; | |
| 31 | + | |
| 32 | + | |
| 33 | + @PostMapping("/import") | |
| 34 | + @ResponseBody | |
| 35 | + public ResponseBean impotVideo(@RequestBody JSONObject json){ | |
| 36 | + ShySites shySites = new ShySites(); | |
| 37 | + ShyVideos shyVideos = new ShyVideos(); | |
| 38 | + shyVideos.setState(CommonConst.AUDIT_INTT); | |
| 39 | + //判断是否白名单 | |
| 40 | + shySites.setSpid(json.getInteger("spId")); | |
| 41 | + List<ShySites> shySitesList = videosService.getBusiness(shySites); | |
| 42 | + if(!shySitesList.isEmpty()){ | |
| 43 | + if(CommonUtils.isNotEmpty(shySitesList.get(0).getWrite_business())){ | |
| 44 | + String write_business = shySitesList.get(0).getWrite_business(); | |
| 45 | + String[] business = write_business.split(","); | |
| 46 | + List<String> asList = Arrays.asList(business); | |
| 47 | + if(asList.contains(CommonConst.BUSINESS_VIDEO+"")){ | |
| 48 | + shyVideos.setState(CommonConst.AUDIT_SUCCESS); | |
| 49 | + Pass.auditPass(json.getString("videoId"),CommonConst.AUDIT_SUCCESS,"",""); | |
| 50 | + }else { | |
| 51 | + shyVideos.setState(CommonConst.AUDIT_INTT); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + } | |
| 55 | + //封装数据入库 | |
| 56 | + shyVideos.setVideo_id(json.getString("videoId")); | |
| 57 | + shyVideos.setVideo_title(json.getString("videoTitle")); | |
| 58 | + shyVideos.setVideo_url(json.getString("videoUrl")); | |
| 59 | + shyVideos.setVideo_imgs(json.getString("videoCoverUrl")); | |
| 60 | + shyVideos.setVideo_desc(json.getString("videoIntro")); | |
| 61 | + shyVideos.setVideo_keyword(json.getString("videoKeyword")); | |
| 62 | + shyVideos.setVideo_priority(json.getString("priority")); | |
| 63 | + shyVideos.setCallback(json.getString("callback")); | |
| 64 | + shyVideos.setSpid(Integer.parseInt(json.getString("spId"))); | |
| 65 | + int i = videosService.impotVideo(shyVideos); | |
| 66 | + if(i>0){ | |
| 67 | + return new ResponseBean(ErrorEnum.SUCCESS); | |
| 68 | + }else { | |
| 69 | + return new ResponseBean(ErrorEnum.ERROR); | |
| 70 | + } | |
| 71 | + } | |
| 72 | +} | ... | ... |
src/main/java/com/cnlive/shenhe/controller/CommentsController.java
| ... | ... | @@ -4,11 +4,8 @@ import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 5 | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | 6 | import com.cnlive.shenhe.bean.SessionUser; |
| 7 | -import com.cnlive.shenhe.entity.ShyComments; | |
| 8 | -import com.cnlive.shenhe.entity.ShySites; | |
| 9 | 7 | import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; |
| 10 | 8 | import com.cnlive.shenhe.utils.AuditPass; |
| 11 | -import com.cnlive.shenhe.utils.CommonConst; | |
| 12 | 9 | import com.cnlive.shenhe.utils.CommonUtils; |
| 13 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | 11 | import org.springframework.stereotype.Controller; |
| ... | ... | @@ -16,16 +13,9 @@ import org.springframework.web.bind.annotation.PostMapping; |
| 16 | 13 | import org.springframework.web.bind.annotation.RequestBody; |
| 17 | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 18 | 15 | import org.springframework.web.bind.annotation.ResponseBody; |
| 19 | - | |
| 20 | 16 | import javax.servlet.http.HttpSession; |
| 21 | -import java.util.Arrays; | |
| 22 | -import java.util.List; | |
| 23 | 17 | |
| 24 | -/** | |
| 25 | - * @Auther: chenhao | |
| 26 | - * @Date: 2018/12/4 17:30 | |
| 27 | - * @Description:评论内容送审接口 | |
| 28 | - */ | |
| 18 | + | |
| 29 | 19 | @Controller |
| 30 | 20 | @RequestMapping("/comments") |
| 31 | 21 | public class CommentsController { |
| ... | ... | @@ -34,62 +24,7 @@ public class CommentsController { |
| 34 | 24 | @Autowired |
| 35 | 25 | CommentsServiceImpl commentsService; |
| 36 | 26 | |
| 37 | - /** | |
| 38 | - * 评论送审接口 | |
| 39 | - * @param json | |
| 40 | - * @return | |
| 41 | - */ | |
| 42 | - @PostMapping("/import") | |
| 43 | - @ResponseBody | |
| 44 | - public ResponseBean impotComment(@RequestBody JSONObject json){ | |
| 45 | - ShyComments shyComments = new ShyComments(); | |
| 46 | - ShySites shySites = new ShySites(); | |
| 47 | - shyComments.setState(CommonConst.AUDIT_INTT); | |
| 48 | - //判断是否白名单 | |
| 49 | - shySites.setSpid(json.getInteger("spId")); | |
| 50 | - List<ShySites> shySitesList = commentsService.getBusiness(shySites); | |
| 51 | - if(!shySitesList.isEmpty()){ | |
| 52 | - if(CommonUtils.isNotEmpty(shySitesList.get(0).getWrite_business())){ | |
| 53 | - String write_business = shySitesList.get(0).getWrite_business(); | |
| 54 | - String[] business = write_business.split(","); | |
| 55 | - List<String> asList = Arrays.asList(business); | |
| 56 | - if(asList.contains(CommonConst.BUSINESS_COMMENT+"")){ | |
| 57 | - shyComments.setState(CommonConst.AUDIT_SUCCESS); | |
| 58 | - //封装json数据传参进行回调 | |
| 59 | - JSONObject json1 = new JSONObject(); | |
| 60 | - json1.put("activity_id",json.getString("activityId")); | |
| 61 | - json1.put("state",CommonConst.AUDIT_SUCCESS); | |
| 62 | - json1.put("attr_tags",""); | |
| 63 | - json1.put("msg",""); | |
| 64 | - Pass.commentPass(json1); | |
| 65 | - }else { | |
| 66 | - shyComments.setState(CommonConst.AUDIT_INTT); | |
| 67 | - } | |
| 68 | - } | |
| 69 | - } | |
| 70 | - //封装数据入库 | |
| 71 | - shyComments.setProgram_id(json.getInteger("programId")); | |
| 72 | - shyComments.setComment_original_url(json.getString("originalUrl")); | |
| 73 | - shyComments.setComment_title(json.getString("commentTitle")); | |
| 74 | - shyComments.setComment_user_id(json.getInteger("commentUserId")); | |
| 75 | - shyComments.setComment_user_name(json.getString("commentUserName")); | |
| 76 | - shyComments.setComment_user_avatar(json.getString("commentUserAvatar")); | |
| 77 | - shyComments.setComment_user_ip(json.getString("commentUserIP")); | |
| 78 | - shyComments.setComment_content(json.getString("commentContent")); | |
| 79 | - shyComments.setComment_time(json.getDate("commentTime")); | |
| 80 | - shyComments.setSpid(json.getInteger("spId")); | |
| 81 | - shyComments.setApp_id(json.getString("appId")); | |
| 82 | - shyComments.setPlatform(json.getString("platform")); | |
| 83 | - shyComments.setActivity_id(json.getString("activityId")); | |
| 84 | - shyComments.setIs_hot(json.getBoolean("priority")); | |
| 85 | - shyComments.setCallback(json.getString("callback")); | |
| 86 | - int i = commentsService.impotComments(shyComments); | |
| 87 | - if(i>0){ | |
| 88 | - return new ResponseBean(ErrorEnum.SUCCESS); | |
| 89 | - }else { | |
| 90 | - return new ResponseBean(ErrorEnum.ERROR); | |
| 91 | - } | |
| 92 | - } | |
| 27 | + | |
| 93 | 28 | |
| 94 | 29 | /** |
| 95 | 30 | * 评论修改状态接口 |
| ... | ... | @@ -139,7 +74,7 @@ public class CommentsController { |
| 139 | 74 | * @param id |
| 140 | 75 | * @return |
| 141 | 76 | */ |
| 142 | - @RequestMapping("/Details") | |
| 77 | + @RequestMapping("/details") | |
| 143 | 78 | @ResponseBody |
| 144 | 79 | public Object getDetailsComments(Integer id){ |
| 145 | 80 | return commentsService.getDetailsComment(id); | ... | ... |
src/main/java/com/cnlive/shenhe/controller/VideosController.java
| 1 | 1 | package com.cnlive.shenhe.controller; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSONObject; | |
| 4 | 3 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 5 | 4 | import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | 5 | import com.cnlive.shenhe.bean.SessionUser; |
| 7 | -import com.cnlive.shenhe.entity.ShySites; | |
| 8 | -import com.cnlive.shenhe.entity.ShyVideos; | |
| 9 | 6 | import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; |
| 10 | 7 | import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; |
| 11 | 8 | import com.cnlive.shenhe.utils.AuditPass; |
| 12 | -import com.cnlive.shenhe.utils.CommonConst; | |
| 13 | 9 | import com.cnlive.shenhe.utils.CommonUtils; |
| 14 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 11 | import org.springframework.stereotype.Controller; |
| 16 | 12 | import org.springframework.web.bind.annotation.*; |
| 17 | - | |
| 18 | 13 | import javax.servlet.http.HttpSession; |
| 19 | -import java.util.Arrays; | |
| 20 | -import java.util.Date; | |
| 21 | -import java.util.List; | |
| 22 | 14 | |
| 23 | -/** | |
| 24 | - * @Auther: chenhao | |
| 25 | - * @Date: 2018/11/30 14:22 | |
| 26 | - * @Description:视频送审接口 | |
| 27 | - */ | |
| 28 | 15 | @Controller |
| 29 | 16 | @RequestMapping("/videos") |
| 30 | 17 | public class VideosController { |
| ... | ... | @@ -35,50 +22,7 @@ public class VideosController { |
| 35 | 22 | VideosServiceImpl videosService; |
| 36 | 23 | @Autowired |
| 37 | 24 | UsersServiceImpl usersService; |
| 38 | - /** | |
| 39 | - * 视频送审接口 | |
| 40 | - * @param json | |
| 41 | - * @return | |
| 42 | - */ | |
| 43 | - @PostMapping("/import") | |
| 44 | - @ResponseBody | |
| 45 | - public ResponseBean impotVideo(@RequestBody JSONObject json){ | |
| 46 | - ShySites shySites = new ShySites(); | |
| 47 | - ShyVideos shyVideos = new ShyVideos(); | |
| 48 | - shyVideos.setState(CommonConst.AUDIT_INTT); | |
| 49 | - //判断是否白名单 | |
| 50 | - shySites.setSpid(json.getInteger("spId")); | |
| 51 | - List<ShySites> shySitesList = videosService.getBusiness(shySites); | |
| 52 | - if(!shySitesList.isEmpty()){ | |
| 53 | - if(CommonUtils.isNotEmpty(shySitesList.get(0).getWrite_business())){ | |
| 54 | - String write_business = shySitesList.get(0).getWrite_business(); | |
| 55 | - String[] business = write_business.split(","); | |
| 56 | - List<String> asList = Arrays.asList(business); | |
| 57 | - if(asList.contains(CommonConst.BUSINESS_VIDEO+"")){ | |
| 58 | - shyVideos.setState(CommonConst.AUDIT_SUCCESS); | |
| 59 | - Pass.auditPass(json.getString("videoId"),CommonConst.AUDIT_SUCCESS,"",""); | |
| 60 | - }else { | |
| 61 | - shyVideos.setState(CommonConst.AUDIT_INTT); | |
| 62 | - } | |
| 63 | - } | |
| 64 | - } | |
| 65 | - //封装数据入库 | |
| 66 | - shyVideos.setVideo_id(json.getString("videoId")); | |
| 67 | - shyVideos.setVideo_title(json.getString("videoTitle")); | |
| 68 | - shyVideos.setVideo_url(json.getString("videoUrl")); | |
| 69 | - shyVideos.setVideo_imgs(json.getString("videoCoverUrl")); | |
| 70 | - shyVideos.setVideo_desc(json.getString("videoIntro")); | |
| 71 | - shyVideos.setVideo_keyword(json.getString("videoKeyword")); | |
| 72 | - shyVideos.setVideo_priority(json.getString("priority")); | |
| 73 | - shyVideos.setCallback(json.getString("callback")); | |
| 74 | - shyVideos.setSpid(Integer.parseInt(json.getString("spId"))); | |
| 75 | - int i = videosService.impotVideo(shyVideos); | |
| 76 | - if(i>0){ | |
| 77 | - return new ResponseBean(ErrorEnum.SUCCESS); | |
| 78 | - }else { | |
| 79 | - return new ResponseBean(ErrorEnum.ERROR); | |
| 80 | - } | |
| 81 | - } | |
| 25 | + | |
| 82 | 26 | |
| 83 | 27 | /** |
| 84 | 28 | * 审核信息返回接口 |
| ... | ... | @@ -90,7 +34,7 @@ public class VideosController { |
| 90 | 34 | */ |
| 91 | 35 | @RequestMapping("/shenheVideo") |
| 92 | 36 | @ResponseBody |
| 93 | - public ResponseBean shenheInfo(Integer id,String activity_id,int state,String attr_tags,String msg,HttpSession session){ | |
| 37 | + public ResponseBean shenheInfo(Integer id,String activity_id,Integer state,String attr_tags,String msg,HttpSession session){ | |
| 94 | 38 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 95 | 39 | String userId = sessionUser.getUserId(); |
| 96 | 40 | String code = Pass.auditPass(activity_id, state, attr_tags, msg); | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| ... | ... | @@ -33,7 +33,7 @@ public class VideosServiceImpl { |
| 33 | 33 | List<ShySites> sitesList = shySitesMapper.select(shySites); |
| 34 | 34 | return sitesList; |
| 35 | 35 | } |
| 36 | - public int updateVideo(Integer id,String auditor_id,String activity_id,int state,String attr_tags,String msg){ | |
| 36 | + public int updateVideo(Integer id,String auditor_id,String activity_id,Integer state,String attr_tags,String msg){ | |
| 37 | 37 | ShyVideos shyVideos = new ShyVideos(); |
| 38 | 38 | shyVideos.setId(id); |
| 39 | 39 | shyVideos.setAuditor_id(auditor_id); | ... | ... |