From 499fcf4b24c104c7c627d0951d96fabdf8cb0631 Mon Sep 17 00:00:00 2001
From: yanghui <2536613402@qq.com>
Date: 星期一, 10 十月 2022 12:08:23 +0800
Subject: [PATCH] #feat 提交微信违规信息校验

---
 springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java |   86 +++++++++++++++++++++++++++---------------
 1 files changed, 55 insertions(+), 31 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java
index 9d79434..767556f 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java
@@ -1,25 +1,21 @@
 package com.panzhihua.applets.api;
 
+import cn.hutool.core.util.StrUtil;
 import com.panzhihua.applets.weixin.CheckService;
 import com.panzhihua.common.constants.NeighborCircleConstants;
-import javax.annotation.Resource;
-
-import com.panzhihua.common.model.vos.neighbor.*;
-import io.swagger.annotations.ApiModelProperty;
-import org.springframework.web.bind.annotation.*;
-
 import com.panzhihua.common.controller.BaseController;
 import com.panzhihua.common.model.dtos.neighbor.*;
 import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.model.vos.R;
+import com.panzhihua.common.model.vos.neighbor.*;
 import com.panzhihua.common.service.community.CommunityService;
 import com.panzhihua.common.utlis.StringUtils;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
 
-import static java.util.Objects.isNull;
+import javax.annotation.Resource;
 
 /**
  * @auther lyq
@@ -66,39 +62,52 @@
         LoginUserInfoVO loginUser = this.getLoginUserInfo();
         Long userId = loginUser.getUserId();
         Long communityId = loginUser.getCommunityId();
-        if(userId == null){
+        if (userId == null) {
             return R.fail("请重新登录");
+        }
+        String releaseContent = addNeighborCircleAppDTO.getReleaseContent();
+        if (StrUtil.isNotBlank(releaseContent)) {
+            String result = checkService.checkMessageBy(releaseContent, this.getLoginUserInfo().getOpenid(), this.getAppId());
+            if (StrUtil.isNotBlank(result)) {
+                return R.fail("填写内容存在 " + result + " 违规信息");
+            }
+        }
+        String releaseImages = addNeighborCircleAppDTO.getReleaseImages();
+        if (StrUtil.isNotBlank(releaseImages)) {
+            if (checkService.checkImageBy(releaseImages, this.getAppId())) {
+                return R.fail("上传图片存在违规信息");
+            }
         }
         addNeighborCircleAppDTO.setUserId(userId);
         if (StringUtils.isNotEmpty(loginUser.getPhone())) {
             addNeighborCircleAppDTO.setPhone(this.getLoginUserInfo().getPhone());
         }
-        if(communityId != null){
+        if (communityId != null) {
             addNeighborCircleAppDTO.setCommunityId(communityId);
         }
 
         //查询社区自动审核是否开着
         String key = NeighborCircleConstants.NEIGHBOR_CIRCLE_AUTO_EXAMINE;
-        R isOk = communityService.getSysConfValue(key + communityId,communityId);
-        if(R.isOk(isOk)){
-            if(isOk.getData() != null){
+        R isOk = communityService.getSysConfValue(key + communityId, communityId);
+        if (R.isOk(isOk)) {
+            if (isOk.getData() != null) {
                 String value = isOk.getData().toString();
-                if(value.equals("1")){
+                if (value.equals("1")) {
                     addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.no);
                     String msg = addNeighborCircleAppDTO.getReleaseContent();
                     if (checkService.checkMessage(msg)) {
                         addNeighborCircleAppDTO.setWxExamineResult(AddComActNeighborCircleAppDTO.isExamine.yes);
-                    }else{
+                    } else {
                         addNeighborCircleAppDTO.setWxExamineResult(AddComActNeighborCircleAppDTO.isExamine.no);
                     }
-                }else{
+                } else {
                     addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.yes);
                 }
-            }else{
-                communityService.addSysConfValue(key + communityId,communityId,"社区邻里圈自动审核参数","1");
+            } else {
+                communityService.addSysConfValue(key + communityId, communityId, "社区邻里圈自动审核参数", "1");
                 addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.no);
             }
-        }else{
+        } else {
             addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.yes);
         }
 
@@ -164,6 +173,13 @@
         if (userId == null) {
             return R.fail("请先登录");
         }
+        String content = commentAppDTO.getContent();
+        if (StrUtil.isNotBlank(content)) {
+            String result = checkService.checkMessageBy(content, this.getLoginUserInfo().getOpenid(), this.getAppId());
+            if (StrUtil.isNotBlank(result)) {
+                return R.fail("填写内容存在 " + result + " 违规信息");
+            }
+        }
         commentAppDTO.setUserId(userId);
         return communityService.neighborCommentByApp(commentAppDTO);
     }
@@ -174,6 +190,13 @@
         Long userId = this.getLoginUserInfo().getUserId();
         if (userId == null) {
             return R.fail("请先登录");
+        }
+        String content = replyAppDTO.getContent();
+        if (StrUtil.isNotBlank(content)) {
+            String result = checkService.checkMessageBy(content, this.getLoginUserInfo().getOpenid(), this.getAppId());
+            if (StrUtil.isNotBlank(result)) {
+                return R.fail("填写内容存在 " + result + " 违规信息");
+            }
         }
         replyAppDTO.setUserId(userId);
         return communityService.neighborReplyByApp(replyAppDTO);
@@ -219,7 +242,7 @@
     @ApiOperation(value = "查询社区邻里圈话题列表", response = ComActNeighborCircleTopicAppVO.class)
     @GetMapping("topic/list")
     public R getNeighborTopicByApp(
-            @RequestParam(value = "name",defaultValue = "",required = false) String name) {
+            @RequestParam(value = "name", defaultValue = "", required = false) String name) {
         return communityService.getNeighborTopicByApp(name);
     }
 
@@ -227,8 +250,8 @@
     @PostMapping("delete")
     public R deleteNeighborByApp(@RequestBody DeleteNeighborCircleAppDTO circleTopicAppDTO) {
         LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin();
-        if(loginUserInfo == null){
-            return R.fail(401,"请先登录");
+        if (loginUserInfo == null) {
+            return R.fail(401, "请先登录");
         }
         circleTopicAppDTO.setUserId(loginUserInfo.getUserId());
         circleTopicAppDTO.setCommunityId(loginUserInfo.getCommunityId());
@@ -238,11 +261,10 @@
     /**
      * 分页查询邻里圈列表
      *
-     * @param neighborCircleAppDTO
-     *            请求参数
+     * @param neighborCircleAppDTO 请求参数
      * @return 邻里圈列表
      */
