Просмотр исходного кода

去掉日志删除,注册时,密码复杂度增加

wangjiang988 2 лет назад
Родитель
Сommit
f408d1f18a

+ 21 - 0
src/main/java/platform/common/util/CommonUtils.java

@@ -1,5 +1,6 @@
 package platform.common.util;
 
+import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -76,6 +77,26 @@ public class CommonUtils {
      */
     private static List<String> FILTER_STRINGS_LIST = null;
 
+    /**
+     * @return 符合长度要求 返回true
+     * @brief 检测密码复杂度是否为 强
+     * @param[in] password  密码字符串
+     */
+    public static void checkStrongPwd(String pwd) {
+        try {
+            Preconditions.checkNotNull(pwd);
+            if (!PwdCheckUtil.checkPasswordLength(pwd, "8", null)
+                    || !PwdCheckUtil.checkContainCase(pwd)
+                    || !PwdCheckUtil.checkContainDigit(pwd)
+                    || !PwdCheckUtil.checkContainSpecialChar(pwd)
+            ) {
+                throw new Exception("密码必须包含数字、字母、特殊符号且大于8位");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
     /**
      * 把分转换为元,并且保留小数点2位
      *

+ 112 - 0
src/main/java/platform/common/util/PwdCheckUtil.java

@@ -0,0 +1,112 @@
+package platform.common.util;
+
+import com.google.common.base.Preconditions;
+import com.xiaoleilu.hutool.util.StrUtil;
+
+public class PwdCheckUtil {
+
+    //定义特殊字符
+    public static String SPECIAL_CHAR = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
+
+    /**
+     * @brief   检测密码中字符长度
+     * @param[in] password            密码字符串
+     * @return  符合长度要求 返回true
+     */
+    public static boolean checkPasswordLength(String password, String minNum, String maxNum) {
+        boolean flag =false;
+        if (StrUtil.isBlank(maxNum))  {
+            minNum = StrUtil.isBlank(minNum) ? "0":minNum;
+            if (password.length() >= Integer.parseInt(minNum)) {
+                flag = true;
+            }
+        } else {
+            minNum = StrUtil.isBlank(minNum) ? "0":minNum;
+            if (password.length() >= Integer.parseInt(minNum) &&
+                    password.length() <= Integer.parseInt(maxNum)) {
+                flag = true;
+            }
+        }
+        return flag;
+    }
+
+    /**
+     * @brief   检测密码中是否包含数字
+     * @param[in] password            密码字符串
+     * @return  包含数字 返回true
+     */
+    public static boolean checkContainDigit(String password) {
+        char[] chPass = password.toCharArray();
+        for (int i = 0; i < chPass.length; i++) {
+            if (Character.isDigit(chPass[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @brief   检测密码中是否包含字母(不区分大小写)
+     * @param[in] password            密码字符串
+     * @return  包含字母 返回true
+     */
+    public static boolean checkContainCase(String password) {
+        char[] chPass = password.toCharArray();
+        for (int i = 0; i < chPass.length; i++) {
+            if (Character.isLetter(chPass[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    /**
+     * @brief   检测密码中是否包含小写字母
+     * @param[in] password            密码字符串
+     * @return  包含小写字母 返回true
+     */
+    public static boolean checkContainLowerCase(String password) {
+        char[] chPass = password.toCharArray();
+        for (int i = 0; i < chPass.length; i++) {
+            if (Character.isLowerCase(chPass[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    /**
+     * @brief   检测密码中是否包含大写字母
+     * @param[in] password            密码字符串
+     * @return  包含大写字母 返回true
+     */
+    public static boolean checkContainUpperCase(String password) {
+        char[] chPass = password.toCharArray();
+        for (int i = 0; i < chPass.length; i++) {
+            if (Character.isUpperCase(chPass[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    /**
+     * @brief   检测密码中是否包含特殊符号
+     * @param[in] password            密码字符串
+     * @return  包含特殊符号 返回true
+     */
+    public static boolean checkContainSpecialChar(String password) {
+        char[] chPass = password.toCharArray();
+        for (int i = 0; i < chPass.length; i++) {
+            if (SPECIAL_CHAR.indexOf(chPass[i]) != -1) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+}

+ 4 - 3
src/main/java/platform/modules/company/service/StockLandService.java

@@ -1183,8 +1183,8 @@ public class StockLandService extends BaseService<StockLand> {
         }else if(type == 15||type == 14){
         	//简易流程会签
         	if(null != approval){
-//				String nextChecker = approval.getNextchecker();
-				String nextChecker = getNextLevelCheckerByDepartment(ShiroUtils.getUserId(),approval.getNextchecker());
+				String nextChecker = approval.getNextchecker();
+//				String nextChecker = getNextLevelCheckerByDepartment(ShiroUtils.getUserId(),approval.getNextchecker());
 				//2.找出下一审核人
 				String [] nextCheckerArr = nextChecker.split(",");
 				if(null != nextCheckerArr && nextCheckerArr.length > 0){
@@ -1203,7 +1203,8 @@ public class StockLandService extends BaseService<StockLand> {
 						
 					}else{
 						//不是最后一个人审核
-						nextChecker = nextChecker.replace(ShiroUtils.getUserId()+",","");
+//						nextChecker = nextChecker.replace(ShiroUtils.getUserId()+",","");
+						nextChecker = getNextLevelCheckerByDepartment(ShiroUtils.getUserId(),approval.getNextchecker());
 						//保存审核记录,并更新附件
 						saveApprovalAndUpdateAttach(slad, id, comment, nextChecker,Constant.LandApproveStatus.JYLCHQ, Constant.OperType.SUBMIT_COMMENT,approval_round);
 						//完成待办

+ 14 - 0
src/main/java/platform/modules/home/web/HomeRefactorController.java

@@ -3,6 +3,7 @@ package platform.modules.home.web;
 import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.exceptions.ClientException;
 import com.github.pagehelper.PageInfo;
+import com.google.common.base.Preconditions;
 import com.xiaoleilu.hutool.crypto.SecureUtil;
 import com.xiaoleilu.hutool.util.StrUtil;
 import io.jsonwebtoken.Claims;
@@ -365,6 +366,8 @@ public class HomeRefactorController extends BaseController {
      * 个人注册
      * 20200514 新门户使用
      *
+     * 这里密码需要格式更多一些
+     *
      * @param userInfo
      * @return
      */
@@ -380,6 +383,17 @@ public class HomeRefactorController extends BaseController {
                 return ResponseMessage.error("验证码错误!");
             }
 //            }
+
+            String pwd = userInfo.getPassword().trim();
+            Preconditions.checkNotNull(pwd);
+            if (!PwdCheckUtil.checkPasswordLength(pwd, "8", null)
+                    || !PwdCheckUtil.checkContainCase(pwd)
+                    || !PwdCheckUtil.checkContainDigit(pwd)
+                    || !PwdCheckUtil.checkContainSpecialChar(pwd)
+            ) {
+                return ResponseMessage.error("密码必须包含数字、字母、特殊符号且大于8位");
+            }
+
             User user = new User();
             user.setUser_name(userInfo.getUser_name());
             user.setNick_name(userInfo.getNick_name().trim());

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

@@ -21,8 +21,8 @@ spring:
 
   #数据源
   datasource:
-#    url: jdbc:mysql://47.105.241.108:33060/service_platform_42_backup?useUnicode=true&characterEncoding=utf-8&useSSL=true&autoReconnect=true&allowMultiQueries=true
-    url: jdbc:mysql://mysql:3306/service_platform?useUnicode=true&characterEncoding=utf-8&useSSL=true&autoReconnect=true&allowMultiQueries=true
+    url: jdbc:mysql://47.105.241.108:33060/service_platform?useUnicode=true&characterEncoding=utf-8&useSSL=true&autoReconnect=true&allowMultiQueries=true
+#    url: jdbc:mysql://mysql:3306/service_platform?useUnicode=true&characterEncoding=utf-8&useSSL=true&autoReconnect=true&allowMultiQueries=true
     username: root
     password: ${password}
     driver-class-name: com.mysql.jdbc.Driver

BIN
src/main/resources/template/苏州高新区存量工业用地合规性审核意见书.docx


+ 5 - 5
src/main/resources/templates/admin/log/log_list.html

@@ -34,15 +34,15 @@
 	    	</button>
         </div>
         <div class="cl pd-5 bg-1 bk-gray mt-20">
-            <span class="l">
-                <a   onClick="log_del('/admin/log/deleteBatch')"  class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 删除</a>
-            </span>
+<!--            <span class="l">-->
+<!--                <a   onClick="log_del('/admin/log/deleteBatch')"  class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 删除</a>-->
+<!--            </span>-->
             <span class="r" >共有数据:<strong th:text="${pageInfo.total}" id="total">54</strong> 条</span>
         </div>
         <table class="table table-border table-bordered table-bg table-hover">
             <thead>
             <tr class="text-c">
-                <th width="25"><input type="checkbox" name="" value=""/></th>
+<!--                <th width="25"><input type="checkbox" name="" value=""/></th>-->
                 <!-- <th>日志类型</th> -->
                 <th>姓名</th>
                 <th>操作</th>
@@ -53,7 +53,7 @@
             </thead>
             <tbody>
             <tr class="text-c" th:each="model,iterStat:${pageInfo.list}" th:object="${model}">
-                <td><input type="checkbox" th:value="*{id}" th:id="${iterStat.index+1}"  name="id"/></td>
+<!--                <td><input type="checkbox" th:value="*{id}" th:id="${iterStat.index+1}"  name="id"/></td>-->
                 <!-- <td class="td-status">
                     <span class="label radius" th:unless="*{logType==0}">异常日志</span>
                     <span class="label radius label-success" th:if="*{logType==0}">操作日志</span>

+ 18 - 4
src/test/java/com/test2.java

@@ -16,6 +16,7 @@ package com;
  * limitations under the License.
  */
 
+import com.alibaba.druid.filter.config.ConfigTools;
 import com.alibaba.druid.util.Base64;
 import com.alibaba.druid.util.JdbcUtils;
 
@@ -39,10 +40,23 @@ public class test2 {
 
     public static void main(String[] args) throws Exception {
         String password = "fgjdb-1234";
-        String[] arr = genKeyPair(512);
-        System.out.println("privateKey:" + arr[0]);
-        System.out.println("publicKey:" + arr[1]);
-        System.out.println("password:" + encrypt(arr[0], password));
+//        String[] arr = genKeyPair(512);
+//        System.out.println("privateKey:" + arr[0]);
+//        System.out.println("publicKey:" + arr[1]);
+//        System.out.println("password:" + encrypt(arr[0], password));
+
+        // 利用阿里的ConfigTools工具类来生成一对公私钥,私钥用来加密,公钥用来解密
+        // 解析密码
+        String[] keyParis = ConfigTools.genKeyPair(512);
+        String privateKey = keyParis[0];
+        String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIMx332UUYFcxPYHIEunciA17W0DoVdaGghmWNJLJqyy+AXQyxVu5Wq+v3nxWSNiOf8JIZcHtofQJomGOhbjzMkCAwEAAQ==";
+        System.out.println("privateKey="+privateKey);
+        System.out.println("publicKey="+publicKey);
+//        String encryptPassword = ConfigTools.encrypt(privateKey, password);
+        String encryptPassword = "DHjPUaxtgLj6B63mND5ccHj3PXyNIsD/GLoc9jIqY6blFQCCwMyKje8ZCuf22YKlbK9JH8lc4dG1IjQc0fBTlA==";
+        System.out.println("encryptPassword="+encryptPassword);
+        String decryptPassword = ConfigTools.decrypt(publicKey, encryptPassword);
+        System.out.println("decryptPassword="+decryptPassword);
     }
 
     public static String decrypt(String cipherText) throws Exception {