【add】消费明细导出功能实现
This commit is contained in:
parent
881938047a
commit
21af75c2fc
|
@ -36,6 +36,8 @@ public class ManageController {
|
|||
@ApiOperation("消费明细导出接口")
|
||||
@PostMapping("/export")
|
||||
public ResponseEntity<Resource> export(@RequestBody ConsumptionDetailDto dto) {
|
||||
dto.setPageNum(1);
|
||||
dto.setPageSize(Integer.MAX_VALUE);
|
||||
File file = manageService.saveConsumptionDetail(dto);
|
||||
Resource resource;
|
||||
try {
|
||||
|
|
|
@ -11,6 +11,6 @@ import lombok.Data;
|
|||
@Data
|
||||
public class ConsumptionDetailDto extends BaseQuery{
|
||||
private Integer productType;
|
||||
private String supplierName;
|
||||
private String userName;
|
||||
private String orderNo;
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
|||
|
||||
@Override
|
||||
public PageResult<ConsumptionDetailExcel> pageConsumptionDetail(ConsumptionDetailDto dto) {
|
||||
if (dto.getSupplierName()==null){
|
||||
dto.setSupplierName("");
|
||||
if (dto.getUserName()==null){
|
||||
dto.setUserName("");
|
||||
}
|
||||
if (dto.getOrderNo()==null){
|
||||
dto.setOrderNo("");
|
||||
|
@ -75,12 +75,11 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
|||
PageRequest pageRequest = PageRequest
|
||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id"));
|
||||
Page<ConsumptionDetailExcel> data=new PageImpl<>(Collections.emptyList());
|
||||
//todo 各类型数据处理 record换成detail表
|
||||
switch (dto.getProductType()) {
|
||||
case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getSupplierName(),dto.getOrderNo(),pageRequest));
|
||||
case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getSupplierName(),dto.getOrderNo(),pageRequest));
|
||||
case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderNoContaining(dto.getSupplierName(),dto.getOrderNo(),pageRequest));
|
||||
case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getSupplierName(),dto.getOrderNo(),pageRequest));
|
||||
case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest));
|
||||
case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest));
|
||||
case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest));
|
||||
case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest));
|
||||
}
|
||||
return PageResult.totalPageNum(data.getTotalElements(), data.getContent());
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
package com.chint.manage.service.impl;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.infrastructure.export.OrderDetailExport;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.manage.entity.ConsumptionDetailExcel;
|
||||
import com.chint.manage.entity.dto.ConsumptionDetailDto;
|
||||
|
@ -15,8 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue