From 2837bdd57f72e386bbf9a725e7b3a13e5eb9e930 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 21 八月 2023 09:19:57 +0800
Subject: [PATCH] 修复bug

---
 server/src/main/java/doumeemes/config/shiro/ShiroRealm.java |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/server/src/main/java/doumeemes/config/shiro/ShiroRealm.java b/server/src/main/java/doumeemes/config/shiro/ShiroRealm.java
index 795623f..c405ec9 100644
--- a/server/src/main/java/doumeemes/config/shiro/ShiroRealm.java
+++ b/server/src/main/java/doumeemes/config/shiro/ShiroRealm.java
@@ -35,7 +35,9 @@
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 鑷畾涔塕ealm锛屽鐞嗚璇佸拰鏉冮檺
@@ -123,11 +125,17 @@
             per.setType(Constants.PlatType.admin);
         }else{
             if(authenticationToken.getCompanyId() == null){
-                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝璇ヨ处鎴峰紓甯革紒");
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝璇ヨ处鎴峰垹闄わ紒");
             }
             com = companyExtService.getModelById(authenticationToken.getCompanyId());
-            if(com == null){
-                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヨ处鎴峰紓甯革紒");
+            if(com == null || Constants.equalsInteger( com.getDeleted(),Constants.ONE)){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヨ处鎴峰垹闄わ紒璇疯仈绯荤鐞嗗憳");
+            }
+            if(Constants.equalsInteger( com.getStatus(),Constants.ZERO) ){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氬凡绂佺敤锛�");
+            }
+            if(com.getOepnValidDate() != null && com.getOepnValidDate().before(new Date())){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氬凡杩囦娇鐢ㄦ湁鏁堟湡锛�");
             }
             //濡傛灉鏄紒涓氱敤鎴�
             QueryCompanyUserExtDTO c =new QueryCompanyUserExtDTO();
@@ -136,7 +144,7 @@
             c.setCompanyId(authenticationToken.getCompanyId());
             cu = companyUserExtService.selectOne(c);
             if(cu == null){
-                return  null;
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氱敤鎴蜂笉瀛樺湪锛�");
             }
             if(Constants.equalsInteger(cu.getStatus(),Constants.ONE)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ヤ紒涓氱敤鎴峰凡绂佺敤锛�");

--
Gitblit v1.9.3