package com.nokia.service;


import com.nokia.vo.TokenFlagVo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;

@Service
public class TopService{

    @Value("${top.url}")
    private String topUrl;
    @Value("${top.api.fromSystem:tousu}")
    private String fromSystem;

    public TokenFlagVo topReturn(String token) {
        HashMap<Object, Object> hashMap = new HashMap<>();
        hashMap.put("token",token);
        hashMap.put("fromSystem",fromSystem);
        RestTemplate restTemplate = new RestTemplate();
        TokenFlagVo tokenFlagVo = restTemplate.postForObject(topUrl, hashMap, TokenFlagVo.class);
        return tokenFlagVo;
    }

}
