http使用 RestTemplate 发送 post 请求传递参数
代码参考如下
import com.wondersgroup.yilian.interface_monitor_portallogin.entity.ResponseEntity;
import com.alibaba.fastjson.JSONObject;
import com.wondersgroup.yilian.interface_monitor_portallogin.service.PortalloginService;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;
@Service
public class PortalloginServiceImpl implements PortalloginService {
@Override
public ResponseEntity validateLogin(JSONObject request) {
ResponseEntity response = new ResponseEntity();
String code = "-1";
String msg =