bug
jiangping
2023-12-06 1f4e7d0f73a73e7350cf5a1df279d5f30904c5d5
server/src/main/java/doumeemes/service/ext/impl/DepartmentExtServiceImpl.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import doumeemes.config.shiro.ShiroToken;
import doumeemes.core.constants.ResponseStatus;
import doumeemes.core.exception.BusinessException;
import doumeemes.core.model.LoginUserInfo;
@@ -30,6 +31,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@@ -37,6 +39,7 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.util.*;
import java.util.stream.Collectors;
@@ -253,8 +256,8 @@
    @Override
    public Department findOne(Department Department) {
        Wrapper<Department> wrapper = new QueryWrapper<>(Department);
        return departmentExtMapper.selectOne(wrapper);
        QueryWrapper<Department> wrapper = new QueryWrapper<>(Department);
        return departmentExtMapper.selectOne(wrapper.last("limit 1"));
    }
    @Override
@@ -293,6 +296,8 @@
              throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起!只能切换到公司级部门!");
          }
          user.setCurComDepartment(d);
          //更新会话数据信息
          SecurityUtils.getSubject().login(new ShiroToken(user,1));
        }
    }
@@ -443,6 +448,7 @@
            //加入redis缓存,存储企业信息
            RedisUtil.addObject(redisTemplate,Constants.RedisKeys.COM_DEPART_TREE_KEY+com.getId(),rootDepart);
    }
    @PostConstruct
    @Override
    public  void loadAllDepart() {
        QueryCompanyExtDTO dto = new QueryCompanyExtDTO();
@@ -796,7 +802,7 @@
            for (Department department:departmentList ) {
                this.dealDepartmentData(department,user);
            }
        }
        }
    }
    public void dealDepartmentData(Department department,LoginUserInfo user){