| | |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | @PostMapping() |
| | | @ApiOperation("添加设备报修") |
| | | public AjaxResult add(@RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.saveDeviceRepair(deviceRepair); |
| | | Long id = deviceRepairService.saveDeviceRepair(deviceRepair); |
| | | return AjaxResult.success("添加成功", id); |
| | | } |
| | | |
| | | @ApiOperation("根据id查询设备报修") |
| | |
| | | @PutMapping() |
| | | @ApiOperation("修改设备报修") |
| | | public AjaxResult update(@RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepair); |
| | | deviceRepairService.updateDeviceRepair(deviceRepair); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("repair") |
| | | @ApiOperation("设备维修") |
| | | public AjaxResult repair(@RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepair); |
| | | deviceRepairService.submitDeviceMaintain(deviceRepair); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("acceptance") |
| | | @ApiOperation("设备报修验收") |
| | | public AjaxResult acceptance(@RequestBody DeviceRepair deviceRepair) { |
| | | deviceRepairService.acceptDeviceRepair(deviceRepair); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @ApiOperation("删除设备报修") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceRepairService.removeBatchByIds(Arrays.asList(ids)); |
| | | boolean b = deviceRepairService.deleteRepairAndFiles(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return AjaxResult.error("删除失败"); |
| | | } |
| | |
| | | } |
| | | |
| | | @PostMapping("/uploadFile") |
| | | @ApiOperation("设备保修-附件上传") |
| | | public AjaxResult uploadFile(MultipartFile file, Long deviceRepairId) { |
| | | deviceRepairService.uploadFile(file, deviceRepairId); |
| | | @ApiOperation("设备保修-附件上传(fileType: 14设备问题 15维修完成)") |
| | | public AjaxResult uploadFile(MultipartFile file, Long deviceRepairId, Integer fileType) { |
| | | deviceRepairService.uploadFile(file, deviceRepairId, fileType); |
| | | return AjaxResult.success(); |
| | | } |
| | | |