diff --git a/pom.xml b/pom.xml
index acc5545a..dc8d08b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,6 +71,10 @@
knife4j-spring-boot-starter
3.0.3
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
diff --git a/src/main/java/com/chint/application/commands/LegSyncCommand.java b/src/main/java/com/chint/application/commands/LegSyncCommand.java
new file mode 100644
index 00000000..e50a7e3a
--- /dev/null
+++ b/src/main/java/com/chint/application/commands/LegSyncCommand.java
@@ -0,0 +1,25 @@
+package com.chint.application.commands;
+
+import com.chint.domain.value_object.SyncLegData;
+import com.chint.infrastructure.echo_framework.command.Command;
+import lombok.Data;
+
+import static com.chint.infrastructure.constant.Constant.LEG_EVENT_NOT_ORDERED;
+
+@Data
+public class LegSyncCommand extends Command {
+ private Integer LegEventType = LEG_EVENT_NOT_ORDERED;
+ private Long LegId;
+ private Long routOrderId;
+ private SyncLegData data;
+
+ public LegSyncCommand legId(Long LegId) {
+ this.setLegId(LegId);
+ return this;
+ }
+
+ public LegSyncCommand data(SyncLegData data) {
+ this.data = data;
+ return this;
+ }
+}
diff --git a/src/main/java/com/chint/application/commands/OrderCreateCommand.java b/src/main/java/com/chint/application/commands/OrderCreateCommand.java
new file mode 100644
index 00000000..870021da
--- /dev/null
+++ b/src/main/java/com/chint/application/commands/OrderCreateCommand.java
@@ -0,0 +1,15 @@
+package com.chint.application.commands;
+
+import com.chint.domain.value_object.UserLoginParam;
+import com.chint.infrastructure.echo_framework.command.Command;
+import lombok.Data;
+
+@Data
+public class OrderCreateCommand extends Command {
+ private UserLoginParam loginParam;
+
+ public OrderCreateCommand of(UserLoginParam loginParam) {
+ this.loginParam = loginParam;
+ return this;
+ }
+}
diff --git a/src/main/java/com/chint/application/out/LoginController.java b/src/main/java/com/chint/application/out/LoginController.java
index 311eb802..bd8ea167 100644
--- a/src/main/java/com/chint/application/out/LoginController.java
+++ b/src/main/java/com/chint/application/out/LoginController.java
@@ -1,13 +1,19 @@
package com.chint.application.out;
+import com.chint.application.commands.OrderCreateCommand;
import com.chint.domain.service.auth.AuthenticateService;
import com.chint.domain.value_object.UserLoginParam;
import com.chint.domain.value_object.UserLoginResult;
+import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
import static com.chint.infrastructure.constant.Constant.*;
@@ -18,6 +24,7 @@ public class LoginController {
@Autowired
private AuthenticateService authenticateService;
+ @Transactional
@GetMapping("/login")
public Result login(@RequestParam("sfno") String sfno,
@RequestParam("syscode") String syscode,
@@ -32,6 +39,8 @@ public class LoginController {
UserLoginParam userLoginParam = new UserLoginParam(sfno, syscode, billcode, timespan);
UserLoginResult userLoginResult = authenticateService
.authenticateEmployeeNo(userLoginParam);
+ //发送创建行程订单命令
+ Command.of(OrderCreateCommand.class).of(userLoginParam).sendToQueue();
return Result.Success(SUCCESS, userLoginResult);
} else {
return Result.error(SIGN_ERROR);
diff --git a/src/main/java/com/chint/application/services/OrderApplicationService.java b/src/main/java/com/chint/application/services/OrderApplicationService.java
index 4dc07e5d..c0655ef3 100644
--- a/src/main/java/com/chint/application/services/OrderApplicationService.java
+++ b/src/main/java/com/chint/application/services/OrderApplicationService.java
@@ -2,6 +2,7 @@ package com.chint.application.services;
import com.chint.application.commands.LegPrepareCommand;
import com.chint.domain.aggregates.order.RouteOrder;
+import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.factoriy.leg.LegFactory;
import com.chint.domain.factoriy.order.OrderFactory;
import com.chint.domain.repository.RouteRepository;
@@ -13,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import static com.chint.infrastructure.constant.Constant.NOT_FOUND;
+
@Service
public class OrderApplicationService {
@@ -35,10 +38,11 @@ public class OrderApplicationService {
order = routeRepository.queryById(orderSaveData.getRouteId());
order.reloadStatus(orderSaveData, legFactory);
} else {
- order = orderFactory.createOrder(orderSaveData);
+// order = orderFactory.createOrder(orderSaveData);
+ throw new NotFoundException(NOT_FOUND);
}
RouteOrder routeOrder = orderDomainService.saveOrder(order);
- //这里保存订单之后,需要为每个leg执行规划中事件
+ //这里保存订单之后,需要为每个新添加的leg执行规划中事件
routeOrder.getLegItems().forEach(leg ->
Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue()
);
diff --git a/src/main/java/com/chint/domain/aggregates/order/ApproveOrderNo.java b/src/main/java/com/chint/domain/aggregates/order/ApproveOrderNo.java
index 65467a17..53193228 100644
--- a/src/main/java/com/chint/domain/aggregates/order/ApproveOrderNo.java
+++ b/src/main/java/com/chint/domain/aggregates/order/ApproveOrderNo.java
@@ -6,4 +6,5 @@ import lombok.Data;
public class ApproveOrderNo {
private String fakeOrderNo;
private String actualOrderNo;
+ private String accountCompany;
}
diff --git a/src/main/java/com/chint/domain/aggregates/order/Leg.java b/src/main/java/com/chint/domain/aggregates/order/Leg.java
index 12d27ae1..a8cb81fa 100644
--- a/src/main/java/com/chint/domain/aggregates/order/Leg.java
+++ b/src/main/java/com/chint/domain/aggregates/order/Leg.java
@@ -107,6 +107,7 @@ public class Leg {
case LEG_STATUS_ORDERED -> LEG_STATUS_ORDERED_NAME;
case LEG_STATUS_PAYED -> LEG_STATUS_PAYED_NAME;
case LEG_STATUS_FINISH -> LEG_STATUS_FINISH_NAME;
+ case LEG_STATUS_NOT_ORDERED -> LEG_STATUS_NOT_ORDERED_NAME;
default -> "未知状态";
};
}
diff --git a/src/main/java/com/chint/domain/aggregates/order/LegEvent.java b/src/main/java/com/chint/domain/aggregates/order/LegEvent.java
index c9b28487..5262949d 100644
--- a/src/main/java/com/chint/domain/aggregates/order/LegEvent.java
+++ b/src/main/java/com/chint/domain/aggregates/order/LegEvent.java
@@ -34,6 +34,7 @@ public class LegEvent {
case LEG_EVENT_ORDERED -> LEG_EVENT_ORDERED_NAME;
case LEG_EVENT_PAYED -> LEG_EVENT_PAYED_NAME;
case LEG_EVENT_FINISH -> LEG_EVENT_FINISH_NAME;
+ case LEG_EVENT_NOT_ORDERED -> LEG_EVENT_NOT_ORDERED_NAME;
default -> "未知事件";
};
}
diff --git a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java
index 045108c4..4176abfc 100644
--- a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java
+++ b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java
@@ -157,6 +157,7 @@ public class RouteOrder extends BaseEntity {
case ORDER_STATUS_ORDERED -> ORDER_STATUS_ORDERED_NAME;
case ORDER_STATUS_PAYED -> ORDER_STATUS_PAYED_NAME;
case ORDER_STATUS_FINISH -> ORDER_STATUS_FINISH_NAME;
+ case ORDER_STATUS_NOT_ORDERED -> ORDER_STATUS_NOT_ORDERED_NAME;
default -> "未知状态";
};
}
diff --git a/src/main/java/com/chint/domain/factoriy/order/OrderFactory.java b/src/main/java/com/chint/domain/factoriy/order/OrderFactory.java
index f9917dbe..8adb40e0 100644
--- a/src/main/java/com/chint/domain/factoriy/order/OrderFactory.java
+++ b/src/main/java/com/chint/domain/factoriy/order/OrderFactory.java
@@ -1,9 +1,11 @@
package com.chint.domain.factoriy.order;
+import com.chint.application.commands.OrderCreateCommand;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.value_object.OrderSaveData;
public interface OrderFactory {
RouteOrder createOrder(OrderSaveData orderData);
+ RouteOrder createOrder(OrderCreateCommand command);
}
diff --git a/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java b/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java
index e854a163..2d163f8c 100644
--- a/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java
+++ b/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java
@@ -1,5 +1,6 @@
package com.chint.domain.factoriy.order;
+import com.chint.application.commands.OrderCreateCommand;
import com.chint.domain.aggregates.order.ApproveOrderNo;
import com.chint.domain.aggregates.order.Leg;
import com.chint.domain.aggregates.order.RouteOrder;
@@ -7,6 +8,7 @@ import com.chint.domain.aggregates.user.User;
import com.chint.domain.factoriy.leg.RouteLegFactory;
import com.chint.domain.value_object.LegData;
import com.chint.domain.value_object.OrderSaveData;
+import com.chint.domain.value_object.UserLoginParam;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.OrderNo;
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,4 +40,18 @@ public class RouteOrderFactory implements OrderFactory {
routeOrder.setLegItems(leglist);
return routeOrder;
}
+
+ @Override
+ public RouteOrder createOrder(OrderCreateCommand command) {
+ UserLoginParam loginParam = command.getLoginParam();
+ RouteOrder routeOrder = new RouteOrder();
+ routeOrder.setRouteOrderNo(OrderNo.generate());
+ //根据项目需求,需要保存假审批订单号,真审批订单号 ,创建的时候保存假审批订单号
+ routeOrder.setUserId(Long.valueOf(loginParam.getSfno()));
+ ApproveOrderNo approveOrderNo = new ApproveOrderNo();
+ approveOrderNo.setFakeOrderNo(loginParam.getBillcode());
+ routeOrder.setApproveOrderNo(approveOrderNo);
+ routeOrder.setBookingTime(LocalDateTime.now());
+ return routeOrder;
+ }
}
diff --git a/src/main/java/com/chint/domain/service/OrderDomainService.java b/src/main/java/com/chint/domain/service/OrderDomainService.java
index 53500abd..ff25bb49 100644
--- a/src/main/java/com/chint/domain/service/OrderDomainService.java
+++ b/src/main/java/com/chint/domain/service/OrderDomainService.java
@@ -1,22 +1,36 @@
package com.chint.domain.service;
+import com.chint.application.commands.OrderCreateCommand;
import com.chint.domain.aggregates.order.Leg;
import com.chint.domain.aggregates.order.RouteOrder;
+import com.chint.domain.aggregates.user.User;
+import com.chint.domain.factoriy.order.RouteOrderFactory;
import com.chint.domain.repository.LocationRepository;
import com.chint.domain.repository.RouteRepository;
+import com.chint.domain.repository.UserRepository;
+import com.chint.domain.value_object.UserLoginParam;
+import com.chint.infrastructure.echo_framework.annotation.ListenTo;
+import com.chint.infrastructure.util.BaseContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
+import java.util.Optional;
@Service
public class OrderDomainService {
@Autowired
private RouteRepository routeRepository;
+ @Autowired
+ private UserRepository userRepository;
+
@Autowired
private LocationRepository locationRepository;
+ @Autowired
+ private RouteOrderFactory routeOrderFactory;
+
public RouteOrder saveOrder(RouteOrder routeOrder) {
return routeRepository.save(routeOrder);
}
@@ -28,4 +42,16 @@ public class OrderDomainService {
});
return list;
}
+
+ @ListenTo(command = "OrderCreateCommand", order = 0)
+ public RouteOrder createOrder(OrderCreateCommand command) {
+ UserLoginParam loginParam = command.getLoginParam();
+ User byUserEmployeeNo = userRepository.findByUserEmployeeNo(Long.valueOf(loginParam.getSfno()));
+ return Optional.ofNullable(routeRepository.findByFakeOrderNo(loginParam.getBillcode())).orElseGet(() -> {
+ BaseContext.setCurrentUser(byUserEmployeeNo);
+ RouteOrder order = routeOrderFactory.createOrder(command);
+ this.saveOrder(order);
+ return order;
+ });
+ }
}
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 de20f930..3fef58f2 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
@@ -9,6 +9,7 @@ public interface LegEventService {
void prepareLeg(LegPrepareCommand command);
//审批事件要从bpm或其他平台接收到一个真实订单
void approveLeg(LegApprovalCommand command);
+ void syncLeg(LegSyncCommand command);
//下单事件
void 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 e165e392..9b10ebce 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
@@ -1,10 +1,7 @@
package com.chint.domain.service.leg_event;
import com.chint.application.commands.*;
-import com.chint.domain.aggregates.order.Leg;
-import com.chint.domain.aggregates.order.LegEvent;
-import com.chint.domain.aggregates.order.OrderDetail;
-import com.chint.domain.aggregates.order.RouteOrder;
+import com.chint.domain.aggregates.order.*;
import com.chint.domain.factoriy.leg_event.LegEventFactory;
import com.chint.domain.repository.LegRepository;
import com.chint.domain.repository.RouteRepository;
@@ -12,7 +9,10 @@ import com.chint.domain.service.order_sync.SyncAdapter;
import com.chint.domain.value_object.ApproveLegData;
import com.chint.domain.value_object.OrderLegData;
import com.chint.domain.value_object.PayLegData;
+import com.chint.domain.value_object.SyncLegData;
+
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
+import com.chint.infrastructure.echo_framework.annotation.TransitionTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -32,28 +32,29 @@ public class LegEventServiceImpl implements LegEventService {
@Autowired
private LegEventFactory legEventFactory;
- @Transactional
- @ListenTo(command = "LegPrepareCommand", order = 0)
+
+ @TransitionTo(command = "LegPrepareCommand", order = 0)
@Override
public void prepareLeg(LegPrepareCommand command) {
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
- LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
- leg.addEvent(legEvent);
- legRepository.save(leg);
+ if (leg.getEventList().isEmpty()) {
+ LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
+ leg.addEvent(legEvent);
+ legRepository.save(leg);
+ }
}
//因为审批是针对整个订单的,因此所有订单下属的行程节点触发审批事件
//出发审批提交事件 , 需要生成 差旅单 , 将差旅但提交到供应商 ,
//根据command里面选择的数据来讲差旅但提交到不同的实现类当中
- @Transactional
@ListenTo(command = "LegApprovalCommand", order = 0)
@Override
public void approveLeg(LegApprovalCommand command) {
ApproveLegData data = command.getData();
RouteOrder routeOrder = routeRepository.findByFakeOrderNo(data.getFakeOrderNo());
- routeOrder.getApproveOrderNo().setActualOrderNo(data.getActualOrderNo());
- String supplierName = data.getSupplierName();
- syncAdapter.of(supplierName).syncSupplierOrder(routeOrder);
+ ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
+ approveOrderNo.setActualOrderNo(data.getActualOrderNo());
+ approveOrderNo.setAccountCompany(data.getAccountCompany());
//这里order所有的leg触发approve事件
routeOrder.getLegItems().forEach(leg -> leg.getEventList().add(
@@ -64,7 +65,25 @@ public class LegEventServiceImpl implements LegEventService {
routeRepository.save(routeOrder);
}
- @Transactional
+ //这里需要获取同步类,价格routeOrder同步到供应商
+ @ListenTo(command = "LegSyncCommand", order = 0)
+ @Override
+ public void syncLeg(LegSyncCommand command) {
+ SyncLegData data = command.getData();
+ RouteOrder routeOrder = routeRepository.queryById(command.getRoutOrderId());
+ String supplierName = data.getSupplierName();
+
+ //这里order所有的leg触发approve事件
+ routeOrder.getLegItems().forEach(leg -> leg.getEventList().add(
+ legEventFactory.creatLegEvent(command.getLegEventType())
+ ));
+ syncAdapter.of(supplierName).syncSupplierOrder(routeOrder);
+
+ //保存routeOrder的状态
+ routeRepository.save(routeOrder);
+ }
+
+
@ListenTo(command = "LegOrderedCommand", order = 0)
@Override
public void orderLeg(LegOrderedCommand command) {
@@ -79,9 +98,9 @@ public class LegEventServiceImpl implements LegEventService {
legRepository.save(leg);
}
- @Transactional
- @ListenTo(command = "LegPayedCommand", order = 0)
+
@Override
+ @ListenTo(command = "LegPayedCommand", order = 0)
public void payForLeg(LegPayedCommand command) {
PayLegData data = command.getData();
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
@@ -94,9 +113,9 @@ public class LegEventServiceImpl implements LegEventService {
legRepository.save(leg);
}
- @Transactional
- @ListenTo(command = "LegFinishedCommand", order = 0)
+
@Override
+ @ListenTo(command = "LegFinishedCommand", order = 0)
public void finishLeg(LegFinishedCommand command) {
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
diff --git a/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java b/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java
index 61e1ccd6..4d52b841 100644
--- a/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java
+++ b/src/main/java/com/chint/domain/service/order_sync/LYOrderSyncAdapter.java
@@ -1,10 +1,12 @@
package com.chint.domain.service.order_sync;
+import com.chint.domain.aggregates.order.Location;
import com.chint.domain.aggregates.order.RouteOrder;
import org.springframework.stereotype.Component;
@Component
public class LYOrderSyncAdapter implements SupplierOrderSync {
+
@Override
public void syncSupplierOrder(RouteOrder order) {
System.out.println("开始同步同程订单");
diff --git a/src/main/java/com/chint/domain/value_object/ApproveLegData.java b/src/main/java/com/chint/domain/value_object/ApproveLegData.java
index e7b203a9..575a0386 100644
--- a/src/main/java/com/chint/domain/value_object/ApproveLegData.java
+++ b/src/main/java/com/chint/domain/value_object/ApproveLegData.java
@@ -4,7 +4,7 @@ import lombok.Data;
@Data
public class ApproveLegData {
- private String supplierName;
private String actualOrderNo;
private String fakeOrderNo;
+ private String accountCompany;
}
diff --git a/src/main/java/com/chint/domain/value_object/SyncLegData.java b/src/main/java/com/chint/domain/value_object/SyncLegData.java
new file mode 100644
index 00000000..d24aee3f
--- /dev/null
+++ b/src/main/java/com/chint/domain/value_object/SyncLegData.java
@@ -0,0 +1,8 @@
+package com.chint.domain.value_object;
+
+import lombok.Data;
+
+@Data
+public class SyncLegData {
+ private String supplierName;
+}
diff --git a/src/main/java/com/chint/infrastructure/constant/Constant.java b/src/main/java/com/chint/infrastructure/constant/Constant.java
index a7afee77..aa00b4d3 100644
--- a/src/main/java/com/chint/infrastructure/constant/Constant.java
+++ b/src/main/java/com/chint/infrastructure/constant/Constant.java
@@ -43,24 +43,28 @@ public class Constant {
public static final int ORDER_STATUS_PREPARE = 0;
public static final String ORDER_STATUS_PREPARE_NAME = "规划中";
public static final int ORDER_STATUS_APPROVAL = 1;
- public static final String ORDER_STATUS_APPROVAL_NAME = "审批中";
- public static final int ORDER_STATUS_ORDERED = 2;
+ public static final String ORDER_STATUS_APPROVAL_NAME = "提交审批";
+ public static final int ORDER_STATUS_NOT_ORDERED = 2;
+ public static final String ORDER_STATUS_NOT_ORDERED_NAME = "未下单";
+ public static final int ORDER_STATUS_ORDERED = 3;
public static final String ORDER_STATUS_ORDERED_NAME = "已下单";
- public static final int ORDER_STATUS_PAYED = 3;
+ public static final int ORDER_STATUS_PAYED = 4;
public static final String ORDER_STATUS_PAYED_NAME = "已付款";
- public static final int ORDER_STATUS_FINISH = 4;
+ public static final int ORDER_STATUS_FINISH = 5;
public static final String ORDER_STATUS_FINISH_NAME = "已结束";
// 规划节点状态
public static final int LEG_STATUS_PREPARE = 0;
public static final String LEG_STATUS_PREPARE_NAME = "规划中";
public static final int LEG_STATUS_APPROVAL = 1;
- public static final String LEG_STATUS_APPROVAL_NAME = "审批中";
- public static final int LEG_STATUS_ORDERED = 2;
+ public static final String LEG_STATUS_APPROVAL_NAME = "提交审批";
+ public static final int LEG_STATUS_NOT_ORDERED = 2;
+ public static final String LEG_STATUS_NOT_ORDERED_NAME = "未下单";
+ public static final int LEG_STATUS_ORDERED = 3;
public static final String LEG_STATUS_ORDERED_NAME = "已下单";
- public static final int LEG_STATUS_PAYED = 3;
+ public static final int LEG_STATUS_PAYED = 4;
public static final String LEG_STATUS_PAYED_NAME = "已付款";
- public static final int LEG_STATUS_FINISH = 4;
+ public static final int LEG_STATUS_FINISH = 5;
public static final String LEG_STATUS_FINISH_NAME = "已结束";
// 规划节点运输方式
@@ -80,11 +84,13 @@ public class Constant {
public static final String LEG_EVENT_PREPARE_NAME = "初始事件";
public static final int LEG_EVENT_APPROVAL = 1;
public static final String LEG_EVENT_APPROVAL_NAME = "审批事件";
- public static final int LEG_EVENT_ORDERED = 2;
+ public static final int LEG_EVENT_NOT_ORDERED = 2;
+ public static final String LEG_EVENT_NOT_ORDERED_NAME = "审批事件";
+ public static final int LEG_EVENT_ORDERED = 3;
public static final String LEG_EVENT_ORDERED_NAME = "下单事件";
- public static final int LEG_EVENT_PAYED = 3;
+ public static final int LEG_EVENT_PAYED = 4;
public static final String LEG_EVENT_PAYED_NAME = "付款事件";
- public static final int LEG_EVENT_FINISH = 4;
+ public static final int LEG_EVENT_FINISH = 5;
public static final String LEG_EVENT_FINISH_NAME = "结束事件";
// 金额
diff --git a/src/main/java/com/chint/infrastructure/echo_framework/annotation/BindingCommand.java b/src/main/java/com/chint/infrastructure/echo_framework/annotation/BindingCommand.java
index 7ddcb864..adffff78 100644
--- a/src/main/java/com/chint/infrastructure/echo_framework/annotation/BindingCommand.java
+++ b/src/main/java/com/chint/infrastructure/echo_framework/annotation/BindingCommand.java
@@ -3,13 +3,11 @@ package com.chint.infrastructure.echo_framework.annotation;
import com.chint.infrastructure.echo_framework.command.Command;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
-@Target(ElementType.TYPE)
+@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
+@Documented
public @interface BindingCommand {
Class extends Command> commandClass();
}
\ No newline at end of file
diff --git a/src/main/java/com/chint/infrastructure/echo_framework/annotation/ListenTo.java b/src/main/java/com/chint/infrastructure/echo_framework/annotation/ListenTo.java
index 7d12d78e..bf5ee290 100644
--- a/src/main/java/com/chint/infrastructure/echo_framework/annotation/ListenTo.java
+++ b/src/main/java/com/chint/infrastructure/echo_framework/annotation/ListenTo.java
@@ -1,13 +1,11 @@
package com.chint.infrastructure.echo_framework.annotation;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
// ListenTo Annotation
+@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.FIELD})
+@Documented
public @interface ListenTo {
String command();
long order();
diff --git a/src/main/java/com/chint/infrastructure/echo_framework/annotation/TransitionTo.java b/src/main/java/com/chint/infrastructure/echo_framework/annotation/TransitionTo.java
index 355bc4fe..20b907b4 100644
--- a/src/main/java/com/chint/infrastructure/echo_framework/annotation/TransitionTo.java
+++ b/src/main/java/com/chint/infrastructure/echo_framework/annotation/TransitionTo.java
@@ -1,13 +1,11 @@
package com.chint.infrastructure.echo_framework.annotation;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
// TransitionTo Annotation
+@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.FIELD})
+@Documented
public @interface TransitionTo {
String command();
long order();
diff --git a/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java b/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java
index 4d922f36..c5b57e20 100644
--- a/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java
+++ b/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java
@@ -1,6 +1,7 @@
package com.chint.infrastructure.echo_framework.manager;
+import com.chint.domain.service.leg_event.LegEventService;
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
import com.chint.infrastructure.echo_framework.annotation.TransitionTo;
import com.chint.infrastructure.echo_framework.command.Command;
@@ -17,7 +18,9 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionTemplate;
+import com.chint.domain.service.leg_event.LegEventServiceImpl;
+import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
@@ -85,7 +88,7 @@ public class EventManager implements ApplicationContextAware, BeanNameAware, Ini
List resultContainers = new ArrayList<>();
containers.forEach(container -> {
try {
- Object result = container.getMethod().invoke(container.getBean(), command, args);
+ Object result = container.getMethod().invoke(container.getBean(), command);
if (result instanceof ResultContainer) {
resultContainers.add((ResultContainer) result);
}
@@ -97,6 +100,7 @@ public class EventManager implements ApplicationContextAware, BeanNameAware, Ini
}
private static List processTransitionCommand(Command command) {
+ System.out.println(transitionMethods);
List containers = transitionMethods.getOrDefault(command.getCommandName(), Collections.emptyList());
List resultContainers = new ArrayList<>();
transactionTemplate.execute(transactionStatus -> {
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 cf8ddb5e..a51df694 100644
--- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java
+++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java
@@ -13,4 +13,5 @@ public interface JdbcRouteRepository extends CrudRepository {
RouteOrder findByRouteId(Long routeId);
RouteOrder findByApproveOrderNo_FakeOrderNo(String approveOrderNo_fakeOrderNo);
+
}
diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java b/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java
index f0e24a8f..63129e7f 100644
--- a/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java
+++ b/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java
@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@RequestMapping("/pubilc/CTrip")
+@RequestMapping("/public/CTrip")
public class CTripNoteController {
@PostMapping("/event")
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 67e95d95..08f9b334 100644
--- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java
+++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java
@@ -1,6 +1,7 @@
package com.chint.interfaces.rest.user;
+
import com.chint.dc.api.DataCenterResult;
import com.chint.dc.api.dto.DataCenterOption;
import com.chint.dc.api.service.DataCenterService;