heheng
2025-10-20 e7202ce274c9ee51a1617069e42c5b886d21991a
功能改造
已修改2个文件
28 ■■■■■ 文件已修改
gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/service/impl/HazardsServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java
@@ -148,11 +148,11 @@
        if (!admin){
            boolean sysAdmin = SecurityUtils.hasRole(Constants.SYS_ADMIN);
            if (!sysAdmin){
                throw new RuntimeException("没有权限");
                throw new ServiceException("没有权限");
            }
            boolean placeSafetyOfficer = SecurityUtils.hasRole(Constants.PLACE_SAFETY_OFFICER);
            if (!placeSafetyOfficer){
                throw new RuntimeException("没有权限");
                throw new ServiceException("没有权限");
            }
        }
gkhy-system/src/main/java/com/gkhy/system/service/impl/HazardsServiceImpl.java
@@ -7,6 +7,7 @@
import com.gkhy.common.core.domain.entity.SysRole;
import com.gkhy.common.core.domain.entity.SysUser;
import com.gkhy.common.core.domain.model.LoginUser;
import com.gkhy.common.exception.ServiceException;
import com.gkhy.common.utils.SecurityUtils;
import com.gkhy.system.domain.Hazards;
import com.gkhy.system.domain.dto.HazardsEditDTO;
@@ -71,7 +72,13 @@
    @Override
    public int updateHazards(HazardsEditDTO dto) {
        checkPer();
        Hazards hazards = hazardsMapper.selectById(dto.getId());
        if (hazards == null){
            throw new ServiceException("没有此数据");
        }
        if (!hazards.getReformUserId().toString().equals(SecurityUtils.getUserId().toString())){
            throw new ServiceException("只能整改本人数据");
        }
        Hazards inspection = new Hazards();
        inspection.setId(dto.getId());
        inspection.setReformPeriod(dto.getReformPeriod());
@@ -85,12 +92,13 @@
    }
    private void checkPer(){
        boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
        if (!admin){
            boolean placeSafetyOfficer = SecurityUtils.hasRole(Constants.SYS_ADMIN);
            if (!placeSafetyOfficer){
                throw new RuntimeException("没有权限");
            }
//        boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
//        if (!admin){
//            boolean placeSafetyOfficer = SecurityUtils.hasRole(Constants.SYS_ADMIN);
//            if (!placeSafetyOfficer){
//                throw new RuntimeException("没有权限");
//            }
//            LoginUser loginUser = SecurityUtils.getLoginUser();
//            SysUser user = loginUser.getUser();
//            List<SysRole> roles = user.getRoles();
@@ -98,7 +106,7 @@
//            if (sysAdmin == 0){
//                throw new RuntimeException("没有权限");
//            }
        }
//        }
    }