Преглед изворни кода

Merge remote-tracking branch 'origin/企微聊天' into 企微聊天

ct пре 1 недеља
родитељ
комит
dc6187e69a

+ 16 - 1
fs-service/src/main/java/com/fs/gtPush/service/impl/uniPush2ServiceImpl.java

@@ -2,6 +2,7 @@ package com.fs.gtPush.service.impl;
 
 import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.alibaba.fastjson.JSON;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -14,6 +15,8 @@ import com.fs.gtPush.domain.UniPushLog;
 import com.fs.gtPush.service.UniPushLogService;
 import com.fs.gtPush.service.uniPush2Service;
 import com.fs.im.service.OpenIMService;
+import com.fs.system.domain.SysConfig;
+import com.fs.system.service.ISysConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import com.fs.gtPush.utils.PushUtils;
 import com.fs.his.domain.FsUser;
@@ -28,16 +31,28 @@ import java.util.Map;
 public class uniPush2ServiceImpl implements uniPush2Service {
     @Autowired
     private OpenIMService openIMService;
-    private static final String url = "https://fc-mp-de6e03a9-c1a3-439b-9eec-d0dc3c565e4e.next.bspapp.com/push";
+//    private static final String url = "https://fc-mp-de6e03a9-c1a3-439b-9eec-d0dc3c565e4e.next.bspapp.com/push";
+
+//    @Value("${openIM.pushUrl}")
+//    private String openIMpushUrl;
 
     @Autowired
     private IFsUserService userService;
 
     @Autowired
     private UniPushLogService logService;
+    @Autowired
+    private ISysConfigService iSysConfigService;
 
     @Override
     public PushResult pushMessage(PushReqBean push) {
+        SysConfig config = iSysConfigService.selectConfigByConfigKey("his.config");
+        JSONObject json = JSON.parseObject(config.getConfigValue());
+        String url = json.getString("appPushUrl");
+        if (StringUtils.isBlank(url)) {
+            throw new RuntimeException("his.config 中未配置 appPushUrl");
+        }
+
         String result = HttpUtil.post(url, push.toString());
         PushResult pushResult = JSONUtil.toBean(result, PushResult.class);
         return pushResult;