Commit 6099026eaa35c16ca3b5d9d64fa88c4774b70468

Authored by liwei2917
1 parent 8a70aec8

评论审核修改时间获取以及审核类型

src/main/java/com/cnlive/shenhe/api/CommentsControllerApi.java
@@ -56,7 +56,7 @@ public class CommentsControllerApi { @@ -56,7 +56,7 @@ public class CommentsControllerApi {
56 shyComments1.setComment_content(json.getString("commentContent")); 56 shyComments1.setComment_content(json.getString("commentContent"));
57 String commentTime = json.getString("commentTime"); 57 String commentTime = json.getString("commentTime");
58 if (CommonUtils.isNotEmpty(commentTime)) { 58 if (CommonUtils.isNotEmpty(commentTime)) {
59 - Date timestamp = CommonUtils.getTimestamp(commentTime, "yyyy-MM-dd HH:mm:ss"); 59 + Date timestamp = CommonUtils.getTimestamp(commentTime, "yyyy-MM-dd HH:mm");
60 shyComments1.setComment_time(timestamp); 60 shyComments1.setComment_time(timestamp);
61 61
62 } 62 }
@@ -85,7 +85,7 @@ public class CommentsControllerApi { @@ -85,7 +85,7 @@ public class CommentsControllerApi {
85 shyComments.setComment_content(json.getString("commentContent")); 85 shyComments.setComment_content(json.getString("commentContent"));
86 String commentTime = json.getString("commentTime"); 86 String commentTime = json.getString("commentTime");
87 if (CommonUtils.isNotEmpty(commentTime)) { 87 if (CommonUtils.isNotEmpty(commentTime)) {
88 - Date timestamp = CommonUtils.getTimestamp(commentTime, "yyyy-MM-dd HH:mm:ss"); 88 + Date timestamp = CommonUtils.getTimestamp(commentTime, "yyyy-MM-dd HH:mm");
89 shyComments.setComment_time(timestamp); 89 shyComments.setComment_time(timestamp);
90 } 90 }
91 shyComments.setSpid(json.getInteger("spId")); 91 shyComments.setSpid(json.getInteger("spId"));
@@ -93,6 +93,7 @@ public class CommentsControllerApi { @@ -93,6 +93,7 @@ public class CommentsControllerApi {
93 shyComments.setPlatform(json.getString("platform")); 93 shyComments.setPlatform(json.getString("platform"));
94 shyComments.setIs_hot(json.getBoolean("priority")); 94 shyComments.setIs_hot(json.getBoolean("priority"));
95 shyComments.setCallback(json.getString("callback")); 95 shyComments.setCallback(json.getString("callback"));
  96 + commentsService.getShenheType(shyComments);
96 boolean YorN = commentsService.impotComments(shyComments); 97 boolean YorN = commentsService.impotComments(shyComments);
97 if (YorN == true) { 98 if (YorN == true) {
98 return new ResponseBean(ErrorEnum.SUCCESS); 99 return new ResponseBean(ErrorEnum.SUCCESS);
src/main/java/com/cnlive/shenhe/controller/CommentsController.java
@@ -5,9 +5,11 @@ import com.cnlive.shenhe.bean.ErrorEnum; @@ -5,9 +5,11 @@ import com.cnlive.shenhe.bean.ErrorEnum;
5 import com.cnlive.shenhe.bean.ResponseBean; 5 import com.cnlive.shenhe.bean.ResponseBean;
6 import com.cnlive.shenhe.bean.SessionUser; 6 import com.cnlive.shenhe.bean.SessionUser;
7 import com.cnlive.shenhe.entity.ShyComments; 7 import com.cnlive.shenhe.entity.ShyComments;
  8 +import com.cnlive.shenhe.entity.ShySites;
8 import com.cnlive.shenhe.entity.ShyUsers; 9 import com.cnlive.shenhe.entity.ShyUsers;
9 import com.cnlive.shenhe.entity.ShyVideos; 10 import com.cnlive.shenhe.entity.ShyVideos;
10 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; 11 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
  12 +import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
11 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; 13 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
12 import com.cnlive.shenhe.utils.AuditPass; 14 import com.cnlive.shenhe.utils.AuditPass;
13 import com.cnlive.shenhe.utils.CommonConst; 15 import com.cnlive.shenhe.utils.CommonConst;
@@ -36,6 +38,9 @@ public class CommentsController { @@ -36,6 +38,9 @@ public class CommentsController {
36 38
37 @Autowired 39 @Autowired
38 UsersServiceImpl usersService; 40 UsersServiceImpl usersService;
  41 +
  42 + @Autowired
  43 + SitesServiceImpl sitesService;
39 44
40 /** 45 /**
41 * 评论列表页 46 * 评论列表页
@@ -98,6 +103,11 @@ public class CommentsController { @@ -98,6 +103,11 @@ public class CommentsController {
98 } 103 }
99 comment.setUpdater(updater); 104 comment.setUpdater(updater);
100 } 105 }
  106 + //显示spid简称
  107 + ShySites shySites = sitesService.findspidDescByspid(comment.getSpid());
  108 + if (CommonUtils.isNotNull(shySites)) {
  109 + comment.setSpid_desc(shySites.getName());
  110 + }
101 } 111 }
102 } 112 }
103 model.addAttribute("commentPage", commentPage); 113 model.addAttribute("commentPage", commentPage);
@@ -129,7 +139,7 @@ public class CommentsController { @@ -129,7 +139,7 @@ public class CommentsController {
129 public ResponseBean pass(String ids, HttpSession session) { 139 public ResponseBean pass(String ids, HttpSession session) {
130 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 140 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
131 String userId = sessionUser.getUserId(); 141 String userId = sessionUser.getUserId();
132 - boolean success = commentsService.updateState(ids, CommonConst.AUDIT_SUCCESS, userId); 142 + boolean success = commentsService.updateState(ids, CommonConst.AUDIT_SUCCESS, userId,"","审核通过");
133 if (success) { 143 if (success) {
134 return new ResponseBean(); 144 return new ResponseBean();
135 } else { 145 } else {
@@ -148,7 +158,7 @@ public class CommentsController { @@ -148,7 +158,7 @@ public class CommentsController {
148 public ResponseBean refuse(String ids, HttpSession session) { 158 public ResponseBean refuse(String ids, HttpSession session) {
149 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 159 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
150 String userId = sessionUser.getUserId(); 160 String userId = sessionUser.getUserId();
151 - boolean success = commentsService.updateState(ids, CommonConst.AUDIT_REFUSE, userId); 161 + boolean success = commentsService.updateState(ids, CommonConst.AUDIT_REFUSE, userId,"","审核拒绝");
152 if (success) { 162 if (success) {
153 return new ResponseBean(); 163 return new ResponseBean();
154 } else { 164 } else {
src/main/java/com/cnlive/shenhe/entity/ShyComments.java
@@ -54,6 +54,11 @@ public class ShyComments { @@ -54,6 +54,11 @@ public class ShyComments {
54 * 原文链接url 54 * 原文链接url
55 */ 55 */
56 private String comment_original_url; 56 private String comment_original_url;
  57 +
  58 + /**
  59 + * 审核类型,1:免审,2:机审,3:人工审
  60 + */
  61 + private Integer shenhe_type;
57 62
58 /** 63 /**
59 * 更新者 64 * 更新者
@@ -303,6 +308,9 @@ public class ShyComments { @@ -303,6 +308,9 @@ public class ShyComments {
303 public void setComment_original_url(String comment_original_url) { 308 public void setComment_original_url(String comment_original_url) {
304 this.comment_original_url = comment_original_url; 309 this.comment_original_url = comment_original_url;
305 } 310 }
  311 +
  312 + @Transient
  313 + private String spid_desc;
306 314
307 /** 315 /**
308 * 获取更新者 316 * 获取更新者
@@ -529,4 +537,22 @@ public class ShyComments { @@ -529,4 +537,22 @@ public class ShyComments {
529 public void setReceive_user_id(String receive_user_id) { 537 public void setReceive_user_id(String receive_user_id) {
530 this.receive_user_id = receive_user_id; 538 this.receive_user_id = receive_user_id;
531 } 539 }
  540 +
  541 + public Integer getShenhe_type() {
  542 + return shenhe_type;
  543 + }
  544 +
  545 + public void setShenhe_type(Integer shenhe_type) {
  546 + this.shenhe_type = shenhe_type;
  547 + }
  548 +
  549 + public String getSpid_desc() {
  550 + return spid_desc;
  551 + }
  552 +
  553 + public void setSpid_desc(String spid_desc) {
  554 + this.spid_desc = spid_desc;
  555 + }
  556 +
  557 +
532 } 558 }
533 \ No newline at end of file 559 \ No newline at end of file
src/main/java/com/cnlive/shenhe/job/CommentsJob.java
@@ -37,51 +37,38 @@ public class CommentsJob { @@ -37,51 +37,38 @@ public class CommentsJob {
37 @Scheduled(fixedRate = 60 * 1000) 37 @Scheduled(fixedRate = 60 * 1000)
38 public void updateComments() { 38 public void updateComments() {
39 39
40 - //收集免审的spid  
41 - List<ShySites> sitesList = sitesService.findAll();  
42 - ArrayList<Integer> sites = new ArrayList<Integer>();  
43 - for (ShySites shySites : sitesList) {  
44 - if (CommonUtils.isNotEmpty(shySites.getWrite_business())) {  
45 - String[] business = shySites.getWrite_business().split(",");  
46 - List<String> asList = Arrays.asList(business);  
47 - if (asList.contains(CommonConst.BUSINESS_COMMENT + "")) {  
48 - sites.add(shySites.getSpid());  
49 - }  
50 - }  
51 - }  
52 //遍历免审的spid去更改状态值 40 //遍历免审的spid去更改状态值
53 ShyComments shyComments = new ShyComments(); 41 ShyComments shyComments = new ShyComments();
54 - for (int spid : sites) {  
55 - shyComments.setSpid(spid); 42 + shyComments.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审
56 shyComments.setState(CommonConst.AUDIT_INTT); 43 shyComments.setState(CommonConst.AUDIT_INTT);
57 List<ShyComments> commentsList = commentsService.findshyComments(shyComments); 44 List<ShyComments> commentsList = commentsService.findshyComments(shyComments);
58 if (commentsList.size() > 0) { 45 if (commentsList.size() > 0) {
59 for (ShyComments comments : commentsList) { 46 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 - Integer errorCode = result.getInteger("errorCode");  
70 - if (0 == errorCode) {  
71 - int i = commentsService.updateComment(comments.getId(), CommonConst.AUDIT_SUCCESS, json1.getString("errorMessage"));  
72 - if (i != 1) {  
73 - logger.error("评论审核回调失败,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), errorCode, result.getString("errorMessage"));  
74 - }  
75 - } else {  
76 - commentsService.updateComment(comments.getId(), CommonConst.AUDIT_CALLBACK_FAIL, "白名单回调失败");  
77 - logger.error("评论审核回调失败,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), errorCode, result.getString("errorMessage"));  
78 - }  
79 - } catch (Exception e) {  
80 - logger.error("评论回调失败,activity_id:{}", comments.getActivity_id(),e);  
81 - } 47 + commentsService.updateState(comments.getId().toString(), CommonConst.AUDIT_SUCCESS, "","白名单","白名单通过");
  48 +// //封装json数据传参进行回调
  49 +// JSONObject json1 = new JSONObject();
  50 +// json1.put("activity_id", comments.getActivity_id());
  51 +// json1.put("state", 3);
  52 +// json1.put("attr_tags", "");
  53 +// json1.put("msg", "白名单通过");
  54 +// JSONObject result = new JSONObject();
  55 +// try {
  56 +// result = Pass.commentPass(json1, comments.getCallback());
  57 +// Integer errorCode = result.getInteger("errorCode");
  58 +// if (0 == errorCode) {
  59 +// int i = commentsService.updateComment(comments.getId(), CommonConst.AUDIT_SUCCESS, json1.getString("msg"));
  60 +// if (i != 1) {
  61 +// logger.error("评论审核回调失败,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), errorCode, result.getString("errorMessage"));
  62 +// }
  63 +// } else {
  64 +// commentsService.updateComment(comments.getId(), CommonConst.AUDIT_CALLBACK_FAIL, "白名单回调失败");
  65 +// logger.error("评论审核回调失败,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), errorCode, result.getString("errorMessage"));
  66 +// }
  67 +// } catch (Exception e) {
  68 +// logger.error("评论回调失败,activity_id:{}", comments.getActivity_id(),e);
  69 +// }
82 } 70 }
83 } 71 }
84 - }  
85 } 72 }
86 73
87 /** 74 /**
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
4 import com.cnlive.shenhe.entity.ShyComments; 4 import com.cnlive.shenhe.entity.ShyComments;
5 import com.cnlive.shenhe.entity.ShySites; 5 import com.cnlive.shenhe.entity.ShySites;
6 import com.cnlive.shenhe.entity.ShyUsers; 6 import com.cnlive.shenhe.entity.ShyUsers;
  7 +import com.cnlive.shenhe.entity.ShyUsersfree;
7 import com.cnlive.shenhe.entity.ShyVideos; 8 import com.cnlive.shenhe.entity.ShyVideos;
8 import com.cnlive.shenhe.mapper.ShyCommentsMapper; 9 import com.cnlive.shenhe.mapper.ShyCommentsMapper;
9 import com.cnlive.shenhe.mapper.ShySitesMapper; 10 import com.cnlive.shenhe.mapper.ShySitesMapper;
@@ -40,6 +41,9 @@ public class CommentsServiceImpl { @@ -40,6 +41,9 @@ public class CommentsServiceImpl {
40 ShyUsersMapper shyUsersMapper; 41 ShyUsersMapper shyUsersMapper;
41 @Autowired 42 @Autowired
42 AuditPass Pass; 43 AuditPass Pass;
  44 +
  45 + @Autowired
  46 + SitesServiceImpl sitesService;
43 47
44 public List<ShySites> getBusiness(ShySites shySites) { 48 public List<ShySites> getBusiness(ShySites shySites) {
45 List<ShySites> sitesList = shySitesMapper.select(shySites); 49 List<ShySites> sitesList = shySitesMapper.select(shySites);
@@ -142,22 +146,17 @@ public class CommentsServiceImpl { @@ -142,22 +146,17 @@ public class CommentsServiceImpl {
142 return comment; 146 return comment;
143 } 147 }
144 148
145 - public boolean updateState(String ids, Integer state, String userId) { 149 + public boolean updateState(String ids, Integer state, String userId,String updater,String msg) {
146 boolean success = true; 150 boolean success = true;
147 String[] commentIds = ids.split(","); 151 String[] commentIds = ids.split(",");
148 for (String commentId : commentIds) { 152 for (String commentId : commentIds) {
149 ShyComments comment = shyCommentsMapper.selectByPrimaryKey(Integer.parseInt(commentId)); 153 ShyComments comment = shyCommentsMapper.selectByPrimaryKey(Integer.parseInt(commentId));
150 -// if (!comment.getReceive() || CommonUtils.isEmpty(comment.getReceive_user_id()) || !userId.equals(comment.getReceive_user_id())) {  
151 -// logger.error("领取逻辑不符,不能审核,activity_id:{}", comment.getActivity_id());  
152 -// success = false;  
153 -// break;  
154 -// }  
155 154
156 JSONObject json = new JSONObject(); 155 JSONObject json = new JSONObject();
157 json.put("activity_id", comment.getActivity_id()); 156 json.put("activity_id", comment.getActivity_id());
158 json.put("state", state + 2); 157 json.put("state", state + 2);
159 json.put("attr_tags", ""); 158 json.put("attr_tags", "");
160 - json.put("msg", ""); 159 + json.put("msg", msg);
161 JSONObject result = new JSONObject(); 160 JSONObject result = new JSONObject();
162 try { 161 try {
163 result = Pass.commentPass(json, comment.getCallback()); 162 result = Pass.commentPass(json, comment.getCallback());
@@ -178,7 +177,14 @@ public class CommentsServiceImpl { @@ -178,7 +177,14 @@ public class CommentsServiceImpl {
178 break; 177 break;
179 } 178 }
180 comment.setState(state); 179 comment.setState(state);
181 - comment.setAuditor_id(userId); 180 + comment.setMsg(msg);
  181 + if(CommonUtils.isEmpty(userId)){
  182 + comment.setUpdater(updater);
  183 + }else{
  184 + comment.setAuditor_id(userId);
  185 + comment.setReceive(1);//已领取
  186 + comment.setReceive_user_id(userId);
  187 + }
182 int i = shyCommentsMapper.updateByPrimaryKeySelective(comment); 188 int i = shyCommentsMapper.updateByPrimaryKeySelective(comment);
183 if (i != 1) { 189 if (i != 1) {
184 success = false; 190 success = false;
@@ -242,6 +248,23 @@ public class CommentsServiceImpl { @@ -242,6 +248,23 @@ public class CommentsServiceImpl {
242 public int updateByPrimaryKeySelective(ShyComments comments) { 248 public int updateByPrimaryKeySelective(ShyComments comments) {
243 return shyCommentsMapper.updateByPrimaryKeySelective(comments); 249 return shyCommentsMapper.updateByPrimaryKeySelective(comments);
244 } 250 }
  251 +
  252 + /**
  253 + * 获得审核类型
  254 + * @param shyComments
  255 + */
  256 + public void getShenheType(ShyComments shyComments){
  257 +
  258 + //获取点播免审sp
  259 + List<Integer> sites = sitesService.getBusinessList(CommonConst.BUSINESS_COMMENT);
  260 + //初始化一个审核状态
  261 + Integer shenheType=3;//审核类型,1:免审,2:机审,3:人工审
  262 + //如果当前sp是免审sp
  263 + if(sites.contains(shyComments.getSpid())){
  264 + shenheType=1;//免审
  265 + }
  266 + shyComments.setShenhe_type(shenheType);
  267 + }
245 268
246 } 269 }
247 270
src/main/resources/templates/page/comment.html
@@ -65,13 +65,13 @@ @@ -65,13 +65,13 @@
65 class="btn btn-sm margin-r-5 action_bottom" 65 class="btn btn-sm margin-r-5 action_bottom"
66 onclick="searchStatus('0',0)">全部待领 66 onclick="searchStatus('0',0)">全部待领
67 </button> 67 </button>
68 - <button type="button" id="my_after_button" 68 + <button type="button" id="my_brfore_button"
69 class="btn btn-sm margin-r-5 action_bottom" 69 class="btn btn-sm margin-r-5 action_bottom"
70 - onclick="searchStatus('1,2',1)">我的已 70 + onclick="searchStatus('0',1)">我的待
71 </button> 71 </button>
72 - <button type="button" id="my_brfore_button" 72 + <button type="button" id="my_after_button"
73 class="btn btn-sm margin-r-5 action_bottom" 73 class="btn btn-sm margin-r-5 action_bottom"
74 - onclick="searchStatus('0',1)">我的未 74 + onclick="searchStatus('1,2',1)">我的已
75 </button> 75 </button>
76 </div> 76 </div>
77 <button type="button" class="btn btn-primary btn-sm margin-r-5" id="query" 77 <button type="button" class="btn btn-primary btn-sm margin-r-5" id="query"
@@ -241,7 +241,7 @@ @@ -241,7 +241,7 @@
241 <input data-index="0" name="btSelectItem" type="checkbox" 241 <input data-index="0" name="btSelectItem" type="checkbox"
242 th:value="${comment.id}"></td> 242 th:value="${comment.id}"></td>
243 <td style="text-align: center; width: 5%;" 243 <td style="text-align: center; width: 5%;"
244 - th:text="${session.sessionUser.company}">网加加 244 + th:text="${comment.spid_desc}">网加加
245 </td> 245 </td>
246 <td style="text-align: center; width: 5%;" 246 <td style="text-align: center; width: 5%;"
247 th:text="${comment.comment_user_name}">鱼 247 th:text="${comment.comment_user_name}">鱼