|
@@ -813,6 +813,9 @@ public class LawyerClientConsultationOrderServiceImpl extends ServiceImpl<Lawyer
|
|
|
// 发送拒绝接单通知
|
|
// 发送拒绝接单通知
|
|
|
sendRejectOrderNotice(order);
|
|
sendRejectOrderNotice(order);
|
|
|
|
|
|
|
|
|
|
+ // 发送退款到账通知
|
|
|
|
|
+ sendRefundArrivalNotice(order);
|
|
|
|
|
+
|
|
|
return R.data(true, "取消订单成功");
|
|
return R.data(true, "取消订单成功");
|
|
|
} else {
|
|
} else {
|
|
|
log.error("律师取消订单失败:数据库操作失败,订单ID={}, 订单编号={}", orderId, order.getOrderNumber());
|
|
log.error("律师取消订单失败:数据库操作失败,订单ID={}, 订单编号={}", orderId, order.getOrderNumber());
|
|
@@ -1592,6 +1595,49 @@ public class LawyerClientConsultationOrderServiceImpl extends ServiceImpl<Lawyer
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 发送退款到账通知给客户端用户
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param order 订单对象
|
|
|
|
|
+ */
|
|
|
|
|
+ private void sendRefundArrivalNotice(LawyerConsultationOrder order) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ Integer clientUserId = order.getClientUserId();
|
|
|
|
|
+ if (clientUserId == null) {
|
|
|
|
|
+ log.warn("发送退款到账通知失败:客户端用户ID为空,订单ID={}", order.getId());
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取客户端用户接收ID
|
|
|
|
|
+ String receiverId = getClientReceiverId(clientUserId);
|
|
|
|
|
+ if (!StringUtils.hasText(receiverId)) {
|
|
|
|
|
+ log.warn("发送退款到账通知失败:获取客户端用户接收ID失败,订单ID={}, 用户ID={}",
|
|
|
|
|
+ order.getId(), clientUserId);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 构建通知消息
|
|
|
|
|
+ String orderNumber = order.getOrderNumber() != null ? order.getOrderNumber() : "";
|
|
|
|
|
+ String message = String.format("您的编号为%s的订单,订单金额已原路返还至您的支付渠道,请查收。",
|
|
|
|
|
+ orderNumber);
|
|
|
|
|
+
|
|
|
|
|
+ // 创建并保存通知
|
|
|
|
|
+ LifeNotice lifeNotice = createOrderNotice(order.getId(), receiverId, "退款到账通知", message);
|
|
|
|
|
+ int noticeResult = lifeNoticeMapper.insert(lifeNotice);
|
|
|
|
|
+ if (noticeResult <= 0) {
|
|
|
|
|
+ log.warn("发送退款到账通知失败:保存通知失败,订单ID={}", order.getId());
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 发送WebSocket消息
|
|
|
|
|
+ sendWebSocketMessage(receiverId, lifeNotice);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("发送退款到账通知成功,接收人ID={}, 订单编号={}", receiverId, orderNumber);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("发送退款到账通知异常,订单ID={}, 异常信息={}", order.getId(), e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 创建订单通知对象
|
|
* 创建订单通知对象
|
|
|
*
|
|
*
|
|
|
* @param businessId 业务ID(订单ID)
|
|
* @param businessId 业务ID(订单ID)
|