Commit 6d18b645 authored by 刘基明's avatar 刘基明

查重

parent 384a8053
......@@ -17,7 +17,7 @@ import org.apache.ibatis.annotations.Update;
* @since 2021-09-08
*/
public interface ThemeCheckDuplicateMapper extends BaseMapper<ThemeCheckDuplicateEntity> {
@Update("update theme_check_duplicate set delete_tag=1 where theme_id =${id}")
@Update("update theme_check_duplicate set delete_tag=1 where theme_id =#{id}")
Long deleteByThemeId(@Param("id") String themeId);
@Select("select max(tmp.d) from (" +
......
......@@ -248,7 +248,7 @@ public class ThemeManager {
} catch (Exception e) {
log.error("error in save theme to ES. themeId:{}, error:{}", themeEntity.getThemeId(), ExceptionUtils.getStackTrace(e));
}
themeTextCheckService.insert(esThemeQo.getTextContent(), themeEntity.getThemeId(), userId, themeEntity.getThemeType());
themeTextCheckService.insert(esThemeQo.getTextContent(), themeEntity.getThemeId(), userId, themeEntity.getThemeType(),req.getEditThemeId());
redisCache.evict(StringUtils.joinWith("_", CACHE_THEME_ID, themeEntity.getThemeId()));
......
......@@ -25,8 +25,10 @@ public class ThemeTextCheckService {
private final String regex = "[,。!?;;:, ]";
// 插入
public void insert(String content, String themeId, String userId, Integer themeType) {
themeCheckDuplicateMapper.deleteByThemeId(themeId);
public void insert(String content, String themeId, String userId, Integer themeType, String editThemeId) {
if (StringUtils.isNotBlank(editThemeId)){
themeCheckDuplicateMapper.deleteByThemeId(editThemeId);
}
content = content.replaceAll(regex, "。");
String[] split = content.split("。");
for (int i = 0; i < split.length; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment