|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
|
+import com.qmth.boot.core.exception.ParameterException;
|
|
|
import com.qmth.boot.tools.device.DeviceInfo;
|
|
|
import com.qmth.ops.api.constants.OpsApiConstants;
|
|
|
import com.qmth.ops.api.dto.DeployForm;
|
|
@@ -13,6 +14,7 @@ import com.qmth.ops.api.vo.*;
|
|
|
import com.qmth.ops.biz.domain.AppDeploy;
|
|
|
import com.qmth.ops.biz.domain.Deploy;
|
|
|
import com.qmth.ops.biz.domain.DeployMode;
|
|
|
+import com.qmth.ops.biz.domain.Version;
|
|
|
import com.qmth.ops.biz.query.DeployQuery;
|
|
|
import com.qmth.ops.biz.query.OrgQuery;
|
|
|
import com.qmth.ops.biz.service.*;
|
|
@@ -38,6 +40,9 @@ public class DeployController {
|
|
|
@Resource
|
|
|
private AppService appService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private VersionService versionService;
|
|
|
+
|
|
|
@Resource
|
|
|
private FileService fileService;
|
|
|
|
|
@@ -129,11 +134,23 @@ public class DeployController {
|
|
|
@PostMapping("/license/download")
|
|
|
public void licenseDownload(@RequestAttribute AdminSession adminSession, HttpServletResponse response,
|
|
|
@RequestParam Long id, @RequestParam(required = false) String deviceId,
|
|
|
- @RequestParam(required = false) String version) throws Exception {
|
|
|
+ @RequestParam(required = false) Long versionId) throws Exception {
|
|
|
adminSession.hasPermission(Permission.DEPLOY_LICENSE_DOWNLOAD, id);
|
|
|
+ Deploy deploy = deployService.findById(id);
|
|
|
+ if (deploy == null) {
|
|
|
+ throw new ParameterException("invalid deploy id");
|
|
|
+ }
|
|
|
+ String versionName = null;
|
|
|
+ if (versionId != null) {
|
|
|
+ Version version = versionService.getById(versionId);
|
|
|
+ if (version == null || version.getArchived() || !version.getAppId().equals(deploy.getAppId())) {
|
|
|
+ throw new ParameterException("invalid versionId");
|
|
|
+ }
|
|
|
+ versionName = version.getName();
|
|
|
+ }
|
|
|
response.setContentType("application/octet-stream; charset=utf-8");
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=app.lic");
|
|
|
- licenseService.buildLicense(deployService.findById(id), deviceId, version, response.getOutputStream());
|
|
|
+ licenseService.buildLicense(deploy, deviceId, versionName, response.getOutputStream());
|
|
|
}
|
|
|
|
|
|
@PostMapping("/org/list")
|