package com.qmth.qrzk.repository.user.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.qmth.qrzk.dao.IPaperPaperBatchDao;
import com.qmth.qrzk.repository.common.base.BaseDao;
import com.qmth.qrzk.repository.service.query.PaperBatchParams;
import com.qmth.qrzk.repository.service.query.PaperParams;
import com.qmth.qrzk.repository.user.model.PaperPaperBatch;
import com.qmth.qrzk.repository.user.service.IPaperPaperBatchService;

@Service("paperPaperBatchServiceImpl")
public class PaperPaperBatchServiceImpl implements IPaperPaperBatchService{
	@Autowired
	@Qualifier("paperPaperBatchDaoImpl")
	private IPaperPaperBatchDao	paperPaperBatchDaoImpl;
	
	@Autowired
	private BaseDao dao;

	
	public void insertPaperPaperBatch(PaperPaperBatch ppb) {
		paperPaperBatchDaoImpl.insert(ppb);
	}

	
	public int updateBatchIdWithPaperId(int batchId, int paperId) {
		// TODO Auto-generated method stub
		return paperPaperBatchDaoImpl.updateBatchIdWithPaperId(batchId, paperId);
	}

	
	public List<Integer> findPaperIdByBatchId(int batchId) {
		// TODO Auto-generated method stub
		List<Integer> ls=new ArrayList<Integer>();
		List<PaperPaperBatch> list=paperPaperBatchDaoImpl.findPaperIdByBatchId(batchId);
		for(PaperPaperBatch ppb:list){
			ls.add(ppb.getPaperId());
		}
		return ls;
	}

	
	public int removeFromBatch(PaperParams pp) {
		// TODO Auto-generated method stub
		return paperPaperBatchDaoImpl.removeFromBatch(pp);
	}

	
	public PaperPaperBatch findPaperPaperBatch(int batchId, int paperId) {
		// TODO Auto-generated method stub
		return paperPaperBatchDaoImpl.findPaperPaperBatch(batchId, paperId);
	}

	
	public int updateInfo(PaperBatchParams pbp) {
		// TODO Auto-generated method stub
		return paperPaperBatchDaoImpl.updateInfo(pbp);
	}

	
	public int updateRevocation(PaperBatchParams pbp) {
		// TODO Auto-generated method stub
		return paperPaperBatchDaoImpl.updateRevocation(pbp);
	}


	@Override
	public void deleteByBatchId(int batchId) {
		// TODO Auto-generated method stub
		paperPaperBatchDaoImpl.deleteByBatchId(batchId);
	}


	@Override
	public void updateIsAnswerSheetReturn(PaperParams pp) {
		// TODO Auto-generated method stub
		paperPaperBatchDaoImpl.updateIsAnswerSheetReturn(pp);
	}


	@Override
	public List<Integer> findPaperIdByIsStorageScanned(int batchId) {
		List<Integer> ls=new ArrayList<Integer>();
		List<PaperPaperBatch> list=paperPaperBatchDaoImpl.findPaperIdByIsStorageScanned(batchId);
		for(PaperPaperBatch ppb:list){
			ls.add(ppb.getPaperId());
		}
		return ls;
	}


	@Override
	public int getCountIsStorageScanned(PaperParams pp) {
		// TODO Auto-generated method stub
		return paperPaperBatchDaoImpl.getCountIsStorageScanned(pp);
	}


	@Override
	public int getCountIsOutBoundScanned(PaperParams pp) {
		// TODO Auto-generated method stub
		return paperPaperBatchDaoImpl.getCountIsOutBoundScanned(pp);
	}


	@Override
	public int removePaperFromBatch(PaperParams pp) {
		// TODO Auto-generated method stub
		return paperPaperBatchDaoImpl.removePaperFromBatch(pp);
	}


	@Override
	public void updatePaperPaperBatch(PaperPaperBatch ppb) {
		dao.update("updatePaperPaperBatch", ppb);
	}


}
