Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
79839f5457
|
@ -13,7 +13,9 @@ public class OrderRecordGenerateCommand extends Command {
|
||||||
private LocalDateTime startTime = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.MIDNIGHT);
|
private LocalDateTime startTime = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.MIDNIGHT);
|
||||||
private LocalDateTime endTime = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.MAX);
|
private LocalDateTime endTime = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.MAX);
|
||||||
private String date;
|
private String date;
|
||||||
|
private String oneDate;
|
||||||
private String supplierName;
|
private String supplierName;
|
||||||
|
private Integer productType;
|
||||||
|
|
||||||
public OrderRecordGenerateCommand startTime(LocalDateTime startTime) {
|
public OrderRecordGenerateCommand startTime(LocalDateTime startTime) {
|
||||||
this.setStartTime(startTime);
|
this.setStartTime(startTime);
|
||||||
|
|
|
@ -6,4 +6,5 @@ import lombok.Data;
|
||||||
public class RecordMonthSaveDTO {
|
public class RecordMonthSaveDTO {
|
||||||
private String date;
|
private String date;
|
||||||
private String supplierName;
|
private String supplierName;
|
||||||
|
private Integer productType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.chint.application.dtos.system;
|
package com.chint.application.dtos.system;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
public class SupplierRedirectDTO {
|
public class SupplierRedirectDTO {
|
||||||
private String redirectUrl;
|
private String redirectUrl;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ import com.chint.application.dtos.RecordMonthSaveDTO;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.factoriy.order_record.LyStatementOrder;
|
import com.chint.domain.factoriy.order_record.LyStatementOrder;
|
||||||
import com.chint.domain.service.OrderRecordDomainService;
|
import com.chint.domain.service.OrderRecordDomainService;
|
||||||
|
import com.chint.domain.service.order_record.OrderRecordPuller;
|
||||||
|
import com.chint.domain.service.supplier.SupplierAdapterSelector;
|
||||||
import com.chint.infrastructure.echo_framework.command.Command;
|
import com.chint.infrastructure.echo_framework.command.Command;
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
|
import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
|
||||||
import com.chint.infrastructure.util.DateTimeUtil;
|
import com.chint.infrastructure.util.DateTimeUtil;
|
||||||
|
@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||||
|
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||||
|
|
||||||
|
@ -49,6 +52,9 @@ public class AutoWorkController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderRecordDomainService orderRecordDomainService;
|
private OrderRecordDomainService orderRecordDomainService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SupplierAdapterSelector supplierAdapterSelector;
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("用户状态检查,离职用户将关闭开卡")
|
@ApiOperation("用户状态检查,离职用户将关闭开卡")
|
||||||
@PostMapping("/user/status/check")
|
@PostMapping("/user/status/check")
|
||||||
|
@ -89,12 +95,42 @@ public class AutoWorkController {
|
||||||
return Result.Success(SUCCESS);
|
return Result.Success(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("拉取按月份的流水")
|
||||||
|
@PostMapping("/record/pull/month/")
|
||||||
|
public Result<String> pullDataFromSupplier(@RequestBody RecordMonthSaveDTO param) {
|
||||||
|
String date = param.getDate();
|
||||||
|
OrderRecordPuller orderRecordPuller = supplierAdapterSelector
|
||||||
|
.of(param.getSupplierName(), OrderRecordPuller.class);
|
||||||
|
//将昨天的结算数据生成为财务共享需要的数据
|
||||||
|
OrderRecordGenerateCommand command = Command.of(OrderRecordGenerateCommand.class)
|
||||||
|
.startTime(DateTimeUtil.firstDayOfMonth(date))
|
||||||
|
.endTime(DateTimeUtil.endDayOfMonth(date))
|
||||||
|
.date(date)
|
||||||
|
.supplierName(param.getSupplierName());
|
||||||
|
if (param.getProductType().equals(LEG_TYPE_TRAIN)) {
|
||||||
|
orderRecordPuller.pullTrainOrderRecord(command);
|
||||||
|
}
|
||||||
|
if (param.getProductType().equals(LEG_TYPE_AIRPLANE)) {
|
||||||
|
orderRecordPuller.pullFlightOrderRecord(command);
|
||||||
|
}
|
||||||
|
if (param.getProductType().equals(LEG_TYPE_HOTEL)) {
|
||||||
|
orderRecordPuller.pullHotelOrderRecord(command);
|
||||||
|
}
|
||||||
|
if (param.getProductType().equals(LEG_TYPE_TAXI)) {
|
||||||
|
orderRecordPuller.pullCarOrderRecord(command);
|
||||||
|
}
|
||||||
|
return Result.Success(SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ApiOperation("根据月份生成结算记录")
|
@ApiOperation("根据月份生成结算记录")
|
||||||
@PostMapping("/record/save/month")
|
@PostMapping("/record/save/month")
|
||||||
public Result<String> autoSaveRecordByMonth(@RequestBody RecordMonthSaveDTO recordMonthSaveDTO) {
|
public Result<String> autoSaveRecordByMonth(@RequestBody RecordMonthSaveDTO recordMonthSaveDTO) {
|
||||||
String date = recordMonthSaveDTO.getDate();
|
String date = recordMonthSaveDTO.getDate();
|
||||||
|
if (date == null) {
|
||||||
|
date = DateTimeUtil.lastMonthStr();
|
||||||
|
}
|
||||||
//将昨天的结算数据生成为财务共享需要的数据
|
//将昨天的结算数据生成为财务共享需要的数据
|
||||||
Command.of(OrderRecordGenerateCommand.class)
|
Command.of(OrderRecordGenerateCommand.class)
|
||||||
.startTime(DateTimeUtil.firstDayOfMonth(date))
|
.startTime(DateTimeUtil.firstDayOfMonth(date))
|
||||||
|
@ -106,11 +142,11 @@ public class AutoWorkController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("自动拉取同程上个月的流水号")
|
@ApiOperation("自动拉取同程上个月的流水号")
|
||||||
@PostMapping("/ly/record/save")
|
@PostMapping("/ly/record/save")
|
||||||
public Result<String> autoSaveLYRecord() {
|
public Result<String> autoSaveLYRecord() {
|
||||||
//同步拉取上月数据
|
//同步拉取上月数据
|
||||||
|
lyStatementOrder.saveAll();
|
||||||
//将未转换的结算数据生成为财务共享需要的数据
|
//将未转换的结算数据生成为财务共享需要的数据
|
||||||
try {
|
try {
|
||||||
Command.of(LYOrderRecordGenerateCommand.class).sendToQueue();
|
Command.of(LYOrderRecordGenerateCommand.class).sendToQueue();
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package com.chint.application.out;
|
package com.chint.application.out;
|
||||||
|
|
||||||
import com.chint.application.commands.RefundOrderGenerateCommand;
|
|
||||||
import com.chint.application.dtos.*;
|
import com.chint.application.dtos.*;
|
||||||
import com.chint.application.dtos.mapper.RouteOrderMapper;
|
import com.chint.application.dtos.mapper.RouteOrderMapper;
|
||||||
import com.chint.application.dtos.response.OrderDetailRes;
|
import com.chint.application.dtos.response.OrderDetailRes;
|
||||||
import com.chint.application.queryies.OrderDetailQuery;
|
import com.chint.application.queryies.OrderDetailQuery;
|
||||||
import com.chint.domain.aggregates.order.*;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.domain.factoriy.order_detail.OrderExtensionCreator;
|
import com.chint.domain.factoriy.order_detail.OrderExtensionCreator;
|
||||||
import com.chint.domain.repository.ClientRepository;
|
import com.chint.domain.repository.ClientRepository;
|
||||||
|
@ -14,7 +13,6 @@ import com.chint.domain.repository.RouteRepository;
|
||||||
import com.chint.domain.repository.UserRepository;
|
import com.chint.domain.repository.UserRepository;
|
||||||
import com.chint.domain.service.auth.AuthenticateService;
|
import com.chint.domain.service.auth.AuthenticateService;
|
||||||
import com.chint.domain.value_object.RouteOrderDetail;
|
import com.chint.domain.value_object.RouteOrderDetail;
|
||||||
import com.chint.infrastructure.echo_framework.annotation.TransitionTo;
|
|
||||||
import com.chint.infrastructure.export.OrderDetailExportFactory;
|
import com.chint.infrastructure.export.OrderDetailExportFactory;
|
||||||
import com.chint.infrastructure.util.Digest;
|
import com.chint.infrastructure.util.Digest;
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
|
@ -41,15 +39,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.BPMConstant.H3_BPM;
|
import static com.chint.infrastructure.constant.BPMConstant.H3_BPM;
|
||||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/OrderDetail")
|
@RequestMapping("/OrderDetail")
|
||||||
|
@ -172,7 +165,7 @@ public class OrderDetailController {
|
||||||
Integer pageNum = authenticationDto.getPageNum();
|
Integer pageNum = authenticationDto.getPageNum();
|
||||||
String orgsign = authenticationDto.getSign();
|
String orgsign = authenticationDto.getSign();
|
||||||
String input;
|
String input;
|
||||||
if (systemType.equals("AN_FK") || systemType.equals("XN_FK")) {
|
if (systemType.equals("AN_FK")) {
|
||||||
input = productType + systemType + startTime + endTime + pageSize + pageNum;
|
input = productType + systemType + startTime + endTime + pageSize + pageNum;
|
||||||
} else {
|
} else {
|
||||||
input = orderNo + productType + systemType + startTime + endTime + pageSize + pageNum;
|
input = orderNo + productType + systemType + startTime + endTime + pageSize + pageNum;
|
||||||
|
@ -245,5 +238,4 @@ public class OrderDetailController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -24,8 +24,20 @@ public class SupplierProduct implements Serializable {
|
||||||
private String ifCanCancelRule;
|
private String ifCanCancelRule;
|
||||||
@MappedCollection(idColumn = "supplier_product_id", keyColumn = "supplier_product_key")
|
@MappedCollection(idColumn = "supplier_product_id", keyColumn = "supplier_product_key")
|
||||||
private List<SupplierProductStandardLevel> supplierProductStandardLevelList;
|
private List<SupplierProductStandardLevel> supplierProductStandardLevelList;
|
||||||
|
@MappedCollection(idColumn = "supplier_product_id", keyColumn = "supplier_product_key")
|
||||||
|
private List<SupplierProductSysCode> supplierProductSysCodeList;
|
||||||
|
@MappedCollection(idColumn = "supplier_product_id", keyColumn = "supplier_product_key")
|
||||||
|
private List<SupplierProductCompany> supplierProductCompanyList;
|
||||||
|
|
||||||
public boolean ifCanOrder() {
|
public boolean ifCanOrder() {
|
||||||
return ifCanOrder == 1;
|
return ifCanOrder == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkStandardLevelIfInUse(String standardLevel) {
|
||||||
|
return this.getSupplierProductStandardLevelList()
|
||||||
|
.stream()
|
||||||
|
.filter(SupplierProductStandardLevel::inUse)
|
||||||
|
.map(SupplierProductStandardLevel::getStandardLevelName)
|
||||||
|
.anyMatch(it -> it.equals(standardLevel));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.chint.domain.aggregates.supplier;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Table("supplier_product_company")
|
||||||
|
public class SupplierProductCompany implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 7176388412356123574L;
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
private Long supplierProductId;
|
||||||
|
private String companyCode;
|
||||||
|
private String companyName;
|
||||||
|
private Integer status;
|
||||||
|
private String extension;
|
||||||
|
public boolean inUse() {
|
||||||
|
return status == 1;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.chint.domain.aggregates.supplier;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Table("supplier_product_sys_code")
|
||||||
|
public class SupplierProductSysCode implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1987625985511322474L;
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
private Long supplierProductId;
|
||||||
|
private Long SystemCodeId;
|
||||||
|
private String systemCode;
|
||||||
|
private Integer status;
|
||||||
|
private String extension;
|
||||||
|
public boolean inUse() {
|
||||||
|
return status == 1;
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ import static com.chint.infrastructure.constant.BelongSystemConstant.TRAVAL_SYS_
|
||||||
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_CAR_STATUS_REFUND;
|
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_CAR_STATUS_REFUND;
|
||||||
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_CAR_STATUS_SUCCESS;
|
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_CAR_STATUS_SUCCESS;
|
||||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
|
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP_CN_NAME;
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP_CN_NAME;
|
||||||
import static com.chint.interfaces.rest.amap.util.AmapStatusUtil.mapFSSCOrderStatus;
|
import static com.chint.interfaces.rest.amap.util.AmapStatusUtil.mapFSSCOrderStatus;
|
||||||
|
|
||||||
|
@ -29,18 +30,9 @@ import static com.chint.interfaces.rest.amap.util.AmapStatusUtil.mapFSSCOrderSta
|
||||||
@Component
|
@Component
|
||||||
public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AmapOrderDetailRequest orderDetailRequest;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RouteRequestDomainService routeRequestDomainService;
|
private RouteRequestDomainService routeRequestDomainService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private OrderDetailRepository orderDetailRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RouteRepository routeRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserRepository userRepository;
|
private UserRepository userRepository;
|
||||||
|
|
||||||
|
@ -246,4 +238,9 @@ public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||||
public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) {
|
public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_AMAP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,29 +25,20 @@ import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||||
import static com.chint.infrastructure.constant.FSSCConstant.*;
|
import static com.chint.infrastructure.constant.FSSCConstant.*;
|
||||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
|
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
|
||||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
|
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||||
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private OrderDetailRepository orderDetailRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RouteRepository routeRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserRepository userRepository;
|
private UserRepository userRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private LocationRepository locationRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderDetailFactory orderDetailFactory;
|
private OrderDetailFactory orderDetailFactory;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RouteRequestRepository routeRequestRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RouteRequestDomainService routeRequestDomainService;
|
private RouteRequestDomainService routeRequestDomainService;
|
||||||
|
@ -581,4 +572,9 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||||
public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) {
|
public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_C_TRIP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,23 +28,13 @@ import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||||
import static com.chint.infrastructure.constant.FSSCConstant.*;
|
import static com.chint.infrastructure.constant.FSSCConstant.*;
|
||||||
import static com.chint.infrastructure.constant.LYConstant.L_Y_CAR_FEE_TYPE_CANCEL;
|
import static com.chint.infrastructure.constant.LYConstant.L_Y_CAR_FEE_TYPE_CANCEL;
|
||||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
|
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_CN_NAME;
|
import static com.chint.infrastructure.constant.SupplierNameConstant.*;
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_EXTENSION_NAME;
|
|
||||||
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||||
import static com.chint.infrastructure.util.DateTimeUtil.formatter;
|
import static com.chint.infrastructure.util.DateTimeUtil.formatter;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserRepository userRepository;
|
|
||||||
@Autowired
|
|
||||||
private EstimatePrice estimatePrice;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserHttpRequest userHttpRequest;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RouteRepository routeRepository;
|
private RouteRepository routeRepository;
|
||||||
|
|
||||||
|
@ -54,9 +44,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderDetailFactory orderDetailFactory;
|
private OrderDetailFactory orderDetailFactory;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RouteRequestRepository routeRequestRepository;
|
|
||||||
|
|
||||||
|
|
||||||
//用车消费明细
|
//用车消费明细
|
||||||
@Override
|
@Override
|
||||||
|
@ -575,4 +562,8 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_L_Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package com.chint.domain.factoriy.order_detail;
|
package com.chint.domain.factoriy.order_detail;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.*;
|
import com.chint.domain.aggregates.order.*;
|
||||||
|
import com.chint.domain.service.supplier.SupplierAdapter;
|
||||||
|
|
||||||
public interface OrderExtensionFactory {
|
public interface OrderExtensionFactory extends SupplierAdapter {
|
||||||
|
|
||||||
CarOrderDetail createCarOrderDetail(Object carOrderDetailData);
|
CarOrderDetail createCarOrderDetail(Object carOrderDetailData);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
||||||
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,4 +169,8 @@ public class AmapOrderRecordExtensionFactory implements OrderRecordExtensionFact
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_AMAP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
|
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||||
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -1342,4 +1343,9 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
||||||
userName,
|
userName,
|
||||||
userCode);
|
userCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_C_TRIP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.util.function.Consumer;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
|
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
|
||||||
import static com.chint.infrastructure.constant.OrderRecordConstant.*;
|
import static com.chint.infrastructure.constant.OrderRecordConstant.*;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同程数据转换
|
* 同程数据转换
|
||||||
|
@ -870,4 +871,9 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
default -> "1";
|
default -> "1";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_L_Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,6 +266,5 @@ public class LyStatementOrder {
|
||||||
lyOrderCarRecords.forEach(lyOrderCarRecord -> {
|
lyOrderCarRecords.forEach(lyOrderCarRecord -> {
|
||||||
lySearchRequest.getCarDetailResponse(lyOrderCarRecord.getOrderSerialNo());
|
lySearchRequest.getCarDetailResponse(lyOrderCarRecord.getOrderSerialNo());
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,11 @@ import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
|
||||||
|
import com.chint.domain.service.supplier.SupplierAdapter;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface OrderRecordExtensionFactory {
|
public interface OrderRecordExtensionFactory extends SupplierAdapter {
|
||||||
|
|
||||||
|
|
||||||
OrderCarRecord createCarOrderRecord(Object orderCarRecordData);
|
OrderCarRecord createCarOrderRecord(Object orderCarRecordData);
|
||||||
|
|
|
@ -9,7 +9,9 @@ import com.chint.domain.repository.LegRepository;
|
||||||
import com.chint.domain.repository.RouteRepository;
|
import com.chint.domain.repository.RouteRepository;
|
||||||
import com.chint.domain.repository.RouteRequestRepository;
|
import com.chint.domain.repository.RouteRequestRepository;
|
||||||
import com.chint.domain.repository.SupplierRepository;
|
import com.chint.domain.repository.SupplierRepository;
|
||||||
|
import com.chint.domain.service.order_sync.SupplierOrderSync;
|
||||||
import com.chint.domain.service.order_sync.SyncAdapter;
|
import com.chint.domain.service.order_sync.SyncAdapter;
|
||||||
|
import com.chint.domain.service.supplier.SupplierAdapterSelector;
|
||||||
import com.chint.domain.value_object.SyncLegData;
|
import com.chint.domain.value_object.SyncLegData;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -52,6 +54,9 @@ public class RouteRequestDomainService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SupplierDomainService supplierDomainService;
|
private SupplierDomainService supplierDomainService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SupplierAdapterSelector supplierAdapterSelector;
|
||||||
|
|
||||||
|
|
||||||
// //这里增加一个判断 ,如果这个订单的行程为空,那么就返回给用户提示
|
// //这里增加一个判断 ,如果这个订单的行程为空,那么就返回给用户提示
|
||||||
// if (legItems == null || legItems.isEmpty()) {
|
// if (legItems == null || legItems.isEmpty()) {
|
||||||
|
@ -98,7 +103,7 @@ public class RouteRequestDomainService {
|
||||||
|
|
||||||
legs.forEach(it -> it.addEvent(legEventFactory.creatLegEvent(LEG_EVENT_NOT_ORDERED)));
|
legs.forEach(it -> it.addEvent(legEventFactory.creatLegEvent(LEG_EVENT_NOT_ORDERED)));
|
||||||
//这里执行同步
|
//这里执行同步
|
||||||
if (syncAdapter.of(syncLegData.getSupplierName()).syncRouteRequest(routeRequest)) {
|
if (supplierAdapterSelector.of(syncLegData.getSupplierName(), SupplierOrderSync.class).syncRouteRequest(routeRequest)) {
|
||||||
routeRequest.addEvent(RouteRequestEvent.sync(syncLegData.getSupplierName()));
|
routeRequest.addEvent(RouteRequestEvent.sync(syncLegData.getSupplierName()));
|
||||||
//通过保存聚合根来保存差旅申请单
|
//通过保存聚合根来保存差旅申请单
|
||||||
routeRepository.save(routeOrder);
|
routeRepository.save(routeOrder);
|
||||||
|
@ -144,21 +149,21 @@ public class RouteRequestDomainService {
|
||||||
List<Leg> orderedLegs = collect.get(false);
|
List<Leg> orderedLegs = collect.get(false);
|
||||||
if (!orderedLegs.isEmpty()) {
|
if (!orderedLegs.isEmpty()) {
|
||||||
it.reloadGenerateRequestLegs(orderedLegs);
|
it.reloadGenerateRequestLegs(orderedLegs);
|
||||||
syncAdapter.of(it.getSupplier()).syncRouteRequest(it);
|
supplierAdapterSelector.of(it.getSupplier(), SupplierOrderSync.class).syncRouteRequest(it);
|
||||||
it.addEvent(RouteRequestEvent.sync(it.getSupplier()));
|
it.addEvent(RouteRequestEvent.sync(it.getSupplier()));
|
||||||
List<Leg> notOrderLegs = collect.get(true);
|
List<Leg> notOrderLegs = collect.get(true);
|
||||||
notOrderLegs.forEach(leg -> leg.addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)));
|
notOrderLegs.forEach(leg -> leg.addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)));
|
||||||
} else {
|
} else {
|
||||||
it.addEvent(RouteRequestEvent.cancel(it.getSupplier()));
|
it.addEvent(RouteRequestEvent.cancel(it.getSupplier()));
|
||||||
getLegInfoFromRouteOrder(it, routeOrder);
|
getLegInfoFromRouteOrder(it, routeOrder);
|
||||||
syncAdapter.of(it.getSupplier()).cancelRouteRequest(it);
|
supplierAdapterSelector.of(it.getSupplier(), SupplierOrderSync.class).syncRouteRequest(it);
|
||||||
it.getRouteRequestLegList()
|
it.getRouteRequestLegList()
|
||||||
.forEach(requestLeg -> requestLeg.getLeg().addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)));
|
.forEach(requestLeg -> requestLeg.getLeg().addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
it.addEvent(RouteRequestEvent.cancel(it.getSupplier()));
|
it.addEvent(RouteRequestEvent.cancel(it.getSupplier()));
|
||||||
getLegInfoFromRouteOrder(it, routeOrder);
|
getLegInfoFromRouteOrder(it, routeOrder);
|
||||||
syncAdapter.of(it.getSupplier()).cancelRouteRequest(it);
|
supplierAdapterSelector.of(it.getSupplier(), SupplierOrderSync.class).syncRouteRequest(it);
|
||||||
it.getRouteRequestLegList()
|
it.getRouteRequestLegList()
|
||||||
.forEach(requestLeg -> requestLeg.getLeg().addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)));
|
.forEach(requestLeg -> requestLeg.getLeg().addEvent(legEventFactory.creatLegEvent(LEG_EVENT_APPROVAL)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,4 +75,9 @@ public class AmapOrderRecordDomainService implements OrderRecordDomainService{
|
||||||
.toList();
|
.toList();
|
||||||
return orderDetailDomainService.saveCarOrderRecordBatch(orderCarRecordList);
|
return orderDetailDomainService.saveCarOrderRecordBatch(orderCarRecordList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_AMAP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.chint.domain.service.order_record;
|
||||||
|
|
||||||
|
import com.chint.application.commands.OrderRecordGenerateCommand;
|
||||||
|
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarOrderRecord;
|
||||||
|
import com.chint.domain.repository.AmapCarOrderRecordRepository;
|
||||||
|
import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse;
|
||||||
|
import com.chint.interfaces.rest.amap.request.AmapSettleBillRequest;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class AmapOrderRecordPuller implements OrderRecordPuller{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmapSettleBillRequest amapSettleBillRequest;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmapCarOrderRecordRepository amapCarOrderRecordRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullTrainOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullFlightOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullHotelOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullCarOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
try {
|
||||||
|
List<FinishedOrderResponse.ListElement> listElements = amapSettleBillRequest.amapRecordByMonth(command.getDate());
|
||||||
|
List<AmapCarOrderRecord> list = listElements.stream().map(AmapCarOrderRecord::of).toList();
|
||||||
|
amapCarOrderRecordRepository.saveAll(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_AMAP;
|
||||||
|
}
|
||||||
|
}
|
|
@ -111,4 +111,9 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService {
|
||||||
.toList();
|
.toList();
|
||||||
return orderDetailDomainService.saveCarOrderRecordBatch(orderCarRecordList);
|
return orderDetailDomainService.saveCarOrderRecordBatch(orderCarRecordList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_C_TRIP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.chint.domain.service.order_record;
|
||||||
|
|
||||||
|
import com.chint.application.commands.OrderRecordGenerateCommand;
|
||||||
|
import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class CTripOrderRecordPuller implements OrderRecordPuller {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CTripOrderRecordAutoSave cTripOrderRecordAutoSave;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullTrainOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
try {
|
||||||
|
cTripOrderRecordAutoSave.cTripCarRecordAutoSave(Optional.ofNullable(command.getDate()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullFlightOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
try {
|
||||||
|
cTripOrderRecordAutoSave.cTripFlightRecordAutoSave(Optional.ofNullable(command.getDate()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullHotelOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
try {
|
||||||
|
cTripOrderRecordAutoSave.cTripHotelRecordAutoSave(Optional.ofNullable(command.getDate()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullCarOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
try {
|
||||||
|
cTripOrderRecordAutoSave.cTripCarRecordAutoSave(Optional.ofNullable(command.getDate()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_C_TRIP;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,233 @@
|
||||||
|
package com.chint.domain.service.order_record;
|
||||||
|
|
||||||
|
import com.chint.application.commands.OrderRecordGenerateCommand;
|
||||||
|
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord;
|
||||||
|
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord;
|
||||||
|
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderHotelRecord;
|
||||||
|
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTrainRecord;
|
||||||
|
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderCarRecord;
|
||||||
|
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderFlightRecord;
|
||||||
|
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderHotelRecord;
|
||||||
|
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderTrainRecord;
|
||||||
|
import com.chint.infrastructure.util.BeanCopyUtils;
|
||||||
|
import com.chint.infrastructure.util.DateTimeUtil;
|
||||||
|
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||||
|
import com.chint.interfaces.rest.ly.reconciliation.dto.BaseDetailParam;
|
||||||
|
import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.CarStatement;
|
||||||
|
import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.FlightStatement;
|
||||||
|
import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.HotelStatement;
|
||||||
|
import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.TrainStatement;
|
||||||
|
import com.chint.interfaces.rest.ly.reconciliation.dto.statementList.ResStatementList;
|
||||||
|
import com.chint.interfaces.rest.ly.reconciliation.dto.statementList.StatementList;
|
||||||
|
import com.chint.interfaces.rest.ly.reconciliation.dto.statementList.StatementPageList;
|
||||||
|
import com.chint.interfaces.rest.ly.reconciliation.request.ReqStatement;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.chint.application.services.login.LoginStrategy.log;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class LYOrderRecordPuller implements OrderRecordPuller {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReqStatement reqStatement;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JdbcLyOrderFlightRecord jdbcLyOrderFlightRecord;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JdbcLyOrderHotelRecord jdbcLyOrderHotelRecord;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JdbcLyOrderTrainRecord jdbcLyOrderTrainRecord;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JdbcLyOrderCarRecord jdbcLyOrderCarRecord;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LYSearchRequest lySearchRequest;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullTrainOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
String date = command.getDate();
|
||||||
|
String startOfDay = DateTimeUtil.timeToStrCommon(DateTimeUtil.startOfDay(date));
|
||||||
|
String endOfDay = DateTimeUtil.timeToStrCommon(DateTimeUtil.endOfDay(date));
|
||||||
|
List<ResStatementList.OnlineStatementList> onlineStatementLists = statementOrder(startOfDay, endOfDay);
|
||||||
|
List<LyOrderTrainRecord> res = new ArrayList<>();
|
||||||
|
List<String> orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(startOfDay, endOfDay);
|
||||||
|
for (ResStatementList.OnlineStatementList onlineStatementList : onlineStatementLists) {
|
||||||
|
String statementCode = onlineStatementList.getStatementCode();
|
||||||
|
res.addAll(trainStatement(statementCode, orderSerialNoList));
|
||||||
|
}
|
||||||
|
jdbcLyOrderTrainRecord.saveAll(res);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullFlightOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
String date = command.getDate();
|
||||||
|
String startOfDay = DateTimeUtil.timeToStrCommon(DateTimeUtil.startOfDay(date));
|
||||||
|
String endOfDay = DateTimeUtil.timeToStrCommon(DateTimeUtil.endOfDay(date));
|
||||||
|
List<ResStatementList.OnlineStatementList> onlineStatementLists = statementOrder(startOfDay, endOfDay);
|
||||||
|
List<String> orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(startOfDay, endOfDay);
|
||||||
|
List<LyOrderFlightRecord> res = new ArrayList<>();
|
||||||
|
for (ResStatementList.OnlineStatementList onlineStatementList : onlineStatementLists) {
|
||||||
|
String statementCode = onlineStatementList.getStatementCode();
|
||||||
|
res.addAll(flightStatement(statementCode, orderSerialNoList));
|
||||||
|
}
|
||||||
|
jdbcLyOrderFlightRecord.saveAll(res);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullHotelOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
String date = command.getDate();
|
||||||
|
String startOfDay = DateTimeUtil.timeToStrCommon(DateTimeUtil.startOfDay(date));
|
||||||
|
String endOfDay = DateTimeUtil.timeToStrCommon(DateTimeUtil.endOfDay(date));
|
||||||
|
List<ResStatementList.OnlineStatementList> onlineStatementLists = statementOrder(startOfDay, endOfDay);
|
||||||
|
List<String> orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(startOfDay, endOfDay);
|
||||||
|
List<LyOrderHotelRecord> res = new ArrayList<>();
|
||||||
|
for (ResStatementList.OnlineStatementList onlineStatementList : onlineStatementLists) {
|
||||||
|
String statementCode = onlineStatementList.getStatementCode();
|
||||||
|
res.addAll(hotelStatement(statementCode, orderSerialNoList));
|
||||||
|
}
|
||||||
|
jdbcLyOrderHotelRecord.saveAll(res);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean pullCarOrderRecord(OrderRecordGenerateCommand command) {
|
||||||
|
String date = command.getDate();
|
||||||
|
String startOfDay = DateTimeUtil.timeToStrCommon(DateTimeUtil.startOfDay(date));
|
||||||
|
String endOfDay = DateTimeUtil.timeToStrCommon(DateTimeUtil.endOfDay(date));
|
||||||
|
List<ResStatementList.OnlineStatementList> onlineStatementLists = statementOrder(startOfDay, endOfDay);
|
||||||
|
List<String> orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(startOfDay, endOfDay);
|
||||||
|
List<LyOrderCarRecord> res = new ArrayList<>();
|
||||||
|
for (ResStatementList.OnlineStatementList onlineStatementList : onlineStatementLists) {
|
||||||
|
String statementCode = onlineStatementList.getStatementCode();
|
||||||
|
res.addAll(carStatement(statementCode, orderSerialNoList));
|
||||||
|
}
|
||||||
|
jdbcLyOrderCarRecord.saveAll(res);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<ResStatementList.OnlineStatementList> statementOrder(String beginDate, String endDate) {
|
||||||
|
StatementPageList param = new StatementPageList();
|
||||||
|
param.setPageIndex(1)
|
||||||
|
.setPageSize(10)
|
||||||
|
.setBeginDate(beginDate)//2024-03-01 00:00:00
|
||||||
|
.setEndDate(endDate);
|
||||||
|
StatementList statementList = new StatementList(param);
|
||||||
|
ResStatementList resStatementList = reqStatement.queryStatementList(statementList);
|
||||||
|
log.info("resStatementList: {}", resStatementList);
|
||||||
|
return resStatementList.getData().getOnlineStatementList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 飞机账单同步
|
||||||
|
*/
|
||||||
|
public List<LyOrderFlightRecord> flightStatement(String statementCode, List<String> orderSerialNoList) {
|
||||||
|
List<LyOrderFlightRecord> res = new ArrayList<>();
|
||||||
|
int flightCount = 0;//初始化变量
|
||||||
|
int flightPageCount;//飞机总分页数
|
||||||
|
do {
|
||||||
|
//至少查询一次
|
||||||
|
BaseDetailParam baseDetailParam = BaseDetailParam.of(1 + flightCount, 100, statementCode);
|
||||||
|
FlightStatement flightStatement = reqStatement.queryFlightStatement(baseDetailParam);
|
||||||
|
flightPageCount = flightStatement.getData().getPageInfo().getPageCount();//总页数
|
||||||
|
//保存数据
|
||||||
|
List<FlightStatement.StatementOrderList> statementOrderList = flightStatement.getData().getStatementOrderList();
|
||||||
|
//过滤出已经保存的数据
|
||||||
|
List<FlightStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
|
||||||
|
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||||
|
).toList();
|
||||||
|
res.addAll(BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderFlightRecord.class));
|
||||||
|
flightCount++;
|
||||||
|
} while (flightCount < flightPageCount);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 酒店账单同步
|
||||||
|
*/
|
||||||
|
public List<LyOrderHotelRecord> hotelStatement(String statementCode, List<String> orderSerialNoList) {
|
||||||
|
List<LyOrderHotelRecord> res = new ArrayList<>();
|
||||||
|
int hotelCount = 0;//初始化变量
|
||||||
|
int hotelPageCount;//酒店总分页数
|
||||||
|
do {
|
||||||
|
BaseDetailParam baseDetailParam = BaseDetailParam.of(1 + hotelCount, 100, statementCode);
|
||||||
|
HotelStatement hotelStatement = reqStatement.queryHotelStatement(baseDetailParam);
|
||||||
|
hotelPageCount = hotelStatement.getData().getPageInfo().getPageCount();//总页数
|
||||||
|
//保存数据
|
||||||
|
List<HotelStatement.StatementOrderList> statementOrderList = hotelStatement.getData().getStatementOrderList();
|
||||||
|
//过滤出已经保存的数据
|
||||||
|
List<HotelStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
|
||||||
|
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||||
|
).toList();
|
||||||
|
res.addAll(BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderHotelRecord.class));
|
||||||
|
hotelCount++;
|
||||||
|
} while (hotelCount < hotelPageCount);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 火车账单同步
|
||||||
|
*/
|
||||||
|
public List<LyOrderTrainRecord> trainStatement(String statementCode, List<String> orderSerialNoList) {
|
||||||
|
List<LyOrderTrainRecord> res = new ArrayList<>();
|
||||||
|
int trainCount = 0;//初始化变量
|
||||||
|
int trainPageCount;//酒店总分页数
|
||||||
|
do {
|
||||||
|
BaseDetailParam baseDetailParam = BaseDetailParam.of(1 + trainCount, 100, statementCode);
|
||||||
|
TrainStatement trainStatement = reqStatement.queryTrainStatement(baseDetailParam);
|
||||||
|
trainPageCount = trainStatement.getData().getPageInfo().getPageCount();//总页数
|
||||||
|
//保存数据
|
||||||
|
List<TrainStatement.StatementOrderList> statementOrderList = trainStatement.getData().getStatementOrderList();
|
||||||
|
//过滤出已经保存的数据
|
||||||
|
List<TrainStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
|
||||||
|
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||||
|
).toList();
|
||||||
|
res.addAll(BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderTrainRecord.class));
|
||||||
|
//保存结算明细数据
|
||||||
|
trainCount++;
|
||||||
|
} while (trainCount < trainPageCount);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用车账单同步
|
||||||
|
*/
|
||||||
|
public List<LyOrderCarRecord> carStatement(String statementCode, List<String> orderSerialNoList) {
|
||||||
|
List<LyOrderCarRecord> res = new ArrayList<>();
|
||||||
|
int carCount = 0;//初始化变量
|
||||||
|
int carPageCount;//酒店总分页数
|
||||||
|
do {
|
||||||
|
BaseDetailParam baseDetailParam = BaseDetailParam.of(1 + carCount, 100, statementCode);
|
||||||
|
CarStatement carStatement = reqStatement.queryCarStatement(baseDetailParam);
|
||||||
|
carPageCount = carStatement.getData().getPageInfo().getPageCount();//总页数
|
||||||
|
//保存数据
|
||||||
|
List<CarStatement.StatementOrderList> statementOrderList = carStatement.getData().getStatementOrderList();
|
||||||
|
//过滤出已经保存的数据
|
||||||
|
List<CarStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
|
||||||
|
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||||
|
).toList();
|
||||||
|
res.addAll(BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderCarRecord.class));
|
||||||
|
carCount++;
|
||||||
|
} while (carCount < carPageCount);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_L_Y;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,10 +5,11 @@ import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
|
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
|
||||||
|
import com.chint.domain.service.supplier.SupplierAdapter;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface OrderRecordDomainService {
|
public interface OrderRecordDomainService extends SupplierAdapter {
|
||||||
List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command);
|
List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command);
|
||||||
List<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command);
|
List<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command);
|
||||||
List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command);
|
List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command);
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.chint.domain.service.order_record;
|
||||||
|
|
||||||
|
import com.chint.application.commands.OrderRecordGenerateCommand;
|
||||||
|
import com.chint.domain.service.supplier.SupplierAdapter;
|
||||||
|
|
||||||
|
public interface OrderRecordPuller extends SupplierAdapter {
|
||||||
|
|
||||||
|
boolean pullTrainOrderRecord(OrderRecordGenerateCommand command);
|
||||||
|
|
||||||
|
boolean pullFlightOrderRecord(OrderRecordGenerateCommand command);
|
||||||
|
|
||||||
|
boolean pullHotelOrderRecord(OrderRecordGenerateCommand command);
|
||||||
|
|
||||||
|
boolean pullCarOrderRecord(OrderRecordGenerateCommand command);
|
||||||
|
|
||||||
|
}
|
|
@ -1,9 +1,6 @@
|
||||||
package com.chint.domain.service.order_search;
|
package com.chint.domain.service.order_search;
|
||||||
|
|
||||||
import com.chint.domain.exceptions.NotFoundException;
|
import com.chint.domain.exceptions.NotFoundException;
|
||||||
import com.chint.domain.service.supplier.CTripOrderDataAdapter;
|
|
||||||
import com.chint.domain.service.supplier.LYOrderDataAdapter;
|
|
||||||
import com.chint.domain.service.supplier.OrderDataAdapter;
|
|
||||||
import com.chint.infrastructure.constant.CommonMessageConstant;
|
import com.chint.infrastructure.constant.CommonMessageConstant;
|
||||||
import com.chint.infrastructure.constant.SupplierNameConstant;
|
import com.chint.infrastructure.constant.SupplierNameConstant;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
@ -7,7 +7,10 @@ import com.chint.domain.aggregates.supplier.SupplierProductStandardLevel;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.domain.exceptions.AuthException;
|
import com.chint.domain.exceptions.AuthException;
|
||||||
import com.chint.domain.exceptions.CommandException;
|
import com.chint.domain.exceptions.CommandException;
|
||||||
import com.chint.domain.repository.*;
|
import com.chint.domain.repository.AmapPolicyRepository;
|
||||||
|
import com.chint.domain.repository.AmapRouteRelationshipRepository;
|
||||||
|
import com.chint.domain.repository.SupplierRepository;
|
||||||
|
import com.chint.domain.repository.UserRepository;
|
||||||
import com.chint.domain.service.LegDomainService;
|
import com.chint.domain.service.LegDomainService;
|
||||||
import com.chint.infrastructure.util.DateTimeUtil;
|
import com.chint.infrastructure.util.DateTimeUtil;
|
||||||
import com.chint.interfaces.rest.amap.AmapLocationRequest;
|
import com.chint.interfaces.rest.amap.AmapLocationRequest;
|
||||||
|
@ -141,7 +144,7 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
|
||||||
}
|
}
|
||||||
List<String> areaCodes = new ArrayList<>();
|
List<String> areaCodes = new ArrayList<>();
|
||||||
for (Location location : locationList) {
|
for (Location location : locationList) {
|
||||||
if(location.getLocationType() != LOCATION_TYPE_CITY){
|
if (location.getLocationType() != LOCATION_TYPE_CITY) {
|
||||||
//如果类型不是地级市,那么就从地区路径获取地级市信息
|
//如果类型不是地级市,那么就从地区路径获取地级市信息
|
||||||
String[] split = location.getLocationPathName().split("_");
|
String[] split = location.getLocationPathName().split("_");
|
||||||
areaCodes.add(amapLocationRequest.getACodeByLocationName(split[3]));
|
areaCodes.add(amapLocationRequest.getACodeByLocationName(split[3]));
|
||||||
|
@ -155,7 +158,6 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
|
||||||
dto.setStatus("1");
|
dto.setStatus("1");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Optional<Supplier> supplier = supplierRepository.findBySupplierName(SUPPLIER_AMAP);
|
Optional<Supplier> supplier = supplierRepository.findBySupplierName(SUPPLIER_AMAP);
|
||||||
supplier.flatMap(Supplier::carSupplierProduct).ifPresent(carSupplierProduct -> {
|
supplier.flatMap(Supplier::carSupplierProduct).ifPresent(carSupplierProduct -> {
|
||||||
if (carSupplierProduct.getSupplierProductStandardLevelList()
|
if (carSupplierProduct.getSupplierProductStandardLevelList()
|
||||||
|
@ -166,9 +168,14 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
|
||||||
amapPolicyRepository.findByStandardLevel(routeRequestFields.getStandardLevel())
|
amapPolicyRepository.findByStandardLevel(routeRequestFields.getStandardLevel())
|
||||||
.ifPresent(policy -> dto.setRegulationId(policy.getAmapPolicyCode()));
|
.ifPresent(policy -> dto.setRegulationId(policy.getAmapPolicyCode()));
|
||||||
} else {
|
} else {
|
||||||
throw new AuthException("你目前的差标不支持使用高德打车");
|
throw new AuthException("你目前的公司暂不支持使用高德打车");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (routeRequestFields.getAccountCompanyName().equals("浙江正泰物联技术有限公司") ||
|
||||||
|
routeRequestFields.getAccountCompanyName().equals("浙江正泰仪器仪表有限责任公司")) {
|
||||||
|
throw new AuthException("你目前的公司暂不支持使用高德打车");
|
||||||
|
}
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,4 +202,9 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
|
||||||
}
|
}
|
||||||
return code.equals(1);
|
return code.equals(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_AMAP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import java.util.stream.Collectors;
|
||||||
import static com.chint.infrastructure.constant.LegConstant.*;
|
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY;
|
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY;
|
||||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_DISTRICT;
|
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_DISTRICT;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
@ -250,4 +251,9 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
||||||
}
|
}
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_C_TRIP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||||
import static com.chint.infrastructure.constant.LYConstant.L_Y_ORDER_PATH;
|
import static com.chint.infrastructure.constant.LYConstant.L_Y_ORDER_PATH;
|
||||||
import static com.chint.infrastructure.constant.LegConstant.*;
|
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||||
import static com.chint.infrastructure.constant.LocationConstant.*;
|
import static com.chint.infrastructure.constant.LocationConstant.*;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
@ -373,4 +374,9 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
||||||
Set<String> set = new LinkedHashSet<>(Arrays.asList(array));
|
Set<String> set = new LinkedHashSet<>(Arrays.asList(array));
|
||||||
return String.join(",", set);
|
return String.join(",", set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_L_Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
package com.chint.domain.service.order_sync;
|
package com.chint.domain.service.order_sync;
|
||||||
|
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.*;
|
||||||
import com.chint.domain.aggregates.order.RouteRequest;
|
import com.chint.domain.aggregates.supplier.Supplier;
|
||||||
|
import com.chint.domain.aggregates.supplier.SupplierProductStandardLevel;
|
||||||
|
import com.chint.domain.exceptions.AuthException;
|
||||||
|
import com.chint.domain.service.supplier.SupplierAdapter;
|
||||||
|
|
||||||
public interface SupplierOrderSync {
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SupplierOrderSync extends SupplierAdapter {
|
||||||
boolean syncSupplierOrder(RouteOrder order);
|
boolean syncSupplierOrder(RouteOrder order);
|
||||||
|
|
||||||
boolean syncRouteRequest(RouteRequest routeRequest);
|
boolean syncRouteRequest(RouteRequest routeRequest);
|
||||||
|
@ -12,4 +17,45 @@ public interface SupplierOrderSync {
|
||||||
boolean cancelSyncSupplierOrder(RouteOrder order);
|
boolean cancelSyncSupplierOrder(RouteOrder order);
|
||||||
|
|
||||||
boolean cancelRouteRequest(RouteRequest routeRequest);
|
boolean cancelRouteRequest(RouteRequest routeRequest);
|
||||||
|
|
||||||
|
default boolean syncRouteRequest(RouteRequest routeRequest, Supplier supplier) {
|
||||||
|
RouteRequestFields routeRequestFields = routeRequest.getRouteRequestFields();
|
||||||
|
|
||||||
|
List<Integer> legType = routeRequest.getRouteRequestLegList()
|
||||||
|
.stream()
|
||||||
|
.map(RouteRequestLeg::getLeg)
|
||||||
|
.map(Leg::getLegType)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
supplier.carSupplierProduct()
|
||||||
|
.ifPresent(carSupplierProduct -> {
|
||||||
|
if (!carSupplierProduct.checkStandardLevelIfInUse(routeRequestFields.getStandardLevel())) {
|
||||||
|
throw new AuthException("你目前的公司暂不支持使用高德打车");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
supplier.flightSupplierProduct().ifPresent(flightSupplierProduct -> {
|
||||||
|
if (flightSupplierProduct.getSupplierProductStandardLevelList()
|
||||||
|
.stream()
|
||||||
|
.filter(SupplierProductStandardLevel::inUse)
|
||||||
|
.map(SupplierProductStandardLevel::getStandardLevelName)
|
||||||
|
.noneMatch(standardLevel -> standardLevel.equals(routeRequestFields.getStandardLevel()))) {
|
||||||
|
throw new AuthException("你目前的公司暂不支持使用高德打车");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
supplier.flightSupplierProduct().ifPresent(flightSupplierProduct -> {
|
||||||
|
if (flightSupplierProduct.getSupplierProductStandardLevelList()
|
||||||
|
.stream()
|
||||||
|
.filter(SupplierProductStandardLevel::inUse)
|
||||||
|
.map(SupplierProductStandardLevel::getStandardLevelName)
|
||||||
|
.noneMatch(standardLevel -> standardLevel.equals(routeRequestFields.getStandardLevel()))) {
|
||||||
|
throw new AuthException("你目前的公司暂不支持使用高德打车");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return syncRouteRequest(routeRequest);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Optional;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TAXI;
|
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TAXI;
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP_CN_NAME;
|
||||||
import static com.chint.interfaces.rest.amap.util.AmapStatusUtil.mapCarStatus;
|
import static com.chint.interfaces.rest.amap.util.AmapStatusUtil.mapCarStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,6 +118,11 @@ public class AmapOrderDataAdapter implements OrderDataAdapter {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_AMAP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private String handlerLocationName(String locationName) {
|
private String handlerLocationName(String locationName) {
|
||||||
if (locationName == null) {
|
if (locationName == null) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.util.Optional;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
|
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
|
||||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_COUNTY;
|
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_COUNTY;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -49,7 +50,7 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
|
||||||
if (!itineraryList.isEmpty()) {
|
if (!itineraryList.isEmpty()) {
|
||||||
ItineraryEntity itineraryEntity = itineraryList.get(0);
|
ItineraryEntity itineraryEntity = itineraryList.get(0);
|
||||||
OrderLegData.Builder builder = OrderLegData.builder()
|
OrderLegData.Builder builder = OrderLegData.builder()
|
||||||
.supplierName(SupplierNameConstant.SUPPLIER_C_TRIP);
|
.supplierName(SUPPLIER_C_TRIP);
|
||||||
OrderLegData.Builder elementList = findSingleElementList(itineraryEntity, builder);
|
OrderLegData.Builder elementList = findSingleElementList(itineraryEntity, builder);
|
||||||
if (elementList == null) {
|
if (elementList == null) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
@ -89,6 +90,11 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_C_TRIP;
|
||||||
|
}
|
||||||
|
|
||||||
private OrderLegData.Builder findSingleElementList(ItineraryEntity itineraryEntity,
|
private OrderLegData.Builder findSingleElementList(ItineraryEntity itineraryEntity,
|
||||||
OrderLegData.Builder builder) {
|
OrderLegData.Builder builder) {
|
||||||
List<HotelOrderInfoEntity> hotelOrderInfoList = itineraryEntity.getHotelOrderInfoList();
|
List<HotelOrderInfoEntity> hotelOrderInfoList = itineraryEntity.getHotelOrderInfoList();
|
||||||
|
|
|
@ -281,7 +281,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OrderStatusChangeCommand> commonHotel(RouteOrder routeOrder, SupplierCallbackData callbackData) {
|
private List<OrderStatusChangeCommand> commonHotel(RouteOrder routeOrder, SupplierCallbackData callbackData) {
|
||||||
HotelDetailResponse.Data data = (HotelDetailResponse.Data ) callbackData.getData();
|
HotelDetailResponse.Data data = (HotelDetailResponse.Data) callbackData.getData();
|
||||||
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
|
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
|
||||||
String outStatus = orderInfo.getOrderStatusDesc();
|
String outStatus = orderInfo.getOrderStatusDesc();
|
||||||
String orderNo = orderInfo.getOrderSerialNo();
|
String orderNo = orderInfo.getOrderSerialNo();
|
||||||
|
@ -339,4 +339,9 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSupplierName() {
|
||||||
|
return SUPPLIER_L_Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,7 @@ import com.chint.domain.value_object.SupplierCallbackData;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface OrderDataAdapter {
|
public interface OrderDataAdapter extends SupplierAdapter{
|
||||||
Optional<OrderLegData> adapt(SupplierCallbackData supplierData);
|
Optional<OrderLegData> adapt(SupplierCallbackData supplierData);
|
||||||
|
|
||||||
List<OrderStatusChangeCommand> orderStatusToCommand(RouteOrder routeOrder, SupplierCallbackData callbackData);
|
List<OrderStatusChangeCommand> orderStatusToCommand(RouteOrder routeOrder, SupplierCallbackData callbackData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.chint.domain.service.supplier;
|
||||||
|
|
||||||
|
public interface SupplierAdapter {
|
||||||
|
String getSupplierName();
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.chint.domain.service.supplier;
|
||||||
|
|
||||||
|
import com.chint.domain.exceptions.NotFoundException;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class SupplierAdapterSelector {
|
||||||
|
|
||||||
|
private final Map<String, Map<Class<?>, SupplierAdapter>> adapterMap = new HashMap<>();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
log.info("开始注入供应商适配器到选择器。。。。。");
|
||||||
|
Map<String, SupplierAdapter> beansOfType = applicationContext.getBeansOfType(SupplierAdapter.class);
|
||||||
|
for (SupplierAdapter adapter : beansOfType.values()) {
|
||||||
|
String supplierName = adapter.getSupplierName();
|
||||||
|
log.info(supplierName);
|
||||||
|
adapterMap
|
||||||
|
.computeIfAbsent(supplierName, k -> new HashMap<>())
|
||||||
|
.put(adapter.getClass().getInterfaces()[0], adapter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T> T of(String supplierName, Class<T> type) {
|
||||||
|
Map<Class<?>, SupplierAdapter> supplierAdapters = adapterMap.get(supplierName);
|
||||||
|
if (supplierAdapters == null) {
|
||||||
|
throw new NotFoundException(NOT_FOUND);
|
||||||
|
}
|
||||||
|
SupplierAdapter adapter = supplierAdapters.get(type);
|
||||||
|
if (adapter == null) {
|
||||||
|
throw new NotFoundException(NOT_FOUND);
|
||||||
|
}
|
||||||
|
return (T) adapter;
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,7 +41,8 @@ public class AmapUserRequest implements UserSync {
|
||||||
UserQueryResponse userQueryResponse = queryUser(user);
|
UserQueryResponse userQueryResponse = queryUser(user);
|
||||||
List<UserQueryResponse.UserDate> data = userQueryResponse.getData();
|
List<UserQueryResponse.UserDate> data = userQueryResponse.getData();
|
||||||
if (data == null || data.isEmpty()) {
|
if (data == null || data.isEmpty()) {
|
||||||
return createUser(user);
|
BaseResponse baseResponse = createUser(user);
|
||||||
|
return baseResponse;
|
||||||
} else {
|
} else {
|
||||||
return updateUser(user);
|
return updateUser(user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,13 @@ public class PostRequest {
|
||||||
return post(post, responseType);
|
return post(post, responseType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> T post(String url, String json, Class<T> responseType) {
|
||||||
|
HttpPost post = new HttpPost(url);
|
||||||
|
log.info(json);
|
||||||
|
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
||||||
|
return post(post, responseType);
|
||||||
|
}
|
||||||
|
|
||||||
public <T> T post(String url, UrlEncodedFormEntity entity, Class<T> responseType) {
|
public <T> T post(String url, UrlEncodedFormEntity entity, Class<T> responseType) {
|
||||||
HttpPost post = new HttpPost(url);
|
HttpPost post = new HttpPost(url);
|
||||||
post.setEntity(entity);
|
post.setEntity(entity);
|
||||||
|
|
|
@ -98,9 +98,10 @@ public class BPMParamFactory {
|
||||||
}
|
}
|
||||||
}).orElse(new BigDecimal(KEEP_TWO_DECIMAL_ZERO));
|
}).orElse(new BigDecimal(KEEP_TWO_DECIMAL_ZERO));
|
||||||
};
|
};
|
||||||
|
BigDecimal standardPriceFromQuery = handleNullLegId.get();
|
||||||
if (orderDetail.getPrice() != null && orderDetail.getProductType().equals(LEG_TYPE_HOTEL)) {
|
if (orderDetail.getPrice() != null && orderDetail.getProductType().equals(LEG_TYPE_HOTEL)) {
|
||||||
standardPrice = legId != null ? calculateStandardPrice.apply(legRepository.findByLegId(legId)) : handleNullLegId.get();
|
standardPrice = !standardPriceFromQuery.equals(new BigDecimal(KEEP_TWO_DECIMAL_ZERO)) ? standardPriceFromQuery :
|
||||||
|
calculateStandardPrice.apply(legRepository.findByLegId(legId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 金额计算
|
// 金额计算
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class EmployeeEntity {
|
||||||
private int workingState;
|
private int workingState;
|
||||||
private String birthday;
|
private String birthday;
|
||||||
private String credentialExpireDate;
|
private String credentialExpireDate;
|
||||||
|
private Integer modifyType;
|
||||||
// private int credentialType;
|
// private int credentialType;
|
||||||
// private int addTravellerAllowed;
|
// private int addTravellerAllowed;
|
||||||
private String employeeCode;
|
private String employeeCode;
|
||||||
|
|
|
@ -36,6 +36,4 @@ public class ResStatementList extends BaseResponse {
|
||||||
private String overDueRemark;//是否过期说明 离付款日还剩xxx天/已过期xxx天
|
private String overDueRemark;//是否过期说明 离付款日还剩xxx天/已过期xxx天
|
||||||
private Double payAmount;//待付款
|
private Double payAmount;//待付款
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,19 +50,19 @@ ly:
|
||||||
password: glHRJJ9JMUwNfQ8OwAQi
|
password: glHRJJ9JMUwNfQ8OwAQi
|
||||||
secret: MnghmYJpM1U2RaLx
|
secret: MnghmYJpM1U2RaLx
|
||||||
baseUrl: https://api.dttrip.cn/openapi
|
baseUrl: https://api.dttrip.cn/openapi
|
||||||
ifForwardRequest: false
|
ifForwardRequest: true
|
||||||
forwardRequestBaseUrl: https://secureqrdev-t.chint.com/llz
|
forwardRequestBaseUrl: https://gxdev03.chint.com/routeapi
|
||||||
|
|
||||||
#高德
|
#高德
|
||||||
amap:
|
amap:
|
||||||
eId: 612660
|
eId: 201107
|
||||||
appId: car_zhengtecm3noxh
|
appId: car_zhengtveefkay6
|
||||||
key: a1vxgdwobkphirln5fgup0oj6e2rsniw
|
key: vibcxd6ltlxxuct0j9sc079u0rdaur0s
|
||||||
keyt: car_zhengtecm3noxh
|
keyt: car_zhengtveefkay6
|
||||||
signKey: ngwdzlembqju9lairthw264bzkhw2vto
|
signKey: fb0jcukg6hjbn2k2cxedvweux4uozzxo
|
||||||
aesKey: 7eEdUzuVflM8n9Wo
|
aesKey: UTatMtHBBVzc05PY
|
||||||
baseUrl: https://sns.testing.amap.com
|
baseUrl: https://gws.amap.com
|
||||||
baseLoginUrl: https://pre-hailing.amap.com
|
baseLoginUrl: https://dache.amap.com
|
||||||
sf:
|
sf:
|
||||||
openApiBaseUrl: https://openapi.chintcloud.net
|
openApiBaseUrl: https://openapi.chintcloud.net
|
||||||
akBaseUrl: https://transitbridge.chint.com
|
akBaseUrl: https://transitbridge.chint.com
|
||||||
|
|
|
@ -40,6 +40,7 @@ import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||||
import com.chint.interfaces.rest.ctrip.in.CTripNoteController;
|
import com.chint.interfaces.rest.ctrip.in.CTripNoteController;
|
||||||
import com.chint.interfaces.rest.ctrip.order.CTripOrderDetailRequest;
|
import com.chint.interfaces.rest.ctrip.order.CTripOrderDetailRequest;
|
||||||
|
import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -127,6 +128,9 @@ public class CTripTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderRecordFactorySelector orderRecordFactorySelector;
|
private OrderRecordFactorySelector orderRecordFactorySelector;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CTripOrderRecordAutoSave cTripOrderRecordAutoSave;
|
||||||
|
|
||||||
|
|
||||||
@Value("${cTrip.requestSecret}")
|
@Value("${cTrip.requestSecret}")
|
||||||
private String C_TRIP_REQUEST_SECRET;
|
private String C_TRIP_REQUEST_SECRET;
|
||||||
|
@ -246,7 +250,7 @@ public class CTripTest {
|
||||||
@Test
|
@Test
|
||||||
void search() {
|
void search() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("32206424651");
|
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("32559146895");
|
||||||
System.out.println(response);
|
System.out.println(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,4 +606,9 @@ public class CTripTest {
|
||||||
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
||||||
orderRecordExtensionFactory.createHotelOrderRecord(hotelRecordByRecordId);
|
orderRecordExtensionFactory.createHotelOrderRecord(hotelRecordByRecordId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void pullCarRecord() {
|
||||||
|
cTripOrderRecordAutoSave.cTripCarRecordAutoSave(Optional.ofNullable("202405"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -828,7 +828,7 @@ public class LYTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void searchHotel() {
|
void searchHotel() {
|
||||||
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240510114900487148");
|
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240417095100616718");
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
String json = gson.toJson(hotelOrderDetail);
|
String json = gson.toJson(hotelOrderDetail);
|
||||||
System.out.println(json);
|
System.out.println(json);
|
||||||
|
|
|
@ -18,7 +18,6 @@ import com.chint.domain.service.JTCompanyDomainService;
|
||||||
import com.chint.domain.service.OrderDomainService;
|
import com.chint.domain.service.OrderDomainService;
|
||||||
import com.chint.domain.service.SystemDomainService;
|
import com.chint.domain.service.SystemDomainService;
|
||||||
import com.chint.domain.service.order_sync.LYOrderSyncAdapter;
|
import com.chint.domain.service.order_sync.LYOrderSyncAdapter;
|
||||||
import com.chint.domain.value_object.RanksData;
|
|
||||||
import com.chint.infrastructure.repository.CTripOrderDetailImpl;
|
import com.chint.infrastructure.repository.CTripOrderDetailImpl;
|
||||||
import com.chint.infrastructure.util.DateTimeUtil;
|
import com.chint.infrastructure.util.DateTimeUtil;
|
||||||
import com.chint.infrastructure.util.Digest;
|
import com.chint.infrastructure.util.Digest;
|
||||||
|
@ -35,6 +34,7 @@ import com.chint.interfaces.rest.data_center.user.BatchUserWorker;
|
||||||
import com.chint.interfaces.rest.data_center.user.UserHttpRequest;
|
import com.chint.interfaces.rest.data_center.user.UserHttpRequest;
|
||||||
import com.chint.interfaces.rest.data_center.user.UserHttpRequestImpl;
|
import com.chint.interfaces.rest.data_center.user.UserHttpRequestImpl;
|
||||||
import com.chint.interfaces.rest.data_center.user.UserSFRequest;
|
import com.chint.interfaces.rest.data_center.user.UserSFRequest;
|
||||||
|
import com.chint.interfaces.rest.ly.LYNoteResponse;
|
||||||
import com.chint.interfaces.rest.ly.LYPostRequest;
|
import com.chint.interfaces.rest.ly.LYPostRequest;
|
||||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||||
import com.chint.interfaces.rest.ly.LYUserRequest;
|
import com.chint.interfaces.rest.ly.LYUserRequest;
|
||||||
|
@ -59,6 +59,8 @@ import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.LocationConstant.*;
|
import static com.chint.infrastructure.constant.LocationConstant.*;
|
||||||
|
@ -302,7 +304,7 @@ class RouteApplicationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void loginSign() {
|
void loginSign() {
|
||||||
String sfno = "230207110";
|
String sfno = "230410022";
|
||||||
String syscode = "FSSC";
|
String syscode = "FSSC";
|
||||||
String billcode = "CLSQ240225000099";
|
String billcode = "CLSQ240225000099";
|
||||||
String companycode = "正泰集团股份有限公司";
|
String companycode = "正泰集团股份有限公司";
|
||||||
|
@ -313,10 +315,10 @@ class RouteApplicationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void loginSignProd() {
|
void loginSignProd() {
|
||||||
String sfno = "220531010";
|
String sfno = "230214151";
|
||||||
String syscode = "FSSC";
|
String syscode = "FSSC";
|
||||||
String billcode = "CLSQ240225000099";
|
String billcode = "CLSQ240225000099";
|
||||||
String companycode = "A70000021";
|
String companycode = "正泰集团股份有限公司";
|
||||||
String timespan = "1708908662738";
|
String timespan = "1708908662738";
|
||||||
String key = "ZhengTaiRoute";
|
String key = "ZhengTaiRoute";
|
||||||
String s = Digest.md5(sfno + syscode + billcode + companycode + key + timespan);
|
String s = Digest.md5(sfno + syscode + billcode + companycode + key + timespan);
|
||||||
|
@ -383,7 +385,7 @@ class RouteApplicationTests {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void postUserToAmap(){
|
void postUserToAmap() {
|
||||||
// 读取文件内容
|
// 读取文件内容
|
||||||
String filePath = "D:\\data\\routeData\\itinerary_booking_user_employee_no.sql"; // 修改为实际文件路径
|
String filePath = "D:\\data\\routeData\\itinerary_booking_user_employee_no.sql"; // 修改为实际文件路径
|
||||||
String s = readFileAsString(filePath);
|
String s = readFileAsString(filePath);
|
||||||
|
@ -393,6 +395,51 @@ class RouteApplicationTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void postOrderToProd() {
|
||||||
|
String filePath = "D:\\data\\routeData\\itinerary_booking_supplier_call_back_log.sql";
|
||||||
|
String log = readFileAsString(filePath);
|
||||||
|
List<String> strings = extractRequestBodies(log);
|
||||||
|
|
||||||
|
int requestCount = 0;
|
||||||
|
for (String requestBody : strings) {
|
||||||
|
System.out.println(requestBody);
|
||||||
|
requestBody = requestBody.replace("\\\\", "\\");
|
||||||
|
if (requestBody.startsWith("{\"notifyData\":")) {
|
||||||
|
postRequest.post("https://trip.chint.com/api/public/common/back",
|
||||||
|
requestBody, LYNoteResponse.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (requestBody.startsWith("{\"productType\":")) {
|
||||||
|
postRequest.post("https://trip.chint.com/api/public/CTrip/status",
|
||||||
|
requestBody, CTripNoteResponse.class);
|
||||||
|
}
|
||||||
|
System.out.println("这是第" + requestCount + "次请求");
|
||||||
|
// 每发起10次请求后休息1秒
|
||||||
|
requestCount++;
|
||||||
|
if (requestCount % 10 == 0) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> extractRequestBodies(String log) {
|
||||||
|
List<String> requestBodies = new ArrayList<>();
|
||||||
|
String patternString = "RequestBody:\\s*(\\{.*?\\})\\s*Stack Trace:";
|
||||||
|
Pattern pattern = Pattern.compile(patternString, Pattern.DOTALL);
|
||||||
|
Matcher matcher = pattern.matcher(log);
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
requestBodies.add(matcher.group(1).trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
return requestBodies;
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void post() {
|
void post() {
|
||||||
|
|
||||||
|
@ -446,7 +493,7 @@ class RouteApplicationTests {
|
||||||
int requestCount = 0;
|
int requestCount = 0;
|
||||||
List<String> alreadyPost = new ArrayList<>();
|
List<String> alreadyPost = new ArrayList<>();
|
||||||
for (CTripStatusNotification cTripStatusNotification : cTripStatusNotifications) {
|
for (CTripStatusNotification cTripStatusNotification : cTripStatusNotifications) {
|
||||||
if(!CTripUtils.checkHotelStatus(cTripStatusNotification.getOrderStatus())) {
|
if (!CTripUtils.checkHotelStatus(cTripStatusNotification.getOrderStatus())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!list1.contains(cTripStatusNotification.getOrderId()) || alreadyPost.contains(cTripStatusNotification.getOrderId())) {
|
if (!list1.contains(cTripStatusNotification.getOrderId()) || alreadyPost.contains(cTripStatusNotification.getOrderId())) {
|
||||||
|
|
Loading…
Reference in New Issue