mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update 预约充电
This commit is contained in:
@@ -413,6 +413,8 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
return 0;
|
||||
}
|
||||
|
||||
String redisKey = CacheConstants.UPDATE_RESERVATION_INFO + pileReservationInfo.getPileConnectorCode();
|
||||
|
||||
// 是否发指令 false:不发指令 true:发指令, 默认不发指令
|
||||
boolean sendFlag = false;
|
||||
if (StringUtils.equals(pileReservationInfo.getStatus(), "1")) {
|
||||
@@ -488,11 +490,16 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
.build();
|
||||
String result = pileRemoteService.reservationCharging(command);
|
||||
sendResult = StringUtils.equals(result, Constants.ONE);
|
||||
|
||||
// 设置缓存1分钟, 如果更新数据库就删掉, 如果没有更新数据量缓存70秒
|
||||
redisCache.setCacheObject(redisKey, JSON.toJSONString(pileReservationInfo), CacheConstants.cache_expire_time_70s);
|
||||
}
|
||||
|
||||
log.info("修改预约充电信息, updateFlag:{}, sendFlag:{}, sendResult:{}", updateFlag, sendFlag, sendResult);
|
||||
// 更新数据库, 一般情况下是都更新的, 只有在发送指令并发送失败的情况下才不更新
|
||||
if (updateFlag && (sendFlag == sendResult)) {
|
||||
log.debug("修改预约充电相应成功, 删除缓存并更新数据库");
|
||||
redisCache.deleteObject(redisKey);
|
||||
return this.insertOrUpdateSelective(pileReservationInfo);
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user