|
|
@@ -3,6 +3,7 @@ package com.ruoyi.app.pay;
|
|
|
import com.ruoyi.app.order.dto.OrderPushBodyDto;
|
|
|
import com.ruoyi.app.utils.PayPush;
|
|
|
import com.ruoyi.app.utils.event.PushEventService;
|
|
|
+import com.ruoyi.common.utils.LocaleUtils;
|
|
|
import com.ruoyi.common.utils.MessageUtils;
|
|
|
import com.ruoyi.system.domain.InfoUser;
|
|
|
import com.ruoyi.system.domain.PosOrder;
|
|
|
@@ -12,6 +13,8 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.support.TransactionSynchronization;
|
|
|
+
|
|
|
+import java.util.Locale;
|
|
|
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
|
|
|
|
|
/** Executes the existing one-time order log and push side effects after LINE payment capture. */
|
|
|
@@ -40,21 +43,24 @@ public class LinePayOrderNotificationService {
|
|
|
private void pushPaymentSuccess(PosOrder order) {
|
|
|
try {
|
|
|
String ddId = String.valueOf(order.getDdId());
|
|
|
- String title = MessageUtils.message("no.message.push.message");
|
|
|
String body = OrderPushBodyDto.getJson(ddId, String.valueOf(order.getState()), 0);
|
|
|
InfoUser user = order.getUserId() == null ? null : infoUserService.getById(order.getUserId());
|
|
|
if (user != null) {
|
|
|
- new PayPush().apppush(user.getCid(), title,
|
|
|
- MessageUtils.message("no.message.push.payment.success"), body);
|
|
|
- pushEventService.PublisherEvent(user.getUserId(), title,
|
|
|
- MessageUtils.message("no.message.push.payment.success"), body);
|
|
|
+ // 推送常在异步线程执行(confirm 回调投递 linePayTaskExecutor),无请求级 locale,
|
|
|
+ // 必须按收件人用户语言解析,否则回落 JVM 默认语言(线上为英文)
|
|
|
+ Locale userLocale = LocaleUtils.getUserLocale(user.getUserId());
|
|
|
+ String title = MessageUtils.message("no.message.push.message", userLocale);
|
|
|
+ String content = MessageUtils.message("no.message.push.payment.success", userLocale);
|
|
|
+ new PayPush().apppush(user.getCid(), title, content, body);
|
|
|
+ pushEventService.PublisherEvent(user.getUserId(), title, content, body);
|
|
|
}
|
|
|
InfoUser merchant = order.getShId() == null ? null : infoUserService.getById(order.getShId());
|
|
|
if (merchant != null) {
|
|
|
- new PayPush().shpush(merchant.getCid(), title,
|
|
|
- MessageUtils.message("no.message.push.new.order"), body);
|
|
|
- pushEventService.PublisherEvent(merchant.getUserId(), title,
|
|
|
- MessageUtils.message("no.message.push.new.order"), body);
|
|
|
+ Locale merchantLocale = LocaleUtils.getUserLocale(merchant.getUserId());
|
|
|
+ String title = MessageUtils.message("no.message.push.message", merchantLocale);
|
|
|
+ String content = MessageUtils.message("no.message.push.new.order", merchantLocale);
|
|
|
+ new PayPush().shpush(merchant.getCid(), title, content, body);
|
|
|
+ pushEventService.PublisherEvent(merchant.getUserId(), title, content, body);
|
|
|
}
|
|
|
} catch (Exception exception) {
|
|
|
log.error("LINE Pay payment success push failed, ddId={}", order.getDdId(), exception);
|