hotfix(20240617-workspace): 产品版本产品列表增加version升序排序

This commit is contained in:
李昆鹏 2024-06-21 14:50:19 +08:00
parent 51b1a60a60
commit 25a41cf79f
2 changed files with 11 additions and 1 deletions

View File

@ -70,6 +70,11 @@ public class WorkspaceProductResp {
*/
private Integer maxWorkspaceCount;
/**
* 版本升级序列(数字越小版本越低不能降级只能升级) <企业项目产品>
*/
private Integer version;
/**
* SKU列表
*/

View File

@ -252,7 +252,11 @@ public class ProductServiceImpl implements ProductService {
.build()).collect(Collectors.toList()));
} else {
if (ProductModuleCategoryEnum.PRODUCT_VERSION.getCode().equals(k)) {
resp.getProductVersions().addAll(v.stream().map(this::buildRespProduct).filter(Objects::nonNull).collect(Collectors.toList()));
List<WorkspaceProductResp.Product> products = v.stream().map(this::buildRespProduct).filter(Objects::nonNull).collect(Collectors.toList());
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(products)) {
products.sort(Comparator.comparing(p -> Objects.isNull(p.getVersion()) ? 0 : p.getVersion()));
}
resp.getProductVersions().addAll(products);
}
if (ProductModuleCategoryEnum.ADD_VALUE_SERVICE.getCode().equals(k)) {
resp.getAddValueServices().addAll(v.stream().map(this::buildRespProduct).filter(Objects::nonNull).collect(Collectors.toList()));
@ -372,6 +376,7 @@ public class ProductServiceImpl implements ProductService {
.productName(e.getProductName())
.maxPersonCount(e.getMaxPersonCount())
.maxWorkspaceCount(e.getMaxWorkspaceCount())
.version(e.getVersion())
.skus(CollectionUtil.isNotEmpty(e.getSkus()) ? e.getSkus().stream().map(s -> WorkspaceProductResp.Sku
.builder()
.skuName(s.getSkuName())