Commit 02fc25fd by guojuxing

门店刷es代码修改

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