-    @ApiOperation(value = "新版接单问题",response =ComActNeighborCircleAppVO.class )
+    @ApiOperation(value = "新版接单问题", response = ComActNeighborCircleAppVO.class)
     @PostMapping("selectSolve")
     public R selectSolve(@RequestBody ComActNeighborCircleAppDTO neighborCircleAppDTO) {
         neighborCircleAppDTO.setUserId(this.getUserId());
@@ -252,31 +274,33 @@
 
     /**
      * 修改数据
+     *
      * @param editNeighborCircleAdminVO
      * @return
      */
-    @ApiOperation(value = "接单 反馈",response =ComActNeighborCircleAppVO.class )
+    @ApiOperation(value = "接单 反馈", response = ComActNeighborCircleAppVO.class)
     @PostMapping("update")
-    public R order(@RequestBody EditNeighborCircleAdminVO editNeighborCircleAdminVO){
+    public R order(@RequestBody EditNeighborCircleAdminVO editNeighborCircleAdminVO) {
         return this.communityService.order(editNeighborCircleAdminVO);
     }
 
-    @ApiOperation(value = "服务统计",response = ServiceStaticsVO.class)
+    @ApiOperation(value = "服务统计", response = ServiceStaticsVO.class)
     @PostMapping("/serviceStatic")
-    public R serviceStatic(@RequestBody ServiceStaticDTO serviceStaticDTO){
+    public R serviceStatic(@RequestBody ServiceStaticDTO serviceStaticDTO) {
         return this.communityService.serviceStatic(serviceStaticDTO);
     }
 
     /**
      * 求助我的问题数量统计
+     *
      * @param type
      * @param phone
      * @return
      */
     @ApiOperation(value = "求助我的问题数量统计")
     @GetMapping("/selectCount")
-    public R selectCount(@RequestParam("type")Integer type,@RequestParam(value = "phone",required = false)String phone,@RequestParam("communityId")Long communityId){
-        return this.communityService.selectCount(type,phone,communityId);
+    public R selectCount(@RequestParam("type") Integer type, @RequestParam(value = "phone", required = false) String phone, @RequestParam("communityId") Long communityId) {
+        return this.communityService.selectCount(type, phone, communityId);
     }
 }
 

--
Gitblit v1.7.1