feat:高德结算退款账单代码备份
This commit is contained in:
parent
02bd1ae0e9
commit
c7e2b67d75
|
@ -143,7 +143,6 @@ public class ApprovalLegAddAndChangeBatch extends ApprovalProcess {
|
|||
approvalRecord.addLeg(newLeg);
|
||||
}
|
||||
});
|
||||
bpmPlatform.submitLegAddOrChangeApproval(approvalData);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
package com.chint.domain.aggregates.order.order_record.amap_order_record;
|
||||
|
||||
import com.chint.infrastructure.util.BeanCopyUtils;
|
||||
import com.chint.interfaces.rest.amap.dto.settlement.RefundOrderData;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Table("amap_car_refund_order_record")
|
||||
public class AmapCarRefundOrderRecord implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1927629135132675511L;
|
||||
@Id
|
||||
private Long id;
|
||||
private String amapOrderId; // 订单号
|
||||
private String gmtCreate; // 下单时间:2022-09-19 08:27:39
|
||||
private String refundSuccessTime; // 退款成功时间:2022-09-19 16:34:17
|
||||
private String refundAmount; // 退款金额,单位:元
|
||||
private String refundRequestId; // 退款请求id
|
||||
private String payType; // 退款支付类型:企业/个人
|
||||
private String eName; // 企业名称
|
||||
private String eId; // 企业id
|
||||
private String cpAmapId; // 高德子订单号
|
||||
private String cpOrderId; // 商户订单号
|
||||
private String amapRideType; // 运力类型
|
||||
private String cpCode; // 商户id
|
||||
private String cpName; // 商户名称
|
||||
private String userId; // 高德账号
|
||||
private String eUserId; // 企业员工id
|
||||
private String realName; // 企业员工姓名
|
||||
private String financeCostcenterCode; // 成本中心编号
|
||||
private String financeCostcenterDesc; // 成本中心描述
|
||||
private String dep1; // 1级部门
|
||||
private String dep2; // 2级部门
|
||||
private String dep3; // 3级部门
|
||||
private String dep4; // 4级部门
|
||||
private String dep5; // 5级部门
|
||||
private String dep6; // 6级部门
|
||||
private String dep7; // 7级部门
|
||||
private String dep8; // 8级部门
|
||||
private String dep9; // 9级部门
|
||||
private String dep10; // 10级部门
|
||||
private String dep11; // 11级部门
|
||||
private String dep12; // 12级部门
|
||||
private String dep13; // 13级部门
|
||||
private String dep14; // 14级部门
|
||||
private String dep15; // 15级部门
|
||||
private String cityName; // 起点城市
|
||||
private String startName; // 起点名称
|
||||
private String endCity; // 终点城市
|
||||
private String endName; // 终点名称
|
||||
private String regulationName; // 用车制度名称
|
||||
private double mileage; // 订单总里程,单位:km
|
||||
private double estimateMileage; // 订单预估里程,单位:km
|
||||
private double estimatePrice; // 预估金额,单位:元
|
||||
private double enterpriseAmount; // 企业支付金额
|
||||
private String isChangeFee; // 是否改价(改价、未改价)
|
||||
private String isCancelFeeOrder; // 是否为取消费订单(取消费订单、非取消费订单)
|
||||
private String remark; // 用车备注
|
||||
private String resultType; // 审批结果类型
|
||||
private String result; // 审批结果
|
||||
private String processStatus; // 审批状态:新创建、yu
|
||||
private String approvalSecondType; // 审批类型:0-行前审批;1-行后审批;2-因公转企付审批
|
||||
private String approvalEUserId; // 审批人ID
|
||||
private String approvalUserName; // 审批人姓名
|
||||
private String ds; // 日期:20220913
|
||||
@Column(value = "gmt_create_start_time_106")
|
||||
private String gmtCreateStartTime106; // 开始计费时间:2022-09-19 08:27:39
|
||||
@Column(value = "gmt_create_end_time_106")
|
||||
private String gmtCreateEndTime106; // 结束计费时间:2022-09-19 08:27:39
|
||||
private double totalCouponAmount; // 优惠总金额
|
||||
private String departTime; // 计划用车时间:2022-09-19 08:27:39
|
||||
@Column(value = "gmt_create_103")
|
||||
private String gmtCreate103; // 司机接单时间:2022-09-19 08:27:39
|
||||
@Column(value = "gmt_create_104")
|
||||
private String gmtCreate104; // 司机到达上车点时间:2022-09-19 08:27:39
|
||||
private String cardId; // 员工cardID
|
||||
private String projectCode; // 外部项目code
|
||||
private String departmentId; // 部门编号
|
||||
private String orderRelyId; // 用车申请凭证ID
|
||||
private String orderRely; // 用车凭证
|
||||
private String outApplyRecordId; // 外部申请单单号
|
||||
private String applyRecordId; // 申请单ID
|
||||
private Integer orderEnterance; // 发单入口:0-实时; 1-预约; 2-接机; 3-送机; 4-接站; 5-送站 ;8-代驾 ;10-代叫实时; 11-代叫预约; 12-代叫接机; 13-代叫送机; 14-代叫接站; 15-代叫送站
|
||||
private String autoEnterprisePay; // 是否超时自动转企业支付:是/否
|
||||
private String relationEntId; // 关联企业Id
|
||||
private String relationEntName; // 关联企业名称
|
||||
private String signCompanyName; // 订单签约主体
|
||||
private String entStaffExtInfo; // 企业员工拓展信息
|
||||
private String parentProjectCode; // 上级项目ID
|
||||
private String parentProjectName; // 上级项目名称
|
||||
private String tripFrontApplyReason; // 行前审批申请原因
|
||||
private String isUpgradeSuccess; // 是否自费升舱
|
||||
private String outMeetingId; // 外部会议ID
|
||||
private String outMeetingName; // 外部会议名称
|
||||
private Integer personalPayStatus; // 转个付支付状态 0:无需支付 1: 待支付 2:支付成功 3:超期未支付
|
||||
private String personalPayTime; // 转个付支付时间
|
||||
private String tokenExtInfo; // 该信息为提交token时,userInfo里的extInfo值
|
||||
private Integer carPool; // 是否拼车,1:拼成 0:未拼成
|
||||
private String enterpriseCustomFields; // 申请单企业自定义字段
|
||||
|
||||
public static AmapCarRefundOrderRecord of(RefundOrderData data) {
|
||||
return BeanCopyUtils.copyBean(data, AmapCarRefundOrderRecord.class);
|
||||
}
|
||||
}
|
|
@ -65,16 +65,6 @@ public class AmapOrderRecordExtensionFactory implements OrderRecordExtensionFact
|
|||
orderStatus = "1";
|
||||
}
|
||||
|
||||
// orderCarRecord.loadBasicOrderInfo(carRecordData.getAmapOrderId(),
|
||||
// orderStatus,
|
||||
// carRecordData.getGmtCreate())
|
||||
// .loadBelongDeport(
|
||||
// routeOrder.stream().flatMap(order ->
|
||||
// Optional.ofNullable(order.getRouterOrderExtensionField().getBelongDeptCode()).stream()
|
||||
// ).findFirst().orElseGet(() ->
|
||||
// userHttpRequest.belongDeport(orderCarRecord.getBookingUserCode(), orderCarRecord.getAccountCompanyName()))
|
||||
// );
|
||||
|
||||
orderCarRecord.loadBasicOrderInfo(carRecordData.getAmapOrderId(),
|
||||
orderStatus,
|
||||
carRecordData.getGmtCreate())
|
||||
|
|
|
@ -0,0 +1,197 @@
|
|||
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.RouterOrderExtensionField;
|
||||
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.OrderHotelRecord;
|
||||
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.amap_order_record.AmapCarRefundOrderRecord;
|
||||
import com.chint.infrastructure.util.DateTimeUtil;
|
||||
import com.chint.interfaces.rest.data_center.user.UserHttpRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.domain.service.supplier.SupplierUtil.getBelongSysType;
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP_FSSC;
|
||||
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||
|
||||
@Component
|
||||
public class AmapRefundOrderRecordExtensionFactory implements OrderRecordExtensionFactory {
|
||||
|
||||
@Autowired
|
||||
private UserHttpRequest userHttpRequest;
|
||||
|
||||
@Override
|
||||
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
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) {
|
||||
AmapCarRefundOrderRecord carRecordData = (AmapCarRefundOrderRecord) orderCarRecordData;
|
||||
OrderCarRecord orderCarRecord = buildWithRecord(orderCarRecordData).carRecord();
|
||||
Optional<OrderDetail> orderDetail = routeOrder
|
||||
.stream()
|
||||
.flatMap(order -> order
|
||||
.getOrderDetails()
|
||||
.stream()
|
||||
.filter(it -> it.getOrderNo().equals(carRecordData.getAmapOrderId())))
|
||||
.findFirst();
|
||||
orderCarRecord.loadBasicOrderInfo(carRecordData.getAmapOrderId(),
|
||||
"3",
|
||||
carRecordData.getGmtCreate())
|
||||
.loadBelongDeport(
|
||||
routeOrder.stream()
|
||||
.flatMap(order ->
|
||||
Optional.of(order)
|
||||
.map(RouteOrder::getRouterOrderExtensionField)
|
||||
.map(RouterOrderExtensionField::getBelongDeptCode)
|
||||
.stream()
|
||||
)
|
||||
.findFirst()
|
||||
.orElseGet(() ->
|
||||
userHttpRequest.belongDeport(orderCarRecord.getBookingUserCode(), orderCarRecord.getAccountCompanyName()))
|
||||
);
|
||||
|
||||
String ds = carRecordData.getDs();
|
||||
//车辆运行时间
|
||||
String gmtCreateStartTime106 = carRecordData.getGmtCreateStartTime106();
|
||||
String gmtCreateEndTime106 = carRecordData.getGmtCreateEndTime106();
|
||||
orderCarRecord.loadTravelInfo(
|
||||
gmtCreateStartTime106,
|
||||
gmtCreateEndTime106,
|
||||
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,
|
||||
"-" + carRecordData.getRefundAmount(),
|
||||
"-" + carRecordData.getRefundAmount()
|
||||
).loadFeeDetails(
|
||||
"",
|
||||
"",
|
||||
KEEP_TWO_DECIMAL_ZERO,
|
||||
KEEP_TWO_DECIMAL_ZERO,
|
||||
KEEP_TWO_DECIMAL_ZERO,
|
||||
"高速费"
|
||||
);
|
||||
orderCarRecord.setNoTaxAmt(carRecordData.getTotalCouponAmount() == 0 ? String.valueOf(carRecordData.getTotalCouponAmount())
|
||||
: "-" + carRecordData.getTotalCouponAmount());
|
||||
orderCarRecord.setTaxAmt(KEEP_TWO_DECIMAL_ZERO);
|
||||
Double enterpriseAmount = carRecordData.getEnterpriseAmount();
|
||||
Double individualAmount = Double.parseDouble(KEEP_TWO_DECIMAL_ZERO);
|
||||
String paymentType;
|
||||
paymentType = "0"; // 全部由企业支付
|
||||
|
||||
String outApplyRecordId = carRecordData.getOutApplyRecordId();
|
||||
String[] split = carRecordData.getRemark().split("-");
|
||||
if (outApplyRecordId == null || outApplyRecordId.isEmpty()) {
|
||||
outApplyRecordId = split[split.length - 1];
|
||||
}
|
||||
orderCarRecord.loadSystemInfo(SUPPLIER_AMAP_FSSC, getBelongSysType(split[4]), split[1], split[0]);
|
||||
//补充遗漏的字段
|
||||
orderCarRecord.setProjectOrderNo(split[2]);
|
||||
orderCarRecord.setOfflineCcomyCode(split[3]);
|
||||
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(1L),
|
||||
carRecordData.getRefundRequestId(),
|
||||
outApplyRecordId,
|
||||
outApplyRecordId,
|
||||
carRecordData.getAmapOrderId(),
|
||||
carRecordData.getAmapOrderId()
|
||||
);
|
||||
//兼容测试环境获取运行时间
|
||||
if (gmtCreateStartTime106 != null && gmtCreateStartTime106.length() > 18 &&
|
||||
gmtCreateEndTime106 != null && gmtCreateEndTime106.length() > 18 &&
|
||||
Double.parseDouble(orderCarRecord.getRunTime()) <= 0) {
|
||||
LocalDateTime runStartTime = DateTimeUtil.strToTime(gmtCreateStartTime106);
|
||||
LocalDateTime runEndTime = DateTimeUtil.strToTime(gmtCreateEndTime106);
|
||||
Duration runtimeDuration = Duration.between(runStartTime, runEndTime);
|
||||
long runtimeInMinutes = runtimeDuration.toMinutes();
|
||||
orderCarRecord.setRunTime(String.valueOf(runtimeInMinutes));
|
||||
}
|
||||
if (Double.parseDouble(orderCarRecord.getRunTime()) <= 0) {
|
||||
orderCarRecord.setRunTime("0");
|
||||
}
|
||||
if (routeOrder.isPresent()) {
|
||||
RouteOrder routeOrderEntity = routeOrder.get();
|
||||
orderCarRecord.setRouteId(routeOrderEntity.getRouteId());
|
||||
}
|
||||
orderDetail.ifPresentOrElse(orderCarRecord::loadComplianceInfo, orderCarRecord::loadComplianceInfoNot);
|
||||
return orderCarRecord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData, Optional<RouteOrder> routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData, Optional<RouteOrder> routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData, Optional<RouteOrder> routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSupplierName() {
|
||||
return amapRefundFactoryMark();
|
||||
}
|
||||
|
||||
public static String amapRefundFactoryMark() {
|
||||
return "Amap_Refund";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.chint.domain.repository;
|
||||
|
||||
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarOrderRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarRefundOrderRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AmapCarRefundOrderRecordRepository {
|
||||
List<AmapCarRefundOrderRecord> saveAll(List<AmapCarRefundOrderRecord> records);
|
||||
List<AmapCarRefundOrderRecord> findByOrderIds(List<String> orderIds);
|
||||
List<AmapCarRefundOrderRecord> findByRefundRequestIdIn(List<String> orderIds);
|
||||
List<AmapCarRefundOrderRecord> findByDs(String ds);
|
||||
List<AmapCarRefundOrderRecord> findByOneDate(String oneDate);
|
||||
List<AmapCarRefundOrderRecord> findByDate(String date);
|
||||
}
|
|
@ -508,7 +508,11 @@ public class OrderDomainService {
|
|||
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
||||
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
|
||||
userHttpRequest.loadUserInfo(user);
|
||||
routeOrder.setStandardLevel(user.getStandardLevel());
|
||||
String standardLevel = user.getStandardLevel();
|
||||
routeOrder.setStandardLevel(standardLevel);
|
||||
for (RouteRequest routeRequest : routeOrder.getRouteRequestList()) {
|
||||
routeRequest.getRouteRequestFields().setStandardLevel(standardLevel);
|
||||
}
|
||||
if ("1".equals(queryData.getExtension())) {
|
||||
Command.of(RouteAutoSyncCommand.class).route(routeOrder).async().sendToQueue();
|
||||
} else {
|
||||
|
|
|
@ -7,10 +7,11 @@ 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.OrderTrainRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarOrderRecord;
|
||||
import com.chint.domain.factoriy.order_record.AmapOrderRecordExtensionFactory;
|
||||
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarRefundOrderRecord;
|
||||
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.repository.AmapCarRefundOrderRecordRepository;
|
||||
import com.chint.domain.service.OrderDetailDomainService;
|
||||
import com.chint.domain.service.RouteRequestDomainService;
|
||||
import com.chint.domain.service.supplier.SupplierAdapterSelector;
|
||||
|
@ -21,13 +22,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.chint.domain.factoriy.order_record.AmapRefundOrderRecordExtensionFactory.amapRefundFactoryMark;
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
||||
|
||||
|
||||
|
@ -38,6 +37,9 @@ public class AmapOrderRecordGenerator implements OrderRecordGenerator {
|
|||
@Autowired
|
||||
private AmapCarOrderRecordRepository aMapCarOrderRecordRepository;
|
||||
|
||||
@Autowired
|
||||
private AmapCarRefundOrderRecordRepository amapCarRefundOrderRecordRepository;
|
||||
|
||||
@Autowired
|
||||
private OrderRecordFactorySelector orderRecordFactorySelector;
|
||||
|
||||
|
@ -50,6 +52,7 @@ public class AmapOrderRecordGenerator implements OrderRecordGenerator {
|
|||
@Autowired
|
||||
private SupplierAdapterSelector supplierAdapterSelector;
|
||||
|
||||
|
||||
@Override
|
||||
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
|
||||
return List.of();
|
||||
|
@ -91,7 +94,26 @@ public class AmapOrderRecordGenerator implements OrderRecordGenerator {
|
|||
|
||||
@Override
|
||||
public List<OrderCarRecord> generateCarRecordMultiParam(OrderRecordGenerateCommand command) {
|
||||
return getOrderCarRecords(command);
|
||||
ArrayList<OrderCarRecord> orderCarRecords = new ArrayList<>(getOrderCarRecords(command));
|
||||
orderCarRecords.addAll(getRefundOrderCarRecords(command));
|
||||
return orderCarRecords;
|
||||
}
|
||||
|
||||
|
||||
private List<OrderCarRecord> getRefundOrderCarRecords(OrderRecordGenerateCommand command) {
|
||||
List<AmapCarRefundOrderRecord> amapCarRefundOrderRecordList;
|
||||
String oneDate = command.getOneDate();
|
||||
String date = command.getDate();
|
||||
if (oneDate != null) {
|
||||
amapCarRefundOrderRecordList = amapCarRefundOrderRecordRepository.findByDs(oneDate);
|
||||
} else amapCarRefundOrderRecordList = amapCarRefundOrderRecordRepository
|
||||
.findByDate(Objects.requireNonNullElseGet(date, () -> DateTimeUtil.timeToStrYYYYMMDD(LocalDateTime.now().minusDays(1))));
|
||||
|
||||
return mapToCarRefundRecord(amapCarRefundOrderRecordList);
|
||||
}
|
||||
|
||||
private List<OrderCarRecord> mapToCarRefundRecord(List<AmapCarRefundOrderRecord> amapCarRefundOrderRecordList) {
|
||||
return mapToCarRecordCommon(amapRefundFactoryMark(), AmapCarRefundOrderRecord::getOutApplyRecordId, amapCarRefundOrderRecordList);
|
||||
}
|
||||
|
||||
private List<OrderCarRecord> getOrderCarRecords(OrderRecordGenerateCommand command) {
|
||||
|
@ -100,22 +122,27 @@ public class AmapOrderRecordGenerator implements OrderRecordGenerator {
|
|||
String date = command.getDate();
|
||||
if (oneDate != null) {
|
||||
amapCarOrderRecordList = aMapCarOrderRecordRepository.findByDs(oneDate);
|
||||
} else
|
||||
amapCarOrderRecordList = aMapCarOrderRecordRepository.findByDate(Objects
|
||||
.requireNonNullElseGet(date, () -> DateTimeUtil.timeToStrYYYYMMDD(LocalDateTime.now().minusDays(1))));
|
||||
} else {
|
||||
amapCarOrderRecordList = aMapCarOrderRecordRepository.findByDate(Objects.requireNonNullElseGet(date,
|
||||
() -> DateTimeUtil.timeToStrYYYYMMDD(LocalDateTime.now().minusDays(1))));
|
||||
}
|
||||
return mapToCarRecord(amapCarOrderRecordList);
|
||||
}
|
||||
|
||||
private List<OrderCarRecord> mapToCarRecord(List<AmapCarOrderRecord> amapCarOrderRecordList) {
|
||||
OrderRecordExtensionFactory orderRecordExtensionFactory = supplierAdapterSelector.of(SUPPLIER_AMAP, OrderRecordExtensionFactory.class);
|
||||
List<String> routeOrderNoList = amapCarOrderRecordList.stream().map(AmapCarOrderRecord::getOutApplyRecordId).distinct().toList();
|
||||
return mapToCarRecordCommon(SUPPLIER_AMAP, AmapCarOrderRecord::getOutApplyRecordId, amapCarOrderRecordList);
|
||||
}
|
||||
|
||||
private <T> List<OrderCarRecord> mapToCarRecordCommon(String supplierName, Function<T, String> function, List<T> dataList) {
|
||||
OrderRecordExtensionFactory orderRecordExtensionFactory = supplierAdapterSelector.of(supplierName, OrderRecordExtensionFactory.class);
|
||||
List<String> routeOrderNoList = dataList.stream().map(function).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
|
||||
List<OrderCarRecord> orderCarRecordList = dataList
|
||||
.parallelStream()
|
||||
.map(it -> orderRecordExtensionFactory.createCarOrderRecord(it, collect.get(it.getOutApplyRecordId())))
|
||||
.map(it -> orderRecordExtensionFactory.createCarOrderRecord(it, collect.get(function.apply(it))))
|
||||
.toList();
|
||||
return orderDetailDomainService.saveCarOrderRecordBatch(orderCarRecordList);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,11 @@ 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.aggregates.order.order_record.amap_order_record.AmapCarRefundOrderRecord;
|
||||
import com.chint.domain.repository.AmapCarOrderRecordRepository;
|
||||
import com.chint.domain.repository.AmapCarRefundOrderRecordRepository;
|
||||
import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse;
|
||||
import com.chint.interfaces.rest.amap.dto.settlement.RefundOrderData;
|
||||
import com.chint.interfaces.rest.amap.request.AmapSettleBillRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -21,6 +24,9 @@ public class AmapOrderRecordPuller implements OrderRecordPuller {
|
|||
@Autowired
|
||||
private AmapCarOrderRecordRepository amapCarOrderRecordRepository;
|
||||
|
||||
@Autowired
|
||||
private AmapCarRefundOrderRecordRepository amapCarRefundOrderRecordRepository;
|
||||
|
||||
@Override
|
||||
public boolean pullTrainOrderRecord(OrderRecordGenerateCommand command) {
|
||||
return false;
|
||||
|
@ -39,24 +45,14 @@ public class AmapOrderRecordPuller implements OrderRecordPuller {
|
|||
@Override
|
||||
public boolean pullCarOrderRecord(OrderRecordGenerateCommand command) {
|
||||
try {
|
||||
List<FinishedOrderResponse.ListElement> listElements;
|
||||
String date = command.getDate();
|
||||
String oneDate = command.getOneDate();
|
||||
if (date != null) {
|
||||
listElements = amapSettleBillRequest.amapRecordByMonth(date);
|
||||
} else if (oneDate != null) {
|
||||
listElements = amapSettleBillRequest.amapRecordByDay(oneDate);
|
||||
} else {
|
||||
listElements = amapSettleBillRequest.amapRecordByDay();
|
||||
}
|
||||
List<String> orderIdList = listElements.stream().map(FinishedOrderResponse.ListElement::getAmapOrderId).toList();
|
||||
List<AmapCarOrderRecord> alreadyExist = amapCarOrderRecordRepository.findByOrderIds(orderIdList);
|
||||
List<AmapCarOrderRecord> list = listElements.parallelStream().map(AmapCarOrderRecord::of).peek(it -> alreadyExist.forEach(already -> {
|
||||
if (already.getAmapOrderId().equals(it.getAmapOrderId())) {
|
||||
it.setId(already.getId());
|
||||
}
|
||||
})).toList();
|
||||
amapCarOrderRecordRepository.saveAll(list);
|
||||
List<FinishedOrderResponse.ListElement> listElements = fetchOrderRecords(command);
|
||||
List<RefundOrderData> refundOrderDataList = fetchRefundRecords(command);
|
||||
|
||||
List<AmapCarOrderRecord> carOrderRecords = mapToCarOrderRecords(listElements);
|
||||
List<AmapCarRefundOrderRecord> carRefundOrderRecords = mapToCarRefundOrderRecords(refundOrderDataList);
|
||||
|
||||
amapCarOrderRecordRepository.saveAll(carOrderRecords);
|
||||
amapCarRefundOrderRecordRepository.saveAll(carRefundOrderRecords);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
|
@ -64,6 +60,60 @@ public class AmapOrderRecordPuller implements OrderRecordPuller {
|
|||
return true;
|
||||
}
|
||||
|
||||
private List<FinishedOrderResponse.ListElement> fetchOrderRecords(OrderRecordGenerateCommand command) {
|
||||
String date = command.getDate();
|
||||
String oneDate = command.getOneDate();
|
||||
if (date != null) {
|
||||
return amapSettleBillRequest.amapRecordByMonth(date);
|
||||
} else if (oneDate != null) {
|
||||
return amapSettleBillRequest.amapRecordByDay(oneDate);
|
||||
} else {
|
||||
return amapSettleBillRequest.amapRecordByDay();
|
||||
}
|
||||
}
|
||||
|
||||
private List<RefundOrderData> fetchRefundRecords(OrderRecordGenerateCommand command) {
|
||||
String date = command.getDate();
|
||||
String oneDate = command.getOneDate();
|
||||
if (date != null) {
|
||||
return amapSettleBillRequest.amapRefundRecordByMonth(date);
|
||||
} else if (oneDate != null) {
|
||||
return amapSettleBillRequest.amapRefundRecordByDay(oneDate);
|
||||
} else {
|
||||
return amapSettleBillRequest.amapRefundRecordByDay();
|
||||
}
|
||||
}
|
||||
|
||||
private List<AmapCarOrderRecord> mapToCarOrderRecords(List<FinishedOrderResponse.ListElement> listElements) {
|
||||
List<String> orderIdList = listElements.stream()
|
||||
.map(FinishedOrderResponse.ListElement::getAmapOrderId)
|
||||
.toList();
|
||||
List<AmapCarOrderRecord> alreadyExist = amapCarOrderRecordRepository.findByOrderIds(orderIdList);
|
||||
return listElements.parallelStream()
|
||||
.map(AmapCarOrderRecord::of)
|
||||
.peek(it -> alreadyExist.forEach(already -> {
|
||||
if (already.getAmapOrderId().equals(it.getAmapOrderId())) {
|
||||
it.setId(already.getId());
|
||||
}
|
||||
}))
|
||||
.toList();
|
||||
}
|
||||
|
||||
private List<AmapCarRefundOrderRecord> mapToCarRefundOrderRecords(List<RefundOrderData> refundOrderDataList) {
|
||||
List<String> refundOrderIdList = refundOrderDataList.stream()
|
||||
.map(RefundOrderData::getRefundRequestId)
|
||||
.toList();
|
||||
List<AmapCarRefundOrderRecord> byRefundRequestIdIn = amapCarRefundOrderRecordRepository.findByRefundRequestIdIn(refundOrderIdList);
|
||||
return refundOrderDataList.stream()
|
||||
.map(AmapCarRefundOrderRecord::of)
|
||||
.peek(it -> byRefundRequestIdIn.forEach(already -> {
|
||||
if (already.getRefundRequestId().equals(it.getRefundRequestId())) {
|
||||
it.setId(already.getId());
|
||||
}
|
||||
}))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSupplierName() {
|
||||
return SUPPLIER_AMAP;
|
||||
|
|
|
@ -12,6 +12,7 @@ public class AmapConstant {
|
|||
//订单详情地址
|
||||
public static final String ORDER_DETAIL_URL = "/ws/car/open/enterprise/order/detail";
|
||||
public static final String FINISHED_ORDER_URL = "/ws/car/open/enterprise/bill/detail/list";//企业完单数据分页查询
|
||||
public static final String REFUND_ORDER_URL = "/ws/car/open/enterprise/bill/detail/refund";//企业退单数据分页查询
|
||||
public static final String CANCEL_AN_ORDER_URL = "/ws/car/open/enterprise/cancelOrder";//取消订单
|
||||
|
||||
//订单详情地址,查询城市信息
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.chint.infrastructure.repository;
|
||||
|
||||
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarOrderRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarRefundOrderRecord;
|
||||
import com.chint.domain.repository.AmapCarRefundOrderRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcAmapCarRefundOrderRecordRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class AmapCarRefundOrderRecordRepositoryImpl implements AmapCarRefundOrderRecordRepository {
|
||||
|
||||
@Autowired
|
||||
private JdbcAmapCarRefundOrderRecordRepository jdbcAmapCarRefundOrderRecordRepository;
|
||||
|
||||
@Override
|
||||
public List<AmapCarRefundOrderRecord> saveAll(List<AmapCarRefundOrderRecord> records) {
|
||||
List<AmapCarRefundOrderRecord> res = new ArrayList<>();
|
||||
jdbcAmapCarRefundOrderRecordRepository.saveAll(records).forEach(res::add);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AmapCarRefundOrderRecord> findByOrderIds(List<String> orderIds) {
|
||||
return jdbcAmapCarRefundOrderRecordRepository.findByAmapOrderIdIn(orderIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AmapCarRefundOrderRecord> findByRefundRequestIdIn(List<String> orderIds) {
|
||||
return jdbcAmapCarRefundOrderRecordRepository.findByRefundRequestIdIn(orderIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AmapCarRefundOrderRecord> findByDs(String ds) {
|
||||
return jdbcAmapCarRefundOrderRecordRepository.findByDsContaining(ds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AmapCarRefundOrderRecord> findByOneDate(String oneDate) {
|
||||
return jdbcAmapCarRefundOrderRecordRepository.findByDs(oneDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AmapCarRefundOrderRecord> findByDate(String date) {
|
||||
return jdbcAmapCarRefundOrderRecordRepository.findByDsContaining(date);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
import com.chint.domain.aggregates.order.order_record.amap_order_record.AmapCarRefundOrderRecord;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface JdbcAmapCarRefundOrderRecordRepository extends CrudRepository<AmapCarRefundOrderRecord, Long> {
|
||||
List<AmapCarRefundOrderRecord> findByDsContaining(String ds);
|
||||
|
||||
List<AmapCarRefundOrderRecord> findByDs(String ds);
|
||||
|
||||
List<AmapCarRefundOrderRecord> findByAmapOrderIdIn(Collection<String> amapOrderId);
|
||||
|
||||
List<AmapCarRefundOrderRecord> findByRefundRequestIdIn(Collection<String> refundRequestId);
|
||||
}
|
||||
|
|
@ -10,6 +10,14 @@ import java.util.List;
|
|||
public class FinishedOrderResponse extends BaseResponse {
|
||||
private Data data;
|
||||
|
||||
public List<ListElement> getDataList() {
|
||||
return this.getData().getList();
|
||||
}
|
||||
|
||||
public Boolean hasNextPage() {
|
||||
return this.getData().getHasNextPage();
|
||||
}
|
||||
|
||||
@lombok.Data
|
||||
public static class Data {
|
||||
private Boolean hasNextPage;//是否有下一页
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.chint.interfaces.rest.amap.BaseRequestParam;
|
|||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FinishedOrderDto extends BaseRequestParam {
|
||||
public class OrderQueryDto extends BaseRequestParam {
|
||||
private Integer pageNum;//查询页码
|
||||
private Integer pageSize;//页面数据条数 默认20,最大值100
|
||||
//dsStart和dsEnd时间跨度最大为1个月,dsStart和dsEnd相同时查询1天的账单
|
|
@ -0,0 +1,88 @@
|
|||
package com.chint.interfaces.rest.amap.dto.settlement;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RefundOrderData {
|
||||
private String amapOrderId; // 订单号
|
||||
private String gmtCreate; // 下单时间:2022-09-19 08:27:39
|
||||
private String refundSuccessTime; // 退款成功时间:2022-09-19 16:34:17
|
||||
private String refundAmount; // 退款金额,单位:元
|
||||
private String refundRequestId; // 退款请求id
|
||||
private String payType; // 退款支付类型:企业/个人
|
||||
private String eName; // 企业名称
|
||||
private String eId; // 企业id
|
||||
private String cpAmapId; // 高德子订单号
|
||||
private String cpOrderId; // 商户订单号
|
||||
private String amapRideType; // 运力类型
|
||||
private String cpCode; // 商户id
|
||||
private String cpName; // 商户名称
|
||||
private String userId; // 高德账号
|
||||
private String eUserId; // 企业员工id
|
||||
private String realName; // 企业员工姓名
|
||||
private String financeCostcenterCode; // 成本中心编号
|
||||
private String financeCostcenterDesc; // 成本中心描述
|
||||
private String dep1; // 1级部门
|
||||
private String dep2; // 2级部门
|
||||
private String dep3; // 3级部门
|
||||
private String dep4; // 4级部门
|
||||
private String dep5; // 5级部门
|
||||
private String dep6; // 6级部门
|
||||
private String dep7; // 7级部门
|
||||
private String dep8; // 8级部门
|
||||
private String dep9; // 9级部门
|
||||
private String dep10; // 10级部门
|
||||
private String dep11; // 11级部门
|
||||
private String dep12; // 12级部门
|
||||
private String dep13; // 13级部门
|
||||
private String dep14; // 14级部门
|
||||
private String dep15; // 15级部门
|
||||
private String cityName; // 起点城市
|
||||
private String startName; // 起点名称
|
||||
private String endCity; // 终点城市
|
||||
private String endName; // 终点名称
|
||||
private String regulationName; // 用车制度名称
|
||||
private double mileage; // 订单总里程,单位:km
|
||||
private double estimateMileage; // 订单预估里程,单位:km
|
||||
private double estimatePrice; // 预估金额,单位:元
|
||||
private String isChangeFee; // 是否改价(改价、未改价)
|
||||
private String isCancelFeeOrder; // 是否为取消费订单(取消费订单、非取消费订单)
|
||||
private String remark; // 用车备注
|
||||
private String resultType; // 审批结果类型
|
||||
private String result; // 审批结果
|
||||
private String processStatus; // 审批状态:新创建、yu
|
||||
private String approvalSecondType; // 审批类型:0-行前审批;1-行后审批;2-因公转企付审批
|
||||
private String approvalEUserId; // 审批人ID
|
||||
private String approvalUserName; // 审批人姓名
|
||||
private String ds; // 日期:20220913
|
||||
private String gmtCreateStartTime106; // 开始计费时间:2022-09-19 08:27:39
|
||||
private String gmtCreateEndTime106; // 结束计费时间:2022-09-19 08:27:39
|
||||
private double totalCouponAmount; // 优惠总金额
|
||||
private String departTime; // 计划用车时间:2022-09-19 08:27:39
|
||||
private String gmtCreate103; // 司机接单时间:2022-09-19 08:27:39
|
||||
private String gmtCreate104; // 司机到达上车点时间:2022-09-19 08:27:39
|
||||
private String cardId; // 员工cardID
|
||||
private String projectCode; // 外部项目code
|
||||
private String departmentId; // 部门编号
|
||||
private String orderRelyId; // 用车申请凭证ID
|
||||
private String orderRely; // 用车凭证
|
||||
private String outApplyRecordId; // 外部申请单单号
|
||||
private String applyRecordId; // 申请单ID
|
||||
private Integer orderEnterance; // 发单入口:0-实时; 1-预约; 2-接机; 3-送机; 4-接站; 5-送站 ;8-代驾 ;10-代叫实时; 11-代叫预约; 12-代叫接机; 13-代叫送机; 14-代叫接站; 15-代叫送站
|
||||
private String autoEnterprisePay; // 是否超时自动转企业支付:是/否
|
||||
private String relationEntId; // 关联企业Id
|
||||
private String relationEntName; // 关联企业名称
|
||||
private String signCompanyName; // 订单签约主体
|
||||
private String entStaffExtInfo; // 企业员工拓展信息
|
||||
private String parentProjectCode; // 上级项目ID
|
||||
private String parentProjectName; // 上级项目名称
|
||||
private String tripFrontApplyReason; // 行前审批申请原因
|
||||
private String isUpgradeSuccess; // 是否自费升舱
|
||||
private String outMeetingId; // 外部会议ID
|
||||
private String outMeetingName; // 外部会议名称
|
||||
private Integer personalPayStatus; // 转个付支付状态 0:无需支付 1: 待支付 2:支付成功 3:超期未支付
|
||||
private String personalPayTime; // 转个付支付时间
|
||||
private String tokenExtInfo; // 该信息为提交token时,userInfo里的extInfo值
|
||||
private Integer carPool; // 是否拼车,1:拼成 0:未拼成
|
||||
private String enterpriseCustomFields; // 申请单企业自定义字段
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.chint.interfaces.rest.amap.dto.settlement;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RefundOrderParam {
|
||||
private Integer pageNum;//查询页码
|
||||
private Integer pageSize;//页面数据条数 默认20,最大值100
|
||||
//dsStart和dsEnd时间跨度最大为1个月,dsStart和dsEnd相同时查询1天的账单
|
||||
private String dsStart;//开始支付时间 格式:20210101
|
||||
private String dsEnd;//结束支付时间 格式:20210101
|
||||
private Integer subEid;//关联企业id
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.chint.interfaces.rest.amap.dto.settlement;
|
||||
|
||||
import com.chint.interfaces.rest.amap.BaseResponse;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RefundOrderResponse extends BaseResponse {
|
||||
private boolean result; // 结果状态
|
||||
private String version; // 版本
|
||||
private ResponseData data; // 数据部分
|
||||
|
||||
public List<RefundOrderData> getDataList() {
|
||||
return this.getData().getList();
|
||||
}
|
||||
|
||||
public Boolean hasNextPage() {
|
||||
return this.getData().getHasNextPage();
|
||||
}
|
||||
|
||||
@Data
|
||||
private static class ResponseData {
|
||||
private Boolean hasNextPage;
|
||||
private Boolean hasPreviousPage;
|
||||
private List<RefundOrderData> list;
|
||||
}
|
||||
}
|
|
@ -1,18 +1,21 @@
|
|||
package com.chint.interfaces.rest.amap.request;
|
||||
|
||||
import com.chint.infrastructure.util.DateTimeUtil;
|
||||
import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderDto;
|
||||
import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse;
|
||||
import com.chint.interfaces.rest.amap.dto.settlement.OrderQueryDto;
|
||||
import com.chint.interfaces.rest.amap.dto.settlement.RefundOrderData;
|
||||
import com.chint.interfaces.rest.amap.dto.settlement.RefundOrderResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static com.chint.infrastructure.constant.AmapConstant.FINISHED_ORDER_URL;
|
||||
import static com.chint.infrastructure.constant.AmapConstant.REFUND_ORDER_URL;
|
||||
|
||||
@Component
|
||||
public class AmapSettleBillRequest {
|
||||
|
@ -28,28 +31,62 @@ public class AmapSettleBillRequest {
|
|||
* @return
|
||||
*/
|
||||
public List<FinishedOrderResponse.ListElement> pageFinishedOrder(String dsStart, String dsEnd) {
|
||||
List<FinishedOrderResponse.ListElement> result = new ArrayList<>();
|
||||
FinishedOrderDto finishedOrderDto = new FinishedOrderDto();
|
||||
finishedOrderDto.setDsStart(dsStart);
|
||||
finishedOrderDto.setDsEnd(dsEnd);
|
||||
int page = 1;
|
||||
boolean flag;//默认false
|
||||
finishedOrderDto.setPageSize(100);
|
||||
do {
|
||||
finishedOrderDto.setPageNum(page);
|
||||
FinishedOrderResponse finishedOrderResponse = amapRequest
|
||||
.post(baseUrl + FINISHED_ORDER_URL, finishedOrderDto, FinishedOrderResponse.class);
|
||||
FinishedOrderResponse.Data data = finishedOrderResponse.getData();
|
||||
if (data != null && data.getList() != null && !data.getList().isEmpty()) {
|
||||
result.addAll(data.getList());
|
||||
return pageOrder(dsStart, dsEnd, baseUrl + FINISHED_ORDER_URL, FinishedOrderResponse.class,
|
||||
FinishedOrderResponse::getDataList,
|
||||
FinishedOrderResponse::hasNextPage);
|
||||
// List<FinishedOrderResponse.ListElement> result = new ArrayList<>();
|
||||
// OrderQueryDto finishedOrderDto = new OrderQueryDto();
|
||||
// finishedOrderDto.setDsStart(dsStart);
|
||||
// finishedOrderDto.setDsEnd(dsEnd);
|
||||
// int page = 1;
|
||||
// boolean flag;//默认false
|
||||
// finishedOrderDto.setPageSize(100);
|
||||
// do {
|
||||
// finishedOrderDto.setPageNum(page);
|
||||
// FinishedOrderResponse finishedOrderResponse = amapRequest
|
||||
// .post(baseUrl + FINISHED_ORDER_URL, finishedOrderDto, FinishedOrderResponse.class);
|
||||
// FinishedOrderResponse.Data data = finishedOrderResponse.getData();
|
||||
// if (data != null && data.getList() != null && !data.getList().isEmpty()) {
|
||||
// result.addAll(data.getList());
|
||||
// }
|
||||
// flag = data.getHasNextPage();//是否有下一页
|
||||
// page++;
|
||||
// } while (flag);
|
||||
// return result;
|
||||
}
|
||||
flag = data.getHasNextPage();//是否有下一页
|
||||
|
||||
public List<RefundOrderData> pageRefundOrder(String dsStart, String dsEnd) {
|
||||
return pageOrder(dsStart, dsEnd, baseUrl + REFUND_ORDER_URL, RefundOrderResponse.class,
|
||||
RefundOrderResponse::getDataList,
|
||||
RefundOrderResponse::hasNextPage);
|
||||
}
|
||||
|
||||
public <T, R> List<T> pageOrder(String dsStart,
|
||||
String dsEnd,
|
||||
String url,
|
||||
Class<R> clazz,
|
||||
Function<R, List<T>> function,
|
||||
Function<R, Boolean> function2) {
|
||||
List<T> result = new ArrayList<>();
|
||||
OrderQueryDto orderQueryDto = new OrderQueryDto();
|
||||
orderQueryDto.setDsStart(dsStart);
|
||||
orderQueryDto.setDsEnd(dsEnd);
|
||||
int page = 1;
|
||||
boolean flag;
|
||||
orderQueryDto.setPageSize(100);
|
||||
do {
|
||||
orderQueryDto.setPageNum(page);
|
||||
R response = amapRequest.post(url, orderQueryDto, clazz);
|
||||
List<T> list = function.apply(response);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
result.addAll(list);
|
||||
}
|
||||
flag = function2.apply(response);
|
||||
page++;
|
||||
} while (flag);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public List<FinishedOrderResponse.ListElement> amapRecordLastMonth() {
|
||||
String lastMonthStr = DateTimeUtil.lastMonthStr();
|
||||
String firstDayOfMonth = DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.firstDayOfMonth(lastMonthStr));
|
||||
|
@ -74,4 +111,22 @@ public class AmapSettleBillRequest {
|
|||
LocalDateTime yesterday = localDateTime.minusDays(1).toLocalDate().atStartOfDay();
|
||||
return pageFinishedOrder(DateTimeUtil.timeToStrYYYYMMDD(yesterday), DateTimeUtil.timeToStrYYYYMMDD(localDateTime));
|
||||
}
|
||||
|
||||
public List<RefundOrderData> amapRefundRecordByMonth(String date) {
|
||||
String firstDayOfMonth = DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.firstDayOfMonth(date));
|
||||
String endDayOfMonth = DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.endDayOfMonth(date));
|
||||
return pageRefundOrder(firstDayOfMonth, endDayOfMonth);
|
||||
}
|
||||
|
||||
public List<RefundOrderData> amapRefundRecordByDay() {
|
||||
LocalDateTime today = LocalDateTime.now();
|
||||
LocalDateTime yesterday = today.minusDays(1).toLocalDate().atStartOfDay();
|
||||
return pageRefundOrder(DateTimeUtil.timeToStrYYYYMMDD(yesterday), DateTimeUtil.timeToStrYYYYMMDD(today));
|
||||
}
|
||||
|
||||
public List<RefundOrderData> amapRefundRecordByDay(String date) {
|
||||
LocalDateTime localDateTime = DateTimeUtil.strToTimeYYYYMMDD(date);
|
||||
LocalDateTime yesterday = localDateTime.minusDays(1).toLocalDate().atStartOfDay();
|
||||
return pageRefundOrder(DateTimeUtil.timeToStrYYYYMMDD(yesterday), DateTimeUtil.timeToStrYYYYMMDD(localDateTime));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,14 +118,13 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
|||
.findRankNameByEmployNoAndJTCompany(user.getEmployeeNo(), user.getCompanyCode())
|
||||
.flatMap(it -> it.stream().findFirst());
|
||||
if (staffRank.isPresent()) {
|
||||
rankName = staffRank.get().getEmployeeLevel();
|
||||
//如果存在自定义职级,那么就开始比较职级大小
|
||||
//这里执行rank排序规则
|
||||
Optional<RanksOrder> max = ranksOrderRepository
|
||||
.findByRankNameIn(new HashSet<>(List.of(rankName, staffRank.get().getEmployeeLevel())))
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.max(Comparator.comparing(RanksOrder::getRankOrderValue));
|
||||
.max(Comparator.comparingInt(RanksOrder::getRankOrderValue));
|
||||
if (max.isPresent()) {
|
||||
rankName = max.get().getRankName();
|
||||
}
|
||||
|
|
|
@ -13,20 +13,21 @@ import com.chint.interfaces.rest.amap.BaseResponse;
|
|||
import com.chint.interfaces.rest.amap.dto.UserQueryResponse;
|
||||
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.settlement.OrderQueryDto;
|
||||
import com.chint.interfaces.rest.amap.dto.settlement.RefundOrderResponse;
|
||||
import com.chint.interfaces.rest.amap.dto.token.TokenResponse;
|
||||
import com.chint.interfaces.rest.amap.request.AmapOrderDetailRequest;
|
||||
import com.chint.interfaces.rest.amap.request.AmapSettleBillRequest;
|
||||
import com.chint.interfaces.rest.amap.request.TakeCarRequest;
|
||||
import com.chint.interfaces.rest.amap.request.TokenRequest;
|
||||
import com.chint.interfaces.rest.amap.request.*;
|
||||
import com.chint.interfaces.rest.base.dto.H5LoginResponse;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.google.gson.Gson;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.AmapConstant.REFUND_ORDER_URL;
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
|
||||
|
||||
@SpringBootTest
|
||||
|
@ -47,6 +48,12 @@ public class AmapTest {
|
|||
@Autowired
|
||||
private AmapPolicyRepository amapPolicyRepository;
|
||||
|
||||
@Autowired
|
||||
private AmapRequest amapRequest;
|
||||
|
||||
@Value("${amap.baseUrl}")
|
||||
private String baseUrl;
|
||||
|
||||
private Gson gson = new Gson();
|
||||
|
||||
private User user = new User(1L, "230615020", 1, "卢麟哲", "lulz1@chint.com", "15857193365", "A30000001");
|
||||
|
@ -108,6 +115,19 @@ public class AmapTest {
|
|||
// List<FinishedOrderResponse> responses = settleBillRequest.pageFinishedOrder("20240401", "20240431");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pageRefundOrder(){
|
||||
OrderQueryDto orderQueryDto = new OrderQueryDto();
|
||||
orderQueryDto.setDsStart("20240601");
|
||||
orderQueryDto.setDsEnd("20240630");
|
||||
int page = 1;
|
||||
boolean flag;
|
||||
orderQueryDto.setPageNum(page);
|
||||
orderQueryDto.setPageSize(100);
|
||||
RefundOrderResponse post = amapRequest.post(baseUrl + REFUND_ORDER_URL, orderQueryDto, RefundOrderResponse.class);
|
||||
System.out.println(post);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createUser() {
|
||||
BaseResponse baseResponse = amapUserRequest.createUser(user2);
|
||||
|
|
|
@ -251,7 +251,7 @@ public class CTripTest {
|
|||
void search() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
//todo ActualDepartureTime用实际离店时间判断退款间夜数
|
||||
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("32408533878");
|
||||
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("32275803493");
|
||||
System.out.println(response);
|
||||
}
|
||||
|
||||
|
|
|
@ -821,7 +821,7 @@ public class LYTest {
|
|||
|
||||
@Test
|
||||
void searchTrain() {
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24061677314144436");
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24070980157596312");
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(trainOrderDetail);
|
||||
System.out.println(json);
|
||||
|
|
|
@ -314,7 +314,7 @@ class RouteApplicationTests {
|
|||
|
||||
@Test
|
||||
void loginSign() {
|
||||
String sfno = "231213086";
|
||||
String sfno = "231220053";
|
||||
String syscode = "FSSC";
|
||||
String billcode = "CLSQ240225000100";
|
||||
String companycode = "正泰集团股份有限公司";
|
||||
|
@ -325,7 +325,7 @@ class RouteApplicationTests {
|
|||
|
||||
@Test
|
||||
void loginSignProd() {
|
||||
String sfno = "240102037";
|
||||
String sfno = "231220053";
|
||||
String syscode = "FSSC";
|
||||
String billcode = "CLSQ240225000100";
|
||||
String companycode = "正泰集团股份有限公司";
|
||||
|
|
Loading…
Reference in New Issue