来单提醒

This commit is contained in:
Bunny 2024-01-10 16:13:32 +08:00
parent 4d75011b42
commit 8f96d6c9c4
2 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,4 @@
package com.sky.controller.user; package com.sky.controller.nofity;
import com.alibaba.druid.support.json.JSONUtils; import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@ -30,6 +30,7 @@ public class PayNotifyController {
@Resource @Resource
private WeChatProperties weChatProperties; private WeChatProperties weChatProperties;
/** /**
* 支付成功回调 * 支付成功回调
* *

View File

@ -14,6 +14,7 @@ import com.sky.service.OrderService;
import com.sky.utils.WeChatPayUtil; import com.sky.utils.WeChatPayUtil;
import com.sky.vo.OrderPaymentVO; import com.sky.vo.OrderPaymentVO;
import com.sky.vo.OrderSubmitVO; import com.sky.vo.OrderSubmitVO;
import com.sky.websocket.WebSocketServer;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -22,6 +23,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
@Service @Service
@ -38,6 +40,8 @@ public class OrderServiceImpl implements OrderService {
private UserMapper userMapper; private UserMapper userMapper;
@Resource @Resource
private WeChatPayUtil weChatPayUtil; private WeChatPayUtil weChatPayUtil;
@Resource
private WebSocketServer webSocketServer;
/** /**
* 用户下单 * 用户下单
@ -143,6 +147,13 @@ public class OrderServiceImpl implements OrderService {
.build(); .build();
orderMapper.update(orders); orderMapper.update(orders);
HashMap map = new HashMap<>();
map.put("type", 1);
map.put("orderId", ordersDB.getId());
map.put("content", "订单号" + outTradeNo);
String jsonString = JSONObject.toJSONString(map);
webSocketServer.sendToAllClient(jsonString);
} }
} }