package com.buy507.mall.portal.service.impl;

import com.buy507.mall.mapper.UmsMemberAccountTransactionMapper;
import com.buy507.mall.mapper.UmsMemberRelationTreeMapper;
import com.buy507.mall.model.OmsOrder;
import com.buy507.mall.model.UmsMember;
import com.buy507.mall.portal.service.MemberCommissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Service
public class MemberCommissionServiceImpl implements MemberCommissionService {

    /**
     * 会员上下关系
     */
    @Resource
    private UmsMemberRelationTreeMapper umsMemberRelationTreeMapper;

    /**
     * 会员分成流水
     */
    @Resource
    private UmsMemberAccountTransactionMapper umsMemberAccountTransactionMapper;

    /**
     * 线程池处理逻辑
     */
    private ExecutorService executorService = Executors.newFixedThreadPool(10);


    @Override
    public void computeCommission(OmsOrder order, UmsMember currentMember) {

        executorService.submit(()->{
            /**
             * 会员排队分红逻辑，及流水记账
             */
            System.out.println(order.getBillType());



        });




    }
}
