license常量信息

This commit is contained in:
fengjunfeng
2022-01-13 19:00:24 +08:00
parent 0552e11b68
commit e9f2532a78
2 changed files with 27 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package com.sentinel.license.controller;
import cn.hutool.log.Log; import cn.hutool.log.Log;
import com.sentinel.license.bean.LicenseInfo; import com.sentinel.license.bean.LicenseInfo;
import com.sentinel.license.utils.Constant;
import com.sentinel.license.utils.HaspUtil; import com.sentinel.license.utils.HaspUtil;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -23,16 +24,16 @@ public class LicenseController {
*/ */
@PostMapping("/licenseOperation") @PostMapping("/licenseOperation")
public Object licenseOperation(@RequestBody LicenseInfo licenseInfo) { public Object licenseOperation(@RequestBody LicenseInfo licenseInfo) {
if (licenseInfo.getType() == 1){ if (licenseInfo.getType().equals(Constant.LICENSE_C2V)){
//获取C2V信息 //获取C2V信息
return HaspUtil.readC2V(licenseInfo.getVendorCode(),licenseInfo.getFeatureId()); return HaspUtil.readC2V(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
}else if (licenseInfo.getType() == 2){ }else if (licenseInfo.getType().equals(Constant.LICENSE_UPDATE)){
//上传license信息 //上传license信息
return HaspUtil.updateKeyWithLicense(licenseInfo.getV2C()); return HaspUtil.updateKeyWithLicense(licenseInfo.getV2C());
}else if (licenseInfo.getType() == 3){ }else if (licenseInfo.getType().equals(Constant.LICENSE_QUERY)){
//获取license信息 //获取license信息
return HaspUtil.getLicenseInfo(licenseInfo.getVendorCode(),licenseInfo.getFeatureId()); return HaspUtil.getLicenseInfo(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
}else if (licenseInfo.getType() == 4){ }else if (licenseInfo.getType().equals(Constant.LICENSE_VERIFY)){
//验证license信息 //验证license信息
return HaspUtil.verify(licenseInfo.getVendorCode(),licenseInfo.getFeatureId()); return HaspUtil.verify(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
}else { }else {

View File

@@ -0,0 +1,22 @@
package com.sentinel.license.utils;
/**
* @author fengjunfeng
* @date 2022/1/13
* @time 13:45
* @description
**/
public class Constant {
//获取c2v信息
public static final Integer LICENSE_C2V = 1;
//更新license信息
public static final Integer LICENSE_UPDATE = 2;
//查询license信息
public static final Integer LICENSE_QUERY = 3;
//验证授权信息
public static final Integer LICENSE_VERIFY = 4;
}