|
@@ -547,7 +547,16 @@ public class DepositServiceImpl implements DepositService { |
|
@@ -547,7 +547,16 @@ public class DepositServiceImpl implements DepositService { |
547
|
* @return
|
547
|
* @return
|
548
|
*/
|
548
|
*/
|
549
|
public int renewStorageDeposit(String depositCode, Integer renewDay, int uid, int depositId) {
|
549
|
public int renewStorageDeposit(String depositCode, Integer renewDay, int uid, int depositId) {
|
550
|
- int result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60, DateUtil.getCurrentTimeSecond());
|
550
|
+
|
|
|
551
|
+ StorageDeposit deposit = storageDepositMapper.selectByPrimaryKey(depositId);
|
|
|
552
|
+ int currentTimeSecond = DateUtil.getCurrentTimeSecond();
|
|
|
553
|
+ int result;
|
|
|
554
|
+ if (deposit.getDepositEndTime() <= currentTimeSecond) { // 如果当前库存记录已经过期,则按当前时间加续约时长
|
|
|
555
|
+ result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60 + currentTimeSecond, currentTimeSecond);
|
|
|
556
|
+ } else { // 如果当前库存记录未过期,则按库存结束时间加续约时长
|
|
|
557
|
+ result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60 + deposit.getDepositEndTime(), currentTimeSecond);
|
|
|
558
|
+ }
|
|
|
559
|
+
|
551
|
clearDepositCache(depositCode, uid);
|
560
|
clearDepositCache(depositCode, uid);
|
552
|
return result;
|
561
|
return result;
|
553
|
}
|
562
|
}
|