Authored by mali

Merge branch 'hotfix_续约' into test6.9.10

... ... @@ -381,7 +381,7 @@
<update id="updateDepositEndTime">
update storage_deposit
set deposit_end_time = unix_timestamp(now()) + #{depositEndTime,jdbcType=INTEGER} ,update_time = #{updateTime,jdbcType=INTEGER}
set deposit_end_time = #{depositEndTime,jdbcType=INTEGER} ,update_time = #{updateTime,jdbcType=INTEGER}
where id = #{depositId,jdbcType=INTEGER} AND del_status = 0 AND owner_uid = #{uid,jdbcType=INTEGER}
</update>
... ...
... ... @@ -547,7 +547,16 @@ public class DepositServiceImpl implements DepositService {
* @return
*/
public int renewStorageDeposit(String depositCode, Integer renewDay, int uid, int depositId) {
int result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60, DateUtil.getCurrentTimeSecond());
StorageDeposit deposit = storageDepositMapper.selectByPrimaryKey(depositId);
int currentTimeSecond = DateUtil.getCurrentTimeSecond();
int result;
if (deposit.getDepositEndTime() <= currentTimeSecond) { // 如果当前库存记录已经过期,则按当前时间加续约时长
result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60 + currentTimeSecond, currentTimeSecond);
} else { // 如果当前库存记录未过期,则按库存结束时间加续约时长
result = storageDepositMapper.updateDepositEndTime(uid, depositId, renewDay * 24 * 60 * 60 + deposit.getDepositEndTime(), currentTimeSecond);
}
clearDepositCache(depositCode, uid);
return result;
}
... ...