From b3b566ebdfed4005aaa513da3d5d2fd3924903cc Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Wed, 31 Jan 2024 16:17:54 +0800
Subject: [PATCH] 拿不到地址总表数据,不设置网格信息

---
 src/main/java/org/springblade/modules/property/service/impl/PropertyCompanyCommentServiceImpl.java |   39 +++++++++++++++++++++++++++++++++------
 1 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/springblade/modules/property/service/impl/PropertyCompanyCommentServiceImpl.java b/src/main/java/org/springblade/modules/property/service/impl/PropertyCompanyCommentServiceImpl.java
index 43e140b..51c22f9 100644
--- a/src/main/java/org/springblade/modules/property/service/impl/PropertyCompanyCommentServiceImpl.java
+++ b/src/main/java/org/springblade/modules/property/service/impl/PropertyCompanyCommentServiceImpl.java
@@ -19,6 +19,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.logging.log4j.util.Strings;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.modules.property.entity.PropertyCompanyCommentEntity;
 import org.springblade.modules.property.entity.PropertyCompanyScoreEntity;
@@ -27,10 +28,13 @@
 import org.springblade.modules.property.mapper.PropertyCompanyCommentMapper;
 import org.springblade.modules.property.service.IPropertyCompanyCommentService;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.modules.words.WorksService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Map;
 
 /**
  * 物业公司评论表 服务实现类
@@ -43,6 +47,9 @@
 
 	@Autowired
 	private IPropertyCompanyScoreService propertyCompanyScoreService;
+
+	@Autowired
+	private WorksService worksService;
 
 	@Override
 	public IPage<PropertyCompanyCommentVO> selectPropertyCompanyCommentPage(IPage<PropertyCompanyCommentVO> page, PropertyCompanyCommentVO propertyCompanyComment) {
@@ -58,12 +65,32 @@
 	 */
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean saveOrUpdatePropertyCompanyComment(PropertyCompanyCommentVO propertyCompanyComment) {
-		boolean save = save(propertyCompanyComment);
-		// 更新评分
-		updatePropertyCompanyScore(propertyCompanyComment);
-		// 返回
-		return save;
+	public String saveOrUpdatePropertyCompanyComment(PropertyCompanyCommentVO propertyCompanyComment) {
+		boolean flag = false;
+		// 先进行敏感词过滤
+		Map<String, Object> map = worksService.interceptWords(propertyCompanyComment.getContent());
+		// 获取敏感词校验结果
+		String iswords = map.get("iswords").toString();
+		if (iswords.equals("false")){
+			// 审核通过
+			propertyCompanyComment.setCheckStatus(2);
+			flag = save(propertyCompanyComment);
+			// 更新评分
+			if(flag) {
+				updatePropertyCompanyScore(propertyCompanyComment);
+			}
+			// 返回
+			return "操作成功";
+		}else {
+			// 审核不通过
+			propertyCompanyComment.setCheckStatus(3);
+			// 设置审核不通过的说明
+			propertyCompanyComment.setCheckRemark(map.get("words").toString());
+			// 保存
+			save(propertyCompanyComment);
+			// 返回
+			return "当前评论内容中带有敏感词,当前评论无法生效!";
+		}
 	}
 
 	/**

--
Gitblit v1.9.3