From 03c85f4c22af92d9dc2651b51408a7f30837e858 Mon Sep 17 00:00:00 2001 From: "yunpeng.ma" Date: Thu, 18 Mar 2021 09:28:07 +0800 Subject: [PATCH] =?utf8?q?=E6=B6=88=E8=B4=B9=E6=8E=A8=E9=80=81=E4=BF=AE?= =?utf8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/kafka_service_impl.kt | 61 +++++++++---------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/kafka_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/kafka_service_impl.kt index fc5afd8b..068ab00a 100644 --- a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/kafka_service_impl.kt +++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/kafka_service_impl.kt @@ -42,7 +42,7 @@ class KafkaSendMsgServiceImpl : KafkaSendMsgService { @Async("kafkaSendMessageAsyncTask") override fun sendJpushMessage(userid: String, title: String, content: String, refno: String, extras: MutableMap, tenantId: String?) { - val musers = mobileApiService.findByUseridAndStatus(userid, TradeDict.STATUS_NORMAL) + // val musers = mobileApiService.findByUseridAndStatus(userid, TradeDict.STATUS_NORMAL) var msg = TBMsg().apply { this.content = content this.title = title @@ -52,39 +52,36 @@ class KafkaSendMsgServiceImpl : KafkaSendMsgService { this.refno = refno this.extras = gson.toJson(extras) } - if (musers == null || musers.isEmpty()) { - msg.pushresult = "没有手机用户,消息未推送" - msgDao.save(msg) - return - } +// if (musers == null || musers.isEmpty()) { +// msg.pushresult = "没有手机用户,消息未推送" +// msgDao.save(msg) +// return +// } msg = msgDao.save(msg) var uids = "" - musers.forEach { - uids += "${it.uid}," - var platform = "android" - if ("ios".equals(it.lastloginplatform, true)) { - platform = "ios" - } - val message = KafkaXgMessage() - message.alltarget = false - message.callback = true - message.content = msg.content - message.title = msg.title - message.platform = platform - message.retries = 3 - extras["refno"] = refno - message.custom = gson.toJson(extras) - message.expiretime = DateUtil.getNewTime(DateUtil.getNow(), 300) - message.gids = it.uid - if (it.lastloginplatform.isNullOrEmpty()) { - message.platform = "all" - kafkaTemplate.send(topic, msg.msgid, gson.toJson(message)) - } else { - kafkaTemplate.send(topic, msg.msgid, gson.toJson(message)) - } - } - msg.pusheduids = uids - msgDao.save(msg) +// musers.forEach { +// uids += "${it.uid}," +// var platform = "android" +// if ("ios".equals(it.lastloginplatform, true)) { +// platform = "ios" +// } +// +// } +// msg.pusheduids = uids +// msgDao.save(msg) + val message = KafkaXgMessage() + message.alltarget = false + message.callback = true + message.content = msg.content + message.title = msg.title + message.retries = 3 + extras["refno"] = refno + message.custom = gson.toJson(extras) + message.expiretime = DateUtil.getNewTime(DateUtil.getNow(), 300) + message.gids = userid + message.platform = "all" + kafkaTemplate.send(topic, msg.msgid, gson.toJson(message)) + } @Async("kafkaSendMessageAsyncTask") -- 2.17.1