Commit 02fc25fd by guojuxing

门店刷es代码修改

parent 36a86f44
......@@ -1599,41 +1599,47 @@ public class StoreApiServiceImpl implements StoreApiService {
logId = this.storeIndexLogService.saveStoreIndexLog(enterpriseId, storeId);
}
boolean isAdd = true;
DynamicSearchDTO dynamicSearchDTO = new DynamicSearchDTO();
JSONObject search = QueryConditionAssemblyUtil.createSimpleQueryNode("id", OperateEnum.OPERATE_EQ, enterpriseId + "_" + storeId);
dynamicSearchDTO.setEnterpriseId(com.gic.enterprise.constants.Constants.INDEX_ENTERPRISEID);
dynamicSearchDTO.setColumnCategoryCode(com.gic.enterprise.constants.Constants.ColumnCategoryCode);
dynamicSearchDTO.setSearchJson(search);
ServiceResponse<Long> serviceResponse = this.esBusinessOperaApiService.queryDataCount(dynamicSearchDTO);
if (serviceResponse.isSuccess()) {
Long result = serviceResponse.getResult();
if (result != null) {
if (result > 0) {
isAdd = false;
try {
DynamicSearchDTO dynamicSearchDTO = new DynamicSearchDTO();
JSONObject search = QueryConditionAssemblyUtil.createSimpleQueryNode("id", OperateEnum.OPERATE_EQ, enterpriseId + "_" + storeId);
dynamicSearchDTO.setEnterpriseId(com.gic.enterprise.constants.Constants.INDEX_ENTERPRISEID);
dynamicSearchDTO.setColumnCategoryCode(com.gic.enterprise.constants.Constants.ColumnCategoryCode);
dynamicSearchDTO.setSearchJson(search);
ServiceResponse<Long> serviceResponse = this.esBusinessOperaApiService.queryDataCount(dynamicSearchDTO);
if (serviceResponse.isSuccess()) {
Long result = serviceResponse.getResult();
if (result != null) {
if (result > 0) {
isAdd = false;
}
}
}
}
DynamicDocDTO docDTO = this.buildStoreDocDto(enterpriseId, storeId);
logger.info("写入es的门店数据:{}", JSON.toJSONString(docDTO, true));
String message = "success";
if (docDTO != null) {
ServiceResponse esResponse = null;
if (isAdd) {
esResponse = this.esBusinessOperaApiService.createDataSingle(docDTO, false);
} else {
esResponse = this.esBusinessOperaApiService.updateDataSingle(docDTO, false);
}
logger.info("门店写入es返回结果:{}", JSON.toJSONString(esResponse));
if (esResponse.isSuccess()) {
DynamicDocDTO docDTO = this.buildStoreDocDto(enterpriseId, storeId);
logger.info("写入es的门店数据:{}", JSON.toJSONString(docDTO, true));
String message = "success";
if (docDTO != null) {
ServiceResponse esResponse = null;
if (isAdd) {
esResponse = this.esBusinessOperaApiService.createDataSingle(docDTO, false);
} else {
esResponse = this.esBusinessOperaApiService.updateDataSingle(docDTO, false);
}
logger.info("门店写入es返回结果:{}", JSON.toJSONString(esResponse));
if (esResponse.isSuccess()) {
this.storeIndexLogService.updateStoreIndexLog(logId, message);
return esResponse;
}
message = esResponse.getMessage();
this.storeIndexLogService.updateStoreIndexLog(logId, message);
return esResponse;
return EnterpriseServiceResponse.failure(esResponse.getCode(), esResponse.getMessage());
}
message = esResponse.getMessage();
message = "门店不存在";
this.storeIndexLogService.updateStoreIndexLog(logId, message);
return EnterpriseServiceResponse.failure(esResponse.getCode(), esResponse.getMessage());
} catch (Exception e) {
logger.info("addStoreToIndexMq报错:{}", e.getMessage(), e);
this.storeIndexLogService.updateStoreIndexLog(logId, "addStoreToIndexMq报错:" + e.getMessage());
}
message = "门店不存在";
this.storeIndexLogService.updateStoreIndexLog(logId, message);
return null;
}
......
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