Commit 989bae5890a8b199423c805062ca30c7d6df06c1
1 parent
3d5a1343
更改接口逻辑,评论审核定时任务
Showing
6 changed files
with
203 additions
and
85 deletions
src/main/java/com/cnlive/shenhe/api/CommentsControllerApi.java
| @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
| 18 | import org.springframework.web.bind.annotation.ResponseBody; | 18 | import org.springframework.web.bind.annotation.ResponseBody; |
| 19 | 19 | ||
| 20 | import java.sql.Timestamp; | 20 | import java.sql.Timestamp; |
| 21 | +import java.time.Year; | ||
| 21 | import java.util.Arrays; | 22 | import java.util.Arrays; |
| 22 | import java.util.Date; | 23 | import java.util.Date; |
| 23 | import java.util.List; | 24 | import java.util.List; |
| @@ -41,43 +42,43 @@ public class CommentsControllerApi { | @@ -41,43 +42,43 @@ public class CommentsControllerApi { | ||
| 41 | public ResponseBean impotComment(String param) { | 42 | public ResponseBean impotComment(String param) { |
| 42 | logger.info("评论入库,param=====" + param); | 43 | logger.info("评论入库,param=====" + param); |
| 43 | JSONObject json = JSONObject.parseObject(param); | 44 | JSONObject json = JSONObject.parseObject(param); |
| 45 | + //判断是否存在 | ||
| 44 | ShyComments shyComments = new ShyComments(); | 46 | ShyComments shyComments = new ShyComments(); |
| 45 | - ShySites shySites = new ShySites(); | ||
| 46 | - String callback = json.getString("callback"); | ||
| 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", 3); | ||
| 62 | - json1.put("attr_tags", ""); | ||
| 63 | - json1.put("msg", ""); | ||
| 64 | - JSONObject result = new JSONObject(); | ||
| 65 | - try { | ||
| 66 | - result = Pass.commentPass(json1, callback); | ||
| 67 | - } catch (Exception e) { | ||
| 68 | - logger.error("评论回调失败,activity_id:{}", json.getString("activityId")); | ||
| 69 | - return new ResponseBean(ErrorEnum.BACK_ERROR); | ||
| 70 | - } | ||
| 71 | - Integer code = result.getInteger("errorCode"); | ||
| 72 | - if (code != 0) { | ||
| 73 | - logger.error("评论回调错误,activity_id:{},code:{},errorMessage:{}", json.getString("activityId"), code, result.getString("errorMessage")); | ||
| 74 | - return new ResponseBean(code, result.getString("errorMessage")); | ||
| 75 | - } | ||
| 76 | - shyComments.setState(CommonConst.AUDIT_SUCCESS); | ||
| 77 | - } | 47 | + shyComments.setActivity_id(json.getString("activityId")); |
| 48 | + List<ShyComments> commentsList = commentsService.findshyComments(shyComments); | ||
| 49 | + //存在则更新 | ||
| 50 | + if (commentsList.size() > 0) { | ||
| 51 | + ShyComments shyComments1 = commentsList.get(0); | ||
| 52 | + shyComments1.setState(CommonConst.AUDIT_INTT); | ||
| 53 | + shyComments1.setProgram_id(json.getString("programId")); | ||
| 54 | + shyComments1.setComment_original_url(json.getString("originalUrl")); | ||
| 55 | + shyComments1.setComment_title(json.getString("commentTitle")); | ||
| 56 | + shyComments1.setComment_user_id(json.getInteger("commentUserId")); | ||
| 57 | + shyComments1.setComment_user_name(json.getString("commentUserName")); | ||
| 58 | + shyComments1.setComment_user_avatar(json.getString("commentUserAvatar")); | ||
| 59 | + shyComments1.setComment_user_ip(json.getString("commentUserIP")); | ||
| 60 | + shyComments1.setComment_content(json.getString("commentContent")); | ||
| 61 | + String commentTime = json.getString("commentTime"); | ||
| 62 | + if (CommonUtils.isNotEmpty(commentTime)) { | ||
| 63 | + Date timestamp = CommonUtils.getTimestamp(commentTime, "yyyy-MM-dd hh:mm"); | ||
| 64 | + shyComments1.setComment_time(timestamp); | ||
| 65 | + | ||
| 66 | + } | ||
| 67 | + shyComments1.setSpid(json.getInteger("spId")); | ||
| 68 | + shyComments1.setApp_id(json.getString("appId")); | ||
| 69 | + shyComments1.setPlatform(json.getString("platform")); | ||
| 70 | + shyComments1.setActivity_id(json.getString("activityId")); | ||
| 71 | + shyComments1.setIs_hot(json.getBoolean("priority")); | ||
| 72 | + shyComments1.setCallback(json.getString("callback")); | ||
| 73 | + boolean YorN = commentsService.updateshyComments1(shyComments1); | ||
| 74 | + if (YorN == true) { | ||
| 75 | + return new ResponseBean(ErrorEnum.SUCCESS); | ||
| 76 | + } else { | ||
| 77 | + return new ResponseBean(ErrorEnum.ERROR); | ||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | - //封装数据入库 | 80 | + //如果不存在直接插入 |
| 81 | + shyComments.setState(CommonConst.AUDIT_INTT); | ||
| 81 | shyComments.setProgram_id(json.getString("programId")); | 82 | shyComments.setProgram_id(json.getString("programId")); |
| 82 | shyComments.setComment_original_url(json.getString("originalUrl")); | 83 | shyComments.setComment_original_url(json.getString("originalUrl")); |
| 83 | shyComments.setComment_title(json.getString("commentTitle")); | 84 | shyComments.setComment_title(json.getString("commentTitle")); |
| @@ -87,19 +88,18 @@ public class CommentsControllerApi { | @@ -87,19 +88,18 @@ public class CommentsControllerApi { | ||
| 87 | shyComments.setComment_user_ip(json.getString("commentUserIP")); | 88 | shyComments.setComment_user_ip(json.getString("commentUserIP")); |
| 88 | shyComments.setComment_content(json.getString("commentContent")); | 89 | shyComments.setComment_content(json.getString("commentContent")); |
| 89 | String commentTime = json.getString("commentTime"); | 90 | String commentTime = json.getString("commentTime"); |
| 90 | - if(CommonUtils.isNotEmpty(commentTime)){ | 91 | + if (CommonUtils.isNotEmpty(commentTime)) { |
| 91 | Date timestamp = CommonUtils.getTimestamp(commentTime, "yyyy-MM-dd hh:mm"); | 92 | Date timestamp = CommonUtils.getTimestamp(commentTime, "yyyy-MM-dd hh:mm"); |
| 92 | shyComments.setComment_time(timestamp); | 93 | shyComments.setComment_time(timestamp); |
| 93 | - | ||
| 94 | } | 94 | } |
| 95 | shyComments.setSpid(json.getInteger("spId")); | 95 | shyComments.setSpid(json.getInteger("spId")); |
| 96 | shyComments.setApp_id(json.getString("appId")); | 96 | shyComments.setApp_id(json.getString("appId")); |
| 97 | shyComments.setPlatform(json.getString("platform")); | 97 | shyComments.setPlatform(json.getString("platform")); |
| 98 | shyComments.setActivity_id(json.getString("activityId")); | 98 | shyComments.setActivity_id(json.getString("activityId")); |
| 99 | shyComments.setIs_hot(json.getBoolean("priority")); | 99 | shyComments.setIs_hot(json.getBoolean("priority")); |
| 100 | - shyComments.setCallback(callback); | ||
| 101 | - int i = commentsService.impotComments(shyComments); | ||
| 102 | - if (i > 0) { | 100 | + shyComments.setCallback(json.getString("callback")); |
| 101 | + boolean YorN = commentsService.impotComments(shyComments); | ||
| 102 | + if (YorN == true) { | ||
| 103 | return new ResponseBean(ErrorEnum.SUCCESS); | 103 | return new ResponseBean(ErrorEnum.SUCCESS); |
| 104 | } else { | 104 | } else { |
| 105 | return new ResponseBean(ErrorEnum.ERROR); | 105 | return new ResponseBean(ErrorEnum.ERROR); |
src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
| @@ -36,60 +36,65 @@ public class VideosControllerApi { | @@ -36,60 +36,65 @@ public class VideosControllerApi { | ||
| 36 | VideosServiceImpl videosService; | 36 | VideosServiceImpl videosService; |
| 37 | @Autowired | 37 | @Autowired |
| 38 | UsersServiceImpl usersService; | 38 | UsersServiceImpl usersService; |
| 39 | - | 39 | + //先统一入库,入库时查询是否已有,有,更新 无,插入 白名单单独定时任务 |
| 40 | @PostMapping("/import") | 40 | @PostMapping("/import") |
| 41 | @ResponseBody | 41 | @ResponseBody |
| 42 | public ResponseBean impotVideo(String param) { | 42 | public ResponseBean impotVideo(String param) { |
| 43 | logger.info("点播入库,param=====" + param); | 43 | logger.info("点播入库,param=====" + param); |
| 44 | JSONObject json = JSONObject.parseObject(param); | 44 | JSONObject json = JSONObject.parseObject(param); |
| 45 | - ShySites shySites = new ShySites(); | ||
| 46 | - ShyVideos shyVideos = new ShyVideos(); | ||
| 47 | - shyVideos.setState(CommonConst.AUDIT_INTT); | ||
| 48 | - //判断是否白名单 | ||
| 49 | - shySites.setSpid(json.getInteger("spId")); | ||
| 50 | - List<ShySites> shySitesList = videosService.getBusiness(shySites); | 45 | + ShyVideos shyVideos1 = new ShyVideos(); |
| 46 | + //g得到视频id去查询是否已有 | ||
| 51 | String videoId = json.getString("videoId"); | 47 | String videoId = json.getString("videoId"); |
| 52 | - String callback = json.getString("callback"); | ||
| 53 | - if (!shySitesList.isEmpty()) { | ||
| 54 | - if (CommonUtils.isNotEmpty(shySitesList.get(0).getWrite_business())) { | ||
| 55 | - String write_business = shySitesList.get(0).getWrite_business(); | ||
| 56 | - String[] business = write_business.split(","); | ||
| 57 | - List<String> asList = Arrays.asList(business); | ||
| 58 | - if (asList.contains(CommonConst.BUSINESS_VIDEO + "")) { | ||
| 59 | - logger.info("白名单回调通过:videoId===" + videoId); | ||
| 60 | - JSONObject result = new JSONObject(); | ||
| 61 | - try { | ||
| 62 | - result = Pass.auditPass(videoId, 3, "", "", callback); | ||
| 63 | - } catch (Exception e) { | ||
| 64 | - logger.error("点播回调失败,videoId:{}", videoId); | ||
| 65 | - return new ResponseBean(ErrorEnum.BACK_ERROR); | ||
| 66 | - } | ||
| 67 | - Integer code = result.getInteger("code"); | ||
| 68 | - if (code != 0) { | ||
| 69 | - logger.error("点播回调错误,videoId:{},code:{},msg:{}", videoId, code, result.getString("msg")); | ||
| 70 | - return new ResponseBean(code, result.getString("msg")); | ||
| 71 | - } | ||
| 72 | - shyVideos.setState(CommonConst.AUDIT_SUCCESS); | ||
| 73 | - } | 48 | + shyVideos1.setVideo_id(videoId); |
| 49 | + //查询一下 存在,更新 没有,插入 | ||
| 50 | + List<ShyVideos> listshyVideos = videosService.findshyVideo(shyVideos1); | ||
| 51 | + if(listshyVideos.size()>0){ | ||
| 52 | + ShyVideos shyVideos = listshyVideos.get(0); | ||
| 53 | + //封装数据入库 | ||
| 54 | + shyVideos.setVideo_id(videoId); | ||
| 55 | + shyVideos.setVideo_title(json.getString("videoTitle")); | ||
| 56 | + shyVideos.setVideo_url(json.getString("videoUrl")); | ||
| 57 | + String videoCoverUrl = json.getString("videoCoverUrl"); | ||
| 58 | + shyVideos.setVideo_imgs(videoCoverUrl); | ||
| 59 | + if (CommonUtils.isNotEmpty(videoCoverUrl)) { | ||
| 60 | + String poster = json.getJSONObject("videoCoverUrl").getString("224*126"); | ||
| 61 | + shyVideos.setVideo_poster(poster); | ||
| 62 | + } | ||
| 63 | + shyVideos.setVideo_desc(json.getString("videoIntro")); | ||
| 64 | + shyVideos.setVideo_tags(json.getString("videoTag")); | ||
| 65 | + shyVideos.setVideo_keyword(json.getString("videoKeyword")); | ||
| 66 | + shyVideos.setVideo_upload_time(json.getDate(" uploadTime")); | ||
| 67 | + shyVideos.setVideo_priority(json.getString("priority")); | ||
| 68 | + shyVideos.setCallback(json.getString("callback")); | ||
| 69 | + shyVideos.setSpid(Integer.parseInt(json.getString("spId"))); | ||
| 70 | + shyVideos.setState(CommonConst.AUDIT_INTT); | ||
| 71 | + boolean YorN = videosService.updateshyVideos(shyVideos); | ||
| 72 | + if(YorN == true){ | ||
| 73 | + return new ResponseBean(ErrorEnum.SUCCESS); | ||
| 74 | + }else { | ||
| 75 | + return new ResponseBean(ErrorEnum.ERROR); | ||
| 74 | } | 76 | } |
| 75 | } | 77 | } |
| 76 | - //封装数据入库 | ||
| 77 | - shyVideos.setVideo_id(videoId); | ||
| 78 | - shyVideos.setVideo_title(json.getString("videoTitle")); | ||
| 79 | - shyVideos.setVideo_url(json.getString("videoUrl")); | 78 | + //查了,没有,直接插入数据库 |
| 79 | + shyVideos1.setVideo_id(videoId); | ||
| 80 | + shyVideos1.setVideo_title(json.getString("videoTitle")); | ||
| 81 | + shyVideos1.setVideo_url(json.getString("videoUrl")); | ||
| 80 | String videoCoverUrl = json.getString("videoCoverUrl"); | 82 | String videoCoverUrl = json.getString("videoCoverUrl"); |
| 81 | - shyVideos.setVideo_imgs(videoCoverUrl); | 83 | + shyVideos1.setVideo_imgs(videoCoverUrl); |
| 82 | if (CommonUtils.isNotEmpty(videoCoverUrl)) { | 84 | if (CommonUtils.isNotEmpty(videoCoverUrl)) { |
| 83 | String poster = json.getJSONObject("videoCoverUrl").getString("224*126"); | 85 | String poster = json.getJSONObject("videoCoverUrl").getString("224*126"); |
| 84 | - shyVideos.setVideo_poster(poster); | 86 | + shyVideos1.setVideo_poster(poster); |
| 85 | } | 87 | } |
| 86 | - shyVideos.setVideo_desc(json.getString("videoIntro")); | ||
| 87 | - shyVideos.setVideo_keyword(json.getString("videoKeyword")); | ||
| 88 | - shyVideos.setVideo_priority(json.getString("priority")); | ||
| 89 | - shyVideos.setCallback(callback); | ||
| 90 | - shyVideos.setSpid(Integer.parseInt(json.getString("spId"))); | ||
| 91 | - int i = videosService.impotVideo(shyVideos); | ||
| 92 | - if (i > 0) { | 88 | + shyVideos1.setVideo_desc(json.getString("videoIntro")); |
| 89 | + shyVideos1.setVideo_tags(json.getString("videoTag")); | ||
| 90 | + shyVideos1.setVideo_keyword(json.getString("videoKeyword")); | ||
| 91 | + shyVideos1.setVideo_upload_time(json.getDate("uploadTime")); | ||
| 92 | + shyVideos1.setVideo_priority(json.getString("priority")); | ||
| 93 | + shyVideos1.setCallback(json.getString("callback")); | ||
| 94 | + shyVideos1.setSpid(Integer.parseInt(json.getString("spId"))); | ||
| 95 | + shyVideos1.setState(CommonConst.AUDIT_INTT); | ||
| 96 | + boolean result = videosService.impotVideo(shyVideos1); | ||
| 97 | + if (result == true) { | ||
| 93 | return new ResponseBean(ErrorEnum.SUCCESS); | 98 | return new ResponseBean(ErrorEnum.SUCCESS); |
| 94 | } else { | 99 | } else { |
| 95 | return new ResponseBean(ErrorEnum.ERROR); | 100 | return new ResponseBean(ErrorEnum.ERROR); |
src/main/java/com/cnlive/shenhe/job/CommentsJob.java
0 → 100644
| 1 | +package com.cnlive.shenhe.job; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.cnlive.shenhe.bean.ErrorEnum; | ||
| 5 | +import com.cnlive.shenhe.bean.ResponseBean; | ||
| 6 | +import com.cnlive.shenhe.entity.ShyComments; | ||
| 7 | +import com.cnlive.shenhe.entity.ShySites; | ||
| 8 | +import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; | ||
| 9 | +import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; | ||
| 10 | +import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | ||
| 11 | +import com.cnlive.shenhe.utils.AuditPass; | ||
| 12 | +import com.cnlive.shenhe.utils.CommonConst; | ||
| 13 | +import com.cnlive.shenhe.utils.CommonUtils; | ||
| 14 | +import org.slf4j.Logger; | ||
| 15 | +import org.slf4j.LoggerFactory; | ||
| 16 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 17 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 18 | +import org.springframework.stereotype.Component; | ||
| 19 | + | ||
| 20 | +import java.util.ArrayList; | ||
| 21 | +import java.util.Arrays; | ||
| 22 | +import java.util.List; | ||
| 23 | + | ||
| 24 | +@Component | ||
| 25 | +public class CommentsJob { | ||
| 26 | + private static Logger logger = LoggerFactory.getLogger(CommentsJob.class); | ||
| 27 | + @Autowired | ||
| 28 | + SitesServiceImpl sitesService; | ||
| 29 | + @Autowired | ||
| 30 | + AuditPass Pass; | ||
| 31 | + @Autowired | ||
| 32 | + CommentsServiceImpl commentsService; | ||
| 33 | + | ||
| 34 | + @Autowired | ||
| 35 | + UsersServiceImpl usersService; | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + @Scheduled(fixedRate = 30 * 60 * 1000) | ||
| 39 | + public void syncComments() { | ||
| 40 | + | ||
| 41 | + //收集免审的spid | ||
| 42 | + List<ShySites> sitesList = sitesService.findAll(); | ||
| 43 | + ArrayList<Integer> sites = new ArrayList<Integer>(); | ||
| 44 | + for (ShySites shySites : sitesList) { | ||
| 45 | + if (CommonUtils.isNotEmpty(shySites.getWrite_business())) { | ||
| 46 | + String[] business = shySites.getWrite_business().split(","); | ||
| 47 | + List<String> asList = Arrays.asList(business); | ||
| 48 | + if (asList.contains(CommonConst.BUSINESS_COMMENT + "")) { | ||
| 49 | + sites.add(shySites.getSpid()); | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + //遍历免审的spid去更改状态值 | ||
| 54 | + ShyComments shyComments = new ShyComments(); | ||
| 55 | + for (int spid : sites) { | ||
| 56 | + shyComments.setSpid(spid); | ||
| 57 | + List<ShyComments> commentsList = commentsService.findshyComments(shyComments); | ||
| 58 | + if (commentsList.size() > 0) { | ||
| 59 | + for (ShyComments comments : commentsList) { | ||
| 60 | + //封装json数据传参进行回调 | ||
| 61 | + JSONObject json1 = new JSONObject(); | ||
| 62 | + json1.put("activity_id", comments.getActivity_id()); | ||
| 63 | + json1.put("state", 3); | ||
| 64 | + json1.put("attr_tags", ""); | ||
| 65 | + json1.put("msg", ""); | ||
| 66 | + JSONObject result = new JSONObject(); | ||
| 67 | + try { | ||
| 68 | + result = Pass.commentPass(json1, comments.getCallback()); | ||
| 69 | + } catch (Exception e) { | ||
| 70 | + logger.error("评论回调失败,activity_id:{}", comments.getActivity_id()); | ||
| 71 | + } | ||
| 72 | + comments.setState(CommonConst.AUDIT_SUCCESS); | ||
| 73 | + int i = commentsService.updateComment(json1, null, comments.getAuditor_id()); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | +} |
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
| @@ -44,9 +44,25 @@ public class CommentsServiceImpl { | @@ -44,9 +44,25 @@ public class CommentsServiceImpl { | ||
| 44 | return sitesList; | 44 | return sitesList; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | - public int impotComments(ShyComments shyComments) { | 47 | + //************************************** |
| 48 | + public List<ShyComments> findshyComments(ShyComments shyComments) { | ||
| 49 | + List<ShyComments> commentsList = shyCommentsMapper.select(shyComments); | ||
| 50 | + return commentsList; | ||
| 51 | + } | ||
| 52 | + public boolean updateshyComments1(ShyComments shyComments) { | ||
| 53 | + int result = shyCommentsMapper.updateByPrimaryKeySelective(shyComments); | ||
| 54 | + if(result==0){ | ||
| 55 | + return false; | ||
| 56 | + } | ||
| 57 | + return true; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public boolean impotComments(ShyComments shyComments) { | ||
| 48 | int result = shyCommentsMapper.insert(shyComments); | 61 | int result = shyCommentsMapper.insert(shyComments); |
| 49 | - return result; | 62 | + if(result==0){ |
| 63 | + return false; | ||
| 64 | + } | ||
| 65 | + return true; | ||
| 50 | } | 66 | } |
| 51 | 67 | ||
| 52 | public int updateComment(JSONObject json, Integer id, String auditor_id) { | 68 | public int updateComment(JSONObject json, Integer id, String auditor_id) { |
src/main/java/com/cnlive/shenhe/serviceImpl/SitesServiceImpl.java
| @@ -47,4 +47,8 @@ public class SitesServiceImpl { | @@ -47,4 +47,8 @@ public class SitesServiceImpl { | ||
| 47 | public boolean update(ShySites site) { | 47 | public boolean update(ShySites site) { |
| 48 | return shySitesMapper.updateByPrimaryKeySelective(site)==1; | 48 | return shySitesMapper.updateByPrimaryKeySelective(site)==1; |
| 49 | } | 49 | } |
| 50 | + public List<ShySites> findAll() { | ||
| 51 | + List<ShySites> shySites = shySitesMapper.selectAll(); | ||
| 52 | + return shySites; | ||
| 53 | + } | ||
| 50 | } | 54 | } |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| @@ -31,16 +31,31 @@ public class VideosServiceImpl { | @@ -31,16 +31,31 @@ public class VideosServiceImpl { | ||
| 31 | @Autowired | 31 | @Autowired |
| 32 | ShyUsersMapper shyUsersMapper; | 32 | ShyUsersMapper shyUsersMapper; |
| 33 | 33 | ||
| 34 | - public int impotVideo(ShyVideos shyVideos) { | 34 | + public boolean impotVideo(ShyVideos shyVideos) { |
| 35 | int result = shyVideosMapper.insert(shyVideos); | 35 | int result = shyVideosMapper.insert(shyVideos); |
| 36 | - return result; | 36 | + if(result==0){ |
| 37 | + return false; | ||
| 38 | + } | ||
| 39 | + return true; | ||
| 37 | } | 40 | } |
| 38 | 41 | ||
| 39 | public List<ShySites> getBusiness(ShySites shySites) { | 42 | public List<ShySites> getBusiness(ShySites shySites) { |
| 40 | List<ShySites> sitesList = shySitesMapper.select(shySites); | 43 | List<ShySites> sitesList = shySitesMapper.select(shySites); |
| 41 | return sitesList; | 44 | return sitesList; |
| 42 | } | 45 | } |
| 46 | +// 重改逻辑后新加的方法============================ | ||
| 47 | + public List<ShyVideos> findshyVideo(ShyVideos shyVideos) { | ||
| 48 | + List<ShyVideos> shyVideoslist = shyVideosMapper.select(shyVideos); | ||
| 49 | + return shyVideoslist; | ||
| 50 | + } | ||
| 43 | 51 | ||
| 52 | + public boolean updateshyVideos(ShyVideos shyVideos) { | ||
| 53 | + int i = shyVideosMapper.updateByPrimaryKeySelective(shyVideos); | ||
| 54 | + if(i==0){ | ||
| 55 | + return false; | ||
| 56 | + } | ||
| 57 | + return true; | ||
| 58 | + } | ||
| 44 | public int updateVideo(Integer id, String auditor_id, Integer state, String msg) { | 59 | public int updateVideo(Integer id, String auditor_id, Integer state, String msg) { |
| 45 | ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id); | 60 | ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id); |
| 46 | shyVideos.setAuditor_id(auditor_id); | 61 | shyVideos.setAuditor_id(auditor_id); |