feat: There is no way the, es 只更新全部规则排序字段
This commit is contained in:
@@ -125,6 +125,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetALLSearchCenter");
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/manualResetALLSearchCenter");
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetALLSearchCenterToSearch");
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetALLSearchCenterToFields");
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetAStandSearchCenter");
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetBLawsSearchCenter");
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetCBussStandSearchCenter");
|
||||
|
||||
@@ -9,6 +9,8 @@ public interface StandLawsSearchService {
|
||||
|
||||
String addStandLawsSearch(StandLawsEO standLawsEO);
|
||||
|
||||
String updateEsFulltextserch(Map<String,Object> fullTextSearchEO);
|
||||
|
||||
String addStandLawsSearchForMap(Map<String,Object> attrInfoMap);
|
||||
|
||||
// String updateStandLawsSearch(StandLawsEO standLawsEO);
|
||||
|
||||
+19
@@ -67,6 +67,25 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
|
||||
return indexstate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateEsFulltextserch(Map<String,Object> fullTextSearchEO){
|
||||
Set<String> keys = fullTextSearchEO.keySet();
|
||||
for (String key:keys) {
|
||||
String value = String.valueOf(fullTextSearchEO.get(key));
|
||||
if (StringUtils.isNotBlank(value) && !"null".equals(value)){
|
||||
value = value.replace(","," , ");
|
||||
fullTextSearchEO.put(key,value);
|
||||
}
|
||||
}
|
||||
String result = "";
|
||||
String id = String.valueOf(fullTextSearchEO.get("id"));
|
||||
// 方便全文检索,重新建索引
|
||||
if(StringUtils.isNotBlank(id) && elasticsearchService.isIndexExist("fulltextserch")){
|
||||
result = elasticsearchService.updateDataByIdForMap(fullTextSearchEO,"fulltextserch","fulltextserch",id);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateStandLawsSearchForMap(Map<String,Object> attrInfoMap){
|
||||
Set<String> keys = attrInfoMap.keySet();
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.adc.da.mq;
|
||||
|
||||
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CreateEsMQService {
|
||||
@Autowired
|
||||
private AmqpTemplate rabbitTemplate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param standMap 全文检索存储Map
|
||||
* @param addOrUpdate
|
||||
*/
|
||||
public void sendEsUpdFullMQ(Map<String,Object> standMap, String addOrUpdate){
|
||||
standMap.put("addOrUpdate", addOrUpdate);
|
||||
|
||||
//发送消息队列
|
||||
this.rabbitTemplate.convertAndSend("esUpdFull-exchange_SQ_GSAR_RELEASE", "esUpdFull-key_SQ_GSAR_RELEASE", standMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.adc.da.mq;
|
||||
|
||||
import com.adc.da.search.service.StandLawsSearchService;
|
||||
import com.adc.da.slrs.otSvpps.service.IOtSvppsService;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.json.JSONTokener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class SendEsUpdFullMQService {
|
||||
|
||||
@Autowired
|
||||
private ISarStandardsInfoService sarStandardsInfoService;
|
||||
|
||||
@Autowired
|
||||
private StandLawsSearchService standLawsSearchService;
|
||||
|
||||
@Autowired
|
||||
private SysInfoEOService sysInfoEOService;
|
||||
|
||||
@Autowired
|
||||
private DicTypeEODao dicTypeEODao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IOtSvppsService otSvppsEOService;
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SendEsUpdFullMQService.class);
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(value = "CreateEsUpdFullMQ_SQ_GSAR_RELEASE", durable = "true"),
|
||||
exchange = @Exchange(value = "esUpdFull-exchange_SQ_GSAR_RELEASE", ignoreDeclarationExceptions = "true"),
|
||||
key = "esUpdFull-key_SQ_GSAR_RELEASE"))
|
||||
public void createMQ(Map<String,Object> standMap, Message message, Channel channel) throws Exception{
|
||||
try{
|
||||
try{
|
||||
Thread.sleep(5000);
|
||||
insertOrUpdateStandInfo(standMap);
|
||||
}catch(InterruptedException e){
|
||||
logger.error(e.toString());
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索中心-多字段更新-标准消息队列进入添加数据方法前失败!");
|
||||
logger.error(e.getMessage(),e);
|
||||
}finally {
|
||||
Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
channel.basicAck(tag,false);
|
||||
logger.debug("搜索中心-多字段更新-消息确认成功!!!!!!!!!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void insertOrUpdateStandInfo(Map<String,Object> standMap){
|
||||
String addOrUpdate = standMap.get("addOrUpdate").toString();
|
||||
|
||||
if("add".equals(addOrUpdate)){
|
||||
// standLawsSearchService.addStandLawsSearchForMap(attrInfoMap);
|
||||
} else {
|
||||
standLawsSearchService.updateEsFulltextserch(standMap);
|
||||
}
|
||||
}
|
||||
|
||||
private String filterStringIsNotBlank(String str,boolean boo){
|
||||
String f = ",";
|
||||
return (str == null || str.equals("") || str.equals("null")) ? "" : (boo ? str+f : str);
|
||||
}
|
||||
|
||||
private String dateFormatToStr(String dateStr){
|
||||
if(dateStr == null || dateStr.equals("")){
|
||||
return "";
|
||||
}
|
||||
String dateToStr = "";
|
||||
try {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
dateToStr = dateFormat.format(dateFormat.parse(dateStr.trim().substring(0,10)));
|
||||
}catch (Exception e){
|
||||
e.getMessage();
|
||||
}
|
||||
return dateToStr;
|
||||
}
|
||||
|
||||
public Map<String,Object> dealNumberMsg (Map<String,Object> saveMap,SarStandardsInfo infoEO,String getCodeName) {
|
||||
if(StringUtils.isNotEmpty(infoEO.getStandYear())){
|
||||
String number = getCodeName + " " + infoEO.getStandNumber() + "-" + infoEO.getStandYear();
|
||||
saveMap.put("numbershow",number);
|
||||
int index = infoEO.getStandNumber().indexOf(".");
|
||||
int index1 = infoEO.getStandNumber().indexOf(":");
|
||||
String numberExpNull = "";
|
||||
if(index > -1){
|
||||
numberExpNull = (getCodeName + infoEO.getStandNumber() + "-" + number.replaceAll(" ","")
|
||||
+ "-" + getCodeName + infoEO.getStandNumber().substring(0,index) + "-" + infoEO.getStandNumber().substring(0,index));
|
||||
} else if (index1 > -1) {
|
||||
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + number.replaceAll(" ","")
|
||||
+ "-" + getCodeName + infoEO.getStandNumber().substring(0,index1) + "-" + infoEO.getStandNumber().substring(0,index1);
|
||||
} else {
|
||||
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + number.replaceAll(" ","");
|
||||
}
|
||||
saveMap.put("numberExpNull",numberExpNull);
|
||||
} else {
|
||||
String num = getCodeName + " " + infoEO.getStandNumber();
|
||||
saveMap.put("numbershow",num);
|
||||
int index = infoEO.getStandNumber().indexOf(".");
|
||||
String numberExpNull = "";
|
||||
if(index > -1){
|
||||
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + num.replaceAll(" ","")
|
||||
+ "-" + getCodeName + infoEO.getStandNumber().substring(0,index) + "-" + infoEO.getStandNumber().substring(0,index);
|
||||
} else {
|
||||
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + num.replaceAll(" ","");
|
||||
}
|
||||
saveMap.put("numberExpNull",numberExpNull);
|
||||
}
|
||||
return saveMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.adc.da.search;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.search.bean.SearchCenter;
|
||||
import com.adc.da.search.bean.SearchFields;
|
||||
import com.adc.da.search.server.ResetSearchCenterService;
|
||||
import com.adc.da.slrs.sarLawsInfo.page.SarLawsInfoEOPage;
|
||||
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfoPage;
|
||||
@@ -32,6 +33,13 @@ public class ResetSearchCenterController extends BaseController<Map<String, Obje
|
||||
@Autowired
|
||||
private ResetSearchCenterService resetSearchCenterService;
|
||||
|
||||
@ApiOperation(value = "|Search|ES规则排序字段重置数据维护ES")
|
||||
@PostMapping(value = "/resetALLSearchCenterToFields")
|
||||
public ResponseMessage resetALLSearchCenterToFields(@RequestBody SearchFields searchFields) throws Exception {
|
||||
|
||||
return resetSearchCenterService.resetALLSearchCenterToFields(searchFields);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|Search|文本条件搜索更新标准数据索引")
|
||||
@PostMapping(value="/resetALLSearchCenterToSearch")
|
||||
public ResponseMessage resetALLSearchCenterToSearch(@RequestBody SearchCenter searchCenter) throws Exception{
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.search.bean;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
*/
|
||||
@Data
|
||||
public class SearchFields {
|
||||
|
||||
@ApiModelProperty(value = "根据搜索条件")
|
||||
private String search;
|
||||
}
|
||||
@@ -2,9 +2,11 @@ package com.adc.da.search.server;
|
||||
|
||||
import com.adc.da.att.entity.AttFileEO;
|
||||
import com.adc.da.att.service.IAttFileEOService;
|
||||
import com.adc.da.mq.CreateEsMQService;
|
||||
import com.adc.da.mq.CreateStandMQService;
|
||||
import com.adc.da.person.service.IPersonCollectEOService;
|
||||
import com.adc.da.search.bean.SearchCenter;
|
||||
import com.adc.da.search.bean.SearchFields;
|
||||
import com.adc.da.search.service.ElasticsearchService;
|
||||
import com.adc.da.slrs.sarBussStandAttrInfo.dao.SarBussStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
@@ -26,6 +28,7 @@ import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.sys.entity.DicTypeEO;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.utils.util.DateUtil;
|
||||
@@ -92,6 +95,9 @@ public class ResetSearchCenterService {
|
||||
@Autowired
|
||||
private CreateStandMQService createStandMQService;
|
||||
|
||||
@Autowired
|
||||
private CreateEsMQService createEsMQService;
|
||||
|
||||
@Autowired
|
||||
private IPersonCollectEOService personCollectEOService;
|
||||
|
||||
@@ -107,6 +113,49 @@ public class ResetSearchCenterService {
|
||||
client = this.transportClient;
|
||||
}
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetALLSearchCenterToFields(SearchFields searchFields) throws Exception {
|
||||
|
||||
//查询字典表,形成Hash映射提升速度
|
||||
List<DicTypeEO> dicInfo = dicTypeEODao.getDicInfo("dic_id","dic_type_code", "dic_type_name","show_index");
|
||||
dicInfo = dicInfo.stream().filter(dicTypeEO -> {
|
||||
if(StringUtils.isNotBlank(dicTypeEO.getDicTypeCode())){
|
||||
dicTypeEO.setDicTypeCode(dicTypeEO.getDicTypeCode().replace(" ",""));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
Map<String, Integer> dicMap = dicInfo.stream()
|
||||
.filter(item-> ("2klxdk7fo3tvpvin70dk".equals(item.getDicId()) || "18mg1g4x0rwubcto7fdd".equals(item.getDicId()) || "08rerbsn8ucjfk13z2ci".equals(item.getDicId()) || "pnv0ik979yqogocqujwo".equals(item.getDicId())) && !item.getDicTypeCode().isEmpty())
|
||||
.collect(Collectors.toMap(DicTypeEO::getDicTypeCode,DicTypeEO::getShowIndex,(value1, value2 )->value2));
|
||||
|
||||
String search = "";
|
||||
if(StringUtils.isNotBlank(searchFields.getSearch())) {
|
||||
search = searchFields.getSearch();
|
||||
}
|
||||
|
||||
Boolean getStandIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
|
||||
if(!getStandIndex){
|
||||
logger.info("ES 不存在索引:fulltextserch");
|
||||
return Result.error("ES 不存在索引:fulltextserch");
|
||||
}
|
||||
|
||||
List<Map<String, Object>> searchListData = elasticsearchService.searchAll("fulltextserch",search);
|
||||
List<String> esIdList = searchListData.stream().map(stringObjectMap -> stringObjectMap.get("id").toString()).collect(Collectors.toList());
|
||||
|
||||
if(!esIdList.isEmpty()){
|
||||
logger.info("ES 国内外标准 fulltextserch ");
|
||||
resetStandSearchCenterToFields(esIdList,dicMap);
|
||||
logger.info("ES 国内外政策 fulltextserch ");
|
||||
resetLawsSearchCenterToFields(esIdList,dicMap);
|
||||
logger.info("ES 企标 fulltextserch ");
|
||||
resetBussStandSearchCenterToFields(esIdList,dicMap);
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetALLSearchCenterToSearch(SearchCenter searchCenter) throws Exception{
|
||||
Boolean getFulltextserchIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
@@ -248,6 +297,84 @@ public class ResetSearchCenterService {
|
||||
return Result.success(res);
|
||||
}
|
||||
|
||||
//重建国内外标准
|
||||
@Async
|
||||
public ResponseMessage resetStandSearchCenterToFields(List<String> esIdList,Map<String,Integer> dicMap) throws Exception {
|
||||
|
||||
int countUpdateSuccess = 0;
|
||||
int countAddSuccess = 0;
|
||||
SarStandardsInfoEOPage page = new SarStandardsInfoEOPage();
|
||||
page.setValidFlag("0");
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.eq("VALID_FLAG","0");
|
||||
int count = iSarStandardsInfoService.count(qw);
|
||||
if(count > 0){
|
||||
page.setPageSize(count);
|
||||
page.setMenuId("nomenu");
|
||||
page.setStandType("ALL");
|
||||
List<SarStandardsInfo> rowsStand = iSarStandardsInfoService.getSarStandardsInfoPage(page);
|
||||
List<SarStandardsInfo> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
if(!esIdList.isEmpty()){
|
||||
|
||||
// 交集 更新
|
||||
List<SarStandardsInfo> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(!intersection.isEmpty()){
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!updList.isEmpty()){
|
||||
for(SarStandardsInfo sarStandardsInfoEO : updList){
|
||||
countUpdateSuccess++;
|
||||
Map<String,Object> fullTextSearchEO = new HashMap<>();
|
||||
fullTextSearchEO.put("id",sarStandardsInfoEO.getId());
|
||||
if ("FOREIGN".equals(sarStandardsInfoEO.getStandType())){
|
||||
fullTextSearchEO.put("standTypeOrder","2");
|
||||
}else {
|
||||
fullTextSearchEO.put("standTypeOrder","1");
|
||||
}
|
||||
fullTextSearchEO.put("standSortOrder",esStateOrder(sarStandardsInfoEO.getStandSort(),dicMap));
|
||||
fullTextSearchEO.put("yearOrder", sarStandardsInfoEO.getStandYear());
|
||||
fullTextSearchEO.put("sortTitle", sarStandardsInfoEO.getStandSort());
|
||||
fullTextSearchEO.put("numberTitle", sarStandardsInfoEO.getStandNumber());
|
||||
fullTextSearchEO.put("nameTitle", sarStandardsInfoEO.getStandName());
|
||||
String textStatusName = "";
|
||||
if(sarStandardsInfoEO.getTextStatus() != null && StringUtils.isNotBlank(sarStandardsInfoEO.getTextStatus())){
|
||||
List<String> valArr = Arrays.asList(sarStandardsInfoEO.getTextStatus().split(","));
|
||||
textStatusName = dicTypeEODao.getDicNamesByCodes(valArr,"");
|
||||
}
|
||||
fullTextSearchEO.put("textStatusFull", textStatusName);
|
||||
createEsMQService.sendEsUpdFullMQ(fullTextSearchEO,"update");
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
|
||||
return Result.success("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
|
||||
}else {
|
||||
logger.info("未查询到标准数据");
|
||||
return Result.error("未查询到标准数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String esStateOrder(String data, Map<String, Integer> dicMap){
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
data = data.replace(" ","");
|
||||
if(dicMap.get(data.trim().toUpperCase()) != null){
|
||||
return String.valueOf(dicMap.get(data.trim().toUpperCase()));
|
||||
}else {
|
||||
return "99999";
|
||||
}
|
||||
}else {
|
||||
return "99999";
|
||||
}
|
||||
}
|
||||
|
||||
//重建国内外标准
|
||||
@Async
|
||||
public ResponseMessage resetStandSearchCenterToSearch(SarStandardsInfoEOPage page,SearchCenter searchCenter) throws Exception{
|
||||
@@ -537,6 +664,64 @@ public class ResetSearchCenterService {
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetLawsSearchCenterToFields(List<String> esIdList,Map<String,Integer> dicMap) throws Exception{
|
||||
|
||||
SarLawsStandInfoPage sarLawsInfoEOPage = new SarLawsStandInfoPage();
|
||||
sarLawsInfoEOPage.setLawsType("FOREIGN");
|
||||
|
||||
int countUpdateSuccess = 0;
|
||||
int countAddSuccess = 0;
|
||||
QueryWrapper qw2 = new QueryWrapper();
|
||||
qw2.eq("VALID_FLAG","0");
|
||||
int count2 = iSarLawsStandInfoService.count(qw2);
|
||||
if(count2 > 0){
|
||||
sarLawsInfoEOPage.setPageSize(count2);
|
||||
List<SarLawsStandInfo> rowsStand = iSarLawsStandInfoService.getSarStandardsInfoPage(sarLawsInfoEOPage);
|
||||
List<SarLawsStandInfo> updList = new ArrayList<>();
|
||||
|
||||
if(!esIdList.isEmpty()){
|
||||
|
||||
// 交集 更新
|
||||
List<String> finalEsIdList = esIdList;
|
||||
List<SarLawsStandInfo> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(finalEsIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(!intersection.isEmpty()){
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
}
|
||||
|
||||
if(!updList.isEmpty()){
|
||||
for(SarLawsStandInfo sarLawsInfoEO : updList){
|
||||
countUpdateSuccess++;
|
||||
Map<String,Object> fullTextSearchEO = new HashMap<>();
|
||||
fullTextSearchEO.put("id",sarLawsInfoEO.getId());
|
||||
fullTextSearchEO.put("standTypeOrder","4");
|
||||
fullTextSearchEO.put("standSortOrder",esStateOrder(sarLawsInfoEO.getLawsType(),dicMap));
|
||||
fullTextSearchEO.put("yearOrder", sarLawsInfoEO.getLawsYear());
|
||||
fullTextSearchEO.put("sortTitle", sarLawsInfoEO.getLawsType());
|
||||
fullTextSearchEO.put("numberTitle", sarLawsInfoEO.getLawsNumber());
|
||||
fullTextSearchEO.put("nameTitle", sarLawsInfoEO.getLawsName());
|
||||
String textStatusName = "";
|
||||
if(sarLawsInfoEO.getLawsTextState() != null && StringUtils.isNotBlank(sarLawsInfoEO.getLawsTextState())){
|
||||
List<String> valArr = Arrays.asList(sarLawsInfoEO.getLawsTextState().split(","));
|
||||
textStatusName = dicTypeEODao.getDicNamesByCodes(valArr,"");
|
||||
}
|
||||
fullTextSearchEO.put("textStatusFull", textStatusName);
|
||||
createEsMQService.sendEsUpdFullMQ(fullTextSearchEO,"update"); }
|
||||
}
|
||||
|
||||
logger.info("重置国内外政策:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外政策共:"+rowsStand.size()+"条)数据");
|
||||
return Result.success("");
|
||||
}else {
|
||||
logger.info("未查询到国内外政策数据");
|
||||
return Result.error("未查询到国内外政策数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetLawsSearchCenterToSearch(SarLawsStandInfoPage sarLawsInfoEOPage,SearchCenter searchCenter) throws Exception{
|
||||
Boolean getLawsIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
@@ -882,6 +1067,72 @@ public class ResetSearchCenterService {
|
||||
* 文本搜索
|
||||
*/
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetBussStandSearchCenterToFields(List<String> esIdList,Map<String,Integer> dicMap) throws Exception{
|
||||
|
||||
SarBussionessStandEOPage sarBussionessStandEOPage = new SarBussionessStandEOPage();
|
||||
sarBussionessStandEOPage.setValidFlag("0");
|
||||
sarBussionessStandEOPage.setOrderBy("SAR_BUSSIONESS_STAND.issue_time is null,SAR_BUSSIONESS_STAND.issue_time desc,SAR_BUSSIONESS_STAND.id");
|
||||
sarBussionessStandEOPage.setMenuRoleList(null);
|
||||
|
||||
int countUpdateSuccess = 0;
|
||||
int countAddSuccess = 0;
|
||||
sarBussionessStandEOPage.setMenuId("0");
|
||||
|
||||
QueryWrapper qw3 = new QueryWrapper();
|
||||
qw3.eq("VALID_FLAG","0");
|
||||
int count3 = iSarBussionessStandService.count(qw3);
|
||||
|
||||
if(count3 > 0){
|
||||
sarBussionessStandEOPage.setPageSize(count3);
|
||||
|
||||
List<SarBussionessStand> rowsStand = iSarBussionessStandService.getSarBussionStandPage(sarBussionessStandEOPage);
|
||||
List<SarBussionessStand> insList = new ArrayList<>();
|
||||
List<SarBussionessStand> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
List<String> standIdList = rowsStand.stream().map(SarBussionessStand::getId).collect(Collectors.toList());
|
||||
if(!esIdList.isEmpty()){
|
||||
|
||||
// 交集 更新
|
||||
List<String> finalEsIdList = esIdList;
|
||||
List<SarBussionessStand> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(finalEsIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(!intersection.isEmpty()){
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
}
|
||||
|
||||
if(!updList.isEmpty()){
|
||||
for(SarBussionessStand sarBussionessStandEO : updList){
|
||||
countUpdateSuccess++;
|
||||
Map<String,Object> fullTextSearchEO = new HashMap<>();
|
||||
fullTextSearchEO.put("id",sarBussionessStandEO.getId());
|
||||
fullTextSearchEO.put("standTypeOrder","3");
|
||||
fullTextSearchEO.put("standSortOrder",esStateOrder(sarBussionessStandEO.getStandSort(),dicMap));
|
||||
fullTextSearchEO.put("yearOrder", sarBussionessStandEO.getStandYear());
|
||||
fullTextSearchEO.put("sortTitle", sarBussionessStandEO.getStandSort());
|
||||
fullTextSearchEO.put("numberTitle", sarBussionessStandEO.getStandNumber());
|
||||
fullTextSearchEO.put("nameTitle", sarBussionessStandEO.getStandName());
|
||||
String textStatusBussName = "";
|
||||
if(sarBussionessStandEO.getTextStatusBuss() != null && StringUtils.isNotBlank(sarBussionessStandEO.getTextStatusBuss())){
|
||||
List<String> valArr = Arrays.asList(sarBussionessStandEO.getTextStatusBuss().split(","));
|
||||
textStatusBussName = dicTypeEODao.getDicNamesByCodes(valArr,"");
|
||||
}
|
||||
fullTextSearchEO.put("textStatusFull", textStatusBussName);
|
||||
createEsMQService.sendEsUpdFullMQ(fullTextSearchEO,"update");
|
||||
}
|
||||
}
|
||||
logger.info("重置企标:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(企标共:"+rowsStand.size()+"条)数据");
|
||||
return Result.success("");
|
||||
}else {
|
||||
logger.info("未查询到企标数据");
|
||||
return Result.error("未查询到企标数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Async
|
||||
public ResponseMessage resetBussStandSearchCenterToSearch(SarBussionessStandEOPage sarBussionessStandEOPage,SearchCenter searchCenter) throws Exception{
|
||||
Boolean getbussstandIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
|
||||
Reference in New Issue
Block a user