package com.bootdo.system.service.device;

import java.util.List;

import com.bootdo.common.utils.WebUtils;
import com.bootdo.system.domain.AuthNetDeviceVo;
import com.bootdo.system.domain.RegisterResult;
import com.bootdo.system.domain.ResultMsg;
import feign.Feign;
import feign.Request;
import feign.Retryer;
import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder;

/**
 * @author smartcyl
 */
public class RegisterServiceImpl {

    private final RegisterService registerService ;


    public RegisterServiceImpl() {
        System.out.println("load~~~");
        registerService = Feign.builder()
                .encoder(new JacksonEncoder())
                .decoder(new JacksonDecoder())
                .options(new Request.Options(1000, 3500))
                .retryer(new Retryer.Default(5000, 5000, 3))
                //.target(RegisterService.class, "http://10.9.0.1:8052/cias-agent"); //内网
                .target(RegisterService.class, "http://103.118.52.158:8687/cias-agent"); //公网
    }




    public ResultMsg<RegisterResult> deviceRegister(AuthNetDeviceVo authNetDeviceVo){
        System.out.println("authNetDeviceVo:"+authNetDeviceVo.getDeviceCode());
        //WebUtils.doPost("http://103.118.52.158:8687/cias-agent/agent/api/reg/device",);
        System.out.println("registerService:"+registerService);
        return registerService.deviceRegister(authNetDeviceVo);
    }

}
