feat(order): 新增近三个月订单筛选功能
- 在ShopOrderMapper.xml中添加状态筛选条件9,用于查询近三个月的订单- 修改数据库连接地址为生产环境IP - 完善GPS消息处理器,增加空消息和心跳状态消息检查 - 优化订单支付逻辑,修复后更新订单状态为已支付
This commit is contained in:
@@ -329,6 +329,8 @@ public class BszxPayController extends BaseController {
|
||||
bszxPay.setComments(shopOrder.getComments());
|
||||
bszxPayService.save(bszxPay);
|
||||
}
|
||||
shopOrder.setOrderStatus(1);
|
||||
shopOrderService.updateById(shopOrder);
|
||||
}
|
||||
return success("修复成功");
|
||||
}
|
||||
|
||||
@@ -60,9 +60,22 @@ public class GpsMessageProcessor {
|
||||
try {
|
||||
logger.debug("开始处理GPS消息: {}", payload);
|
||||
|
||||
// 检查消息内容是否为空
|
||||
if (StrUtil.isBlank(payload)) {
|
||||
logger.warn("接收到空消息,跳过处理");
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否为心跳或状态消息(非JSON格式)
|
||||
if (isHeartbeatOrStatusMessage(payload)) {
|
||||
logger.info("接收到心跳或状态消息: {}", payload);
|
||||
return;
|
||||
}
|
||||
|
||||
// 尝试解析JSON格式的GPS数据
|
||||
Gps gps = JSONUtil.parseObject(payload, Gps.class);
|
||||
if (ObjectUtil.isEmpty(gps)) {
|
||||
logger.warn("GPS数据为空,跳过处理");
|
||||
logger.warn("GPS数据解析为空,跳过处理。消息内容: {}", payload);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -73,6 +86,30 @@ public class GpsMessageProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否为心跳或状态消息
|
||||
*
|
||||
* @param payload 消息内容
|
||||
* @return true 如果是心跳或状态消息
|
||||
*/
|
||||
private boolean isHeartbeatOrStatusMessage(String payload) {
|
||||
// 去除前后空格和引号
|
||||
String cleanPayload = payload.trim();
|
||||
if (cleanPayload.startsWith("\"") && cleanPayload.endsWith("\"")) {
|
||||
cleanPayload = cleanPayload.substring(1, cleanPayload.length() - 1);
|
||||
}
|
||||
|
||||
// 检查常见的心跳或状态消息
|
||||
return "online".equalsIgnoreCase(cleanPayload) ||
|
||||
"offline".equalsIgnoreCase(cleanPayload) ||
|
||||
"ping".equalsIgnoreCase(cleanPayload) ||
|
||||
"pong".equalsIgnoreCase(cleanPayload) ||
|
||||
"heartbeat".equalsIgnoreCase(cleanPayload) ||
|
||||
"status".equalsIgnoreCase(cleanPayload) ||
|
||||
cleanPayload.startsWith("status:") ||
|
||||
cleanPayload.startsWith("heartbeat:");
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理GPS数据
|
||||
*
|
||||
|
||||
@@ -259,6 +259,10 @@
|
||||
<!-- 8已取消:订单已取消 -->
|
||||
AND a.order_status = 2
|
||||
</if>
|
||||
<!-- 近三个月订单 -->
|
||||
<if test="param.statusFilter == 9">
|
||||
AND a.create_time >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH)
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://1Panel-mysql-Bqdt:3306/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://8.134.169.209:13306/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: modules
|
||||
password: P7KsAyDXG8YdLnkA
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
Reference in New Issue
Block a user