hshzz 1 неделя назад
Родитель
Сommit
1fca540281

+ 3 - 3
src/main/java/com/ruoyi/business/service/impl/licenseServiceImpl.java

@@ -19,7 +19,7 @@ import java.io.InputStreamReader;
 @Service
 public class licenseServiceImpl implements LicenseService {
 
-    public static int DELAY_DAY = 15 ;
+    public static int DELAY_DAY = 14 ;
 
     @Value("${jsPath}")
     private String jsPath;
@@ -45,7 +45,7 @@ public class licenseServiceImpl implements LicenseService {
         private String createLicenseForDZ(String licenseCode) {
         String strRobotNum = "999";
         DateTime endTime = DateUtil.offset(DateUtil.date(), DateField.DAY_OF_YEAR, DELAY_DAY);
-        String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss");
+        String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd") + " 23:59:59";
         System.out.println("到期时间:" + endTimeStr);
 
         //        下属数字员工个数
@@ -79,7 +79,7 @@ public class licenseServiceImpl implements LicenseService {
     private String createLicenseForSP(String licenseCode) {
         try {
             DateTime endTime = DateUtil.offset(DateUtil.date(), DateField.DAY_OF_YEAR, DELAY_DAY);
-            String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss");
+            String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd") + " 23:59:59";
             System.out.println("到期时间:" + endTimeStr);
             String command = "node".concat(" ").concat(jsPath)
                     .concat(" ").concat(licenseCode).concat(" ").concat(endTimeStr);

+ 1 - 2
src/main/resources/application.yml

@@ -1,7 +1,6 @@
 server:
   port: 9623
-
-jsPath:  E:\workspace\jx\workSpace\approval\ApprovalHelper_key\cl.js
+jsPath: /diaozheng/license/approval/cl.js
 #jsPath:   /my/ApprovalHelper_key/cl.js
 
 

+ 91 - 0
src/main/resources/static/index.html

@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta
+      name="viewport"
+      content="width=device-width, initial-scale=1.0" />
+    <title>Document</title>
+  </head>
+  <body>
+    <div>
+      机器码:<input
+        id="input1"
+        type="text" />
+    </div>
+    <div>
+      类型:
+      <input
+        type="radio"
+        id="option1"
+        name="group1"
+        value="dz" />
+      <label for="option1">调证</label>
+      <input
+        type="radio"
+        id="option2"
+        name="group1"
+        value="sp" />
+      <label for="option2">审批</label>
+    </div>
+    <button id="submit">生成License</button
+    ><button id="copy">复制License</button>
+    <div id="result"></div>
+  </body>
+
+  <script>
+    const getLicense = () => {
+      const machineCode = document.querySelector("#input1").value;
+      const type = document.querySelector('input[name="group1"]:checked').value;
+      console.log(machineCode, type);
+      if (machineCode && type) {
+        fetch(
+          `http://221.226.175.250:2230/license/create?machineCode=${machineCode}&type=${type}`,
+          {
+            method: "get",
+          }
+        )
+          .then((res) => {
+            return res.text();
+          })
+          .then((res) => {
+            const result = document.querySelector("#result");
+            result.innerText = res;
+          });
+      }
+    }
+    const copyText = async (val, callback) => {
+      if (navigator.clipboard && navigator.permissions) {
+        await navigator.clipboard.writeText(val);
+        if (callback) callback();
+      } else {
+        const textArea = document.createElement("textArea");
+        textArea.value = val;
+        textArea.style.width = 0;
+        textArea.style.position = "fixed";
+        textArea.style.left = "-999px";
+        textArea.style.top = "10px";
+        textArea.setAttribute("readonly", "readonly");
+        document.body.appendChild(textArea);
+        textArea.select();
+        document.execCommand("copy");
+        document.body.removeChild(textArea);
+        if (callback) callback();
+      }
+    };
+    const handleCopyText = ()=>{
+      const result = document.querySelector("#result").innerText.trim();
+      if(result){
+        copyText(result,()=>{
+          alert('复制成功,复制内容为:' + result)
+        })
+      }
+    }
+    window.onload = () => {
+      const btn = document.querySelector("#submit");
+      const btn2 = document.querySelector("#copy");
+      btn.addEventListener("click", getLicense);
+      btn2.addEventListener("click", handleCopyText);
+    };
+  </script>
+</html>