mitao
2025-05-20 179c4d64313c9b7572778da4aaaf6c6584fe457d
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborWestApi.java
@@ -1,13 +1,11 @@
package com.panzhihua.applets.api;
import cn.hutool.core.util.StrUtil;
import com.panzhihua.applets.weixin.CheckService;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.constants.NeighborCircleConstants;
import javax.annotation.Resource;
import com.panzhihua.common.model.dtos.neighbor.*;
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.ComActNeighborCircleAppVO;
@@ -16,10 +14,12 @@
import com.panzhihua.common.model.vos.neighbor.ComActNeighborCommentReplyAppVO;
import com.panzhihua.common.service.community.CommunityWestService;
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 javax.annotation.Resource;
/**
 * @auther lyq
@@ -54,41 +54,68 @@
        LoginUserInfoVO loginUser = this.getLoginUserInfo();
        Long userId = loginUser.getUserId();
        Long communityId = loginUser.getCommunityId();
        if(userId == null){
        if (userId == null) {
            return R.fail("请重新登录");
        }
        addNeighborCircleAppDTO.setUserId(userId);
        String openid = this.getLoginUserInfo().getOpenid();
        String appId = this.getAppId();
        // 微信内容审核
        String releaseContent = addNeighborCircleAppDTO.getReleaseContent();
        if (StrUtil.isNotBlank(releaseContent)) {
            String result = checkService.checkMessageBy(releaseContent, openid, appId);
            if (StrUtil.isNotBlank(result)) {
                return R.fail(501, "填写内容存在 " + result + " 违规信息");
            }
        }
        //微信图片审核
        String releaseImages = addNeighborCircleAppDTO.getReleaseImages();
        if (StrUtil.isNotBlank(releaseImages)) {
            if (!checkService.checkImageBy(releaseImages, appId)) {
                return R.fail(501, "上传图片存在违规信息");
            }
        }
        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 = communityWestService.getSysConfValue(key + communityId,communityId);
        if(R.isOk(isOk)){
            if(isOk.getData() != null){
                String value = isOk.getData().toString();
                if(value.equals("1")){
                    addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.no);
                    String msg = addNeighborCircleAppDTO.getReleaseContent();
                    if (checkService.checkMessage(msg)) {
                        addNeighborCircleAppDTO.setWxExamineResult(AddComActNeighborCircleAppDTO.isExamine.yes);
                    }else{
                        addNeighborCircleAppDTO.setWxExamineResult(AddComActNeighborCircleAppDTO.isExamine.no);
        if(this.getAppId().equals("wx118de8a734d269f0")){
            //花城直接通过
            addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.no);
            addNeighborCircleAppDTO.setWxExamineResult(AddComActNeighborCircleAppDTO.isExamine.yes);
        }else {
            //查询社区自动审核是否开着
            String key = NeighborCircleConstants.NEIGHBOR_CIRCLE_AUTO_EXAMINE;
            R isOk = communityWestService.getSysConfValue(key + communityId, communityId);
            if (R.isOk(isOk)) {
                if (isOk.getData() != null) {
                    String value = isOk.getData().toString();
                    if (value.equals("1")) {
                        addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.no);
                        String msg = addNeighborCircleAppDTO.getReleaseContent();
                        if (StrUtil.isEmpty(checkService.checkMessageBy(msg,this.getLoginUserInfo().getOpenid(),this.getAppId()))) {
                            addNeighborCircleAppDTO.setWxExamineResult(AddComActNeighborCircleAppDTO.isExamine.yes);
                        } else {
                            addNeighborCircleAppDTO.setWxExamineResult(AddComActNeighborCircleAppDTO.isExamine.no);
                        }
                    } else {
                        addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.yes);
                    }
                }else{
                    addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.yes);
                } else {
                    communityWestService.addSysConfValue(key + communityId, communityId, "社区邻里圈自动审核参数", "1");
                    addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.no);
                }
            }else{
                communityWestService.addSysConfValue(key + communityId,communityId,"社区邻里圈自动审核参数","1");
                addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.no);
            } else {
                addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.yes);
            }
        }else{
            addNeighborCircleAppDTO.setIsExamine(AddComActNeighborCircleAppDTO.isExamine.yes);
        }
        return communityWestService.addNeighborByApp(addNeighborCircleAppDTO);
    }
@@ -153,6 +180,16 @@
            return R.fail("请先登录");
        }
        commentAppDTO.setUserId(userId);
        String openid = this.getLoginUserInfo().getOpenid();
        String appId = this.getAppId();
        // 微信内容审核
        String content = commentAppDTO.getContent();
        if (StrUtil.isNotBlank(content)) {
            String result = checkService.checkMessageBy(content, openid, appId);
            if (StrUtil.isNotBlank(result)) {
                return R.fail(501, "填写内容存在 " + result + " 违规信息");
            }
        }
        return communityWestService.neighborCommentByApp(commentAppDTO);
    }
@@ -207,24 +244,24 @@
    @ApiOperation(value = "查询社区邻里圈话题列表", response = ComActNeighborCircleTopicAppVO.class)
    @GetMapping("topic/list")
    public R getNeighborTopicByApp(@RequestParam("communityId") Long communityId
            ,@RequestParam(value = "isZero",defaultValue = "2",required = false) Integer isZero
            ,@RequestParam(value = "name",defaultValue = "",required = false) String name) {
            , @RequestParam(value = "isZero", defaultValue = "2", required = false) Integer isZero
            , @RequestParam(value = "name", defaultValue = "", required = false) String name) {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin();
        if (loginUserInfo != null) {
            communityId = loginUserInfo.getCommunityId();
        }
        if(isZero == null){
        if (isZero == null) {
            isZero = 2;
        }
        return communityWestService.getNeighborTopicByApp(communityId,isZero,name);
        return communityWestService.getNeighborTopicByApp(communityId, isZero, name);
    }
    @ApiOperation(value = "用户新增邻里圈话题")
    @PostMapping("topic/add")
    public R addNeighborTopicByApp(@RequestBody AddNeighborCircleTopicAppDTO 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());
@@ -235,8 +272,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());