From 0925c3682cb79206c8b6b911b2ee42bb3bc1012a Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期日, 12 十一月 2023 20:33:49 +0800
Subject: [PATCH] 完善mapper.xml中的枚举类型处理handler
---
pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java | 36 +++++++++++++++++++++++++++++++-----
1 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java
index aead030..bc7b78e 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java
@@ -2,10 +2,12 @@
import com.dy.common.aop.SsoVo;
import com.dy.common.multiDataSource.DataSourceContext;
+import com.dy.common.util.MD5;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoBa.BaUser;
+import com.mysql.cj.util.StringUtils;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -80,12 +82,24 @@
if(bindingResult != null && bindingResult.hasErrors()){
return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
}
+ if(vo.orgTag == null || vo.orgTag.trim().length() == 0){
+ return BaseResponseUtils.buildFail("鏈�夋嫨缁勭粐鍗曚綅");
+ }
+ //鎶婄粍缁囧崟浣嶆爣绛句綔涓烘暟鎹簮鍚嶇О
+ DataSourceContext.set(vo.orgTag);
String uuid ;
BaUser userPo ;
try {
//Boolean flag = cacheManager.getCacheNames().isEmpty() ;
uuid = UUID.randomUUID().toString();
+ if(!StringUtils.isNullOrEmpty(vo.password)){
+ /*
+ 濡傛灉鍓嶇杩涜浜哹ase64鍔犲瘑
+ po.password = new String(Base64.getDecoder().decode(po.password)) ;
+ */
+ vo.password = MD5.encrypt(vo.password) ;
+ }
userPo = this.sv.loginWithMapperXml(uuid, vo.phone, vo.password);
} catch (Exception e) {
log.error("鐢ㄦ埛鐧诲綍寮傚父", e);
@@ -131,6 +145,13 @@
try {
//Boolean flag = cacheManager.getCacheNames().isEmpty() ;
uuid = UUID.randomUUID().toString();
+ if(!StringUtils.isNullOrEmpty(vo.password)){
+ /*
+ 濡傛灉鍓嶇杩涜浜哹ase64鍔犲瘑
+ po.password = new String(Base64.getDecoder().decode(po.password)) ;
+ */
+ vo.password = MD5.encrypt(vo.password) ;
+ }
userPo = this.sv.loginWithMapperXml(uuid, vo.phone, vo.password);
} catch (Exception e) {
log.error("鐢ㄦ埛鐧诲綍寮傚父", e);
@@ -205,12 +226,17 @@
if(userPo.supperAdmin != null && userPo.supperAdmin == 1){
vo.hasPower = true ;
}else{
- if(userPo.privileges != null && userPo.privileges.size() > 0){
- vo.hasPower = this.hasOnePrivilege(privilege, userPo) ;
- if(!vo.hasPower){
- vo.hasPower = this.hasAllPrivilege(allPrivilege, userPo) ;
+ if(privilege.equals("-1")){
+ //鏃犻渶鏉冮檺楠岃瘉
+ vo.hasPower = true ;
+ }else{
+ if(userPo.privileges != null && userPo.privileges.size() > 0){
+ vo.hasPower = this.hasOnePrivilege(privilege, userPo) ;
if(!vo.hasPower){
- vo.hasPower = this.hasAnyPrivilege(anyPrivilege, userPo) ;
+ vo.hasPower = this.hasAllPrivilege(allPrivilege, userPo) ;
+ if(!vo.hasPower){
+ vo.hasPower = this.hasAnyPrivilege(anyPrivilege, userPo) ;
+ }
}
}
}
--
Gitblit v1.8.0