|
|
@@ -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;
|
|
|
@@ -31,18 +34,27 @@ public class uniPush2ServiceImpl implements uniPush2Service {
|
|
|
private OpenIMService openIMService;
|
|
|
// private static final String url = "https://fc-mp-de6e03a9-c1a3-439b-9eec-d0dc3c565e4e.next.bspapp.com/push";
|
|
|
|
|
|
- @Value("${openIM.pushUrl}")
|
|
|
- private String openIMpushUrl;
|
|
|
+// @Value("${openIM.pushUrl}")
|
|
|
+// private String openIMpushUrl;
|
|
|
|
|
|
@Autowired
|
|
|
private IFsUserService userService;
|
|
|
|
|
|
@Autowired
|
|
|
private UniPushLogService logService;
|
|
|
+ @Autowired
|
|
|
+ private ISysConfigService iSysConfigService;
|
|
|
|
|
|
@Override
|
|
|
public PushResult pushMessage(PushReqBean push) {
|
|
|
- String result = HttpUtil.post(openIMpushUrl, push.toString());
|
|
|
+ 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;
|
|
|
}
|