summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfengjunfeng <[email protected]>2022-01-13 19:00:24 +0800
committerfengjunfeng <[email protected]>2022-01-13 19:00:24 +0800
commite9f2532a7818fd32aa40e8aa69285bb6cf9752fb (patch)
tree6a4e69f61a41541fdb7ec25ec796f557d5c9f850
parent0552e11b68694e953158f07f551a0448644c945d (diff)
license常量信息
-rw-r--r--src/main/java/com/sentinel/license/controller/LicenseController.java9
-rw-r--r--src/main/java/com/sentinel/license/utils/Constant.java22
2 files changed, 27 insertions, 4 deletions
diff --git a/src/main/java/com/sentinel/license/controller/LicenseController.java b/src/main/java/com/sentinel/license/controller/LicenseController.java
index 9ed62a0..67638c6 100644
--- a/src/main/java/com/sentinel/license/controller/LicenseController.java
+++ b/src/main/java/com/sentinel/license/controller/LicenseController.java
@@ -2,6 +2,7 @@ package com.sentinel.license.controller;
import cn.hutool.log.Log;
import com.sentinel.license.bean.LicenseInfo;
+import com.sentinel.license.utils.Constant;
import com.sentinel.license.utils.HaspUtil;
import org.springframework.web.bind.annotation.*;
@@ -23,16 +24,16 @@ public class LicenseController {
*/
@PostMapping("/licenseOperation")
public Object licenseOperation(@RequestBody LicenseInfo licenseInfo) {
- if (licenseInfo.getType() == 1){
+ if (licenseInfo.getType().equals(Constant.LICENSE_C2V)){
//获取C2V信息
return HaspUtil.readC2V(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
- }else if (licenseInfo.getType() == 2){
+ }else if (licenseInfo.getType().equals(Constant.LICENSE_UPDATE)){
//上传license信息
return HaspUtil.updateKeyWithLicense(licenseInfo.getV2C());
- }else if (licenseInfo.getType() == 3){
+ }else if (licenseInfo.getType().equals(Constant.LICENSE_QUERY)){
//获取license信息
return HaspUtil.getLicenseInfo(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
- }else if (licenseInfo.getType() == 4){
+ }else if (licenseInfo.getType().equals(Constant.LICENSE_VERIFY)){
//验证license信息
return HaspUtil.verify(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
}else {
diff --git a/src/main/java/com/sentinel/license/utils/Constant.java b/src/main/java/com/sentinel/license/utils/Constant.java
new file mode 100644
index 0000000..19948a7
--- /dev/null
+++ b/src/main/java/com/sentinel/license/utils/Constant.java
@@ -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;
+}