add: 添加处理ES索引数据接口

This commit is contained in:
zyd
2022-03-15 21:29:36 +08:00
parent 496fb1da4d
commit 32f16ee4cf
3 changed files with 85 additions and 1 deletions
@@ -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);
}
}
}