package com.casic.controller; import com.alibaba.fastjson.JSONObject; import com.casic.util.HttpClientUtil; import com.casic.util.ServerSocketUtil; 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 javax.annotation.Resource; import java.util.Map; @Slf4j @RestController public class DataForwardingController { @Value("${casic.url}") private String url; @Resource private ServerSocketUtil serverSocketUtil; @RequestMapping("/data/forwarding") public String dataForwarding(@RequestBody Map map) { JSONObject retObj = new JSONObject(); log.info(JSONObject.toJSONString(map)); try { HttpClientUtil.doPostJson("##" + JSONObject.toJSONString(map) + "**", url); // serverSocketUtil.sendMsg(JSONObject.toJSONString(map)); } catch (Exception ex) { log.error("错误"); } retObj.put("code", 200); retObj.put("success", true); return retObj.toJSONString(); } }