| | |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.jd.JDOrder; |
| | | import com.yeshi.fanli.entity.jd.JDOrderItem; |
| | | import com.yeshi.fanli.entity.money.InviteOrderSubsidyDebt; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods; |
| | | import com.yeshi.fanli.entity.order.CommonOrderTradeIdMap; |
| | |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService; |
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService; |
| | | import com.yeshi.fanli.service.inter.money.InviteOrderSubsidyDebtService; |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService; |
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService; |
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service; |
| | |
| | | |
| | | @Resource |
| | | private InviteOrderSubsidyService inviteOrderSubsidyService; |
| | | |
| | | @Resource |
| | | private InviteOrderSubsidyDebtService inviteOrderSubsidyDebtService; |
| | | |
| | | @Resource |
| | | private UserVIPInfoService userVIPInfoService; |
| | |
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType) { |
| | | // 奖励订单、免单 使用记录 |
| | | if (sourceType == null) { |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData); |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData, |
| | | hongBao); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip, |
| | | acceptData); |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip, acceptData, |
| | | hongBao); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) { |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip, |
| | | acceptData); |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip, acceptData, |
| | | hongBao); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip, |
| | | acceptData); |
| | | acceptData, hongBao); |
| | | } |
| | | } |
| | | |
| | | // 分享、邀请 隐藏订单号 |
| | | if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType || HongBaoV2.TYPE_YAOQING == hongBaoType |
| | | || HongBaoV2.TYPE_YIJI == hongBaoType || HongBaoV2.TYPE_ERJI == hongBaoType |
| | | // 邀请 隐藏订单号 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType || HongBaoV2.TYPE_ERJI == hongBaoType |
| | | || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) { |
| | | order.setOrderNo(UserUtil.filterOrderId(order.getOrderNo())); |
| | | } |
| | |
| | | * @param signList |
| | | */ |
| | | private void couponFactory(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, Integer hongBaoType, |
| | | List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData) throws Exception { |
| | | List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData, BigDecimal hongBao) |
| | | throws Exception { |
| | | |
| | | // 是否免单商品 |
| | | boolean freeOrder = false; |
| | |
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail")); |
| | | rewardMap.put("jump", jump); |
| | | order.setRewardDetail(rewardMap); |
| | | } |
| | | |
| | | // 使用奖励券 金额额限制 |
| | | if (hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) > 0) { |
| | | return; |
| | | } |
| | | |
| | | // 是否可使用奖励券 |
| | |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | Integer urank = order.getUrank(); |
| | | if (urank != null) { |
| | | String levelName = UserLevelUtil.getLevelName(urank); |
| | | if (!StringUtil.isNullOrEmpty(levelName)) { |
| | | order.setOrderDesc("订单来源:" + levelName); |
| | | UserLevelEnum levelEnum = UserLevelUtil.getByOrderRank(urank); |
| | | if (levelEnum != null) { |
| | | levelEnum = UserLevelUtil.getShowLevel(levelEnum); |
| | | order.setOrderDesc("订单来源:" + levelEnum.getName()); |
| | | } |
| | | } |
| | | } |
| | |
| | | orderStateMap.put("fontColor", "#666666"); |
| | | order.setOrderState(orderStateMap); |
| | | |
| | | String hongbaoInfo = ""; |
| | | // 订单标识 |
| | | List<String> signList = new ArrayList<String>(); |
| | | /* 订单返利类型 转换 */ |
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) { |
| | | // 自购 |
| | | hongbaoInfo = "返利"; |
| | | order.setOrderOrigin("1"); |
| | | order.setHongBaoTypePic(CommonOrder.TYPE_FANLI); |
| | | signList.add(CommonOrder.TYPE_FANLI); |
| | |
| | | } |
| | | } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType) { |
| | | // 分享 |
| | | hongbaoInfo = "奖金"; |
| | | order.setOrderOrigin("2"); |
| | | order.setHongBaoTypePic(CommonOrder.TYPE_SHARE); |
| | | signList.add(CommonOrder.TYPE_SHARE); |
| | |
| | | || HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_ERJI == hongBaoType) { |
| | | // 邀请订单 |
| | | hongbaoInfo = "收益"; |
| | | order.setOrderOrigin("3"); |
| | | order.setHongBaoTypePic(CommonOrder.TYPE_INVITE); |
| | | signList.add(CommonOrder.TYPE_INVITE); |
| | | |
| | | // 红包加上补贴金额 |
| | | InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid, orderNo, |
| | | sourceType); |
| | | if (orderSubsidy != null && orderSubsidy.getMoney() != null) { |
| | | BigDecimal subsidyMoney = orderSubsidy.getMoney(); |
| | | // 维权金额 |
| | | InviteOrderSubsidyDebt subsidyDebt = inviteOrderSubsidyDebtService |
| | | .getBySourceId(orderSubsidy.getId()); |
| | | if (subsidyDebt != null && subsidyDebt.getOriginMoney() != null) { |
| | | subsidyMoney = subsidyMoney.subtract(subsidyDebt.getOriginMoney()); |
| | | } |
| | | // 最终补贴 |
| | | if (subsidyMoney.compareTo(new BigDecimal(0)) > 0) { |
| | | hongBao = hongBao.add(subsidyMoney); |
| | | } |
| | | } |
| | | } |
| | | order.setSignList(signList); |
| | | |
| | |
| | | stateMap.put("content", stateContent); |
| | | stateMap.put("fontColor", stateFontColor); |
| | | order.setAccountState(stateMap); |
| | | hongbaoInfo = hongBaoState_Str + hongbaoInfo; |
| | | |
| | | Map<String, String> hongBaoMap = new HashMap<String, String>(); |
| | | hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); |
| | | hongBaoMap.put("content", |
| | | hongBaoState_Str + "收益 ¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); |
| | | hongBaoMap.put("fontColor", hongbaoInfoFontColor); |
| | | order.setHongBaoInfo(hongBaoMap); |
| | | |
| | |
| | | if (UserSystemCouponRecord.STATE_FREE_ON == state) { |
| | | text = "免单中"; |
| | | } else if (UserSystemCouponRecord.STATE_SUCCESS == state) { |
| | | text = "免单成功"; |
| | | text = "已免单"; |
| | | } |
| | | } |
| | | break; |
| | |
| | | order.setRewardDetail(rewardMap); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public long countOrderByUidAndSettled(Long uid, BigDecimal payment) { |
| | | Long count = commonOrderMapper.countOrderByUidAndSettled(uid, payment); |
| | | if (count == null) { |
| | | count = 0L; |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | } |