From 6e62a17d19dd032b02102b5b9a7c8f6128929e89 Mon Sep 17 00:00:00 2001 From: dengwc Date: Fri, 29 Mar 2024 16:49:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=98=A0=E5=B0=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LyOrderRecordExtensionFactory.java | 27 ++++++++-- .../echo_framework/manager/EventManager.java | 49 ++++++++++--------- 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java index b0bb8193..61e9debb 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -131,6 +131,11 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setBookOrgCode2(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息2 .setBookOrgCode3(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息3 .setOfflineCcomyCode(lyOrderFlightRecord.getPassengerCostCenter()) //成本中心 + /* .setOrderStatus() //结算状态 + .setExpenseOrderAmount() //订单金额 + .setSettleOrderFlag() //订单对账状态 + .setPayAmount() //支付金额 +*/ ; } @@ -187,6 +192,11 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setBookOrgCode2("") //入住人组织架构信息2 .setBookOrgCode3("") //入住人组织架构信息3 .setOfflineCcomyCode(lyOrderHotelRecord.getPassengerCostCenter()) //成本中心 +/* .setOrderStatus() //结算状态 + .setExpenseOrderAmount() //订单金额 + .setSettleOrderFlag() //订单对账状态 + .setPayAmount() //支付金额 +*/ ; } @@ -234,14 +244,20 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setBookOrgCode2("")//出行人组织架构信息2 .setBookOrgCode3("")//出行人组织架构信息3 .setOfflineCcomyCode(lyOrderTrainRecord.getPassengerCostCenter())//成本中心 - .setTravelUserBirthday("")//生日 +/* .setOrderStatus() //结算状态 + .setExpenseOrderAmount() //订单金额 + .setSettleOrderFlag() //订单对账状态 + .setPayAmount() //支付金额 +*/ + +/* .setTravelUserBirthday("")//生日 .setTravelUserPhone("") //出行人手机号 .setTravelUserSex("")//"性别:0保密不展示 1男 2女" .setTravelUserType("") //"乘客类型:成人(ADULT) 儿童(CHILDREN) 婴儿(BABY)" .setPassportNo("")//乘客证件号 .setPassportType("")//乘客证件类型 .setTrainTime("")//发车时间 yyyy - MM - dd HH:mm:ss - .setYxId("")//影像比对ID + .setYxId("")//影像比对ID*/ ; } @@ -288,9 +304,10 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setPaymentType(String.valueOf(getPaymentType(lyOrderCarRecord.getPayType()))) //"付款方式0:公司统付 1:个人付 2:混付" .setOfflineCcomyCode(lyOrderCarRecord.getPassengerDepartment()) //成本中心 .setOrderSource(lyOrderCarRecord.getBookingPlat()) //预订来源:线上/线下 -// .setORDER_AMOUNT() //订单金额 -// .setSETTLE_ORDER_FLAG() //订单对账状态 -// .setpayAmount()// 支付金额 +/* .setExpenseOrderAmount() //订单金额 + .setSettleOrderFlag() //订单对账状态 + .setPayAmount()// 支付金额*/ + ; } 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 f73aab18..7f993e35 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 @@ -66,31 +66,36 @@ public class EventManager implements ApplicationContextAware, BeanNameAware, Ini } } + private void scanAndRegister(Object bean) { - Method[] methods = null; - //判断是何种类型的代理,使得动态代理的自定义注解不会失效 - if (AopUtils.isJdkDynamicProxy(bean)) { - Object singletonTarget = AopProxyUtils.getSingletonTarget(bean); - if (singletonTarget != null) { - methods = singletonTarget.getClass().getDeclaredMethods(); + Method[] methods = getTargetClassMethods(bean); + processAnnotation(methods, bean); + } + + private Method[] getTargetClassMethods(Object bean) { + //判断是何种类型的代理,获取动态代理后的原类的自定义注解,使其不会失效。 + if (AopUtils.isCglibProxy(bean)) { + return bean.getClass().getSuperclass().getDeclaredMethods(); + } else if (AopUtils.isJdkDynamicProxy(bean)) { + Object target = AopProxyUtils.getSingletonTarget(bean); + if (target != null) { + return target.getClass().getDeclaredMethods(); } - } else if (AopUtils.isCglibProxy(bean)) { - methods = bean.getClass().getSuperclass().getDeclaredMethods(); - } else { - methods = bean.getClass().getDeclaredMethods(); } - if (methods != null) { - for (Method method : methods) { - if (method.isAnnotationPresent(ListenTo.class)) { - ListenTo listenTo = method.getAnnotation(ListenTo.class); - MethodContainer container = new MethodContainer(bean, listenTo.order(), method); - listenerMethods.computeIfAbsent(listenTo.command(), k -> new ArrayList<>()).add(container); - } - if (method.isAnnotationPresent(TransitionTo.class)) { - TransitionTo transitionTo = method.getAnnotation(TransitionTo.class); - MethodContainer container = new MethodContainer(bean, transitionTo.order(), method); - transitionMethods.computeIfAbsent(transitionTo.command(), k -> new ArrayList<>()).add(container); - } + return bean.getClass().getDeclaredMethods(); + } + + private void processAnnotation(Method[] methods, Object bean) { + for (Method method : methods) { + if (method.isAnnotationPresent(ListenTo.class)) { + ListenTo listenTo = method.getAnnotation(ListenTo.class); + MethodContainer container = new MethodContainer(bean, listenTo.order(), method); + listenerMethods.computeIfAbsent(listenTo.command(), k -> new ArrayList<>()).add(container); + } + if (method.isAnnotationPresent(TransitionTo.class)) { + TransitionTo transitionTo = method.getAnnotation(TransitionTo.class); + MethodContainer container = new MethodContainer(bean, transitionTo.order(), method); + transitionMethods.computeIfAbsent(transitionTo.command(), k -> new ArrayList<>()).add(container); } } }