Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
lulz1 2024-05-10 08:09:36 +08:00
commit 3c2e1884ec
23 changed files with 305 additions and 99 deletions

View File

@ -1,4 +1,4 @@
# 差旅项目 # 差旅项目功能模块
## application ## application
### commands ### commands
继承command类通用的of方法用于选取处理方法 继承command类通用的of方法用于选取处理方法
@ -49,3 +49,16 @@ dao层
## interfaces ## interfaces
### rest ### rest
高德、同程、携程等第三方API 高德、同程、携程等第三方API
# 表
## 结算记录表 非实时(同程是 月初才有数据 携程是 T+1
order_flight_record
order_hotel_record
order_train_record
order_car_record
## 结算详情表 实时
flight_order_detail
hotel_order_detail
train_order_detail
car_order_detail

View File

@ -48,6 +48,4 @@ public interface JdbcOrderCarRecordRepository extends CrudRepository<OrderCarRec
order by r1.create_time desc order by r1.create_time desc
""") """)
Integer countRecordByCustomFiled(String fieldName, Object fieldValue, String accountPeriod); Integer countRecordByCustomFiled(String fieldName, Object fieldValue, String accountPeriod);
Page<OrderCarRecord> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
} }

View File

@ -47,6 +47,4 @@ public interface JdbcOrderFlightRecordRepository extends CrudRepository<OrderFli
order by r1.create_time desc order by r1.create_time desc
""") """)
Integer countRecordByCustomFiled(String fieldName, Object fieldValue, String accountPeriod); Integer countRecordByCustomFiled(String fieldName, Object fieldValue, String accountPeriod);
Page<OrderFlightRecord> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
} }

View File

@ -49,5 +49,4 @@ public interface JdbcOrderHotelRecordRepository extends CrudRepository<OrderHote
""") """)
Integer countRecordByCustomFiled(String fieldName, Object fieldValue, String accountPeriod); Integer countRecordByCustomFiled(String fieldName, Object fieldValue, String accountPeriod);
Page<OrderHotelRecord> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
} }

View File

@ -46,7 +46,4 @@ public interface JdbcOrderTrainRecordRepository extends CrudRepository<OrderTrai
order by r1.create_time desc order by r1.create_time desc
""") """)
Integer countRecordByCustomFiled(String fieldName, Object fieldValue, String accountPeriod); Integer countRecordByCustomFiled(String fieldName, Object fieldValue, String accountPeriod);
Page<OrderTrainRecord> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
} }

View File

@ -1,8 +1,8 @@
package com.chint.manage.controller; package com.chint.manage.controller;
import com.chint.application.dtos.AuthenticationSignDto;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.manage.entity.ConsumptionDetailExcel; import com.chint.manage.entity.excel.BaseExcel;
import com.chint.manage.entity.excel.TrainOrderDetailExcel;
import com.chint.manage.entity.dto.ConsumptionDetailDto; import com.chint.manage.entity.dto.ConsumptionDetailDto;
import com.chint.manage.service.ManageService; import com.chint.manage.service.ManageService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -29,13 +29,15 @@ public class ManageController {
@ApiOperation("消费明细查询接口") @ApiOperation("消费明细查询接口")
@PostMapping("/query") @PostMapping("/query")
public PageResult<ConsumptionDetailExcel> query(@RequestBody ConsumptionDetailDto dto){ public PageResult<? extends BaseExcel> query(@RequestBody ConsumptionDetailDto dto){
return manageService.pageConsumptionDetail(dto); return manageService.pageConsumptionDetail(dto);
} }
@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 {

View File

@ -1,30 +0,0 @@
package com.chint.manage.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 消费明细-order_detail
* @Authornxj
* @Date2024/5/7 14:17
*/
@Data
public class ConsumptionDetailExcel extends BaseExcel{
@ExcelProperty("出行人姓名")
private String userName;
@ExcelProperty("出发时间")
private String startDate;
@ExcelProperty("到达时间")
private String arriveDate;
@ExcelProperty("出发城市")
private String fromCity;
@ExcelProperty("到达城市")
private String toCity;
@ExcelProperty("出发站")
private String fromStationName;
@ExcelProperty("到达站")
private String toStationName;
@ExcelProperty("订单总额(含前收服务费)")
private String payAmount;
}

View File

@ -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;
} }

