class AgentController {

	@PostMapping("/sharedeposit")
	public ResBodyData shareDeposit(@Validated EcmAgent ecmAgent) {
		
		long start = System.currentTimeMillis();
		logger.info("share profit for agent start:{}", start);
		
		//判断当前个代是否已分润过
		List<EcmMzfAgentWater> shareResults = agentService.getShareProfitResult(ecmAgent.getId(), ecmAgent.getRecNo());
		if(CollectionUtils.isNotEmpty(shareResults)){
			throw new ServiceException(SettlementApiCode.ALREADY_SHAREPROIFT, BaseApiCode.getZhMsg(SettlementApiCode.ALREADY_SHAREPROIFT));
		}
		
		//调用分润方法
		List<Map<String, Object>> resultList = depositService.shareDeposit(ecmAgent);
		
		long end = System.currentTimeMillis();
		logger.info("share profit for agent end:{}", end);
		logger.info("total time(second) for shareprofit:{}", (end - start) / 1000);
		
		if(CollectionUtils.isNotEmpty(resultList)){
			return SettlementUtil.success(resultList);
		}
		return null;
		

	}

}