package com.ssj.service.weixin.library.service.impl;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.dubbo.config.annotation.Service;
import com.ssj.bean.weixin.libmy.domain.LibVipDoc;
import com.ssj.bean.weixin.zyb.domain.ZuoybKnowHowDetails;
import com.ssj.dao.weixin.library.dao.LibVipDocDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.kmt.service.KmtCourseService;
import com.ssj.service.weixin.library.service.LibVipDocService;
import com.ssj.service.weixin.zuoyb.service.ZuoybKnowHowDetailsService;



@Service(version="1.0")
@Transactional
public class LibVipDocServiceImpl extends BaseServiceImpl<LibVipDoc, String> implements LibVipDocService {

	private   Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	private LibVipDocDao dao;
	
//	@Autowired
//	private ITzybService zybService;
	
	@Autowired
	private ZuoybKnowHowDetailsService zuoybKnowHowDetailsService;
	
	@Autowired
	private KmtCourseService kmtCourseService;
	
	

	@Override
	public PagingAndSortingRepository<LibVipDoc, String> getDao() {
		return dao;
	}

	@Override
	public void saveZuoybDocByVipId(String vipId, String howDetailsId,Integer num) {
		ZuoybKnowHowDetails zuoybKnowHowDetail=zuoybKnowHowDetailsService.getById(howDetailsId);
		LibVipDoc libVipDoc=new LibVipDoc();
		libVipDoc.setCreateTime(new Date());
		libVipDoc.setHowDetailsId(howDetailsId);
		libVipDoc.setName(zuoybKnowHowDetail.getName());
		libVipDoc.setState(LibVipDoc.ConstantState.NOT_MASTER);
		libVipDoc.setVipId(vipId);
		libVipDoc.setSource(2);
		libVipDoc.setWrongNum(num);
		libVipDoc.setCountNum(num);
		dao.save(libVipDoc);
	}
	
	
	
	@Override
	public void saveKmtDocByVipId(String courseId) {
		
	}



}