View File

@ -1,14 +1,13 @@
package com.chint.manage.entity; package com.chint.manage.entity.excel;
import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle; import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle; import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum; import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* * 基础Excel类
* @Authornxj * @Authornxj
* @Date2024/5/8 14:57 * @Date2024/5/8 14:57
*/ */

View File

@ -0,0 +1,41 @@
package com.chint.manage.entity.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class CarOrderDetailExcel extends BaseExcel{
@ExcelProperty("用车人姓名")
private String userName;
@ExcelProperty("出发时间")
private String startTime;
@ExcelProperty("到达时间")
private String arriveTime;
@ExcelProperty("出发城市")
private String fromCity;
@ExcelProperty("到达城市")
private String toCity;
@ExcelProperty("出发地")
private String fromStationName;
@ExcelProperty("到达地")
private String toStationName;
@ExcelProperty("订单总额(含前收服务费)")
private String orderAmount;
@ExcelProperty("车型")
private String carModel;
@ExcelProperty("里程数")
private String mileage;
@ExcelProperty("订单状态")
private String orderStatus;
@ExcelProperty("是否超标")
private String overStandard;
@ExcelProperty("超标原因")
private String overStandardReason;
@ExcelProperty("订单号")
private String orderNo;
@ExcelProperty("订单创建时间")
private String createTime;
}

View File

@ -0,0 +1,35 @@
package com.chint.manage.entity.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class FlightOrderDetailExcel extends BaseExcel{
@ExcelProperty("出行人姓名")
private String userName;
@ExcelProperty("起飞时间")
private String startTime;
@ExcelProperty("到达时间")
private String arriveTime;
@ExcelProperty("起飞城市名称")
private String startCityName;
@ExcelProperty("到达城市名称")
private String endCityName;
@ExcelProperty("订单总额")
private String orderAmount;
@ExcelProperty("舱位名称")
private String seatPointName;
@ExcelProperty("订单状态")
private String orderStatus;
@ExcelProperty("是否超标")
private String isOverStandard;
@ExcelProperty("超标原因")
private String overStandardReason;
@ExcelProperty("订单号")
private String orderNo;
@ExcelProperty("订单创建时间")
private String createTime;
}

View File

@ -0,0 +1,31 @@
package com.chint.manage.entity.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class HotelOrderDetailExcel extends BaseExcel {
@ExcelProperty("入住人姓名")
private String userName;
@ExcelProperty("入住日期")
private String checkInDate;
@ExcelProperty("离店日期")
private String departureDate;
@ExcelProperty("入住城市")
private String checkInCity;
@ExcelProperty("间夜信息")
private String nightRates;
@ExcelProperty("订单总额")
private String orderAmount;
@ExcelProperty("是否超标")
private String overStandard;
@ExcelProperty("超标原因")
private String overStandardReason;
@ExcelProperty("是否协议酒店")
private String agreementHotel;
@ExcelProperty("订单号")
private String orderNo;
@ExcelProperty("订单创建时间")
private String createTime;
}

View File

@ -0,0 +1,39 @@
package com.chint.manage.entity.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Builder;
import lombok.Data;
@Data
public class TrainOrderDetailExcel extends BaseExcel{
@ExcelProperty("出行人姓名")
private String userName;
@ExcelProperty("出发时间")
private String startTime;
@ExcelProperty("到达时间")
private String arriveTime;
@ExcelProperty("出发城市")
private String fromCity;
@ExcelProperty("到达城市")
private String toCity;
@ExcelProperty("出发站")
private String fromStationName;
@ExcelProperty("到达站")
private String toStationName;
@ExcelProperty("订单总额(含前收服务费)")
private String orderAmount;
@ExcelProperty("座位等级")
private String seatType;
@ExcelProperty("订单状态")
private String orderStatus;
@ExcelProperty("是否超标")
private String overStandard;
@ExcelProperty("超标原因")
private String overStandardReason;
@ExcelProperty("订单号")
private String orderNo;
@ExcelProperty("订单创建时间")
private String createTime;
}

