소스 검색

修改举报接口报错问题

qrs 3 달 전
부모
커밋
d78928ba7c
1개의 변경된 파일31개의 추가작업 그리고 27개의 파일을 삭제
  1. 31 27
      alien-store/src/main/java/shop/alien/store/service/impl/LifeUserViolationServiceImpl.java

+ 31 - 27
alien-store/src/main/java/shop/alien/store/service/impl/LifeUserViolationServiceImpl.java

@@ -106,17 +106,19 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
                     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());
+                    if(StringUtils.isNotEmpty(lifeuserViolation.getReportContextType()) && "1,2,3".contains(lifeuserViolation.getReportContextType())){
+                        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;
             }
@@ -139,22 +141,9 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
         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);
@@ -166,10 +155,25 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
 
         lifeNotice.setReceiverId(phoneId);
 
-
-        if(StringUtils.isNotEmpty(reportContextType)){
+        if(StringUtils.isNotEmpty(reportContextType) && "1,2,3".contains(reportContextType)){
             String violationType = StringUtils.isNotEmpty(lifeuserViolation.getViolationType())?lifeuserViolation.getViolationType():"13";
             String violationText = EnumUtil.getStatusValue(Integer.parseInt(violationType));
+
+            String storeOrUserName = "";
+            // 查询被举报用户信息
+            String reportedUserId = lifeuserViolation.getReportedUserId();
+            if ("1".equals(lifeuserViolation.getReportedUserType())) {
+                StoreUser storeUser = storeUserMapper.selectById(reportedUserId);
+                storeOrUserName = storeUser.getNickName();
+            } else {
+                LifeUser lifeUser = lifeUserMapper.selectById(reportedUserId);
+                storeOrUserName = lifeUser.getUserName();
+            }
+
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SimpleDateFormat simpleDateFormats = new SimpleDateFormat("yyyy-MM-dd");
+            String storeDate = simpleDateFormat.format(new Date());
+
             switch (reportContextType) {
                 case "1":
                     message = "您在" + storeDate + "举报用户“" + storeOrUserName + "”,涉嫌"+violationText+",已提交至平台审核,1-3个工作日会将审核结果发送到您应用内的消息-通知中,请注意查收。";