feat:消费明细接口增加订单号参数
This commit is contained in:
parent
f645cebd44
commit
d27131fc36
|
@ -6,7 +6,7 @@ import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class AuthenticationSignDto extends BaseQuery {
|
public class AuthenticationSignDto extends BaseQuery {
|
||||||
// private String orderNo; //订单号
|
private String orderNo; //订单号
|
||||||
private Integer productType; //机票1 、酒店2、火车3、打车4
|
private Integer productType; //机票1 、酒店2、火车3、打车4
|
||||||
private String systemType;
|
private String systemType;
|
||||||
private String startTime;
|
private String startTime;
|
||||||
|
|
|
@ -142,6 +142,7 @@ public class OrderDetailController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean signCheck(AuthenticationSignDto authenticationDto) {
|
private boolean signCheck(AuthenticationSignDto authenticationDto) {
|
||||||
|
String orderNo = authenticationDto.getOrderNo();
|
||||||
Integer productType = authenticationDto.getProductType();
|
Integer productType = authenticationDto.getProductType();
|
||||||
String systemType = authenticationDto.getSystemType();
|
String systemType = authenticationDto.getSystemType();
|
||||||
String startTime = authenticationDto.getStartTime();
|
String startTime = authenticationDto.getStartTime();
|
||||||
|
@ -149,7 +150,13 @@ public class OrderDetailController {
|
||||||
Integer pageSize = authenticationDto.getPageSize();
|
Integer pageSize = authenticationDto.getPageSize();
|
||||||
Integer pageNum = authenticationDto.getPageNum();
|
Integer pageNum = authenticationDto.getPageNum();
|
||||||
String orgsign = authenticationDto.getSign();
|
String orgsign = authenticationDto.getSign();
|
||||||
String sign = Digest.md5(productType + systemType + startTime + endTime + pageSize + pageNum);
|
String input;
|
||||||
|
if (orderNo != null) {
|
||||||
|
input = orderNo + productType + systemType + startTime + endTime + pageSize + pageNum;
|
||||||
|
} else {
|
||||||
|
input = productType + systemType + startTime + endTime + pageSize + pageNum;
|
||||||
|
}
|
||||||
|
String sign = Digest.md5(input);
|
||||||
return orgsign.equals(sign);
|
return orgsign.equals(sign);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ import static com.chint.application.queryies.util.QueryUtil.reGetReceiptsNum;
|
||||||
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||||
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_ORDER_STATUS_CANCEL;
|
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_ORDER_STATUS_CANCEL;
|
||||||
|
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -132,7 +133,6 @@ public class OrderDetailQuery {
|
||||||
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
|
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
|
||||||
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
|
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
|
||||||
});
|
});
|
||||||
// systemDomainService.generateRecordClerk(orderFlightRecordList);
|
|
||||||
return orderFlightRecordList;
|
return orderFlightRecordList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,6 @@ public class OrderDetailQuery {
|
||||||
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
|
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
|
||||||
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
|
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
|
||||||
});
|
});
|
||||||
// systemDomainService.generateRecordClerk(orderHotelRecordList);
|
|
||||||
return orderHotelRecordList;
|
return orderHotelRecordList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +154,6 @@ public class OrderDetailQuery {
|
||||||
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
|
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
|
||||||
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
|
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
|
||||||
});
|
});
|
||||||
// systemDomainService.generateRecordClerk(orderTrainRecordList);
|
|
||||||
return orderTrainRecordList;
|
return orderTrainRecordList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +164,6 @@ public class OrderDetailQuery {
|
||||||
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
|
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
|
||||||
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
|
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
|
||||||
});
|
});
|
||||||
// systemDomainService.generateRecordClerk(orderCarRecordList);
|
|
||||||
return orderCarRecordList;
|
return orderCarRecordList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,15 +189,25 @@ public class OrderDetailQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OrderDetail> queryOrderDetail(AuthenticationSignDto authenticationDto) {
|
private List<OrderDetail> queryOrderDetail(AuthenticationSignDto authenticationDto) {
|
||||||
|
Integer legType = translateProductTypeToLegType(
|
||||||
|
authenticationDto.getProductType()
|
||||||
|
);
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter);
|
LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter);
|
||||||
LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter);
|
LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter);
|
||||||
return orderDetailRepository.findByUpdateTimeBetween(targetTimeBegin, targetTimeEnd);
|
List<OrderDetail> res;
|
||||||
|
if (authenticationDto.getOrderNo() != null && !authenticationDto.getOrderNo().isEmpty()) {
|
||||||
|
res = orderDetailRepository.findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(targetTimeBegin,
|
||||||
|
targetTimeEnd, legType, authenticationDto.getOrderNo());
|
||||||
|
} else {
|
||||||
|
res = orderDetailRepository.findByCreateTimeBetweenAndProductType(targetTimeBegin,
|
||||||
|
targetTimeEnd, legType);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File exportOrderDetailToFile(AuthenticationSignDto authenticationDto) {
|
public File exportOrderDetailToFile(AuthenticationSignDto authenticationDto) {
|
||||||
List<OrderDetail> orderDetailList = queryOrderDetail(authenticationDto).stream().filter(Objects::nonNull).toList();
|
List<OrderDetail> orderDetailList = queryOrderDetail(authenticationDto).stream().filter(Objects::nonNull).toList();
|
||||||
|
|
||||||
Integer productType = authenticationDto.getProductType();
|
Integer productType = authenticationDto.getProductType();
|
||||||
return OrderDetailWriter.exportReport(
|
return OrderDetailWriter.exportReport(
|
||||||
switch (productType) {
|
switch (productType) {
|
||||||
|
@ -363,4 +370,13 @@ public class OrderDetailQuery {
|
||||||
return new PageResult<>(total, OrderDetailResList);
|
return new PageResult<>(total, OrderDetailResList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Integer translateProductTypeToLegType(Integer productType) {
|
||||||
|
return switch (productType) {
|
||||||
|
case 1 -> LEG_TYPE_AIRPLANE;
|
||||||
|
case 2 -> LEG_TYPE_HOTEL;
|
||||||
|
case 3 -> LEG_TYPE_TRAIN;
|
||||||
|
case 4 -> LEG_TYPE_TAXI;
|
||||||
|
default -> 4;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.chint.domain.repository;
|
||||||
|
|
||||||
import com.chint.application.dtos.OrderDetailQueryParam;
|
import com.chint.application.dtos.OrderDetailQueryParam;
|
||||||
import com.chint.domain.aggregates.order.OrderDetail;
|
import com.chint.domain.aggregates.order.OrderDetail;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
@ -12,6 +11,7 @@ import java.util.Optional;
|
||||||
public interface OrderDetailRepository {
|
public interface OrderDetailRepository {
|
||||||
|
|
||||||
Page<OrderDetail> pageQuery(OrderDetailQueryParam orderDetailQueryParam);
|
Page<OrderDetail> pageQuery(OrderDetailQueryParam orderDetailQueryParam);
|
||||||
|
|
||||||
OrderDetail findById(Long orderDetailId);
|
OrderDetail findById(Long orderDetailId);
|
||||||
|
|
||||||
List<OrderDetail> findByLegId(Long legId);
|
List<OrderDetail> findByLegId(Long legId);
|
||||||
|
@ -23,4 +23,9 @@ public interface OrderDetailRepository {
|
||||||
void deleteById(Long id);
|
void deleteById(Long id);
|
||||||
|
|
||||||
List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTimeStart, LocalDateTime createTimeEnd);
|
List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTimeStart, LocalDateTime createTimeEnd);
|
||||||
|
|
||||||
|
List<OrderDetail> findByCreateTimeBetweenAndProductType(LocalDateTime createTimeStart, LocalDateTime createTimeEnd, Integer productType);
|
||||||
|
|
||||||
|
List<OrderDetail> findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTimeStart, LocalDateTime createTimeEnd, Integer productType, String orderNo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||||
@Repository
|
@Repository
|
||||||
public class OrderDetailRepositoryImpl implements OrderDetailRepository {
|
public class OrderDetailRepositoryImpl implements OrderDetailRepository {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcOrderDetailRepository orderDetailRepository;
|
private JdbcOrderDetailRepository jdbcOrderDetailRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RouteCacheService routeCacheService;
|
private RouteCacheService routeCacheService;
|
||||||
|
@ -32,22 +32,22 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
|
||||||
PageRequest pageRequest = PageRequest
|
PageRequest pageRequest = PageRequest
|
||||||
.of(orderDetailQueryParam.getPageNum() - 1, orderDetailQueryParam.getPageSize(), Sort.by("updateTime"));
|
.of(orderDetailQueryParam.getPageNum() - 1, orderDetailQueryParam.getPageSize(), Sort.by("updateTime"));
|
||||||
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo();
|
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo();
|
||||||
return orderDetailRepository.findByEmployeeNo(employeeNo, pageRequest);
|
return jdbcOrderDetailRepository.findByEmployeeNo(employeeNo, pageRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrderDetail findById(Long orderDetailId) {
|
public OrderDetail findById(Long orderDetailId) {
|
||||||
return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
return jdbcOrderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderDetail> findByLegId(Long legId) {
|
public List<OrderDetail> findByLegId(Long legId) {
|
||||||
return orderDetailRepository.findByLegId(legId);
|
return jdbcOrderDetailRepository.findByLegId(legId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<OrderDetail> findByOrderNo(String orderNo) {
|
public Optional<OrderDetail> findByOrderNo(String orderNo) {
|
||||||
return Optional.ofNullable(orderDetailRepository.findByOrderNo(orderNo));
|
return Optional.ofNullable(jdbcOrderDetailRepository.findByOrderNo(orderNo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,7 +55,7 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
|
||||||
if (orderDetail.getRouteId() != null) {
|
if (orderDetail.getRouteId() != null) {
|
||||||
routeCacheService.invalidateRouteCache(orderDetail.getRouteId());
|
routeCacheService.invalidateRouteCache(orderDetail.getRouteId());
|
||||||
}
|
}
|
||||||
OrderDetail detail = orderDetailRepository.save(orderDetail);
|
OrderDetail detail = jdbcOrderDetailRepository.save(orderDetail);
|
||||||
if (detail.getRouteId() != null) {
|
if (detail.getRouteId() != null) {
|
||||||
routeCacheService.invalidateRouteCache(orderDetail.getRouteId());
|
routeCacheService.invalidateRouteCache(orderDetail.getRouteId());
|
||||||
}
|
}
|
||||||
|
@ -64,12 +64,22 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteById(Long id) {
|
public void deleteById(Long id) {
|
||||||
orderDetailRepository.deleteById(id);
|
jdbcOrderDetailRepository.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTimeStart, LocalDateTime createTimeEnd) {
|
public List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTimeStart, LocalDateTime createTimeEnd) {
|
||||||
return orderDetailRepository.findByCreateTimeBetween(createTimeStart, createTimeEnd);
|
return jdbcOrderDetailRepository.findByCreateTimeBetween(createTimeStart, createTimeEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrderDetail> findByCreateTimeBetweenAndProductType(LocalDateTime createTimeStart, LocalDateTime createTimeEnd, Integer productType) {
|
||||||
|
return jdbcOrderDetailRepository.findByCreateTimeBetweenAndProductType(createTimeStart, createTimeEnd, productType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrderDetail> findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTimeStart, LocalDateTime createTimeEnd, Integer productType, String orderNo) {
|
||||||
|
return jdbcOrderDetailRepository.findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(createTimeStart, createTimeEnd, productType, orderNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,5 +22,7 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
|
||||||
Page<OrderDetail> findByEmployeeNo(String employeeNo, Pageable pageable);
|
Page<OrderDetail> findByEmployeeNo(String employeeNo, Pageable pageable);
|
||||||
|
|
||||||
List<OrderDetail> findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
|
List<OrderDetail> findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
|
||||||
|
List<OrderDetail> findByCreateTimeBetweenAndProductType(LocalDateTime createTime, LocalDateTime createTime2, Integer productType);
|
||||||
|
List<OrderDetail> findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTime, LocalDateTime createTime2, Integer productType, String orderNo);
|
||||||
List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
|
List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class LYOrderUtil {
|
||||||
case "E" -> ORDER_EVENT_ORDERED; //已申请出票
|
case "E" -> ORDER_EVENT_ORDERED; //已申请出票
|
||||||
case "K" -> ORDER_EVENT_PREPARE; //抢票中
|
case "K" -> ORDER_EVENT_PREPARE; //抢票中
|
||||||
case "M" -> ORDER_EVENT_ORDERED; //已付款
|
case "M" -> ORDER_EVENT_ORDERED; //已付款
|
||||||
case "U" -> ORDER_EVENT_REFUND; //申请出差失败
|
case "U" -> ORDER_EVENT_REFUND; //申请出票失败
|
||||||
case "J" -> ORDER_EVENT_CANCEL; //申请抢票失败
|
case "J" -> ORDER_EVENT_CANCEL; //申请抢票失败
|
||||||
case "C" -> ORDER_EVENT_CANCEL; //订单已取消
|
case "C" -> ORDER_EVENT_CANCEL; //订单已取消
|
||||||
case "F" -> ORDER_EVENT_ORDERED; //出票成功
|
case "F" -> ORDER_EVENT_ORDERED; //出票成功
|
||||||
|
@ -34,6 +34,7 @@ public class LYOrderUtil {
|
||||||
!"S".equals(status) &&
|
!"S".equals(status) &&
|
||||||
!"G".equals(status) &&
|
!"G".equals(status) &&
|
||||||
!"H".equals(status) &&
|
!"H".equals(status) &&
|
||||||
|
!"U".equals(status) &&
|
||||||
!"B".equals(status) &&
|
!"B".equals(status) &&
|
||||||
!"A".equals(status) &&
|
!"A".equals(status) &&
|
||||||
!"O".equals(status) &&
|
!"O".equals(status) &&
|
||||||
|
|
|
@ -824,7 +824,7 @@ public class LYTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void searchTrain() {
|
void searchTrain() {
|
||||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24050872686468359");
|
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24050872678451149");
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
String json = gson.toJson(trainOrderDetail);
|
String json = gson.toJson(trainOrderDetail);
|
||||||
System.out.println(json);
|
System.out.println(json);
|
||||||
|
|
Loading…
Reference in New Issue