| | |
| | | @Override |
| | | public void checkDeptDataScope(Long deptId) |
| | | { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && ObjectUtil.isNotNull(deptId)) |
| | | if (!SecurityUtils.adminUser() && ObjectUtil.isNotNull(deptId)) |
| | | { |
| | | SysDept dept = new SysDept(); |
| | | dept.setDeptId(deptId); |
| | |
| | | @Override |
| | | @Transactional |
| | | public int saveDept(SysDeptSaveDTOReq dept) { |
| | | Long companyId = SecurityUtils.getCompanyId(); |
| | | if (!companyId.equals(dept.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | // Long companyId = SecurityUtils.getCompanyId(); |
| | | // if (!companyId.equals(dept.getCompanyId())){ |
| | | // throw new ApiException("无权操作!"); |
| | | // } |
| | | SysDept sysDept = new SysDept(); |
| | | BeanUtils.copyProperties(dept, sysDept); |
| | | sysDept.setCompanyId(companyId); |
| | | boolean b = checkDeptNameUnique(sysDept); |
| | | if (!b){ |
| | | throw new ApiException("部门名称已存在!"); |
| | |
| | | delCaluse(sysDept.getDeptId(), delCaluseIds); |
| | | } |
| | | //处理条款 |
| | | batchSaveCaluse(sysDept.getDeptId(), companyId, dept.getCaluseVO1List()); |
| | | batchSaveCaluse(sysDept.getDeptId(), dept.getCompanyId(), dept.getCaluseVO1List()); |
| | | |
| | | } |
| | | |
| | |
| | | @Override |
| | | @Transactional |
| | | public int saveDeptResponsibility(SysDeptResponsibilityReqVo reqVo) { |
| | | Long companyId = SecurityUtils.getCompanyId(); |
| | | if (!companyId.equals(reqVo.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | // Long companyId = SecurityUtils.getCompanyId(); |
| | | // if (!companyId.equals(reqVo.getCompanyId())){ |
| | | // throw new ApiException("无权操作!"); |
| | | // } |
| | | SysDept sysDept = deptMapper.selectDeptById(reqVo.getDeptId()); |
| | | if (null == sysDept){ |
| | | throw new ApiException("部门不存在!"); |
| | | } |
| | | if (!companyId.equals(sysDept.getCompanyId())){ |
| | | if (!reqVo.getCompanyId().equals(sysDept.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | SysDept dept = new SysDept(); |
| | |
| | | @Transactional |
| | | public int initFunctionalDistribution(Long companyId) { |
| | | |
| | | if (!companyId.equals(SecurityUtils.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | // if (!companyId.equals(SecurityUtils.getCompanyId())){ |
| | | // throw new ApiException("无权操作!"); |
| | | // } |
| | | |
| | | sysFunctionalDistributionMapper.delByCompanyId(companyId); |
| | | SysDept sysDept = new SysDept(); |
| | |
| | | |
| | | @Override |
| | | public int saveFunctionalDistribution(FunctionalDistributionVo reqVo) { |
| | | Long companyId = SecurityUtils.getCompanyId(); |
| | | if (!companyId.equals(reqVo.getCompanyId())){ |
| | | throw new ApiException("无权操作!"); |
| | | } |
| | | // Long companyId = SecurityUtils.getCompanyId(); |
| | | // if (!companyId.equals(reqVo.getCompanyId())){ |
| | | // throw new ApiException("无权操作!"); |
| | | // } |
| | | List<SysFunctionalDistribution> list = reqVo.getList(); |
| | | if (list != null && !list.isEmpty()) |
| | | { |
| | | for (SysFunctionalDistribution sysFunctionalDistribution : list) { |
| | | sysFunctionalDistribution.setCompanyId(companyId); |
| | | sysFunctionalDistribution.setCompanyId(reqVo.getCompanyId()); |
| | | sysFunctionalDistribution.setUpdateBy(SecurityUtils.getUsername()); |
| | | sysFunctionalDistribution.setUpdateTime(LocalDateTime.now()); |
| | | } |