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

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.scheduler.SysQuartzScheduleTaskStatementOfAccount;
import cn.superdesk.uniorder.dto.param.accounting.AutoCreateScheduleTaskStatementOfAccountParam;
import cn.superdesk.uniorder.dto.param.accounting.AutoCreateScheduleTaskStatementOfAccountReportVo;
import cn.superdesk.uniorder.dto.param.scheduler.SysQuartzScheduleTaskStatementOfAccountParam;
import cn.superdesk.uniorder.dubbo.facade.scheduler.DubboSysQuartzScheduleTaskStatementOfAccountService;
import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @Description: 定时任务-时刻任务-对账单
 * @Author: linjinyu
 * @Email linjinyu@avic-s.com
 * @CreateDate: 2020-12-17 16:35:26
 * @UpdateUser: linjinyu
 * @UpdateDate: 2020-12-17 16:35:26
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Slf4j
@Component
public class SysQuartzScheduleTaskStatementOfAccountDubboConsumerService {

	@Reference(version = "1.0.0", timeout = 10000, retries = -1)
	private DubboSysQuartzScheduleTaskStatementOfAccountService dubboSysQuartzScheduleTaskStatementOfAccountService;


	/****************************************** extends BaseService 部分 start ******************************************/

	public void addObj(SysQuartzScheduleTaskStatementOfAccountParam param) {

		dubboSysQuartzScheduleTaskStatementOfAccountService.addObj(param);

	}

	public void updateObj(SysQuartzScheduleTaskStatementOfAccountParam param) {

		dubboSysQuartzScheduleTaskStatementOfAccountService.updateObj(param);
	}

	public void deleteObj(Long id) {

		dubboSysQuartzScheduleTaskStatementOfAccountService.deleteObj(id);
	}

	public SysQuartzScheduleTaskStatementOfAccount findById(Long id) {

		return dubboSysQuartzScheduleTaskStatementOfAccountService.findById(id);
	}

	public PageInfo<SysQuartzScheduleTaskStatementOfAccount> findByPaging(Map<String, Object> conditions, Integer pageNun, Integer pageSize) {

		return dubboSysQuartzScheduleTaskStatementOfAccountService.findByPaging(conditions, pageNun, pageSize);
	}

	public List<SysQuartzScheduleTaskStatementOfAccount> findAll(Map<String, Object> queryMap) {

		return dubboSysQuartzScheduleTaskStatementOfAccountService.findAll(queryMap);
	}

	/****************************************** extends BaseService 部分   end ******************************************/


	public void addSysQuartzScheduleTaskStatementOfAccount(SysQuartzScheduleTaskStatementOfAccountParam param) {

		dubboSysQuartzScheduleTaskStatementOfAccountService.addSysQuartzScheduleTaskStatementOfAccount(param);
	}


	public void updateSysQuartzScheduleTaskStatementOfAccount(SysQuartzScheduleTaskStatementOfAccountParam param) {

		dubboSysQuartzScheduleTaskStatementOfAccountService.updateSysQuartzScheduleTaskStatementOfAccount(param);
	}


	public void deleteSysQuartzScheduleTaskStatementOfAccount(Long id) {
		dubboSysQuartzScheduleTaskStatementOfAccountService.deleteSysQuartzScheduleTaskStatementOfAccount(id);
	}


	public SysQuartzScheduleTaskStatementOfAccount findSysQuartzScheduleTaskStatementOfAccountById(Long id) {

		return dubboSysQuartzScheduleTaskStatementOfAccountService.findSysQuartzScheduleTaskStatementOfAccountById(id);
	}


	public R<List<SysQuartzScheduleTaskStatementOfAccount>> pageQuery(Map<String, Object> conditions, int pageNun, int pageSize) {

		return dubboSysQuartzScheduleTaskStatementOfAccountService.pageQuery(conditions, pageNun, pageSize);
	}

	/**
	 * 自动 生成对账单 新做
	 *
	 * @param params
	 */
	public AutoCreateScheduleTaskStatementOfAccountReportVo autoCreateScheduleTaskStatementOfAccountDimOrder(String token, AutoCreateScheduleTaskStatementOfAccountParam params) {

		return dubboSysQuartzScheduleTaskStatementOfAccountService.autoCreateScheduleTaskStatementOfAccountDimOrder(token, params);
	}

	public AutoCreateScheduleTaskStatementOfAccountReportVo autoCreateScheduleTaskStatementOfAccountDimGoods(String token, AutoCreateScheduleTaskStatementOfAccountParam params) {

		return dubboSysQuartzScheduleTaskStatementOfAccountService.autoCreateScheduleTaskStatementOfAccountDimGoods(token, params);
	}

	public List<SysQuartzScheduleTaskStatementOfAccount> getToDoSysQuartzScheduleTaskStatementOfAccountList(int pageNun, int pageSize) {
		return dubboSysQuartzScheduleTaskStatementOfAccountService.getToDoSysQuartzScheduleTaskStatementOfAccountList(pageNun, pageSize);
	}

	/**
	 * 客户结算 查看任务 opt 执行任务
	 *
	 * @param token
	 * @param entity
	 */
	public void runTaskSysQuartzScheduleTaskStatementOfAccount(String token, SysQuartzScheduleTaskStatementOfAccount entity) {

		LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

		dubboSysQuartzScheduleTaskStatementOfAccountService.runTaskSysQuartzScheduleTaskStatementOfAccount(entity, loginSysUser);
	}

	public void runAsyncTaskSysQuartzScheduleTaskStatementOfAccount(String token, SysQuartzScheduleTaskStatementOfAccount entity) {

		LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);

		dubboSysQuartzScheduleTaskStatementOfAccountService.runAsyncTaskSysQuartzScheduleTaskStatementOfAccount(entity, loginSysUser);
	}

	public void kafkaStatementOfAccountDimOrderTaskReceive(String message) {

		LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(JwtUtil.FORGED_BACKEND_TOKEN);
		dubboSysQuartzScheduleTaskStatementOfAccountService.kafkaStatementOfAccountDimOrderTaskReceive(message, loginSysUser);

	}
}
