From f848633d896fd5d0f261e5426907a5e7498ced2f Mon Sep 17 00:00:00 2001 From: lulz1 Date: Fri, 21 Jun 2024 17:19:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E5=BD=92=E5=B1=9E=E9=83=A8=E9=97=A8=E6=97=B6=E9=AB=98=E5=BE=B7?= =?UTF-8?q?=E6=B6=88=E8=B4=B9=E6=98=8E=E7=BB=86=E5=9B=9E=E6=8E=A8=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AmapOrderExtensionFactoryImpl.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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());