From 29ca8afa441d0e01188757dc9fb2b5ec11c05c90 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@S0ZHK00LKCA6OYY> Date: 星期三, 28 十一月 2018 12:30:41 +0800 Subject: [PATCH] 分享赚返利规则调整 --- fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 42 insertions(+), 2 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java index de532c1..1e2fae5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java @@ -573,17 +573,37 @@ } } + 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()); @@ -608,10 +628,17 @@ } } + /** + * 澶勭悊椤剁骇鍒嗕韩璧� + */ + // 鏌ヨ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(); @@ -632,10 +659,15 @@ } } + /** + * 澶勭悊涓�绾т簩绾у垎浜禋 + */ + 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); @@ -643,8 +675,12 @@ 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()); @@ -656,6 +692,10 @@ } } + /** + * 澧炲姞鐢ㄦ埛璧勯噾璁板綍 + */ + if (money.compareTo(new BigDecimal(0)) > 0) { userInfoMapper.addHongBaoByUid(uid, money); // 娣诲姞璁板綍 -- Gitblit v1.8.0