Merge branch 'hotfix/20240617-workspace' into 'master'

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

See merge request universal/infrastructure/backend/tyr!56
This commit is contained in:
李龙 2024-06-24 11:53:15 +00:00
commit 758d785710
2 changed files with 11 additions and 1 deletions

View File

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

View File

@ -252,7 +252,11 @@ public class ProductServiceImpl implements ProductService {
.build()).collect(Collectors.toList())); .build()).collect(Collectors.toList()));
} else { } else {
if (ProductModuleCategoryEnum.PRODUCT_VERSION.getCode().equals(k)) { 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)) { if (ProductModuleCategoryEnum.ADD_VALUE_SERVICE.getCode().equals(k)) {
resp.getAddValueServices().addAll(v.stream().map(this::buildRespProduct).filter(Objects::nonNull).collect(Collectors.toList())); 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()) .productName(e.getProductName())
.maxPersonCount(e.getMaxPersonCount()) .maxPersonCount(e.getMaxPersonCount())
.maxWorkspaceCount(e.getMaxWorkspaceCount()) .maxWorkspaceCount(e.getMaxWorkspaceCount())
.version(e.getVersion())
.skus(CollectionUtil.isNotEmpty(e.getSkus()) ? e.getSkus().stream().map(s -> WorkspaceProductResp.Sku .skus(CollectionUtil.isNotEmpty(e.getSkus()) ? e.getSkus().stream().map(s -> WorkspaceProductResp.Sku
.builder() .builder()
.skuName(s.getSkuName()) .skuName(s.getSkuName())