fix:补充高德消费明细回推缺少的字段
This commit is contained in:
parent
26f667a827
commit
0b98847092
|
@ -8,8 +8,6 @@ import org.springframework.data.relational.core.mapping.Table;
|
|||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
|
@ -51,7 +49,7 @@ public class UserDepartmentInfo implements Serializable {
|
|||
private String custQualityLevel;
|
||||
private String status;
|
||||
|
||||
public boolean ifPrimary(){
|
||||
public boolean ifPrimary() {
|
||||
return ifPrimary == 1;
|
||||
}
|
||||
|
||||
|
@ -256,4 +254,14 @@ public class UserDepartmentInfo implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean checkIfIn(String orgShortCode) {
|
||||
return this.companyCode.contains(orgShortCode) ||
|
||||
this.departmentCodeOne.contains(orgShortCode) ||
|
||||
this.departmentCodeTwo.contains(orgShortCode) ||
|
||||
this.departmentCodeThree.contains(orgShortCode) ||
|
||||
this.departmentCodeFour.contains(orgShortCode) ||
|
||||
this.departmentCodeFive.contains(orgShortCode) ||
|
||||
this.departmentCodeSix.contains(orgShortCode) ||
|
||||
this.departmentCodeSeven.contains(orgShortCode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,12 @@ package com.chint.domain.factoriy.order_detail;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.aggregates.user.UserDepartmentInfo;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.service.RouteRequestDomainService;
|
||||
import com.chint.infrastructure.util.BigDecimalCalculator;
|
||||
import com.chint.interfaces.rest.amap.dto.detail.AmapOrderDetailResponse;
|
||||
import com.chint.interfaces.rest.amap.request.AmapOrderDetailRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -14,9 +16,12 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.BelongSystemConstant.TRAVAL_SYS_TYPE_AMAP;
|
||||
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_CAR_STATUS_SUCCESS;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP_CN_NAME;
|
||||
import static com.chint.interfaces.rest.amap.util.AmapStatusUtil.mapFSSCOrderStatus;
|
||||
|
||||
|
||||
|
@ -54,6 +59,20 @@ public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
RouteOrder routeOrder = routeRequestDomainService.getRouteOrder(data.getRequestRouterNo());
|
||||
|
||||
CarOrderDetail carOrderDetail = BeanUtil.copyProperties(orderDetailFactory.buildWithRouteOrder(routeOrder), CarOrderDetail.class);
|
||||
|
||||
routeOrder.getOrderDetails()
|
||||
.stream()
|
||||
.filter(it -> it.getOrderNo().equals(orderNo))
|
||||
.findFirst()
|
||||
.ifPresent(orderDetail -> orderDetail.getOrderEventList()
|
||||
.stream()
|
||||
.filter(it -> it.getEventType().equals(ORDER_EVENT_ETA))
|
||||
.findFirst()
|
||||
.ifPresentOrElse(it -> {
|
||||
carOrderDetail.setOverStandard("是");
|
||||
carOrderDetail.setOverStandardReason(it.getExtension());
|
||||
}, () -> carOrderDetail.setOverStandard("否")));
|
||||
|
||||
carOrderDetail.setOrderNo(orderNo);
|
||||
carOrderDetail.setDetailId(orderNo);
|
||||
|
||||
|
@ -62,11 +81,27 @@ public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
carOrderDetail.setBookingName(user.getName());
|
||||
carOrderDetail.setBookingUserPhone(data.getMobile());
|
||||
|
||||
|
||||
List<UserDepartmentInfo> userDepartmentInfoList = user.getUserDepartmentInfoList();
|
||||
UserDepartmentInfo userDepartmentInfo = userDepartmentInfoList.stream().filter(it -> it.checkIfIn(routeOrder.getRouterOrderExtensionField().getBelongDeptCode()))
|
||||
.findFirst()
|
||||
.orElseGet(() -> userDepartmentInfoList.stream().filter(UserDepartmentInfo::ifPrimary).findFirst().orElse(null));
|
||||
|
||||
if (userDepartmentInfo != null) {
|
||||
carOrderDetail.setBOOK_ORG_STRUCT_1(userDepartmentInfo.getCompanyName());
|
||||
carOrderDetail.setBOOK_ORG_STRUCT_2(userDepartmentInfo.getDepartmentNameOne());
|
||||
carOrderDetail.setBOOK_ORG_STRUCT_3(userDepartmentInfo.getDepartmentNameTwo());
|
||||
}
|
||||
|
||||
|
||||
//这里要更新用车的状态
|
||||
carOrderDetail.setOrderStatus(mapFSSCOrderStatus(data.getShowStatus()));
|
||||
|
||||
carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_AMAP);
|
||||
return updateCarOrderDetailData(carOrderDetail, carOrderDetailData);
|
||||
updateCarOrderDetailData(carOrderDetail, carOrderDetailData);
|
||||
if (carOrderDetail.getUserName() == null) {
|
||||
carOrderDetail.setUserName(user.getName());
|
||||
}
|
||||
return carOrderDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,8 +118,8 @@ public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
//金额
|
||||
BigDecimal amountCent = BigDecimal.valueOf(data.getEnterpriseAmount() + data.getPersonAmount());
|
||||
carOrderDetail.setOrderAmount(String.valueOf(amountCent.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP)));
|
||||
carOrderDetail.setCompanyPaymentAmount(String.valueOf(data.getEnterpriseAmount()));
|
||||
carOrderDetail.setPersonalPaymentAmount(String.valueOf(data.getPersonAmount()));
|
||||
carOrderDetail.setCompanyPaymentAmount(BigDecimalCalculator.divide(String.valueOf(data.getEnterpriseAmount()), "100"));
|
||||
carOrderDetail.setPersonalPaymentAmount(BigDecimalCalculator.divide(String.valueOf(data.getPersonAmount()), "100"));
|
||||
|
||||
if (data.getPersonAmount() == 0 && data.getEnterpriseAmount() > 0) {
|
||||
carOrderDetail.setPaymentType("0");
|
||||
|
@ -111,6 +146,8 @@ public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
carOrderDetail.setToCity(data.getEndCity());
|
||||
carOrderDetail.setCarModel(data.getCarType());
|
||||
}
|
||||
|
||||
carOrderDetail.setSupplier(SUPPLIER_AMAP_CN_NAME);
|
||||
return carOrderDetail;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,13 +63,6 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
|
|||
baseOrderExtension.setBookingName(user.getName());
|
||||
baseOrderExtension.setBookingUserPhone(user.getPhoneNumber());
|
||||
|
||||
//配置供应商信息
|
||||
// String supplierName = routeOrder.getSupplierName();
|
||||
// if (supplierName.equals(SUPPLIER_C_TRIP)) {
|
||||
// baseOrderExtension.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
|
||||
// } else {
|
||||
// baseOrderExtension.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
|
||||
// }
|
||||
|
||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||
if (approveOrderNo != null) {
|
||||
|
|
|
@ -29,6 +29,10 @@ public class AmapOrderRecordExtensionFactory implements OrderRecordExtensionFact
|
|||
@Override
|
||||
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
|
||||
FinishedOrderResponse.ListElement carRecordData = (FinishedOrderResponse.ListElement) orderCarRecordData;
|
||||
OrderRecordBasic orderRecordBasic = new OrderRecordBasic();
|
||||
// orderRecordBasic.loadBookingInfo(
|
||||
//
|
||||
// )
|
||||
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue