package com.dhcc.finance.main.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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.model.CwProjectCheckWeb;
import com.dhcc.finance.main.service.CwProjectCheckService;
import com.github.pagehelper.PageInfo;

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

/**
 * 功能描述：财务校验Controller
 * @author leiyu
 * @date 2020年4月21日 下午17:40:18
 * @修改日志：
 */
@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwProjectCheckController.API_PREFIX, produces = {
		MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "财务校验信息controller", tags = { "财务校验信息操作接口" })
public class CwProjectCheckController {
	// 财务校验信息接口地址前缀
	public static final String API_PREFIX = "/cw_project_check";
	public static final String JZRQ = "jzrq";

	@Autowired
	CwProjectCheckService cwProjectCheckService;
	
	@ApiOperation(value = "查询单个科目余额为负", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
		@ApiImplicitParam(name = "xtxmbh", value = "项目名称", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "xtzxmbh", value = "子项目名称", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "userId", value = "核算会计", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "jzrq", value = "截止日期", required = true, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query")
    }) 
	@RequestMapping(value = { "/selectSingleSubjectBalance" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<PageInfo<CwProjectCheckWeb>, CurrencyMeta> selectSingleSubjectBalance(
			@RequestParam(value="xtxmbh",required=false) String xtxmbh,
			@RequestParam(value="xtzxmbh",required=false) String xtzxmbh,
			@RequestParam(value="userId",required=false) String userId,
			@RequestParam(value= JZRQ,required=true) String jzrq,
			@RequestParam("pageNum") int pageNum,
    		@RequestParam("pageSize") int pageSize,
    		@RequestParam("navigatePages") int navigatePages){
		return cwProjectCheckService.selectSingleSubjectBalance(xtxmbh, xtzxmbh, userId, jzrq, pageNum, pageSize, navigatePages);
	}


	@ApiOperation(value = "查询未结束项目无信托规模", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
			@ApiImplicitParam(name = "xtxmbh", value = "项目名称", required = false, dataType = "String", paramType="query"),
			@ApiImplicitParam(name = "xtzxmbh", value = "子项目名称", required = false, dataType = "String", paramType="query"),
			@ApiImplicitParam(name = "userId", value = "核算会计", required = false, dataType = "String", paramType="query"),
			@ApiImplicitParam(name = JZRQ, value = "截止日期", required = true, dataType = "String", paramType="query"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
			@ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
			@ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query")
	})
	@RequestMapping(value = { "/selectNoScaleNoClosed" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<PageInfo<CwProjectCheckWeb>, CurrencyMeta> selectNoScaleNoClosed(
			@RequestParam(value="xtxmbh",required=false) String xtxmbh,
			@RequestParam(value="xtzxmbh",required=false) String xtzxmbh,
			@RequestParam(value="userId",required=false) String userId,
			@RequestParam(value=JZRQ,required=true) String jzrq,
			@RequestParam("pageNum") int pageNum,
			@RequestParam("pageSize") int pageSize,
			@RequestParam("navigatePages") int navigatePages){
		return cwProjectCheckService.selectNoScaleNoClosed(xtxmbh, xtzxmbh, userId, jzrq, pageNum, pageSize, navigatePages);
	}



	@ApiOperation(value = "未分配利润出现负数", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
		@ApiImplicitParam(name = "xtxmbh", value = "项目名称", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "xtzxmbh", value = "子项目名称", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "userId", value = "核算会计", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "jzrq", value = "截止日期", required = true, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query")
    }) 
	@RequestMapping(value = { "/selectUndistributedProfit" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<PageInfo<CwProjectCheckWeb>, CurrencyMeta> selectUndistributedProfit(
			@RequestParam(value="xtxmbh",required=false) String xtxmbh,
			@RequestParam(value="xtzxmbh",required=false) String xtzxmbh,
			@RequestParam(value="userId",required=false) String userId,
			@RequestParam(value="jzrq",required=true) String jzrq,
			@RequestParam("pageNum") int pageNum,
    		@RequestParam("pageSize") int pageSize,
    		@RequestParam("navigatePages") int navigatePages){
		return cwProjectCheckService.selectUndistributedProfit(xtxmbh, xtzxmbh, userId, jzrq, pageNum, pageSize, navigatePages);
	}
	
	@ApiOperation(value = "科目余额与辅助账余额不一致", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
		@ApiImplicitParam(name = "kmlx", value = "科目类型", required = true, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "xtxmbh", value = "项目名称", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "xtzxmbh", value = "子项目名称", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "userId", value = "核算会计", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "jzrq", value = "截止日期", required = true, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query")
    }) 
	@RequestMapping(value = { "/selectDifferentBalance" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<PageInfo<CwProjectCheckWeb>, CurrencyMeta> selectDifferentBalance(
			@RequestParam(value="kmlx",required=true) String kmlx,
			@RequestParam(value="xtxmbh",required=false) String xtxmbh,
			@RequestParam(value="xtzxmbh",required=false) String xtzxmbh,
			@RequestParam(value="userId",required=false) String userId,
			@RequestParam(value="jzrq",required=true) String jzrq,
			@RequestParam("pageNum") int pageNum,
    		@RequestParam("pageSize") int pageSize,
    		@RequestParam("navigatePages") int navigatePages){
		return cwProjectCheckService.selectDifferentBalance(kmlx, xtxmbh, xtzxmbh, userId, jzrq, pageNum, pageSize, navigatePages);
	}
	
	@ApiOperation(value = "已结束项目存在信托规模", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
		@ApiImplicitParam(name = "xtxmbh", value = "项目名称", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "xtzxmbh", value = "子项目名称", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "userId", value = "核算会计", required = false, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "xmyjzzr", value = "项目预计终止日", required = true, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query")
    }) 
	@RequestMapping(value = { "/selectScaleOfClosedProjects" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<PageInfo<CwProjectCheckWeb>, CurrencyMeta> selectScaleOfClosedProjects(
			@RequestParam(value="xtxmbh",required=false) String xtxmbh,
			@RequestParam(value="xtzxmbh",required=false) String xtzxmbh,
			@RequestParam(value="userId",required=false) String userId,
			@RequestParam(value="xmyjzzr",required=true) String xmyjzzr,
			@RequestParam("pageNum") int pageNum,
    		@RequestParam("pageSize") int pageSize,
    		@RequestParam("navigatePages") int navigatePages){
		return cwProjectCheckService.selectScaleOfClosedProjects(xtxmbh,xtzxmbh,userId,xmyjzzr,pageNum, pageSize, navigatePages);
	}
	
	/**
     * 功能描述 查询未归还固有代垫款项目
     *@param xtxmbh
     *@param xtzxmbh
     *@param userId
     *@param pageNum
     *@param pageSize
     *@param navigatePages
     *@return RestfulResponse<PageInfo<CwBdGlorgbookAndOther>,CurrencyMeta>
     *@author jiangyoushun
     *@date 2020年4月22日
     *修改日志:
     */
    @ApiOperation(value = "获取未归还固有代垫款项目信息列表", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
        @ApiImplicitParam(name = "xtxmbh", value = "项目名称", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "xtzxmbh", value = "子项目名称", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "userId", value = "核算会计", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "jzrq", value = "截止日期", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query")
    }) 
    @RequestMapping(value = {"/selectEntrustRewardBalance"}, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<PageInfo<CwProjectCheckWeb>, CurrencyMeta> selectEntrustRewardBalance(
            @RequestParam(value = "xtxmbh", required = false) String xtxmbh,
            @RequestParam(value = "xtzmbh", required = false) String xtzxmbh,
            @RequestParam(value = "userId", required = false) String userId,
            @RequestParam(value="jzrq",required=true) String jzrq,
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam("navigatePages") int navigatePages){
        return cwProjectCheckService.selectEntrustRewardBalance(xtxmbh,xtzxmbh,userId,jzrq,pageNum, pageSize, navigatePages);
    }
    
    /**
     * 功能描述 查询其他应付款余额超过100万
     *@param xtxmbh
     *@param xtzxmbh
     *@param userId
     *@param pageNum
     *@param pageSize
     *@param navigatePages
     *@return RestfulResponse<PageInfo<CwBdGlorgbookAndOther>,CurrencyMeta>
     *@author jiangyoushun
     *@date 2020年4月22日
     *修改日志:
     */
    @ApiOperation(value = "获取其他应付款余额超过100万信息列表", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
        @ApiImplicitParam(name = "xtxmbh", value = "项目名称", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "xtzxmbh", value = "子项目名称", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "userId", value = "核算会计", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "jzrq", value = "截止日期", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query")
    }) 
    @RequestMapping(value = {"/selectOtherPayablesBalance"}, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<PageInfo<CwProjectCheckWeb>, CurrencyMeta> selectOtherPayablesBalance(
            @RequestParam(value = "xtxmbh", required = false) String xtxmbh,
            @RequestParam(value = "xtzmbh", required = false) String xtzxmbh,
            @RequestParam(value = "userId", required = false) String userId,
            @RequestParam(value="jzrq",required=true) String jzrq,
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam("navigatePages") int navigatePages){
        return cwProjectCheckService.selectOtherPayablesBalance(xtxmbh,xtzxmbh,userId,jzrq,pageNum, pageSize, navigatePages);
    }
    
    /**
     * 功能描述 查询应付受益人收益有余额
     *@param xtxmbh
     *@param xtzxmbh
     *@param userId
     *@param pageNum
     *@param pageSize
     *@param navigatePages
     *@return RestfulResponse<PageInfo<CwBdGlorgbookAndOther>,CurrencyMeta>
     *@author jiangyoushun
     *@date 2020年4月22日
     *修改日志:
     */
    @ApiOperation(value = "获取应付受益人收益有余额信息列表", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
        @ApiImplicitParam(name = "xtxmbh", value = "项目名称", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "xtzxmbh", value = "子项目名称", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "userId", value = "核算会计", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "jzrq", value = "截止日期", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query")
    }) 
    @RequestMapping(value = {"/selectAccruedIncomeBalance"}, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<PageInfo<CwProjectCheckWeb>, CurrencyMeta> selectAccruedIncomeBalance(
            @RequestParam(value = "xtxmbh", required = false) String xtxmbh,
            @RequestParam(value = "xtzmbh", required = false) String xtzxmbh,
            @RequestParam(value = "userId", required = false) String userId,
            @RequestParam(value="jzrq",required=true) String jzrq,
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam("navigatePages") int navigatePages){
        return cwProjectCheckService.selectAccruedIncomeBalance(xtxmbh,xtzxmbh,userId,jzrq,pageNum, pageSize, navigatePages);
    }
    
    /**
     * 功能描述 查询科目辅助账存在负数
     *@param xtxmbh
     *@param xtzxmbh
     *@param userId
     *@param pageNum
     *@param pageSize
     *@param navigatePages
     *@return RestfulResponse<PageInfo<CwBdGlorgbookAndOther>,CurrencyMeta>
     *@author jiangyoushun
     *@date 2020年4月22日
     *修改日志:
     */
    @ApiOperation(value = "获取科目辅助账存在负数信息列表", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
        @ApiImplicitParam(name = "xtxmbh", value = "项目名称", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "xtzxmbh", value = "子项目名称", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "userId", value = "核算会计", required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "jzrq", value = "截止日期", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query")
    }) 
    @RequestMapping(value = {"/selectAssetAccountBalance"}, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<PageInfo<CwProjectCheckWeb>, CurrencyMeta> selectAssetAccountBalance(
    		@RequestParam(value="kmlx",required=true) String kmlx,
            @RequestParam(value = "xtxmbh", required = false) String xtxmbh,
            @RequestParam(value = "xtzmbh", required = false) String xtzxmbh,
            @RequestParam(value = "userId", required = false) String userId,
            @RequestParam(value="jzrq",required=true) String jzrq,
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam("navigatePages") int navigatePages){
        return cwProjectCheckService.selectAssetAccountBalance(kmlx, xtxmbh,xtzxmbh,userId,jzrq,pageNum, pageSize, navigatePages);
    }

}
