| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | |
| | | import com.ruoyi.device.mapper.DeviceMaintenanceMapper; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | |
| | | private final DeviceMaintenanceMapper deviceMaintenanceMapper; |
| | | private final SparePartsMapper sparePartsMapper; |
| | | private final SparePartsRequisitionRecordService sparePartsRequisitionRecordService; |
| | | private final FileUtil fileUtil; |
| | | |
| | | @Override |
| | | public IPage<DeviceMaintenanceDto> queryPage(Page page, DeviceMaintenanceDto deviceMaintenanceDto) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult saveDeviceRepair(DeviceMaintenance deviceMaintenance) { |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance) { |
| | | boolean save = this.save(deviceMaintenance); |
| | | if (save){ |
| | | // 处理图片上传 |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenance deviceMaintenance) { |
| | | public AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceMaintenance oldDeviceMaintenance = this.getById(deviceMaintenance.getId()); |
| | | // 处理备件使用情况 |
| | | if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(deviceMaintenance.getSparePartsUseList())) { |
| | |
| | | } |
| | | |
| | | if (this.updateById(deviceMaintenance)) { |
| | | // 处理图片上传 |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public DeviceMaintenanceDto detailById(Long id) { |
| | | |
| | | return deviceMaintenanceMapper.detailById(id); |
| | | public DeviceMaintenanceVo detailById(Long id) { |
| | | DeviceMaintenanceVo vo = deviceMaintenanceMapper.detailById(id); |
| | | vo.setStorageBlobVOs(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.DEVICE_MAINTENANCE, id)); |
| | | return vo; |
| | | } |
| | | } |