|
@@ -0,0 +1,61 @@
|
|
|
|
|
+package cn.iocoder.yudao.module.pms.util;
|
|
|
|
|
+
|
|
|
|
|
+import cn.hutool.core.util.ObjUtil;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
|
+import java.util.Set;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 部门工具类
|
|
|
|
|
+ */
|
|
|
|
|
+@Service
|
|
|
|
|
+public class DeptUtils {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private DeptService deptService;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检测是否已经维护了生产时效
|
|
|
|
|
+ * @param deptId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public DeptDO loginUserCompany(Long deptId){
|
|
|
|
|
+ Long companyId = null;
|
|
|
|
|
+ DeptDO company = null;
|
|
|
|
|
+ // 查询各专业公司下的所有 部门id集合
|
|
|
|
|
+ // 如果集合包含 当前登录人的 deptId 则确定当前登录人所属的专业公司
|
|
|
|
|
+ Set<Long> rhChildDeptIds = deptService.getChildDeptIdListFromCache(157l);
|
|
|
|
|
+ rhChildDeptIds.add(157l);
|
|
|
|
|
+ Set<Long> ryChildDeptIds = deptService.getChildDeptIdListFromCache(158l);
|
|
|
|
|
+ ryChildDeptIds.add(158l);
|
|
|
|
|
+ Set<Long> rdChildDeptIds = deptService.getChildDeptIdListFromCache(163l);
|
|
|
|
|
+ rdChildDeptIds.add(163l);
|
|
|
|
|
+ Set<Long> fiveChildDeptIds = deptService.getChildDeptIdListFromCache(388l);
|
|
|
|
|
+ fiveChildDeptIds.add(388l);
|
|
|
|
|
+ if (rhChildDeptIds.contains(deptId)) {
|
|
|
|
|
+ // 当前登录所属公司为 瑞恒
|
|
|
|
|
+ companyId = 157l;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ryChildDeptIds.contains(deptId)) {
|
|
|
|
|
+ // 当前登录所属公司为 瑞鹰
|
|
|
|
|
+ companyId = 158l;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (rdChildDeptIds.contains(deptId)) {
|
|
|
|
|
+ // 当前登录所属公司为 瑞都
|
|
|
|
|
+ companyId = 163l;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (fiveChildDeptIds.contains(deptId)) {
|
|
|
|
|
+ // 当前登录所属公司为 5#公司
|
|
|
|
|
+ companyId = 388l;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(companyId)) {
|
|
|
|
|
+ company = deptService.getDept(companyId);
|
|
|
|
|
+ }
|
|
|
|
|
+ return company;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+}
|