今天主要说下电商网站系统中订单功能模块需要注意的一些细节:
一般订单系统牵扯的其他各个系统的内容比较多,比如购物车,商品,配送、订单明细等等。
所以在这块我们需要封装好我们所需要的vo对象,这中间有哪些注意的细节呢,我们今天总结下:
(1)价格毋庸置疑,javaweb中使用Bigdecimal的string构造器来进行精确的金额计算。
(2)订单的创建这块,创建订单的时候,我们在向数据库插入数据的是,我们是将订单的的每个明细一一插入我们的订单明细表即批量插入订单明细表中,这里注意的mybatis的批量插入的使用,即一个订单中有多个订单明细。
除此之外,需要将订单的信息插入订单表中。
在创建订单后,需要将商品的库存更新、购物车中该商品清空。
(3)订单取消后,要涉及到退款这块的信息,订单的取消不是删除订单,而且订单状态的改变。
(4)订单与物流系统的对接。
(5)订单号的创建:一方面避免竞争商家解析根据我们的订单号解析我们的订单销量,一方面避免订单号的重复,还有为分布式系统分库分表的设计,所以订单号的设计很关键。
基本上这几个需要注意吧,其实关键部分还是付款退款这块的对接,毕竟涉及到用户的利益问题嘛,以上是最近在做这块系统的一些心得,纯属个人拙见,如无用处请忽略!