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