diff --git a/src/main/java/com/license/controller/LicenseController.java b/src/main/java/com/license/controller/LicenseController.java index 01b3f71..24c9cd8 100644 --- a/src/main/java/com/license/controller/LicenseController.java +++ b/src/main/java/com/license/controller/LicenseController.java @@ -41,9 +41,9 @@ public class LicenseController { */ @PostMapping("/licenseOperation") public Object licenseOperation(@RequestBody LicenseInfo licenseInfo) { -// if (!verify(licenseInfo.getServerId())){ -// return null; -// } + if (!verify(licenseInfo.getServerId())){ + return null; + } if (licenseInfo.getType().equals(Constant.LICENSE_C2V)){ //获取C2V信息 return HaspUtil.readC2V(licenseInfo.getVendorCode(),licenseInfo.getFeatureId()); @@ -77,9 +77,8 @@ public class LicenseController { headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); HttpEntity httpEntity = new HttpEntity<>(null, headers); String url = "http://" + GetIpProtUtil.getLocalIP() +":" + port + "/getServerId"; - ResponseEntity entity = restTemplate.exchange(url, HttpMethod.GET,httpEntity,Map.class); - log.info("license status: {}", JSONUtil.toJsonStr(entity)); - String str = MapUtil.get(entity.getBody(), "data", String.class); + String str = restTemplate.exchange(url, HttpMethod.GET,httpEntity,String.class).getBody(); + log.info("license bifang_api server id: {}", str); if (str.equals(serverId)){ return true; } @@ -90,16 +89,16 @@ public class LicenseController { } - @PostMapping("/test") - public Object test() { - verify("1111"); - - if (CacheManager.getCache("test") == null){ - CacheManager.addCache("test","11111"); - }else { - System.out.println(CacheManager.getCache("test")); - } - return null; - } +// @PostMapping("/test") +// public Object test() { +// verify("1111"); +// +// if (CacheManager.getCache("test") == null){ +// CacheManager.addCache("test","11111"); +// }else { +// System.out.println(CacheManager.getCache("test")); +// } +// return null; +// } } diff --git a/src/test/java/com/sentinel/license/LicenseApplicationTests.java b/src/test/java/com/sentinel/license/LicenseApplicationTests.java deleted file mode 100644 index 8f7f818..0000000 --- a/src/test/java/com/sentinel/license/LicenseApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.sentinel.license; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class LicenseApplicationTests { - - @Test - void contextLoads() { - } - -}