From bd605ac1e79b73db3b501f323d6f4a10c0f27dd5 Mon Sep 17 00:00:00 2001 From: heheng <475597332@qq.com> Date: 星期五, 27 六月 2025 15:01:57 +0800 Subject: [PATCH] 部分功能调整 --- multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java | 55 +++++++++++++++++++++++++++++++++---------------------- 1 files changed, 33 insertions(+), 22 deletions(-) diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java index a186588..acf7d43 100644 --- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java +++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java @@ -226,7 +226,7 @@ @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); @@ -260,13 +260,12 @@ @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("部门名称已存在!"); @@ -287,7 +286,7 @@ delCaluse(sysDept.getDeptId(), delCaluseIds); } //处理条款 - batchSaveCaluse(sysDept.getDeptId(), companyId, dept.getCaluseVO1List()); + batchSaveCaluse(sysDept.getDeptId(), dept.getCompanyId(), dept.getCaluseVO1List()); } @@ -297,15 +296,15 @@ @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(); @@ -333,13 +332,14 @@ } @Override + @Transactional public int initFunctionalDistribution(Long companyId) { - if (!companyId.equals(SecurityUtils.getCompanyId())){ - throw new ApiException("无权操作!"); - } - sysFunctionalDistributionMapper.delete(new LambdaQueryWrapper<SysFunctionalDistribution>().eq(SysFunctionalDistribution::getCompanyId, SecurityUtils.getLoginUser().getUser().getCompanyId())); +// if (!companyId.equals(SecurityUtils.getCompanyId())){ +// throw new ApiException("无权操作!"); +// } + sysFunctionalDistributionMapper.delByCompanyId(companyId); SysDept sysDept = new SysDept(); sysDept.setCompanyId(companyId); List<DeptVo> deptVos = deptMapper.selectDeptList(sysDept); @@ -369,11 +369,19 @@ @Override public int saveFunctionalDistribution(FunctionalDistributionVo reqVo) { - Long companyId = SecurityUtils.getLoginUser().getUser().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(reqVo.getCompanyId()); + sysFunctionalDistribution.setUpdateBy(SecurityUtils.getUsername()); + sysFunctionalDistribution.setUpdateTime(LocalDateTime.now()); + } + } int i = sysFunctionalDistributionMapper.batchUpdate(list); if (i < 1){ throw new ApiException("保存失败!"); @@ -408,7 +416,9 @@ if (!emptyIdClauseNums.isEmpty()){ List<SysDeptResponsibility> sysDeptResponsibilities = deptResponsibilityMapper.selectList(new LambdaQueryWrapper<SysDeptResponsibility>() - .eq(SysDeptResponsibility::getDeptId, reqVo.getDeptId()).in(SysDeptResponsibility::getClauseNum, emptyIdClauseNums).notIn(SysDeptResponsibility::getId, emptyIdClauseIds)); + .eq(SysDeptResponsibility::getDeptId, reqVo.getDeptId()) + .in(SysDeptResponsibility::getClauseNum, emptyIdClauseNums) + .notIn(SysDeptResponsibility::getId, emptyIdClauseIds).eq(SysDeptResponsibility::getDelFlag, "0")); if (!sysDeptResponsibilities.isEmpty()){ throw new ApiException("部门条款编码重复!"); } @@ -447,7 +457,8 @@ .collect(Collectors.toList()); if (!emptyIdClauseNums.isEmpty()){ List<SysDeptResponsibility> sysDeptResponsibilities = deptResponsibilityMapper.selectList(new LambdaQueryWrapper<SysDeptResponsibility>() - .eq(SysDeptResponsibility::getDeptId, deptId).in(SysDeptResponsibility::getClauseNum, emptyIdClauseNums)); + .eq(SysDeptResponsibility::getDeptId, deptId).in(SysDeptResponsibility::getClauseNum, emptyIdClauseNums) + .eq(SysDeptResponsibility::getCompanyId, companyId).eq(SysDeptResponsibility::getDelFlag, "0")); if (!sysDeptResponsibilities.isEmpty()){ throw new ApiException("部门条款编码重复!"); } -- Gitblit v1.9.2