| | |
| | | import com.ruoyi.device.execl.DeviceMaintenanceExeclDto; |
| | | import com.ruoyi.device.mapper.DeviceMaintenanceMapper; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.DeviceMaintenanceFileService; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | |
| | | @Autowired |
| | | private DeviceMaintenanceMapper deviceMaintenanceMapper; |
| | | |
| | | @Autowired |
| | | private DeviceMaintenanceFileService deviceMaintenanceFileService; |
| | | |
| | | @Override |
| | | public IPage<DeviceMaintenanceDto> queryPage(Page page, DeviceMaintenanceDto deviceMaintenanceDto) { |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult saveDeviceRepair(DeviceMaintenance deviceMaintenance) { |
| | | // 先保存设备保养记录 |
| | | boolean save = this.save(deviceMaintenance); |
| | | if (save) { |
| | | return AjaxResult.success(deviceMaintenance); |
| | | if (!save) { |
| | | return AjaxResult.error("保存失败"); |
| | | } |
| | | return AjaxResult.error(); |
| | | |
| | | // 处理临时文件关联 |
| | | if (deviceMaintenance.getTempFileIds() != null && !deviceMaintenance.getTempFileIds().isEmpty()) { |
| | | for (String tempId : deviceMaintenance.getTempFileIds()) { |
| | | try { |
| | | deviceMaintenanceFileService.bindFromTemp(tempId, deviceMaintenance.getId().intValue(), null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("关联临时文件失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success(deviceMaintenance); |
| | | } |
| | | |
| | | @Override |