update:
1. update check-update api
This commit is contained in:
@@ -11,6 +11,8 @@ 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.dto.CommonReleaseVersionDTO;
|
||||||
|
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionDetailVO;
|
||||||
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;
|
||||||
@@ -19,6 +21,8 @@ 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.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP版本发布管理 控制器
|
* APP版本发布管理 控制器
|
||||||
@@ -44,6 +48,7 @@ public class CommonReleaseVersionController extends BladeController {
|
|||||||
CommonReleaseVersionEntity detail = commonReleaseVersionService.getOne(Condition.getQueryWrapper(commonReleaseVersion));
|
CommonReleaseVersionEntity detail = commonReleaseVersionService.getOne(Condition.getQueryWrapper(commonReleaseVersion));
|
||||||
return R.data(CommonReleaseVersionWrapper.build().entityVO(detail));
|
return R.data(CommonReleaseVersionWrapper.build().entityVO(detail));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP版本发布管理 分页
|
* APP版本发布管理 分页
|
||||||
*/
|
*/
|
||||||
@@ -55,6 +60,16 @@ public class CommonReleaseVersionController extends BladeController {
|
|||||||
return R.data(CommonReleaseVersionWrapper.build().pageVO(pages));
|
return R.data(CommonReleaseVersionWrapper.build().pageVO(pages));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP版本发布管理 详情查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail-list")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@Operation(summary = "详情查询", description = "传入versionName、appType")
|
||||||
|
public R<List<CommonReleaseVersionDetailVO>> detailList(String versionName, Integer appType) {
|
||||||
|
return R.data(commonReleaseVersionService.selectDetaiList(versionName, appType));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP版本发布管理 自定义分页
|
* APP版本发布管理 自定义分页
|
||||||
*/
|
*/
|
||||||
@@ -108,10 +123,10 @@ public class CommonReleaseVersionController extends BladeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/applyStatus")
|
@PostMapping("/publish")
|
||||||
@ApiOperationSupport(order = 8)
|
@ApiOperationSupport(order = 8)
|
||||||
@Operation(summary = "上下架版本信息", description = "releaseVersion.id")
|
@Operation(summary = "上架版本")
|
||||||
public R applyStatus(CommonReleaseVersionEntity releaseVersion) {
|
public R publish(@Valid @RequestBody CommonReleaseVersionDTO dto) {
|
||||||
return R.status(commonReleaseVersionService.applyStatus(releaseVersion.getId()));
|
return R.status(commonReleaseVersionService.publish(dto.getId(), dto.getDownloadUrl()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import lombok.Getter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum VersionStatus {
|
public enum VersionStatus {
|
||||||
ENABLED(1, "启用"),
|
ENABLED(1, "已启用"),
|
||||||
PUBLISHED(2, "已上架"),
|
PUBLISHED(2, "已上架"),
|
||||||
EXPIRED(3, "过期");
|
EXPIRED(3, "已过期");
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.springblade.modules.common.mapper;
|
package org.springblade.modules.common.mapper;
|
||||||
|
|
||||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||||
|
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionDetailVO;
|
||||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
@@ -25,6 +26,6 @@ public interface CommonReleaseVersionMapper extends BaseMapper<CommonReleaseVers
|
|||||||
|
|
||||||
List<CommonReleaseVersionVO> selectCustomerCommonReleaseVersionPage(IPage page, CommonReleaseVersionVO commonReleaseVersion);
|
List<CommonReleaseVersionVO> selectCustomerCommonReleaseVersionPage(IPage page, CommonReleaseVersionVO commonReleaseVersion);
|
||||||
|
|
||||||
|
List<CommonReleaseVersionDetailVO> selectDetaiList(String versionName, Integer appType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,5 +43,12 @@
|
|||||||
ORDER BY string_to_array(version_name, '.')::int[] DESC, app_type, id DESC
|
ORDER BY string_to_array(version_name, '.')::int[] DESC, app_type, id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDetaiList" resultType="org.springblade.modules.common.pojo.vo.CommonReleaseVersionDetailVO">
|
||||||
|
select id, channel_code, download_url, status
|
||||||
|
from release_version
|
||||||
|
where is_deleted = 0
|
||||||
|
and version_name = #{versionName}
|
||||||
|
and app_type = #{appType}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -25,10 +25,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.springblade.modules.common.pojo.dto;
|
package org.springblade.modules.common.pojo.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP版本发布管理 数据传输对象实体类
|
* APP版本发布管理 数据传输对象实体类
|
||||||
@@ -37,9 +40,14 @@ import java.io.Serial;
|
|||||||
* @since 2026-04-01
|
* @since 2026-04-01
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
public class CommonReleaseVersionDTO implements Serializable {
|
||||||
public class CommonReleaseVersionDTO extends CommonReleaseVersionEntity {
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@NotNull(message = "ID 不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotBlank(message = "上架链接不能为空")
|
||||||
|
private String downloadUrl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
* BladeX Commercial License Agreement
|
||||||
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||||
|
* <p>
|
||||||
|
* Use of this software is governed by the Commercial License Agreement
|
||||||
|
* obtained after purchasing a license from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||||
|
* not liable for any claims arising from secondary or illegal development.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.modules.common.pojo.vo;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP版本发布管理 视图实体类
|
||||||
|
*
|
||||||
|
* @author BladeX
|
||||||
|
* @since 2026-04-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CommonReleaseVersionDetailVO implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
private String downloadUrl;
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,16 @@
|
|||||||
package org.springblade.modules.common.service;
|
package org.springblade.modules.common.service;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.springblade.modules.api.response.CheckVersionResponse;
|
import org.springblade.modules.api.response.CheckVersionResponse;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||||
|
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionDetailVO;
|
||||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseService;
|
import org.springblade.core.mp.base.BaseService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP版本发布管理 服务类
|
* APP版本发布管理 服务类
|
||||||
*
|
*
|
||||||
@@ -28,4 +33,8 @@ public interface ICommonReleaseVersionService extends BaseService<CommonReleaseV
|
|||||||
CheckVersionResponse checkUpdate(Integer type, String version, String brand);
|
CheckVersionResponse checkUpdate(Integer type, String version, String brand);
|
||||||
|
|
||||||
boolean createVersion(CommonReleaseVersionVO vo);
|
boolean createVersion(CommonReleaseVersionVO vo);
|
||||||
|
|
||||||
|
List<CommonReleaseVersionDetailVO> selectDetaiList(String versionName, Integer appType);
|
||||||
|
|
||||||
|
boolean publish(Long id, String downloadUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import jakarta.validation.Valid;
|
|||||||
import org.jspecify.annotations.NonNull;
|
import org.jspecify.annotations.NonNull;
|
||||||
import org.semver4j.Semver;
|
import org.semver4j.Semver;
|
||||||
import org.springblade.core.log.exception.ServiceException;
|
import org.springblade.core.log.exception.ServiceException;
|
||||||
|
import org.springblade.core.tool.utils.StringUtil;
|
||||||
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.convert.CommonReleaseVersionConvert;
|
||||||
import org.springblade.modules.common.eums.AppMarketChannelEnum;
|
import org.springblade.modules.common.eums.AppMarketChannelEnum;
|
||||||
@@ -13,6 +14,7 @@ import org.springblade.modules.common.eums.AppType;
|
|||||||
import org.springblade.modules.common.eums.PhoneBrand;
|
import org.springblade.modules.common.eums.PhoneBrand;
|
||||||
import org.springblade.modules.common.eums.VersionStatus;
|
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.CommonReleaseVersionDetailVO;
|
||||||
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;
|
||||||
import org.springblade.modules.common.service.ICommonReleaseVersionService;
|
import org.springblade.modules.common.service.ICommonReleaseVersionService;
|
||||||
@@ -136,6 +138,33 @@ public class CommonReleaseVersionServiceImpl extends BaseServiceImpl<CommonRelea
|
|||||||
return saveBatch(versionList);
|
return saveBatch(versionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CommonReleaseVersionDetailVO> selectDetaiList(String versionName, Integer appType) {
|
||||||
|
return baseMapper.selectDetaiList(versionName, appType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean publish(Long id, String downloadUrl) {
|
||||||
|
if (id == null || StringUtil.isBlank(downloadUrl)) {
|
||||||
|
throw new IllegalArgumentException("ID 和下载链接不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
CommonReleaseVersionEntity existing = getById(id);
|
||||||
|
if (existing == null) {
|
||||||
|
throw new ServiceException("版本不存在");
|
||||||
|
}
|
||||||
|
if (VersionStatus.PUBLISHED.getCode() == existing.getStatus()) {
|
||||||
|
throw new ServiceException("版本已上架,不可重复操作");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtil.isBlank(downloadUrl)) {
|
||||||
|
throw new ServiceException("下载链接不能为空");
|
||||||
|
}
|
||||||
|
existing.setDownloadUrl(downloadUrl);
|
||||||
|
existing.setStatus(VersionStatus.PUBLISHED.getCode());
|
||||||
|
return updateById(existing);
|
||||||
|
}
|
||||||
|
|
||||||
private static CommonReleaseVersionEntity getCommonReleaseVersionEntity(CommonReleaseVersionVO vo) {
|
private static CommonReleaseVersionEntity getCommonReleaseVersionEntity(CommonReleaseVersionVO vo) {
|
||||||
CommonReleaseVersionEntity entity = new CommonReleaseVersionEntity();
|
CommonReleaseVersionEntity entity = new CommonReleaseVersionEntity();
|
||||||
// 手动设 VO 特有字段(或也可用另一个 MapStruct VO->Entity)
|
// 手动设 VO 特有字段(或也可用另一个 MapStruct VO->Entity)
|
||||||
|
|||||||
Reference in New Issue
Block a user