heheng
2024-12-16 125487e1a99361df5e8de543f8b2c75602022590
expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java
@@ -239,8 +239,11 @@
    public int deleteProjectManagementByIds(Long[] ids) {
        // 校验
        for (Long id : ids) {
            checkDataPer(id);
            checkDelData(id);
        }
//        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) ){
//            throw new ServiceException("无权操作!");
//        }
        return projectManagementMapper.deleteProjectManagementByIds(ids);
    }
@@ -317,7 +320,7 @@
        projectManagementUp.setId(req.getId());
        projectManagementUp.setState(4L);
        projectManagementUp.setStep(4L);
        projectManagementUp.setDesc(req.getDesc());
//        projectManagementUp.setDesc(req.getDesc());
        projectManagementUp.setProjectEndTime(req.getProjectEndTime());
        projectManagementUp.setUpdateBy(SecurityUtils.getUsername());
        int i = projectManagementMapper.updateProjectManagement(projectManagementUp);
@@ -485,11 +488,17 @@
            projectDetailResp.setDeptId(projectManagement.getDeptId());
            projectDetailResp.setDeptName(projectDetailResp.getDeptName());
            projectDetailResp.setProjectName(projectManagement.getProjectName());
            projectDetailResp.setProjectDateStart(projectManagement.getProjectDateStart());
            projectDetailResp.setProjectDateEnd(projectManagement.getProjectDateEnd());
            if (StringUtils.isNotEmpty(projectManagement.getJobCategory())){
                projectDetailResp.setJobCategory(projectManagement.getJobCategory());
            }
            SysExpertInfo sysExpertInfo = sysExpertInfoMapper.selectById(projectDetailResp.getExpertId());
            if (sysExpertInfo != null){
                projectDetailResp.setTitle(sysExpertInfo.getTitle());
                projectDetailResp.setJob(sysExpertInfo.getJob());
            }
        }
        return projectDetailResp;
    }
@@ -545,11 +554,24 @@
        Long deptId = projectManagement.getDeptId();
        // 本部门审批?
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && deptId.intValue() != SecurityUtils.getDeptId().intValue()){
            throw new ServiceException("非本部门数据,无权操作!");
            throw new ServiceException("非本处室数据,无权操作!");
        }
        if (projectManagement.getState() == 4){
            throw new ServiceException("已结项,无权操作!");
        }
        return projectManagement;
    }
    private void checkDelData(Long id){
        ProjectManagement projectManagement = checkData(id);
        Long deptId = projectManagement.getDeptId();
        // 本部门审批?
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && deptId.intValue() != SecurityUtils.getDeptId().intValue()){
            throw new ServiceException("非本处室数据,无权操作!");
        }
    }
}