From 199ca54ad688bf3b41dccb9515c294c56278d139 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Sun, 7 Apr 2024 09:25:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=86=8D=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=83=A8=E9=97=A8=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order_record/OrderCarRecord.java | 10 ++------ .../order/order_record/OrderFlightRecord.java | 4 ++-- .../order/order_record/OrderHotelRecord.java | 4 ++-- .../order/order_record/OrderTrainRecord.java | 4 ++-- .../CTripOrderRecordExtensionFactory.java | 2 +- .../interfaces/rest/user/UserHttpRequest.java | 2 ++ .../rest/user/UserHttpRequestImpl.java | 24 +++++++++++++++++++ 7 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java index 6c76a6be..3d169756 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java @@ -1,7 +1,6 @@ package com.chint.domain.aggregates.order.order_record; import com.chint.domain.aggregates.order.OrderDetail; -import com.chint.domain.aggregates.order.OrderEvent; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -9,11 +8,6 @@ import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; -import java.util.List; -import java.util.Optional; - -import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA; - @Data @Table("order_car_record") @NoArgsConstructor @@ -71,13 +65,13 @@ public class OrderCarRecord extends OrderBaseRecord { private String orderSource; // 预订来源:线上/线下 private String payAmount;//支付总金额 private String receiptsNumOrigin;//支付总金额 - private String belongDeport; //归属部门 + private String belongDepart; //归属部门 public OrderCarRecord loadBelongDeport(String belongDeport ) { // 行程信息 - this.setBelongDeport(belongDeport); + this.setBelongDepart(belongDeport); return this; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index b27dc60d..c68ee69a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -80,12 +80,12 @@ public class OrderFlightRecord extends OrderBaseRecord { private String createTime; private String receiptsNumOrigin;//原差旅申请单单号 private String payAmount; - private String belongDeport; //归属部门 + private String belongDepart; //归属部门 public OrderFlightRecord loadBelongDeport(String belongDeport ) { // 行程信息 - this.setBelongDeport(belongDeport); + this.setBelongDepart(belongDeport); return this; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index 52acf941..f078d6ec 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -79,12 +79,12 @@ public class OrderHotelRecord extends OrderBaseRecord { private String orderStatus; private String createTime; private String receiptsNumOrigin;//支付总金额 - private String belongDeport; //归属部门 + private String belongDepart; //归属部门 public OrderHotelRecord loadBelongDeport(String belongDeport ) { // 行程信息 - this.setBelongDeport(belongDeport); + this.setBelongDepart(belongDeport); return this; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java index d9a30807..3036f338 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java @@ -73,12 +73,12 @@ public class OrderTrainRecord extends OrderBaseRecord{ private String trainTime; // 发车时间 yyyy-MM-dd HH:‌mm:ss private String yxId; // 影像比对ID private String receiptsNumOrigin;//原差旅申请单单号 - private String belongDeport; //归属部门 + private String belongDepart; //归属部门 public OrderTrainRecord loadBelongDeport(String belongDeport ) { // 行程信息 - this.setBelongDeport(belongDeport); + this.setBelongDepart(belongDeport); return this; } // 加载基础订单信息 diff --git a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java index 48ef9945..59958d3e 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java @@ -591,7 +591,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac private String belongDeport(String employeeNo, String accountCompanyName) { User user = userRepository.findByUserEmployeeNo(employeeNo); if (user == null) { - user = userHttpRequest.loadUserInfo(User.withEmployeeNo(employeeNo)); + user = userHttpRequest.loadUserBaseInfo(User.withEmployeeNo(employeeNo)); if (user == null) { return null; } diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java index 41092f5e..4d1a3393 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java @@ -5,5 +5,7 @@ import com.chint.domain.aggregates.user.User; public interface UserHttpRequest { User loadUserInfo(User user); + User loadUserBaseInfo(User user); + User loadUserDeptInfo(User user); } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index 241ed3fe..0f48476c 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -182,6 +182,30 @@ public class UserHttpRequestImpl implements UserHttpRequest { return user; } + //这个方法只保存从sf取来的信息 + public User loadUserBaseInfo(User user) { + List userDataDTOList = userSFRequest + .getUserSFDataFromOpenApi(user); + + if (userDataDTOList == null || userDataDTOList.isEmpty()) { + return null; + } + userDataDTOList + .stream() + .filter(it -> it.getPersonIdExternal().equals(it.getLoginUsername())) + .findFirst() + .ifPresent(it -> { + User byUserEmployeeNo = userRepository.findByUserEmployeeNo(user.getEmployeeNo()); + if(byUserEmployeeNo == null){ + userRepository.save( + getDataFromUserSFData(user, it) + ); + } + }); + return user; + } + + private User addDeptInfo(UserDataDTO userData, User user, Boolean ifPrimary) { UserDepartmentInfo.Builder builder = user.addDeptInfo() .companyInfo(userData.getCompany(), userData.getCompany_cn())