| | |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.other.service.TempFileService; |
| | | import com.ruoyi.purchase.dto.ProductRecordDto; |
| | | import com.ruoyi.purchase.dto.TicketRegistrationDto; |
| | | import com.ruoyi.purchase.service.ITicketRegistrationService; |
| | | import com.ruoyi.purchase.service.impl.TicketRegistrationServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | |
| | | private TempFileService tempFileService; |
| | | |
| | | private TicketRegistrationServiceImpl ticketRegistrationServiceImpl; |
| | | |
| | | @PostMapping("/upload") |
| | | public AjaxResult uploadFile(MultipartFile file, String type) { |
| | | public AjaxResult uploadFile(MultipartFile file, Integer type) { |
| | | try { |
| | | return AjaxResult.success(tempFileService.uploadFile(file, type)); |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("uploadFile") |
| | | public AjaxResult uploadFile(@RequestBody ProductRecordDto productRecordDto) { |
| | | try { |
| | | if (!productRecordDto.getTempFileIds().isEmpty()&&productRecordDto.getTicketRegistrationId() != null) { |
| | | ticketRegistrationServiceImpl.migrateTempFilesToFormal(productRecordDto.getTicketRegistrationId(), productRecordDto.getTempFileIds()); |
| | | } |
| | | } catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |