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 DopService{

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

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

}
