|
@@ -7,11 +7,12 @@ import com.hjy.common.core.page.TableDataInfo;
|
|
|
import com.hjy.common.enums.BusinessType;
|
|
|
import com.hjy.common.enums.CbNewsType;
|
|
|
import com.hjy.common.enums.WorkFlowServiceEnums;
|
|
|
-import com.hjy.module.domain.news.CbNews;
|
|
|
import com.hjy.module.mapper.news.CbNewsMapper;
|
|
|
import com.hjy.module.service.news.ICbNewsService;
|
|
|
+import com.hjy.module.service.portal.ICbSensitiveService;
|
|
|
import com.hjy.module.service.wf.IWfInstActionTaskService;
|
|
|
import com.hjy.module.vo.news.CbNewsVo;
|
|
|
+import com.hjy.module.vo.portal.CbSensitiveVo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -19,6 +20,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+
|
|
|
/**
|
|
|
* 网站新闻Controller
|
|
|
*
|
|
@@ -36,6 +41,8 @@ public class CbNewsController extends BaseController {
|
|
|
|
|
|
private final IWfInstActionTaskService wfInstActionTaskService;
|
|
|
|
|
|
+ private final ICbSensitiveService cbSensitiveService;
|
|
|
+
|
|
|
@ApiOperation("查询网站新闻列表")
|
|
|
@PreAuthorize("@ss.hasPermi('business:NEWS:list')")
|
|
|
@GetMapping("/list")
|
|
@@ -55,6 +62,20 @@ public class CbNewsController extends BaseController {
|
|
|
@Log(title = "网站新闻", businessType = BusinessType.INSERT)
|
|
|
@PostMapping("add")
|
|
|
public AjaxResult add(@RequestBody CbNewsVo entity) {
|
|
|
+ // 获取敏感集合
|
|
|
+ List<CbSensitiveVo> list = cbSensitiveService.queryAll(new CbSensitiveVo());
|
|
|
+
|
|
|
+ for (CbSensitiveVo sensitive : list) {
|
|
|
+ // 构建匹配模式,允许分隔符或特殊字符在敏感词中间
|
|
|
+ String regex = "\\b" + Pattern.quote(sensitive.getSensitive()) + "\\b";
|
|
|
+ Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
|
|
|
+
|
|
|
+ Matcher matcher = pattern.matcher(entity.getContent());
|
|
|
+
|
|
|
+ if (matcher.find()) {
|
|
|
+ return AjaxResult.error("包含敏感字符,请修改");
|
|
|
+ }
|
|
|
+ }
|
|
|
cbNewsService.save(entity);
|
|
|
if (!CbNewsType.DRAFTS.getCode().equals(entity.getStatus())){
|
|
|
wfInstActionTaskService.statrWfqueue(WorkFlowServiceEnums.NEWSSERVICE.getService(), entity.getId(), "新闻新增审核");
|