InBoxSDK.java 1.08 KB
package com.yohoufo.inboxclient.sdk;

import com.yohoufo.inboxclient.common.UrlConstant;
import com.yohoufo.inboxclient.model.InBoxResponse;
import com.yohoufo.inboxclient.model.InboxReqVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * Created by shengguo.cai on 2018/9/19.
 */
@Service
public class InBoxSDK {
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private UrlConstant urlConstant;

    private final Logger log = LoggerFactory.getLogger(InBoxSDK.class);

    public InBoxResponse addInbox(InboxReqVO reqVO){
        log.info("addInbox with param is {}", reqVO);
        InBoxResponse result = restTemplate.getForObject(urlConstant.getInboxAddUrl()+"&uid={1}&type={2}&businessType={3}&params={4}",InBoxResponse.class,
                reqVO.getUid(),reqVO.getType(),reqVO.getBusinessType(),reqVO.getParams());
        log.info("addInbox call result is {}",result);
        return result;
    }
}