Commit 0827e287aca8e4b7db0221f15ae4561f0da5e42e
1 parent
f9248009
update
Showing
8 changed files
with
83 additions
and
69 deletions
src/main/java/com/cnlive/shenhe/controller/CommentsController.java
| ... | ... | @@ -3,7 +3,8 @@ package com.cnlive.shenhe.controller; |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 5 | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | -import com.cnlive.shenhe.entity.AcpComments; | |
| 6 | +import com.cnlive.shenhe.bean.SessionUser; | |
| 7 | +import com.cnlive.shenhe.entity.ShyComments; | |
| 7 | 8 | import com.cnlive.shenhe.entity.ShySites; |
| 8 | 9 | import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; |
| 9 | 10 | import com.cnlive.shenhe.utils.AuditPass; |
| ... | ... | @@ -15,6 +16,8 @@ import org.springframework.web.bind.annotation.PostMapping; |
| 15 | 16 | import org.springframework.web.bind.annotation.RequestBody; |
| 16 | 17 | import org.springframework.web.bind.annotation.RequestMapping; |
| 17 | 18 | import org.springframework.web.bind.annotation.ResponseBody; |
| 19 | + | |
| 20 | +import javax.servlet.http.HttpSession; | |
| 18 | 21 | import java.util.Arrays; |
| 19 | 22 | import java.util.List; |
| 20 | 23 | |
| ... | ... | @@ -39,9 +42,9 @@ public class CommentsController { |
| 39 | 42 | @PostMapping("/import") |
| 40 | 43 | @ResponseBody |
| 41 | 44 | public ResponseBean impotComment(@RequestBody JSONObject json){ |
| 42 | - AcpComments acpComments = new AcpComments(); | |
| 45 | + ShyComments shyComments = new ShyComments(); | |
| 43 | 46 | ShySites shySites = new ShySites(); |
| 44 | - acpComments.setState(CommonConst.AUDIT_INTT); | |
| 47 | + shyComments.setState(CommonConst.AUDIT_INTT); | |
| 45 | 48 | //判断是否白名单 |
| 46 | 49 | shySites.setSpid(json.getInteger("spId")); |
| 47 | 50 | List<ShySites> shySitesList = commentsService.getBusiness(shySites); |
| ... | ... | @@ -51,7 +54,7 @@ public class CommentsController { |
| 51 | 54 | String[] business = write_business.split(","); |
| 52 | 55 | List<String> asList = Arrays.asList(business); |
| 53 | 56 | if(asList.contains(CommonConst.BUSINESS_COMMENT+"")){ |
| 54 | - acpComments.setState(CommonConst.AUDIT_SUCCESS); | |
| 57 | + shyComments.setState(CommonConst.AUDIT_SUCCESS); | |
| 55 | 58 | //封装json数据传参进行回调 |
| 56 | 59 | JSONObject json1 = new JSONObject(); |
| 57 | 60 | json1.put("activity_id",json.getString("activityId")); |
| ... | ... | @@ -60,27 +63,27 @@ public class CommentsController { |
| 60 | 63 | json1.put("msg",""); |
| 61 | 64 | Pass.commentPass(json1); |
| 62 | 65 | }else { |
| 63 | - acpComments.setState(CommonConst.AUDIT_INTT); | |
| 66 | + shyComments.setState(CommonConst.AUDIT_INTT); | |
| 64 | 67 | } |
| 65 | 68 | } |
| 66 | 69 | } |
| 67 | 70 | //封装数据入库 |
| 68 | - acpComments.setProgram_id(json.getInteger("programId")); | |
| 69 | - acpComments.setComment_original_url(json.getString("originalUrl")); | |
| 70 | - acpComments.setComment_title(json.getString("commentTitle")); | |
| 71 | - acpComments.setComment_user_id(json.getInteger("commentUserId")); | |
| 72 | - acpComments.setComment_user_name(json.getString("commentUserName")); | |
| 73 | - acpComments.setComment_user_avatar(json.getString("commentUserAvatar")); | |
| 74 | - acpComments.setComment_user_ip(json.getString("commentUserIP")); | |
| 75 | - acpComments.setComment_content(json.getString("commentContent")); | |
| 76 | - acpComments.setComment_time(json.getDate("commentTime")); | |
| 77 | - acpComments.setSpid(json.getInteger("spId")); | |
| 78 | - acpComments.setApp_id(json.getString("appId")); | |
| 79 | - acpComments.setPlatform(json.getString("platform")); | |
| 80 | - acpComments.setActivity_id(json.getString("activityId")); | |
| 81 | - acpComments.setIs_hot(json.getBoolean("priority")); | |
| 82 | - acpComments.setCallback(json.getString("callback")); | |
| 83 | - int i = commentsService.impotComments(acpComments); | |
| 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); | |
| 84 | 87 | if(i>0){ |
| 85 | 88 | return new ResponseBean(ErrorEnum.SUCCESS); |
| 86 | 89 | }else { |
| ... | ... | @@ -95,9 +98,11 @@ public class CommentsController { |
| 95 | 98 | */ |
| 96 | 99 | @PostMapping("/shenheComment") |
| 97 | 100 | @ResponseBody |
| 98 | - public ResponseBean shenheInfo(@RequestBody JSONObject json){ | |
| 101 | + public ResponseBean shenheInfo(@RequestBody JSONObject json,Integer id,HttpSession session){ | |
| 99 | 102 | Pass.commentPass(json); |
| 100 | - int i = commentsService.updateComment(json); | |
| 103 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | |
| 104 | + String userId = sessionUser.getUserId(); | |
| 105 | + int i = commentsService.updateComment(json,id,userId); | |
| 101 | 106 | if(i==0){ |
| 102 | 107 | return new ResponseBean(ErrorEnum.ERROR); |
| 103 | 108 | }else { |
| ... | ... | @@ -119,12 +124,14 @@ public class CommentsController { |
| 119 | 124 | * @param orderByClause |
| 120 | 125 | * @return |
| 121 | 126 | */ |
| 122 | - @RequestMapping("/table") | |
| 127 | + @RequestMapping("/page") | |
| 123 | 128 | @ResponseBody |
| 124 | - 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){ | |
| 129 | + 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){ | |
| 130 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | |
| 131 | + Integer spid = sessionUser.getSpid(); | |
| 125 | 132 | if(CommonUtils.isNull(page))page=1; |
| 126 | 133 | if(CommonUtils.isNull(pageSize))pageSize=10; |
| 127 | - return commentsService.getListComments(activity_id,content,is_hot,start_date,end_date,state,auditor,page,pageSize,orderByClause); | |
| 134 | + return commentsService.getListComments(activity_id,content,is_hot,start_date,end_date,state,auditor,page,pageSize,orderByClause,spid); | |
| 128 | 135 | } |
| 129 | 136 | |
| 130 | 137 | /** | ... | ... |
src/main/java/com/cnlive/shenhe/controller/VideosController.java
| ... | ... | @@ -6,6 +6,7 @@ import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | 6 | import com.cnlive.shenhe.bean.SessionUser; |
| 7 | 7 | import com.cnlive.shenhe.entity.ShySites; |
| 8 | 8 | import com.cnlive.shenhe.entity.ShyVideos; |
| 9 | +import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | |
| 9 | 10 | import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; |
| 10 | 11 | import com.cnlive.shenhe.utils.AuditPass; |
| 11 | 12 | import com.cnlive.shenhe.utils.CommonConst; |
| ... | ... | @@ -32,7 +33,8 @@ public class VideosController { |
| 32 | 33 | AuditPass Pass; |
| 33 | 34 | @Autowired |
| 34 | 35 | VideosServiceImpl videosService; |
| 35 | - | |
| 36 | + @Autowired | |
| 37 | + UsersServiceImpl usersService; | |
| 36 | 38 | /** |
| 37 | 39 | * 视频送审接口 |
| 38 | 40 | * @param json |
| ... | ... | @@ -88,12 +90,14 @@ public class VideosController { |
| 88 | 90 | */ |
| 89 | 91 | @RequestMapping("/shenheVideo") |
| 90 | 92 | @ResponseBody |
| 91 | - public ResponseBean shenheInfo(String activity_id,int state,String attr_tags,String msg){ | |
| 93 | + public ResponseBean shenheInfo(Integer id,String activity_id,int state,String attr_tags,String msg,HttpSession session){ | |
| 94 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | |
| 95 | + String userId = sessionUser.getUserId(); | |
| 92 | 96 | String code = Pass.auditPass(activity_id, state, attr_tags, msg); |
| 93 | 97 | // if(code.equals("-1")){ |
| 94 | 98 | // return new ResponseBean(ErrorEnum.ERROR); |
| 95 | 99 | // } |
| 96 | - int i = videosService.updateVideo(activity_id, state, attr_tags, msg); | |
| 100 | + int i = videosService.updateVideo(id,userId,activity_id, state, attr_tags, msg); | |
| 97 | 101 | if(i==0){ |
| 98 | 102 | return new ResponseBean(ErrorEnum.ERROR); |
| 99 | 103 | } | ... | ... |
src/main/java/com/cnlive/shenhe/entity/ShyComments.java
| ... | ... | @@ -61,9 +61,9 @@ public class ShyComments { |
| 61 | 61 | private String updater; |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * 审核员 | |
| 64 | + * 审核员id | |
| 65 | 65 | */ |
| 66 | - private String auditor; | |
| 66 | + private String auditor_id; | |
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * 回调函数 |
| ... | ... | @@ -313,21 +313,21 @@ public class ShyComments { |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | - * 获取审核员 | |
| 316 | + * 获取审核员id | |
| 317 | 317 | * |
| 318 | - * @return auditor - 审核员 | |
| 318 | + * @return auditor_id - 审核员id | |
| 319 | 319 | */ |
| 320 | - public String getAuditor() { | |
| 321 | - return auditor; | |
| 320 | + public String getAuditor_id() { | |
| 321 | + return auditor_id; | |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
| 325 | - * 设置审核员 | |
| 325 | + * 设置审核员id | |
| 326 | 326 | * |
| 327 | - * @param auditor 审核员 | |
| 327 | + * @param auditor_id 审核员id | |
| 328 | 328 | */ |
| 329 | - public void setAuditor(String auditor) { | |
| 330 | - this.auditor = auditor; | |
| 329 | + public void setAuditor_id(String auditor_id) { | |
| 330 | + this.auditor_id = auditor_id; | |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** | ... | ... |
src/main/java/com/cnlive/shenhe/entity/ShyVideos.java
| ... | ... | @@ -35,7 +35,7 @@ public class ShyVideos { |
| 35 | 35 | /** |
| 36 | 36 | * 审核员id |
| 37 | 37 | */ |
| 38 | - private Integer auditor; | |
| 38 | + private String auditor_id; | |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * 回调地址 |
| ... | ... | @@ -198,19 +198,19 @@ public class ShyVideos { |
| 198 | 198 | /** |
| 199 | 199 | * 获取审核员id |
| 200 | 200 | * |
| 201 | - * @return auditor - 审核员id | |
| 201 | + * @return auditor_id - 审核员id | |
| 202 | 202 | */ |
| 203 | - public Integer getAuditor() { | |
| 204 | - return auditor; | |
| 203 | + public String getAuditor_id() { | |
| 204 | + return auditor_id; | |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | 208 | * 设置审核员id |
| 209 | 209 | * |
| 210 | - * @param auditor 审核员id | |
| 210 | + * @param auditor_id 审核员id | |
| 211 | 211 | */ |
| 212 | - public void setAuditor(Integer auditor) { | |
| 213 | - this.auditor = auditor; | |
| 212 | + public void setAuditor_id(String auditor_id) { | |
| 213 | + this.auditor_id = auditor_id; | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.cnlive.shenhe.entity.AcpComments; | |
| 4 | +import com.cnlive.shenhe.entity.ShyComments; | |
| 5 | 5 | import com.cnlive.shenhe.entity.ShySites; |
| 6 | -import com.cnlive.shenhe.mapper.AcpCommentsMapper; | |
| 6 | +import com.cnlive.shenhe.mapper.ShyCommentsMapper; | |
| 7 | 7 | import com.cnlive.shenhe.mapper.ShySitesMapper; |
| 8 | 8 | import com.cnlive.shenhe.utils.CommonUtils; |
| 9 | 9 | import com.github.pagehelper.PageHelper; |
| ... | ... | @@ -22,7 +22,7 @@ import java.util.List; |
| 22 | 22 | @Service |
| 23 | 23 | public class CommentsServiceImpl { |
| 24 | 24 | @Autowired |
| 25 | - AcpCommentsMapper acpCommentsMapper; | |
| 25 | + ShyCommentsMapper shyCommentsMapper ; | |
| 26 | 26 | @Autowired |
| 27 | 27 | ShySitesMapper shySitesMapper; |
| 28 | 28 | |
| ... | ... | @@ -31,22 +31,22 @@ public class CommentsServiceImpl { |
| 31 | 31 | List<ShySites> sitesList = shySitesMapper.select(shySites); |
| 32 | 32 | return sitesList; |
| 33 | 33 | } |
| 34 | - public int impotComments(AcpComments acpComments){ | |
| 35 | - int result = acpCommentsMapper.insert(acpComments); | |
| 34 | + public int impotComments(ShyComments shyComments){ | |
| 35 | + int result = shyCommentsMapper.insert(shyComments); | |
| 36 | 36 | return result; |
| 37 | 37 | } |
| 38 | - public int updateComment(JSONObject json){ | |
| 39 | - AcpComments acpComments = new AcpComments(); | |
| 40 | - acpComments.setActivity_id(json.getString("activity_id")); | |
| 41 | - Integer id = acpCommentsMapper.select(acpComments).get(0).getId(); | |
| 42 | - acpComments.setId(id); | |
| 43 | - acpComments.setState(json.getInteger("state")); | |
| 44 | - acpComments.setMsg(json.getString("msg")); | |
| 45 | - int result = acpCommentsMapper.updateByPrimaryKeySelective(acpComments); | |
| 38 | + public int updateComment(JSONObject json,Integer id,String auditor_id){ | |
| 39 | + ShyComments shyComments = new ShyComments(); | |
| 40 | + shyComments.setId(id); | |
| 41 | + shyComments.setAuditor_id(auditor_id); | |
| 42 | + shyComments.setActivity_id(json.getString("activity_id")); | |
| 43 | + shyComments.setState(json.getInteger("state")); | |
| 44 | + shyComments.setMsg(json.getString("msg")); | |
| 45 | + int result = shyCommentsMapper.updateByPrimaryKeySelective(shyComments); | |
| 46 | 46 | return result; |
| 47 | 47 | } |
| 48 | - public PageInfo<AcpComments> 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){ | |
| 49 | - Example example = new Example(AcpComments.class); | |
| 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); | |
| 50 | 50 | Example.Criteria criteria = example.createCriteria(); |
| 51 | 51 | if (CommonUtils.isNotEmpty(orderByClause)) { |
| 52 | 52 | example.setOrderByClause(orderByClause); |
| ... | ... | @@ -61,6 +61,9 @@ public class CommentsServiceImpl { |
| 61 | 61 | if (CommonUtils.isNotEmpty(auditor)){ |
| 62 | 62 | criteria.andEqualTo("auditor", auditor ); |
| 63 | 63 | } |
| 64 | + if (CommonUtils.isNotNull(spid)){ | |
| 65 | + criteria.andEqualTo("spid", spid ); | |
| 66 | + } | |
| 64 | 67 | if (CommonUtils.isNotNull(is_hot)){ |
| 65 | 68 | criteria.andEqualTo("is_hot", is_hot ); |
| 66 | 69 | } |
| ... | ... | @@ -70,13 +73,13 @@ public class CommentsServiceImpl { |
| 70 | 73 | //默认按上传时间倒序排序 |
| 71 | 74 | example.setOrderByClause("comment_time desc"); |
| 72 | 75 | PageHelper.startPage(page, pageSize, true); |
| 73 | - List<AcpComments> commentsList = acpCommentsMapper.selectByExample(example); | |
| 74 | - PageInfo<AcpComments> pageInfo = new PageInfo<>(commentsList); | |
| 76 | + List<ShyComments> commentsList = shyCommentsMapper.selectByExample(example); | |
| 77 | + PageInfo<ShyComments> pageInfo = new PageInfo<>(commentsList); | |
| 75 | 78 | return pageInfo; |
| 76 | 79 | } |
| 77 | 80 | |
| 78 | 81 | public Object getDetailsComment(Integer id){ |
| 79 | - AcpComments comment = acpCommentsMapper.selectByPrimaryKey(id); | |
| 82 | + ShyComments comment = shyCommentsMapper.selectByPrimaryKey(id); | |
| 80 | 83 | return comment; |
| 81 | 84 | } |
| 82 | 85 | } | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| ... | ... | @@ -33,11 +33,11 @@ public class VideosServiceImpl { |
| 33 | 33 | List<ShySites> sitesList = shySitesMapper.select(shySites); |
| 34 | 34 | return sitesList; |
| 35 | 35 | } |
| 36 | - public int updateVideo(String activity_id,int state,String attr_tags,String msg){ | |
| 36 | + public int updateVideo(Integer id,String auditor_id,String activity_id,int state,String attr_tags,String msg){ | |
| 37 | 37 | ShyVideos shyVideos = new ShyVideos(); |
| 38 | - shyVideos.setVideo_id(activity_id); | |
| 39 | - Integer id = shyVideosMapper.select(shyVideos).get(0).getId(); | |
| 40 | 38 | shyVideos.setId(id); |
| 39 | + 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); | ... | ... |
src/main/resources/mapper/ShyCommentsMapper.xml
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | <result column="app_id" jdbcType="VARCHAR" property="app_id" /> |
| 18 | 18 | <result column="comment_original_url" jdbcType="VARCHAR" property="comment_original_url" /> |
| 19 | 19 | <result column="updater" jdbcType="VARCHAR" property="updater" /> |
| 20 | - <result column="auditor" jdbcType="VARCHAR" property="auditor" /> | |
| 20 | + <result column="auditor_id" jdbcType="VARCHAR" property="auditor_id" /> | |
| 21 | 21 | <result column="callback" jdbcType="VARCHAR" property="callback" /> |
| 22 | 22 | <result column="is_hot" jdbcType="BIT" property="is_hot" /> |
| 23 | 23 | <result column="msg" jdbcType="VARCHAR" property="msg" /> | ... | ... |
src/main/resources/mapper/ShyVideosMapper.xml
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | <result column="video_imgs" jdbcType="VARCHAR" property="video_imgs" /> |
| 13 | 13 | <result column="video_tags" jdbcType="VARCHAR" property="video_tags" /> |
| 14 | 14 | <result column="updater" jdbcType="VARCHAR" property="updater" /> |
| 15 | - <result column="auditor" jdbcType="INTEGER" property="auditor" /> | |
| 15 | + <result column="auditor_id" jdbcType="VARCHAR" property="auditor_id" /> | |
| 16 | 16 | <result column="callback" jdbcType="VARCHAR" property="callback" /> |
| 17 | 17 | <result column="video_priority" jdbcType="VARCHAR" property="video_priority" /> |
| 18 | 18 | <result column="msg" jdbcType="VARCHAR" property="msg" /> | ... | ... |