View File

@ -0,0 +1,13 @@
package com.chint.manage.mapper;
import com.chint.domain.aggregates.order.CarOrderDetail;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JdbcCarOrderDetailRepository extends CrudRepository<CarOrderDetail, Long> {
Page<CarOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
}

View File

@ -2,7 +2,8 @@ package com.chint.manage.mapper;
import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.manage.entity.ConsumptionDetailExcel; import com.chint.manage.entity.excel.BaseExcel;
import com.chint.manage.entity.excel.TrainOrderDetailExcel;
import com.chint.manage.entity.dto.ConsumptionDetailDto; import com.chint.manage.entity.dto.ConsumptionDetailDto;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@ -10,5 +11,5 @@ import org.springframework.data.domain.Pageable;
public interface JdbcConsumptionDetailRepository { public interface JdbcConsumptionDetailRepository {
Page<OrderDetail> findAllByProductType(String productType, String param2, String param3, Pageable pageable); Page<OrderDetail> findAllByProductType(String productType, String param2, String param3, Pageable pageable);
PageResult<ConsumptionDetailExcel> pageConsumptionDetail(ConsumptionDetailDto dto); PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailDto dto);
} }

View File

@ -0,0 +1,13 @@
package com.chint.manage.mapper;
import com.chint.domain.aggregates.order.FlightOrderDetail;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JdbcFlightOrderDetailRepository extends CrudRepository<FlightOrderDetail, Long> {
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
}

View File

@ -0,0 +1,14 @@
package com.chint.manage.mapper;
import com.chint.domain.aggregates.order.HotelOrderDetail;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JdbcHotelOrderDetailRepository extends CrudRepository<HotelOrderDetail, Long> {
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
}

View File

@ -0,0 +1,13 @@
package com.chint.manage.mapper;
import com.chint.domain.aggregates.order.TrainOrderDetail;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JdbcTrainOrderDetailRepository extends CrudRepository<TrainOrderDetail, Long> {
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
}

View File

