fix: 微信支付,创建失败,问题修复。

This commit is contained in:
tianyongbao
2026-04-04 00:44:12 +08:00
parent e30cd5ffc8
commit 8eca4ac64a
3 changed files with 25 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.intc.common.core.exception.ServiceException;
import com.intc.fishery.constant.DefineDeviceWarnCode;
import com.intc.fishery.domain.Device;
import com.intc.fishery.domain.PayDevice;
import com.intc.fishery.domain.PayOrder;
@@ -313,15 +314,22 @@ public class PayOrderBusinessServiceImpl implements PayOrderBusinessService {
// 计算新的到期时间
Date newDeadTime = calculateNewDeadTime(device.getDeadTime(), payDevice.getAddMonth());
// 更新设备到期时间
// 清除 warnCode 中的「设备到期」标志位(续费后恢复正常状态)
Integer oldWarnCode = device.getWarnCode();
Integer newWarnCode = oldWarnCode != null
? (oldWarnCode & ~DefineDeviceWarnCode.DeviceTimeDead)
: 0;
// 更新设备到期时间,并同步清除到期告警位
deviceMapper.update(null,
new LambdaUpdateWrapper<Device>()
.eq(Device::getId, device.getId())
.set(Device::getDeadTime, newDeadTime)
.set(Device::getWarnCode, newWarnCode)
);
log.info("更新设备到期时间: deviceId={}, serialNum={}, newDeadTime={}",
device.getId(), device.getSerialNum(), newDeadTime);
log.info("续费成功,更新设备到期时间并清除到期告警: deviceId={}, serialNum={}, newDeadTime={}, oldWarnCode={}, newWarnCode={}",
device.getId(), device.getSerialNum(), newDeadTime, oldWarnCode, newWarnCode);
}
}