From 96f9b33c5377febc8fc1fd686bcd870e0cc1b452 Mon Sep 17 00:00:00 2001 From: Andru <769883346@qq.com> Date: 星期三, 27 十二月 2023 17:48:33 +0800 Subject: [PATCH] 划扣填充订单关联信息 --- phi_platform_common/src/main/resources/mapper/platform/OrderInfoMapper.xml | 4 ++++ phi_platform_common/src/main/java/com/hx/phip/dao/mapper/OrderInfoMapper.java | 2 ++ phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/phi_platform_common/src/main/java/com/hx/phip/dao/mapper/OrderInfoMapper.java b/phi_platform_common/src/main/java/com/hx/phip/dao/mapper/OrderInfoMapper.java index a8da64c..2e895f3 100644 --- a/phi_platform_common/src/main/java/com/hx/phip/dao/mapper/OrderInfoMapper.java +++ b/phi_platform_common/src/main/java/com/hx/phip/dao/mapper/OrderInfoMapper.java @@ -32,4 +32,6 @@ int deleteWhere(SqlSentence sqlSentence); /**鍒犻櫎锛岃繑鍥炲垹闄ゆ暟閲�*/ int deleteById(Object object); + /**鏌ヨ锛岃繑鍥炲疄浣撶被娌℃湁澶ф暟鎹殑*/ + OrderInfo selectOneByOrderId(Object object); } \ No newline at end of file diff --git a/phi_platform_common/src/main/resources/mapper/platform/OrderInfoMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/OrderInfoMapper.xml index 859e18c..3bba6f0 100644 --- a/phi_platform_common/src/main/resources/mapper/platform/OrderInfoMapper.xml +++ b/phi_platform_common/src/main/resources/mapper/platform/OrderInfoMapper.xml @@ -86,5 +86,9 @@ <delete id="deleteById" parameterType="java.lang.Object"> delete from orders_info WHERE id = #{value} </delete> + + <select id="selectOneByOrderId" resultType="com.hx.phiappt.model.order.OrderInfo" parameterType="java.lang.Object" > + select * from orders_info WHERE orderId = #{value} + </select> </mapper> \ No newline at end of file diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java b/phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java index 294cc3d..6d9e8f0 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java +++ b/phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java @@ -25,14 +25,14 @@ import com.hx.phiappt.model.coupon.CouponReleaseRecordItem; import com.hx.phiappt.model.deduction.*; import com.hx.phiappt.model.giving.TurnAddItem; +import com.hx.phiappt.model.order.OrderInfo; +import com.hx.phiappt.model.order.OrderItem; +import com.hx.phiappt.model.order.OrderItemSon; import com.hx.phiappt.model.order.OrdersTotal; import com.hx.phiappt.model.project.ProjectInfo; import com.hx.phiappt.model.treat.TreatProjectDoctor; import com.hx.phiappt.model.treat.TreatSingle; -import com.hx.phiappt.model.user.UserProject; -import com.hx.phiappt.model.user.UserProjectItem; -import com.hx.phiappt.model.user.UserProjectTurn; -import com.hx.phiappt.model.user.UserProjectUsed; +import com.hx.phiappt.model.user.*; import com.hx.phiappt.model.userMoney.UserMoneyUnclaimed; import com.hx.phiappt.model.userStatus.UserStatusLog; import com.hx.phiappt.model.warehouse.ShopWarehouse; @@ -95,6 +95,8 @@ private CommonService commonService; @Resource private CustomParameter customParameter; + @Resource + private OrderInfoMapper orderInfoMapper; @Resource private TurnAddItemMapper turnAddItemMapper; @Resource @@ -631,6 +633,9 @@ deductionSingle.setUserStatus(user.getUserStatus()); // 鍒掓墸榛樿绫诲瀷 deductionSingle.setType(deductionDto.getType()); + // 娣诲姞鍏宠仈淇℃伅 + this.getRelationInfo(deductionSingle, userProjectItem); + // 娣诲姞鍒掓墸璁板綍 int count = deductionSingleMapper.insert(deductionSingle); if (count != 1) { throw new TipsException("鏂板澶辫触锛�"); @@ -4800,4 +4805,41 @@ logger.error("浣滃簾鍒掓墸鍙戦�氱煡缁欐姢澹暱鍑洪敊锛�", e); } } + + /** + * 鑾峰彇璁㈠崟鍏宠仈淇℃伅 + * @param deductionSingle 鍒掓墸瀵硅薄 + * @param userProjectItem 鐢ㄦ埛椤圭洰 + */ + private void getRelationInfo(DeductionSingle deductionSingle, UserProjectItem userProjectItem) { + String orderId = null; + if (OrderSourceConstans.TYPE_RETAIL.equals(userProjectItem.getCommonType())) { + // 浜岀骇鏌ヤ竴绾у�艰鍗曪紝鐢ㄦ埛鍗″寘鎵�鍏宠仈鐨勮鍗� + if (!StringUtils.isEmpty(userProjectItem.getCommonId())) { + OrderItemSon orderItemSon = commonService.selectOneByKey(OrderItemSonMapper.class, userProjectItem.getCommonId()); + if (orderItemSon != null) { + OrderItem orderItem = commonService.selectOneByKey(OrderItemMapper.class, orderItemSon.getOrderItemId()); + if (orderItem != null && OrderItemConstants.CARD_BAG.equals(orderItem.getType()) && !StringUtils.isEmpty(orderItem.getUserCardId())) { + UserCard userCard = commonService.selectOneByKey(UserCardMapper.class, orderItem.getUserCardId()); + if (userCard != null) { + orderId = userCard.getOrderId(); + } + } + } + } + } else { + // 涓�绾х洿鎺ラ偅璁㈠崟id + orderId = userProjectItem.getOrdersTotalId(); + } + // 鑾峰彇鍏宠仈淇℃伅 + if (!StringUtils.isEmpty(orderId)) { + OrderInfo orderInfo = orderInfoMapper.selectOneByOrderId(orderId); + if (orderInfo != null) { + // 濉厖鍏宠仈鍏崇郴 + deductionSingle.setRelationType(orderInfo.getRelationType()); + deductionSingle.setRelationId(orderInfo.getRelationId()); + deductionSingle.setRelationName(orderInfo.getRelationName()); + } + } + } } -- Gitblit v1.8.0