liurunyu
2023-11-12 21eb47b061d16056f37eee47928c7fe629b63061
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)){
                /*
                如果前端进行了base64加密
                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)){
                /*
                如果前端进行了base64加密
                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);