@ -1,14 +1,10 @@
package com.chint.manage.mapper.impl; package com.chint.manage.mapper.impl;
import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.order.order_record.*;
import com.chint.infrastructure.constant.LegConstant;
import com.chint.infrastructure.repository.jdbc.*;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.manage.entity.ConsumptionDetailExcel; import com.chint.manage.entity.excel.*;
import com.chint.manage.entity.dto.ConsumptionDetailDto; import com.chint.manage.entity.dto.ConsumptionDetailDto;
import com.chint.manage.mapper.JdbcConsumptionDetailRepository; import com.chint.manage.mapper.*;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.*; import org.springframework.data.domain.*;
@ -17,6 +13,7 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.LegConstant.*; import static com.chint.infrastructure.constant.LegConstant.*;
@ -32,13 +29,13 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
private NamedParameterJdbcTemplate jdbcTemplate; private NamedParameterJdbcTemplate jdbcTemplate;
@Autowired @Autowired
private JdbcOrderTrainRecordRepository jdbcOrderTrainRecordRepository; private JdbcTrainOrderDetailRepository jdbcTrainOrderDetailRepository;
@Autowired @Autowired
private JdbcOrderCarRecordRepository jdbcOrderCarRecordRepository; private JdbcCarOrderDetailRepository jdbcCarOrderDetailRepository;
@Autowired @Autowired
private JdbcOrderHotelRecordRepository jdbcOrderHotelRecordRepository; private JdbcHotelOrderDetailRepository jdbcHotelOrderDetailRepository;
@Autowired @Autowired
private JdbcOrderFlightRecordRepository jdbcOrderFlightRecordRepository; private JdbcFlightOrderDetailRepository jdbcFlightOrderDetailRepository;
@Override @Override
@ -65,41 +62,80 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
} }
@Override @Override
public PageResult<ConsumptionDetailExcel> pageConsumptionDetail(ConsumptionDetailDto dto) { public PageResult<? extends BaseExcel> 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("");
} }
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<? extends OrderBaseRecord> data=new PageImpl<>(Collections.emptyList()); Page<? extends BaseExcel> data=new PageImpl<>(Collections.emptyList());
switch (dto.getProductType()) { switch (dto.getProductType()) {
case LEG_TYPE_TRAIN -> data=jdbcOrderTrainRecordRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getSupplierName(),dto.getOrderNo(),pageRequest); case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest));
case LEG_TYPE_AIRPLANE -> data=jdbcOrderFlightRecordRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getSupplierName(),dto.getOrderNo(),pageRequest); case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest));
case LEG_TYPE_HOTEL -> data=jdbcOrderHotelRecordRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getSupplierName(),dto.getOrderNo(),pageRequest); case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest));
case LEG_TYPE_TAXI -> data=jdbcOrderCarRecordRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getSupplierName(),dto.getOrderNo(),pageRequest); case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest));
} }
//todo 数据处理 return PageResult.totalPageNum(data.getTotalElements(), data.getContent());
Page<ConsumptionDetailExcel> result=mapOrderTrainRecordToConsumptionDetailExcel(data);
return PageResult.totalPageNum(result.getTotalElements(), result.getContent());
} }
public Page<ConsumptionDetailExcel> mapOrderTrainRecordToConsumptionDetailExcel(Page<? extends OrderBaseRecord> page) { public Page<TrainOrderDetailExcel> getOrderTrainRecord(Page<TrainOrderDetail> page) {
List<? extends OrderBaseRecord> orderRecords = page.getContent(); List<TrainOrderDetail> orderRecords = page.getContent();
List<ConsumptionDetailExcel> consumptionDetailExcels = new ArrayList<>(); List<TrainOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
// 遍历 OrderBaseRecord将其转换为 ConsumptionDetailExcel
for (TrainOrderDetail orderRecord : orderRecords) {
TrainOrderDetailExcel trainOrderDetailExcel = new TrainOrderDetailExcel();
BeanUtils.copyProperties(orderRecord, trainOrderDetailExcel);
trainOrderDetailExcels.add(trainOrderDetailExcel);
}
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
}
public Page<FlightOrderDetailExcel> getOrderFlightRecord(Page<FlightOrderDetail> page) {
List<FlightOrderDetail> orderRecords = page.getContent();
List<FlightOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
for (FlightOrderDetail orderRecord : orderRecords) {
FlightOrderDetailExcel flightOrderDetailExcel = new FlightOrderDetailExcel();
BeanUtils.copyProperties(orderRecord, flightOrderDetailExcel);
trainOrderDetailExcels.add(flightOrderDetailExcel);
}
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
}
public Page<HotelOrderDetailExcel> getOrderHotelRecord(Page<HotelOrderDetail> page) {
List<HotelOrderDetail> orderRecords = page.getContent();
List<HotelOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
for (HotelOrderDetail orderRecord : orderRecords) {
HotelOrderDetailExcel hotelOrderDetailExcel = new HotelOrderDetailExcel();
BeanUtils.copyProperties(orderRecord, hotelOrderDetailExcel);
List<HotelOrderDetailCustomer> customers=orderRecord.getCustomers();
String userNames = customers.stream()
.map(HotelOrderDetailCustomer::getUserName) // 获取用户名
.collect(Collectors.joining(",")); // 用逗号分隔拼接
hotelOrderDetailExcel.setUserName(userNames);
trainOrderDetailExcels.add(hotelOrderDetailExcel);
}
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
}
public Page<CarOrderDetailExcel> getOrderCarRecord(Page<CarOrderDetail> page) {
List<CarOrderDetail> orderRecords = page.getContent();
List<CarOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
// 遍历 OrderBaseRecord将其转换为 ConsumptionDetailExcel // 遍历 OrderBaseRecord将其转换为 ConsumptionDetailExcel
for (OrderBaseRecord orderRecord : orderRecords) { for (CarOrderDetail orderRecord : orderRecords) {
ConsumptionDetailExcel consumptionDetailExcel = new ConsumptionDetailExcel(); CarOrderDetailExcel carOrderDetailExcel = new CarOrderDetailExcel();
// 使用 BeanUtils.copyProperties 进行属性拷贝 BeanUtils.copyProperties(orderRecord, carOrderDetailExcel);
BeanUtils.copyProperties(orderRecord, consumptionDetailExcel); trainOrderDetailExcels.add(carOrderDetailExcel);
// 添加到结果列表中
consumptionDetailExcels.add(consumptionDetailExcel);
} }
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回 // 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
return new PageImpl<>(consumptionDetailExcels, page.getPageable(), page.getTotalElements()); return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
} }
} }

