package com.dhcc.finance.main.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RestController;

import com.dhcc.common.constant.SysConstants;
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.model.CwGlVoucherAndName;
import com.dhcc.finance.main.model.FundsFlowInfoGydd;
import com.dhcc.finance.main.model.ThirdPmProjectChild;
import com.dhcc.finance.main.model.VoucherRequestInfo;
import com.dhcc.finance.main.model.XmlxAndBalance;
import com.dhcc.finance.main.service.FinanceForThirdService;

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

/**
 * 功能描述：财务对外接口
 * @author dml
 * @date 2019年5月23日 下午3:44:14
 * @修改日志：
 */
@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + FinanceForThirdController.API_PREFIX, 
  	          produces = {MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "财务对外接口controller", tags = { "财务对外接口" })
public class FinanceForThirdController {
	// 财务对外接口接口地址前缀
	public static final String API_PREFIX = "/finance_for_third";
	
	@Autowired
	FinanceForThirdService financeForThirdService;
	
	/**
	 * 功能描述：生成凭证信息
	 * @param thirdBusiBenlistInfo
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年5月23日 下午3:54:18
	 * @修改日志：
	 */
	@ApiOperation(value = "流水综合信息-生成凭证", notes = "生成凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "voucherRequestInfo", value = "流水综合信息", required = true, dataType = "VoucherRequestInfo")
	@RequestMapping(value = "/createVoucherInfo", method = RequestMethod.POST)
	RestfulResponse<Object, CurrencyMeta> createVoucherInfo(@RequestBody VoucherRequestInfo voucherRequestInfo){
		return financeForThirdService.createVoucherInfo(voucherRequestInfo);
	}
	
//	/**
//	 * 冲抹账处理
//	 * @param thirdBusiBenlistInfo
//	 * @return RestfulResponse<Object,CurrencyMeta>
//	 *@author huangpeng
//	 *@date 2019年5月24日 下午1:42:05
//	 *@修改日志：
//	 */
//	@ApiOperation(value = "冲抹账处理", notes = "冲抹账处理", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//	@ApiImplicitParam(name = "fundsFlowInfo", value = "资金募集及分配流水信息", required = true, dataType = "FundsFlowInfo")
//	@RequestMapping(value = "/updateBusiBenlistInfo", method = RequestMethod.PUT)
//	public RestfulResponse<Object, CurrencyMeta> updateBusiBenlistInfoForBatch(@RequestBody FundsFlowInfo fundsFlowInfo ) {
//		return financeForThirdService.updateBusiBenlistInfoForBatch(fundsFlowInfo);
//	}
//	
	/**
	 * 功能描述：生成账套信息
	 * @param ThirdPmProjectChild
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年6月4日 下午3:18:44
	 * @修改日志：
	 */
	@ApiOperation(value = "根据子项目生成账套信息", notes = "生成账套信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "thirdPmProjectChild", value = "子项目信息", required = true, dataType = "ThirdPmProjectChild")
	@RequestMapping(value = "/createGlorgbookInfo", method = RequestMethod.POST)
	RestfulResponse<Object, CurrencyMeta> createGlorgbookInfo(@RequestBody ThirdPmProjectChild thirdPmProjectChild){
		return financeForThirdService.createGlorgbookInfo(thirdPmProjectChild);
	}
	/**
	 * 功能描述  查询新增账套接口
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author huangpeng
	 * @date 2019年7月13日 上午11:17:47
	 * 修改日志
	 */
	@ApiOperation(value = "查询新增账套接口", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = { "/searchCwBdGlorgbookForNewAdd" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<List<CwBdGlorgbook>, CurrencyMeta> searchCwBdGlorgbookForNewAdd(){
		return financeForThirdService.searchCwBdGlorgbookForNewAdd();
    }
	/**
	 * 功能描述  查询今日新增凭证接口
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author huangpeng
	 * @date 2019年7月13日 上午11:17:47
	 * 修改日志
	 */
	@ApiOperation(value = " 查询今日新增凭证接口", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = { "/searchCwGlVoucherTodayAdd" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<List<CwGlVoucherAndName>, CurrencyMeta> searchCwGlVoucherTodayAdd(){
		 return financeForThirdService.searchCwGlVoucherTodayAdd();
    }
	/**
	 * 功能描述：查询实收信托
	 * @return RestfulResponse<List<>,CurrencyMeta>
	 * @author dml
	 * @date 2019年11月17日 下午4:19:04
	 * @修改日志：
	 */
	@ApiOperation(value = "按照单一集合财产权查询实收信托", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = { "/searchPaidInTrust" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<List<XmlxAndBalance>, CurrencyMeta> searchPaidInTrust(){
		return financeForThirdService.searchPaidInTrust();
    }
	/**
	 * 功能描述：查询资产端规模
	 * @return RestfulResponse<List<>,CurrencyMeta>
	 * @author dml
	 * @date 2019年11月17日 下午4:19:04
	 * @修改日志：
	 */
	@ApiOperation(value = "按照单一集合财产权查询资产端规模", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = { "/searchAssetScale" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<List<XmlxAndBalance>, CurrencyMeta> searchAssetScale(){
		return financeForThirdService.searchAssetScale();
    }
	
    /**
     * 功能描述：批量建账接口
     * @param thirdPmProjectChild
     * @return RestfulResponse<Object,CurrencyMeta>
     * @author dml
     * @date 2020年3月9日 下午2:25:44
     * @修改日志：
     */
	@ApiOperation(value = "批量建账接口", notes = "批量建账接口", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "thirdPmProjectChildList", value = "子项目信息", required = true, dataType = "List")
	@RequestMapping(value = "/createGlorgbookInfoBatch", method = RequestMethod.POST)
	RestfulResponse<Object, CurrencyMeta> createGlorgbookInfoBatch(@RequestBody List<ThirdPmProjectChild> thirdPmProjectChildList){
		return financeForThirdService.createGlorgbookInfoBatch(thirdPmProjectChildList);
	}
	
	/**
	 * 功能描述:固有代垫生成凭证信息
	 * @param fundsFlowInfoGydds
	 * @return RestfulResponse<Object,CurrencyMeta>
	 *@author likai
	 *@data 2020年4月15日下午3:24:45
	 *修改日志
	 */
	@ApiOperation(value = "固有代垫生成凭证", notes = "固有代垫生成凭证", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = SysConstants.MS_OPEN_INTERFACE+"/createVoucherInfoGydd", method = RequestMethod.POST)
	RestfulResponse<Object, CurrencyMeta> createVoucherInfoGydd(@RequestBody String params){
		return financeForThirdService.createVoucherInfoGydd(params);
	}
}	
