|
|
@ -143,34 +143,35 @@ public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, Vecto |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("synchronization vector param id:{}", id); |
|
|
|
log.info("synchronization vector param id:{}", id); |
|
|
|
VectorUrlResponse response = getUrlResponse(entity.getUrl(), bladeToken, hzinfoToken); |
|
|
|
VectorUrlResponse response = getUrlResponse(entity.getUrl(), bladeToken, hzinfoToken); |
|
|
|
if (response != null) { |
|
|
|
if (response == null || response.getOriginalData() == null || response.getOriginalData().isEmpty()) { |
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
return false; |
|
|
|
JsonNode rootNode = null; |
|
|
|
} |
|
|
|
try { |
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
rootNode = mapper.readTree(entity.getAttributeMap()); |
|
|
|
JsonNode rootNode = null; |
|
|
|
} catch (JsonProcessingException e) { |
|
|
|
try { |
|
|
|
log.error("getUrlResponseKeyList error", e); |
|
|
|
rootNode = mapper.readTree(entity.getAttributeMap()); |
|
|
|
} |
|
|
|
} catch (JsonProcessingException e) { |
|
|
|
Map<String, String> attrMap = new HashMap<>(); |
|
|
|
log.error("getUrlResponseKeyList error", e); |
|
|
|
Iterator<String> iterator = rootNode.fieldNames(); |
|
|
|
} |
|
|
|
while (iterator.hasNext()) { |
|
|
|
Map<String, String> attrMap = new HashMap<>(); |
|
|
|
String key = iterator.next(); |
|
|
|
Iterator<String> iterator = rootNode.fieldNames(); |
|
|
|
attrMap.put(key, rootNode.findValue(key).textValue()); |
|
|
|
while (iterator.hasNext()) { |
|
|
|
} |
|
|
|
String key = iterator.next(); |
|
|
|
String tableName = entity.getTableName().replace(entity.getProjectPrefix() + "_", ""); |
|
|
|
attrMap.put(key, rootNode.findValue(key).textValue()); |
|
|
|
String syncResult = weaviateService.saveBatch(response.getOriginalData(), tableName, attrMap); |
|
|
|
} |
|
|
|
if (this.update(Wrappers.<VectorParamEntity>lambdaUpdate() |
|
|
|
String tableName = entity.getTableName().replace(entity.getProjectPrefix() + "_", ""); |
|
|
|
.eq(VectorParamEntity::getId, id) |
|
|
|
String syncResult = weaviateService.saveBatch(response.getOriginalData(), tableName, attrMap); |
|
|
|
.set(VectorParamEntity::getSynchronizationRemark, syncResult) |
|
|
|
log.info("synchronization vector param id:{}, result:{}", id, syncResult); |
|
|
|
.set(VectorParamEntity::getSynchronizationTime, new Date()))) { |
|
|
|
if (this.update(Wrappers.<VectorParamEntity>lambdaUpdate() |
|
|
|
return vectorParamLogService.synchronization(VectorParamLogEntity.builder() |
|
|
|
.eq(VectorParamEntity::getId, id) |
|
|
|
.vectorParamId(id) |
|
|
|
.set(VectorParamEntity::getSynchronizationRemark, syncResult) |
|
|
|
.type(DataOperateType.SYNCHRONIZATION.getCode()).build()); |
|
|
|
.set(VectorParamEntity::getSynchronizationTime, new Date()))) { |
|
|
|
} else { |
|
|
|
return vectorParamLogService.synchronization(VectorParamLogEntity.builder() |
|
|
|
return false; |
|
|
|
.vectorParamId(id) |
|
|
|
} |
|
|
|
.type(DataOperateType.SYNCHRONIZATION.getCode()).build()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|