Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
haungxing 2 months ago
parent
commit
142c84ca8e
  1. 55
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java

55
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java

@ -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

Loading…
Cancel
Save