【add】超标报表导出功能实现
This commit is contained in:
parent
4fbcbd779a
commit
e1d23c8ef4
|
@ -62,3 +62,6 @@ flight_order_detail
|
|||
hotel_order_detail
|
||||
train_order_detail
|
||||
car_order_detail
|
||||
|
||||
## 超标订单标表
|
||||
order_exceed_standard
|
|
@ -53,10 +53,28 @@ public class ManageController {
|
|||
.body(resource);
|
||||
}
|
||||
|
||||
@ApiOperation("超标查询接口")
|
||||
@ApiOperation("超标报表查询接口")
|
||||
@PostMapping("/standard/query")
|
||||
public PageResult<OrderExceedStandardExcel> standardQuery(@RequestBody StandardQueryDto dto){
|
||||
return manageService.standardQuery(dto);
|
||||
}
|
||||
|
||||
@ApiOperation("超标报表导出接口")
|
||||
@PostMapping("/standard/export")
|
||||
public ResponseEntity<Resource> standardExport(@RequestBody StandardQueryDto dto){
|
||||
dto.setPageNum(1);
|
||||
dto.setPageSize(Integer.MAX_VALUE);
|
||||
File file = manageService.standardExport(dto);
|
||||
Resource resource;
|
||||
try {
|
||||
resource = new InputStreamResource(new FileInputStream(file));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return ResponseEntity.ok()
|
||||
.header("Content-Disposition", "attachment; filename=" + file.getName())
|
||||
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
||||
.body(resource);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.math.BigDecimal;
|
|||
* @Date:2024/5/11 8:51
|
||||
*/
|
||||
@Data
|
||||
public class OrderExceedStandardExcel {
|
||||
public class OrderExceedStandardExcel extends BaseExcel{
|
||||
@ExcelProperty("订单号")
|
||||
private String orderNo;
|
||||
@ExcelProperty("出差人")
|
||||
|
|
|
@ -20,4 +20,6 @@ public interface ManageService {
|
|||
File saveConsumptionDetail(ConsumptionDetailDto dto);
|
||||
|
||||
PageResult<OrderExceedStandardExcel> standardQuery(StandardQueryDto dto);
|
||||
|
||||
File standardExport(StandardQueryDto dto);
|
||||
}
|
||||
|
|
|
@ -61,6 +61,11 @@ public class ManageServiceImpl implements ManageService {
|
|||
return PageResult.totalPageNum(page.getTotalElements(), excelList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File standardExport(StandardQueryDto dto) {
|
||||
return ExcelUtil.exportReport(standardQuery(dto).getRecords());
|
||||
}
|
||||
|
||||
private static List<OrderExceedStandardExcel> getOrderExceedStandardExcels(Page<OrderExceedStandard> page) {
|
||||
List<OrderExceedStandard> orderList = page.getContent();
|
||||
List<OrderExceedStandardExcel> excelList = new ArrayList<>();
|
||||
|
|
Loading…
Reference in New Issue