diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/AmapOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/AmapOrderExtensionFactoryImpl.java index 6bd0dba5..4598c8ea 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/AmapOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/AmapOrderExtensionFactoryImpl.java @@ -4,13 +4,10 @@ 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; import org.springframework.stereotype.Component; @@ -99,10 +96,17 @@ public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory { carOrderDetail.setBookingUserPhone(data.getMobile()); List userDepartmentInfoList = user.getUserDepartmentInfoList(); - UserDepartmentInfo userDepartmentInfo = userDepartmentInfoList.stream() - .filter(it -> it.checkIfIn(routeOrder.getRouterOrderExtensionField().getBelongDeptCode())) - .findFirst() - .orElseGet(() -> userDepartmentInfoList.stream().filter(UserDepartmentInfo::ifPrimary).findFirst().orElse(null)); + + UserDepartmentInfo userDepartmentInfo; + if (routeOrder.getRouterOrderExtensionField() != null && routeOrder.getRouterOrderExtensionField().getBelongDeptCode() != null) { + userDepartmentInfo = userDepartmentInfoList.stream() + .filter(it -> it.checkIfIn(routeOrder.getRouterOrderExtensionField().getBelongDeptCode())) + .findFirst() + .orElseGet(() -> userDepartmentInfoList.stream().filter(UserDepartmentInfo::ifPrimary).findFirst().orElse(null)); + } else { + userDepartmentInfo = userDepartmentInfoList.stream().filter(UserDepartmentInfo::ifPrimary).findFirst().orElse(null); + } + if (userDepartmentInfo != null) { carOrderDetail.setBOOK_ORG_STRUCT_1(userDepartmentInfo.getCompanyName());