Authored by mali

Merge branch 'hotfix_续约' into test6.9.10

@@ -381,7 +381,7 @@ @@ -381,7 +381,7 @@
381 381
382 <update id="updateDepositEndTime"> 382 <update id="updateDepositEndTime">
383 update storage_deposit 383 update storage_deposit
384 - set deposit_end_time = unix_timestamp(now()) + #{depositEndTime,jdbcType=INTEGER} ,update_time = #{updateTime,jdbcType=INTEGER} 384 + set deposit_end_time = #{depositEndTime,jdbcType=INTEGER} ,update_time = #{updateTime,jdbcType=INTEGER}
385 where id = #{depositId,jdbcType=INTEGER} AND del_status = 0 AND owner_uid = #{uid,jdbcType=INTEGER} 385 where id = #{depositId,jdbcType=INTEGER} AND del_status = 0 AND owner_uid = #{uid,jdbcType=INTEGER}
386 </update> 386 </update>
387 387
@@ -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 }