package com.dhcc.finance.main.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import com.dhcc.common.constant.SysConstants;
import com.dhcc.common.constant.SysStatusCode;
import com.dhcc.common.model.CurrencyMeta;
import com.dhcc.common.model.response.RestfulResponse;
import com.dhcc.finance.config.DhccCustomPropertiesConfig;
import com.dhcc.finance.constant.FinanceDictConsts;
import com.dhcc.finance.main.dao.CwBdAccassitemMapper;
import com.dhcc.finance.main.domain.CwBdAccassitem;
import com.dhcc.finance.main.domain.CwBdAccassitemExample;
import com.dhcc.finance.main.domain.CwBdAccassitemExample.Criteria;
import com.dhcc.finance.main.model.CwBdAccassitemWeb;
import com.dhcc.finance.main.service.CwBdAccassitemService;
import com.dhcc.finance.util.MetaDataUtil;

import brave.Tracer;

/**
 * 功能描述：辅助核算项目接口实现
 * @author dml
 * @date 2019年4月4日 上午11:19:07
 * @修改日志：
 */
@Service
public class CwBdAccassitemServiceImpl implements CwBdAccassitemService{
	@Autowired
	private Tracer tracer;
	
	@Autowired
	private DhccCustomPropertiesConfig dhccCustomPropertiesConfig;
	
	@Autowired
	private StringRedisTemplate stringRedisTemplate;
	
	@Autowired
	CwBdAccassitemMapper cwBdAccassitemMapper;

	/*
	 * (非 Javadoc)  
	 * Title: searchCwBdAccassitemAllData 
	 * Description:查询全部辅助核算项目
	 * @param pageNum
	 * @param pageSize
	 * @param navigatePages
	 * @return  
	 * @see com.dhcc.finance.main.service.CwBdAccassitemService#searchCwBdAccassitemAllData(int, int, int)    
	 * @author dml
	 * @date 2019年4月4日 上午11:28:47
	 * @修改日志：
	 */
	@Override
	public RestfulResponse<List<CwBdAccassitem>, CurrencyMeta> searchCwBdAccassitemAllData() {
		CwBdAccassitemExample cwBdAccassitemExample = new CwBdAccassitemExample();
		Criteria create = cwBdAccassitemExample.createCriteria();
		create.andUseStateEqualTo(FinanceDictConsts.Syzt.EFFECTIVE);
		List<CwBdAccassitem> selectByExample = cwBdAccassitemMapper.selectByExample(cwBdAccassitemExample);
		return new RestfulResponse<List<CwBdAccassitem>, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,selectByExample,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));
	}

	/* (非 Javadoc)  
	 * <p>Title: searchCwBdAccassitemForBatch</p>  
	 * <p>Description: </p>
	 * @param accassitemPks
	 * @return  
	 * @see com.dhcc.finance.main.service.CwBdAccassitemService#searchCwBdAccassitemForBatch(java.util.List)    
	 * @author huangpeng
	 * @date 2019年4月6日 下午2:22:40
	 * @修改日志：
	 */
	
	@Override
	public RestfulResponse<List<CwBdAccassitem>, CurrencyMeta> searchCwBdAccassitemForBatch(
			List<String> accassitemPks) {
		List<CwBdAccassitem> list =cwBdAccassitemMapper.selectForBatch(accassitemPks);
		return new RestfulResponse<List<CwBdAccassitem>, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,list,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));
	}
	/*
	 * (非 Javadoc)  
	 * <p>Title: searchCwBdAccassitemByPk</p>  
	 * <p>Description:根据主键获取辅助项信息 </p>
	 * @param accassitemPks
	 * @return  
	 * @see com.dhcc.finance.main.service.CwBdAccassitemService#searchCwBdAccassitemByPk(java.lang.String)    
	 * @author huangpeng
	 * @date 2019年6月15日 上午11:10:05
	 * @修改日志：
	 */
	@Override
	public RestfulResponse<CwBdAccassitem, CurrencyMeta> searchCwBdAccassitemByPk(String accassitemPks) {
		CwBdAccassitem selectByPrimaryKey = cwBdAccassitemMapper.selectByPrimaryKey(accassitemPks);
		return new RestfulResponse<CwBdAccassitem, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,selectByPrimaryKey,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));
	}
	/*
	 * (非 Javadoc)  
	 * <p>Title: searchPkAccassitemList</p>  
	 * <p>Description: 根据科目版本和科目获取辅助项数据</p>
	 * @param pkAccsubj
	 * @param pkSubjscheme
	 * @return  
	 * @see com.dhcc.finance.main.service.CwBdAccassitemService#searchPkAccassitemList(java.lang.String, java.lang.String)    
	 * @author huangpeng
	 * @date 2019年7月2日 下午9:53:59
	 * @修改日志：
	 */
	@Override
	public RestfulResponse<List<CwBdAccassitem>, CurrencyMeta> searchPkAccassitemList(String pkAccsubj, String pkSubjscheme) {
		List<CwBdAccassitem> list = cwBdAccassitemMapper.searchPkAccassitemList(pkSubjscheme, pkAccsubj);
		return new RestfulResponse<List<CwBdAccassitem>, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,list,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));
	}
	/*
	 * (非 Javadoc)  
	 * <p>Title: searchCwBdAccassitemForSypj</p>  
	 * <p>Description: 获取受益凭据信息 </p>
	 * @param xtzxmbh
	 * @return  
	 * @see com.dhcc.finance.main.service.CwBdAccassitemService#searchCwBdAccassitemForSypj(java.lang.String)    
	 * @author huangpeng
	 * @date 2019年10月30日 下午6:16:16
	 * @修改日志：
	 */
	@Override
	public RestfulResponse<List<CwBdAccassitemWeb>, CurrencyMeta> searchCwBdAccassitemForSypj(String xtzxmbh) {
		List<CwBdAccassitemWeb> list = cwBdAccassitemMapper.searchCwBdAccassitemForSypj(xtzxmbh);
		return new RestfulResponse<List<CwBdAccassitemWeb>, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,list,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));
	}


}
