Browse Source

【恒轮】舱体恒轮逻辑优化

lxb 1 year ago
parent
commit
153129792f

+ 17 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/MsgUtil.java

@@ -661,4 +661,21 @@ public class MsgUtil implements ApplicationContextAware {
     public Map redis_get_map(String key){
         return redisTemplate.opsForHash().entries(key);
     }
+
+    /**
+     * http post请求
+     * @return
+     */
+    public String httpForPost(String url,String params){
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
+        HttpEntity<String> formEntity = new HttpEntity<String>(params, headers);
+        String returnData = null;
+        try{
+            returnData = restTemplate.postForObject(url, formEntity, String.class);
+        }catch(BizException ex){
+            logger.error("接口{}数据远程调用失败,参数:{}", url,params);
+        }
+        return returnData;
+    }
 }