This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-license-admi…/src/main/java/com/sentinel/license/controller/LicenseController.java

46 lines
1.5 KiB
Java
Raw Normal View History

2021-12-29 11:37:15 +08:00
package com.sentinel.license.controller;
import cn.hutool.log.Log;
import com.sentinel.license.bean.LicenseInfo;
2022-01-13 19:00:24 +08:00
import com.sentinel.license.utils.Constant;
2021-12-29 11:37:15 +08:00
import com.sentinel.license.utils.HaspUtil;
import org.springframework.web.bind.annotation.*;
/**
* @author fengjunfeng
* @date 2021/12/28
* @time 16:00
* @description
**/
@RestController
public class LicenseController {
private static final Log log = Log.get();
/**
* license锁信息交互
*
* @return
*/
@PostMapping("/licenseOperation")
public Object licenseOperation(@RequestBody LicenseInfo licenseInfo) {
2022-01-13 19:00:24 +08:00
if (licenseInfo.getType().equals(Constant.LICENSE_C2V)){
2021-12-29 11:37:15 +08:00
//获取C2V信息
return HaspUtil.readC2V(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
2022-01-13 19:00:24 +08:00
}else if (licenseInfo.getType().equals(Constant.LICENSE_UPDATE)){
2021-12-29 11:37:15 +08:00
//上传license信息
return HaspUtil.updateKeyWithLicense(licenseInfo.getV2C());
2022-01-13 19:00:24 +08:00
}else if (licenseInfo.getType().equals(Constant.LICENSE_QUERY)){
2021-12-29 11:37:15 +08:00
//获取license信息
return HaspUtil.getLicenseInfo(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
2022-01-13 19:00:24 +08:00
}else if (licenseInfo.getType().equals(Constant.LICENSE_VERIFY)){
2021-12-29 11:37:15 +08:00
//验证license信息
return HaspUtil.verify(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
}else {
log.info("type error");
return null;
}
}
}