build: license 相关代码
This commit is contained in:
parent
d0c99d2d2f
commit
a55fbacfe0
|
@ -0,0 +1,21 @@
|
|||
package io.metersphere.sdk.controller;
|
||||
|
||||
import io.metersphere.sdk.dto.LicenseDTO;
|
||||
import io.metersphere.sdk.service.LicenseService;
|
||||
import io.metersphere.sdk.util.CommonBeanFactory;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/license")
|
||||
public class LicenseValidateController {
|
||||
@GetMapping("/validate")
|
||||
public LicenseDTO validate() {
|
||||
LicenseService licenseService = CommonBeanFactory.getBean(LicenseService.class);
|
||||
if (licenseService != null) {
|
||||
return licenseService.validate();
|
||||
}
|
||||
return new LicenseDTO();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package io.metersphere.sdk.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class LicenseDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String status;
|
||||
|
||||
private LicenseInfoDTO license;
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package io.metersphere.sdk.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class LicenseInfoDTO implements Serializable {
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String corporation;
|
||||
/**
|
||||
* 授权截止时间
|
||||
*/
|
||||
private String expired;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String product;
|
||||
/**
|
||||
* 产品版本
|
||||
*/
|
||||
private String edition;
|
||||
/**
|
||||
* icense版本
|
||||
*/
|
||||
private String licenseVersion;
|
||||
/**
|
||||
* 授权数量
|
||||
*/
|
||||
private int count;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package io.metersphere.sdk.service;
|
||||
|
||||
|
||||
import io.metersphere.sdk.dto.LicenseDTO;
|
||||
|
||||
public interface LicenseService {
|
||||
|
||||
LicenseDTO refreshLicense();
|
||||
|
||||
LicenseDTO validate();
|
||||
|
||||
}
|
Loading…
Reference in New Issue