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/license/controller/LicenseController.java
fengjunfeng 9a8f2d47ac 目录修改
2022-01-21 16:24:47 +08:00

48 lines
1.5 KiB
Java

package com.license.controller;
import cn.hutool.log.Log;
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;
/**
* @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) {
if (licenseInfo.getType().equals(Constant.LICENSE_C2V)){
//获取C2V信息
return HaspUtil.readC2V(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
}else if (licenseInfo.getType().equals(Constant.LICENSE_UPDATE)){
//上传license信息
return HaspUtil.updateKeyWithLicense(licenseInfo.getV2C());
}else if (licenseInfo.getType().equals(Constant.LICENSE_QUERY)){
//获取license信息
return HaspUtil.getLicenseInfo(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
}else if (licenseInfo.getType().equals(Constant.LICENSE_VERIFY)){
//验证license信息
return HaspUtil.verify(licenseInfo.getVendorCode(),licenseInfo.getFeatureId());
}else {
log.info("type error");
return null;
}
}
}