From ef106c9a6002872892de9db355ef7cd37512dba5 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期五, 12 一月 2024 10:10:17 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/web/AuthController.java |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/zy/common/web/AuthController.java b/src/main/java/com/zy/common/web/AuthController.java
index 28e42fc..f260726 100644
--- a/src/main/java/com/zy/common/web/AuthController.java
+++ b/src/main/java/com/zy/common/web/AuthController.java
@@ -14,6 +14,7 @@
 import com.zy.common.properties.SystemProperties;
 import com.zy.common.utils.RandomValidateCodeUtil;
 import com.zy.system.entity.*;
+import com.zy.system.entity.license.LicenseVerify;
 import com.zy.system.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -50,6 +51,12 @@
     @RequestMapping("/login.action")
     @ManagerAuth(value = ManagerAuth.Auth.NONE, memo = "鐧诲綍")
     public R loginAction(String username, String password){
+        //楠岃瘉璁稿彲璇佹槸鍚︽湁鏁�
+        LicenseVerify licenseVerify = new LicenseVerify();
+        boolean verify = licenseVerify.verify();
+        if (!verify) {//璁稿彲璇佸凡澶辨晥
+            return R.parse(CodeRes.SYSTEM_20001);
+        }
         if (username.equals("super") && password.equals(Cools.md5(superPwd))) {
             Map<String, Object> res = new HashMap<>();
             res.put("username", username);
@@ -274,19 +281,21 @@
         if (!Cools.isEmpty(powers)){
             List<PowerDto> dtos = JSON.parseArray(powers, PowerDto.class);
             for (PowerDto dto : dtos) {
-                Resource resource = resourceService.selectOne(new EntityWrapper<Resource>().eq("id", dto.getTwo()).eq("level", 2));
-                if (!Cools.isEmpty(resource)) {
-                    // 鏍¢獙涓婄骇鏉冮檺
-                    if (leaderId != null) {
-                        RoleResource roleResource = roleResourceService.selectOne(new EntityWrapper<RoleResource>().eq("role_id", leaderId).eq("resource_id", resource.getId()));
-                        if (null == roleResource) {
-                            throw new CoolException(resource.getName().concat("鏃犳硶鎺堟潈缁�").concat(role.getName()));
+                if (isNumber(dto.getTwo())) {
+                    Resource resource = resourceService.selectOne(new EntityWrapper<Resource>().eq("id", dto.getTwo()).eq("level", 2));
+                    if (!Cools.isEmpty(resource)) {
+                        // 鏍¢獙涓婄骇鏉冮檺
+                        if (leaderId != null) {
+                            RoleResource roleResource = roleResourceService.selectOne(new EntityWrapper<RoleResource>().eq("role_id", leaderId).eq("resource_id", resource.getId()));
+                            if (null == roleResource) {
+                                throw new CoolException(resource.getName().concat("鏃犳硶鎺堟潈缁�").concat(role.getName()));
+                            }
                         }
+                        RoleResource roleResource = new RoleResource();
+                        roleResource.setRoleId(roleId);
+                        roleResource.setResourceId(resource.getId());
+                        roleResourceService.insert(roleResource);
                     }
-                    RoleResource roleResource = new RoleResource();
-                    roleResource.setRoleId(roleId);
-                    roleResource.setResourceId(resource.getId());
-                    roleResourceService.insert(roleResource);
                 } else {
                     Permission permission = permissionService.selectOne(new EntityWrapper<Permission>().eq("action", dto.getTwo()));
                     if (!Cools.isEmpty(permission)){
@@ -303,7 +312,7 @@
                         if (leaderId != null) {
                             RoleResource roleResource = roleResourceService.selectOne(new EntityWrapper<RoleResource>().eq("role_id", leaderId).eq("resource_id", resource1.getId()));
                             if (null == roleResource) {
-                                throw new CoolException(resource.getName().concat("鐨�").concat(resource1.getName().concat("鏃犳硶鎺堟潈缁�").concat(role.getName())));
+                                throw new CoolException(resource1.getName().concat("鏃犳硶鎺堟潈缁�").concat(role.getName()));
                             }
                         }
                         RoleResource roleResource = new RoleResource();

--
Gitblit v1.9.1