admin
2018-12-10 3e5ec6f3a4dcb66a696fca86aee06a11f5464483
返利时加入返利和资金明细对应关系
3个文件已修改
45 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/AccountDetailsHongBaoMapServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/AccountDetailsHongBaoMapService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/AccountDetailsHongBaoMapServiceImpl.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.service.impl.hongbao;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
@@ -38,4 +39,12 @@
    }
    @Transactional
    @Override
    public void saveAccountDetailsHongBaoMap(List<Long> hongBaoIdList, Long accountDetailsId) {
        if (hongBaoIdList != null)
            for (Long hongBaoId : hongBaoIdList)
                saveAccountDetailsHongBaoMap(hongBaoId, accountDetailsId);
    }
}
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());
                // 维权扣款(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 {
fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/AccountDetailsHongBaoMapService.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.service.inter.hongbao;
import java.util.List;
/**
 * 红包ID与账户明细的资金对应
 * 
@@ -15,4 +17,12 @@
     */
    public void saveAccountDetailsHongBaoMap(Long hongBaoId, Long accountDetailsId);
    /**
     * 保存红包与资金明细的关系
     *
     * @param hongBaoIdList
     * @param accountDetailsId
     */
    public void saveAccountDetailsHongBaoMap(List<Long> hongBaoIdList, Long accountDetailsId);
}