zjh
2025-03-13 62c7cb2668a90cfb00e7d3e2f8044ae9d8bfc664
ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysLoginController.java
@@ -51,13 +51,10 @@
public class SysLoginController {
    @Autowired
    private SysLoginService loginService;
    @Autowired
    private ISysMenuService menuService;
    @Autowired
    private SysPermissionService permissionService;
    @Resource
    private ITjCustomerService customerService;
    @Resource
@@ -92,9 +89,9 @@
        // 生成令牌
        String token;
        if (loginBody.getMobile()) {
            token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getType(),loginBody.getCode(),loginBody.getUuid());
            token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getType(), loginBody.getCode(), loginBody.getUuid());
        } else {
            token = loginService.Cuslogin(loginBody.getUsername(), loginBody.getPassword(), loginBody.getType(),loginBody.getCode(),loginBody.getUuid());
            token = loginService.Cuslogin(loginBody.getUsername(), loginBody.getPassword(), loginBody.getType(), loginBody.getCode(), loginBody.getUuid());
        }
        if (null == token) {
            return success("该账号正在使用中");
@@ -111,37 +108,35 @@
    @GetMapping("getInfo")
    public AjaxResult getInfo() {
        AjaxResult ajax = success();
//        SysUser user = Objects.requireNonNull(SecurityUtils.getLoginUser()).getUser();
        SysUser user = UserHoder.getLoginUser().getUser();
        if (null != user.getUserId()) {
            String message=null;
            if (secretKeyLogin)
            {
                if(null !=user.getDeptId()){
                    if(!SecurityUtils.isAdmin(user.getUserId())){
                        SysDept sysDept = deptService.getById(user.getDeptId());
                        if (null != sysDept) {
                            DictHosp dictHosp = hospService.getById(sysDept.getHospId());
                            if(null !=dictHosp && dictHosp.getSecretKey() !=null && dictHosp.getExpirationTime() !=null){
                                if (!SecurityUtils.matchesMallMerchantSecretKey(secret,dictHosp.getHospAreaId(),dictHosp.getAreaid(),
                                        dictHosp.getExpirationTime(),dictHosp.getSecretKey())) {
            if (secretKeyLogin) {
                if (null != user.getDeptId()) {
                    SysDept sysDept = deptService.getById(user.getDeptId());
                    if (null != sysDept) {
                        DictHosp dictHosp = hospService.getById(sysDept.getHospId());
                        if (null != dictHosp) {
                            user.setHospName(dictHosp.getHospAreaName());
                            user.setHospId(dictHosp.getHospAreaId());
                        }
                        if (!SecurityUtils.isAdmin(user.getUserId())) {
                            if (null != dictHosp && dictHosp.getSecretKey() != null && dictHosp.getExpirationTime() != null) {
                                if (!SecurityUtils.matchesMallMerchantSecretKey(secret, dictHosp.getHospAreaId(), dictHosp.getHospAreaName(),
                                        dictHosp.getExpirationTime(), dictHosp.getSecretKey())) {
                                    String userIdKey = Constants.LOGIN_USERID_KEY + user.getUserId();
                                    String userKey = redisCache.getCacheObject(userIdKey);
                                    if (org.apache.commons.lang3.StringUtils.isNotEmpty(userKey))
                                    {
                                    if (org.apache.commons.lang3.StringUtils.isNotEmpty(userKey)) {
                                        redisCache.deleteObject(userIdKey);
                                        redisCache.deleteObject(userKey);
                                    }
                                    throw new SecretKeyException("商家已过期请续费使用");
                                }
                                long between = DateUtil.between(new Date(), DateUtil.endOfDay(dictHosp.getExpirationTime()), DateUnit.DAY);
                                if(between<=30){
//                                    message="还有 "+between+" 天到期 请注意续费! 以免影响正常使用!";
                                    UserHoder.getLoginUser().setMessage("还有 "+between+" 天到期 请注意续费! 以免影响正常使用!");
                                if (between <= 30) {
                                    UserHoder.getLoginUser().setMessage("还有 " + between + " 天到期 请注意续费! 以免影响正常使用!");
                                }
                            }else {
                            } else {
                                throw new SecretKeyException("请缴费使用");
                            }
                        }
@@ -154,7 +149,8 @@
            ajax.put("user", user);
            ajax.put("roles", roles);
            ajax.put("permissions", permissions);
            ajax.put("securitMessage",UserHoder.getLoginUser().getMessage());
            ajax.put("securitMessage", UserHoder.getLoginUser().getMessage());
            ajax.put("hospName", UserHoder.getLoginUser().getHospName());
        } else {
            Set<String> roles = new HashSet<>();
            LambdaQueryWrapper<SysRole> wq = new LambdaQueryWrapper<>();
@@ -173,8 +169,9 @@
            ajax.put("user", user1);
            ajax.put("roles", roles);
            ajax.put("permissions", permissions);
            ajax.put("post",null);
            ajax.put("securitMessage",null);
            ajax.put("post", null);
            ajax.put("securitMessage", null);
            ajax.put("hospName", UserHoder.getLoginUser().getHospName());
        }
        return ajax;
    }