| | |
| | | BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime());
|
| | | // 免单处理
|
| | | boolean mianDan = false;
|
| | | if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_FK) {
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | commonOrder.getOrderNo());
|
| | | if (orderList != null && orderList.size() == 1) {// 只有1个订单才参与免单
|
| | |
| | |
|
| | | if (payMent.compareTo(new BigDecimal(10)) < 0) {
|
| | | mianDan = userSystemCouponRecordService.isSuccessMianDan(commonOrder.getOrderNo());
|
| | | fanliRate = new BigDecimal(100);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
|
| | | if (mianDan)
|
| | | hongBao.setMoney(commonOrder.getPayment());
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS) {
|
| | | hongBao.setState(HongBaoV2.STATE_KELINGQU);
|
| | | hongBao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
|
| | | hongBao.setPreGetTime(new Date(commonOrder.getSettleTime().getTime() + 1000 * 60 * 60 * 24 * 15L));
|
| | | if (mianDan)
|
| | | hongBao.setMoney(commonOrder.getSettlement().compareTo(commonOrder.getPayment()) <= 0
|
| | | ? commonOrder.getSettlement() : commonOrder.getPayment());//返利结算与付款较小的金额
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | hongBao.setState(HongBaoV2.STATE_SHIXIAO);
|
| | | hongBao.setMoney(new BigDecimal(0));
|
| | | if (mianDan) {
|
| | | try {
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | throw new HongBaoException(12, "免单券退款出错");
|
| | | }
|
| | | }
|
| | | }
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(hongBao);
|
| | |
|