pc端版本更新返回信息修改

This commit is contained in:
2026-01-08 16:49:29 +08:00
parent 0b7fb7748a
commit 202cfe4d26

View File

@@ -30,7 +30,7 @@ import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIg
import static com.zt.plat.framework.common.pojo.CommonResult.success; import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils; import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.alibaba.fastjson.JSONObject;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog; import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*; import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
@@ -121,7 +121,7 @@ public class VersionManagementController extends AbstractFileUploadController im
@GetMapping("/checkUpdate") @GetMapping("/checkUpdate")
@Operation(summary = "根据更新平台和安装包类型获取最新客户端版本管理信息") @Operation(summary = "根据更新平台和安装包类型获取最新客户端版本管理信息")
public CommonResult<VersionManagementRespVO> checkUpdate(@Valid VersionManagementPageReqVO pageReqVO) { public Object checkUpdate(@Valid VersionManagementPageReqVO pageReqVO) {
if (pageReqVO.getApplicationCode() == null ) { if (pageReqVO.getApplicationCode() == null ) {
return CommonResult.error(400, "客户端编号不能为空"); return CommonResult.error(400, "客户端编号不能为空");
@@ -130,10 +130,42 @@ public class VersionManagementController extends AbstractFileUploadController im
return CommonResult.error(400, "更新平台不能为空"); return CommonResult.error(400, "更新平台不能为空");
} }
PageResult<VersionManagementDO> pageResult = systemVersionManagementService.getList(pageReqVO); PageResult<VersionManagementDO> pageResult = systemVersionManagementService.getList(pageReqVO);
if ("pc".equals(pageReqVO.getUpdatePlatform())) {
String version = "0.0.0";
String minVersion = "0.0.0";
String checksumSha1 = "";
String url = "";
String log = "";
if (pageResult.getList().size() != 0) {
VersionManagementDO versionManagementDO = pageResult.getList().get(0);
version = versionManagementDO.getCurrentVersion();
minVersion = versionManagementDO.getMinimumVersion();
url = versionManagementDO.getDownloadUrl();
log = versionManagementDO.getUpdateContent();
checksumSha1 = versionManagementDO.getFileEncryptAlgorithm();
}
JSONObject resultJson = new JSONObject();
resultJson.put("version", version);
resultJson.put("url", url);
resultJson.put("changelog", log);
JSONObject mandatory = new JSONObject();
mandatory.put("value", true);
mandatory.put("minVersion", minVersion);
mandatory.put("mode", 2);
resultJson.put("mandatory", mandatory);
JSONObject checksum = new JSONObject();
checksum.put("hashingAlgorithm", "SHA1");
checksum.put("value", checksumSha1);
resultJson.put("checksum", checksum);
return resultJson;
}
if (pageResult.getList().size() == 0) { if (pageResult.getList().size() == 0) {
return CommonResult.error(400, "没有可更新版本"); return CommonResult.error(400, "没有可更新版本");
} }
VersionManagementDO versionManagementDO = pageResult.getList().get(0); VersionManagementDO versionManagementDO = pageResult.getList().get(0);
return success(BeanUtils.toBean(versionManagementDO, VersionManagementRespVO.class)); return success(BeanUtils.toBean(versionManagementDO, VersionManagementRespVO.class));
} }