修改灌溉记录bug,添加充值报文处理

This commit is contained in:
mi9688
2025-01-07 12:56:40 +08:00
parent a9dde2c96b
commit 8d6f5216d5
2 changed files with 29 additions and 5 deletions

View File

@ -412,7 +412,18 @@ public class DeviceOtherMsgConsumer {
if(data1.getStr("action")!=null&& "askMsg".equals(data1.getStr("action"))){
cardReportHandler(productId,serialNumber,jsonObject);
}
//充值成功处理的报文
else if (data1.getStr("action")!=null&& "investMsg".equals(data1.getStr("action"))){
//获取订单号并更新订单状态
Long orderNum = data1.getLong("orderNum");
boolean update = new LambdaUpdateChainWrapper<>(ngUserRechargeRecordsMapper)
.set(NgUserRechargeRecords::getStatus, 3)//已充值
.eq(NgUserRechargeRecords::getId, orderNum)
.update();
if(!update){
log.error("设备{}修改订单号为:{}的订单状态为已充值失败",serialNumber,orderNum);
}
}
}
else if (topic.endsWith("/info/reply")) {
@ -565,6 +576,15 @@ public class DeviceOtherMsgConsumer {
for(int i=0;i<=orderList.size()-1;i++){
//累加金额
investBalance=investBalance+orderList.get(i).getAmount().doubleValue();
//被合并的订单状态修改为已充值
if(i<orderList.size()-1){
boolean update = new LambdaUpdateChainWrapper<>(ngUserRechargeRecordsMapper)
.set(NgUserRechargeRecords::getStatus, 3)
.update();
if(!update){
log.error("设备{}更新被合并的订单{}状态为已充值失败",serialNumber,orderList.get(i).getId());
}
}
}
//取最新的订单号作为合并后的订单
dataValue.put("orderNum",orderList.get(orderList.size()-1).getId());//订单号