| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.dto.DeviceRecordDto; |
| | | import com.ruoyi.device.excel.DeviceRecordExportWord; |
| | | import com.ruoyi.device.mapper.DeviceMapper; |
| | |
| | | import com.ruoyi.device.pojo.DeviceRecord; |
| | | import com.ruoyi.device.service.DeviceRecordService; |
| | | import com.ruoyi.inspect.util.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.system.domain.vo.SysRoleVo; |
| | | import com.ruoyi.system.mapper.SysRoleMenuMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Resource |
| | | private DeviceMapper deviceMapper; |
| | | |
| | | @Resource |
| | | private SysRoleMenuMapper sysRoleMenuMapper; |
| | | |
| | | @Override |
| | | public IPage<DeviceRecordDto> deviceRecordPage(Integer deviceId, Page page, String sampleCode, String managementNumber) { |
| | | // todo:仅看自己 |
| | | Integer userId = null; |
| | | Long userId = SecurityUtils.getUserId(); |
| | | // 获取权限判断是否是仅看我 |
| | | SysRoleVo sysRoleVo = sysRoleMenuMapper.selectRoleMenu("get:device:record", userId); |
| | | |
| | | return baseMapper.deviceRecordPage(deviceId, page, sampleCode, managementNumber, userId); |
| | | Integer testUserId = null; |
| | | //没有仅看我权限跳过 |
| | | if (sysRoleVo != null && sysRoleVo.getIsRersonal() != null && sysRoleVo.getIsRersonal().equals(1)) { |
| | | testUserId = SecurityUtils.getUserId().intValue(); |
| | | } |
| | | |
| | | return baseMapper.deviceRecordPage(deviceId, page, sampleCode, managementNumber, testUserId); |
| | | } |
| | | |
| | | |
| | |
| | | endTime = deviceRecord.getUseEndDate().format(formatter); |
| | | String[] startTimeSplit = startTime.split(" "); |
| | | String[] endTimeSplit = endTime.split(" "); |
| | | startTime = startTimeSplit[1]; |
| | | if (startTimeSplit[0].equals(endTimeSplit[0])) { |
| | | startTime = startTimeSplit[1]; |
| | | endTime = endTimeSplit[1]; |
| | | } else { |
| | | endTime = endTimeSplit[0] + '\n' + endTimeSplit[1]; |
| | | startTime = startTimeSplit[0] + '\n' + startTimeSplit[1]; |
| | | } |
| | | DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy.M.d"); |
| | | operationDate = deviceRecord.getUseStartDate().format(formatter2); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导出失败"); |