| | |
| | | |
| | | @Override |
| | | public List<DailySafetyInspection> selectDailySafetyInspectionList(DailySafetyInspection inspection) { |
| | | boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); |
| | | if (!admin){ |
| | | boolean sysAdmin = SecurityUtils.hasRole(Constants.SYS_ADMIN); |
| | | boolean placeSafetyOfficer = SecurityUtils.hasRole(Constants.PLACE_SAFETY_OFFICER); |
| | | if (!(sysAdmin || placeSafetyOfficer)) { |
| | | inspection.setCreateById(SecurityUtils.getUserId()); |
| | | } |
| | | } |
| | | return dailySafetyInspectionMapper.getDailySafetyInspectionList(inspection); |
| | | } |
| | | |
| | |
| | | if (inspection.getId() == null) { |
| | | inspection.setCreateTime(LocalDateTime.now()); |
| | | inspection.setCreateBy(SecurityUtils.getUsername()); |
| | | inspection.setCreateById(SecurityUtils.getUserId()); |
| | | i = dailySafetyInspectionMapper.insert(inspection); |
| | | } else { |
| | | inspection.setUpdateTime(LocalDateTime.now()); |
| | | inspection.setUpdateBy(SecurityUtils.getUsername()); |
| | | inspection.setUpdateById(SecurityUtils.getUserId()); |
| | | i = dailySafetyInspectionMapper.updateById(inspection); |
| | | } |
| | | if (i > 0){ |
| | |
| | | return dailySafetyInspectionMapper.update(new DailySafetyInspection(), |
| | | new LambdaUpdateWrapper<DailySafetyInspection>().eq(DailySafetyInspection::getId, id) |
| | | .set(DailySafetyInspection::getDelFlag, Constants.FAIL).set(DailySafetyInspection::getUpdateTime, LocalDateTime.now()) |
| | | .set(DailySafetyInspection::getUpdateBy, SecurityUtils.getUsername())); |
| | | .set(DailySafetyInspection::getUpdateBy, SecurityUtils.getUsername()).set(DailySafetyInspection::getUpdateById, SecurityUtils.getUserId())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | return dailySafetyInspectionMapper.getCheckCount(deptId); |
| | | } |
| | | |
| | | |
| | | private void checkPer(){ |
| | | boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); |
| | | if (!admin){ |
| | | boolean sysAdmin = SecurityUtils.hasRole(Constants.SYS_ADMIN); |
| | | if (!sysAdmin){ |
| | | throw new RuntimeException("没有权限"); |
| | | } |
| | | boolean placeSafetyOfficer = SecurityUtils.hasRole(Constants.PLACE_SAFETY_OFFICER); |
| | | if (!placeSafetyOfficer){ |
| | | throw new RuntimeException("没有权限"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |