| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ltkj.common.constant.CacheConstants; |
| | | import com.ltkj.common.core.domain.entity.SysDept; |
| | | import com.ltkj.common.enums.DataSourceType; |
| | | import com.ltkj.common.exception.CustomException; |
| | | import com.ltkj.common.exception.user.CaptchaException; |
| | | import com.ltkj.common.exception.user.CaptchaExpireException; |
| | | import com.ltkj.common.exception.user.SecretKeyException; |
| | | import com.ltkj.common.utils.*; |
| | | import com.ltkj.common.utils.sign.RsaUtils; |
| | | import com.ltkj.db.DataSourceConfig; |
| | | import com.ltkj.db.DataSourceContextHolder; |
| | | import com.ltkj.framework.config.JwtUtils; |
| | | import com.ltkj.framework.config.UserHoder; |
| | | import com.ltkj.hosp.domain.DictHosp; |
| | |
| | | |
| | | @Value("${token.secret_key_login}") |
| | | private boolean secretKeyLogin; |
| | | @Autowired |
| | | private DataSourceConfig dataSourceConfig; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param password 密码 |
| | | * @return 结果 |
| | | */ |
| | | public String login(String username, String password, Boolean type,String code,String uuid) { |
| | | public String login(String username, String password, Boolean type,String code,String uuid,String hospId) { |
| | | |
| | | DataSourceContextHolder.setDataSourceKey(DataSourceType.MASTER.name()); |
| | | LambdaQueryWrapper<DictHosp> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(DictHosp::getCode,hospId); |
| | | DictHosp hosp = hospService.getOne(wrapper); |
| | | |
| | | DataSourceContextHolder.setDataSourceKey(hosp.getDbname()); |
| | | String aSwitch = configService.selectConfigByKey("captcha_switch"); |
| | | if(null !=aSwitch && aSwitch.equalsIgnoreCase("Y")){ |
| | | String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; |
| | |
| | | } |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| | | LoginUser loginUser = (LoginUser) authentication.getPrincipal(); |
| | | loginUser.setHospDB(hosp.getDbname()); |
| | | loginUser.setHospId(hospId); |
| | | tokenService.setLoginUser(loginUser); |
| | | |
| | | recordLoginInfo(Long.valueOf(loginUser.getUserId())); |
| | | //校验商家过期否 |