| | |
| | | if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
|
| | | BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime());
|
| | | // 查询是否有免单计划
|
| | | boolean mianDan = false;
|
| | | BigDecimal mianDanMoney = null;
|
| | | if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_FK) {
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | commonOrder.getOrderNo());
|
| | |
| | | if (goods != null) {
|
| | |
|
| | | try {
|
| | | mianDan = userSystemCouponService.updateCouponRecordUsed(commonOrder.getUserInfo().getId(),
|
| | | commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId()));
|
| | | if (mianDan)
|
| | | fanliRate = new BigDecimal(100);
|
| | | if (userSystemCouponService.updateCouponRecordUsed(commonOrder.getUserInfo().getId(),
|
| | | commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId())))
|
| | | mianDanMoney = payMent;
|
| | | } catch (NumberFormatException e) {
|
| | | throw new HongBaoException(10, "免单商品处理出错");
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | throw new HongBaoException(11, "免单商品处理出错");
|
| | | }
|
| | | }
|
| | | }
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_SX) {//设置失效
|
| | | // userSystemCouponService.updateS
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | HongBaoV2 hongBao = new HongBaoV2();
|
| | |
| | | } else if (commonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | hongBao.setState(HongBaoV2.STATE_SHIXIAO);
|
| | | hongBao.setMoney(new BigDecimal(0));
|
| | |
|
| | | } else {
|
| | | throw new HongBaoException(3, "维权订单不能创建红包");
|
| | | }
|
| | |
|
| | | if (mianDanMoney != null)
|
| | | hongBao.setMoney(mianDanMoney);
|
| | |
|
| | | UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
|
| | | hongBao.setUrank(user.getRank());
|
| | | hongBaoV2Mapper.insertSelective(hongBao);
|
| | |
| | | }
|
| | |
|
| | | UserInfo boss = threeSaleSerivce.getBoss(user.getId());
|
| | | if (boss != null && hongBao.getState() != HongBaoV2.STATE_SHIXIAO && !mianDan) {// 1级BOSS存在且红包未失效,免单不支持多级分销
|
| | | if (boss != null && hongBao.getState() != HongBaoV2.STATE_SHIXIAO && mianDanMoney==null) {// 1级BOSS存在且红包未失效,免单不支持多级分销
|
| | |
|
| | | // 插入一级子红包
|
| | | BigDecimal firstRate = hongBaoManageService
|