heheng
2026-03-25 7b8d0d576082e148c778ca0bd2090e91bb61c4a6
gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java
@@ -21,6 +21,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
@@ -130,16 +131,35 @@
    @Override
    public int getCheckCount() {
        Long deptId = SecurityUtils.getDeptId();
        SysDept sysDept = sysDeptMapper.selectDeptById(deptId);
        if (sysDept == null){
        Long[] deptIds = SecurityUtils.getDeptIds();
        if (ObjectUtil.isEmpty(deptIds)){
            return 1;
        }else {
            if (!"1".equals(sysDept.getSafety())){
                return 1;
        }
        List<SysDept> sysDepts = sysDeptMapper.selectDeptByIds(deptIds);
        if (ObjectUtil.isEmpty(sysDepts)){
            return 1;
        }
        List<Long> data = new ArrayList<>();
        for (SysDept sysDept : sysDepts) {
            if ("1".equals(sysDept.getSafety())){
                data.add(sysDept.getDeptId());
            }
        }
        return dailySafetyInspectionMapper.getCheckCount(deptId);
        if (ObjectUtil.isEmpty(data)){
            return 1;
        }
        return dailySafetyInspectionMapper.getCheckCountList(data);
//        Long deptId = SecurityUtils.getDeptId();
//        SysDept sysDept = sysDeptMapper.selectDeptById(deptId);
//        if (sysDept == null){
//            return 1;
//        }else {
//            if (!"1".equals(sysDept.getSafety())){
//                return 1;
//            }
//        }
       // return dailySafetyInspectionMapper.getCheckCount(deptId);
    }
@@ -148,11 +168,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("没有权限");
            }
        }