From 80cd218ecf3b1aee9c49e8f34400581db1066dd3 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 28 一月 2019 10:58:28 +0800
Subject: [PATCH] BUG修改
---
fanli/src/main/java/com/yeshi/fanli/controller/client/PushController.java | 63 ++++++++++---------------------
1 files changed, 21 insertions(+), 42 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/PushController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/PushController.java
index 3151631..dda8ea9 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/PushController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/PushController.java
@@ -16,7 +16,6 @@
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.push.DeviceActive;
-import com.yeshi.fanli.entity.push.DeviceTokenIOS;
import com.yeshi.fanli.entity.push.PushGoods;
import com.yeshi.fanli.entity.push.PushGoodsGroup;
import com.yeshi.fanli.entity.push.PushGoodsRecord;
@@ -58,25 +57,25 @@
@Resource
private DeviceActiveService deviceActiveService;
-
+
@Resource
private PushService pushService;
-
+
@Resource
private PushGoodsService PushGoodsService;
-
+
@Resource
private PushGoodsGroupService pushGoodsGroupService;
-
+
@Resource
private PushGoodsRecordService pushGoodsRecordService;
-
+
@Resource
private JumpDetailV2Service jumpDetailV2Service;
-
+
@Resource
private ConfigService configService;
-
+
@Resource(name = "taskExecutor")
private TaskExecutor executor;
@@ -111,16 +110,10 @@
da.setDeviceToken(deviceToken);
da.setPlatform(DeviceActive.PLATFORM_IOS);
da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
+ da.setDevice(acceptData.getDevice());
deviceActiveService.addDeviceActive(da);
-
- DeviceTokenIOS deviceTokenIOS = iosPushService.getDeviceTokenByDeviceToken(deviceToken);
- if (deviceTokenIOS == null)
- iosPushService.addDeviceToken(null, Integer.parseInt(acceptData.getVersion()), deviceToken,
- acceptData.getDevice());
- else {
- deviceTokenIOS.setDevice(acceptData.getDevice());
- iosPushService.updateDeviceToken(deviceTokenIOS);
- }
+ iosPushService.addDeviceToken(null, Integer.parseInt(acceptData.getVersion()), deviceToken,
+ acceptData.getDevice());
out.print(JsonUtil.loadTrue(0, null, "鎴愬姛"));
}
}
@@ -141,19 +134,11 @@
da.setDeviceToken(deviceToken);
da.setPlatform(DeviceActive.PLATFORM_IOS);
da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
+ da.setDevice(acceptData.getDevice());
deviceActiveService.addDeviceActive(da);
// 娣诲姞token
- DeviceTokenIOS deviceTokenIOS = iosPushService.getDeviceTokenByDeviceToken(deviceToken);
- if (deviceTokenIOS != null) {
- deviceTokenIOS.setUid(uid);
- deviceTokenIOS.setDevice(acceptData.getDevice());
- deviceTokenIOS.setVersion(Integer.parseInt(acceptData.getVersion()));
- iosPushService.updateDeviceToken(deviceTokenIOS);
- } else {
- iosPushService.addDeviceToken(uid, Integer.parseInt(acceptData.getVersion()), deviceToken,
- acceptData.getDevice());
- }
- out.print(JsonUtil.loadTrueResult(""));
+ iosPushService.addDeviceToken(uid, Integer.parseInt(acceptData.getVersion()), deviceToken,
+ acceptData.getDevice());
}
}
@@ -165,12 +150,8 @@
*/
@RequestMapping(value = "/unBind", method = RequestMethod.POST)
public void unBind(AcceptData acceptData, String deviceToken, PrintWriter out) {
- if (!StringUtil.isNullOrEmpty(deviceToken)) {
- DeviceTokenIOS deviceTokenIOS = iosPushService.getDeviceTokenByDeviceToken(deviceToken);
- if (deviceTokenIOS != null) {
- deviceTokenIOS.setUid(null);
- iosPushService.updateDeviceToken(deviceTokenIOS);
- }
+ if (!StringUtil.isNullOrEmpty(acceptData.getDevice())) {
+ iosPushService.unBindUidAndDevice(acceptData.getDevice());
out.print(JsonUtil.loadTrue(0, null, "瑙g粦鎴愬姛"));
}
}
@@ -202,8 +183,7 @@
deviceTokenHWService.unBindDeviceToken(acceptData.getDevice());
out.print(JsonUtil.loadTrueResult("鎴愬姛"));
}
-
-
+
/**
* 瑙g粦鎺ㄩ��
*
@@ -272,16 +252,15 @@
String fontColor1 = "#666666";
String fontColor2 = "#E5005C";
JSONArray array = new JSONArray();
-
JSONObject contentJson1 = new JSONObject();
contentJson1.put("color", fontColor1);
contentJson1.put("content", "鏈鎺ㄨ崘鍏�");
-
+
JSONObject contentJson2 = new JSONObject();
contentJson2.put("color", fontColor2);
contentJson2.put("content", totalgoods);
-
+
JSONObject contentJson3 = new JSONObject();
contentJson3.put("color", fontColor1);
contentJson3.put("content", "涓晢鍝�");
@@ -339,8 +318,8 @@
Long deviceId = deviceActive.getId();
for (PushGoods pushGoods : listPush) {
- List<PushGoodsRecord> listRecord = pushGoodsRecordService.listByPushIdAndDeviceId(
- pushGoods.getId(), deviceId);
+ List<PushGoodsRecord> listRecord = pushGoodsRecordService
+ .listByPushIdAndDeviceId(pushGoods.getId(), deviceId);
if (listRecord != null && listRecord.size() > 0) {
continue; // 宸茶璁板綍
}
@@ -361,5 +340,5 @@
});
}
}
-
+
}
--
Gitblit v1.8.0