| | |
| | | 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; |
| | |
| | | List<Integer> listSource) throws CommonOrderException, Exception { |
| | | |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | |
| | | List<CommonOrderVO> listOrder = commonOrderMapper.listUserOrder((page - 1) * pageSize, pageSize, uid, state, |
| | | type, orderState, orderNo, startTime, endTime, dateType, listSource); |
| | | |
| | |
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType) { |
| | | // 奖励订单、免单 使用记录 |
| | | if (sourceType == null) { |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData, hongBao); |
| | | 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, hongBao); |
| | | 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, hongBao); |
| | | 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, 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, BigDecimal hongBao) throws Exception { |
| | | List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData, BigDecimal hongBao) |
| | | throws Exception { |
| | | |
| | | // 是否免单商品 |
| | | boolean freeOrder = false; |
| | |
| | | } |
| | | |
| | | // 使用奖励券 金额额限制 |
| | | if (hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) > 0){ |
| | | if (hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) > 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // 是否可使用奖励券 |
| | | if (!rewardSuccess && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType |
| | | && HongBaoV2.STATE_YILINGQU == hongBaoState && !vip && CommonOrder.STATE_WQ != order.getState()) { |
| | |
| | | @Override |
| | | public List<CommonOrderVO> getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type, |
| | | Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, |
| | | List<Integer> listSource) throws CommonOrderException, Exception { |
| | | List<Integer> listSource, boolean notBackSuVip) throws CommonOrderException, Exception { |
| | | |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | |
| | | List<CommonOrderVO> listOrder = commonOrderMapper.getOrderList((page - 1) * pageSize, pageSize, uid, state, |
| | | type, orderState, orderNo, startTime, endTime, dateType, listSource); |
| | | type, orderState, orderNo, startTime, endTime, dateType, listSource,notBackSuVip); |
| | | |
| | | // 订单信息为空 |
| | | if (listOrder == null || listOrder.size() == 0) { |
| | |
| | | |
| | | @Override |
| | | public long countOrderList(Long uid, Integer state, Integer type, Integer orderState, String orderNo, |
| | | String startTime, String endTime, Integer dateType, List<Integer> listSource) throws CommonOrderException { |
| | | String startTime, String endTime, Integer dateType, List<Integer> listSource, boolean notBackSuVip) throws CommonOrderException { |
| | | return commonOrderMapper.countOrderList(uid, state, type, orderState, orderNo, startTime, endTime, dateType, |
| | | listSource); |
| | | listSource, notBackSuVip); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<String> listPDD = new ArrayList<String>(); |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_YIJI |
| | | || 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()); |
| | | } |
| | | } |
| | | } |
| | |
| | | List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper |
| | | .selectListByOrderIdAndState(order.getOrderNo(), "维权成功"); |
| | | BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid); |
| | | |
| | | if (settleTime != null) { |
| | | orderStateContent = "售后成功"; |
| | | WeiQuanInfo weiQuanInfo = new WeiQuanInfo(); |
| | | weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); |
| | | weiQuanInfo.setWqHongBao("售后:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); |
| | | order.setWeiQuanInfo(weiQuanInfo); |
| | | } |
| | | hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney); |
| | | } |
| | | } |
| | |
| | | orderStateMap.put("fontColor", "#666666"); |
| | | order.setOrderState(orderStateMap); |
| | | |
| | | |
| | | // 订单标识 |
| | | List<String> signList = new ArrayList<String>(); |
| | | /* 订单返利类型 转换 */ |
| | |
| | | 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); |
| | | |
| | |
| | | order.setAccountState(stateMap); |
| | | |
| | | Map<String, String> hongBaoMap = new HashMap<String, String>(); |
| | | hongBaoMap.put("content", hongBaoState_Str + "收益 ¥" + 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); |
| | | |
| | |
| | | text = "免单中"; |
| | | } else if (UserSystemCouponRecord.STATE_SUCCESS == state) { |
| | | 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; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String getNewestOrderNoByTaoBao() { |
| | | return commonOrderMapper.getNewestOrderNoByTaoBao(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<CommonOrder> listByOrderNo(String orderNo) { |
| | | return commonOrderMapper.listByOrderNo(orderNo); |
| | | } |
| | | |
| | | } |