xiaohuqwq
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 详细设计文档 **<font size = 5>文档作者</font>** 主要编写者:李孟宇、汪楷涵、劳厚新、史珈豪 其他编写者:无 **<font size = 5>文档修改历史</font>** | 修改人员 | 日期 | 修改原因 | 版本号 | | :------: | ------------- | -------------------------------------------------------- | ------ | | 李孟宇 | 2024年5月14日 | 创建了详细设计文档 | V1.0.0 | | 汪楷涵 | 2024年5月15日 | 增加了展示层的分解相关内容 | V1.0.1 | | 李孟宇 | 2024年5月17日 | 添加了业务逻辑层分解中的Coupon模块和Order模块 | V1.0.2 | | 史珈豪 | 2024年5月18日 | 添加了业务逻辑层分解中的User模块、Store模块和Product模块 | V1.0.3 | | 劳厚新 | 2024年5月18日 | 添加了数据访问层的分解相关内容 | V1.0.4 | | 汪楷涵 | 2024年6月6日 | 补充了展示层的分解相关内容 | V1.1.0 | |史珈豪|2024年6月6日|补充了业务逻辑层分解中的Order模块|V1.1.1| |劳厚新|2024年6月6日|补充了数据访问层的分解相关内容|V1.1.2| [toc] ## 1. 引言 ### 1.1 编制目的 本报告详细完成对 **南鲸网购平台管理系统(OSMS)** 的详细设计,达到指导后续软件构造的目的,同时实现和测试人员及用户的沟通。 本报告面向开发人员、测试人员及最终用户而编写,是了解系统的导航。 ### 1.2 词汇表 详细设计描述的约定详见下表所示: | 词汇名称 | 词汇含义 | 备注 | | -------- | -------------------- | ---- | | OSMS | 南鲸网购平台管理系统 | | ### 1.3 参考资料 - 《软件开发的技术基础》丁二玉、刘钦编著 - IEEE标准 - 南鲸网购平台管理系统用例文档 - 南鲸网购平台管理系统需求规格说明书 - 南鲸网购平台管理系统体系结构设计文档 ## 2. 产品概述 参考南鲸网购平台管理系统用例文档和南鲸网购平台管理系统需求规格说明书中对产品的概括描述。 ## 3. 体系结构设计概述 参考南鲸网购平台管理系统的体系结构设计文档中对体系结构设计的概述。 ## 4. 结构视角 ### 4.1 展示层的分解 展示层开发包图参见体系结构设计文档。 #### 4.1.1 userUI ##### 4.1.1.1 模块概述 - userUI模块解决的是用户注册、用户登录、用户信息展示和修改的需求。 ##### 4.1.1.2 整体结构 userUI包含三个界面:DashBoard、Login、Resgister | 界面和组件 | 职责 | | ---------- | ------------------ | | DashBoard | 用户信息展示和修改 | | Login | 用户登录 | | Register | 用户注册 | ##### 4.1.1.3 模块内部类的接口规范 - userUI模块需要的服务(需接口) | 接口名称 | 语法 | 前置条件 | 后置条件 | | -------------------------------- | ------------------------------------ | -------- | -------------- | | UserController.register | register(UserVO userVO) | 输入合法 | 添加新用户信息 | | UserController.login | login(String phone, String password) | 输入合法 | 用户验证登录 | | UserController.getInformation | getInformation() | 无 | 获取用户信息 | | UserController.updateInformation | updateInformation(UserVO userVO) | 输入合法 | 修改用户信息 | #### 4.1.2 storeUI ##### 4.1.2.1 模块概述 - storeUI模块解决的是查看所有商店、查看商店详情、创建商店的需求。 ##### 4.1.2.2 整体结构 storeUI包含三个页面:AllStore、CreateStore、StoreDetail,和两个组件:StoreItem、ProductItem | 界面和组件 | 职责 | | ----------- | ---------------- | | AllStore | 查看所有商店 | | CreateStore | 创建商店 | | StoreDetail | 查看商店详情 | | StoreItem | 展示商店基本信息 | | ProductItem | 展示商品基本信息 | ##### 4.1.2.3 模块内部类的接口规范 - storeUI模块需要的服务(需接口) | 接口名称 | 语法 | 前置条件 | 后置条件 | | ------------------------------ | ------------------------------- | -------- | -------------------- | | StoreController.getInformation | getInformation(Integer id) | 无 | 获取商店信息 | | StoreController.getAllProducts | getAllProducts(Integer hotelId) | 输入合法 | 获取对应商店所有商品 | | StoreController.createStore | createStore(StoreVO storeVO) | 输入合法 | 添加新商店信息 | | StoreController.getAllStore | getAllStore() | 无 | 获取所有商店信息 | #### 4.1.3 productUI ##### 4.1.3.1 模块概述 - productUI模块解决的是展示商品详情、创建商品、修改商品数量、购买商品、查找商品的需求。 ##### 4.1.3.2 整体结构 productUI包含三个界面:CreateProduct、ProductDetail、SearchProduct,和一个组件:CommentItem | 界面和组件 | 职责 | | ------------- | ---------------------------------------- | | CreateProduct | 创建商品 | | ProductDetail | 展示商品详情信息、购买商品、修改商品数量 | | SearchProduct | 查找商品 | | CommentItem | 展示评论区信息 | ##### 4.1.3.3 模块内部类的接口规范 - productUI模块需要的服务(需接口) | 接口名称 | 语法 | 前置条件 | 后置条件 | | -------------------------------- | ------------------------------------------------------------ | -------- | -------------- | | ProductController.getInformation | getInformation(Integer id) | 无 | 获得商品信息 | | ProductController.setCurrentNum | setCurrentNum(ProductVO productVO) | 输入合法 | 修改商品数量 | | ProductController.createProduct | createProduct(ProductVO productVO) | 输入合法 | 添加新商品信息 | | ProductController.getComment | getComment(Integer productId) | 输入合法 | 获得商品评论 | | ProductController.find | find(String name, String category, Double highPrice, Double lowPrice) | 输入合法 | 查找商品 | #### 4.1.4 orderUI ##### 4.1.4.1 模块概述 - orderUI模块解决的是查看订单、购买商品、发货与收货、评价订单的需求。 ##### 4.1.4.2 整体结构 orderUI包含一个界面:AllOrder,和一个组件:OrderItem | 界面和组件 | 职责 | | ---------- | ---------------------------------------- | | AllOrder | 查看订单、购买商品、收货与发货、评价订单 | | OrderItem | 展示订单详情信息 | ##### 4.1.4.3 模块内部类的接口规范 - orderUI模块需要的服务(需接口) | 接口名称 | 语法 | 前置条件 | 后置条件 | | ----------------------------- | -------------------------------------------------------- | -------- | ------------------ | | OrderController.getAllOrder | getAllOrders(Integer id) | 无 | 获取订单 | | OrderController.createOrder | createOrder(OrderVO orderVO) | 输入合法 | 添加新订单信息 | | OrderController.pay | pay(Integer id) | 输入合法 | 支付订单 | | OrderController.send | send(Integer id) | 输入合法 | 订单发货 | | OrderController.getProduct | getProduct(Integer id) | 输入合法 | 订单收货 | | OrderController.evaluateOrder | evaluateOrder(Integer id, Double rating, String comment) | 输入合法 | 订单评价 | | OrderController.getOrderInfo | getOrderInfo( Integer id) | 无 | 获得订单详情 | | OrderController.getAllSheet | getAllSheet() | 无 | 得到所有订单报表 | | OrderController.getStoreSheet | getStoreSheet(Integer id) | 无 | 得到某商店订单报表 | #### 4.1.5 couponUI ##### 4.1.5.1 模块概述 - couponUI模块解决的是展示优惠券、发放优惠券、领取优惠券的需求。 ##### 4.1.5.2 整体结构 couponUI包含一个界面:AllCoupon,和一个组件:CouponItem | 界面和组件 | 职责 | | ---------- | ---------------------------------- | | AllCoupon | 展示优惠券、发放优惠券、领取优惠券 | | CouponItem | 展示优惠券信息 | ##### 4.1.5.3 模块内部类的接口规范 - couponUI模块需要的服务(需接口) | 接口名称 | 语法 | 前置条件 | 后置条件 | | ----------------------------------- | ----------------------------------------------- | -------- | ------------------------ | | CouponController.collectCoupon | collectCoupon(Integer couponGroupId) | 输入合法 | 领取优惠券 | | CouponController.getAllAvailCoupons | getAllAvailCoupons(Integer orderId ) | 输入合法 | 获得所有可以使用的优惠券 | | CouponController.selectCoupon | selectCoupon(Integer couponId, Integer orderId) | 输入合法 | 获得选择优惠券后的价格 | | CouponController.getCouponGroups | getCouponGroups(Integer storeId) | 输入合法 | 获得优惠券组 | | CouponController.createCouponGroup | createCouponGroup(CouponGroupVO couponGroupVO) | 输入合法 | 创建优惠券组 | ### 4.2 业务逻辑层的分解 业务逻辑层的开发包图参见体系结构设计文档。 #### 4.2.1 Coupon模块 ##### 4.2.1.1 模块概述 - Coupon模块承担的需求参见需求规格说明文档功能需求及相关非功能需求文档。 - Coupon模块的职责和接口参见软件系统结构描述文档 ##### 4.2.1.2 整体结构 根据体系结构的设计,我们将系统分为展示层、业务逻辑层、数据层。为了增加灵活性,我们添加了接口,比如在展示层和业务逻辑层之间我们添加了CouponService,业务逻辑层与数据层之间我们添加了Repository接口。为了隔离业务逻辑职责和逻辑控制职责,我们增加了CouponController,这样CouponController会将具体的业务逻辑委托给CouponService。Coupon是作为优惠券的持久化对象被添加到设计模型中去的。 Coupon模块的设计如下图: ![coupon模块设计](详细设计文档.assets/coupon模块设计.svg) - Coupon模块各个类的职责 | 模块 | 职责 | | --------------------- | ------------------------------------------------------------ | | CouponController | 负责完成和优惠策略相关的服务 | | CouponService | 负责提供给CouponController的接口 | | CouponServiceImpl | 负责具体实现CouponService中的接口 | | CouponRepository | 负责提供优惠券数据与持久化相关的接口 | | CouponGroupRepository | 负责提供优惠券组数据与持久化相关的接口 | | Coupon | 优惠券持久化对象的实现载体,存有优惠券的持有者,是否被使用过等信息 | | CouponGroup | 优惠券组持久化对象的实现载体,拥有优惠券组的类型、数量、所属商店、满减额等信息 | ##### 4.2.1.3 模块内部类的接口规范 Coupon模块的各个类的职责和内部类的接口规范已在软件体系结构设计文档中描述。 **Coupon模块的接口规范** | 接口名字 | 语法 | 前置条件 | 后置条件 | | :---------------------------------- | ----------------------------------------------- | -------- | --------------------------------------------- | | CouponController.colletCoupon | collectCoupon(Integer couponGroupId) | 输入合法 | 从CouponService里领取对应优惠券组的优惠券 | | CouponController.getAllAvailCoupons | getAllAvailCoupons(Integer orderId) | 输入合法 | 从CouponService里获得该订单所有可用优惠券 | | CouponController.selectCoupon | selectCoupon(Integer couponId, Integer orderId) | 输入合法 | 从CouponService里获得使用该优惠券后的订单金额 | | CouponController.getCouponGroups | getCouponGroups(Integer storeId) | 输入合法 | 从CouponService里获得优惠券组信息 | | CouponController.createCouponGroup | createCouponGroup(CouponGroupVO couponGroupVO) | 输入合法 | 调用CouponService里的createCouponGroup方法 | **Coupon模块的服务接口** | 服务名 | 服务 | | ------------------------------------------------------------ | -------------------------------- | | CouponService.collectCoupon(Integer couponGroupId) | 从对应的优惠券组中领取一张优惠券 | | CouponService.getAllAvailCoupons(Integer orderId) | 获得该订单所有可用优惠券 | | CouponService.selectCoupon(Integer couponId, Integer orderId) | 返回使用该优惠券后的订单金额 | | CouponService.useCoupon(Integer couponId, Integer orderId) | 获得使用该优惠券后的订单金额 | | CouponService.getCouponGroups(Integer storeId) | 获得所有优惠券组信息 | | CouponService.createCouponGroup(CouponGroupVO couponGroupVO) | 创建优惠券组 | ##### 4.2.1.4 业务逻辑层的动态模型 下图表明了在OSMS中,Coupon.collectCoupon的相关对象之间的协作。 ![领取优惠券](详细设计文档.assets/领取优惠券.svg) 下图表明了在OSMS中,Coupon.getAllAvailCoupons的相关对象之间的协作。 ![获得可用优惠券](详细设计文档.assets/获得可用优惠券.svg) 下图表明了在OSMS中,Coupon.selectCoupon的相关对象之间的协作。 ![选择优惠券](详细设计文档.assets/选择优惠券.svg) 下图表明了在OSMS中,Coupon.useCoupon的相关对象之间的协作。 ![使用优惠券](详细设计文档.assets/使用优惠券.svg) 下图表明了在OSMS中,Coupon.getCouponGroups的相关对象之间的协作。 ![获得优惠券组](详细设计文档.assets/获得优惠券组.svg) 下图表明了在OSMS中,Coupon.createCouponGroup的相关对象之间的协作。 ![创建优惠券组](详细设计文档.assets/创建优惠券组.svg) ##### 4.2.1.5 业务逻辑层的设计原理 利用委托式控制⻛格,每个界面需要访问的业务逻辑由各自的控制器委托给不同的领域对象。 #### 4.2.2 Order模块 ##### 4.2.2.1 模块概述 - Order模块承担的需求参见需求规格说明文档功能需求及相关非功能需求文档。 - Order模块的职责和接口参见软件系统结构描述文档 ##### 4.2.2.2 整体结构 根据体系结构的设计,我们将系统分为展示层、业务逻辑层、数据层。为了增加灵活性,我们添加了接口,比如在展示层和业务逻辑层之间我们添加了OrderService,业务逻辑层与数据层之间我们添加了Repository接口。为了隔离业务逻辑职责和逻辑控制职责,我们增加了OrderController,这样OrderController会将具体的业务逻辑委托给OrderService。Order是作为优惠券的持久化对象被添加到设计模型中去的。 Order模块的设计如下图: ![order模块设计](详细设计文档.assets/order模块设计.svg) - Order模块各个类的职责 | 模块 | 职责 | | ---------------- | ------------------------------------------------------------ | | OrderController | 负责完成和订单相关的服务 | | OrderService | 负责提供给OrderController的接口 | | OrderServiceImpl | 负责具体实现OrderService中的接口 | | OrderRepository | 负责提供订单数据与持久化相关的接口 | | Order | 订单持久化对象的实现载体,存有订单的买卖双方,订单价格等信息 | ##### 4.2.2.3 模块内部类的接口规范 Order模块的各个类的职责和内部类的接口规范已在软件体系结构设计文档中描述。 **order模块的接口规范** | 接口名称 | 语法 | 前置条件 | 后置条件 | | ----------------------------- | -------------------------------------------------------- | -------- | ----------------------------------- | | OrderController.getAllOrder | getAllOrders(Integer id, String role) | 无 | 调用OrderService的getAllOrders方法 | | OrderController.createOrder | createOrder(OrderVO orderVO) | 输入合法 | 调用OrderService的createOrder方法 | | OrderController.pay | pay(Integer orderId, Integer couponId) | 输入合法 | 调用OrderService的pay方法 | | OrderController.send | send(Integer id) | 输入合法 | 调用OrderService的send方法 | | OrderController.getProduct | getProduct(Integer id) | 输入合法 | 调用OrderService的getProduct方法 | | OrderController.evaluateOrder | evaluateOrder(Integer id, Double rating, String comment) | 输入合法 | 调用OrderService的evaluateOrder方法 | | OrderController.getOrderInfo | getOrderInfo(Integer Id) | 输入合法 | 调用OrderService的getOrderInfo方法 | |OrderController.getAllSheet|getAllSheet()|无|调用OrderService的getAllSheet方法 | |OrderController.getStoreSheet|getStoreSheet(Integer id)|输入合法|调用OrderService的getStoreSheet方法| **Order模块的服务接口** | 服务名 | 服务 | | ------------------------------------------------------------ | ------------------------------ | | OrderService.getAllOrders(Integer id, String role) | 根据不同身份获得允许展示的订单 | | OrderService.createOrder(OrderVO orderVO) | 创建新订单 | | OrderService.pay(Integer orderId, Integer couponId) | 支付订单 | | OrderService.send(Integer id) | 订单发货 | | OrderService.getProduct(Integer id) | 订单收货 | | OrderService.evaluateOrder(Integer id, Double rating, String comment) | 订单评价 | | OrderService.getOrderInfo(Integer Id) | 获得订单详情 | |OrderService.getAllSheet()|获得全部订单| |OrderService.getStoreSheet(Integer id)|获得某商店的全部订单| ##### 4.2.2.4 业务逻辑层的动态模型 下图表明了在OSMS中,Order.getAllOrders的相关对象之间的协作。 ![获得所有订单](详细设计文档.assets/获得所有订单.svg) 下图表明了在OSMS中,Order.createOrder的相关对象之间的协作。 ![创建订单](详细设计文档.assets/创建订单.svg) 下图表明了在OSMS中,Order.pay的相关对象之间的协作。 ![支付订单](详细设计文档.assets/支付订单.svg) 下图表明了在OSMS中,Order.send的相关对象之间的协作。 ![订单发货](详细设计文档.assets/订单发货.svg) 下图表明了在OSMS中,Order.getProduct的相关对象之间的协作。 ![订单收获](详细设计文档.assets/订单收获.svg) 下图表明了在OSMS中,Order.evaluateOrder的相关对象之间的协作。 ![订单评价](详细设计文档.assets/订单评价.svg) 下图表明了在OSMS中,Order.getOrderInfo的相关对象之间的协作。 ![得到订单详情](详细设计文档.assets/得到订单详情.svg) 下图表明了在OSMS中,Order.getAllSheet的相关对象之间的协作。 ![得到全部订单报表](详细设计文档.assets/得到全部订单报表.png) 下图表明了在OSMS中,Order.getStoreSheet的相关对象之间的协作。 ![得到商店订单报表](详细设计文档.assets/得到商店订单报表.png) ##### 4.2.2.5 业务逻辑层的设计原理 利用委托式控制风格,每个界面需要访问的业务逻辑由各自的控制器委托给不同的领域对象。 #### 4.2.3 User模块 ##### 4.2.3.1 模块描述 - User模块承担的需求参见需求规格说明文档功能需求及相关非功能需求文档。 - User模块的职责和接口参见软件系统结构描述文档 ##### 4.2.3.2 整体结构 根据体系结构的设计,我们将系统分为展示层、业务逻辑层、数据层。为了增加灵活性,我们添加了接口,比如在展示层和业务逻辑层之间我们添加了UserService,业务逻辑层与数据层之间我们添加了Repository接口。为了隔离业务逻辑职责和逻辑控制职责,我们增加了UserController,这样UserController会将具体的业务逻辑委托给UserService。Order是作为优惠券的持久化对象被添加到设计模型中去的。 User模块的设计如下图: ![image-20240518145412847](详细设计文档.assets/image-20240518145412847.png) - User模块各个类的职责 | 模块 | 职责 | | --------------- | ------------------------------------------------------ | | UserController | 负责完成和用户相关的服务 | | UserService | 负责提供给UserController的接口 | | UserServiceImpl | 负责具体实现UserService中的接口 | | UserRepository | 负责提供用户数据与持久化相关的接口 | | User | 用户持久化对象的实现载体,存有用户的手机号,密码等信息 | ##### 4.2.3.3 模块内部类的接口规范 User模块的各个类的职责和内部类的接口规范已在软件体系结构设计文档中描述。 **User模块的接口规范** | 接口名称 | 语法 | 前置条件 | 后置条件 | | -------------------------------- | ----------------------------------- | -------------------- | -------------------------------------- | | UserController.register | register(UserVO userVO) | 用户电话号尚未被注册 | 调用UserService的register方法 | | UserController.login | login(String phone,String password) | 用户存在 | 调用UserService的login方法 | | UserController.getInformation | getInformation() | 无 | 调用UserService的getInformation方法 | | UserController.updateInformation | updateInformation(UserVO userVO) | 无 | 调用UserService的updateInformation方法 | **User模块的服务接口** | 服务名 | 服务 | | ----------------------------- | -------------- | | UserService.register | 添加新用户信息 | | UserService.login | 用户验证登录 | | UserService.getInformation | 获取用户信息 | | UserService.updateInformation | 修改用户信息 | ##### 4.2.3.4 业务逻辑层的动态模型 下图表明了在OSMS中,User.register的相关对象之间的协作。 ![image-20240518151142644](详细设计文档.assets/image-20240518151142644.png) 下图表明了在OSMS中,User.login的相关对象之间的协作。 ![image-20240518151512505](详细设计文档.assets/image-20240518151512505.png) 下图表明了在OSMS中,User.getInformation的相关对象之间的协作。 ![image-20240518151805284](详细设计文档.assets/image-20240518151805284.png) 下图表明了在OSMS中,User.updateInformation的相关对象之间的协作。 ![image-20240518152144262](详细设计文档.assets/image-20240518152144262.png) ##### 4.2.3.5 业务逻辑层的设计原理 利用委托式控制风格,每个界面需要访问的业务逻辑由各自的控制器委托给不同的领域对象。 #### 4.2.4 Store模块 ##### 4.2.4.1 模块描述 - Store模块承担的需求参见需求规格说明文档功能需求及相关非功能需求文档。 - Store模块的职责和接口参见软件系统结构描述文档 ##### 4.2.4.2 整体结构 根据体系结构的设计,我们将系统分为展示层、业务逻辑层、数据层。为了增加灵活性,我们添加了接口,比如在展示层和业务逻辑层之间我们添加了StoreService,业务逻辑层与数据层之间我们添加了Repository接口。为了隔离业务逻辑职责和逻辑控制职责,我们增加了StoreController,这样StoreController会将具体的业务逻辑委托给StoreService。Order是作为优惠券的持久化对象被添加到设计模型中去的。 Store模块的设计如下图: ![image-20240518145740958](详细设计文档.assets/image-20240518145740958.png) - Store模块各个类的职责 | 模块 | 职责 | | ---------------- | ---------------------------------------------------- | | StoreController | 负责完成和商店相关的服务 | | StoreService | 负责提供给StoreController的接口 | | StoreServiceImpl | 负责具体实现StoreService中的接口 | | StoreRepository | 负责提供商店数据与持久化相关的接口 | | Store | 商店持久化对象的实现载体,存有商店的介绍,地点等信息 | ##### 4.2.4.3 模块内部类的接口规范 Store模块的各个类的职责和内部类的接口规范已在软件体系结构设计文档中描述。 **Store模块的接口规范** | 接口名称 | 语法 | 前置条件 | 后置条件 | | ------------------------------ | ---------------------------- | ---------- | ------------------------------------ | | StoreController.getInformation | getInformation(Integer id) | 商店id存在 | 调用StoreService的getInformation方法 | | StoreController.getAllProducts | getAllProducts(Integer id) | 商店id存在 | 调用StoreService的getAllProducts方法 | | StoreController.createStore | createStore(StoreVO storeVO) | 无 | 调用StoreService的createStore方法 | | StoreController.getAllStore | getAllStore() | 无 | 调用StoreService的getAllStore方法 | **Store模块的服务接口** | 服务名 | 服务 | | --------------------------- | ------------------ | | StoreService.getInformation | 获得商店信息 | | StoreService.getAllProducts | 获得商店内全部商品 | | StoreService.createStore | 创建商店 | | StoreService.getAllStore | 获得全部商店 | ##### 4.2.4.4 业务逻辑层的动态模型 下图表明了在OSMS中,Store.getInformation的相关对象之间的协作。 ![image-20240518190353107](详细设计文档.assets/image-20240518190353107.png) 下图表明了在OSMS中,Store.getAllProducts的相关对象之间的协作。 ![image-20240518191129008](详细设计文档.assets/image-20240518191129008.png) 下图表明了在OSMS中,Store.createStore的相关对象之间的协作。 ![image-20240518191417714](详细设计文档.assets/image-20240518191417714.png) 下图表明了在OSMS中,Store.getAllStore的相关对象之间的协作。 ![image-20240518191540456](详细设计文档.assets/image-20240518191540456.png) ##### 4.2.4.5 业务逻辑层的设计原理 利用委托式控制风格,每个界面需要访问的业务逻辑由各自的控制器委托给不同的领域对象。 #### 4.2.5 Product模块 ##### 4.2.5.1 模块描述 - Product模块承担的需求参见需求规格说明文档功能需求及相关非功能需求文档。 - Product模块的职责和接口参见软件系统结构描述文档 ##### 4.2.5.2 整体结构 根据体系结构的设计,我们将系统分为展示层、业务逻辑层、数据层。为了增加灵活性,我们添加了接口,比如在展示层和业务逻辑层之间我们添加了ProductService,业务逻辑层与数据层之间我们添加了Repository接口。为了隔离业务逻辑职责和逻辑控制职责,我们增加了ProductController,这样ProductController会将具体的业务逻辑委托给ProductService。Order是作为优惠券的持久化对象被添加到设计模型中去的。 Product模块的设计如下图: ![image-20240518145912707](详细设计文档.assets/image-20240518145912707.png) - Product模块各个类的职责 | 模块 | 职责 | | ------------------ | ---------------------------------------------------- | | ProductController | 负责完成和商品相关的服务 | | ProductService | 负责提供给ProductController的接口 | | ProductServiceImpl | 负责具体实现ProductService中的接口 | | ProductRepository | 负责提供商品数据与持久化相关的接口 | | Product | 商品持久化对象的实现载体,存有商品的介绍,价格等信息 | ##### 4.2.5.3 模块内部类的接口规范 Product模块的各个类的职责和内部类的接口规范已在软件体系结构设计文档中描述。 **Product模块的接口规范** | 接口名称 | 语法 | 前置条件 | 后置条件 | | -------------------------------- | ------------------------------------------------------------ | ---------- | -------------------------------------- | | ProductController.getInformation | getInformation(Integer id) | 商品id存在 | 调用ProductService的getInformation方法 | | ProductController.setCurrentNum | setCurrentNum(ProductVO productVO) | 无 | 调用ProductService的setCurrentNum方法 | | ProductController.createProduct | createProduct(ProductVO productVO) | 无 | 调用ProductService的createProduct方法 | | ProductController.getComment | getComment(Integer productId) | 商品id存在 | 调用ProductService的getComment方法 | | ProductController.find | find(String name, String category,Double highPrice,Double lowPrice) | 无 | 调用ProductService的find方法 | **Product模块的服务接口** | 服务名 | 服务 | | ----------------------------- | -------------- | | ProductService.getInformation | 获得商品信息 | | ProductService.setCurrentNum | 获得商品库存 | | ProductService.createProduct | 创建商品 | | ProductService.getComment | 获得商品评论区 | | ProductService.find | 查找商品 | ##### 4.2.5.4 业务逻辑层的动态模型 下图表明了在OSMS中,Product.getInformation的相关对象之间的协作。 ![image-20240518191825512](详细设计文档.assets/image-20240518191825512.png) 下图表明了在OSMS中,Product.setCurrentNum的相关对象之间的协作。 ![image-20240518192027713](详细设计文档.assets/image-20240518192027713.png) 下图表明了在OSMS中,Product.createProduct的相关对象之间的协作。 ![image-20240518192239228](详细设计文档.assets/image-20240518192239228.png) 下图表明了在OSMS中,Product.getComment的相关对象之间的协作。 ![image-20240518192652863](详细设计文档.assets/image-20240518192652863.png) 下图表明了在OSMS中,Product.find的相关对象之间的协作。 ![image-20240518193547640](详细设计文档.assets/image-20240518193547640.png) ##### 4.2.5.5 业务逻辑层的设计原理 利用委托式控制风格,每个界面需要访问的业务逻辑由各自的控制器委托给不同的领域对象。 ### 4.3 数据访问层的分解 数据访问层的开发包图参见体系结构设计文档。 #### 4.3.1 order模块 ##### 4.3.1.1 模块概述 该模块对订单相关模块进行数据接收和处理,包括创建订单、状态改变、用户查找等操作。 ##### 4.3.1.2 整体结构 我们将order模块分为OrderRepository和Order部分,对数据进行了一定程度的抽象,向上层业务逻辑提供了创建订单,通过订单Id、用户Id等方式查找并返回所需订单数据的接口。 | 组成部分 | 职责 | | --------------- | ------------------------------------------------------ | | Order | 储存订单相关信息,包括价格、状态、商品名、数量、时间等 | | OrderRepository | 映射订单在数据库中的位置,用于查找订单 | ##### 4.3.1.3 模块内部类的接口规范 | 接口名称 | 语法 | 前置条件 | 后置条件 | | ---------------------------------- | ----------------------------------------- | -------------- | ---------------------- | | OrderRepository.findAllByUserId | findAllByUserId(Integer userId) | 已获得用户的Id | 获得用户创建的订单信息 | | OrderRepository.findAllByStoreId | findAllByStoreId(Integer storeId) | 已获得商店的Id | 获得商店收到的订单信息 | | OrderRepository.findAllByProductId | findAllByProductId(Integer productId) | 已获得商品的Id | 获得商品相关的订单信息 | | OrderRepository.findById | OrderRepository.findById(Integer id) | 已获得订单的Id | 获得订单的相关信息 | | OrderRepository.findAll | OrderRepository.findAll() | 无 | 获得全部订单 | | OrderRepository.save | OrderRepository.save(order) | 无 | 保存订单信息 | | ProductRepository.findById | ProductRepository.findById(Integer id) | 已获得商品的Id | 获得商品的相关信息 | | ProductRepository.save | ProductRepository.save(product) | 无 | 保存商品信息 | | StoreRepository.findById | StoreRepository.findById(Integer id) | 已获得商店的Id | 获得商店的相关信息 | | StoreRepository.save | StoreRepository.save(store) | 无 | 保存商店信息 | | UserRepository.findById | UserRepository.findById(Integer id) | 已获得用户的Id | 获得用户的相关信息 | | OrderRepository.getStoreSheet | OrderRepository.getStoreSheet(Integer id) | 用户为商家 | 获得商家总报表 | | OrderRepository.getAllSheet | OrderRepository.getAllSheet() | 用户身份为经理 | 获得所有商店的总报表 | #### 4.3.2 user模块 ##### 4.3.2.1 模块概述 该模块对用户信息进行处理,包括添加用户、查找用户、信息修改等操作。 ##### 4.3.2.2 整体结构 我们将user模块分为UserRepository和User部分,对数据进行了一定程度的抽象,向上层业务逻辑提供了创建账户,通过Id、电话号码和密码等方式查找并返回所需用户信息的接口。 | 组成部分 | 职责 | | -------------- | ---------------------------------------------------- | | User | 储存用户相关信息 | | UserRepository | 映射用户信息在数据库中的位置,用于登录时查找用户信息 | ##### 4.3.2.3 模块内部类的接口规范 | 接口名称 | 语法 | 前置条件 | 后置条件 | | ------------------------------------- | --------------------------------------------------------- | -------------------- | ---------------------------------- | | UserRepository.findByPhone | findByPhone(String phone) | 已获得用户的电话号码 | 通过电话获取相应用户的相关信息 | | UserRepository.findByPhoneAndPassword | findByPhoneAndPassword(String phone**,** String password) | 已获得用户的登录信息 | 通过登录信息获取相应用户的全部信息 | | UserRepository.save | UserRepository.save(user) | 无 | 保存用户信息 | #### 4.3.3 store模块 ##### 4.3.3.1 模块概述 该模块对商店数据进行处理,包括添加商店、查找商店等操作。 ##### 4.3.3.2 整体结构 我们将store模块分为StoreRepository和Store部分,对数据进行了一定程度的抽象,向上层业务逻辑提供了通过Id等方式创建商店、查找并返回所需商店信息的接口。 | 组成部分 | 职责 | | --------------- | ------------------------------------------ | | Store | 储存商店相关信息 | | StoreRepository | 映射商店信息在数据库中的位置,用于查找商店 | ##### 4.3.3.3 模块内部类的接口规范 | 接口名称 | 语法 | 前置条件 | 后置条件 | | ---------------------------------- | --------------------------------------------------- | ---------------- | ------------------------------ | | StoreRepository.findByName | findByName(String name) | 已获得商店的名字 | 根据名字获得相应商店信息 | | StoreRepository.findById | StoreRepository.findById(Integer id) | 已获得商店的Id | 根据商店id获得商店 | | StoreRepository.findAll | StoreRepository.findAll() | 无 | 获取全部商店 | | StoreRepository.save | StoreRepository.save(store) | 无 | 保存商店信息 | | ProductRepository.findAllByStoreId | ProductRepository.findAllByStoreId(Integer storeId) | 已获得商店的Id | 根据商店id获得该商店内全部商品 | #### 4.3.4 product模块 ##### 4.3.4.1 模块概述 该模块对商品数据进行处理,包括添加商品、查找商品等操作。 ##### 4.3.4.2 整体结构 我们将product模块分为ProductRepository和Product部分,对数据进行了一定程度的抽象,向上层业务逻辑提供了通过Id等方式创建商品、查找并返回所需商品信息的接口。 | 组成部分 | 职责 | | ----------------- | ------------------------------------------ | | Product | 储存商品相关信息 | | ProductRepository | 映射商品信息在数据库中的位置,用于查找商品 | ##### 4.3.4.3 模块内部类的接口规范 | 接口名称 | 语法 | 前置条件 | 后置条件 | | ---------------------------------- | ----------------------------------------------------- | -------------- | ------------------------ | | ProductRepository.findAllByStoreId | findAllByStoreId(Integer storeId) | 已获得商店的Id | 获取该商店所有的商品信息 | | ProductRepository.findById | ProductRepository.findById(Integer id) | 已获得商品的Id | 获得商品相关信息 | | ProductRepository.save | ProductRepository.save(product) | 无 | 保存商品信息 | | OrderRepository.findAllByProductId | OrderRepository.findAllByProductId(Integer productId) | 已获得商品的Id | 获得商品全部订单 | #### 4.3.5 coupon模块 ##### 4.3.5.1 模块概述 该模块对优惠券数据进行处理,包括创建、添加、领取、使用优惠券等操作。 ##### 4.3.5.2 整体结构 我们将coupon模块分为CouponGroupRepository, CouponRepository, CouponGroup和Coupon部分,对数据进行了一定程度的抽象,向上层业务逻辑提供了通过用户Id、商店Id等方式创建、领取优惠券、查找并返回所需优惠券和优惠券组的接口。 | 组成部分 | 职责 | | --------------------- | -------------------------------------------------- | | Coupon | 储存优惠券相关信息 | | CouponGroup | 存储优惠券组相关信息 | | CouponRepository | 映射优惠券信息在数据库中的位置,用于查找优惠券 | | CouponGroupRepository | 映射优惠券组信息在数据库中的位置,用于查找优惠券组 | ##### 4.3.5.3 模块内部类的接口规范 | 接口名称 | 语法 | 前置条件 | 后置条件 | | --------------------------------------- | ------------------------------------------------------------ | -------------------- | ---------------------------- | | CouponRepository.findAllByUserId | CouponRepository.findAllByUserId(Integer userId) | 已登录 | 获得该用户所有的优惠券列表 | | CouponRepository.findAllByCouponGroupId | CouponRepository.findAllByCouponGroupId(Integer couponGroupId) | 已获得优惠券组的编号 | 获得该优惠券组下所有优惠券 | | CouponRepository.save | CouponRepository.save(Coupon coupon) | 无 | 保存优惠券信息 | | CouponGroupRepository.findById | CouponGroupRepository.findById(Integer couponGroupId) | 已获得优惠券组的编号 | 获得该优惠券组 | | CouponGroupRepository.save | CouponGroupRepository.save(couponGroup) | 无 | 保存优惠券组信息 | | OrderRepository.findById | OrderRepository.findById(Integer orderId) | 已知订单编号 | 获取订单信息 | | CouponGroupRepository.findAll | CouponGroupRepository.findAll() | 无 | 获取所有优惠券组 | | CouponGroupRepository.findAllByStoreId | CouponGroupRepository.findAllByStoreId(Integer storeId) | 已获得商店Id | 获取该商店发放的所有优惠券组 | ## 5. 依赖视角 下图分别是前端和后端各自的包之间的依赖关系。 ![客户端开发包图](详细设计文档.assets/客户端开发包图.svg) ![服务器端开发包图](详细设计文档.assets/服务器端开发包图.svg)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully