From 0c5f571e272a3b8e00ef6c19eb850160381fa0d0 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 25 Apr 2024 13:46:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=AB=98=E5=BE=B7=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aggregates/user/UserDepartmentInfo.java | 20 +++++++- .../LYOrderExtensionFactoryImpl.java | 4 +- .../AmapOrderRecordExtensionFactory.java | 47 +++++++++++++++++++ .../CTripOrderRecordExtensionFactory.java | 8 ++-- .../OrderRecordFactorySelector.java | 7 ++- .../AmapOrderRecordDomainService.java | 31 ++++++++++++ .../jdbc/JdbcOrderDetailRepository.java | 1 + .../rest/amap/AmapLocationRequest.java | 4 +- .../dto/settlement/FinishedOrderResponse.java | 2 - .../rest/user/UserHttpRequestImpl.java | 2 +- src/test/java/com/chint/LYTest.java | 8 ++-- .../java/com/chint/RouteApplicationTests.java | 3 ++ 12 files changed, 119 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/chint/domain/factoriy/order_record/AmapOrderRecordExtensionFactory.java create mode 100644 src/main/java/com/chint/domain/service/order_record/AmapOrderRecordDomainService.java 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 ec2ad879..9777b071 100644 --- a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java +++ b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java @@ -53,12 +53,28 @@ public class UserDepartmentInfo implements Serializable { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserDepartmentInfo that = (UserDepartmentInfo) o; - return Objects.equals(companyCode, that.companyCode) && Objects.equals(companyName, that.companyName) && Objects.equals(departmentCodeOne, that.departmentCodeOne) && Objects.equals(departmentNameOne, that.departmentNameOne) && Objects.equals(departmentCodeTwo, that.departmentCodeTwo) && Objects.equals(departmentNameTwo, that.departmentNameTwo) && Objects.equals(departmentCodeThree, that.departmentCodeThree) && Objects.equals(departmentNameThree, that.departmentNameThree) && Objects.equals(departmentCodeFour, that.departmentCodeFour) && Objects.equals(departmentNameFour, that.departmentNameFour) && Objects.equals(departmentCodeFive, that.departmentCodeFive) && Objects.equals(departmentNameFive, that.departmentNameFive) && Objects.equals(departmentCodeSix, that.departmentCodeSix) && Objects.equals(departmentNameSix, that.departmentNameSix) && Objects.equals(departmentCodeSeven, that.departmentCodeSeven) && Objects.equals(departmentNameSeven, that.departmentNameSeven); + return Objects.equals(companyCode, that.companyCode) + && Objects.equals(companyName, that.companyName) + && Objects.equals(departmentCodeOne, that.departmentCodeOne) + && Objects.equals(departmentNameOne, that.departmentNameOne) + && Objects.equals(departmentCodeTwo, that.departmentCodeTwo) + && Objects.equals(departmentNameTwo, that.departmentNameTwo) + && Objects.equals(departmentCodeThree, that.departmentCodeThree) + && Objects.equals(departmentNameThree, that.departmentNameThree) + && Objects.equals(departmentCodeFour, that.departmentCodeFour) + && Objects.equals(departmentNameFour, that.departmentNameFour) + && Objects.equals(departmentCodeFive, that.departmentCodeFive) + && Objects.equals(departmentNameFive, that.departmentNameFive) + && Objects.equals(departmentCodeSix, that.departmentCodeSix) + && Objects.equals(departmentNameSix, that.departmentNameSix) + && Objects.equals(departmentCodeSeven, that.departmentCodeSeven) + && Objects.equals(departmentNameSeven, that.departmentNameSeven) + && Objects.equals(ifPrimary, that.ifPrimary); } @Override public int hashCode() { - return Objects.hash(companyCode, companyName, departmentCodeOne, departmentNameOne, departmentCodeTwo, departmentNameTwo, departmentCodeThree, departmentNameThree, departmentCodeFour, departmentNameFour, departmentCodeFive, departmentNameFive, departmentCodeSix, departmentNameSix, departmentCodeSeven, departmentNameSeven); + return Objects.hash(companyCode, companyName, departmentCodeOne, departmentNameOne, departmentCodeTwo, departmentNameTwo, departmentCodeThree, departmentNameThree, departmentCodeFour, departmentNameFour, departmentCodeFive, departmentNameFive, departmentCodeSix, departmentNameSix, departmentCodeSeven, departmentNameSeven,ifPrimary); } public Builder start(User user) { diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java index b6be26a7..23022499 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java @@ -21,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -36,6 +35,7 @@ import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_CN_NAME; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_EXTENSION_NAME; import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO; +import static com.chint.infrastructure.util.DateTimeUtil.formatter; @Component public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { @@ -61,7 +61,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { @Autowired private RouteRequestRepository routeRequestRepository; - private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss"); + @Override diff --git a/src/main/java/com/chint/domain/factoriy/order_record/AmapOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/AmapOrderRecordExtensionFactory.java new file mode 100644 index 00000000..00f12102 --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/order_record/AmapOrderRecordExtensionFactory.java @@ -0,0 +1,47 @@ +package com.chint.domain.factoriy.order_record; + +import com.chint.domain.aggregates.order.order_record.OrderCarRecord; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; +import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; +import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarPassengerInfo; +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarRecord; +import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse; +import org.springframework.stereotype.Component; + +import static com.chint.infrastructure.constant.BelongSystemConstant.TRAVAL_SYS_TYPE_CTRIP; + + +@Component +public class AmapOrderRecordExtensionFactory implements OrderRecordExtensionFactory{ + + + private OrderRecordBasic buildWithRecord(Object orderCarRecordData) { + FinishedOrderResponse.ListElement carRecordData = (FinishedOrderResponse.ListElement) orderCarRecordData; + String[] split = carRecordData.getRemark().split("-"); + return null; + } + + @Override + public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { + FinishedOrderResponse.ListElement carRecordData = (FinishedOrderResponse.ListElement) orderCarRecordData; + + + return null; + } + + @Override + public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData) { + return null; + } + + @Override + public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { + return null; + } + + @Override + public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) { + return null; + } +} 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 df7afe83..bdfe432e 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 @@ -52,16 +52,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac private String getBeLongSysType(String sysCode) { String res = null; if (sysCode != null) { - if (sysCode.contains(BELONG_SYS_CODE_FSSC) || sysCode.contains(BELONG_SYS_TYPE_FSSC)) { + if (sysCode.equals(BELONG_SYS_CODE_FSSC) || sysCode.contains(BELONG_SYS_TYPE_FSSC)) { res = BELONG_SYS_TYPE_FSSC; } - if (sysCode.contains(BELONG_SYS_CODE_H3BPM) || sysCode.contains(BELONG_SYS_TYPE_H3BPM)) { + if (sysCode.equals(BELONG_SYS_CODE_H3BPM) || sysCode.contains(BELONG_SYS_TYPE_H3BPM)) { res = BELONG_SYS_TYPE_H3BPM; } - if (sysCode.contains(BELONG_SYS_CODE_XNFSSC) || sysCode.contains(BELONG_SYS_TYPE_XNFSSC)) { + if (sysCode.equals(BELONG_SYS_CODE_XNFSSC) || sysCode.contains(BELONG_SYS_TYPE_XNFSSC)) { res = BELONG_SYS_TYPE_XNFSSC; } - if (sysCode.contains(BELONG_SYS_CODE_ANFSSC) || sysCode.contains(BELONG_SYS_TYPE_ANFSSC)) { + if (sysCode.equals(BELONG_SYS_CODE_ANFSSC) || sysCode.contains(BELONG_SYS_TYPE_ANFSSC)) { res = BELONG_SYS_TYPE_ANFSSC; } } else { diff --git a/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactorySelector.java b/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactorySelector.java index 88aa0973..1ec33aaa 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactorySelector.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactorySelector.java @@ -3,8 +3,7 @@ package com.chint.domain.factoriy.order_record; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP; -import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y; +import static com.chint.infrastructure.constant.SupplierNameConstant.*; @Component public class OrderRecordFactorySelector { @@ -14,10 +13,14 @@ public class OrderRecordFactorySelector { @Autowired private LyOrderRecordExtensionFactory lyOrderRecordExtensionFactory; + @Autowired + private AmapOrderRecordExtensionFactory aMapOrderRecordExtensionFactory; + public OrderRecordExtensionFactory extensionFactoryOfSupplierName(String supplierName) { return switch (supplierName) { case SUPPLIER_C_TRIP -> cTripOrderRecordExtensionFactory; case SUPPLIER_L_Y -> lyOrderRecordExtensionFactory; + case SUPPLIER_AMAP -> aMapOrderRecordExtensionFactory; default -> null; }; } diff --git a/src/main/java/com/chint/domain/service/order_record/AmapOrderRecordDomainService.java b/src/main/java/com/chint/domain/service/order_record/AmapOrderRecordDomainService.java new file mode 100644 index 00000000..eaab8b27 --- /dev/null +++ b/src/main/java/com/chint/domain/service/order_record/AmapOrderRecordDomainService.java @@ -0,0 +1,31 @@ +package com.chint.domain.service.order_record; + +import com.chint.application.commands.OrderRecordGenerateCommand; +import com.chint.domain.aggregates.order.order_record.OrderCarRecord; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; +import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; +import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; + +import java.util.List; + +public class AmapOrderRecordDomainService implements OrderRecordDomainService{ + @Override + public List generateHotelRecord(OrderRecordGenerateCommand command) { + return List.of(); + } + + @Override + public List generateTrainRecord(OrderRecordGenerateCommand command) { + return List.of(); + } + + @Override + public List generateFlightRecord(OrderRecordGenerateCommand command) { + return List.of(); + } + + @Override + public List generateCarRecord(OrderRecordGenerateCommand command) { + return List.of(); + } +} diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java index 217e2d2f..659f7698 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java @@ -22,4 +22,5 @@ public interface JdbcOrderDetailRepository extends CrudRepository findByEmployeeNo(String employeeNo, Pageable pageable); List findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2); + List findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2); } diff --git a/src/main/java/com/chint/interfaces/rest/amap/AmapLocationRequest.java b/src/main/java/com/chint/interfaces/rest/amap/AmapLocationRequest.java index 8a56787f..eb1e40b1 100644 --- a/src/main/java/com/chint/interfaces/rest/amap/AmapLocationRequest.java +++ b/src/main/java/com/chint/interfaces/rest/amap/AmapLocationRequest.java @@ -5,6 +5,7 @@ import com.chint.interfaces.rest.amap.dto.location.LocationResponse; import com.chint.interfaces.rest.amap.request.AmapRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.util.Optional; @@ -20,12 +21,13 @@ public class AmapLocationRequest { @Value("${amap.baseUrl}") private String BaseUrl; - + @Cacheable(value = "AmapLocation" , key = "#keyWords") public LocationResponse locationQuery(String keyWords) { LocationRequestParam param = LocationRequestParam.of(keyWords); return amapRequest.post(BaseUrl + AMAP_LOCATION_PATH, param, LocationResponse.class); } + public String getACodeByLocationName(String locationName) { LocationResponse locationQuery = locationQuery(locationName); Optional amapCityInfo = Optional.ofNullable(locationQuery.getData()) diff --git a/src/main/java/com/chint/interfaces/rest/amap/dto/settlement/FinishedOrderResponse.java b/src/main/java/com/chint/interfaces/rest/amap/dto/settlement/FinishedOrderResponse.java index 10eb6de7..78fe8720 100644 --- a/src/main/java/com/chint/interfaces/rest/amap/dto/settlement/FinishedOrderResponse.java +++ b/src/main/java/com/chint/interfaces/rest/amap/dto/settlement/FinishedOrderResponse.java @@ -115,7 +115,5 @@ public class FinishedOrderResponse extends BaseResponse { private String entStaffExtInfo;//企业员工拓展信息 private String tokenExtInfo;//该信息为提交token时,userInfo里的extInfo值需申请开通权限 private Integer carPool;//是否拼车,1:拼成 0:未拼成 - - } } 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 8795760e..0c4ea60e 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -67,6 +67,7 @@ public class UserHttpRequestImpl implements UserHttpRequest { @Override public User loadUserInfo(User user) { + //这个方法 逻辑进行修改 , 首先通过查询 表的方式 , 如果部分数据为空 , 那么就要查询 sf信息获取 user = loadSFInfo(user); if (user == null) { return null; @@ -232,7 +233,6 @@ public class UserHttpRequestImpl implements UserHttpRequest { } private void processSpecialCompanies(List userDataDTOS, User user) { - List list = userDataDTOS.stream() .filter(it -> jtCompanyDomainService.ifCompanyInJT(null, it.getCompany())) .toList(); diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index 2e83c23e..3acabdc0 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -822,17 +822,17 @@ public class LYTest { System.out.println(json); } - @Test +// @Test void searchTrain() { - TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24033168626574219"); + TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24042571594139716"); Gson gson = new Gson(); String json = gson.toJson(trainOrderDetail); System.out.println(json); } - // @Test + @Test void searchHotel() { - HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240325155100629867"); + HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240401145300516689"); Gson gson = new Gson(); String json = gson.toJson(hotelOrderDetail); System.out.println(json); diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 87621dab..3597c3a1 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -49,14 +49,17 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; +import java.time.Instant; import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; import static com.chint.infrastructure.constant.LocationConstant.*; import static com.chint.infrastructure.constant.RankConstant.DEFAULT_RANK_NAME; +import static com.chint.infrastructure.util.DateTimeUtil.formatter; import static com.chint.infrastructure.util.DateTimeUtil.lastMonthStr; @Slf4j