feat:消费明细接口增加订单号参数

This commit is contained in:
lulz1 2024-05-15 10:01:16 +08:00
parent f645cebd44
commit d27131fc36
8 changed files with 60 additions and 19 deletions

View File

@ -6,7 +6,7 @@ import lombok.Data;
@Data
public class AuthenticationSignDto extends BaseQuery {
// private String orderNo; //订单号
private String orderNo; //订单号
private Integer productType; //机票1 酒店2火车3打车4
private String systemType;
private String startTime;

View File

@ -142,6 +142,7 @@ public class OrderDetailController {
}
private boolean signCheck(AuthenticationSignDto authenticationDto) {
String orderNo = authenticationDto.getOrderNo();
Integer productType = authenticationDto.getProductType();
String systemType = authenticationDto.getSystemType();
String startTime = authenticationDto.getStartTime();
@ -149,7 +150,13 @@ public class OrderDetailController {
Integer pageSize = authenticationDto.getPageSize();
Integer pageNum = authenticationDto.getPageNum();
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);
}

View File

@ -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.SUCCESS;
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;
@Component
@ -132,7 +133,6 @@ public class OrderDetailQuery {
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
});
// systemDomainService.generateRecordClerk(orderFlightRecordList);
return orderFlightRecordList;
}
@ -144,7 +144,6 @@ public class OrderDetailQuery {
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
});
// systemDomainService.generateRecordClerk(orderHotelRecordList);
return orderHotelRecordList;
}
@ -155,7 +154,6 @@ public class OrderDetailQuery {
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
});
// systemDomainService.generateRecordClerk(orderTrainRecordList);
return orderTrainRecordList;
}
@ -166,7 +164,6 @@ public class OrderDetailQuery {
.ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName()));
record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum()));
});
// systemDomainService.generateRecordClerk(orderCarRecordList);
return orderCarRecordList;
}
@ -192,15 +189,25 @@ public class OrderDetailQuery {
}
private List<OrderDetail> queryOrderDetail(AuthenticationSignDto authenticationDto) {
Integer legType = translateProductTypeToLegType(
authenticationDto.getProductType()
);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), 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) {
List<OrderDetail> orderDetailList = queryOrderDetail(authenticationDto).stream().filter(Objects::nonNull).toList();
Integer productType = authenticationDto.getProductType();
return OrderDetailWriter.exportReport(
switch (productType) {
@ -363,4 +370,13 @@ public class OrderDetailQuery {
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;
};
}
}

View File

@ -2,7 +2,6 @@ package com.chint.domain.repository;
import com.chint.application.dtos.OrderDetailQueryParam;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.RouteOrder;
import org.springframework.data.domain.Page;
import java.time.LocalDateTime;
@ -12,6 +11,7 @@ import java.util.Optional;
public interface OrderDetailRepository {
Page<OrderDetail> pageQuery(OrderDetailQueryParam orderDetailQueryParam);
OrderDetail findById(Long orderDetailId);
List<OrderDetail> findByLegId(Long legId);
@ -23,4 +23,9 @@ public interface OrderDetailRepository {
void deleteById(Long id);
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);
}

View File

@ -22,7 +22,7 @@ import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
@Repository
public class OrderDetailRepositoryImpl implements OrderDetailRepository {
@Autowired
private JdbcOrderDetailRepository orderDetailRepository;
private JdbcOrderDetailRepository jdbcOrderDetailRepository;
@Autowired
private RouteCacheService routeCacheService;
@ -32,22 +32,22 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
PageRequest pageRequest = PageRequest
.of(orderDetailQueryParam.getPageNum() - 1, orderDetailQueryParam.getPageSize(), Sort.by("updateTime"));
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo();
return orderDetailRepository.findByEmployeeNo(employeeNo, pageRequest);
return jdbcOrderDetailRepository.findByEmployeeNo(employeeNo, pageRequest);
}
@Override
public OrderDetail findById(Long orderDetailId) {
return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND));
return jdbcOrderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND));
}
@Override
public List<OrderDetail> findByLegId(Long legId) {
return orderDetailRepository.findByLegId(legId);
return jdbcOrderDetailRepository.findByLegId(legId);
}
@Override
public Optional<OrderDetail> findByOrderNo(String orderNo) {
return Optional.ofNullable(orderDetailRepository.findByOrderNo(orderNo));
return Optional.ofNullable(jdbcOrderDetailRepository.findByOrderNo(orderNo));
}
@Override
@ -55,7 +55,7 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
if (orderDetail.getRouteId() != null) {
routeCacheService.invalidateRouteCache(orderDetail.getRouteId());
}
OrderDetail detail = orderDetailRepository.save(orderDetail);
OrderDetail detail = jdbcOrderDetailRepository.save(orderDetail);
if (detail.getRouteId() != null) {
routeCacheService.invalidateRouteCache(orderDetail.getRouteId());
}
@ -64,12 +64,22 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
@Override
public void deleteById(Long id) {
orderDetailRepository.deleteById(id);
jdbcOrderDetailRepository.deleteById(id);
}
@Override
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);
}
}

View File

@ -22,5 +22,7 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
Page<OrderDetail> findByEmployeeNo(String employeeNo, Pageable pageable);
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);
}

View File

@ -16,7 +16,7 @@ public class LYOrderUtil {
case "E" -> ORDER_EVENT_ORDERED; //已申请出票
case "K" -> ORDER_EVENT_PREPARE; //抢票中
case "M" -> ORDER_EVENT_ORDERED; //已付款
case "U" -> ORDER_EVENT_REFUND; //申请出失败
case "U" -> ORDER_EVENT_REFUND; //申请出失败
case "J" -> ORDER_EVENT_CANCEL; //申请抢票失败
case "C" -> ORDER_EVENT_CANCEL; //订单已取消
case "F" -> ORDER_EVENT_ORDERED; //出票成功
@ -34,6 +34,7 @@ public class LYOrderUtil {
!"S".equals(status) &&
!"G".equals(status) &&
!"H".equals(status) &&
!"U".equals(status) &&
!"B".equals(status) &&
!"A".equals(status) &&
!"O".equals(status) &&

View File

@ -824,7 +824,7 @@ public class LYTest {
@Test
void searchTrain() {
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24050872686468359");
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24050872678451149");
Gson gson = new Gson();
String json = gson.toJson(trainOrderDetail);
System.out.println(json);