class WaterController {

	@PostMapping("/querywaterbyid")
	public ResBodyData queryWaterById(String waterId, String waterType, Integer loginType, String code,
			Integer pageNumber, Integer pageSize) {
		
		if(StringUtil.isEmpty(waterId) || StringUtil.isEmpty(waterType)){
			logger.error("流水编号或流水类型不能为空");
			throw new ServiceException(SettlementApiCode.WATERID_OR_WATERTYPE_ISNULL, BaseApiCode.getZhMsg(SettlementApiCode.WATERID_OR_WATERTYPE_ISNULL));
		}

		Map<String, Object> result = Maps.newHashMap();
		
		if(ShareProfitConstants.WATER_TYPE_DRAW_CASH.equals(waterType)){//提现流水详情
			
			result = waterService.getWaterType1Detail(waterId, waterType);
			
		}else if(ShareProfitConstants.WATER_TYPE_BILL.equals(waterType)){//账单流水详情
			//1：代理 2：商家 3：其他(比如admin)
			if(loginType==null){
				logger.error("查询账单流水详情，登陆类型不能为空");
				throw new ServiceException(SettlementApiCode.LOGIN_TYPE_ISNULL, BaseApiCode.getZhMsg(SettlementApiCode.LOGIN_TYPE_ISNULL));
			}else if(loginType==1 && StringUtil.isEmpty(code)){
				logger.error("查询账单流水详情，登陆类型为代理，代理编号不能为空");
				throw new ServiceException(SettlementApiCode.LOGIN_TYPE_AGENTCODE_ISNULL, BaseApiCode.getZhMsg(SettlementApiCode.LOGIN_TYPE_AGENTCODE_ISNULL));
			}
			
			Integer count = orderService.queryProfitCountByWaterId(waterId);
			
			List<EcmMzfShareProfit> shareProfitList=orderService.queryProfitByWaterByType(waterId,loginType,code,pageNumber,pageSize);
			
			result.put("shareProfitList", shareProfitList);
			result.put("total", count);
			
		}else if(ShareProfitConstants.WATER_TYPE_AGENT_PROFIT.equals(waterType) || ShareProfitConstants.WATER_TYPE_DEPOSIT.equals(waterType)){//代理费流水详情,保证金流水详情
			
			result = waterService.getWaterDetail(waterId, waterType);
		}
		
		return SettlementUtil.success(result);
	}

}