Browse Source

修改bug

shengyang000 3 years ago
parent
commit
a619203021

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

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

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

@@ -5,7 +5,7 @@ eureka:
5
   instance:
5
   instance:
6
     hostname: 172.16.0.6 #地址
6
     hostname: 172.16.0.6 #地址
7
     prefer-ip-address: true
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
   client:
9
   client:
10
     service-url:
10
     service-url:
11
       # 向注册中心注册服务
11
       # 向注册中心注册服务
@@ -27,7 +27,4 @@ spring:
27
     restart:
27
     restart:
28
       log-condition-evaluation-delta: false
28
       log-condition-evaluation-delta: false
29
 
29
 
30
-jpush:
31
-  appKey: 364961d3e7f43b10b3555e51
32
-  masterSecret: 0ce36f05ee8be23b1b84cbd8
33
-  liveTime: 300000
30
+