package org.jeecg.modules.fbsPuArrivalvouch.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.fbsPuArrivalvouch.entity.FbsPuArrivalvouch;
import org.jeecg.modules.fbsPuArrivalvouch.mapper.FbsPuArrivalvouchMapper;
import org.jeecg.modules.fbsPuArrivalvouch.service.IFbsPuArrivalvouchService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 采购到货退货单主表（表头）
 * @author： jeecg-boot
 * @date：   2020-10-21
 * @version： V1.0
 */
@Service
@DS("multi-datasource1")
public class FbsPuArrivalvouchServiceImpl extends ServiceImpl<FbsPuArrivalvouchMapper, FbsPuArrivalvouch> implements IFbsPuArrivalvouchService {
    @Resource
    private FbsPuArrivalvouchMapper fbsPuArrivalvouchMapper;

    public List<Map<String,Object>> getWatingCheckList(){
        return fbsPuArrivalvouchMapper.getWatingCheckList();
    }

    public int getCheckSum(){
        return fbsPuArrivalvouchMapper.getCheckSum();
    }


    public List<Map<String,Object>> getWatingInList(){
        return fbsPuArrivalvouchMapper.getWatingInList();
    }

    public int getInSum(){
        return fbsPuArrivalvouchMapper.getInSum();
    }

    @Override
    public Map<String,Object> getPassRateByVendor() {
        //获取合格率数据
        List<FbsPuArrivalvouch> fbsPuArrivalvouchList=fbsPuArrivalvouchMapper.getPassRateByVendor();
        //封装map数据
        Map<String,Object> map=new HashMap<>();
        if(fbsPuArrivalvouchList!=null){
            for(FbsPuArrivalvouch fbsPuArrivalvouch:fbsPuArrivalvouchList){
                map.put(fbsPuArrivalvouch.getCVenName(),fbsPuArrivalvouch.getPassRate());
            }
        }
        return map;
    }

    @Override
    public Integer getTodayArriveSum() {
        return fbsPuArrivalvouchMapper.getTodayArriveSum();
    }

    @Override
    public Integer getWillArriveSum() {
        return fbsPuArrivalvouchMapper.getWillArriveSum();
    }

    @Override
    public Integer getThisMonthArriveSum() {
        return fbsPuArrivalvouchMapper.getThisMonthArriveSum();
    }

    @Override
    public Integer getNotInSum() {
        return fbsPuArrivalvouchMapper.getNotInSum();
    }

    @Override
    public  Map<String,Object> getCheckRateByBatchno() {
        //获取合格率数据
        List<FbsPuArrivalvouch> fbsPuArrivalvouchList=fbsPuArrivalvouchMapper.getCheckRateByBatchno();
        //封装map数据
        Map<String,Object> map=new HashMap<>();
        if(fbsPuArrivalvouchList!=null){
            for(FbsPuArrivalvouch fbsPuArrivalvouch:fbsPuArrivalvouchList){
                map.put(fbsPuArrivalvouch.getCVenName(),fbsPuArrivalvouch.getPassRate());
            }
        }
        return map;
    }

}
