fix: 修复缺少归属部门时高德消费明细回推的bug

This commit is contained in:
lulz1 2024-06-21 17:19:00 +08:00
parent 91746a727d
commit f848633d89
1 changed files with 11 additions and 7 deletions

View File

@ -4,13 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.aggregates.user.UserDepartmentInfo; 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.repository.UserRepository;
import com.chint.domain.service.RouteRequestDomainService; import com.chint.domain.service.RouteRequestDomainService;
import com.chint.infrastructure.util.BigDecimalCalculator; import com.chint.infrastructure.util.BigDecimalCalculator;
import com.chint.interfaces.rest.amap.dto.detail.AmapOrderDetailResponse; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -99,10 +96,17 @@ public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory {
carOrderDetail.setBookingUserPhone(data.getMobile()); carOrderDetail.setBookingUserPhone(data.getMobile());
List<UserDepartmentInfo> userDepartmentInfoList = user.getUserDepartmentInfoList(); List<UserDepartmentInfo> userDepartmentInfoList = user.getUserDepartmentInfoList();
UserDepartmentInfo userDepartmentInfo = userDepartmentInfoList.stream()
UserDepartmentInfo userDepartmentInfo;
if (routeOrder.getRouterOrderExtensionField() != null && routeOrder.getRouterOrderExtensionField().getBelongDeptCode() != null) {
userDepartmentInfo = userDepartmentInfoList.stream()
.filter(it -> it.checkIfIn(routeOrder.getRouterOrderExtensionField().getBelongDeptCode())) .filter(it -> it.checkIfIn(routeOrder.getRouterOrderExtensionField().getBelongDeptCode()))
.findFirst() .findFirst()
.orElseGet(() -> userDepartmentInfoList.stream().filter(UserDepartmentInfo::ifPrimary).findFirst().orElse(null)); .orElseGet(() -> userDepartmentInfoList.stream().filter(UserDepartmentInfo::ifPrimary).findFirst().orElse(null));
} else {
userDepartmentInfo = userDepartmentInfoList.stream().filter(UserDepartmentInfo::ifPrimary).findFirst().orElse(null);
}
if (userDepartmentInfo != null) { if (userDepartmentInfo != null) {
carOrderDetail.setBOOK_ORG_STRUCT_1(userDepartmentInfo.getCompanyName()); carOrderDetail.setBOOK_ORG_STRUCT_1(userDepartmentInfo.getCompanyName());