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

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
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.main.dao.CwReverseOperationMapper;
import com.dhcc.finance.main.service.CwReverseOperationService;
import com.dhcc.finance.util.MetaDataUtil;

import brave.Tracer;

@Service
public class CwReverseOperationServiceImpl implements CwReverseOperationService{
	@Autowired
	private Tracer tracer;
	
	@Autowired
	CwReverseOperationMapper cwReverseOperationMapper;
	
	/*
	 * (非 Javadoc)  
	 * <p>Title: searchCwReverseOperationCount</p>  
	 * <p>Description: 查询反向操作数量 </p>
	 * @param reverseType
	 * @return  
	 * @see com.dhcc.finance.main.service.CwReverseOperationService#searchCwReverseOperationCount(java.lang.String)    
	 * @author huangpeng
	 * @date 2019年7月5日 下午2:06:25
	 * @修改日志：
	 */
	@Override
	public RestfulResponse<Integer, CurrencyMeta> searchCwReverseOperationCount(String reverseType) {
		Date dt = new Date();   
	    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");   
	    String today=sdf.format(dt);
		Integer count=cwReverseOperationMapper.searchCwReverseOperationCount(reverseType,today);
		return new RestfulResponse<Integer, CurrencyMeta>(SysConstants.CODE.SUCCESS,SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS,count,MetaDataUtil.getMeta(tracer,SysStatusCode.OPERATION_SUCCESS));
	}
}
