|
|
@@ -349,29 +349,34 @@ public class HahaCallbackServiceImpl implements HahaCallbackService {
|
|
|
private void saveOrderInfoToRedis(Order order, String activityId) {
|
|
|
try {
|
|
|
String orderKey = ORDER_INFO_KEY + activityId;
|
|
|
- JSONObject orderJson = new JSONObject();
|
|
|
- orderJson.put("orderId", order.getId());
|
|
|
- orderJson.put("orderNo", order.getOrderNo());
|
|
|
- orderJson.put("activityId", activityId);
|
|
|
- orderJson.put("deviceId", order.getDeviceId());
|
|
|
- orderJson.put("userId", order.getUserId());
|
|
|
- orderJson.put("totalAmount", order.getTotalAmount());
|
|
|
- orderJson.put("items", order.getItems());
|
|
|
- orderJson.put("status", order.getStatus());
|
|
|
- orderJson.put("payStatus", order.getPayStatus());
|
|
|
- orderJson.put("createTime", order.getCreateTime());
|
|
|
- orderJson.put("timestamp", System.currentTimeMillis());
|
|
|
-
|
|
|
- stringRedisTemplate.opsForValue().set(orderKey, orderJson.toJSONString(), 30, TimeUnit.MINUTES);
|
|
|
+
|
|
|
+ stringRedisTemplate.delete(orderKey);
|
|
|
+
|
|
|
+ Map<String, String> orderData = new HashMap<>();
|
|
|
+ orderData.put("orderId", order.getId() != null ? order.getId().toString() : "");
|
|
|
+ orderData.put("orderNo", order.getOrderNo() != null ? order.getOrderNo() : "");
|
|
|
+ orderData.put("activityId", activityId != null ? activityId : "");
|
|
|
+ orderData.put("deviceId", order.getDeviceId() != null ? order.getDeviceId() : "");
|
|
|
+ orderData.put("userId", order.getUserId() != null ? order.getUserId().toString() : "");
|
|
|
+ orderData.put("totalAmount", order.getTotalAmount() != null ? order.getTotalAmount().toString() : "0");
|
|
|
+ orderData.put("items", order.getItems() != null ? order.getItems() : "");
|
|
|
+ orderData.put("status", order.getStatus() != null ? order.getStatus().toString() : "");
|
|
|
+ orderData.put("payStatus", order.getPayStatus() != null ? order.getPayStatus().toString() : "");
|
|
|
+ orderData.put("timestamp", String.valueOf(System.currentTimeMillis()));
|
|
|
|
|
|
+ stringRedisTemplate.opsForHash().putAll(orderKey, orderData);
|
|
|
+ stringRedisTemplate.expire(orderKey, 30, TimeUnit.MINUTES);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("保存订单信息到Redis失败", e);
|
|
|
+ log.error("保存订单信息到Redis失败 - activityId: {}", activityId, e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void saveOrderInfoToRedis(Order order, String activityId, String orderId, Object orderMoney, String orderDetail) {
|
|
|
try {
|
|
|
String orderKey = ORDER_INFO_KEY + activityId;
|
|
|
+
|
|
|
+ stringRedisTemplate.delete(orderKey);
|
|
|
+
|
|
|
Map<String, String> orderData = new HashMap<>();
|
|
|
orderData.put("orderId", orderId != null ? orderId : "");
|
|
|
orderData.put("activityId", activityId != null ? activityId : "");
|