| | |
| | | }
|
| | | }
|
| | |
|
| | | private HongBao filterWeiQuanINGHongBao(HongBao hongBao) {
|
| | |
|
| | | List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hongBao.getOrderId(), "维权创建");
|
| | |
|
| | | List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList1 = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hongBao.getOrderId(), "等待处理");
|
| | | if ((taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
|
| | | || (taoBaoWeiQuanList1 != null && taoBaoWeiQuanList1.size() > 0)) {
|
| | | return null;
|
| | | }
|
| | | return hongBao;
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void fanliInvaiteAndShare(Long uid) throws TaoBaoWeiQuanException {
|
| | | /**
|
| | | * 处理邀请赚订单
|
| | | */
|
| | | // 查询UID的邀请赚订单
|
| | | List<HongBao> hongBaoList = hongBaoMapper.selectCanBalanceHongBaoByChildHongBaoAndUid(uid);
|
| | | BigDecimal money = new BigDecimal(0);
|
| | |
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | // 需要判断退款的订单号
|
| | | Set<String> drawBackOrders = new HashSet<String>();
|
| | |
|
| | | for (HongBao hongBao : hongBaoList) {
|
| | | hongBao = filterWeiQuanINGHongBao(hongBao);
|
| | | if (hongBao == null)
|
| | | continue;
|
| | | |
| | | hongBao = hongBaoMapper.selectByPrimaryKeyForUpdate(hongBao.getId());
|
| | | if (hongBao.getState() == HongBao.STATE_BUKELINGQU || hongBao.getState() == HongBao.STATE_KELINGQU) {
|
| | | money = money.add(hongBao.getMoney());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 处理顶级分享赚
|
| | | */
|
| | |
|
| | | // 查询UID的分享赚订单
|
| | | List<PidOrder> pidOrderList = pidOrderMapper.getCanBalanceListByUid(uid);
|
| | | for (PidOrder pidOrder : pidOrderList) {
|
| | | HongBao hongBao = hongBaoMapper.selectByPrimaryKeyForUpdate(pidOrder.getHongBao().getId());
|
| | | hongBao = filterWeiQuanINGHongBao(hongBao);
|
| | | if (hongBao == null)
|
| | | continue;
|
| | | if (hongBao.getState() == HongBao.STATE_BUKELINGQU || hongBao.getState() == HongBao.STATE_KELINGQU) {
|
| | | money = money.add(hongBao.getMoney());
|
| | | HongBao updateHongBao = new HongBao();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 处理一级二级分享赚
|
| | | */
|
| | |
|
| | | List<HongBao> totalHongBaoList = new ArrayList<>();
|
| | | // 查询UID的二级或者三级分享赚订单
|
| | | // TODO 暂时查询10000条数据,后面再做分页
|
| | | List<HongBao> hbList = hongBaoMapper.selectCanBalanceHongBaoByTypeAndUid(HongBao.TYPE_SHARE_YIJI, uid, 10000);
|
| | |
|
| | | if (hbList != null && hbList.size() > 0)
|
| | | totalHongBaoList.addAll(hbList);
|
| | |
|
| | |
| | | if (hbList != null && hbList.size() > 0)
|
| | | totalHongBaoList.addAll(hbList);
|
| | |
|
| | |
|
| | | for (HongBao hb : totalHongBaoList) {
|
| | | if (hb.getState() == HongBao.STATE_BUKELINGQU || hb.getState() == HongBao.STATE_KELINGQU) {
|
| | | hb = filterWeiQuanINGHongBao(hb);
|
| | | if (hb == null)
|
| | | continue;
|
| | | money = money.add(hb.getMoney());
|
| | | HongBao updateHongBao = new HongBao();
|
| | | updateHongBao.setId(hb.getId());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 增加用户资金记录
|
| | | */
|
| | |
|
| | | if (money.compareTo(new BigDecimal(0)) > 0) {
|
| | | userInfoMapper.addHongBaoByUid(uid, money);
|
| | | // 添加记录
|