| | |
| | | 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; |
| | |
| | | private CommonService commonService; |
| | | @Resource |
| | | private CustomParameter customParameter; |
| | | @Resource |
| | | private OrderInfoMapper orderInfoMapper; |
| | | @Resource |
| | | private TurnAddItemMapper turnAddItemMapper; |
| | | @Resource |
| | |
| | | deductionSingle.setUserStatus(user.getUserStatus()); |
| | | // 划扣默认类型 |
| | | deductionSingle.setType(deductionDto.getType()); |
| | | // 添加关联信息 |
| | | this.getRelationInfo(deductionSingle, userProjectItem); |
| | | // 添加划扣记录 |
| | | int count = deductionSingleMapper.insert(deductionSingle); |
| | | if (count != 1) { |
| | | throw new TipsException("新增失败!"); |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | } |
| | | } |