From 8f6dfbc2ca4a55a1ce0a4bb62094c4bf5c671b4d Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期一, 27 十月 2025 10:57:10 +0800
Subject: [PATCH] 会议室问题修改

---
 server/system_service/src/main/java/com/doumee/service/system/impl/SystemLoginServiceImpl.java |   72 ++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/server/system_service/src/main/java/com/doumee/service/system/impl/SystemLoginServiceImpl.java b/server/system_service/src/main/java/com/doumee/service/system/impl/SystemLoginServiceImpl.java
index 5334a12..b47b93f 100644
--- a/server/system_service/src/main/java/com/doumee/service/system/impl/SystemLoginServiceImpl.java
+++ b/server/system_service/src/main/java/com/doumee/service/system/impl/SystemLoginServiceImpl.java
@@ -5,6 +5,8 @@
 import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.config.jwt.JwtTokenUtil;
 import com.doumee.core.exception.BusinessException;
+import com.doumee.core.utils.DateUtil;
+import com.doumee.dao.system.dto.LoginCabinetDTO;
 import com.doumee.dao.system.dto.LoginH5DTO;
 import com.doumee.service.business.third.TmsService;
 import com.doumee.service.business.third.model.LoginUserInfo;
@@ -170,6 +172,27 @@
             throw e;
         }
     }
+
+    @Override
+    public LoginUserInfo loginByPasswordForCabinet(LoginCabinetDTO dto, ServerHttpRequest request) {
+        SystemLoginLog loginLog = getInitLoginlog(dto.getUsername(),request);
+        try {
+            LoginUserInfo user = dealLoginByPwdNewBiz(dto.getUsername(),dto.getPassword(),null,null,null,request);
+            systemLoginLogService.create(loginLog);
+            return  user;
+        }catch (BusinessException e){
+            loginLog.setSuccess(Boolean.FALSE);
+            systemLoginLogService.create(loginLog);
+            throw e;
+
+        }catch (Exception e){
+            loginLog.setSuccess(Boolean.FALSE);
+            systemLoginLogService.create(loginLog);
+            throw e;
+        }
+    }
+
+
     @Override
     public LoginUserInfo loginH5 (LoginH5DTO dto, ServerHttpRequest request) {
         SystemLoginLog loginLog = getInitLoginlog(dto.getUsername(),request);
@@ -269,6 +292,55 @@
         return  userInfo;
     }
 
+
+    public void checkPassword(SystemUser user,String pwd){
+        String pppp = Utils.Secure.encryptPassword(new String(pwd), user.getSalt());
+        // 姣旇緝瀵嗙爜
+        if( !StringUtils.equals(pppp, user.getPassword())){
+            //鏄惁寮�鍚瘑鐮侀敊璇姝㈢櫥褰曪細0=鍚︼紱1=鏄紱
+            SystemDictData prohibitLoginData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROHIBIT_LOGIN_OPEN);
+            if(Objects.nonNull(prohibitLoginData)&&"1".equals(prohibitLoginData.getCode())){
+                SystemDictData prohibitErrTimesData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ERR_TIMES);
+                if(Objects.nonNull(prohibitErrTimesData)){
+
+                }
+                throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT);
+            }else{
+                throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT);
+            }
+        }
+
+    }
+
+    public void updErrTimes(SystemUser systemUser){
+        //鏈�澶ч敊璇鏁� 杩涜鐧诲綍闄愬埗
+        SystemDictData prohibitErrTimesData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ERR_TIMES);
+        //鏄惁寮�鍚瘑鐮侀敊璇姝㈢櫥褰曪細0=鍚︼紱1=鏄紱
+        SystemDictData prohibitLoginData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROHIBIT_LOGIN_OPEN);
+        //瀵嗙爜閿欒绂佹鐧诲綍闄愬埗鏃堕棿锛堝垎閽燂級
+        SystemDictData prohibitTimeData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROHIBIT_TIME);
+        if(Objects.isNull(prohibitTimeData)||Objects.isNull(prohibitLoginData)||Objects.isNull(prohibitTimeData)){
+            return;
+        }
+        systemUserMapper.update(null,new UpdateWrapper<SystemUser>().lambda()
+                .setSql( " PROHIBIT_STATUS = CASE WHEN "+prohibitLoginData+" = 1 and ( IFNULL(ERR_TIMES,0) + 1  ) > "+prohibitErrTimesData.getCode()+" then 1 else 0 end ")
+                .setSql(" PROHIBIT_TIME = CASE WHEN  PROHIBIT_STATUS = 1  then DATE_ADD(NOW(), INTERVAL "+prohibitTimeData.getCode()+" MINUTE) else null end , ")
+                .setSql(" ERR_TIMES = (ifnull(ERR_TIMES,0) + 1) ")
+                .eq(SystemUser::getId,systemUser.getId())
+        );
+    }
+
+    public void prohibitLogin(SystemUser systemUser){
+        if(Constants.equalsInteger(systemUser.getProhibitStatus(),Constants.ZERO)){
+            Long betweenMin = DateUtil.getBetweenMin(systemUser.getProhibitTime(),new Date());
+            if(betweenMin <= 0L){
+                betweenMin = 0L;
+            }
+            throw new BusinessException( ResponseStatus.NOT_ALLOWED.getCode(),"瀵嗙爜閿欒娆℃暟杩囧锛岃鍚�"+ betweenMin +"鍒嗛挓鍚庨噸璇�");
+        }
+    }
+
+
     @Override
     public LoginUserInfo loginByPasswordForPda(LoginDTO dto, ServerHttpRequest request) {
         SystemLoginLog loginLog =getInitLoginlog(dto.getUsername(),request);

--
Gitblit v1.9.3