| | |
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.order.HongBaoException;
|
| | | import com.yeshi.fanli.exception.order.InviteOrderSubsidyException;
|
| | |
| | | * 通知用户的返利情况
|
| | | */
|
| | |
|
| | | if (!Constant.IS_TEST) {
|
| | | if (hasAdd) {
|
| | | Iterator<Integer> its = notificationMap.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | Integer t = its.next();
|
| | | HongBaoV2 notify = notificationMap.get(t).getHongBaoV2();
|
| | | CommonOrder commonOrder = notificationMap.get(t).getCommonOrder();
|
| | | Long uid = notify.getUserInfo().getId();
|
| | | BigDecimal money = notify.getMoney();
|
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | | // if (!Constant.IS_TEST) {
|
| | | if (hasAdd) {
|
| | | // 获取订单补贴
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | | Iterator<Integer> its = notificationMap.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | Integer t = its.next();
|
| | | HongBaoV2 notify = notificationMap.get(t).getHongBaoV2();
|
| | | CommonOrder commonOrder = notificationMap.get(t).getCommonOrder();
|
| | | Long uid = notify.getUserInfo().getId();
|
| | |
|
| | | userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | |
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | |
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_ERJI:
|
| | |
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | |
|
| | | List<InviteOrderSubsidy> subsidyList = inviteOrderSubsidyService.listByOrderNoAndTypeAndUid(orderId,
|
| | | orderType, uid);
|
| | | BigDecimal subsidy = new BigDecimal(0);
|
| | | if (subsidyList != null)
|
| | | for (InviteOrderSubsidy s : subsidyList) {
|
| | | if (s.getState() != InviteOrderSubsidy.STATE_INVALID)
|
| | | subsidy = subsidy.add(s.getOriginalMoney());
|
| | | }
|
| | |
|
| | | BigDecimal money = notify.getMoney();
|
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state, commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | |
|
| | | userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, goodsCount, state, commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, subsidy, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | |
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, subsidy, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | |
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, subsidy, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_ERJI:
|
| | |
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType,
|
| | | commonOrder.getPayment(), money, subsidy, goodsCount, state,
|
| | | commonOrder.getThirdCreateTime());
|
| | |
|
| | | break;
|
| | |
|
| | | }
|
| | | }
|
| | | // }
|
| | | }
|
| | |
|
| | | int resultCode = 0;
|
| | |
| | | return CommonOrder.STATE_SX;
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private boolean updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type,
|
| | | Map<Integer, HongBaoOrder> notificationMap, Date placeOrderTime)
|
| | | throws HongBaoException, UserAccountException {
|
| | |
| | | }
|
| | |
|
| | | child.setUserInfo(user);
|
| | | child.setUrank(user.getRank());
|
| | | child.setUrank(userLevel.getOrderRank());
|
| | | child.setVersion(2);
|
| | | child.setCreateTime(new Date());
|
| | | child.setOrderType(commonOrder.getSourceType());
|
| | | if (child.getMoney() == null)
|
| | | return null;
|
| | | if (child.getMoney().compareTo(new BigDecimal(0)) <= 0 && userLevel == UserLevelEnum.daRen)
|
| | | return null;
|
| | | return child;
|
| | | }
|
| | |
| | | return hongBao;
|
| | | }
|
| | |
|
| | | private HongBaoV2 createFanLiUpdateHongBao(CommonOrder commonOrder, BigDecimal fanliRate, Long hongBaoId,
|
| | | private HongBaoV2 createFanLiUpdateHongBao(CommonOrder commonOrder, BigDecimal money, Long hongBaoId,
|
| | | boolean mianDan) throws HongBaoException, UserAccountException {
|
| | | HongBaoV2 hongBao = new HongBaoV2(hongBaoId);
|
| | | hongBao.setUpdateTime(new Date());
|
| | | hongBao.setMoney(money);
|
| | | // 更改状态与资金
|
| | | if (commonOrder.getState() == CommonOrder.STATE_FK) {
|
| | | 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 || commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | hongBao.setState(HongBaoV2.STATE_KELINGQU);
|
| | | hongBao.setMoney(MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
|
| | | if (commonOrder.getSourceType() == Constant.SOURCE_TYPE_PDD)// 拼多多15天过1个小时到账
|
| | | hongBao.setPreGetTime(new Date(
|
| | | commonOrder.getSettleTime().getTime() + 1000 * 60 * 60 * 24 * 15L + 1000 * 60 * 60 * 1L));
|
| | |
| | | * @throws HongBaoException
|
| | | * @throws UserAccountException
|
| | | */
|
| | | private HongBaoV2 createShareUpdateHongBao(CommonOrder commonOrder, BigDecimal fanliRate, Long hongBaoId)
|
| | | private HongBaoV2 createShareUpdateHongBao(CommonOrder commonOrder, BigDecimal money, Long hongBaoId)
|
| | | throws HongBaoException, UserAccountException {
|
| | | HongBaoV2 hongBao = new HongBaoV2(hongBaoId);
|
| | | hongBao.setUpdateTime(new Date());
|
| | | hongBao.setMoney(money);
|
| | | // 更改状态与资金
|
| | | if (commonOrder.getState() == CommonOrder.STATE_FK) {
|
| | | hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | hongBao.setMoney(MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), fanliRate.divide(new BigDecimal(100))));
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_WQ) {
|
| | | hongBao.setState(HongBaoV2.STATE_KELINGQU);
|
| | | hongBao.setMoney(MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), fanliRate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|