feat:高德打车结算功能 , 高德差旅申请单同步增加差标管控
This commit is contained in:
parent
ab83133cc6
commit
05d16296c9
|
@ -12,13 +12,26 @@ 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 supplierName;
|
||||||
|
|
||||||
public OrderRecordGenerateCommand startTime(LocalDateTime startTime) {
|
public OrderRecordGenerateCommand startTime(LocalDateTime startTime) {
|
||||||
this.setStartTime(startTime);
|
this.setStartTime(startTime);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderRecordGenerateCommand endTime(LocalDateTime endTime) {
|
public OrderRecordGenerateCommand endTime(LocalDateTime endTime) {
|
||||||
this.setEndTime(endTime);
|
this.setEndTime(endTime);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OrderRecordGenerateCommand supplierName(String supplierName) {
|
||||||
|
this.setSupplierName(supplierName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderRecordGenerateCommand date(String date) {
|
||||||
|
this.setDate(date);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.chint.application.dtos;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CTripRecordMonthSaveDTO {
|
public class RecordMonthSaveDTO {
|
||||||
private String date;
|
private String date;
|
||||||
|
private String supplierName;
|
||||||
}
|
}
|
|
@ -2,9 +2,10 @@ package com.chint.application.in;
|
||||||
|
|
||||||
import com.chint.application.commands.LYOrderRecordGenerateCommand;
|
import com.chint.application.commands.LYOrderRecordGenerateCommand;
|
||||||
import com.chint.application.commands.OrderRecordGenerateCommand;
|
import com.chint.application.commands.OrderRecordGenerateCommand;
|
||||||
import com.chint.application.dtos.CTripRecordMonthSaveDTO;
|
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.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;
|
||||||
|
@ -24,6 +25,8 @@ 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.SupplierNameConstant.SUPPLIER_AMAP;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -43,6 +46,9 @@ public class AutoWorkController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcRouteRepository jdbcRouteRepository;
|
private JdbcRouteRepository jdbcRouteRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderRecordDomainService orderRecordDomainService;
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("用户状态检查,离职用户将关闭开卡")
|
@ApiOperation("用户状态检查,离职用户将关闭开卡")
|
||||||
@PostMapping("/user/status/check")
|
@PostMapping("/user/status/check")
|
||||||
|
@ -62,21 +68,45 @@ public class AutoWorkController {
|
||||||
return Result.Success(SUCCESS);
|
return Result.Success(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ApiOperation("拉取按月份的携程流水")
|
@ApiOperation("拉取按月份的流水并自动生成结算记录")
|
||||||
@PostMapping("/cTrip/record/save/month")
|
@PostMapping("/record/pullAndSave/month")
|
||||||
public Result<String> autoSaveCTripRecordByMonth(@RequestBody CTripRecordMonthSaveDTO cTripRecordMonthSaveDTO) {
|
public Result<String> autoDownloadDataAndSaveRecordByMonth(@RequestBody RecordMonthSaveDTO recordMonthSaveDTO) {
|
||||||
String date = cTripRecordMonthSaveDTO.getDate();
|
String date = recordMonthSaveDTO.getDate();
|
||||||
cTripOrderRecordAutoSave.saveAllByDate(date);
|
if (recordMonthSaveDTO.getSupplierName().equals(SUPPLIER_C_TRIP)) {
|
||||||
|
cTripOrderRecordAutoSave.saveAllByDate(date);
|
||||||
|
} else if (recordMonthSaveDTO.getSupplierName().equals(SUPPLIER_AMAP)) {
|
||||||
|
orderRecordDomainService.saveAllAmapCarOrderRecord(date);
|
||||||
|
}
|
||||||
//将昨天的结算数据生成为财务共享需要的数据
|
//将昨天的结算数据生成为财务共享需要的数据
|
||||||
Command.of(OrderRecordGenerateCommand.class)
|
Command.of(OrderRecordGenerateCommand.class)
|
||||||
.startTime(DateTimeUtil.firstDayOfMonth(date))
|
.startTime(DateTimeUtil.firstDayOfMonth(date))
|
||||||
.endTime(DateTimeUtil.endDayOfMonth(date))
|
.endTime(DateTimeUtil.endDayOfMonth(date))
|
||||||
|
.date(date)
|
||||||
|
.supplierName(recordMonthSaveDTO.getSupplierName())
|
||||||
.sendToQueue();
|
.sendToQueue();
|
||||||
return Result.Success(SUCCESS);
|
return Result.Success(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@ApiOperation("根据月份生成结算记录")
|
||||||
|
@PostMapping("/record/save/month")
|
||||||
|
public Result<String> autoSaveRecordByMonth(@RequestBody RecordMonthSaveDTO recordMonthSaveDTO) {
|
||||||
|
String date = recordMonthSaveDTO.getDate();
|
||||||
|
//将昨天的结算数据生成为财务共享需要的数据
|
||||||
|
Command.of(OrderRecordGenerateCommand.class)
|
||||||
|
.startTime(DateTimeUtil.firstDayOfMonth(date))
|
||||||
|
.endTime(DateTimeUtil.endDayOfMonth(date))
|
||||||
|
.date(date)
|
||||||
|
.supplierName(recordMonthSaveDTO.getSupplierName())
|
||||||
|
.sendToQueue();
|
||||||
|
return Result.Success(SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("自动拉取同程上个月的流水号")
|
@ApiOperation("自动拉取同程上个月的流水号")
|
||||||
@PostMapping("/ly/record/save")
|
@PostMapping("/ly/record/save")
|
||||||
public Result<String> autoSaveLYRecord() {
|
public Result<String> autoSaveLYRecord() {
|
||||||
|
|
|
@ -39,6 +39,7 @@ import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_LOCATI
|
||||||
import static com.chint.infrastructure.constant.CommonMessageConstant.NO_PRICE_ERROR;
|
import static com.chint.infrastructure.constant.CommonMessageConstant.NO_PRICE_ERROR;
|
||||||
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.RankConstant.STANDARD_LEVEL_ONE;
|
import static com.chint.infrastructure.constant.RankConstant.STANDARD_LEVEL_ONE;
|
||||||
|
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CTripEstimatePrice implements EstimatePrice {
|
public class CTripEstimatePrice implements EstimatePrice {
|
||||||
|
@ -262,7 +263,8 @@ public class CTripEstimatePrice implements EstimatePrice {
|
||||||
Boolean success = estimate.getStatus().getSuccess();
|
Boolean success = estimate.getStatus().getSuccess();
|
||||||
if (success) {
|
if (success) {
|
||||||
HotelValuationResult hotelValuationResult = estimate.getData().getHotelValuationResult();
|
HotelValuationResult hotelValuationResult = estimate.getData().getHotelValuationResult();
|
||||||
String price = hotelValuationResult.getMaxPrice().toString();
|
BigDecimal maxPrice = hotelValuationResult.getMaxPrice();
|
||||||
|
String price = maxPrice == null ? KEEP_TWO_DECIMAL_ZERO : maxPrice.toString(); ;
|
||||||
|
|
||||||
if (Double.parseDouble(price) == 0) {
|
if (Double.parseDouble(price) == 0) {
|
||||||
hotelPriceData.setSuccess(false);
|
hotelPriceData.setSuccess(false);
|
||||||
|
|
|
@ -4,7 +4,6 @@ package com.chint.domain.aggregates.order;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.annotation.Transient;
|
|
||||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
|
@ -165,6 +164,11 @@ public class HotelOrderDetail implements Serializable {
|
||||||
if (this.customers == null) {
|
if (this.customers == null) {
|
||||||
this.customers = new ArrayList<>();
|
this.customers = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
if (this.customers.stream().anyMatch(it -> it.getUserName().equals(customer.getUserName()) &&
|
||||||
|
it.getPhone().equals(customer.getPhone()) &&
|
||||||
|
it.getUserCode().equals(customer.getUserCode()))) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
this.customers.add(customer);
|
this.customers.add(customer);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,9 @@ import org.springframework.data.relational.core.mapping.Table;
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Table("supplier")
|
@Table("supplier")
|
||||||
|
@ -20,4 +23,29 @@ public class Supplier implements Serializable {
|
||||||
private String cnName;
|
private String cnName;
|
||||||
@MappedCollection(idColumn = "supplier_id", keyColumn = "supplier_key")
|
@MappedCollection(idColumn = "supplier_id", keyColumn = "supplier_key")
|
||||||
private List<SupplierProduct> supplierProductList;
|
private List<SupplierProduct> supplierProductList;
|
||||||
|
|
||||||
|
public Optional<SupplierProduct> carSupplierProduct() {
|
||||||
|
return getSupplierProductByProductType(LEG_TYPE_TAXI);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<SupplierProduct> hotelSupplierProduct() {
|
||||||
|
return getSupplierProductByProductType(LEG_TYPE_HOTEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<SupplierProduct> flightSupplierProduct() {
|
||||||
|
return getSupplierProductByProductType(LEG_TYPE_AIRPLANE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<SupplierProduct> trainSupplierProduct() {
|
||||||
|
return getSupplierProductByProductType(LEG_TYPE_TRAIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Optional<SupplierProduct> getSupplierProductByProductType(Integer productType) {
|
||||||
|
if (supplierProductList == null || supplierProductList.isEmpty()) {
|
||||||
|
return Optional.empty();
|
||||||
|
} else {
|
||||||
|
return supplierProductList.stream()
|
||||||
|
.filter(it -> it.getProductType().equals(productType)).findFirst();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,12 @@ package com.chint.domain.aggregates.supplier;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Table("supplier_product")
|
@Table("supplier_product")
|
||||||
|
@ -20,4 +22,6 @@ public class SupplierProduct implements Serializable {
|
||||||
private Integer productType;
|
private Integer productType;
|
||||||
private Integer ifCanOrder;
|
private Integer ifCanOrder;
|
||||||
private String ifCanCancelRule;
|
private String ifCanCancelRule;
|
||||||
|
@MappedCollection(idColumn = "supplier_product_id", keyColumn = "supplier_product_key")
|
||||||
|
private List<SupplierProductStandardLevel> supplierProductStandardLevelList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
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_standard_level")
|
||||||
|
public class SupplierProductStandardLevel implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1864551962257811354L;
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
private Long supplierProductId;
|
||||||
|
private Long standardLevelId;
|
||||||
|
private String standardLevelName;
|
||||||
|
private Integer status;
|
||||||
|
private String extension;
|
||||||
|
|
||||||
|
public boolean inUse() {
|
||||||
|
return status == 1;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +1,128 @@
|
||||||
package com.chint.domain.factoriy.order_record;
|
package com.chint.domain.factoriy.order_record;
|
||||||
|
|
||||||
|
import com.chint.domain.aggregates.order.OrderDetail;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
|
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.aggregates.order.order_record.amap_order_record.AmapCarOrderRecord;
|
||||||
|
import com.chint.infrastructure.util.BigDecimalCalculator;
|
||||||
import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse;
|
import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AmapOrderRecordExtensionFactory implements OrderRecordExtensionFactory {
|
public class AmapOrderRecordExtensionFactory implements OrderRecordExtensionFactory {
|
||||||
|
|
||||||
|
private final String isCancel = "取消费订单";
|
||||||
|
private final String isNotCancel = "非取消费订单";
|
||||||
|
|
||||||
|
|
||||||
|
private OrderRecordBasic buildWithRecord(Object orderCarRecordData) {
|
||||||
|
AmapCarOrderRecord carRecordData = (AmapCarOrderRecord) orderCarRecordData;
|
||||||
|
OrderRecordBasic orderRecordBasic = new OrderRecordBasic();
|
||||||
|
orderRecordBasic.loadBookingInfo(carRecordData.getEUserId(),
|
||||||
|
carRecordData.getRealName(),
|
||||||
|
null,
|
||||||
|
carRecordData.getRealName(),
|
||||||
|
carRecordData.getEUserId()
|
||||||
|
);
|
||||||
|
return orderRecordBasic;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData, Optional<RouteOrder> routeOrder) {
|
||||||
|
AmapCarOrderRecord carRecordData = (AmapCarOrderRecord) orderCarRecordData;
|
||||||
|
OrderCarRecord orderCarRecord = buildWithRecord(orderCarRecordData).carRecord();
|
||||||
|
|
||||||
|
Optional<OrderDetail> orderDetail = routeOrder
|
||||||
|
.stream()
|
||||||
|
.flatMap(order -> order
|
||||||
|
.getOrderDetails()
|
||||||
|
.stream()
|
||||||
|
.filter(it -> it.getOrderNo().equals(carRecordData.getAmapOrderId())))
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
String orderStatus;
|
||||||
|
if (carRecordData.getIsCancelFeeOrder().equals(isCancel)) {
|
||||||
|
orderStatus = "3";
|
||||||
|
} else {
|
||||||
|
orderStatus = "1";
|
||||||
|
}
|
||||||
|
orderCarRecord.loadBasicOrderInfo(carRecordData.getAmapOrderId(),
|
||||||
|
orderStatus,
|
||||||
|
carRecordData.getGmtCreate())
|
||||||
|
.loadBelongDeport(
|
||||||
|
routeOrder.stream().flatMap(order ->
|
||||||
|
Optional.ofNullable(order.getRouterOrderExtensionField().getBelongDeptCode()).stream()
|
||||||
|
).findFirst().orElseGet(carRecordData::getDepartmentId)
|
||||||
|
);
|
||||||
|
|
||||||
|
String ds = carRecordData.getDs();
|
||||||
|
orderCarRecord.loadTravelInfo(
|
||||||
|
carRecordData.getGmtCreateStartTime106(),
|
||||||
|
carRecordData.getGmtCreateEndTime106(),
|
||||||
|
carRecordData.getCityName(),
|
||||||
|
carRecordData.getEndCity(),
|
||||||
|
carRecordData.getStartName(),
|
||||||
|
carRecordData.getEndName()
|
||||||
|
).loadVehicleAndTravelInfo(
|
||||||
|
carRecordData.getAmapRideType(),
|
||||||
|
orderDetail.flatMap(it -> Optional.ofNullable(it.getCarOrderDetail().getRunTime())).orElse(KEEP_TWO_DECIMAL_ZERO),
|
||||||
|
String.valueOf(carRecordData.getMileage())
|
||||||
|
).loadFinancialInfo(
|
||||||
|
ds.substring(0, 6),
|
||||||
|
ds,
|
||||||
|
String.valueOf(carRecordData.getOrderAmount()),
|
||||||
|
BigDecimalCalculator.add(String.valueOf(carRecordData.getOrderAmount()), String.valueOf(carRecordData.getServicefee()))
|
||||||
|
).loadFeeDetails(
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
String.valueOf(carRecordData.getServicefee()),
|
||||||
|
String.valueOf(carRecordData.getCancelFee()),
|
||||||
|
String.valueOf(carRecordData.getHighwayFee()),
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
Double enterpriseAmount = carRecordData.getEnterpriseAmount();
|
||||||
|
Double individualAmount = carRecordData.getIndividualAmount();
|
||||||
|
String paymentType;
|
||||||
|
if (enterpriseAmount > 0 && enterpriseAmount < carRecordData.getOrderAmount()) {
|
||||||
|
paymentType = "2"; // 企业支付部分,个人支付部分
|
||||||
|
} else if (enterpriseAmount.equals(carRecordData.getOrderAmount())) {
|
||||||
|
paymentType = "0"; // 全部由企业支付
|
||||||
|
} else {
|
||||||
|
paymentType = "1"; // 全部由个人支付
|
||||||
|
}
|
||||||
|
|
||||||
|
String outApplyRecordId = carRecordData.getOutApplyRecordId();
|
||||||
|
orderCarRecord.loadPayment(
|
||||||
|
paymentType,
|
||||||
|
String.valueOf(enterpriseAmount),
|
||||||
|
String.valueOf(individualAmount)
|
||||||
|
).loadOrganizationalInfo(
|
||||||
|
carRecordData.getDep1(),
|
||||||
|
carRecordData.getDep2(),
|
||||||
|
carRecordData.getDep3()
|
||||||
|
).loadSource(
|
||||||
|
outApplyRecordId == null || outApplyRecordId.isEmpty() ? "N" : "Y"
|
||||||
|
).loadRelatedOrderInfo(
|
||||||
|
orderDetail.flatMap(it -> Optional.ofNullable(it.getOrderId())).orElse(Long.parseLong(carRecordData.getAmapOrderId())),
|
||||||
|
carRecordData.getAmapOrderId(),
|
||||||
|
carRecordData.getOutApplyRecordId(),
|
||||||
|
carRecordData.getOutApplyRecordId(),
|
||||||
|
carRecordData.getAmapOrderId(),
|
||||||
|
carRecordData.getAmapOrderId()
|
||||||
|
);
|
||||||
|
orderDetail.ifPresentOrElse(orderCarRecord::loadComplianceInfo, orderCarRecord::loadComplianceInfoNot);
|
||||||
|
return orderCarRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
|
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
|
||||||
|
@ -43,19 +152,6 @@ public class AmapOrderRecordExtensionFactory implements OrderRecordExtensionFact
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OrderRecordBasic buildWithRecord(Object orderCarRecordData) {
|
|
||||||
FinishedOrderResponse.ListElement carRecordData = (FinishedOrderResponse.ListElement) orderCarRecordData;
|
|
||||||
OrderRecordBasic orderRecordBasic = new OrderRecordBasic();
|
|
||||||
// orderRecordBasic.loadBookingInfo(
|
|
||||||
// carRecordData.get
|
|
||||||
// )
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData, Optional<RouteOrder> routeOrder) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData, Optional<RouteOrder> routeOrder) {
|
public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData, Optional<RouteOrder> routeOrder) {
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.chint.domain.repository;
|
||||||
|
|
||||||
|
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarOrderRecord;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface AmapCarOrderRecordRepository {
|
||||||
|
|
||||||
|
List<AmapCarOrderRecord> saveAll(List<AmapCarOrderRecord> records);
|
||||||
|
|
||||||
|
List<AmapCarOrderRecord> findByDs(String ds);
|
||||||
|
}
|
|
@ -4,10 +4,10 @@ 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.repository.OrderCarRecordRepository;
|
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarOrderRecord;
|
||||||
import com.chint.domain.repository.OrderFlightRecordRepository;
|
import com.chint.domain.repository.*;
|
||||||
import com.chint.domain.repository.OrderHotelRecordRepository;
|
import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse;
|
||||||
import com.chint.domain.repository.OrderTrainRecordRepository;
|
import com.chint.interfaces.rest.amap.request.AmapSettleBillRequest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -29,6 +29,12 @@ public class OrderRecordDomainService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemDomainService systemDomainService;
|
private SystemDomainService systemDomainService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmapCarOrderRecordRepository amapCarOrderRecordRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmapSettleBillRequest amapSettleBillRequest;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void reloadClerkAndSave(String accountPeriod) {
|
public void reloadClerkAndSave(String accountPeriod) {
|
||||||
List<OrderCarRecord> orderCarRecordList = orderCarRecordRepository.findByAccountPeriod(accountPeriod);
|
List<OrderCarRecord> orderCarRecordList = orderCarRecordRepository.findByAccountPeriod(accountPeriod);
|
||||||
|
@ -49,4 +55,10 @@ public class OrderRecordDomainService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void saveAllAmapCarOrderRecord(String date) {
|
||||||
|
List<FinishedOrderResponse.ListElement> listElements = amapSettleBillRequest.amapRecordByMonth(date);
|
||||||
|
List<AmapCarOrderRecord> list = listElements.stream().map(AmapCarOrderRecord::of).toList();
|
||||||
|
amapCarOrderRecordRepository.saveAll(list);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,46 @@
|
||||||
package com.chint.domain.service.order_record;
|
package com.chint.domain.service.order_record;
|
||||||
|
|
||||||
import com.chint.application.commands.OrderRecordGenerateCommand;
|
import com.chint.application.commands.OrderRecordGenerateCommand;
|
||||||
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
|
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.aggregates.order.order_record.amap_order_record.AmapCarOrderRecord;
|
||||||
|
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord;
|
||||||
|
import com.chint.domain.factoriy.order_record.OrderRecordExtensionFactory;
|
||||||
|
import com.chint.domain.factoriy.order_record.OrderRecordFactorySelector;
|
||||||
|
import com.chint.domain.repository.AmapCarOrderRecordRepository;
|
||||||
|
import com.chint.domain.service.OrderDetailDomainService;
|
||||||
|
import com.chint.domain.service.RouteRequestDomainService;
|
||||||
|
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
||||||
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||||
|
|
||||||
|
@Component
|
||||||
public class AmapOrderRecordDomainService implements OrderRecordDomainService{
|
public class AmapOrderRecordDomainService implements OrderRecordDomainService{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmapCarOrderRecordRepository aMapCarOrderRecordRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderRecordFactorySelector orderRecordFactorySelector;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RouteRequestDomainService routeRequestDomainService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderDetailDomainService orderDetailDomainService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
|
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
|
||||||
return List.of();
|
return List.of();
|
||||||
|
@ -24,8 +56,23 @@ public class AmapOrderRecordDomainService implements OrderRecordDomainService{
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ListenTo(command = "OrderRecordGenerateCommand", order = 0)
|
||||||
@Override
|
@Override
|
||||||
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
|
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
|
||||||
return List.of();
|
if (!command.getSupplierName().equals(SUPPLIER_AMAP)) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
List<AmapCarOrderRecord> amapCarOrderRecordList = aMapCarOrderRecordRepository.findByDs(command.getDate());
|
||||||
|
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
||||||
|
List<String> routeOrderNoList = amapCarOrderRecordList.stream().map(AmapCarOrderRecord::getOutApplyRecordId).distinct().toList();
|
||||||
|
List<RouteOrder> routeOrderList = routeRequestDomainService.getRouteOrder(routeOrderNoList);
|
||||||
|
// 根据RouteOrder的checkIfMine方法,创建一个包含自己订单的Map
|
||||||
|
Map<String, Optional<RouteOrder>> collect = routeOrderNoList.parallelStream().collect(Collectors.toMap(Function.identity(),
|
||||||
|
it -> routeOrderList.stream().filter(routeOrder -> routeOrder != null && routeOrder.checkIfMine(it)).findFirst()));
|
||||||
|
List<OrderCarRecord> orderCarRecordList = amapCarOrderRecordList
|
||||||
|
.stream()
|
||||||
|
.map(it -> orderRecordExtensionFactory.createCarOrderRecord(it, collect.get(it.getOutApplyRecordId())))
|
||||||
|
.toList();
|
||||||
|
return orderDetailDomainService.saveCarOrderRecordBatch(orderCarRecordList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService {
|
||||||
private CTripOrderDetailRepository cTripOrderDetailRepository;
|
private CTripOrderDetailRepository cTripOrderDetailRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderRecordFactorySelector orderRecordFactorySelector;
|
private OrderRecordFactorySelector orderRecordFactorySelector;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RouteRequestDomainService routeRequestDomainService;
|
private RouteRequestDomainService routeRequestDomainService;
|
||||||
|
|
||||||
|
@ -50,6 +49,9 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService {
|
||||||
@ListenTo(command = "OrderRecordGenerateCommand", order = 0)
|
@ListenTo(command = "OrderRecordGenerateCommand", order = 0)
|
||||||
@Override
|
@Override
|
||||||
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
|
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
|
||||||
|
if (!command.getSupplierName().equals(SUPPLIER_C_TRIP)) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
List<CTripHotelRecord> records = cTripOrderDetailRepository.findHotelRecordByCreateTime(command.getStartTime(), command.getEndTime());
|
List<CTripHotelRecord> records = cTripOrderDetailRepository.findHotelRecordByCreateTime(command.getStartTime(), command.getEndTime());
|
||||||
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
||||||
List<String> routeOrderNoList = records.stream().map(CTripHotelRecord::getRouteOrderNo).distinct().toList();
|
List<String> routeOrderNoList = records.stream().map(CTripHotelRecord::getRouteOrderNo).distinct().toList();
|
||||||
|
@ -73,13 +75,16 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService {
|
||||||
@ListenTo(command = "OrderRecordGenerateCommand", order = 1)
|
@ListenTo(command = "OrderRecordGenerateCommand", order = 1)
|
||||||
@Override
|
@Override
|
||||||
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
|
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
|
||||||
|
if (!command.getSupplierName().equals(SUPPLIER_C_TRIP)) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
List<CTripFlightRecord> records = cTripOrderDetailRepository.findFlightRecordByCreateTime(command.getStartTime(), command.getEndTime());
|
List<CTripFlightRecord> records = cTripOrderDetailRepository.findFlightRecordByCreateTime(command.getStartTime(), command.getEndTime());
|
||||||
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
||||||
List<String> routeOrderNoList = records.stream().map(CTripFlightRecord::getRouteOrderNo).distinct().toList();
|
List<String> routeOrderNoList = records.stream().map(CTripFlightRecord::getRouteOrderNo).distinct().toList();
|
||||||
List<RouteOrder> routeOrderList = routeRequestDomainService.getRouteOrder(routeOrderNoList);
|
List<RouteOrder> routeOrderList = routeRequestDomainService.getRouteOrder(routeOrderNoList);
|
||||||
// 根据RouteOrder的checkIfMine方法,创建一个包含自己订单的Map
|
// 根据RouteOrder的checkIfMine方法,创建一个包含自己订单的Map
|
||||||
Map<String, Optional<RouteOrder>> collect = routeOrderNoList.parallelStream().collect(Collectors.toMap(Function.identity(),
|
Map<String, Optional<RouteOrder>> collect = routeOrderNoList.parallelStream().collect(Collectors.toMap(Function.identity(),
|
||||||
it -> routeOrderList.stream().filter(routeOrder ->routeOrder != null && routeOrder.checkIfMine(it)).findFirst()));
|
it -> routeOrderList.stream().filter(routeOrder -> routeOrder != null && routeOrder.checkIfMine(it)).findFirst()));
|
||||||
List<OrderFlightRecord> orderFlightRecordList = records
|
List<OrderFlightRecord> orderFlightRecordList = records
|
||||||
.stream()
|
.stream()
|
||||||
.map(it -> orderRecordExtensionFactory.createFlightOrderRecord(it, collect.get(it.getRouteOrderNo())))
|
.map(it -> orderRecordExtensionFactory.createFlightOrderRecord(it, collect.get(it.getRouteOrderNo())))
|
||||||
|
@ -90,13 +95,16 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService {
|
||||||
@ListenTo(command = "OrderRecordGenerateCommand", order = 2)
|
@ListenTo(command = "OrderRecordGenerateCommand", order = 2)
|
||||||
@Override
|
@Override
|
||||||
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
|
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
|
||||||
|
if (!command.getSupplierName().equals(SUPPLIER_C_TRIP)) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
List<CTripCarRecord> records = cTripOrderDetailRepository.findCarRecordByCreateTime(command.getStartTime(), command.getEndTime());
|
List<CTripCarRecord> records = cTripOrderDetailRepository.findCarRecordByCreateTime(command.getStartTime(), command.getEndTime());
|
||||||
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
|
||||||
List<String> routeOrderNoList = records.stream().map(CTripCarRecord::getRouteOrderNo).distinct().toList();
|
List<String> routeOrderNoList = records.stream().map(CTripCarRecord::getRouteOrderNo).distinct().toList();
|
||||||
List<RouteOrder> routeOrderList = routeRequestDomainService.getRouteOrder(routeOrderNoList);
|
List<RouteOrder> routeOrderList = routeRequestDomainService.getRouteOrder(routeOrderNoList);
|
||||||
// 根据RouteOrder的checkIfMine方法,创建一个包含自己订单的Map
|
// 根据RouteOrder的checkIfMine方法,创建一个包含自己订单的Map
|
||||||
Map<String, Optional<RouteOrder>> collect = routeOrderNoList.parallelStream().collect(Collectors.toMap(Function.identity(),
|
Map<String, Optional<RouteOrder>> collect = routeOrderNoList.parallelStream().collect(Collectors.toMap(Function.identity(),
|
||||||
it -> routeOrderList.stream().filter(routeOrder ->routeOrder != null && routeOrder.checkIfMine(it)).findFirst()));
|
it -> routeOrderList.stream().filter(routeOrder -> routeOrder != null && routeOrder.checkIfMine(it)).findFirst()));
|
||||||
List<OrderCarRecord> orderCarRecordList = records
|
List<OrderCarRecord> orderCarRecordList = records
|
||||||
.stream()
|
.stream()
|
||||||
.map(it -> orderRecordExtensionFactory.createCarOrderRecord(it, collect.get(it.getRouteOrderNo())))
|
.map(it -> orderRecordExtensionFactory.createCarOrderRecord(it, collect.get(it.getRouteOrderNo())))
|
||||||
|
|
|
@ -2,10 +2,14 @@ package com.chint.domain.service.order_sync;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.*;
|
import com.chint.domain.aggregates.order.*;
|
||||||
import com.chint.domain.aggregates.supplier.AmapRouteRelationship;
|
import com.chint.domain.aggregates.supplier.AmapRouteRelationship;
|
||||||
|
import com.chint.domain.aggregates.supplier.Supplier;
|
||||||
|
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.CommandException;
|
import com.chint.domain.exceptions.CommandException;
|
||||||
import com.chint.domain.repository.AmapPolicyRepository;
|
import com.chint.domain.repository.AmapPolicyRepository;
|
||||||
import com.chint.domain.repository.AmapRouteRelationshipRepository;
|
import com.chint.domain.repository.AmapRouteRelationshipRepository;
|
||||||
|
import com.chint.domain.repository.SupplierRepository;
|
||||||
import com.chint.domain.repository.UserRepository;
|
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;
|
||||||
|
@ -26,6 +30,7 @@ import java.util.List;
|
||||||
import java.util.Optional;
|
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;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
@ -49,6 +54,9 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
|
||||||
@Autowired
|
@Autowired
|
||||||
private AmapPolicyRepository amapPolicyRepository;
|
private AmapPolicyRepository amapPolicyRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SupplierRepository supplierRepository;
|
||||||
|
|
||||||
private Gson gson = new Gson();
|
private Gson gson = new Gson();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -139,9 +147,19 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
|
||||||
dto.setProcessContent(gson.toJson(processContent));
|
dto.setProcessContent(gson.toJson(processContent));
|
||||||
dto.setStatus("1");
|
dto.setStatus("1");
|
||||||
|
|
||||||
amapPolicyRepository.findByStandardLevel(routeRequestFields.getStandardLevel())
|
Optional<Supplier> supplier = supplierRepository.findBySupplierName(SUPPLIER_AMAP);
|
||||||
.ifPresent(policy -> dto.setRegulationId(policy.getAmapPolicyCode()));
|
supplier.flatMap(Supplier::carSupplierProduct).ifPresent(carSupplierProduct -> {
|
||||||
|
if (carSupplierProduct.getSupplierProductStandardLevelList()
|
||||||
|
.stream()
|
||||||
|
.filter(SupplierProductStandardLevel::inUse)
|
||||||
|
.map(SupplierProductStandardLevel::getStandardLevelName)
|
||||||
|
.anyMatch(standardLevel -> standardLevel.equals(routeRequestFields.getStandardLevel()))) {
|
||||||
|
amapPolicyRepository.findByStandardLevel(routeRequestFields.getStandardLevel())
|
||||||
|
.ifPresent(policy -> dto.setRegulationId(policy.getAmapPolicyCode()));
|
||||||
|
} else {
|
||||||
|
throw new AuthException("你目前的差标不支持使用高德打车");
|
||||||
|
}
|
||||||
|
});
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.chint.infrastructure.repository;
|
||||||
|
|
||||||
|
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarOrderRecord;
|
||||||
|
import com.chint.domain.repository.AmapCarOrderRecordRepository;
|
||||||
|
import com.chint.infrastructure.repository.jdbc.JdbcAmapCarOrderRecordRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class AmapCarOrderRecordRepositoryImpl implements AmapCarOrderRecordRepository {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JdbcAmapCarOrderRecordRepository jdbcAmapCarOrderRecordRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AmapCarOrderRecord> saveAll(List<AmapCarOrderRecord> records) {
|
||||||
|
List<AmapCarOrderRecord> res = new ArrayList<>();
|
||||||
|
jdbcAmapCarOrderRecordRepository.saveAll(records).forEach(res::add);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AmapCarOrderRecord> findByDs(String ds) {
|
||||||
|
return jdbcAmapCarOrderRecordRepository.findByDsContaining(ds);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.chint.infrastructure.repository.jdbc;
|
||||||
|
|
||||||
|
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarOrderRecord;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface JdbcAmapCarOrderRecordRepository extends CrudRepository<AmapCarOrderRecord, Long> {
|
||||||
|
List<AmapCarOrderRecord> findByDsContaining(String ds);
|
||||||
|
}
|
|
@ -7,14 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.AmapConstant.FINISHED_ORDER_URL;
|
import static com.chint.infrastructure.constant.AmapConstant.FINISHED_ORDER_URL;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class SettleBillRequest {
|
public class AmapSettleBillRequest {
|
||||||
@Value("${amap.baseUrl}")
|
@Value("${amap.baseUrl}")
|
||||||
private String baseUrl;
|
private String baseUrl;
|
||||||
|
|
||||||
|
@ -49,12 +48,16 @@ public class SettleBillRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<FinishedOrderResponse.ListElement> amapRecordLastMonth(){
|
public List<FinishedOrderResponse.ListElement> amapRecordLastMonth() {
|
||||||
String lastMonthStr = DateTimeUtil.lastMonthStr();
|
String lastMonthStr = DateTimeUtil.lastMonthStr();
|
||||||
LocalDateTime firstDayOfMonth = DateTimeUtil.firstDayOfMonth(lastMonthStr);
|
String firstDayOfMonth = DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.firstDayOfMonth(lastMonthStr));
|
||||||
LocalDateTime endDayOfMonth = DateTimeUtil.endDayOfMonth(lastMonthStr);
|
String endDayOfMonth = DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.endDayOfMonth(lastMonthStr));
|
||||||
|
return pageFinishedOrder(firstDayOfMonth, endDayOfMonth);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<FinishedOrderResponse.ListElement> amapRecordByMonth(String date) {
|
||||||
|
String firstDayOfMonth = DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.firstDayOfMonth(date));
|
||||||
|
String endDayOfMonth = DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.endDayOfMonth(date));
|
||||||
|
return pageFinishedOrder(firstDayOfMonth, endDayOfMonth);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -13,10 +13,9 @@ import com.chint.interfaces.rest.amap.BaseResponse;
|
||||||
import com.chint.interfaces.rest.amap.dto.UserQueryResponse;
|
import com.chint.interfaces.rest.amap.dto.UserQueryResponse;
|
||||||
import com.chint.interfaces.rest.amap.dto.detail.AmapOrderDetailResponse;
|
import com.chint.interfaces.rest.amap.dto.detail.AmapOrderDetailResponse;
|
||||||
import com.chint.interfaces.rest.amap.dto.location.LocationResponse;
|
import com.chint.interfaces.rest.amap.dto.location.LocationResponse;
|
||||||
import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse;
|
|
||||||
import com.chint.interfaces.rest.amap.dto.token.TokenResponse;
|
import com.chint.interfaces.rest.amap.dto.token.TokenResponse;
|
||||||
import com.chint.interfaces.rest.amap.request.AmapOrderDetailRequest;
|
import com.chint.interfaces.rest.amap.request.AmapOrderDetailRequest;
|
||||||
import com.chint.interfaces.rest.amap.request.SettleBillRequest;
|
import com.chint.interfaces.rest.amap.request.AmapSettleBillRequest;
|
||||||
import com.chint.interfaces.rest.amap.request.TakeCarRequest;
|
import com.chint.interfaces.rest.amap.request.TakeCarRequest;
|
||||||
import com.chint.interfaces.rest.amap.request.TokenRequest;
|
import com.chint.interfaces.rest.amap.request.TokenRequest;
|
||||||
import com.chint.interfaces.rest.base.dto.H5LoginResponse;
|
import com.chint.interfaces.rest.base.dto.H5LoginResponse;
|
||||||
|
@ -26,7 +25,6 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
||||||
|
@ -56,7 +54,7 @@ public class AmapTest {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SettleBillRequest settleBillRequest;
|
private AmapSettleBillRequest settleBillRequest;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void search() {
|
public void search() {
|
||||||
|
|
|
@ -246,7 +246,7 @@ public class CTripTest {
|
||||||
@Test
|
@Test
|
||||||
void search() {
|
void search() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("32527114975");
|
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31674878596");
|
||||||
System.out.println(response);
|
System.out.println(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -828,7 +828,7 @@ public class LYTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void searchHotel() {
|
void searchHotel() {
|
||||||
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240330143900871266");
|
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240523153100458921");
|
||||||
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);
|
||||||
|
|
|
@ -299,10 +299,10 @@ class RouteApplicationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void loginSign() {
|
void loginSign() {
|
||||||
String sfno = "220531010";
|
String sfno = "030710001";
|
||||||
String syscode = "FSSC";
|
String syscode = "FSSC";
|
||||||
String billcode = "CLSQ240225000099";
|
String billcode = "CLSQ240225000099";
|
||||||
String companycode = "A70000021";
|
String companycode = "正泰集团股份有限公司";
|
||||||
String timespan = "1708908662738";
|
String timespan = "1708908662738";
|
||||||
String s = Digest.md5(sfno + syscode + billcode + companycode + LOGIN_SECRET_KEY + timespan);
|
String s = Digest.md5(sfno + syscode + billcode + companycode + LOGIN_SECRET_KEY + timespan);
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
|
|
Loading…
Reference in New Issue