View File

@ -1,8 +1,8 @@
package com.chint.manage.service; package com.chint.manage.service;
import com.chint.domain.aggregates.order.order_record.OrderBaseRecord;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.manage.entity.ConsumptionDetailExcel; import com.chint.manage.entity.excel.BaseExcel;
import com.chint.manage.entity.excel.TrainOrderDetailExcel;
import com.chint.manage.entity.dto.ConsumptionDetailDto; import com.chint.manage.entity.dto.ConsumptionDetailDto;
import java.io.File; import java.io.File;
@ -14,7 +14,7 @@ import java.io.File;
*/ */
public interface ManageService { public interface ManageService {
PageResult<ConsumptionDetailExcel> pageConsumptionDetail(ConsumptionDetailDto dto); PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailDto dto);
File saveConsumptionDetail(ConsumptionDetailDto dto); File saveConsumptionDetail(ConsumptionDetailDto dto);
} }

View File

@ -1,22 +1,17 @@
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.excel.BaseExcel;
import com.chint.manage.entity.excel.TrainOrderDetailExcel;
import com.chint.manage.entity.dto.ConsumptionDetailDto; import com.chint.manage.entity.dto.ConsumptionDetailDto;
import com.chint.manage.mapper.impl.JdbcConsumptionDetailRepositoryImpl; import com.chint.manage.mapper.impl.JdbcConsumptionDetailRepositoryImpl;
import com.chint.manage.service.ManageService; import com.chint.manage.service.ManageService;
import com.chint.manage.util.ExcelUtil; import com.chint.manage.util.ExcelUtil;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; 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;
/** /**
* *
@ -29,7 +24,7 @@ public class ManageServiceImpl implements ManageService {
private JdbcConsumptionDetailRepositoryImpl jdbcConsumptionDetailRepository; private JdbcConsumptionDetailRepositoryImpl jdbcConsumptionDetailRepository;
@Override @Override
public PageResult<ConsumptionDetailExcel> pageConsumptionDetail(ConsumptionDetailDto dto) { public PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailDto dto) {
return jdbcConsumptionDetailRepository.pageConsumptionDetail(dto); return jdbcConsumptionDetailRepository.pageConsumptionDetail(dto);
} }

View File

@ -3,9 +3,7 @@ package com.chint.manage.util;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.chint.infrastructure.export.OrderDetailExport; import com.chint.manage.entity.excel.BaseExcel;
import com.chint.manage.entity.BaseExcel;
import com.chint.manage.entity.ConsumptionDetailExcel;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;

View File

@ -3,7 +3,8 @@ package com.chint;
import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.manage.entity.ConsumptionDetailExcel; import com.chint.manage.entity.excel.BaseExcel;
import com.chint.manage.entity.excel.TrainOrderDetailExcel;
import com.chint.manage.entity.dto.ConsumptionDetailDto; import com.chint.manage.entity.dto.ConsumptionDetailDto;
import com.chint.manage.service.ManageService; import com.chint.manage.service.ManageService;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -21,8 +22,8 @@ public class ManageTest {
dto.setPageNum(1); dto.setPageNum(1);
dto.setPageSize(10); dto.setPageSize(10);
dto.setProductType(0); dto.setProductType(0);
dto.setSupplierName("王玲峰"); dto.setUserName("王玲峰");
PageResult<ConsumptionDetailExcel> result=manageService.pageConsumptionDetail(dto); PageResult<? extends BaseExcel> result=manageService.pageConsumptionDetail(dto);
System.out.println(result); System.out.println(result);
} }