add:
1. add version management
This commit is contained in:
@@ -2,13 +2,13 @@ DROP TABLE IF EXISTS release_version CASCADE;
|
|||||||
CREATE TABLE release_version
|
CREATE TABLE release_version
|
||||||
(
|
(
|
||||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||||
version_code varchar(20) NOT NULL, -- 内部版本号 (如: 10023)
|
version_code varchar(20) NULL, -- 内部版本号 (如: 10023)
|
||||||
version_name varchar(50) NULL, -- 版本显示名称 (如: 1.2.3)
|
version_name varchar(50) NOT NULL, -- 版本显示名称 (如: 1.2.3)
|
||||||
app_type int4 NOT NULL, -- 应用类型: 1-app, 2-market
|
app_type int4 NOT NULL, -- 应用类型: 1-app, 2-market
|
||||||
channel_code varchar(20) NOT NULL, -- 渠道标识: xiaomi, huawei, honor, oppo, vivo, apple, qihoo, yingyongbao, pgyer, official
|
channel_code varchar(20) NOT NULL, -- 渠道标识: xiaomi, huawei, honor, oppo, vivo, apple, qihoo, yingyongbao, pgyer, official
|
||||||
package_type int4 NOT NULL, -- 包类型: 1-应用市场包(含跳转链接), 2-OSS直连包(兜底)
|
package_type int4 NOT NULL, -- 包类型: 1-应用市场包(含跳转链接), 2-OSS直连包(兜底)
|
||||||
is_force_update int4 NOT NULL, -- 是否强制更新: 0-否, 1-是
|
is_force_update int4 NOT NULL, -- 是否强制更新: 0-否, 1-是
|
||||||
download_url varchar(255) NOT NULL, -- 下载地址 (市场包通常为 schema 链接, OSS包为 http 链接)
|
download_url varchar(255) NULL, -- 下载地址 (市场包通常为 schema 链接, OSS包为 http 链接)
|
||||||
update_content text NOT NULL, -- 更新日志内容
|
update_content text NOT NULL, -- 更新日志内容
|
||||||
privacy_agreement_url varchar(255) NULL, -- 隐私协议地址
|
privacy_agreement_url varchar(255) NULL, -- 隐私协议地址
|
||||||
user_agreement_url varchar(255) NULL, -- 用户协议地址
|
user_agreement_url varchar(255) NULL, -- 用户协议地址
|
||||||
@@ -19,12 +19,17 @@ CREATE TABLE release_version
|
|||||||
create_time timestamp(6) NULL, -- 创建时间
|
create_time timestamp(6) NULL, -- 创建时间
|
||||||
update_user int8 NULL, -- 更新人ID
|
update_user int8 NULL, -- 更新人ID
|
||||||
update_time timestamp(6) NULL, -- 更新时间
|
update_time timestamp(6) NULL, -- 更新时间
|
||||||
status int4 NULL, -- 上架状态: 0-未上架/下架, 1-已上架
|
status int4 NULL, -- 上架状态: 1-启用, 2-已上架, 3-已过期
|
||||||
is_deleted int4 DEFAULT 0 -- 逻辑删除标识
|
is_deleted int4 DEFAULT 0 -- 逻辑删除标识
|
||||||
);
|
);
|
||||||
|
|
||||||
-- 索引顺序:app_type -> channel_code -> status -> version_code (降序)
|
-- 索引顺序:app_type -> channel_code -> status -> version_code (降序)
|
||||||
CREATE INDEX idx_app_channel_version ON release_version (app_type, channel_code, status, version_code DESC);
|
CREATE INDEX idx_app_channel_version ON release_version (app_type, channel_code, status, version_name DESC);
|
||||||
|
|
||||||
|
-- 后台管理系统页面索引
|
||||||
|
CREATE INDEX CONCURRENTLY idx_release_version_active_app_version
|
||||||
|
ON release_version (app_type, version_name, id DESC)
|
||||||
|
WHERE is_deleted = 0;
|
||||||
|
|
||||||
-- 添加表注释
|
-- 添加表注释
|
||||||
COMMENT ON TABLE release_version IS 'APP版本发布管理表';
|
COMMENT ON TABLE release_version IS 'APP版本发布管理表';
|
||||||
@@ -48,7 +53,7 @@ COMMENT ON COLUMN release_version.create_dept IS '创建部门ID';
|
|||||||
COMMENT ON COLUMN release_version.create_time IS '创建时间';
|
COMMENT ON COLUMN release_version.create_time IS '创建时间';
|
||||||
COMMENT ON COLUMN release_version.update_user IS '更新人ID';
|
COMMENT ON COLUMN release_version.update_user IS '更新人ID';
|
||||||
COMMENT ON COLUMN release_version.update_time IS '更新时间';
|
COMMENT ON COLUMN release_version.update_time IS '更新时间';
|
||||||
COMMENT ON COLUMN release_version.status IS '上架状态: 0-未上架/下架, 1-已上架';
|
COMMENT ON COLUMN release_version.status IS '上架状态: 1-启用, 2-已上架, 3-已过期';
|
||||||
COMMENT ON COLUMN release_version.is_deleted IS '逻辑删除标识';
|
COMMENT ON COLUMN release_version.is_deleted IS '逻辑删除标识';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import org.springblade.core.mp.support.Condition;
|
|||||||
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.mp.support.Query;
|
||||||
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.api.R;
|
||||||
import org.springblade.core.tool.utils.Func;
|
import org.springblade.core.tool.utils.Func;
|
||||||
import org.springblade.modules.common.pojo.entity.TourProductEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||||
@@ -20,8 +19,6 @@ import org.springblade.modules.common.wrapper.CommonReleaseVersionWrapper;
|
|||||||
import org.springblade.modules.common.service.ICommonReleaseVersionService;
|
import org.springblade.modules.common.service.ICommonReleaseVersionService;
|
||||||
import org.springblade.core.boot.ctrl.BladeController;
|
import org.springblade.core.boot.ctrl.BladeController;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP版本发布管理 控制器
|
* APP版本发布管理 控制器
|
||||||
@@ -69,14 +66,15 @@ public class CommonReleaseVersionController extends BladeController {
|
|||||||
return R.data(pages);
|
return R.data(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP版本发布管理 新增
|
* APP版本发布管理 新增
|
||||||
*/
|
*/
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
@Operation(summary = "新增", description = "传入commonReleaseversion")
|
@Operation(summary = "新增", description = "传入vo")
|
||||||
public R save(@Valid @RequestBody CommonReleaseVersionEntity commonReleaseVersion) {
|
public R save(@Valid @RequestBody CommonReleaseVersionVO vo) {
|
||||||
return R.status(commonReleaseVersionService.save(commonReleaseVersion));
|
return R.status(commonReleaseVersionService.createVersion(vo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package org.springblade.modules.common.convert;
|
||||||
|
|
||||||
|
import org.mapstruct.*;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
import org.springblade.modules.common.eums.AppMarketChannelEnum;
|
||||||
|
import org.springblade.modules.common.eums.VersionStatus;
|
||||||
|
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CommonReleaseVersionConvert {
|
||||||
|
|
||||||
|
CommonReleaseVersionConvert INSTANCE = Mappers.getMapper(CommonReleaseVersionConvert.class);
|
||||||
|
|
||||||
|
@Mapping(target = "id", ignore = true)
|
||||||
|
@Mapping(target = "createTime", ignore = true)
|
||||||
|
@Mapping(target = "updateTime", ignore = true)
|
||||||
|
@Mapping(target = "createUser", ignore = true)
|
||||||
|
@Mapping(target = "updateUser", ignore = true)
|
||||||
|
CommonReleaseVersionEntity copyForChannel(CommonReleaseVersionEntity source, @Context AppMarketChannelEnum channel);
|
||||||
|
|
||||||
|
@AfterMapping
|
||||||
|
default void setChannelAndStatus(@MappingTarget CommonReleaseVersionEntity target,
|
||||||
|
@Context AppMarketChannelEnum channel) {
|
||||||
|
target.setChannelCode(channel.getCode());
|
||||||
|
// 注意:OFFICIAL 渠道状态为 PUBLISHED,其他为 ENABLED
|
||||||
|
if (channel == AppMarketChannelEnum.OFFICIAL) {
|
||||||
|
target.setPackageType(2);
|
||||||
|
target.setStatus(VersionStatus.PUBLISHED.getCode());
|
||||||
|
} else {
|
||||||
|
target.setPackageType(1);
|
||||||
|
target.setDownloadUrl(null);
|
||||||
|
target.setStatus(VersionStatus.ENABLED.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package org.springblade.modules.common.eums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum AppMarketChannelEnum {
|
||||||
|
|
||||||
|
XIAOMI("xiaomi", "小米应用商店"),
|
||||||
|
HUAWEI("huawei", "华为应用市场"),
|
||||||
|
HONOR("honor", "荣耀应用市场"),
|
||||||
|
OPPO("oppo", "OPPO 软件商店"),
|
||||||
|
VIVO("vivo", "vivo 应用商店"),
|
||||||
|
APPLE("apple", "App Store"),
|
||||||
|
QIHOO("qihoo", "360手机助手"),
|
||||||
|
YINGYONGBAO("yingyongbao", "应用宝"),
|
||||||
|
PGYER("pgyer", "蒲公英分发平台"),
|
||||||
|
OFFICIAL("official", "官网/自有渠道");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
AppMarketChannelEnum(String code, String name) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 code 获取枚举项
|
||||||
|
*/
|
||||||
|
public static AppMarketChannelEnum fromCode(String code) {
|
||||||
|
for (AppMarketChannelEnum channel : AppMarketChannelEnum.values()) {
|
||||||
|
if (channel.code.equalsIgnoreCase(code)) {
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Unknown app market channel code: " + code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 code 是否有效
|
||||||
|
*/
|
||||||
|
public static boolean isValid(String code) {
|
||||||
|
try {
|
||||||
|
fromCode(code);
|
||||||
|
return true;
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package org.springblade.modules.common.eums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum VersionStatus {
|
||||||
|
ENABLED(1, "启用"),
|
||||||
|
PUBLISHED(2, "已上架"),
|
||||||
|
EXPIRED(3, "过期");
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
VersionStatus(int code, String description) {
|
||||||
|
this.code = code;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VersionStatus fromCode(int code) {
|
||||||
|
for (VersionStatus status : values()) {
|
||||||
|
if (status.code == code) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Invalid code: " + code);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,8 @@ public interface CommonReleaseVersionMapper extends BaseMapper<CommonReleaseVers
|
|||||||
*/
|
*/
|
||||||
List<CommonReleaseVersionVO> selectCommonReleaseVersionPage(IPage page, CommonReleaseVersionVO commonReleaseVersion);
|
List<CommonReleaseVersionVO> selectCommonReleaseVersionPage(IPage page, CommonReleaseVersionVO commonReleaseVersion);
|
||||||
|
|
||||||
|
List<CommonReleaseVersionVO> selectCustomerCommonReleaseVersionPage(IPage page, CommonReleaseVersionVO commonReleaseVersion);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,21 @@
|
|||||||
select * from release_version where is_deleted = 0
|
select * from release_version where is_deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCustomerCommonReleaseVersionPage" resultType="org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO">
|
||||||
|
SELECT DISTINCT ON (app_type, version_name)
|
||||||
|
app_type,
|
||||||
|
version_name,
|
||||||
|
is_force_update,
|
||||||
|
download_url,
|
||||||
|
privacy_agreement_url,
|
||||||
|
user_agreement_url,
|
||||||
|
update_content,
|
||||||
|
dispatch_url,
|
||||||
|
dispatch_target_version
|
||||||
|
FROM release_version
|
||||||
|
WHERE is_deleted = 0
|
||||||
|
ORDER BY app_type, version_name, id DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -25,10 +25,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.springblade.modules.common.pojo.vo;
|
package org.springblade.modules.common.pojo.vo;
|
||||||
|
|
||||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP版本发布管理 视图实体类
|
* APP版本发布管理 视图实体类
|
||||||
@@ -37,9 +39,31 @@ import java.io.Serial;
|
|||||||
* @since 2026-04-01
|
* @since 2026-04-01
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
public class CommonReleaseVersionVO implements Serializable {
|
||||||
public class CommonReleaseVersionVO extends CommonReleaseVersionEntity {
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@NotEmpty
|
||||||
|
private String versionName;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Integer appType;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Integer isForceUpdate;
|
||||||
|
|
||||||
|
@NotEmpty
|
||||||
|
private String updateContent;
|
||||||
|
|
||||||
|
private String privacyAgreementUrl;
|
||||||
|
|
||||||
|
private String userAgreementUrl;
|
||||||
|
|
||||||
|
@NotEmpty
|
||||||
|
private String downloadUrl;
|
||||||
|
|
||||||
|
private String dispatchUrl;
|
||||||
|
|
||||||
|
private String dispatchTargetVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,4 +26,6 @@ public interface ICommonReleaseVersionService extends BaseService<CommonReleaseV
|
|||||||
boolean applyStatus(Long id);
|
boolean applyStatus(Long id);
|
||||||
|
|
||||||
CheckVersionResponse checkUpdate(Integer type, String version, String brand);
|
CheckVersionResponse checkUpdate(Integer type, String version, String brand);
|
||||||
|
|
||||||
|
boolean createVersion(CommonReleaseVersionVO vo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
package org.springblade.modules.common.service.impl;
|
package org.springblade.modules.common.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.jspecify.annotations.NonNull;
|
||||||
|
import org.semver4j.Semver;
|
||||||
import org.springblade.core.log.exception.ServiceException;
|
import org.springblade.core.log.exception.ServiceException;
|
||||||
import org.springblade.modules.api.response.CheckVersionResponse;
|
import org.springblade.modules.api.response.CheckVersionResponse;
|
||||||
|
import org.springblade.modules.common.convert.CommonReleaseVersionConvert;
|
||||||
|
import org.springblade.modules.common.eums.AppMarketChannelEnum;
|
||||||
|
import org.springblade.modules.common.eums.AppType;
|
||||||
|
import org.springblade.modules.common.eums.VersionStatus;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
||||||
import org.springblade.modules.common.mapper.CommonReleaseVersionMapper;
|
import org.springblade.modules.common.mapper.CommonReleaseVersionMapper;
|
||||||
@@ -9,6 +18,12 @@ import org.springblade.modules.common.service.ICommonReleaseVersionService;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP版本发布管理 服务实现类
|
* APP版本发布管理 服务实现类
|
||||||
@@ -21,7 +36,7 @@ public class CommonReleaseVersionServiceImpl extends BaseServiceImpl<CommonRelea
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<CommonReleaseVersionVO> selectCommonReleaseVersionPage(IPage<CommonReleaseVersionVO> page, CommonReleaseVersionVO commonReleaseVersion) {
|
public IPage<CommonReleaseVersionVO> selectCommonReleaseVersionPage(IPage<CommonReleaseVersionVO> page, CommonReleaseVersionVO commonReleaseVersion) {
|
||||||
return page.setRecords(baseMapper.selectCommonReleaseVersionPage(page, commonReleaseVersion));
|
return page.setRecords(baseMapper.selectCustomerCommonReleaseVersionPage(page, commonReleaseVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -39,5 +54,68 @@ public class CommonReleaseVersionServiceImpl extends BaseServiceImpl<CommonRelea
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean createVersion(CommonReleaseVersionVO vo) {
|
||||||
|
AppType appType = AppType.fromCode(vo.getAppType());
|
||||||
|
if (appType == null) {
|
||||||
|
throw new ServiceException("无效类型");
|
||||||
|
}
|
||||||
|
Semver semver = parseSemver((vo.getVersionName()));
|
||||||
|
CommonReleaseVersionEntity current = baseMapper.selectOne(
|
||||||
|
Wrappers.lambdaQuery(CommonReleaseVersionEntity.class)
|
||||||
|
.eq(CommonReleaseVersionEntity::getAppType, vo.getAppType())
|
||||||
|
.ne(CommonReleaseVersionEntity::getStatus, VersionStatus.EXPIRED.getCode())
|
||||||
|
.orderByDesc(CommonReleaseVersionEntity::getId)
|
||||||
|
.last("LIMIT 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
if (current != null) {
|
||||||
|
Semver currentSemver = parseSemver(current.getVersionName());
|
||||||
|
if (currentSemver.isGreaterThan(semver)) {
|
||||||
|
throw new ServiceException("当前版本号过小");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<CommonReleaseVersionEntity> versionList = new ArrayList<>();
|
||||||
|
CommonReleaseVersionEntity officialVersion = getCommonReleaseVersionEntity(vo);
|
||||||
|
versionList.add(officialVersion);
|
||||||
|
versionList.add(getCopyByChannel(officialVersion, AppMarketChannelEnum.PGYER));
|
||||||
|
|
||||||
|
if (vo.getAppType().equals(AppType.APP.getCode())) {
|
||||||
|
Arrays.stream(AppMarketChannelEnum.values()).filter(channel -> channel != AppMarketChannelEnum.PGYER && channel != AppMarketChannelEnum.OFFICIAL).forEach(channel -> {
|
||||||
|
versionList.add(getCopyByChannel(officialVersion, channel));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return saveBatch(versionList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CommonReleaseVersionEntity getCommonReleaseVersionEntity(CommonReleaseVersionVO vo) {
|
||||||
|
CommonReleaseVersionEntity entity = new CommonReleaseVersionEntity();
|
||||||
|
// 手动设 VO 特有字段(或也可用另一个 MapStruct VO->Entity)
|
||||||
|
entity.setVersionName(vo.getVersionName());
|
||||||
|
entity.setAppType(vo.getAppType());
|
||||||
|
entity.setPrivacyAgreementUrl(vo.getPrivacyAgreementUrl());
|
||||||
|
entity.setUserAgreementUrl(vo.getUserAgreementUrl());
|
||||||
|
entity.setIsForceUpdate(vo.getIsForceUpdate());
|
||||||
|
entity.setUpdateContent(vo.getUpdateContent());
|
||||||
|
entity.setDownloadUrl(vo.getDownloadUrl());
|
||||||
|
entity.setDispatchUrl(vo.getDispatchUrl());
|
||||||
|
entity.setDispatchTargetVersion(vo.getDispatchTargetVersion());
|
||||||
|
// 使用 MapStruct 设置渠道和状态
|
||||||
|
return CommonReleaseVersionConvert.INSTANCE.copyForChannel(entity, AppMarketChannelEnum.OFFICIAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CommonReleaseVersionEntity getCopyByChannel(CommonReleaseVersionEntity entity, AppMarketChannelEnum channel) {
|
||||||
|
return CommonReleaseVersionConvert.INSTANCE.copyForChannel(entity, channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Semver parseSemver(String versionName) {
|
||||||
|
Semver semver = Semver.coerce(versionName);
|
||||||
|
if (semver == null) {
|
||||||
|
throw new ServiceException("无效版本号: " + versionName);
|
||||||
|
}
|
||||||
|
return semver;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user