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; } } }