AE86 1 anno fa
parent
commit
12cfa3bc0e

+ 19 - 0
dbsyncer-biz/src/main/java/org/dbsyncer/biz/impl/DefaultLicenseServiceImpl.java

@@ -3,8 +3,12 @@
  */
 package org.dbsyncer.biz.impl;
 
+import org.dbsyncer.common.util.StringUtil;
+import org.dbsyncer.sdk.model.ProductInfo;
 import org.dbsyncer.sdk.spi.LicenseService;
 
+import java.io.File;
+
 /**
  * @Author AE86
  * @Version 1.0.0
@@ -12,4 +16,19 @@ import org.dbsyncer.sdk.spi.LicenseService;
  */
 public final class DefaultLicenseServiceImpl implements LicenseService {
 
+    @Override
+    public String getLicensePath() {
+        return new StringBuilder(System.getProperty("user.dir")).append(File.separatorChar).append("conf")
+                .append(File.separatorChar).toString();
+    }
+
+    @Override
+    public String getKey() {
+        return StringUtil.EMPTY;
+    }
+
+    @Override
+    public ProductInfo getProductInfo() {
+        return null;
+    }
 }

+ 3 - 13
dbsyncer-sdk/src/main/java/org/dbsyncer/sdk/spi/LicenseService.java

@@ -3,11 +3,8 @@
  */
 package org.dbsyncer.sdk.spi;
 
-import org.dbsyncer.common.util.StringUtil;
 import org.dbsyncer.sdk.model.ProductInfo;
 
-import java.io.File;
-
 /**
  * @Author AE86
  * @Version 1.0.0
@@ -18,26 +15,19 @@ public interface LicenseService {
     /**
      * 获取License上传路径 dbsyncer/conf/
      */
-    default String getLicensePath() {
-        return new StringBuilder(System.getProperty("user.dir")).append(File.separatorChar).append("conf")
-                .append(File.separatorChar).toString();
-    }
+    String getLicensePath();
 
     /**
      * 获取授权KEY
      *
      * @return
      */
-    default String getKey() {
-        return StringUtil.EMPTY;
-    }
+    String getKey();
 
     /**
      * 获取授权信息
      *
      * @return
      */
-    default ProductInfo getProductInfo() {
-        return null;
-    }
+    ProductInfo getProductInfo();
 }

+ 23 - 1
dbsyncer-web/src/main/resources/public/license/license.html

@@ -14,9 +14,31 @@
     <form th:if="${not #strings.isEmpty(key)}" class="form-horizontal" role="form">
         <div class="row text-center">
             <div class="page-header">
-                <h3>授权许可</h3>
+                <h3>授权许可<img draggable="false" title="授权成功" th:src="@{'/img/check-circle.png'}"></h3>
             </div>
         </div>
+        <div class="form-group">
+            <table class="table table-hover">
+                <caption>已授权([[${productInfo?.products?.size()} ?: 0]])</caption>
+                <thead>
+                <tr>
+                    <th></th>
+                    <th>产品名称</th>
+                    <th>有效期限</th>
+                </tr>
+                </thead>
+                <tbody>
+                <tr th:id="${p?.name}" th:each="p,state : ${productInfo?.products}">
+                    <td>[[${state.index+1}]]</td>
+                    <!-- 已过期 -->
+                    <td th:if="${#dates.createNow()?.time} > ${p?.effectiveTime}">[[${p?.name}]]<img draggable="false" width="30px" height="30px" title="已过期" th:src="@{'/img/warning.png'}"></td>
+                    <!-- 有效期 -->
+                    <td th:if="${#dates.createNow()?.time} < ${p?.effectiveTime}">[[${p?.name}]]<img draggable="false" width="30px" height="30px" th:src="@{'/img/check.png'}"></td>
+                    <td th:text="${#dates.format(p?.effectiveTime, 'yyyy-MM-dd HH:mm:ss')}"/>
+                </tr>
+                </tbody>
+            </table>
+        </div>
 
         <div class="panel panel-info">
             <div class="panel-heading">

BIN
dbsyncer-web/src/main/resources/static/img/check-circle.png


BIN
dbsyncer-web/src/main/resources/static/img/check.png


BIN
dbsyncer-web/src/main/resources/static/img/warning.png