written test questions


需求
一个简单的订餐系统,客户会在上面注册会员制并定期扣费送餐。

需要以代码形式解决订单周期处理事项

需要解决的问题:订单周期的处理问题。

1. 预订期间|送餐+下一个预订|送餐周期+下一个预订周期|......

订单周期处理的问题

订单周期有什么问题?
1. 先订,
2. 比如中午设定9点扣款,11点送餐,连续送7天。
3. 扣款是直接扣信用卡吗?
4.



订阅机制
用户会订阅某个套餐,如每周10份餐食
----------
理解:一个套餐=多餐+定时送餐服务


Cut Off周期收费机制
套餐每周会有截止时间,超过此时间的只能订阅到下周送餐周期;
理解:这里有两个时间范围:1.套餐的订阅周期,2.套餐的送餐周期

  • 会员新建subscription的时候,立即新建一个order 。
  • 每周到固定时间Cut off时新建一个order(这是什么订单?),这个订阅周还未生产order的subscription.(这个很难理解, 订阅周期结束的时候,没有生产的订单:)
  • Group orders (当cut off为每周二晚上8pm时),获取某一subscription周内所有orders (如31/03 8pm – 07/04 8pm),此Group包含此期间内新注册时建立的orders到cut off 时(即07/04 8pm)建立的orders

可以修改Cut Off 截止日

  • 原定每周二晚上8点的cut off, 改为每周四上午8点
  • 在周四上午8点之后, 需要能获取到对应orders的group
  • 如果有条件, 可以考虑下daylight saving发生时的cut off要如何安全的迁移 (此项不做要求)

餐食流行度算法
推荐算法,推荐出最流行的10个餐食品种给新客户

额外考虑
如何保证系统下线错过截止日期的后台Job,系统恢复后重新运行的订单处理

提交
提交至 GitHub

-------------
关于 daylight saving的问题,
夏时制
夏令时(DST),也称为夏令时或夏令时(美国和加拿大)和夏令时(英国、欧盟和其他一些国家),是在较温暖的月份将时钟提前(通常提前一小时),以便在稍后的时钟时间黑暗。DST的典型实施方式是在春季将时钟向前拨一小时(“向前拨”),在秋季将时钟向后拨一小时(“向后拨”),以恢复标准时间。因此,在冬末或早春有一天23小时,在秋季有一天25小时

Daylight Saving Time
Daylight saving time (DST), also known as daylight savings time or daylight time (the United States and Canada), and summer time (United Kingdom, European Union, and some others), is the practice of advancing clocks (typically by one hour) during warmer months so that darkness falls at a later clock time. The typical implementation of DST is to set clocks forward by one hour in the spring ("spring forward") and set clocks back by one hour in autumn ("fall back") to return to standard time. As a result, there is one 23-hour day in late winter or early spring and one 25-hour day in the autumn.
阅读量: 551
发布于:
修改于: