heheng
2025-03-11 686bd303ddc68db338fe352c38392194217168a5
expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java
@@ -8,6 +8,7 @@
import com.gkhy.common.utils.DateUtils;
import com.gkhy.common.utils.SecurityUtils;
import com.gkhy.common.utils.StringUtils;
import com.gkhy.common.utils.uuid.RandomStringGenerator;
import com.gkhy.system.domain.*;
import com.gkhy.system.domain.vo.request.*;
import com.gkhy.system.domain.vo.response.*;
@@ -65,7 +66,7 @@
     */
    @Override
    public List<ProjectManagement> selectProjectManagementList(ProjectManagement projectManagement) {
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && SecurityUtils.getUserId() != 130L){
           projectManagement.setDeptId(SecurityUtils.getDeptId());
        }
        return projectManagementMapper.selectProjectManagementList(projectManagement);
@@ -93,6 +94,7 @@
           // projectManagementMapper.updateProjectManagement(projectManagementSave);
            updateById(projectManagementSave);
        }else {
            projectManagementSave.setProjectCode(RandomStringGenerator.generateRandomString(10));
            projectManagementSave.setStep(1L);
            projectManagementSave.setCreateBy(SecurityUtils.getUsername());
            projectManagementSave.setCreateTime(DateUtils.getNowDate());
@@ -238,12 +240,12 @@
    @Override
    public int deleteProjectManagementByIds(Long[] ids) {
        // 校验
//        for (Long id : ids) {
//            checkDataPer(id);
//        }
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) ){
            throw new ServiceException("无权操作!");
        for (Long id : ids) {
            checkDelData(id);
        }
//        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) ){
//            throw new ServiceException("无权操作!");
//        }
        return projectManagementMapper.deleteProjectManagementByIds(ids);
    }
@@ -490,12 +492,15 @@
            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;
    }
@@ -551,7 +556,7 @@
        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("已结项,无权操作!");
@@ -559,4 +564,16 @@
        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("非本处室数据,无权操作!");
        }
    }
}