package cn.superdesk.uniorder.dubbo.consumer.unified;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.security.JwtUtil;
import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
import cn.superdesk.uniorder.dao.entity.unified.UnifiedServiceGroup;
import cn.superdesk.uniorder.dto.vo.unified.UnifiedDrowMoneyPage;
import cn.superdesk.uniorder.dto.vo.unified.UnifiedDrowMoneyParam;
import cn.superdesk.uniorder.dto.vo.unified.UnifiedEncouragePage;
import cn.superdesk.uniorder.dto.vo.unified.UnifiedEncourageParam;
import cn.superdesk.uniorder.dto.vo.wechat.WxChannelItemList;
import cn.superdesk.uniorder.dubbo.facade.unified.DubboUnifiedEncourageService;
import com.alibaba.dubbo.config.annotation.Reference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @Description: 激励 相关 分润呀 激励金呀
 * @Author: linjinyu 补充 修改
 * @CreateDate: 5/27/20 7:37 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 5/27/20 7:37 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Slf4j
@Component
public class UnifiedEncourageDubboConsumerService {

	@Reference(version = "1.0.0", timeout = 30000, retries = -1)
	private DubboUnifiedEncourageService dubboUnifiedEncourageService;

	public Map<String, Object> addObj(String token, UnifiedEncourageParam param) {
		LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
		return dubboUnifiedEncourageService.addObj(param, loginSysUser);
	}

	public Map<String, Object> updateObj(String token, UnifiedEncourageParam param) {
		LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
		return dubboUnifiedEncourageService.updateObj(param, loginSysUser);
	}

	public R<List<UnifiedEncouragePage>> getPage(String token, Map<String, Object> params, int pageNum, int pageSize) {
		LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
		return dubboUnifiedEncourageService.getPage(params, pageNum, pageSize);
	}


	public UnifiedServiceGroup findServiceGroupByCode(String businessCode) {
		return dubboUnifiedEncourageService.findServiceGroupByCode(businessCode);
	}

	public Map<String, Object> profitAdd(String token, UnifiedDrowMoneyParam param) {
		LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
		return dubboUnifiedEncourageService.profitAdd(param, loginSysUser.getSysUserId());
	}

	public R<List<UnifiedDrowMoneyPage>> getPageProfit(String token, Map<String, Object> params, int pageNum, int pageSize) {
		LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
		return dubboUnifiedEncourageService.getPageProfit(params, pageNum, pageSize);
	}


	public BigDecimal getAmountProfit(Map<String, Object> amountProfitQuery) {
		return dubboUnifiedEncourageService.getAmountProfit(amountProfitQuery);
	}

	public BigDecimal getAmountEncourage(Map<String, Object> amountProfitQuery) {
		return dubboUnifiedEncourageService.getAmountEncourage(amountProfitQuery);
	}

	public BigDecimal getOrderAmount(Map<String, Object> amountQuery) {
		return dubboUnifiedEncourageService.getOrderAmount(amountQuery);
	}

	public Integer getVirtCountByChannelId(Map<String, Object> virtCountQuery) {
		return dubboUnifiedEncourageService.getVirtCountByChannelId(virtCountQuery);
	}

	public BigDecimal getAmountBack(Map<String, Object> amountProfitQuery) {
		return dubboUnifiedEncourageService.getAmountBack(amountProfitQuery);
	}

	public BigDecimal getAmountGetCash(Map<String, Object> amountGetCashQuery) {
		return dubboUnifiedEncourageService.getAmountGetCash(amountGetCashQuery);
	}

	public List<WxChannelItemList> getChannelItemList(Map<String, Object> channelListQuery) {
		return dubboUnifiedEncourageService.getChannelItemList(channelListQuery);
	}

	public List<UnifiedEncouragePage> getEncourageList(Map<String, Object> amountGetCashQuery) {
		return dubboUnifiedEncourageService.getEncourageList(amountGetCashQuery);
	}

	public List<UnifiedServiceGroup> getServiceGroupAll(Map<String, Object> params) {
		return dubboUnifiedEncourageService.getServiceGroupAll(params);
	}


}
