add 国标、外标、企标、动态消息,新增、编辑、删除时更新es数据库

This commit is contained in:
liao
2023-11-27 11:18:08 +08:00
parent c79e6025c4
commit 750874995c
3 changed files with 33 additions and 1 deletions
@@ -28,6 +28,8 @@ import com.jero.modules.laws.enterprise.service.EnterpriseStandardAuthUserServic
import com.jero.modules.laws.enterprise.service.EnterpriseStandardInspectContentService;
import com.jero.modules.laws.enterprise.util.EnterpriseStandardUtil;
import com.jero.modules.laws.enterprise.util.WaterMarkUtil;
import com.jero.modules.laws.home.common.LawsHomeSearchCommon;
import com.jero.modules.laws.home.service.ILawsHomeSearchService;
import com.jero.modules.laws.standard.entity.*;
import com.jero.modules.laws.standard.service.*;
import com.jero.modules.laws.standardization.entity.LawsStandardization;
@@ -146,6 +148,8 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
private ILawsEnterpriseStandardService lawsEnterpriseStandardService;
@Resource
private EnterpriseStandardAuthDeptService enterpriseAuthDeptService;
@Resource
private ILawsHomeSearchService lawsHomeSearchService;
/**
* @Author: liao
@@ -676,6 +680,10 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
lawsEnterpriseStandardService.update(esWrapper);
}
}
// 同步es数据库
lawsHomeSearchService.updateEsData(module, id, LawsHomeSearchCommon.LAWS_ES_ADD);
return ResultCommon.OK;
}
@@ -813,6 +821,9 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
esAuthUserService.resetAuthDept(id, parameterMap.get(FieldCommon.AUTH_DEPT).toString());
}
// 同步es数据库
lawsHomeSearchService.updateEsData(module, id, LawsHomeSearchCommon.LAWS_ES_UPDATE);
return ResultCommon.OK;
}
@@ -1184,6 +1195,10 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
List<String> idList = Arrays.asList(ids.split(","));
// 操作数据库进行删除操作
lawsCommonMapper.logicalDeleteByIdsAndModule(tableName, idList);
// 同步es数据库
lawsHomeSearchService.updateEsData(module, ids, LawsHomeSearchCommon.LAWS_ES_DELETE);
return MessageUtils.getMessage(ResultCommon.OK);
}
@@ -7,7 +7,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.Translation;
import com.jero.common.exception.JeroBootException;
import com.jero.common.util.MessageUtils;
import com.jero.common.api.vo.ResultCommon;
import com.jero.modules.laws.standard.entity.LawsNewsFeed;
import com.jero.modules.laws.standard.service.ILawsNewsFeedService;
@@ -9,6 +9,8 @@ import com.jero.modules.laws.common.constant.FieldCommon;
import com.jero.modules.laws.common.constant.MessageTemplateCodeCommon;
import com.jero.common.api.vo.ResultCommon;
import com.jero.modules.laws.common.util.CurrentUserUtil;
import com.jero.modules.laws.home.common.LawsHomeSearchCommon;
import com.jero.modules.laws.home.service.ILawsHomeSearchService;
import com.jero.modules.laws.standard.entity.LawsNewsFeed;
import com.jero.modules.laws.standard.entity.LawsPushRange;
import com.jero.modules.laws.standard.mapper.LawsNewsFeedMapper;
@@ -32,6 +34,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.annotation.Resource;
/**
* @Description: 动态消息
@@ -51,6 +55,8 @@ public class LawsNewsFeedServiceImpl extends ServiceImpl<LawsNewsFeedMapper, Law
private SendMessageAPI sendMessageAPI;
@Autowired
private ISysDictItemService sysDictItemService;
@Resource
private ILawsHomeSearchService lawsHomeSearchService;
/**
* 分页查询
@@ -126,6 +132,7 @@ public class LawsNewsFeedServiceImpl extends ServiceImpl<LawsNewsFeedMapper, Law
@Override
@Transactional
public void add(LawsNewsFeed lawsNewsFeed, String type) {
String oldId = lawsNewsFeed.getId();
if (StringUtils.isBlank(lawsNewsFeed.getDynamicHeading())) {
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "dynamicHeading");
}
@@ -169,6 +176,13 @@ public class LawsNewsFeedServiceImpl extends ServiceImpl<LawsNewsFeedMapper, Law
sendMsg(pushRange, lawsNewsFeed);
}
}
// 同步es数据库
if (StringUtils.isBlank(oldId)) {
lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_NEWS_FEED, lawsNewsFeed.getId(), LawsHomeSearchCommon.LAWS_ES_ADD);
} else {
lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_NEWS_FEED, lawsNewsFeed.getId(), LawsHomeSearchCommon.LAWS_ES_UPDATE);
}
}
/**
@@ -249,6 +263,8 @@ public class LawsNewsFeedServiceImpl extends ServiceImpl<LawsNewsFeedMapper, Law
throw new JeroBootException(ResultCommon.NO_PERMISSION);
}
removeById(id);
// 更新es数据库
lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_NEWS_FEED, id, LawsHomeSearchCommon.LAWS_ES_DELETE);
}
/**
@@ -262,6 +278,8 @@ public class LawsNewsFeedServiceImpl extends ServiceImpl<LawsNewsFeedMapper, Law
List<LawsNewsFeed> newsFeedList = listByIds(ids);
newsFeedList.forEach(lawsNewsFeed -> isHaveOperateAuth(lawsNewsFeed));
removeByIds(ids);
// 更新es数据库
lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_NEWS_FEED, StringUtils.join(ids, ","), LawsHomeSearchCommon.LAWS_ES_DELETE);
}
/**