Browse Source

更新极光推送通知

Yangzw 2 months ago
parent
commit
d97654b221

+ 29 - 8
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/utils/push/JPushUtils.java

@@ -79,14 +79,35 @@ public class JPushUtils {
         notificationData.setAndroid(notification);
         requestBody.setNotification(notificationData);
 
-        Options options = new Options();
-        options.setTime_to_live(86400);
-        options.setClassification(1);
-        options.setThird_party_channel(new Options.ThirdPartyChannel().setHuawei(new Options.Channel().setImportance("NORMAL").setCategory("WORK")));
-        options.setThird_party_channel(new Options.ThirdPartyChannel().setXiaomi(new Options.Channel().setChannel_id("NORMAL")));
-        options.setThird_party_channel(new Options.ThirdPartyChannel().setHonor(new Options.Channel().setImportance("NORMAL")));
-        options.setThird_party_channel(new Options.ThirdPartyChannel().setOppo(new Options.Channel().setChannel_id("message")));
-        options.setThird_party_channel(new Options.ThirdPartyChannel().setVivo(new Options.Channel().setDistribution("secondary_push").setCategory("IM")));
+        Options options = Options.builder()
+                .time_to_live(86400)
+                .classification(1)
+                .third_party_channel(Options.ThirdPartyChannel
+                        .builder()
+                        .huawei(Options.Channel
+                                .builder()
+                                .importance("NORMAL")
+                                .category("WORK")
+                                .build())
+                        .xiaomi(Options.Channel
+                                .builder()
+                                .channel_id("NORMAL")
+                                .build())
+                        .honor(Options.Channel
+                                .builder()
+                                .importance("NORMAL")
+                                .build())
+                        .oppo(Options.Channel
+                                .builder()
+                                .channel_id("message")
+                                .build())
+                        .vivo(Options.Channel
+                                .builder()
+                                .distribution("secondary_push")
+                                .category("IM")
+                                .build())
+                        .build())
+                .build();
         requestBody.setOptions(options);
 
         return requestBody;

+ 4 - 1
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/utils/push/pojo/Options.java

@@ -1,5 +1,6 @@
 package cn.newfeifan.mall.module.trade.utils.push.pojo;
 
+import lombok.Builder;
 import lombok.Data;
 
 /**
@@ -7,7 +8,7 @@ import lombok.Data;
  */
 
 @Data
-//@Builder
+@Builder
 public class Options {
     /**
      * 离线消息保留时长 (秒)
@@ -45,6 +46,7 @@ public class Options {
      * key 只支持 xiaomi、huawei、honor、meizu、oppo、vivo、fcm 类型用户。 key 可以为上述 7 个类型中的其中一个或者多个同时存在,未传递的 key 其对应的厂商下发走默认下发逻辑。
      */
     @Data
+    @Builder
     public static class ThirdPartyChannel {
         private Channel huawei;
         private Channel xiaomi;
@@ -54,6 +56,7 @@ public class Options {
     }
 
     @Data
+    @Builder
     public static class Channel{
         /**
          * 华为、荣耀通知栏消息智能分类