|
|
@@ -10,6 +10,8 @@ import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
|
+import com.fs.config.im.IMSystemConfig;
|
|
|
+import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.gtPush.domain.PushReqBean;
|
|
|
import com.fs.gtPush.domain.PushResult;
|
|
|
import com.fs.gtPush.domain.UniPushLog;
|
|
|
@@ -17,6 +19,7 @@ import com.fs.gtPush.service.UniPushLogService;
|
|
|
import com.fs.gtPush.service.uniPush2Service;
|
|
|
import com.fs.im.config.IMConfig;
|
|
|
import com.fs.im.service.OpenIMService;
|
|
|
+import com.fs.system.service.ISysConfigService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import com.fs.gtPush.utils.PushUtils;
|
|
|
@@ -47,6 +50,9 @@ public class uniPush2ServiceImpl implements uniPush2Service {
|
|
|
@Autowired
|
|
|
private IMConfig imConfig;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysConfigService configService;
|
|
|
+
|
|
|
@Override
|
|
|
public PushResult pushMessage(PushReqBean push) {
|
|
|
String result = HttpUtil.post(imConfig.getPushUrl(), JSON.toJSONString(push));
|
|
|
@@ -155,6 +161,10 @@ public class uniPush2ServiceImpl implements uniPush2Service {
|
|
|
if (param.getPayload() == null) {
|
|
|
param.setPayload(new HashMap<>());
|
|
|
}
|
|
|
+
|
|
|
+ if(imJsonString.length()>100){
|
|
|
+ imJsonString="";
|
|
|
+ }
|
|
|
param.getPayload().put("url", purl);
|
|
|
if (StringUtils.isNotBlank(imJsonString)) {
|
|
|
param.getPayload().put("extra", imJsonString);
|
|
|
@@ -173,9 +183,13 @@ public class uniPush2ServiceImpl implements uniPush2Service {
|
|
|
Map<String, Object> options = new HashMap<>();
|
|
|
Map<String, Object> android = new HashMap<>();
|
|
|
|
|
|
+
|
|
|
+ String json = configService.selectConfigByKey("im.config");
|
|
|
+ IMSystemConfig config = JSONUtil.toBean(json, IMSystemConfig.class);
|
|
|
// 小米
|
|
|
Map<String, Object> xm = new HashMap<>();
|
|
|
- xm.put("/extra.channel_id", "133892");
|
|
|
+ xm.put("/extra.channel_id", config.getXm_channel_id());
|
|
|
+
|
|
|
xm.put("/extra.notify_foreground", true);
|
|
|
android.put("XM", xm);
|
|
|
|
|
|
@@ -199,7 +213,7 @@ public class uniPush2ServiceImpl implements uniPush2Service {
|
|
|
hw.put("/message/android/category", "WORK");
|
|
|
hw.put("/message/android/notification/importance", "HIGH");
|
|
|
hw.put("/message/android/notification/visibility", "PUBLIC");
|
|
|
- hw.put("/message/android/notification/channel_id", "133892");
|
|
|
+ hw.put("/message/android/notification/channel_id", config.getHw_channel_id());
|
|
|
android.put("HW", hw);
|
|
|
|
|
|
// 鸿蒙
|
|
|
@@ -309,6 +323,11 @@ public class uniPush2ServiceImpl implements uniPush2Service {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ if(imJsonString.length()>100 ){
|
|
|
+ // 报文总共只能传 4096 长度
|
|
|
+ imJsonString="";
|
|
|
+ }
|
|
|
+
|
|
|
// payload
|
|
|
Map<String, Object> payload = new HashMap<>();
|
|
|
if (StringUtils.isNotBlank(purl)) {
|
|
|
@@ -329,9 +348,12 @@ public class uniPush2ServiceImpl implements uniPush2Service {
|
|
|
// options.android
|
|
|
Map<String, Object> android = new HashMap<>();
|
|
|
|
|
|
+ String json = configService.selectConfigByKey("im.config");
|
|
|
+ IMSystemConfig config = JSONUtil.toBean(json, IMSystemConfig.class);
|
|
|
+
|
|
|
// 小米
|
|
|
Map<String, Object> xm = new HashMap<>();
|
|
|
- xm.put("/extra.channel_id", "133892");
|
|
|
+ xm.put("/extra.channel_id", config.getXm_channel_id());
|
|
|
android.put("XM", xm);
|
|
|
|
|
|
// OPPO
|