|
@@ -16,6 +16,7 @@ import com.qmth.teachcloud.common.enums.OrgTypeEnum;
|
|
|
import com.qmth.teachcloud.common.enums.RoleTypeEnum;
|
|
|
import com.qmth.teachcloud.common.enums.userPush.SpecialPrivilegeEnum;
|
|
|
import com.qmth.teachcloud.common.mapper.SysOrgMapper;
|
|
|
+import com.qmth.teachcloud.common.service.CommonCacheService;
|
|
|
import com.qmth.teachcloud.common.service.SysOrgService;
|
|
|
import com.qmth.teachcloud.common.service.SysRoleService;
|
|
|
import com.qmth.teachcloud.common.service.SysUserService;
|
|
@@ -44,12 +45,12 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
|
|
|
|
|
@Resource
|
|
|
private SysUserService sysUserService;
|
|
|
-
|
|
|
@Resource
|
|
|
private SysRoleService sysRoleService;
|
|
|
-
|
|
|
@Resource
|
|
|
- SysOrgMapper sysOrgMapper;
|
|
|
+ private SysOrgMapper sysOrgMapper;
|
|
|
+ @Resource
|
|
|
+ private CommonCacheService commonCacheService;
|
|
|
|
|
|
@Override
|
|
|
public List<OrgDto> listOrgTree(SpecialPrivilegeEnum specialPrivilegeEnum,boolean withoutPrintingRoom) {
|
|
@@ -126,6 +127,7 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
|
|
org.updateInfo(sysUser.getId());
|
|
|
success = this.updateById(org);
|
|
|
}
|
|
|
+ commonCacheService.updateOrgCollegeLevelCache(schoolId);
|
|
|
} catch (Exception e) {
|
|
|
if (e instanceof DuplicateKeyException) {
|
|
|
String errorColumn = e.getCause().toString();
|
|
@@ -393,17 +395,17 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ commonCacheService.updateOrgCollegeLevelCache(requestUser.getSchoolId());
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public SysOrg findTeachCollegeByOrgId(Long orgId) {
|
|
|
+ public SysOrg findCollegeLevelOrgByOrgId(Long orgId) {
|
|
|
if (!SystemConstant.longNotNull(orgId)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("机构id不存在");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
List<SysOrg> orgList = this.findParentsByOrgId(orgId).stream().distinct().collect(Collectors.toList());
|
|
|
List<SysOrg> schoolOrgList = orgList.stream().filter(e -> OrgTypeEnum.SCHOOL.equals(e.getType())).collect(Collectors.toList());
|
|
|
if (schoolOrgList.size() != 1){
|
|
@@ -411,13 +413,31 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
|
|
}
|
|
|
SysOrg schoolOrg = schoolOrgList.get(0);
|
|
|
Long schoolOrgId = schoolOrg.getId();
|
|
|
- List<SysOrg> collegeOrgList = orgList.stream().filter(e -> schoolOrgId.equals(e.getParentId())).collect(Collectors.toList());;
|
|
|
+ List<SysOrg> collegeOrgList = orgList.stream().filter(e -> schoolOrgId.equals(e.getParentId())).collect(Collectors.toList());
|
|
|
if (collegeOrgList.size() != 1){
|
|
|
throw ExceptionResultEnum.ERROR.exception("开课学院异常");
|
|
|
}
|
|
|
return collegeOrgList.get(0);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<SysOrg> findCollegeLevelOrgList(Long schoolId) {
|
|
|
+ SysOrg schoolOrg = this.getOne(new QueryWrapper<SysOrg>()
|
|
|
+ .lambda()
|
|
|
+ .eq(SysOrg::getSchoolId,schoolId)
|
|
|
+ .eq(SysOrg::getType,OrgTypeEnum.SCHOOL));
|
|
|
+
|
|
|
+ Long schoolOrgId = schoolOrg.getId();
|
|
|
+
|
|
|
+ return this.list(new QueryWrapper<SysOrg>()
|
|
|
+ .lambda()
|
|
|
+ .eq(SysOrg::getSchoolId,schoolId)
|
|
|
+ .eq(SysOrg::getParentId,schoolOrgId))
|
|
|
+ .stream()
|
|
|
+ .filter(e -> !OrgTypeEnum.PRINTING_HOUSE.equals(e.getType()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据子机构id深度优先搜索其父机构们
|
|
|
*
|
|
@@ -497,6 +517,7 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
|
|
sysOrg.setName(orgName);
|
|
|
sysOrg.setEnable(true);
|
|
|
this.save(sysOrg);
|
|
|
+
|
|
|
return sysOrg;
|
|
|
}
|
|
|
}
|