package com.dgtly.quartz.task;

import com.dgtly.common.utils.StringUtils;
import com.dgtly.sync.service.AnalysisDiyCustomerComponent;
import com.dgtly.sync.service.HanaOrderComponent;
import com.dgtly.sync.service.RelationCustomerOnlineComponent;
import com.dgtly.system.service.ISysUserOrderAuthorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定时任务调度测试
 * 
 * @author dgtly
 */
@Component("ryTask")
@Slf4j
public class RyTask
{

    @Autowired
    private AnalysisDiyCustomerComponent analysisDiyCustomerComponent;
    @Autowired
    private HanaOrderComponent hanaOrderComponent;
    @Autowired
    private RelationCustomerOnlineComponent relationCustomerOnlineComponent;
    @Autowired
    private ISysUserOrderAuthorService sysUserOrderAuthorService;

//    private static RyTask ryTask;
//    @PostConstruct
//    public void init() {
//        ryTask = this;
//        ryTask.analysisDiyCustomerComponent = this.analysisDiyCustomerComponent;
//    }

    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
    {
        log.info(StringUtils.format("执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}", s, b, l, d, i));
    }

    public void ryParams(String params)
    {
        log.info("执行有参方法：" + params);
    }

    public void ryNoParams()
    {
        log.info("执行无参方法");
    }

    /*立邦DIY人员定时同步*/
    public void analyDiyCustomer(){
        analysisDiyCustomerComponent.analyDiyCustomer();
    }

    /*立邦DIY人员定时同步*/
  /*  public void analyCwCustomer(){
        analysisDiyCustomerComponent.analyCwCustomer();
    }*/

    /*HANA订单数据定时同步*/
    public void hanaSalesOrderSync() throws Exception {
        hanaOrderComponent.hanaSalesOrderSync();
    }

    /*HANA交货单数据定时同步*/
    public void hanaDeliverOrderSync() throws Exception {
        hanaOrderComponent.hanaDeliverOrderSync();
    }

    /*关联经销商上线定时任务*/
    public void relationCustomerOnlineSync() throws Exception {
        relationCustomerOnlineComponent.relationCustomerOnlineSync();
    }

    /*初始化用户权限*/
    public void initUserAuthor() throws Exception {
        sysUserOrderAuthorService.initUserAuthor();
    }
    /**
     *
     * 离职用户标识
     * **/
    public void quitUser()throws Exception {
        sysUserOrderAuthorService.quitUser();
    }



    /**
     *
     * 维护经销商表
     * **/
    public void updateCustomers()throws Exception {
        sysUserOrderAuthorService.updateCustomers();
    }

    /**
     * 用户账号重复通知邮件
     * **/
    public void sendmailUnionUser()throws Exception{
        sysUserOrderAuthorService.sendmailUnionUser();
    }

    /**
     * 有道接口经销商用户账号重复进行业务处理
     * **/
    public void unionCustomerUser(){
        sysUserOrderAuthorService.unionCustomerUser();
    }

    /**
     * @description: 无tms工厂的交货单更新状态和订单
     * @param: []
     * @return: void
     * @author: njs
     * @date: 2023/2/23 13:16
     */
    public void tmsPlantByOrder(){
        sysUserOrderAuthorService.tmsPlantByOrder();
    }

    /**
     * @description: 经销商自动上线
     * @param:
     * @return:
     * @author: njs
     * @date: 2023/2/23 13:16
     */
    public void customersStart(){
        sysUserOrderAuthorService.customersStart();
    }
}
