Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/1.6.2-qcloud
Conflicts: yudao-ui-admin/yarn.lockplp
commit
65a86e8d75
File diff suppressed because one or more lines are too long
@ -1,2 +1,3 @@
|
|||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration
|
cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration,\
|
||||||
|
cn.iocoder.yudao.framework.redis.config.YudaoCacheAutoConfiguration
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
<http://www.iocoder.cn/Spring-Boot/Cache/?yudao>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.test;
|
package cn.iocoder.yudao.framework.test.core.ut;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
|
import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
|
||||||
import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
|
import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.test;
|
package cn.iocoder.yudao.framework.test.core.ut;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
|
import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
|
||||||
import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
|
import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.system.test;
|
package cn.iocoder.yudao.framework.test.core.ut;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
|
import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
|
||||||
import cn.iocoder.yudao.framework.test.config.RedisTestConfiguration;
|
import cn.iocoder.yudao.framework.test.config.RedisTestConfiguration;
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
### 请求 /infra/test-demo/get 接口 => 成功
|
||||||
|
GET {{baseUrl}}/infra/test-demo/get?id=106
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
### 请求 /infra/test-demo/update 接口 => 成功
|
||||||
|
PUT {{baseUrl}}/infra/test-demo/update
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 106,
|
||||||
|
"name": "测试",
|
||||||
|
"status": "0",
|
||||||
|
"type": 1,
|
||||||
|
"category": 1
|
||||||
|
}
|
||||||
@ -1,16 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.infra.test;
|
|
||||||
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.quartz.Scheduler;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class QuartzTestConfiguration {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Scheduler scheduler() {
|
|
||||||
return Mockito.mock(Scheduler.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.service;
|
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.api.sensitiveword;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感词 API 接口
|
||||||
|
*
|
||||||
|
* @author 永不言败
|
||||||
|
*/
|
||||||
|
public interface SensitiveWordApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得文本所包含的不合法的敏感词数组
|
||||||
|
*
|
||||||
|
* @param text 文本
|
||||||
|
* @param tags 标签数组
|
||||||
|
* @return 不合法的敏感词数组
|
||||||
|
*/
|
||||||
|
List<String> validateText(String text, List<String> tags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断文本是否包含敏感词
|
||||||
|
*
|
||||||
|
* @param text 文本
|
||||||
|
* @param tags 表述数组
|
||||||
|
* @return 是否包含
|
||||||
|
*/
|
||||||
|
boolean isTextValid(String text, List<String> tags);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.api.sensitiveword;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.service.sensitiveword.SensitiveWordService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感词 API 实现类
|
||||||
|
*
|
||||||
|
* @author 永不言败
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SensitiveWordApiImpl implements SensitiveWordApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SensitiveWordService sensitiveWordService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> validateText(String text, List<String> tags) {
|
||||||
|
return sensitiveWordService.validateText(text, tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTextValid(String text, List<String> tags) {
|
||||||
|
return sensitiveWordService.isTextValid(text, tags);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
### 请求 /system/sensitive-word/validate-text 接口 => 成功
|
||||||
|
GET {{baseUrl}}/system/sensitive-word/validate-text?text=XXX&tags=短信&tags=蔬菜
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.sensitiveword;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.sensitiveword.SensitiveWordConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.sensitiveword.SensitiveWordDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.sensitiveword.SensitiveWordService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
|
@Api(tags = "管理后台 - 敏感词")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/sensitive-word")
|
||||||
|
@Validated
|
||||||
|
public class SensitiveWordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SensitiveWordService sensitiveWordService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@ApiOperation("创建敏感词")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sensitive-word:create')")
|
||||||
|
public CommonResult<Long> createSensitiveWord(@Valid @RequestBody SensitiveWordCreateReqVO createReqVO) {
|
||||||
|
return success(sensitiveWordService.createSensitiveWord(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@ApiOperation("更新敏感词")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sensitive-word:update')")
|
||||||
|
public CommonResult<Boolean> updateSensitiveWord(@Valid @RequestBody SensitiveWordUpdateReqVO updateReqVO) {
|
||||||
|
sensitiveWordService.updateSensitiveWord(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@ApiOperation("删除敏感词")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sensitive-word:delete')")
|
||||||
|
public CommonResult<Boolean> deleteSensitiveWord(@RequestParam("id") Long id) {
|
||||||
|
sensitiveWordService.deleteSensitiveWord(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@ApiOperation("获得敏感词")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sensitive-word:query')")
|
||||||
|
public CommonResult<SensitiveWordRespVO> getSensitiveWord(@RequestParam("id") Long id) {
|
||||||
|
SensitiveWordDO sensitiveWord = sensitiveWordService.getSensitiveWord(id);
|
||||||
|
return success(SensitiveWordConvert.INSTANCE.convert(sensitiveWord));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("获得敏感词分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sensitive-word:query')")
|
||||||
|
public CommonResult<PageResult<SensitiveWordRespVO>> getSensitiveWordPage(@Valid SensitiveWordPageReqVO pageVO) {
|
||||||
|
PageResult<SensitiveWordDO> pageResult = sensitiveWordService.getSensitiveWordPage(pageVO);
|
||||||
|
return success(SensitiveWordConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@ApiOperation("导出敏感词 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sensitive-word:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportSensitiveWordExcel(@Valid SensitiveWordExportReqVO exportReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
List<SensitiveWordDO> list = sensitiveWordService.getSensitiveWordList(exportReqVO);
|
||||||
|
// 导出 Excel
|
||||||
|
List<SensitiveWordExcelVO> datas = SensitiveWordConvert.INSTANCE.convertList02(list);
|
||||||
|
ExcelUtils.write(response, "敏感词.xls", "数据", SensitiveWordExcelVO.class, datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-tags")
|
||||||
|
@ApiOperation("获取所有敏感词的标签数组")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sensitive-word:query')")
|
||||||
|
public CommonResult<Set<String>> getSensitiveWordTags() throws IOException {
|
||||||
|
return success(sensitiveWordService.getSensitiveWordTags());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/validate-text")
|
||||||
|
@ApiOperation("获得文本所包含的不合法的敏感词数组")
|
||||||
|
public CommonResult<List<String>> validateText(@RequestParam("text") String text,
|
||||||
|
@RequestParam(value = "tags", required = false) List<String> tags) {
|
||||||
|
return success(sensitiveWordService.validateText(text, tags));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 敏感词创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SensitiveWordCreateReqVO extends SensitiveWordBaseVO {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 敏感词 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SensitiveWordRespVO extends SensitiveWordBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间", required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 敏感词更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SensitiveWordUpdateReqVO extends SensitiveWordBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.convert.sensitiveword;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordExcelVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.sensitiveword.SensitiveWordDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感词 Convert
|
||||||
|
*
|
||||||
|
* @author 永不言败
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SensitiveWordConvert {
|
||||||
|
|
||||||
|
SensitiveWordConvert INSTANCE = Mappers.getMapper(SensitiveWordConvert.class);
|
||||||
|
|
||||||
|
SensitiveWordDO convert(SensitiveWordCreateReqVO bean);
|
||||||
|
|
||||||
|
SensitiveWordDO convert(SensitiveWordUpdateReqVO bean);
|
||||||
|
|
||||||
|
SensitiveWordRespVO convert(SensitiveWordDO bean);
|
||||||
|
|
||||||
|
List<SensitiveWordRespVO> convertList(List<SensitiveWordDO> list);
|
||||||
|
|
||||||
|
PageResult<SensitiveWordRespVO> convertPage(PageResult<SensitiveWordDO> page);
|
||||||
|
|
||||||
|
List<SensitiveWordExcelVO> convertList02(List<SensitiveWordDO> list);
|
||||||
|
|
||||||
|
}
|
||||||
@ -1 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.system.dal.dataobject;
|
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.mysql.permission;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleMenuDO;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体 {@link RoleMenuDO} 的批量插入 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class RoleMenuBatchInsertMapper extends ServiceImpl<RoleMenuMapper, RoleMenuDO> {
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.mysql.permission;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体 {@link UserRoleDO} 的批量插入 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class UserRoleBatchInsertMapper extends ServiceImpl<UserRoleMapper, UserRoleDO> {
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.mysql.sensitiveword;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordExportReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.sensitiveword.SensitiveWordDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感词 Mapper
|
||||||
|
*
|
||||||
|
* @author 永不言败
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SensitiveWordMapper extends BaseMapperX<SensitiveWordDO> {
|
||||||
|
|
||||||
|
default PageResult<SensitiveWordDO> selectPage(SensitiveWordPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<SensitiveWordDO>()
|
||||||
|
.likeIfPresent(SensitiveWordDO::getName, reqVO.getName())
|
||||||
|
.likeIfPresent(SensitiveWordDO::getTags, reqVO.getTag())
|
||||||
|
.eqIfPresent(SensitiveWordDO::getStatus, reqVO.getStatus())
|
||||||
|
.betweenIfPresent(SensitiveWordDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||||
|
.orderByDesc(SensitiveWordDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<SensitiveWordDO> selectList(SensitiveWordExportReqVO reqVO) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<SensitiveWordDO>()
|
||||||
|
.likeIfPresent(SensitiveWordDO::getName, reqVO.getName())
|
||||||
|
.likeIfPresent(SensitiveWordDO::getTags, reqVO.getTag())
|
||||||
|
.eqIfPresent(SensitiveWordDO::getStatus, reqVO.getStatus())
|
||||||
|
.betweenIfPresent(SensitiveWordDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||||
|
.orderByDesc(SensitiveWordDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default SensitiveWordDO selectByName(String name) {
|
||||||
|
return selectOne(SensitiveWordDO::getName, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Select("SELECT id FROM system_sensitive_word WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||||
|
SensitiveWordDO selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.mq.consumer.sensitiveword;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.sensitiveword.SensitiveWordRefreshMessage;
|
||||||
|
import cn.iocoder.yudao.module.system.service.sensitiveword.SensitiveWordService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对 {@link SensitiveWordRefreshMessage} 的消费者
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class SensitiveWordRefreshConsumer extends AbstractChannelMessageListener<SensitiveWordRefreshMessage> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SensitiveWordService sensitiveWordService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(SensitiveWordRefreshMessage message) {
|
||||||
|
log.info("[onMessage][收到 SensitiveWord 刷新消息]");
|
||||||
|
sensitiveWordService.initLocalCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.mq.message.sensitiveword;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感词的刷新 Message
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SensitiveWordRefreshMessage extends AbstractChannelMessage {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getChannel() {
|
||||||
|
return "system.sensitive-word.refresh";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.mq.producer.sensitiveword;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.sensitiveword.SensitiveWordRefreshMessage;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感词相关的 Producer
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class SensitiveWordProducer {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisMQTemplate redisMQTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送 {@link SensitiveWordRefreshMessage} 消息
|
||||||
|
*/
|
||||||
|
public void sendSensitiveWordRefreshMessage() {
|
||||||
|
SensitiveWordRefreshMessage message = new SensitiveWordRefreshMessage();
|
||||||
|
redisMQTemplate.send(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.sensitiveword;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordExportReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.sensitiveword.SensitiveWordDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感词 Service 接口
|
||||||
|
*
|
||||||
|
* @author 永不言败
|
||||||
|
*/
|
||||||
|
public interface SensitiveWordService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化本地缓存
|
||||||
|
*/
|
||||||
|
void initLocalCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建敏感词
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createSensitiveWord(@Valid SensitiveWordCreateReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新敏感词
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateSensitiveWord(@Valid SensitiveWordUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除敏感词
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteSensitiveWord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得敏感词
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 敏感词
|
||||||
|
*/
|
||||||
|
SensitiveWordDO getSensitiveWord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得敏感词列表
|
||||||
|
*
|
||||||
|
* @return 敏感词列表
|
||||||
|
*/
|
||||||
|
List<SensitiveWordDO> getSensitiveWordList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得敏感词分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 敏感词分页
|
||||||
|
*/
|
||||||
|
PageResult<SensitiveWordDO> getSensitiveWordPage(SensitiveWordPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得敏感词列表, 用于 Excel 导出
|
||||||
|
*
|
||||||
|
* @param exportReqVO 查询条件
|
||||||
|
* @return 敏感词列表
|
||||||
|
*/
|
||||||
|
List<SensitiveWordDO> getSensitiveWordList(SensitiveWordExportReqVO exportReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得所有敏感词的标签数组
|
||||||
|
*
|
||||||
|
* @return 标签数组
|
||||||
|
*/
|
||||||
|
Set<String> getSensitiveWordTags();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得文本所包含的不合法的敏感词数组
|
||||||
|
*
|
||||||
|
* @param text 文本
|
||||||
|
* @param tags 标签数组
|
||||||
|
* @return 不合法的敏感词数组
|
||||||
|
*/
|
||||||
|
List<String> validateText(String text, List<String> tags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断文本是否包含敏感词
|
||||||
|
*
|
||||||
|
* @param text 文本
|
||||||
|
* @param tags 表述数组
|
||||||
|
* @return 是否包含
|
||||||
|
*/
|
||||||
|
boolean isTextValid(String text, List<String> tags);
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue