提送增加 payload 参数

This commit is contained in:
Jack 2025-07-05 09:11:32 +08:00
parent 22e28f2e81
commit 58aee5a5f6
5 changed files with 37 additions and 9 deletions

View File

@ -65,4 +65,12 @@ public class CommonConstant {
public static final Integer CONTRACT_SIGN_STA_CANCEL = 3;
public static final Integer CONTRACT_SIGN_STA_EXPIRED = 5;
public static final Integer CONTRACT_SIGN_STA_REJECT = 7;
/**
* 推送消息类别Contract-商家入驻合同orderList-商家订单列表orderDetail-商家订单详情
*/
public static final String PUSH_MSG_CATE_EC = "mchContract";
public static final String PUSH_MSG_CATE_ORDER_LIST = "mchOrderList";
public static final String PUSH_MSG_CATE_ORDER_DETAIL = "mchOrderDetail";
}

View File

@ -563,7 +563,9 @@ public class LakalaApiServiceImpl implements LakalaApiService {
// 小发同城商家恭喜您的开店入驻申请已审核通过请尽快登录APP平台签署电子合同签署链接24小时内有效逾期需重新提交申请如有疑问请联系客服感谢您的支持
shopMessageTemplateService.aliyunSmsSend(mchMobile, "SMS_489795044", null);//SMS_479760276
pushMessageService.noticeMerchantSignEcContract(shopMchEntry.getCreated_by());
JSONObject payload = new JSONObject();
payload.put("category", CommonConstant.PUSH_MSG_CATE_EC);
pushMessageService.noticeMerchantSignEcContract(shopMchEntry.getCreated_by(), payload);
return Pair.of(true, "商家入网申请电子合同成功");

View File

@ -18,9 +18,10 @@ public interface PushMessageService {
* 异步发送推送通知 商户签约电子合同
*
* @param userId
* @param payload
* @return
*/
CompletableFuture<Boolean> noticeMerchantSignEcContract(Integer userId);
CompletableFuture<Boolean> noticeMerchantSignEcContract(Integer userId, JSONObject payload);
/**

View File

@ -47,12 +47,13 @@ public class PushMessageServiceImpl implements PushMessageService {
* 异步发送推送通知 商户签约电子合同
*
* @param userId
* @param payload
* @return
*/
@Async("pushAsyncExecutor")
@Override
public CompletableFuture<Boolean> noticeMerchantSignEcContract(Integer userId) {
public CompletableFuture<Boolean> noticeMerchantSignEcContract(Integer userId, JSONObject payload) {
try {
// 获取商家的 cid 列表确保用户 ID 有效
if (userId == null || userId <= 0) {
@ -83,7 +84,7 @@ public class PushMessageServiceImpl implements PushMessageService {
Pair<Boolean, String> result = uniCloudPushService.sendPushMessageBatch(cidList,
appName + "邀请您签署入驻合同",
"恭喜您的开店入驻申请已审核通过请尽快登录APP平台签署电子合同签署链接24小时内有效逾期需重新提交申请。如有疑问请联系客服感谢您的支持",
null);
payload);
if (!result.getFirst()) {
log.error("商家入驻申请电子合同推送失败用户ID{},错误信息:{}", userId, result.getSecond());

View File

@ -16,6 +16,7 @@ import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.suisung.mall.common.api.StateCode;
import com.suisung.mall.common.constant.CommonConstant;
import com.suisung.mall.common.constant.SFExpressConstant;
import com.suisung.mall.common.exception.ApiException;
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransportBase;
@ -228,7 +229,10 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
shopOrderInfoService.changeOrderStatus(shopOrderId, StateCode.ORDER_STATE_PICKING, 0, 0);
// 个推推送消息
pushMessageService.noticeMerchantEmployeeOrderAction(null, shopOrderId, "您有一笔新的订单", "您有一笔同城订单[" + shopOrderId + "],请及时处理。", null);
JSONObject payload = new JSONObject();
payload.put("category", CommonConstant.PUSH_MSG_CATE_ORDER_DETAIL);
payload.put("orderId", shopOrderId);
pushMessageService.noticeMerchantEmployeeOrderAction(null, shopOrderId, "您有一笔新的订单", "您有一笔同城订单[" + shopOrderId + "],请及时处理。", payload);
return Pair.of(true, "顺丰同城下单成功!");
@ -580,6 +584,9 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
}
// 个推推送消息
JSONObject payload = new JSONObject();
payload.put("category", CommonConstant.PUSH_MSG_CATE_ORDER_DETAIL);
payload.put("orderId", shopOrderId);
pushMessageService.noticeMerchantEmployeeOrderAction(null, shopOrderId, "您有一笔取消订单", "您有一笔取消订单[" + shopOrderId + "],请及时处理。", null);
@ -612,7 +619,8 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
// 获取顺丰同城的物流轨迹
Map<String, Object> params = new HashMap<>();
params.put("order_id", shopStoreSfOrder.getSf_order_id());
String orderId = shopStoreSfOrder.getShop_order_id();
params.put("order_id", orderId);
ThirdApiRes feedRes = listOrderFeed(params);
// logger.debug("获取配送员物流轨迹:{}", feedRes);
if (feedRes != null && feedRes.getError_code().equals(0)) {
@ -679,7 +687,10 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
// logger.debug("向 SSE 通道 {} 发送了:{}", shopStoreSfOrder.getSf_order_id(), jsonData);
// 消息推送
pushMessageService.noticeMerchantEmployeeOrderAction(null, shopStoreSfOrder.getShop_order_id(), "", "顺丰同城订单[" + shopStoreSfOrder.getShop_order_id() + "]" + pushRemark, null);
JSONObject payload = new JSONObject();
payload.put("category", CommonConstant.PUSH_MSG_CATE_ORDER_DETAIL);
payload.put("orderId", orderId);
pushMessageService.noticeMerchantEmployeeOrderAction(null, orderId, "", "顺丰同城订单[" + orderId + "]" + pushRemark, payload);
return new ThirdApiRes().success("success");
}
@ -710,7 +721,9 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
return new ThirdApiRes().fail(-1, "返回数据转换失败!");
}
ShopStoreSfOrder order = shopStoreSfOrderService.getBySfOrderId(shopStoreSfOrder.getSf_order_id());
String orderId = shopStoreSfOrder.getShop_order_id();
ShopStoreSfOrder order = shopStoreSfOrderService.getBySfOrderId(orderId);
if (order == null) {
return new ThirdApiRes().fail(-1, "订单不存在!");
}
@ -750,7 +763,10 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
// SseEmitterUtil.sendMessage(shopStoreSfOrder.getSf_order_id(), jsonData);
// 消息推送
pushMessageService.noticeMerchantEmployeeOrderAction(null, shopStoreSfOrder.getShop_order_id(), "", "顺丰同城订单[" + shopStoreSfOrder.getShop_order_id() + "]已完成配送。", null);
JSONObject payload = new JSONObject();
payload.put("category", CommonConstant.PUSH_MSG_CATE_ORDER_DETAIL);
payload.put("orderId", orderId);
pushMessageService.noticeMerchantEmployeeOrderAction(null, orderId, "", "顺丰同城订单[" + orderId + "]已完成配送。", null);
// 通知微信用户确认收货
// wxOrderShippingService.notifyConfirmReceive(shopStoreSfOrder.getShop_order_id());