|
@@ -0,0 +1,45 @@
|
|
|
+package com.fdkankan.ucenter.controller;
|
|
|
+
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/ucenter/license")
|
|
|
+public class LicenseController {
|
|
|
+
|
|
|
+ public static Node License() throws IOException, InterruptedException {
|
|
|
+ String authLicenseCommandCmd = "";
|
|
|
+ String licensePath = CmdBuildUtil.fdkkLaserConfig.buildCallPath + File.separator + "license" + File.separator;
|
|
|
+ File caches = new File(licensePath + "caches");
|
|
|
+ FileUtil.del(caches);
|
|
|
+ File results = new File(licensePath + "results");
|
|
|
+ FileUtil.del(results);
|
|
|
+
|
|
|
+ JSONObject licenseDataJson = new JSONObject();
|
|
|
+ licenseDataJson.put("split_type", "SPLIT_V23");
|
|
|
+ licenseDataJson.put("skybox_type", "SKYBOX_V5");
|
|
|
+ FileUtils.writeFile(licensePath + File.separator + "data.json", licenseDataJson.toString());
|
|
|
+ if (CmdBuildUtil.OS.isLinux()) {
|
|
|
+ authLicenseCommandCmd = CmdConstant.AUTH_LICENSE_WIN;
|
|
|
+ CmdUtils.callLineSh(authLicenseCommandCmd);
|
|
|
+ } else {
|
|
|
+ authLicenseCommandCmd = CmdConstant.AUTH_LICENSE_WIN
|
|
|
+ .replace("@inPath", licensePath);
|
|
|
+ CmdUtils.callLine(authLicenseCommandCmd);
|
|
|
+ }
|
|
|
+ int count = 10;
|
|
|
+ try {
|
|
|
+ for (int i = count; i > 0; i--) {
|
|
|
+ if (FileUtil.exist(licensePath + File.separator + "results" + File.separator + "encryption_info.xml")) {
|
|
|
+ Document document = XmlUtil.readXML(licensePath + File.separator + "results" + File.separator + "encryption_info.xml");
|
|
|
+ return XmlUtil.getNodeByXPath("//licenseInfo//snInfo", document);
|
|
|
+ }
|
|
|
+ Thread.sleep(1000);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|