2022-01-21 16:24:47 +08:00
|
|
|
package com.license.controller;
|
2021-12-29 11:37:15 +08:00
|
|
|
|
|
|
|
|
import cn.hutool.log.Log;
|
2022-01-21 16:24:47 +08:00
|
|
|
import com.license.bean.LicenseInfo;
|
|
|
|
|
import com.license.utils.Constant;
|
|
|
|
|
import com.license.utils.HaspUtil;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
2021-12-29 11:37:15 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|