From 786abad90595d13e3d68706702ff929e90028fca Mon Sep 17 00:00:00 2001 From: lulz1 Date: Fri, 1 Mar 2024 14:48:19 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/chint/interfaces/rest/ly/in/HotelBackController.java | 1 + src/test/java/com/chint/RouteApplicationTests.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java b/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java index d73c83bf..69b8c7c4 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java +++ b/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java @@ -61,6 +61,7 @@ public class HotelBackController { //状态映射 command.eventType(mapHotelState(notification.getSubNotifyType())); command.sendToQueue(); + return new LYNoteResponse("100", "成功收到消息"); } return new LYNoteResponse("200", "未收到消息"); diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 5248a35b..799b92db 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -139,9 +139,9 @@ class RouteApplicationTests { } @Test void loginSign() { - String sfno = "230615020"; + String sfno = "090223001"; String syscode = "FSSC"; - String billcode = "CLSQ20240228"; + String billcode = "CLSQ240226000004"; String companycode = "正泰集团股份有限公司"; String sec = "Superdandan"; String timespan = "1708908662738"; From b7425c7b80e222a05a19356fb58a5c62a8becc6e Mon Sep 17 00:00:00 2001 From: lulz1 Date: Fri, 1 Mar 2024 15:11:43 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/LegApprovalCommand.java | 11 ++------- .../commands/RouteApprovalCommand.java | 24 +++++++++++++++++++ .../services/OrderApplicationService.java | 14 +++++++---- .../service/leg_event/LegEventHandler.java | 9 ++++++- .../service/leg_event/LegEventService.java | 4 +++- .../leg_event/LegEventServiceImpl.java | 13 +++++++--- 6 files changed, 57 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/chint/application/commands/RouteApprovalCommand.java diff --git a/src/main/java/com/chint/application/commands/LegApprovalCommand.java b/src/main/java/com/chint/application/commands/LegApprovalCommand.java index 552beef4..56e6a1a3 100644 --- a/src/main/java/com/chint/application/commands/LegApprovalCommand.java +++ b/src/main/java/com/chint/application/commands/LegApprovalCommand.java @@ -1,6 +1,5 @@ package com.chint.application.commands; -import com.chint.domain.value_object.ApproveLegData; import com.chint.infrastructure.echo_framework.command.Command; import lombok.Data; @@ -8,17 +7,11 @@ import static com.chint.infrastructure.constant.LegConstant.LEG_EVENT_APPROVAL; @Data public class LegApprovalCommand extends Command { - private Integer LegEventType = LEG_EVENT_APPROVAL; - private Long LegId; - private ApproveLegData data; + private Integer legEventType = LEG_EVENT_APPROVAL; + private Long legId; public LegApprovalCommand legId(Long LegId) { this.setLegId(LegId); return this; } - - public LegApprovalCommand data(ApproveLegData data) { - this.data = data; - return this; - } } diff --git a/src/main/java/com/chint/application/commands/RouteApprovalCommand.java b/src/main/java/com/chint/application/commands/RouteApprovalCommand.java new file mode 100644 index 00000000..2c1c7063 --- /dev/null +++ b/src/main/java/com/chint/application/commands/RouteApprovalCommand.java @@ -0,0 +1,24 @@ +package com.chint.application.commands; + +import com.chint.domain.value_object.ApproveLegData; +import com.chint.infrastructure.echo_framework.command.Command; +import lombok.Data; + +import static com.chint.infrastructure.constant.LegConstant.LEG_EVENT_APPROVAL; + +@Data +public class RouteApprovalCommand extends Command { + private Integer LegEventType = LEG_EVENT_APPROVAL; + private Long LegId; + private ApproveLegData data; + + public RouteApprovalCommand legId(Long LegId) { + this.setLegId(LegId); + return this; + } + + public RouteApprovalCommand data(ApproveLegData data) { + this.data = data; + return this; + } +} diff --git a/src/main/java/com/chint/application/services/OrderApplicationService.java b/src/main/java/com/chint/application/services/OrderApplicationService.java index e7fdef23..080ee19f 100644 --- a/src/main/java/com/chint/application/services/OrderApplicationService.java +++ b/src/main/java/com/chint/application/services/OrderApplicationService.java @@ -28,8 +28,7 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; -import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_NOT_ORDERED; -import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE; +import static com.chint.infrastructure.constant.RouteConstant.*; @Service public class OrderApplicationService { @@ -77,7 +76,14 @@ public class OrderApplicationService { List legs = processLegData(addLegData.getLegData(), order); RouteOrder routeOrder = orderDomainService.saveOrder(order); - legs.forEach(leg -> Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue()); + legs.forEach(leg -> { + Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue(); + //如果订单状态已经处于审批中, 那么为这个新增的leg也提交审批状态 + if (order.getOrderStatus() >= ORDER_STATUS_APPROVAL) { + Command.of(LegApprovalCommand.class).legId(leg.getLegId()).sendToQueue(); + } + }); + //异步操作-如果是当前的状态已经进行过匹配,那么就要订单同步到供应商一次 if (order.getOrderStatus() >= ORDER_STATUS_NOT_ORDERED) { @@ -142,7 +148,7 @@ public class OrderApplicationService { @Transactional public void approve(ApproveLegData approveLegData) { - Command.of(LegApprovalCommand.class).data(approveLegData).sendToQueue(); + Command.of(RouteApprovalCommand.class).data(approveLegData).sendToQueue(); } @Transactional 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 a71db450..25c9818d 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 @@ -72,7 +72,7 @@ public class LegEventHandler implements LegEventService { @Transactional @Override - public void approveLeg(LegApprovalCommand command) { + public void approveRoute(RouteApprovalCommand command) { ApproveLegData data = command.getData(); RouteOrder routeOrder = routeRepository.findByFakeOrderNoAndSysCode(data.getFakeOrderNo(), data.getSysCode()).reloadStatus(); if (routeOrder.getLegItems().isEmpty()) { @@ -135,6 +135,13 @@ public class LegEventHandler implements LegEventService { } } + @Override + public void approveLeg(LegApprovalCommand command) { + Leg leg = legRepository.findByLegId(command.getLegId()); + leg.addEvent(legEventFactory.creatLegEvent(command.getLegEventType())); + legRepository.save(leg); + } + @Transactional @Override public ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command) { diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventService.java b/src/main/java/com/chint/domain/service/leg_event/LegEventService.java index fd11e376..c774ed8d 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventService.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventService.java @@ -8,10 +8,12 @@ public interface LegEventService { void prepareLeg(LegPrepareCommand command); //审批事件要从bpm或其他平台接收到一个真实订单 - void approveLeg(LegApprovalCommand command); + void approveRoute(RouteApprovalCommand command); void syncLeg(LegSyncCommand command); + void approveLeg(LegApprovalCommand command); + //下单事件 ResultContainer orderLeg(LegOrderedCommand command); diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventServiceImpl.java b/src/main/java/com/chint/domain/service/leg_event/LegEventServiceImpl.java index 2bf4328f..7fe9dea3 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventServiceImpl.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventServiceImpl.java @@ -23,10 +23,10 @@ public class LegEventServiceImpl implements LegEventService { //因为审批是针对整个订单的,因此所有订单下属的行程节点触发审批事件 //出发审批提交事件 , 需要生成 差旅单 , 将差旅但提交到供应商 , //根据command里面选择的数据来讲差旅但提交到不同的实现类当中 - @ListenTo(command = "LegApprovalCommand", order = 0) + @ListenTo(command = "RouteApprovalCommand", order = 0) @Override - public void approveLeg(LegApprovalCommand command) { - legEventHandler.approveLeg(command); + public void approveRoute(RouteApprovalCommand command) { + legEventHandler.approveRoute(command); } //这里需要获取同步类,价格routeOrder同步到供应商 @@ -36,6 +36,13 @@ public class LegEventServiceImpl implements LegEventService { legEventHandler.syncLeg(command); } + + @ListenTo(command = "LegApprovalCommand", order = 0) + @Override + public void approveLeg(LegApprovalCommand command) { + legEventHandler.approveLeg(command); + } + //下单时间要求回传,需要付款的金额,以及生成对于的行程订单号,如果没有行程订单号根据地点和时间进行匹配 @ListenTo(command = "LegOrderedCommand", order = 0) @Override From e35d335719c42278da7e758be01b0c2ce5f2d245 Mon Sep 17 00:00:00 2001 From: wanglf3 Date: Fri, 1 Mar 2024 15:47:16 +0800 Subject: [PATCH 3/7] =?UTF-8?q?1.=E5=9B=BD=E9=99=85=E7=83=AD=E9=97=A8?= =?UTF-8?q?=E5=9F=8E=E5=B8=82=E6=B7=BB=E5=8A=A0=20=E5=8F=B0=E5=8C=97=20?= =?UTF-8?q?=E9=A6=99=E6=B8=AF=20=E6=BE=B3=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/chint/domain/aggregates/standards/HotCityTag.java | 4 ++++ .../infrastructure/repository/LocationRepositoryImpl.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/com/chint/domain/aggregates/standards/HotCityTag.java b/src/main/java/com/chint/domain/aggregates/standards/HotCityTag.java index c3a297ca..dcecf717 100644 --- a/src/main/java/com/chint/domain/aggregates/standards/HotCityTag.java +++ b/src/main/java/com/chint/domain/aggregates/standards/HotCityTag.java @@ -43,6 +43,10 @@ public class HotCityTag { internationalCitys.add("欧洲_挪威_奥斯陆市_奥斯陆_"); internationalCitys.add("北美洲_美国_加利福尼亚州_旧金山_"); internationalCitys.add("亚洲_新加坡_新加坡_新加坡_"); + internationalCitys.add("亚洲_中国_香港_香港_"); + internationalCitys.add("亚洲_中国_澳门_澳门_"); + internationalCitys.add("亚洲_中国_台湾_台北_"); + } diff --git a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java index b468c7b0..8f4db9aa 100644 --- a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java @@ -94,6 +94,8 @@ public class LocationRepositoryImpl implements LocationRepository { List hotCities = jdbcLocationRepository.findByLocationPathNameInAndLevel(locationNames,3); return hotCities; + + } From 2719803aa8ad2f066097b8bfdd2c0ac65b64046f Mon Sep 17 00:00:00 2001 From: lulz1 Date: Fri, 1 Mar 2024 16:01:56 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chint/application/dtos/response/LegRes.java | 16 ++++++++++++++-- .../chint/application/queryies/OrderQuery.java | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/chint/application/dtos/response/LegRes.java b/src/main/java/com/chint/application/dtos/response/LegRes.java index 618a48e0..e872550f 100644 --- a/src/main/java/com/chint/application/dtos/response/LegRes.java +++ b/src/main/java/com/chint/application/dtos/response/LegRes.java @@ -7,6 +7,7 @@ import com.chint.domain.aggregates.order.LegExtensionField; import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.value_object.enums.CurrencyType; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.data.annotation.Id; @@ -30,11 +31,21 @@ public class LegRes { private String amount; private String legTypeName; private String legTypeEnName; + @ApiModelProperty("其他费用类型") private Integer amountType; + @ApiModelProperty("其他费用类型名称") private String amountTypeName; + @ApiModelProperty("其他费用类型英文名称") private String amountTypeEnName; + @ApiModelProperty("费用说明") + private String expenseExplanation; + @ApiModelProperty("初始地详细") + private String originDescription; + @ApiModelProperty("目的地详细") + private String destinationDescription; private Integer legStatus; + private String legStatusName; private CurrencyType currencyType; @@ -54,7 +65,9 @@ public class LegRes { legRes.setAmountType(legExtensionField.getAmountType()); legRes.setAmountTypeName(legExtensionField.getAmountTypeName()); legRes.setAmountTypeEnName(legExtensionField.getAmountTypeEnName()); - + legRes.setExpenseExplanation(legExtensionField.getExpenseExplanation()); + legRes.setOriginDescription(legExtensionField.getOriginDescription()); + legRes.setDestinationDescription(legExtensionField.getDestinationDescription()); if (legExtensionField.getLocationIds() != null) { List locationResList = new ArrayList<>(); List locationList = legExtensionField.getLocationList(); @@ -66,7 +79,6 @@ public class LegRes { } legRes.setOriginLocation(LocationRes.copyFrom(leg.getOriginLocation())); legRes.setDestinationLocation(LocationRes.copyFrom(leg.getDestinationLocation())); - return legRes; } } diff --git a/src/main/java/com/chint/application/queryies/OrderQuery.java b/src/main/java/com/chint/application/queryies/OrderQuery.java index c630361e..d3467fdf 100644 --- a/src/main/java/com/chint/application/queryies/OrderQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderQuery.java @@ -156,6 +156,7 @@ public class OrderQuery { .flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation())) .map(LocationRes::copyFrom) .distinct() + .filter(Objects::nonNull) .toList(); res.setLocationResList(locationRes); res.setUserName(currentUser.getName()); From d141719eec568ee11de1b434ea5ed120b3bc32da Mon Sep 17 00:00:00 2001 From: huangxh3 Date: Fri, 1 Mar 2024 16:05:51 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/supplier/LYOrderDataAdapter.java | 33 +++++++- .../domain/value_object/OrderLegData.java | 19 ++++- .../rest/ly/dto/ResultBackHotel.java | 78 +++++++++---------- .../rest/ly/in/HotelBackController.java | 10 +++ 4 files changed, 98 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java b/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java index baeb09cc..2b79dadc 100644 --- a/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java +++ b/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java @@ -1,7 +1,10 @@ package com.chint.domain.service.supplier; +import com.chint.domain.aggregates.order.Location; +import com.chint.domain.repository.LocationRepository; import com.chint.domain.value_object.OrderLegData; import com.chint.domain.value_object.SupplierCallbackData; +import com.chint.infrastructure.constant.OrderConstant; import com.chint.interfaces.rest.ly.dto.ResultBackHotel; import com.chint.interfaces.rest.ly.dto.carorderdatapushback.CarDetailResult; import com.chint.interfaces.rest.ly.dto.flydatapushback.FlyDetailResult; @@ -11,6 +14,7 @@ import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.TrainDetailResult; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Optional; @@ -20,6 +24,10 @@ import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_ @Component public class LYOrderDataAdapter implements OrderDataAdapter { + + @Autowired + private LocationRepository locationRepository; + @Override public Optional adapt(SupplierCallbackData supplierData) { return switch (supplierData.getProductType()) { @@ -54,6 +62,9 @@ public class LYOrderDataAdapter implements OrderDataAdapter { private Optional hotelDateProcess(HotelDetailResult hotelDetailResult) { HotelDetailResponse.Data data = hotelDetailResult.getHotelDetailResponse().getData(); ResultBackHotel.DataObject dataObject = hotelDetailResult.getDataObject(); + String cityName = data.getHotelInfo().getCityName(); + long cityId = data.getHotelInfo().getCityId(); + return Optional.of( OrderLegData.builder() .productType(LEG_TYPE_HOTEL) @@ -62,12 +73,30 @@ public class LYOrderDataAdapter implements OrderDataAdapter { .selfOrderNo(dataObject.getTravelData().getTravelApplyNo()) .actualOrderNo(data.getOrderInfo().getOrderSerialNo()) .hotelOrderDetailData(hotelDetailResult) - // .orderStatus() - // .originOrderStatus() + .orderTime(data.getOrderInfo().getCreateTime()) + .startTime(data.getOrderInfo().getOriginalCheckInDate()) + .endTime(data.getOrderInfo().getOriginalCheckOutDate()) + .orderStatus(hotelState(data.getOrderInfo().getOrderStatusDesc())) + .originOrderStatus(data.getOrderInfo().getOrderStatusDesc()) + .originId(cityId) + .originName(cityName) + .destinationId(cityId) + .destinationName(cityName) .supplierName(SUPPLIER_L_Y) .build() ); } + public Integer hotelState(String subNotifyType) { + return switch (subNotifyType) { + case "确认中" -> OrderConstant.ORDER_EVENT_PAYED;//确认中 + case "待入住" -> OrderConstant.ORDER_EVENT_ORDERED;//已下单, + case "已退房","已入住" -> OrderConstant.ORDER_EVENT_FINISH;//已完成 + case "已取消" -> OrderConstant.ORDER_EVENT_CANCEL;//取消 + case "待提交" -> OrderConstant.ORDER_EVENT_PREPARE;//未下单 + case "待支付" -> OrderConstant.ORDER_EVENT_ORDERED;//已下单 + default -> -99; + }; + } private Optional carDateProcess(CarDetailResult carDetailResult) { CarDetailResponse.Data data = carDetailResult.getCarDetailResponse().getData(); diff --git a/src/main/java/com/chint/domain/value_object/OrderLegData.java b/src/main/java/com/chint/domain/value_object/OrderLegData.java index bf63a9cf..fbe7ff2f 100644 --- a/src/main/java/com/chint/domain/value_object/OrderLegData.java +++ b/src/main/java/com/chint/domain/value_object/OrderLegData.java @@ -20,7 +20,7 @@ public class OrderLegData { private String orderTime; //下单时间 private String startTime; //开始时间 private String endTime; //结束时间 - private Long originId; + private Long originId; private String originName; private Long destinationId; private String destinationName; @@ -84,6 +84,7 @@ public class OrderLegData { private Object flightOrderDetailData; private Object otherOrderDetailData; + public Builder() { } @@ -92,6 +93,21 @@ public class OrderLegData { return this; } + public Builder originName(String originName) { + this.originName = originName; + return this; + } + + + public Builder destinationName(String destinationName) { + this.destinationName = destinationName; + return this; + } + + public void setDestinationName(String destinationName) { + this.destinationName = destinationName; + } + public Builder trainOrderDetailData(Object trainOrderDetailData) { this.trainOrderDetailData = trainOrderDetailData; return this; @@ -132,6 +148,7 @@ public class OrderLegData { return this; } + public Builder originId(Long originId) { this.originId = originId; return this; diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackHotel.java b/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackHotel.java index eb7ac14a..3c1a6311 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackHotel.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackHotel.java @@ -29,40 +29,40 @@ public class ResultBackHotel { @Data public static class OrderInfo { - private int orderType; + private Integer orderType; private String orderSerialNo; private String outEnterpriseId; - private int protocolType; - private double saveTotalPrice; - private double totalStandardPrice; + private Integer protocolType; + private Double saveTotalPrice; + private Double totalStandardPrice; private String outEmployeeId; private String employeeId; private String employeeCode; private String changeOrderSerialNo; - private boolean isChangeOrder; - private int orderStatus; + private Boolean isChangeOrder; + private Integer orderStatus; private String orderStatusDesc; private String createTime; - private int payType; - private int paymentType; - private double totalPrice; - private double diffPrice; - private double personalDiffPrice; - private double companyDiffPrice; - private double roomTotalPrice; - private double servicePrice; - private double afterSettlementServicePrice; + private Integer payType; + private Integer paymentType; + private Double totalPrice; + private Double diffPrice; + private Double personalDiffPrice; + private Double companyDiffPrice; + private Double roomTotalPrice; + private Double servicePrice; + private Double afterSettlementServicePrice; private String contactName; private String contactPhone; private String contactEmail; private String refundRule; - private String refundIntro; + private String refundIntegerro; private String servicePhone; - private boolean canRefund; - private double companyPrice; - private double personalPrice; + private Boolean canRefund; + private Double companyPrice; + private Double personalPrice; private String supplierOrderCreateTime; - private boolean ruleViolate; + private Boolean ruleViolate; private RuleViolateDetail ruleViolateDetail; private String foulReason; private String foulReasonCode; @@ -71,10 +71,10 @@ public class ResultBackHotel { private String cancelReasons; private String customerOrderNo; private String customerRefundOrderNo; - private int customerInvoiceCode; + private Integer customerInvoiceCode; private String customerInvoiceDesc; - private int halfDayRoom; - private double businessAmount; + private Integer halfDayRoom; + private Double businessAmount; } @Data @@ -92,23 +92,23 @@ public class ResultBackHotel { private String checkInDate; private String checkOutDate; private String hotelTel; - private int checkInTime; + private Integer checkIntegerime; private String roomName; private String bedType; private String breakfast; - private int roomNum; - private int nightNum; - private double bdLon; - private double bdLat; + private Integer roomNum; + private Integer nightNum; + private Double bdLon; + private Double bdLat; } @Data public static class DayPrice { private String date; private String dateStr; - private double price; - private double marketPrice; - private double savePrice; + private Double price; + private Double marketPrice; + private Double savePrice; private String breakfast; } @@ -146,16 +146,16 @@ public class ResultBackHotel { private String checkInDate; private String checkOutDate; private String confirmNo; - private int orderStatus; + private Integer orderStatus; private String orderStatusDesc; - private double salesPrice; - private double costPrice; - private double marketPrice; - private double savePrice; - private double standardPrice; + private Double salesPrice; + private Double costPrice; + private Double marketPrice; + private Double savePrice; + private Double standardPrice; private String dayStandardPrice; - private double servicePrice; - private double afterSettlementServicePrice; + private Double servicePrice; + private Double afterSettlementServicePrice; } diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java b/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java index d73c83bf..60f17e83 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java +++ b/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import static com.chint.infrastructure.constant.Constant.*; +import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA; /** * 酒店订单数据回推控制层 @@ -61,6 +62,14 @@ public class HotelBackController { //状态映射 command.eventType(mapHotelState(notification.getSubNotifyType())); command.sendToQueue(); + if (dataObject.getOrderInfo().getRuleViolate()){ + OrderStatusChangeCommand command2 = Command.of(OrderStatusChangeCommand.class) + .orderNo(serialNo) + .outStatus(String.valueOf(notification.getSubNotifyType())); + //状态映射 + command.eventType(ORDER_EVENT_ETA); + command.sendToQueue(); + } return new LYNoteResponse("100", "成功收到消息"); } return new LYNoteResponse("200", "未收到消息"); @@ -72,6 +81,7 @@ public class HotelBackController { case 1 -> OrderConstant.ORDER_EVENT_PAYED;//确认中 case 2,3,6 -> OrderConstant.ORDER_EVENT_ORDERED;//待入住,已变更,已退房 case 4,5 -> OrderConstant.ORDER_EVENT_CANCEL;//已取消,预定失败 + // case 50 -> OrderConstant.ORDER_EVENT_ETA;//超标 default -> -99; }; } From d9d18e1b2719282c32cb9fbb7768dfcc15f92aa3 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Fri, 1 Mar 2024 16:44:23 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chint/infrastructure/constant/LegConstant.java | 6 ++++-- .../chint/infrastructure/constant/RouteConstant.java | 2 +- .../repository/RouteRepositoryImpl.java | 8 ++++---- .../repository/jdbc/JdbcRouteRepository.java | 8 ++++---- src/test/java/com/chint/RouteApplicationTests.java | 11 +++++++++++ 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/chint/infrastructure/constant/LegConstant.java b/src/main/java/com/chint/infrastructure/constant/LegConstant.java index d9159a59..0220090a 100644 --- a/src/main/java/com/chint/infrastructure/constant/LegConstant.java +++ b/src/main/java/com/chint/infrastructure/constant/LegConstant.java @@ -12,10 +12,12 @@ public class LegConstant { public static final String LEG_STATUS_ORDERED_NAME = "已下单"; public static final int LEG_STATUS_PAYED = 5; public static final String LEG_STATUS_PAYED_NAME = "已付款"; - public static final int LEG_STATUS_FINISH = -2; + public static final int LEG_STATUS_FINISH = 9; public static final String LEG_STATUS_FINISH_NAME = "已结束"; public static final int LEG_STATUS_REJECT = -1; public static final String LEG_STATUS_REJECT_NAME = "审批未通过"; + + // 规划节点运输方式 public static final int LEG_TYPE_TRAIN = 0; public static final String LEG_TYPE_TRAIN_NAME = "火车"; @@ -58,7 +60,7 @@ public class LegConstant { public static final String LEG_EVENT_ORDERED_NAME = "下单事件"; public static final int LEG_EVENT_PAYED = 5; public static final String LEG_EVENT_PAYED_NAME = "付款事件"; - public static final int LEG_EVENT_FINISH = -2; + public static final int LEG_EVENT_FINISH = 9; public static final String LEG_EVENT_FINISH_NAME = "结束事件"; public static final int LEG_EVENT_REJECT = -1; public static final String LEG_EVENT_REJECT_NAME = "拒绝事件"; diff --git a/src/main/java/com/chint/infrastructure/constant/RouteConstant.java b/src/main/java/com/chint/infrastructure/constant/RouteConstant.java index e0bbac0f..8f8be66a 100644 --- a/src/main/java/com/chint/infrastructure/constant/RouteConstant.java +++ b/src/main/java/com/chint/infrastructure/constant/RouteConstant.java @@ -12,7 +12,7 @@ public class RouteConstant { public static final String ORDER_STATUS_ORDERED_NAME = "已下单"; public static final int ORDER_STATUS_PAYED = 4; public static final String ORDER_STATUS_PAYED_NAME = "已付款"; - public static final int ORDER_STATUS_FINISH = 5; + public static final int ORDER_STATUS_FINISH = 9; public static final String ORDER_STATUS_FINISH_NAME = "已结束"; public static final int ORDER_STATUS_REJECT = -1; public static final String ORDER_STATUS_REJECT_NAME = "审批拒绝"; diff --git a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java index b84816b7..2e68e7a8 100644 --- a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java @@ -53,7 +53,7 @@ public class RouteRepositoryImpl implements RouteRepository { String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString(); return jdbcRouteRepository .findByUserIdAndRouteOrderNoContainingOrApproveOrderNo_CreatorAndRouteOrderNoContaining( - Long.valueOf(employeeNo), + employeeNo, orderQueryData.getOrderNo(), employeeNo, orderQueryData.getOrderNo(), @@ -66,7 +66,7 @@ public class RouteRepositoryImpl implements RouteRepository { .of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("updateTime")); String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString(); return jdbcRouteRepository.findByUserIdAndApproveOrderNo_InstructionsContainingOrApproveOrderNo_CreatorAndApproveOrderNo_InstructionsContaining( - Long.valueOf(employeeNo), + employeeNo, orderQueryData.getInstructions(), employeeNo, orderQueryData.getInstructions(), @@ -84,7 +84,7 @@ public class RouteRepositoryImpl implements RouteRepository { .of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("updateTime")); String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString(); Page byUserId = jdbcRouteRepository - .findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long.valueOf(employeeNo), employeeNo, sort); + .findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(employeeNo, employeeNo, sort); List orders = byUserId.toList(); orders.forEach(RouteOrder::reloadStatus); return new PageResult<>(byUserId.getTotalElements(), orders); @@ -93,6 +93,6 @@ public class RouteRepositoryImpl implements RouteRepository { @Override public List findByActualOrderNoNotNull(OrderQueryData orderQueryData) { String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString(); - return jdbcRouteRepository.findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long.valueOf(employeeNo), employeeNo); + return jdbcRouteRepository.findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(employeeNo, employeeNo); } } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java index 08711078..38e7ec66 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java @@ -23,17 +23,17 @@ public interface JdbcRouteRepository extends CrudRepository { RouteOrder findByRouteOrderNo(String routeOrderNo); - Page findByUserIdAndRouteOrderNoContainingOrApproveOrderNo_CreatorAndRouteOrderNoContaining(Long userId, String routeOrderNo, String approveOrderNo_creator, String routeOrderNo2, Pageable pageable); + Page findByUserIdAndRouteOrderNoContainingOrApproveOrderNo_CreatorAndRouteOrderNoContaining(String userId, String routeOrderNo, String approveOrderNo_creator, String routeOrderNo2, Pageable pageable); - Page findByUserIdAndApproveOrderNo_InstructionsContainingOrApproveOrderNo_CreatorAndApproveOrderNo_InstructionsContaining(Long userId, String approveOrderNo_instructions, String approveOrderNo_creator, String approveOrderNo_instructions2, Pageable pageable); + Page findByUserIdAndApproveOrderNo_InstructionsContainingOrApproveOrderNo_CreatorAndApproveOrderNo_InstructionsContaining(String userId, String approveOrderNo_instructions, String approveOrderNo_creator, String approveOrderNo_instructions2, Pageable pageable); - Page findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long userId, String approveOrderNo_creator, Pageable pageable); + Page findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(String userId, String approveOrderNo_creator, Pageable pageable); - List findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long userId, String approveOrderNo_creator); + List findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(String userId, String approveOrderNo_creator); } diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 799b92db..f831e2ab 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -4,8 +4,10 @@ import cn.hutool.extra.pinyin.PinyinUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.chint.application.services.login.strategy.PailaLoginStrategy; +import com.chint.domain.aggregates.order.Leg; import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.user.User; +import com.chint.domain.repository.LegRepository; import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.OrderDetailRepository; import com.chint.domain.repository.RouteRepository; @@ -53,6 +55,9 @@ class RouteApplicationTests { @Autowired private PailaLoginStrategy pailaLoginStrategy; + @Autowired + private LegRepository legRepository; + private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365"); @@ -202,6 +207,12 @@ class RouteApplicationTests { orderDetailRepository.deleteById(31L); orderDetailRepository.deleteById(33L); } + @Test + void deleteLeg(){ + + legRepository.deleteById(Leg.of(506L)); + legRepository.deleteById(Leg.of(507L)); + } // @Test void ssoLogin(){ From e963b3d9649b354e71717c2ca73c1fa387ff9c7a Mon Sep 17 00:00:00 2001 From: lulz1 Date: Fri, 1 Mar 2024 16:55:40 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../queryies/estimate/CTripEstimatePrice.java | 12 ++++++++++-- .../chint/domain/value_object/PriceQueryData.java | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/chint/application/queryies/estimate/CTripEstimatePrice.java b/src/main/java/com/chint/application/queryies/estimate/CTripEstimatePrice.java index 126f3966..a489683e 100644 --- a/src/main/java/com/chint/application/queryies/estimate/CTripEstimatePrice.java +++ b/src/main/java/com/chint/application/queryies/estimate/CTripEstimatePrice.java @@ -89,7 +89,11 @@ public class CTripEstimatePrice implements EstimatePrice { .max(Comparator.comparing(BigDecimal::new));//获取最大值 if (optional.isPresent()) { String maxPrice = optional.get(); - trainPriceData.setMaxPrice(maxPrice); + if (priceQueryData.getIfRound() != null && priceQueryData.getIfRound().equals(1)) { + trainPriceData.setMaxPrice(String.valueOf(Integer.parseInt(maxPrice) * 2)); + } else { + trainPriceData.setMaxPrice(maxPrice); + } } return trainPriceData; } @@ -124,7 +128,11 @@ public class CTripEstimatePrice implements EstimatePrice { estimate.getData().getFlightValuationResult().getTotalPrice() ).ifPresentOrElse(price -> { flightPriceData.setSuccess(true); - flightPriceData.setMaxPrice(String.valueOf(price)); + if (priceQueryData.getIfRound() != null && priceQueryData.getIfRound().equals(1)) { + flightPriceData.setMaxPrice(String.valueOf(price.multiply(BigDecimal.valueOf(2)))); + } else { + flightPriceData.setMaxPrice(String.valueOf(price)); + } }, () -> { flightPriceData.setSuccess(false); flightPriceData.setMaxPrice("无估算价格"); diff --git a/src/main/java/com/chint/domain/value_object/PriceQueryData.java b/src/main/java/com/chint/domain/value_object/PriceQueryData.java index 0fea9dd0..1c49408a 100644 --- a/src/main/java/com/chint/domain/value_object/PriceQueryData.java +++ b/src/main/java/com/chint/domain/value_object/PriceQueryData.java @@ -8,4 +8,5 @@ public class PriceQueryData { private String arriveCity; private String departDate; private String arriveDate; + private Integer ifRound; }