package com.dhcc.finance.main.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.dhcc.common.model.CurrencyMeta;
import com.dhcc.common.model.response.RestfulResponse;
import com.dhcc.finance.constant.MsConfigConsts;
import com.dhcc.finance.main.domain.CwBdGlorgbook;
import com.dhcc.finance.main.domain.CwHsGlorgbook;
import com.dhcc.finance.main.service.CwTjkOutcwVoucherService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwTjkOutcwVoucherController.API_PREFIX, 
  	          produces = {MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "估值对接凭证主表controller", tags = { "估值对接凭证主表接口" })
public class CwTjkOutcwVoucherController {
	public static final String API_PREFIX = "/cw_tjk_outcw_voucher";
	@Autowired
	CwTjkOutcwVoucherService cwTjkOutcwVoucherService;
	/**
	 * 功能描述    凭证数据导入
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author huangpeng
	 * @throws Exception 
	 * @date 2019年7月23日 下午5:23:06
	 * 修改日志
	 */
	@ApiOperation(value = "凭证数据导入(测试)", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
		@ApiImplicitParam(name = "list", value = "账套List", required = true, dataType = "List"),
        @ApiImplicitParam(name = "beginDate", value = "起始时间", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "endDate", value = "结束时间", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "isCheck", value = "是否和对", required = false, dataType = "Boolean", paramType="query")
    }) 
	@RequestMapping(value = { "/insertVoucherAndDetailInfo" }, method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
	RestfulResponse<Object, CurrencyMeta> insertVoucherAndDetailInfo(@RequestBody List<CwHsGlorgbook> list,
			@RequestParam(value="beginDate",required=false) String beginDate,
			@RequestParam(value="endDate",required=false) String endDate,
			@RequestParam(value="isCheck") Boolean isCheck){
		return cwTjkOutcwVoucherService.insertVoucherAndDetailInfo(list,beginDate,endDate,isCheck);
	}
	/**
	 * 功能描述：同步证券代码信息
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author likai
	 * @date 2020年7月22日 下午3:26:01
	 * @修改日志：
	 */
	@ApiOperation(value = "同步证券代码信息", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = "/insertCwHsOutcwZqxx", method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> insertCwHsOutcwZqxx(){
        return cwTjkOutcwVoucherService.insertCwHsOutcwZqxx();
    }
}
