package vip.xiaonuo.erp.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import vip.xiaonuo.erp.entity.shengcan.ShiJiChanLiang;
import vip.xiaonuo.erp.entity.xiaoshou.*;
import vip.xiaonuo.erp.service.IErpShengChanService;
import vip.xiaonuo.erp.service.IErpXiaoShouService;

import java.util.List;


@Service
public class ErpXiaoShouServiceImpl implements IErpXiaoShouService {
    @Autowired
    private RestTemplate restTemplate;

    @Override
    public void getWanChengLvDingDanJinE() {
        ResponseEntity<List<XiaoShouWanChenLvJinE>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-XiaoShou/getWanChengLv?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<XiaoShouWanChenLvJinE>>() {}
        );
        List<XiaoShouWanChenLvJinE> forObjects = response.getBody();
        System.out.println(forObjects);
    }

    @Override
    public void getBaiFangKeHu() {
        ResponseEntity<List<BaiFangKeHu>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-XiaoShou/getBaiFangKeHu?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<BaiFangKeHu>>() {}
        );
        List<BaiFangKeHu> forObjects = response.getBody();
        System.out.println(forObjects);
    }

    @Override
    public void getFaPiaoJinE() {
        ResponseEntity<List<XiaoShouFaPiaoJinE>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-XiaoShou/getXiaoShouFaPiaoJinE?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<XiaoShouFaPiaoJinE>>() {}
        );
        List<XiaoShouFaPiaoJinE> forObjects = response.getBody();
        System.out.println(forObjects);
    }

    @Override
    public void getXianShodFaHboJainESheLangKeHuGongXian() {
        ResponseEntity<List<XiaoShouFaHuoJinEKeHuGongXian>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-XiaoShou/getXiaoShouFaHuoJinEKeHuGongXian?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<XiaoShouFaHuoJinEKeHuGongXian>>() {}
        );
        List<XiaoShouFaHuoJinEKeHuGongXian> forObjects = response.getBody();
        System.out.println(forObjects);
    }

    @Override
    public void getXiaoShouFeiYong() {
        ResponseEntity<List<XiaoShouFeiYong>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-XiaoShou/getXiaoShouFeiYong?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<XiaoShouFeiYong>>() {}
        );
        List<XiaoShouFeiYong> forObjects = response.getBody();
        System.out.println(forObjects);
    }

    @Override
    public void getYvQiHeTongMingXi() {
        ResponseEntity<List<YvQiHeTongMingXi>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-XiaoShou/getYvQiHeTongMingXi?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<YvQiHeTongMingXi>>() {}
        );
        List<YvQiHeTongMingXi> forObjects = response.getBody();
        System.out.println(forObjects);
    }
}
