diff --git a/src/main/java/com/chint/domain/aggregates/user/User.java b/src/main/java/com/chint/domain/aggregates/user/User.java index 2f6f8f50..f18560d3 100644 --- a/src/main/java/com/chint/domain/aggregates/user/User.java +++ b/src/main/java/com/chint/domain/aggregates/user/User.java @@ -6,7 +6,6 @@ import com.chint.domain.aggregates.system.FsscSystem; import com.chint.domain.value_object.UserLoginParam; import com.chint.infrastructure.constant.AuthMessageConstant; import com.chint.interfaces.rest.base.PostRequest; -import com.chint.interfaces.rest.user.PushUser; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import lombok.AllArgsConstructor; @@ -47,7 +46,7 @@ public class User implements Serializable { private String password; private LocalDateTime syncTime; @MappedCollection(idColumn = "user_id", keyColumn = "user_key") - private List userDepartmentInfo; + private List userDepartmentInfoList; @Transient private List fsscSystemList; @Transient @@ -73,9 +72,16 @@ public class User implements Serializable { } -// public User addDeptInfo(){ -// -// } + public User addDeptInfo(UserDepartmentInfo userDepartmentInfo) { + if (this.userDepartmentInfoList == null) { + this.userDepartmentInfoList = new ArrayList<>(); + } + if (userDepartmentInfo.getIfPrimary().equals(1) && !this.userDepartmentInfoList.isEmpty()) { + this.userDepartmentInfoList.forEach(it -> it.setIfPrimary(0)); + } + this.userDepartmentInfoList.add(userDepartmentInfo); + return this; + } public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel, String companyCode) { this.userId = userId; @@ -109,7 +115,6 @@ public class User implements Serializable { } - public User addFssc(String CompanyName, String sysCode) { FsscSystem fsscSystem = new FsscSystem(CompanyName, sysCode); this.addFsscSystemToList(fsscSystem); diff --git a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java index 138a3c24..51ab774e 100644 --- a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java +++ b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java @@ -34,6 +34,137 @@ public class UserDepartmentInfo implements Serializable { private String departmentNameSeven; private Integer ifPrimary; - // Builder static inner class + public Builder start(User user) { + return new Builder(user); + } + + public UserDepartmentInfo(String companyCode, String companyName, String departmentCodeOne, + String departmentNameOne, String departmentCodeTwo, String departmentNameTwo, + String departmentCodeThree, String departmentNameThree, String departmentCodeFour, + String departmentNameFour, String departmentCodeFive, String departmentNameFive, + String departmentCodeSix, String departmentNameSix, String departmentCodeSeven, + String departmentNameSeven, Integer ifPrimary) { + this.companyCode = companyCode; + this.companyName = companyName; + this.departmentCodeOne = departmentCodeOne; + this.departmentNameOne = departmentNameOne; + this.departmentCodeTwo = departmentCodeTwo; + this.departmentNameTwo = departmentNameTwo; + this.departmentCodeThree = departmentCodeThree; + this.departmentNameThree = departmentNameThree; + this.departmentCodeFour = departmentCodeFour; + this.departmentNameFour = departmentNameFour; + this.departmentCodeFive = departmentCodeFive; + this.departmentNameFive = departmentNameFive; + this.departmentCodeSix = departmentCodeSix; + this.departmentNameSix = departmentNameSix; + this.departmentCodeSeven = departmentCodeSeven; + this.departmentNameSeven = departmentNameSeven; + this.ifPrimary = ifPrimary; + } + + @Data + public static class Builder { + private User user; + private String companyCode; + private String companyName; + private String departmentCodeOne; + private String departmentNameOne; + private String departmentCodeTwo; + private String departmentNameTwo; + private String departmentCodeThree; + private String departmentNameThree; + private String departmentCodeFour; + private String departmentNameFour; + private String departmentCodeFive; + private String departmentNameFive; + private String departmentCodeSix; + private String departmentNameSix; + private String departmentCodeSeven; + private String departmentNameSeven; + private Integer ifPrimary; + + public Builder(User user) { + this.user = user; + } + + public Builder companyInfo(String companyCode, String companyName) { + this.companyCode = companyCode; + this.companyName = companyName; + return this; + } + + public Builder deptOne(String departmentCodeOne, String departmentNameOne) { + this.departmentCodeOne = departmentCodeOne; + this.departmentNameOne = departmentNameOne; + return this; + } + + public Builder deptTwo(String departmentCodeTwo, String departmentNameTwo) { + this.departmentCodeTwo = departmentCodeTwo; + this.departmentNameTwo = departmentNameTwo; + return this; + } + + public Builder deptThree(String departmentCodeThree, String departmentNameThree) { + this.departmentCodeThree = departmentCodeThree; + this.departmentNameThree = departmentNameThree; + return this; + } + + public Builder deptFour(String departmentCodeFour, String departmentNameFour) { + this.departmentCodeFour = departmentCodeFour; + this.departmentNameFour = departmentNameFour; + return this; + } + + public Builder deptFive(String departmentCodeFive, String departmentNameFive) { + this.departmentCodeFive = departmentCodeFive; + this.departmentNameFive = departmentNameFive; + return this; + } + + public Builder deptSix(String departmentCodeSix, String departmentNameSix) { + this.departmentCodeSix = departmentCodeSix; + this.departmentNameSix = departmentNameSix; + return this; + } + + public Builder primary() { + this.ifPrimary = 1; + return this; + } + + public Builder deptSeven(String departmentCodeSeven, String departmentNameSeven) { + this.departmentCodeSeven = departmentCodeSeven; + this.departmentNameSeven = departmentNameSeven; + return this; + } + + public UserDepartmentInfo addToUser() { + UserDepartmentInfo userDepartmentInfo = new UserDepartmentInfo(companyCode, + companyName, + departmentCodeOne, + departmentNameOne, + departmentCodeTwo, + departmentNameTwo, + departmentCodeThree, + departmentNameThree, + departmentCodeFour, + departmentNameFour, + departmentCodeFive, + departmentNameFive, + departmentCodeSix, + departmentNameSix, + departmentCodeSeven, + departmentNameSeven, + ifPrimary); + if (userDepartmentInfo.getIfPrimary() == null || userDepartmentInfo.getIfPrimary() != 1) { + userDepartmentInfo.setIfPrimary(0); + } + user.addDeptInfo(userDepartmentInfo); + return userDepartmentInfo; + } + } } 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 c1c44246..f11cd154 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 @@ -288,7 +288,11 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac // 加载机票信息 if (cTripFlightTripInfo != null) { - orderFlightRecord.loadTicketInfo(cTripFlightRecord.getTicketNo(), + String ticketNo = cTripFlightRecord.getTicketNo(); + if (ticketNo != null) { + ticketNo = ticketNo.replace("-", ""); + } + orderFlightRecord.loadTicketInfo(ticketNo, String.valueOf(cTripFlightRecordBase.getPrice()), cTripFlightTripInfo.getTicketNoStatusName()); } else {