From 3e5ec6f3a4dcb66a696fca86aee06a11f5464483 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 10 十二月 2018 14:55:02 +0800 Subject: [PATCH] 返利时加入返利和资金明细对应关系 --- fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 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 dbc4515..9f426ce 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 @@ -45,6 +45,7 @@ import com.yeshi.fanli.exception.OrderItemException; import com.yeshi.fanli.exception.TaoBaoWeiQuanException; import com.yeshi.fanli.log.LogHelper; +import com.yeshi.fanli.service.inter.hongbao.AccountDetailsHongBaoMapService; import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService; import com.yeshi.fanli.service.inter.hongbao.HongBaoService; import com.yeshi.fanli.service.inter.order.LostOrderService; @@ -136,9 +137,12 @@ @Resource private TaoBaoWeiQuanOrderMapper taoBaoWeiQuanOrderMapper; - + @Resource private HongBaoManageService hongBaoManageService; + + @Resource + private AccountDetailsHongBaoMapService accountDetailsHongBaoMapService; @Override public void processOrder(Map<String, List<TaoBaoOrder>> orders) { @@ -421,7 +425,7 @@ orderMapper.updateByPrimaryKeySelective(updateOrder); Order order = oldOrder; // 璁㈠崟杩斿埄姣斾緥 - BigDecimal rate = hongBaoManageService.getFanLiRate(); + BigDecimal rate = hongBaoManageService.getFanLiRate(); // 鏌ユ壘鏄惁瀛樺湪绾㈠寘 List<HongBao> hongBaoList = hongBaoMapper.selectByOid(order.getId()); @@ -504,6 +508,9 @@ AccountDetails accountDetails = AccountDetailsFactory.create("+" + hb.getMoney(), AccountDetailsFactory.FANLI, orderItem, null, hb.getUserInfo()); accountDetailsMapper.insertSelective(accountDetails); + + // 娣诲姞璧勯噾鏄庣粏涓庣孩鍖呯殑鏄犲皠鍏崇郴 + accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hb.getId(), accountDetails.getId()); // 缁存潈鎵f锛�2018-08-05鍚庡紑濮嬪疄琛岋級 if (hb.getBalanceTime() != null @@ -600,6 +607,8 @@ // 鏌ヨUID鐨勯個璇疯禋璁㈠崟 List<HongBao> hongBaoList = hongBaoMapper.selectCanBalanceHongBaoByChildHongBaoAndUid(uid); + List<Long> hbIdList = new ArrayList<>(); + BigDecimal money = new BigDecimal(0); // 闇�瑕佸垽鏂��娆剧殑璁㈠崟鍙� Set<String> drawBackOrders = new HashSet<String>(); @@ -607,7 +616,7 @@ 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()); @@ -616,6 +625,8 @@ updateHongBao.setGetTime(System.currentTimeMillis()); updateHongBao.setState(HongBao.STATE_YILINGQU); hongBaoMapper.updateByPrimaryKeySelective(updateHongBao); + // 娣诲姞鍒扮孩鍖呰繑鍒╄褰曢泦鍚� + hbIdList.add(hongBao.getId()); // 2018-08-05 杩囧悗鐨勮鍗曟墠澶勭悊缁存潈 Date balanceTime = null; if (hongBao.getParent() != null) @@ -650,6 +661,8 @@ updateHongBao.setGetTime(System.currentTimeMillis()); updateHongBao.setState(HongBao.STATE_YILINGQU); hongBaoMapper.updateByPrimaryKeySelective(updateHongBao); + // 娣诲姞鍒扮孩鍖呰繑鍒╄褰曢泦鍚� + hbIdList.add(hongBao.getId()); // 2018-08-05 杩囧悗鐨勮鍗曟墠澶勭悊缁存潈 Date balanceTime = null; if (hongBao.getParent() != null) @@ -679,7 +692,6 @@ 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); @@ -691,6 +703,8 @@ updateHongBao.setGetTime(System.currentTimeMillis()); updateHongBao.setState(HongBao.STATE_YILINGQU); hongBaoMapper.updateByPrimaryKeySelective(updateHongBao); + // 娣诲姞鍒扮孩鍖呰繑鍒╄褰曢泦鍚� + hbIdList.add(hb.getId()); if (!StringUtil.isNullOrEmpty(hb.getOrderId())) drawBackOrders.add(hb.getOrderId()); } @@ -706,6 +720,10 @@ AccountDetails accountDetails = AccountDetailsFactory.create("+" + money, AccountDetailsFactory.TICHENG, null, null, new UserInfo(uid)); accountDetailsMapper.insertSelective(accountDetails); + // 璁板綍杩斿埄绾㈠寘涓庤祫閲戣鎯呯殑瀵瑰簲鍏崇郴 + + // 娣诲姞鍒扮孩鍖呰繑鍒╄褰曢泦鍚� + accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hbIdList, accountDetails.getId()); // 鍙戦�佹帹閫� try { -- Gitblit v1.8.0