package com.casic.controller; import com.alibaba.fastjson.JSONObject; import com.casic.util.HttpClientUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Map; @Slf4j @RestController public class DataForwardingController { @Value("${casic.url}") private String url; @RequestMapping("/data/forwarding") public String dataForwarding(@RequestBody Map map) { JSONObject retObj = new JSONObject(); log.info(JSONObject.toJSONString(map)); String resp = ""; try { resp = HttpClientUtil.doPostJson("##" + JSONObject.toJSONString(map) + "**", url); } catch (Exception ex) { log.error("错误: " + ex.getMessage()); } retObj.put("response", resp); retObj.put("code", 200); retObj.put("success", true); log.info(retObj.toJSONString()); return retObj.toJSONString(); } }