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_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 46 insertions(+), 4 deletions(-) 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