| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.common.constant.Constants; |
| | | import com.gkhy.common.core.domain.entity.SysDept; |
| | | import com.gkhy.common.exception.ServiceException; |
| | | import com.gkhy.common.utils.SecurityUtils; |
| | | import com.gkhy.system.domain.DailySafetyInspection; |
| | | import com.gkhy.system.domain.DailySafetyInspectionUser; |
| | | import com.gkhy.system.mapper.DailySafetyInspectionMapper; |
| | | import com.gkhy.system.mapper.DailySafetyInspectionUserMapper; |
| | | import com.gkhy.system.mapper.SysDeptMapper; |
| | | import com.gkhy.system.service.DailySafetyInspectionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private DailySafetyInspectionUserMapper dailySafetyInspectionUserMapper; |
| | | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | | @Override |
| | | public List<DailySafetyInspection> selectDailySafetyInspectionList(DailySafetyInspection inspection) { |
| | | return dailySafetyInspectionMapper.getDailySafetyInspectionList(inspection); |
| | |
| | | if (ObjectUtil.isEmpty(dailySafetyInspectionUsers)) { |
| | | throw new ServiceException("参检人员不能为空"); |
| | | } |
| | | Long researchGroup = inspection.getResearchGroup(); |
| | | SysDept sysDept = sysDeptMapper.selectDeptById(researchGroup); |
| | | if (sysDept == null) { |
| | | throw new ServiceException("部门不存在"); |
| | | } |
| | | if (!"1".equals(sysDept.getSafety())){ |
| | | throw new ServiceException("所选部门未开启安全检查"); |
| | | } |
| | | |
| | | int i = 0; |
| | | if (inspection.getId() == null) { |
| | | inspection.setCreateTime(LocalDateTime.now()); |
| | |
| | | @Override |
| | | public int getCheckCount() { |
| | | 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); |
| | | } |
| | | } |