add: 添加处理ES索引数据接口
This commit is contained in:
@@ -114,7 +114,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetAStandSearchCenter");
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetBLawsSearchCenter");
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/resetCBussStandSearchCenter");
|
||||
|
||||
addInterceptor.excludePathPatterns("/api/search/resetSearchCenter/syncSearchCenterData");
|
||||
|
||||
addInterceptor.excludePathPatterns("/api/att/attFile/downloadFileForSarNew");
|
||||
addInterceptor.excludePathPatterns("/api/att/attFile/downloadFileForSarWaterMarkNew");
|
||||
|
||||
@@ -11,6 +11,9 @@ import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -22,6 +25,8 @@ import java.util.Map;
|
||||
@Api(description = "搜索中心重置索引及数据+实施预警触发")
|
||||
public class ResetSearchCenterController extends BaseController<Map<String, Object>> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ResetSearchCenterController.class);
|
||||
|
||||
@Autowired
|
||||
private ResetSearchCenterService resetSearchCenterService;
|
||||
@ApiOperation(value = "|SearchCenter|重新创建ALL标准数据索引")
|
||||
@@ -77,4 +82,37 @@ public class ResetSearchCenterController extends BaseController<Map<String, Obje
|
||||
SarBussionessStandEOPage sarBussionessStandEOPage = new SarBussionessStandEOPage();
|
||||
return resetSearchCenterService.resetBussStandSearchCenter(sarBussionessStandEOPage,searchCenter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据资源ID对搜索中心数据进行处理
|
||||
* @param standId
|
||||
* @param addOrUp
|
||||
* @param dataType(STAND BUSS)
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "|SearchCenter|根据资源ID对搜索中心数据进行处理")
|
||||
@GetMapping(value="/syncSearchCenterData")
|
||||
public ResponseMessage syncSearchCenterData(@RequestParam("standId") String standId,
|
||||
@RequestParam("addOrUp") Boolean addOrUp,
|
||||
@RequestParam("dataType") String dataType){
|
||||
if(StringUtils.isNotBlank(standId) && StringUtils.isNotBlank(dataType) && addOrUp!=null){
|
||||
try {
|
||||
if("STAND".equals(dataType)){
|
||||
resetSearchCenterService.syncStandSearchCenterData(standId,addOrUp);
|
||||
}else if("BUSS".equals(dataType)){
|
||||
resetSearchCenterService.syncBussStandSearchCenterData(standId,addOrUp);
|
||||
}else{
|
||||
return Result.error("-1","资源类型错误,请检查",null);
|
||||
}
|
||||
return Result.success("200","开始同步",null);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
return Result.error("-1","请求错误,请检查",null);
|
||||
}
|
||||
}else{
|
||||
return Result.error("-1","参数有误,请检查",null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.utils.util.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.slf4j.Logger;
|
||||
@@ -298,4 +299,49 @@ public class ResetSearchCenterService {
|
||||
logger.info("重置企标:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(企标共:"+rowsStand.size()+"条)");
|
||||
return Result.success("重置企标:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(企标共:"+rowsStand.size()+"条)");
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步添加标准搜索中心数据内容
|
||||
* @param standId
|
||||
*/
|
||||
public void syncStandSearchCenterData(String standId,boolean addOrUp) throws Exception {
|
||||
if(StringUtils.isNotBlank(standId)){
|
||||
SarStandardsInfo sarStandardsInfo = iSarStandardsInfoService.selectStandardsInfoByKey(standId);
|
||||
logger.debug("本次处理的标准信息:"+JSONObject.toJSONString(sarStandardsInfo));
|
||||
if(sarStandardsInfo!=null){
|
||||
if (sarStandardsInfo.getAttrInfoMap() != null) {
|
||||
sarStandardsInfo.setSarStandAttrEOStr(JSONObject.toJSONString(sarStandardsInfo.getAttrInfoMap()));
|
||||
}
|
||||
if(addOrUp){
|
||||
createStandMQService.sendStandMQ(sarStandardsInfo,"add");
|
||||
}else{
|
||||
createStandMQService.sendStandMQ(sarStandardsInfo,"update");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步添加企业标准搜索中心数据内容
|
||||
* @param standId
|
||||
*/
|
||||
public void syncBussStandSearchCenterData(String standId,boolean addOrUp) throws Exception {
|
||||
if(StringUtils.isNotBlank(standId)){
|
||||
SarBussionessStand sarBussionessStand = iSarBussionessStandService.selectStandardsInfoByKey(standId);
|
||||
logger.debug("本次处理的标准信息:"+JSONObject.toJSONString(sarBussionessStand));
|
||||
if(sarBussionessStand!=null){
|
||||
if (sarBussionessStand.getAttrInfoMap() != null) {
|
||||
sarBussionessStand.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStand.getAttrInfoMap()));
|
||||
}
|
||||
if(addOrUp){
|
||||
createStandMQService.sendBussStandMQ(sarBussionessStand,"add");
|
||||
}else{
|
||||
createStandMQService.sendBussStandMQ(sarBussionessStand,"update");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user