mirror of https://gitee.com/stylefeng/roses
【7.6.0】【personal】更新当前公司部门数
parent
6b3ad58210
commit
74a147085c
|
@ -121,6 +121,16 @@ public interface HrOrganizationService extends IService<HrOrganization> {
|
||||||
*/
|
*/
|
||||||
CompanyDeptDTO getOrgCompanyInfo(HrOrganization hrOrganization);
|
CompanyDeptDTO getOrgCompanyInfo(HrOrganization hrOrganization);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据组织机构id,获取这个组织机构id对应的公司部门信息
|
||||||
|
*
|
||||||
|
* @param orgId 组织机构id
|
||||||
|
* @return 单独返回公司信息
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/7/2 8:38
|
||||||
|
*/
|
||||||
|
CompanyDeptDTO getOrgCompanyInfo(Long orgId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取组织机构统计信息,包含系统的统计,包含当前用户公司的统计
|
* 获取组织机构统计信息,包含系统的统计,包含当前用户公司的统计
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -19,7 +19,6 @@ import cn.stylefeng.roses.kernel.sys.api.callback.RemoveOrgCallbackApi;
|
||||||
import cn.stylefeng.roses.kernel.sys.api.enums.org.OrgTypeEnum;
|
import cn.stylefeng.roses.kernel.sys.api.enums.org.OrgTypeEnum;
|
||||||
import cn.stylefeng.roses.kernel.sys.api.exception.enums.OrgExceptionEnum;
|
import cn.stylefeng.roses.kernel.sys.api.exception.enums.OrgExceptionEnum;
|
||||||
import cn.stylefeng.roses.kernel.sys.api.pojo.org.CompanyDeptDTO;
|
import cn.stylefeng.roses.kernel.sys.api.pojo.org.CompanyDeptDTO;
|
||||||
import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserOrgDTO;
|
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.org.constants.OrgConstants;
|
import cn.stylefeng.roses.kernel.sys.modular.org.constants.OrgConstants;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.org.entity.HrOrganization;
|
import cn.stylefeng.roses.kernel.sys.modular.org.entity.HrOrganization;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.org.factory.OrganizationFactory;
|
import cn.stylefeng.roses.kernel.sys.modular.org.factory.OrganizationFactory;
|
||||||
|
@ -277,6 +276,27 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
||||||
return this.getOrgCompanyInfo(parentOrgInfo);
|
return this.getOrgCompanyInfo(parentOrgInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanyDeptDTO getOrgCompanyInfo(Long orgId) {
|
||||||
|
|
||||||
|
if (orgId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询组织机构对应的信息
|
||||||
|
LambdaQueryWrapper<HrOrganization> hrOrganizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
hrOrganizationLambdaQueryWrapper.eq(HrOrganization::getOrgId, orgId);
|
||||||
|
hrOrganizationLambdaQueryWrapper.select(HrOrganization::getOrgType, HrOrganization::getOrgId, HrOrganization::getOrgParentId);
|
||||||
|
HrOrganization hrOrganization = this.getOne(hrOrganizationLambdaQueryWrapper, false);
|
||||||
|
|
||||||
|
if (hrOrganization == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询机构对应的公司部门信息
|
||||||
|
return this.getOrgCompanyInfo(hrOrganization);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HomeCompanyInfo orgStatInfo() {
|
public HomeCompanyInfo orgStatInfo() {
|
||||||
|
|
||||||
|
@ -297,17 +317,17 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
||||||
homeCompanyInfo.setPositionNum(totalPositionCount);
|
homeCompanyInfo.setPositionNum(totalPositionCount);
|
||||||
|
|
||||||
// 4. 当前公司下的机构数量
|
// 4. 当前公司下的机构数量
|
||||||
Long userId = LoginContext.me().getLoginUser().getUserId();
|
Long currentOrgId = LoginContext.me().getLoginUser().getCurrentOrgId();
|
||||||
UserOrgDTO userMainOrgInfo = sysUserOrgService.getUserMainOrgInfo(userId);
|
CompanyDeptDTO orgCompanyInfo = this.getOrgCompanyInfo(currentOrgId);
|
||||||
|
|
||||||
// 当前用户没公司,则直接设置为0
|
// 当前用户没公司,则直接设置为0
|
||||||
if (userMainOrgInfo == null) {
|
if (currentOrgId == null || orgCompanyInfo == null) {
|
||||||
homeCompanyInfo.setCurrentCompanyPersonNum(0L);
|
homeCompanyInfo.setCurrentCompanyPersonNum(0L);
|
||||||
homeCompanyInfo.setCurrentCompanyPersonNum(0L);
|
homeCompanyInfo.setCurrentCompanyPersonNum(0L);
|
||||||
return homeCompanyInfo;
|
return homeCompanyInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
Long companyId = userMainOrgInfo.getCompanyId();
|
Long companyId = orgCompanyInfo.getCompanyId();
|
||||||
|
|
||||||
// 获取当前公司的所有子公司数量(含当前公司)
|
// 获取当前公司的所有子公司数量(含当前公司)
|
||||||
LambdaQueryWrapper<HrOrganization> wrapper = Wrappers.lambdaQuery(HrOrganization.class)
|
LambdaQueryWrapper<HrOrganization> wrapper = Wrappers.lambdaQuery(HrOrganization.class)
|
||||||
|
|
Loading…
Reference in New Issue