|
|
@@ -26,10 +26,12 @@ import shop.alien.store.config.WebSocketProcess;
|
|
|
import shop.alien.store.service.*;
|
|
|
import shop.alien.store.util.FunctionMagic;
|
|
|
import shop.alien.util.ali.AliOSSUtil;
|
|
|
+import shop.alien.util.common.EnumUtil;
|
|
|
import shop.alien.util.common.JwtUtil;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.Instant;
|
|
|
import java.time.ZoneId;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
@@ -75,6 +77,10 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
|
|
|
|
|
|
private final AliOSSUtil aliOSSUtil;
|
|
|
|
|
|
+ private final LifeUserDynamicsMapper lifeUserDynamicsMapper;
|
|
|
+
|
|
|
+ private final StoreCommentMapper storeCommentMapper;
|
|
|
+
|
|
|
@Value("${spring.web.resources.excel-path}")
|
|
|
private String excelPath;
|
|
|
|
|
|
@@ -86,21 +92,32 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
|
|
|
try {
|
|
|
int result = lifeUserViolationMapper.insert(lifeuserViolation);
|
|
|
if (result > 0) {
|
|
|
- if (lifeuserViolation.getReportContextType().equals("4") || lifeuserViolation.getReportContextType().equals("5")) {
|
|
|
- String phoneId = Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getString("userType") + "_" + JwtUtil.getCurrentUserInfo().getString("phone");
|
|
|
-
|
|
|
+ //String phoneId = Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getString("userType") + "_" + JwtUtil.getCurrentUserInfo().getString("phone");
|
|
|
+ // 举报人消息
|
|
|
LifeNotice lifeNotice = getLifeNotice(lifeuserViolation);
|
|
|
lifeNoticeMapper.insert(lifeNotice);
|
|
|
-
|
|
|
WebSocketVo websocketVo = new WebSocketVo();
|
|
|
websocketVo.setSenderId("system");
|
|
|
- websocketVo.setReceiverId(phoneId);
|
|
|
+ websocketVo.setReceiverId(lifeNotice.getReceiverId());
|
|
|
websocketVo.setCategory("notice");
|
|
|
websocketVo.setNoticeType("1");
|
|
|
websocketVo.setIsRead(0);
|
|
|
websocketVo.setText(com.alibaba.fastjson2.JSONObject.from(lifeNotice).toJSONString());
|
|
|
- webSocketProcess.sendMessage(phoneId, com.alibaba.fastjson2.JSONObject.from(websocketVo).toJSONString());
|
|
|
- }
|
|
|
+ webSocketProcess.sendMessage(lifeNotice.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVo).toJSONString());
|
|
|
+
|
|
|
+ // 被举报人消息
|
|
|
+ LifeNotice lifeNoticeReported = getLifeReportedNotice(lifeuserViolation);
|
|
|
+ if (lifeNoticeReported != null) {
|
|
|
+ lifeNoticeMapper.insert(lifeNoticeReported);
|
|
|
+ WebSocketVo websocketVoReported = new WebSocketVo();
|
|
|
+ websocketVoReported.setSenderId("system");
|
|
|
+ websocketVoReported.setReceiverId(lifeNoticeReported.getReceiverId());
|
|
|
+ websocketVoReported.setCategory("notice");
|
|
|
+ websocketVoReported.setNoticeType("1");
|
|
|
+ websocketVoReported.setIsRead(0);
|
|
|
+ websocketVoReported.setText(com.alibaba.fastjson2.JSONObject.from(lifeNoticeReported).toJSONString());
|
|
|
+ webSocketProcess.sendMessage(lifeNoticeReported.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVoReported).toJSONString());
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
@@ -110,20 +127,116 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- private static LifeNotice getLifeNotice(LifeUserViolation lifeuserViolation) {
|
|
|
+ private LifeNotice getLifeNotice(LifeUserViolation lifeuserViolation) {
|
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
String phoneId = null;
|
|
|
- if (data != null) {
|
|
|
- phoneId = data.getString("phone");
|
|
|
+// if (data != null) {
|
|
|
+// phoneId = data.getString("phone");
|
|
|
+// }
|
|
|
+ LifeNotice lifeNotice = new LifeNotice();
|
|
|
+ lifeNotice.setSenderId("system");
|
|
|
+ lifeNotice.setBusinessId(lifeuserViolation.getId());
|
|
|
+ lifeNotice.setTitle("举报通知");
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ String message = "平台已受理,感谢您的反馈!";
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ SimpleDateFormat simpleDateFormats = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String storeDate = simpleDateFormat.format(new Date());
|
|
|
+ String reportContextType = lifeuserViolation.getReportContextType();
|
|
|
+ String reportUserId = lifeuserViolation.getReportingUserId();
|
|
|
+ String reportedUserId = lifeuserViolation.getReportedUserId();
|
|
|
+ String storeOrUserName = "";
|
|
|
+ // 查询被举报用户信息
|
|
|
+
|
|
|
+ if ("1".equals(lifeuserViolation.getReportedUserType())) {
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(reportedUserId);
|
|
|
+ storeOrUserName = storeUser.getNickName();
|
|
|
+ } else {
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(reportedUserId);
|
|
|
+ storeOrUserName = lifeUser.getUserName();
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("1".equals(lifeuserViolation.getReportingUserType())) {
|
|
|
+ StoreUser storeUsers = storeUserMapper.selectById(reportUserId);
|
|
|
+ phoneId = "store_"+storeUsers.getPhone();
|
|
|
+ } else {
|
|
|
+ LifeUser lifeUsers = lifeUserMapper.selectById(reportUserId);
|
|
|
+ phoneId = "user_"+lifeUsers.getUserPhone();
|
|
|
+ }
|
|
|
+
|
|
|
+ lifeNotice.setReceiverId(phoneId);
|
|
|
+
|
|
|
+ String violationText = EnumUtil.getStatusValue(Integer.parseInt(lifeuserViolation.getViolationType()));
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(reportContextType)){
|
|
|
+ switch (reportContextType) {
|
|
|
+ case "1":
|
|
|
+ message = "您在" + storeDate + "举报用户“" + storeOrUserName + "”,涉嫌"+violationText+",已提交至平台审核,1-3个工作日会将审核结果发送到您应用内的消息-通知中,请注意查收。";
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ String dynamicsId = lifeuserViolation.getDynamicsId();
|
|
|
+ String dynamicsDate = simpleDateFormat.format(new Date());
|
|
|
+ if(StringUtils.isNotEmpty(dynamicsId)){
|
|
|
+ LifeUserDynamics lifeUserDynamics = lifeUserDynamicsMapper.selectById(dynamicsId);
|
|
|
+ dynamicsDate = simpleDateFormats.format(lifeUserDynamics.getCreatedTime());
|
|
|
+ }
|
|
|
+ message = "您在" + storeDate + "举报用户“" + storeOrUserName + "”在"+dynamicsDate+"发布的动态,涉嫌"+violationText+",已提交至平台审核,1-3个工作日会将审核结果发送到您应用内的消息-通知中,请注意查收。";
|
|
|
+ break;
|
|
|
+ case "3":
|
|
|
+ String commonId = lifeuserViolation.getCommentId();
|
|
|
+ String commonDate = simpleDateFormat.format(new Date());
|
|
|
+ if(StringUtils.isNotEmpty(commonId)){
|
|
|
+ StoreComment storeComment = storeCommentMapper.selectById(commonId);
|
|
|
+ commonDate = simpleDateFormats.format(storeComment.getCreatedTime());
|
|
|
+ }
|
|
|
+ message = "您在" + storeDate + "举报用户“" + storeOrUserName + "”在"+commonDate+"发布的评论,涉嫌"+violationText+",已提交至平台审核,1-3个工作日会将审核结果发送到您应用内的消息-通知中,请注意查收。";
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ jsonObject.put("message", message);
|
|
|
+ lifeNotice.setContext(jsonObject.toJSONString());
|
|
|
+ lifeNotice.setNoticeType(1);
|
|
|
+ return lifeNotice;
|
|
|
+ }
|
|
|
+
|
|
|
+ private LifeNotice getLifeReportedNotice(LifeUserViolation lifeuserViolation) throws Exception {
|
|
|
+
|
|
|
+ // 查询被举报用户信息
|
|
|
+ String reportUserId = lifeuserViolation.getReportedUserId();
|
|
|
+ String phoneId = "";
|
|
|
LifeNotice lifeNotice = new LifeNotice();
|
|
|
+
|
|
|
+ if ("1".equals(lifeuserViolation.getReportedUserType())) {
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(reportUserId);
|
|
|
+ phoneId = storeUser.getPhone();
|
|
|
+ lifeNotice.setReceiverId("store_" + phoneId);
|
|
|
+ } else {
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(reportUserId);
|
|
|
+ phoneId = lifeUser.getUserPhone();
|
|
|
+ lifeNotice.setReceiverId("user_" + phoneId);
|
|
|
+
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(phoneId)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String violationText = EnumUtil.getStatusValue(Integer.parseInt(lifeuserViolation.getViolationType()));
|
|
|
+
|
|
|
lifeNotice.setSenderId("system");
|
|
|
- lifeNotice.setReceiverId("user_" + phoneId);
|
|
|
lifeNotice.setBusinessId(lifeuserViolation.getId());
|
|
|
lifeNotice.setTitle("举报通知");
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("title", "平台已受理");
|
|
|
- jsonObject.put("message", "平台已受理,感谢您的反馈!");
|
|
|
+ String message = "";
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String storeDate = simpleDateFormat.format(new Date());
|
|
|
+ String reportContextType = lifeuserViolation.getReportContextType();
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(reportContextType) && reportContextType.equals("1")){
|
|
|
+ message = "您在" + storeDate + "被举报涉嫌"+violationText+",平台将会进行核实。如确实存在违规行为,平台将禁用您的账号**天,到期后账号可恢复使用,应用内的环境需要我们共同维护。";
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ jsonObject.put("message", message);
|
|
|
lifeNotice.setContext(jsonObject.toJSONString());
|
|
|
lifeNotice.setNoticeType(1);
|
|
|
return lifeNotice;
|
|
|
@@ -223,52 +336,94 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
|
|
|
v.setProcessingStatus(processingStatus);
|
|
|
v.setProcessingTime(new Date());
|
|
|
v.setReportResult(reportResult);
|
|
|
- StringBuilder b = new StringBuilder();
|
|
|
+ // 举报时间
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ SimpleDateFormat simpleDateFormats = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String violationTime = simpleDateFormat.format(v.getCreatedTime());
|
|
|
+ // 被举报人信息
|
|
|
+ String reportedUserName = "";
|
|
|
+ if(StringUtils.isNotEmpty(v.getReportedUserId())){
|
|
|
+ if (v.getReportedUserType().equals("1")) {
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(v.getReportedUserId());
|
|
|
+ reportedUserName = storeUser.getNickName();
|
|
|
+ } else{
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(v.getReportedUserId());
|
|
|
+ reportedUserName = lifeUser.getUserName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 被举报动态信息
|
|
|
+ String dynamicsId = v.getDynamicsId();
|
|
|
+ String dynamicsDate = simpleDateFormats.format(new Date());
|
|
|
+ if(StringUtils.isNotEmpty(dynamicsId)){
|
|
|
+ LifeUserDynamics lifeUserDynamics = lifeUserDynamicsMapper.selectById(dynamicsId);
|
|
|
+ dynamicsDate = simpleDateFormats.format(lifeUserDynamics.getCreatedTime());
|
|
|
+ }
|
|
|
+ // 被举报评论信息
|
|
|
+ String commonId = v.getCommentId();
|
|
|
+ String commonDate = simpleDateFormats.format(new Date());
|
|
|
+ if(StringUtils.isNotEmpty(commonId)){
|
|
|
+ StoreComment storeComment = storeCommentMapper.selectById(commonId);
|
|
|
+ commonDate = simpleDateFormats.format(storeComment.getCreatedTime());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 举报通知信息
|
|
|
+ String message = "";
|
|
|
+ // 被举报通知信息
|
|
|
+ String reportedMessage = "";
|
|
|
+ String title = "";
|
|
|
if (processingStatus.equals("1")) {
|
|
|
// 通过
|
|
|
if (v.getReportContextType().equals("1")) {
|
|
|
// 用户
|
|
|
- b.append("处理结果: 你的举报通过,已被处理 经核实,您举报的用户确实存在违规行为");
|
|
|
+ message = "您在"+violationTime+"举报用户“"+reportedUserName+"”,涉嫌违法违规,经核实,确实存在违规行为,平台已将用户禁用,感谢您为此做出的贡献。";
|
|
|
+ title = "用户举报成功通知";
|
|
|
}
|
|
|
if (v.getReportContextType().equals("2")) {
|
|
|
// 动态
|
|
|
- LifeUserDynamics dynamics = lifeUserDynamicsService.getById(v.getDynamicsId());
|
|
|
- b.append("处理结果: 你的举报通过,已被处理 经核实,您举报的动态'").append(dynamics.getContext()).append("' 确实存在违规行为,感谢您为社区环境做出的贡献。");
|
|
|
+ message = "您在"+violationTime+"举报用户“"+reportedUserName+"”在"+dynamicsDate+"发布的动态,涉嫌违法违规,经核实,确实存在违规行为,平台已将此动态下架,感谢您为此做出的贡献";
|
|
|
+ reportedMessage = "您在"+dynamicsDate+"发布的动态,经核实,确实存在违规行为,平台已将此动态下架,应用内的环境需要我们共同维护";
|
|
|
lifeUserDynamicsService.removeById(v.getDynamicsId());
|
|
|
+ title = "动态举报成功通知";
|
|
|
}
|
|
|
if (v.getReportContextType().equals("3")) {
|
|
|
// 评论
|
|
|
if (v.getReportedUserType().equals("1")) {
|
|
|
// 商户
|
|
|
- StoreComment storeComment = storeCommentService.getById(v.getCommentId());
|
|
|
- b.append("处理结果: 你的举报通过,已被处理 经核实,您举报的评论'").append(storeComment.getCommentContent()).append("'确实存在违规行为感谢您为社区环境做出的贡献。");
|
|
|
+ message = "您在"+violationTime+"举报用户“"+reportedUserName+"”在"+commonDate+"发布的评论,涉嫌违法违规,经核实,确实存在违规行为,平台已将此评论下架,感谢您为此做出的贡献。";
|
|
|
storeCommentService.removeById(v.getCommentId());
|
|
|
} else {
|
|
|
// 用户
|
|
|
- LifeComment lifeComment = lifeCommentMapper.selectById(v.getCommentId());
|
|
|
- b.append("处理结果: 你的举报通过,已被处理 经核实,您举报的评论'").append(lifeComment.getGudingPinglun()).append(" ").append(lifeComment.getShoudaPinglun()).append("'确实存在违规行为感谢您为社区环境做出的贡献。");
|
|
|
+ message = "您在"+violationTime+"举报用户“"+reportedUserName+"”在"+commonDate+"发布的评论,涉嫌违法违规,经核实,确实存在违规行为,平台已将此评论下架,感谢您为此做出的贡献。";
|
|
|
lifeCommentMapper.deleteById(v.getCommentId());
|
|
|
}
|
|
|
+ reportedMessage = "您在"+commonDate+"发布的评论,经核实,确实存在违规行为,平台已将此评论下架,应用内的环境需要我们共同维护。";
|
|
|
+ title = "评论举报成功通知";
|
|
|
}
|
|
|
} else {
|
|
|
// 驳回
|
|
|
switch (v.getReportContextType()) {
|
|
|
case "1":
|
|
|
- b.append("处理结果: 未检测到有违规行为经核实,该用户未存在违规行为,我们将会对该用户重点关注,感谢您为社区做出的贡献。");
|
|
|
+ message = "您在"+violationTime+"举报用户“"+reportedUserName+"”,涉嫌违法违规,经核实,不存在违规行为,感谢您为此做出的贡献。";
|
|
|
+ title = "用户举报失败通知";
|
|
|
break;
|
|
|
case "2":
|
|
|
- b.append("处理结果: 未检测到有违规行为经核实,该动态未存在违规行为,我们将会对该动态重点关注,感谢您为社区做出的贡献。");
|
|
|
+ message = "您在"+violationTime+"举报用户“"+reportedUserName+"”在"+dynamicsDate+"发布的动态,涉嫌违法违规,经核实,不存在违规行为,感谢您为此做出的贡献。";
|
|
|
+ title = "动态举报失败通知";
|
|
|
break;
|
|
|
case "3":
|
|
|
- b.append("处理结果: 未检测到有违规行为经核实,该评论未存在违规行为,我们将会对该评论重点关注,感谢您为社区做出的贡献。");
|
|
|
+ message = "您在"+violationTime+"举报用户“"+reportedUserName+"”在"+commonDate+"发布的评论,涉嫌违法违规,经核实,不存在违规行为,感谢您为此做出的贡献。";
|
|
|
+ title = "评论举报失败通知";
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
lifeUserViolationMapper.updateById(v);
|
|
|
LifeNotice LifeMessage = new LifeNotice();
|
|
|
- LifeMessage.setContext(b.toString());
|
|
|
+ com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
|
|
|
+ jsonObject.put("message", message);
|
|
|
+ LifeMessage.setContext(jsonObject.toJSONString());
|
|
|
LifeMessage.setSenderId("system");
|
|
|
LifeMessage.setIsRead(0);
|
|
|
+ LifeMessage.setTitle(title);
|
|
|
LifeMessage.setNoticeType(1);
|
|
|
LifeMessage.setBusinessId(id);
|
|
|
if (v.getReportingUserType().equals("1")) {
|
|
|
@@ -282,6 +437,57 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
|
|
|
|
|
|
}
|
|
|
lifeNoticeMapper.insert(LifeMessage);
|
|
|
+
|
|
|
+ WebSocketVo websocketVo = new WebSocketVo();
|
|
|
+ websocketVo.setSenderId("system");
|
|
|
+ websocketVo.setReceiverId(LifeMessage.getReceiverId());
|
|
|
+ websocketVo.setCategory("notice");
|
|
|
+ websocketVo.setNoticeType("1");
|
|
|
+ websocketVo.setIsRead(0);
|
|
|
+ websocketVo.setText(com.alibaba.fastjson2.JSONObject.from(LifeMessage).toJSONString());
|
|
|
+ try {
|
|
|
+ webSocketProcess.sendMessage(LifeMessage.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVo).toJSONString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("LifeUserViolationServiceImpl_approve Error Stack={}", e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 被举报通知
|
|
|
+ if(StringUtils.isNotEmpty(reportedMessage)) {
|
|
|
+ LifeNotice reportedLifeMessage = new LifeNotice();
|
|
|
+ com.alibaba.fastjson2.JSONObject jsonObjectReported = new com.alibaba.fastjson2.JSONObject();
|
|
|
+ jsonObjectReported.put("message", reportedMessage);
|
|
|
+ reportedLifeMessage.setContext(jsonObjectReported.toJSONString());
|
|
|
+ reportedLifeMessage.setSenderId("system");
|
|
|
+ reportedLifeMessage.setIsRead(0);
|
|
|
+ reportedLifeMessage.setTitle(title);
|
|
|
+ reportedLifeMessage.setNoticeType(1);
|
|
|
+ reportedLifeMessage.setBusinessId(id);
|
|
|
+ if (v.getReportedUserType().equals("1")) {
|
|
|
+ // M
|
|
|
+ StoreUser storeUser = storeUserService.getOne(new QueryWrapper<StoreUser>().eq("id", v.getReportedUserId()));
|
|
|
+ reportedLifeMessage.setReceiverId("store_" + storeUser.getPhone());
|
|
|
+ } else {
|
|
|
+ // U
|
|
|
+ LifeUser lifeUser = lifeUserService.getOne(new QueryWrapper<LifeUser>().eq("id", v.getReportedUserId()));
|
|
|
+ reportedLifeMessage.setReceiverId("user_" + lifeUser.getUserPhone());
|
|
|
+ }
|
|
|
+ lifeNoticeMapper.insert(reportedLifeMessage);
|
|
|
+
|
|
|
+ WebSocketVo websocketVoReported = new WebSocketVo();
|
|
|
+ websocketVoReported.setSenderId("system");
|
|
|
+ websocketVoReported.setReceiverId(reportedLifeMessage.getReceiverId());
|
|
|
+ websocketVoReported.setCategory("notice");
|
|
|
+ websocketVoReported.setNoticeType("1");
|
|
|
+ websocketVoReported.setIsRead(0);
|
|
|
+ websocketVoReported.setText(com.alibaba.fastjson2.JSONObject.from(reportedLifeMessage).toJSONString());
|
|
|
+ try {
|
|
|
+ webSocketProcess.sendMessage(reportedLifeMessage.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVoReported).toJSONString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("LifeUserViolationServiceImpl_reported_approve Error Stack={}", e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|