From 2adcf92af0f07d50f771df55d755eb55fdc610a2 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 28 Mar 2024 20:19:58 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A1=8C=E7=A8=8B=E8=A7=84=E5=88=92?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=B7=BB=E5=8A=A0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/leg_event/LegEventHandler.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java index 87148a89..53539e4d 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java @@ -42,10 +42,9 @@ import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE import static com.chint.infrastructure.constant.DataMessageConstant.DATA_NOT_FOUND; import static com.chint.infrastructure.constant.LegConstant.*; import static com.chint.infrastructure.constant.OrderConstant.*; -import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_FINISH_NAME; import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_CODE; import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_NAME; -import static com.chint.infrastructure.constant.RouteConstant.*; +import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE; import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL; @Service @@ -161,15 +160,26 @@ public class LegEventHandler implements LegEventService { if (routeOrder.getOrderStatus() >= RouteConstant.ORDER_STATUS_APPROVAL) { String supplierName = data.getSupplierName(); routeOrder.setSupplierName(supplierName); + List legItems = routeOrder.getLegItems(); + + //这里增加一个判断 ,如果这个订单的行程为空,那么就返回给用户提示 + if (legItems == null || legItems.isEmpty()) { + throw new CommandException("订单的行程不能为空"); + } + List needSyncLegs = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_OTHER)).toList(); + if (needSyncLegs.isEmpty()) { + throw new CommandException("有所选的行程规划单不存在需要同步的行程"); + } + //这里order所有的leg触发sync事件 - routeOrder.getLegItems().forEach(leg -> leg.getEventList().add( + legItems.forEach(leg -> leg.getEventList().add( legEventFactory.creatLegEvent(command.getLegEventType()) )); + //保存routeOrder的状态 routeRepository.save(routeOrder).reloadStatus(); routeOrder.setLegItems( - routeOrder - .getLegItems() + legItems .stream() .filter(leg -> !leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER)) .toList() @@ -245,8 +255,8 @@ public class LegEventHandler implements LegEventService { LegEvent legEvent = legEventFactory .creatLegEvent(command.getLegEventType()); leg.addEvent(legEvent); - } else if(orderStatus.equals(ORDER_EVENT_REFUND_NAME) || - orderStatus.equals(ORDER_EVENT_CANCEL_NAME)){ + } else if (orderStatus.equals(ORDER_EVENT_REFUND_NAME) || + orderStatus.equals(ORDER_EVENT_CANCEL_NAME)) { //如果是退款状态,那么就创建加入未下单事件 LegEvent legEvent = legEventFactory .creatLegEvent(LEG_EVENT_NOT_ORDERED); From 404847cb07759609b5867be2937d6f13cc78ad5d Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 28 Mar 2024 20:30:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/com/chint/CTripTest.java | 47 +++++++++++---- src/test/java/com/chint/LYTest.java | 7 ++- .../java/com/chint/RouteApplicationTests.java | 57 +++++++++++++++---- 3 files changed, 86 insertions(+), 25 deletions(-) diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index b96b0355..de2b5abe 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -5,15 +5,15 @@ import com.chint.domain.aggregates.location.basedata.DistrictPOIInfoEntity; import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEntity; import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.order.RouteOrder; -import com.chint.domain.aggregates.order.ctrip.CtripCarOrderDetail; -import com.chint.domain.aggregates.order.ctrip.CtripFlightOrderDetail; -import com.chint.domain.aggregates.order.ctrip.CtripHotelOrderDetail; -import com.chint.domain.aggregates.order.ctrip.CtripTrainOrderDetail; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.*; import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.*; import com.chint.domain.service.order_sync.CTripOrderSyncAdapter; import com.chint.domain.service.supplier.SupplierService; import com.chint.domain.value_object.SupplierCallbackData; +import com.chint.infrastructure.repository.CTripOrderDetailImpl; +import com.chint.infrastructure.repository.OrderFlightRecordRepositoryImpl; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.Digest; import com.chint.infrastructure.util.PinyinUtil; @@ -124,6 +124,12 @@ public class CTripTest { @Value("${cTrip.requestSecret}") private String C_TRIP_REQUEST_SECRET; + @Autowired + private OrderFlightRecordRepository orderFlightRecordRepository; + + @Autowired + private CTripOrderDetailImpl cTripOrderDetail; + private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001"); @@ -236,10 +242,10 @@ public class CTripTest { System.out.println(gson.toJson(estimate)); } - @Test +// @Test void search() { BaseContext.setCurrentUser(user); - SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31108053999"); + SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31288249965"); System.out.println(response); } @@ -488,7 +494,7 @@ public class CTripTest { OrderFlightResponse.FlightOrderSettlementBaseInfo orderSettlementBaseInfo = flightOrderSettlementInfo.getOrderSettlementBaseInfo(); if (orderSettlementBaseInfo != null) { - CtripFlightOrderDetail ctripFlightOrderDetail = new CtripFlightOrderDetail(); + CTripFlightRecordBase ctripFlightOrderDetail = new CTripFlightRecordBase(); ctripFlightOrderDetail = ctripFlightOrderDetail.changeInfo(orderSettlementBaseInfo); ctripOrderDetailRepository.save(ctripFlightOrderDetail); } @@ -510,7 +516,7 @@ public class CTripTest { OrderTrainResponse.CorpTrainSettlementDetail trainSettlementDetail = corpTrainSettlementInfo.getTrainSettlementDetail(); if (trainSettlementDetail != null) { - CtripTrainOrderDetail ctripTrainOrderDetail = new CtripTrainOrderDetail(); + CTripTrainRecordBase ctripTrainOrderDetail = new CTripTrainRecordBase(); ctripTrainOrderDetail = ctripTrainOrderDetail.changeInfo(trainSettlementDetail); ctripOrderDetailRepository.save(ctripTrainOrderDetail); } @@ -531,7 +537,7 @@ public class CTripTest { OrderHotelResponse.LstHotelSettlementDetail hotelSettlementDetail = LstHotelSettlementDetail.get(0); OrderHotelResponse.SettlementDetail settlementDetail = hotelSettlementDetail.getSettlementDetail(); if (settlementDetail != null) { - CtripHotelOrderDetail ctripFlightOrderDetail = new CtripHotelOrderDetail(); + CTripHotelRecordBase ctripFlightOrderDetail = new CTripHotelRecordBase(); ctripFlightOrderDetail = ctripFlightOrderDetail.changeInfo(settlementDetail); ctripOrderDetailRepository.save(ctripFlightOrderDetail); } @@ -553,7 +559,7 @@ public class CTripTest { OrderCarResponse.CarOrderSettlementDetail carOrderSettlementDetail = carSettlementDetailList.get(0); OrderCarResponse.CarOrderSettlementBaseInfo settlementBaseInfo = carOrderSettlementDetail.getSettlementBaseInfo(); if (settlementBaseInfo != null) { - CtripCarOrderDetail ctripCarOrderDetail = new CtripCarOrderDetail(); + CTripCarRecordBase ctripCarOrderDetail = new CTripCarRecordBase(); ctripCarOrderDetail = ctripCarOrderDetail.changeInfo(settlementBaseInfo); ctripOrderDetailRepository.save(ctripCarOrderDetail); } @@ -586,4 +592,25 @@ public class CTripTest { } +// @Test + void findRecord(){ + CTripFlightRecord byId = cTripOrderDetail.findFlightRecordById(14513L); + Gson gson = new Gson(); + System.out.println(gson.toJson(byId)); + } + +// @Test + void findHotelRecord(){ + CTripHotelRecord byId = cTripOrderDetail.findHotelRecordByRecordId("97211839"); + Gson gson = new Gson(); + System.out.println(gson.toJson(byId)); + } + +// @Test + void findCarRecord(){ + CTripCarRecord byId = cTripOrderDetail.findCarRecordByRecordId("50597248"); + Gson gson = new Gson(); + System.out.println(gson.toJson(byId)); + } + } diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index 303ce671..5c4a4f74 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -18,6 +18,7 @@ import com.chint.infrastructure.echo_framework.command.Command; import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderTravelRepository; import com.chint.infrastructure.util.BaseContext; +import com.chint.infrastructure.util.Digest; import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.bpm.BPMRequest; import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory; @@ -886,7 +887,7 @@ public class LYTest { // @Test void sendMsg() { - commonController.sendMsg("T24032167509127504"); + commonController.sendMsg("T24032868351668790"); } @@ -920,14 +921,14 @@ public class LYTest { } -// @Test + @Test void syncToSupplierOne(){ RouteOrder routeOrder = routeRepository.queryById(665L); lyOrderSyncAdapter.syncSupplierOrder(routeOrder); } -// @Test + @Test void queryHotelCustom(){ OrderDetail byId = orderDetailRepository.findById(2569L); HotelOrderDetailDto hotelOrderDetailDto = HotelOrderDetailDto.copyFrom(byId.getHotelOrderDetail()); diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 38f572a2..6e7064d8 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -11,11 +11,15 @@ import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEnti import com.chint.domain.aggregates.order.Leg; import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.order.RouteOrder; +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord; import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.*; import com.chint.domain.service.JTCompanyDomainService; +import com.chint.domain.service.OrderDomainService; import com.chint.domain.service.order_sync.LYOrderSyncAdapter; import com.chint.domain.value_object.RanksData; +import com.chint.infrastructure.repository.CTripOrderDetailImpl; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.Digest; import com.chint.infrastructure.util.PinyinUtil; import com.chint.interfaces.rest.base.PostRequest; @@ -138,6 +142,12 @@ class RouteApplicationTests { @Autowired private RankController rankController; + @Autowired + private CTripOrderDetailImpl cTripOrderDetail; + + @Autowired + private OrderDomainService orderDomainService; + void test3() { FlyOkDTO freightDTO = new FlyOkDTO(); ParamFly param = new ParamFly(); @@ -156,7 +166,7 @@ class RouteApplicationTests { System.out.println(postRequest.getReDirectUrl("http://10.10.100.129:8089" + "/MobileOA/api/FsscSSO?loginUser=230615020&data=%2F%23%2Fexpenseclaim%3FbillDefineId%3Dfcc76666fb1211e98e2019f4db5548fd%26scene%3DWRITE%26isNew%3Dtrue%26goback%3Dfalse")); } - @Test +// @Test void syncUserTo() { User user = new User(); user.setCompanyCode("A10000001"); @@ -267,7 +277,7 @@ class RouteApplicationTests { // log.trace("trace"); } - @Test +// @Test void loginSignProd() { String sfno = "231201060"; String syscode = "FSSC"; @@ -312,7 +322,7 @@ class RouteApplicationTests { routeRepository.deleteById(875L); } - @Test +// @Test void deleteOrderDetail() { orderDetailRepository.deleteById(2609L); } @@ -1000,7 +1010,7 @@ class RouteApplicationTests { pushUser.getUserSFDataFromOpenApiBatch(); } - @Test +// @Test void deleteByOrderId() { orderDetailRepository.deleteById(1647L); orderDetailRepository.deleteById(1648L); @@ -1046,7 +1056,7 @@ class RouteApplicationTests { locationRepository.saveAll(allLevelThreeAndFour); } - @Test +// @Test void generateIfAirport() { List airportLocation = new ArrayList<>(); AirportSearchResponse response = cTripAirportRequest.getAirport(); @@ -1092,7 +1102,7 @@ class RouteApplicationTests { locationRepository.saveAll(airportLocation); } - @Test +// @Test void updateCounty() { List byLocationType = locationRepository.findByLocationType(5); for (Location location : byLocationType) { @@ -1103,7 +1113,7 @@ class RouteApplicationTests { locationRepository.saveAll(byLocationType); } - @Test +// @Test void updateAirportPath() { List byLocationType = locationRepository.findByLocationType(7); for (Location location : byLocationType) { @@ -1113,7 +1123,7 @@ class RouteApplicationTests { locationRepository.saveAll(byLocationType); } - @Test +// @Test void generateLocationType() { List all = locationRepository.findAll(); all.forEach(it -> { @@ -1183,12 +1193,18 @@ class RouteApplicationTests { cTripStatusNotification.setStatusIDs(null); } - @Test + +// YB_STANDARD_LEVEL_ONE m2.p2及以下 +// YB_STANDARD_LEVEL_TWO m3-m4 p3-p4 +// YB_STANDARD_LEVEL_THREE m5-m7 p5-p7 +// YB_STANDARD_LEVEL_FOUR m8.p8及以上 +//浙江正泰仪器仪表有限责任公司 A10160001 +// @Test void addRanks() { RanksData ranksData = new RanksData(); - ranksData.setIndustry("浙江正泰物联技术有限公司"); - ranksData.setCompanyCode("A70000059"); + ranksData.setIndustry("浙江正泰仪器仪表有限责任公司"); + ranksData.setCompanyCode("A10160001"); for (int i = 1; i < 13; i++) { if (i <= 2) { ranksData.setLevel(4); @@ -1209,10 +1225,27 @@ class RouteApplicationTests { } - @Test +// @Test void testQueryCity() { Location location = locationRepository.findById(373L); Location cityLocation = lyOrderSyncAdapter.getCityLocation(location); System.out.println(cityLocation); } + +// @Test + void testTimeFor(){ + LocalDateTime localDateTime = DateTimeUtil.strToTimeMM("2024-03-04 00:23:26.727"); + System.out.println(localDateTime); + } + +// @Test + void testFindOrderRecord(){ + CTripHotelRecord hotelRecordByRecordId = cTripOrderDetail.findHotelRecordByRecordId("98494942"); + System.out.println(hotelRecordByRecordId); + } + +// @Test + void testInBlackList(){ + orderDomainService.checkCompanyNameIfBlack("乐清正泰电器销售有限公司"); + } } From 3c14743c132a314d82af620ad2c3417be2328ff5 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Fri, 29 Mar 2024 09:22:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9FSSC=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E5=8D=95=E8=B7=B3=E8=BD=AC=E7=B1=BB=E5=9E=8B2=E7=9A=84?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/chint/application/out/FSSCController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/chint/application/out/FSSCController.java b/src/main/java/com/chint/application/out/FSSCController.java index 680b588d..42e0bc7c 100644 --- a/src/main/java/com/chint/application/out/FSSCController.java +++ b/src/main/java/com/chint/application/out/FSSCController.java @@ -95,6 +95,9 @@ public class FSSCController { reDirectUrl = postRequest.getReDirectUrl(generateUrlPathFromDataBase(dataBaseUrl, employeeNo)); } + if (sysCode.getSystemCodeUrl().getRedirectType() == 2) { + reDirectUrl = dataBaseUrl; + } return reDirectUrl; }