Commit e218feb6 by zhangxingmin

push

parent 1f7048dc
......@@ -104,11 +104,23 @@ public class ApiAttributeSettingServiceImpl implements ApiAttributeSettingServic
try {
Result<List<ApiFieldValueDetailResponse>> result = apiFieldValueFeignClient.list(request);
if (result != null && result.getCode() == 200 && !CollectionUtils.isEmpty(result.getData())) {
log.info("查询到字段值详情数量: {}", result.getData().size());
// 构建映射关系:字段值业务ID -> 字段值名称 和 字段值业务ID -> 字段值编码
for (ApiFieldValueDetailResponse response : result.getData()) {
log.debug("字段值详情 - fieldValueBizId: {}, fieldValueCode: {}, value: {}",
response.getFieldValueBizId(), response.getFieldValueCode(), response.getValue());
fieldValueBizIdToNameMap.put(response.getFieldValueBizId(), response.getValue());
fieldValueBizIdToCodeMap.put(response.getFieldValueBizId(), response.getFieldValueCode());
// 如果fieldValueCode为空,则使用fieldValueBizId作为备用值
String fieldValueCode = StringUtils.isNotBlank(response.getFieldValueCode())
? response.getFieldValueCode()
: response.getFieldValueBizId();
fieldValueBizIdToCodeMap.put(response.getFieldValueBizId(), fieldValueCode);
}
log.info("字段值编码映射表: {}", fieldValueBizIdToCodeMap);
} else {
log.warn("查询字段值详情失败,fieldValueBizIdList: {}", distinctFieldValueBizIds);
}
......@@ -128,16 +140,20 @@ public class ApiAttributeSettingServiceImpl implements ApiAttributeSettingServic
// 构建字段值名称(多个值用分号分隔)
Map<String, String> finalFieldValueBizIdToNameMap = fieldValueBizIdToNameMap;
List<String> valueNames = valueBizIds.stream()
.map(fieldValueBizId ->
StringUtils.defaultIfBlank(finalFieldValueBizIdToNameMap.get(fieldValueBizId), fieldValueBizId))
.map(fieldValueBizId -> {
String name = finalFieldValueBizIdToNameMap.get(fieldValueBizId);
return StringUtils.defaultIfBlank(name, fieldValueBizId);
})
.collect(Collectors.toList());
settingDto.setValueNames(StringUtils.join(valueNames, ";"));
// 构建字段值编码(多个值用分号分隔)
Map<String, String> finalFieldValueBizIdToCodeMap = fieldValueBizIdToCodeMap;
List<String> valueCodes = valueBizIds.stream()
.map(fieldValueBizId ->
StringUtils.defaultIfBlank(finalFieldValueBizIdToCodeMap.get(fieldValueBizId), fieldValueBizId))
.map(fieldValueBizId -> {
String code = finalFieldValueBizIdToCodeMap.get(fieldValueBizId);
return StringUtils.defaultIfBlank(code, fieldValueBizId);
})
.collect(Collectors.toList());
settingDto.setValueCodes(StringUtils.join(valueCodes, ";"));
}
......
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