shengyang000 3 yıl önce
ebeveyn
işleme
a619203021

+ 1 - 1
src/main/java/com/unissoft/Swagger2Config.java

@@ -31,7 +31,7 @@ public class Swagger2Config {
31 31
     @Bean
32 32
     public Docket createRestApi() {
33 33
         return new Docket(DocumentationType.SWAGGER_2)
34
-                .host(swaggerHost)
34
+//                .host(swaggerHost)
35 35
                 .apiInfo(apiInfo())
36 36
                 .select()
37 37
                 .apis(RequestHandlerSelectors.basePackage("com.unissoft.controller"))

+ 4 - 4
src/main/java/com/unissoft/service/JpushService.java

@@ -3,15 +3,15 @@ package com.unissoft.service;
3 3
 
4 4
 import cn.jpush.api.push.PushResult;
5 5
 
6
-import java.util.List;
6
+import java.util.Collection;
7 7
 import java.util.Map;
8 8
 
9 9
 public interface JpushService {
10 10
 
11
-    PushResult sendMessagePush(String title, String content, Map<String, String> extras, List<String> registrationIds);
11
+    PushResult sendMessagePush(String title, String content, Map<String, String> extras, Collection<String> registrationIds);
12 12
 
13
-    PushResult sendNotificationPush(String title, String content, Map<String, String> extras, List<String> registrationIds);
13
+    PushResult sendNotificationPush(String title, String content, Map<String, String> extras, Collection<String> registrationIds);
14 14
 
15
-    void sendNotificationPushWithCallback(String title, String content, Map<String, String> extras, List<String> registrationIds);
15
+    void sendNotificationPushWithCallback(String title, String content, Map<String, String> extras, Collection<String> registrationIds);
16 16
 
17 17
 }

+ 8 - 6
src/main/java/com/unissoft/service/impl/JpushServiceImpl.java

@@ -26,8 +26,8 @@ import org.springframework.stereotype.Service;
26 26
 import javax.annotation.Resource;
27 27
 import java.net.URI;
28 28
 import java.net.URISyntaxException;
29
+import java.util.Collection;
29 30
 import java.util.HashMap;
30
-import java.util.List;
31 31
 import java.util.Map;
32 32
 
33 33
 
@@ -38,6 +38,8 @@ public class JpushServiceImpl implements JpushService {
38 38
     @Resource
39 39
     JpushConfig jpushConfig;// 注入配置信息
40 40
 
41
+
42
+
41 43
     /**
42 44
      * 推送自定义消息,不创建通知栏提醒,由APP端拦截信息后再决定是否创建通知
43 45
      *
@@ -47,7 +49,7 @@ public class JpushServiceImpl implements JpushService {
47 49
      * @param registrationIds   手机注册ID,设定哪些用户手机能接收信息
48 50
      */
49 51
     @Override
50
-    public PushResult sendMessagePush(String title, String content, Map<String, String> extras, List<String> registrationIds) {
52
+    public PushResult sendMessagePush(String title, String content, Map<String, String> extras, Collection<String> registrationIds) {
51 53
         ClientConfig clientConfig = getClientConfig();
52 54
 
53 55
         // 使用NativeHttpClient网络客户端,连接网络的方式,不提供回调函数
@@ -83,7 +85,7 @@ public class JpushServiceImpl implements JpushService {
83 85
      *
84 86
      */
85 87
     @Override
86
-    public PushResult sendNotificationPush(String title, String content, Map<String, String> extras, List<String> registrationIds) {
88
+    public PushResult sendNotificationPush(String title, String content, Map<String, String> extras, Collection<String> registrationIds) {
87 89
         ClientConfig clientConfig = getClientConfig();
88 90
 
89 91
         // 使用NativeHttpClient网络客户端,连接网络的方式,不提供回调函数
@@ -120,7 +122,7 @@ public class JpushServiceImpl implements JpushService {
120 122
      * @see "使用NettyHttpClient,异步接口发送请求",通过回调函数可以获取推送成功与否情况
121 123
      */
122 124
     @Override
123
-    public void sendNotificationPushWithCallback(String title, String content, Map<String, String> extras, List<String> registrationIds) {
125
+    public void sendNotificationPushWithCallback(String title, String content, Map<String, String> extras, Collection<String> registrationIds) {
124 126
         ClientConfig clientConfig = getClientConfig();
125 127
         String host = (String) clientConfig.get(ClientConfig.PUSH_HOST_NAME);
126 128
         final NettyHttpClient client = new NettyHttpClient(
@@ -158,7 +160,7 @@ public class JpushServiceImpl implements JpushService {
158 160
     /**
159 161
      * 构建Android和IOS的推送通知对象
160 162
      */
161
-    private PushPayload buildNotificationPushPayload(String title, String content, Map<String, String> extras, List<String> registrationIds) {
163
+    private PushPayload buildNotificationPushPayload(String title, String content, Map<String, String> extras, Collection<String> registrationIds) {
162 164
         if (extras == null || extras.isEmpty()) {
163 165
             extras = new HashMap<>();
164 166
         }
@@ -175,7 +177,7 @@ public class JpushServiceImpl implements JpushService {
175 177
     /**
176 178
      * 构建Android和IOS的自定义消息的推送消息对象
177 179
      */
178
-    private PushPayload buildMessagePushPayload(String title, String content, Map<String, String> extras, List<String> registrationIds) {
180
+    private PushPayload buildMessagePushPayload(String title, String content, Map<String, String> extras, Collection<String> registrationIds) {
179 181
         return PushPayload.newBuilder().setPlatform(Platform.android_ios())
180 182
                 .setAudience(Audience.registrationId(registrationIds))
181 183
                 .setMessage(Message.newBuilder().setTitle(title).setMsgContent(content).addExtras(extras).build())

+ 2 - 5
src/main/resources/bootstrap.yml

@@ -5,7 +5,7 @@ eureka:
5 5
   instance:
6 6
     hostname: 172.16.0.6 #地址
7 7
     prefer-ip-address: true
8
-    status-page-url: http://${eureka.instance.hostname}:${server.port}/swagger-ui.html
8
+#    status-page-url: http://${eureka.instance.hostname}:${server.port}/swagger-ui.html
9 9
   client:
10 10
     service-url:
11 11
       # 向注册中心注册服务
@@ -27,7 +27,4 @@ spring:
27 27
     restart:
28 28
       log-condition-evaluation-delta: false
29 29
 
30
-jpush:
31
-  appKey: 364961d3e7f43b10b3555e51
32
-  masterSecret: 0ce36f05ee8be23b1b84cbd8
33
-  liveTime: 300000
30
+