Commit 1f7048dc by zhangxingmin

push

parent 8408dc4c
...@@ -91,6 +91,7 @@ public class ApiAttributeSettingServiceImpl implements ApiAttributeSettingServic ...@@ -91,6 +91,7 @@ public class ApiAttributeSettingServiceImpl implements ApiAttributeSettingServic
//批量查询字段值详情 //批量查询字段值详情
Map<String, String> fieldValueBizIdToNameMap = new HashMap<>(); Map<String, String> fieldValueBizIdToNameMap = new HashMap<>();
Map<String, String> fieldValueBizIdToCodeMap = new HashMap<>();
if (!CollectionUtils.isEmpty(allFieldValueBizIds)) { if (!CollectionUtils.isEmpty(allFieldValueBizIds)) {
// 去重 // 去重
List<String> distinctFieldValueBizIds = allFieldValueBizIds.stream() List<String> distinctFieldValueBizIds = allFieldValueBizIds.stream()
...@@ -103,13 +104,11 @@ public class ApiAttributeSettingServiceImpl implements ApiAttributeSettingServic ...@@ -103,13 +104,11 @@ public class ApiAttributeSettingServiceImpl implements ApiAttributeSettingServic
try { try {
Result<List<ApiFieldValueDetailResponse>> result = apiFieldValueFeignClient.list(request); Result<List<ApiFieldValueDetailResponse>> result = apiFieldValueFeignClient.list(request);
if (result != null && result.getCode() == 200 && !CollectionUtils.isEmpty(result.getData())) { if (result != null && result.getCode() == 200 && !CollectionUtils.isEmpty(result.getData())) {
// 构建映射关系:字段值业务ID -> 字段值名称 // 构建映射关系:字段值业务ID -> 字段值名称 和 字段值业务ID -> 字段值编码
fieldValueBizIdToNameMap = result.getData().stream() for (ApiFieldValueDetailResponse response : result.getData()) {
.collect(Collectors.toMap( fieldValueBizIdToNameMap.put(response.getFieldValueBizId(), response.getValue());
ApiFieldValueDetailResponse::getFieldValueBizId, fieldValueBizIdToCodeMap.put(response.getFieldValueBizId(), response.getFieldValueCode());
ApiFieldValueDetailResponse::getValue, }
(existing, replacement) -> existing
));
} else { } else {
log.warn("查询字段值详情失败,fieldValueBizIdList: {}", distinctFieldValueBizIds); log.warn("查询字段值详情失败,fieldValueBizIdList: {}", distinctFieldValueBizIds);
} }
...@@ -133,6 +132,14 @@ public class ApiAttributeSettingServiceImpl implements ApiAttributeSettingServic ...@@ -133,6 +132,14 @@ public class ApiAttributeSettingServiceImpl implements ApiAttributeSettingServic
StringUtils.defaultIfBlank(finalFieldValueBizIdToNameMap.get(fieldValueBizId), fieldValueBizId)) StringUtils.defaultIfBlank(finalFieldValueBizIdToNameMap.get(fieldValueBizId), fieldValueBizId))
.collect(Collectors.toList()); .collect(Collectors.toList());
settingDto.setValueNames(StringUtils.join(valueNames, ";")); settingDto.setValueNames(StringUtils.join(valueNames, ";"));
// 构建字段值编码(多个值用分号分隔)
Map<String, String> finalFieldValueBizIdToCodeMap = fieldValueBizIdToCodeMap;
List<String> valueCodes = valueBizIds.stream()
.map(fieldValueBizId ->
StringUtils.defaultIfBlank(finalFieldValueBizIdToCodeMap.get(fieldValueBizId), fieldValueBizId))
.collect(Collectors.toList());
settingDto.setValueCodes(StringUtils.join(valueCodes, ";"));
} }
apiAttributeSettingDtoList.add(settingDto); apiAttributeSettingDtoList.add(settingDto);
...@@ -140,4 +147,4 @@ public class ApiAttributeSettingServiceImpl implements ApiAttributeSettingServic ...@@ -140,4 +147,4 @@ public class ApiAttributeSettingServiceImpl implements ApiAttributeSettingServic
} }
return apiAttributeSettingDtoList; return apiAttributeSettingDtoList;
} }
} }
\ No newline at end of file
...@@ -41,6 +41,11 @@ public class ApiAttributeSettingDto { ...@@ -41,6 +41,11 @@ public class ApiAttributeSettingDto {
private String valueNames; private String valueNames;
/** /**
* 字段值编码(多个值存在的情况用分号分隔的;)
*/
private String valueCodes;
/**
* 是否自定义 0-否 1-是 * 是否自定义 0-否 1-是
*/ */
private String isCustomize; private String isCustomize;
......
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