ssm实战(8)-----支付模块开发,订单模块

支付模块

功能:

支付宝对接;支付回调;查询支付状态;

注:

支付宝-当面付 里边封装的demo 应该使用 java8 ,过高的版本不能运行(java9也不行)

request 得到的 path 结束是没有 / 的,在拼接地址的时候要加上

定义常量类,需要 文字、数组 ,用ENUM 枚举;只需要字符串描述,使用 interface ;

 接口:

扫描二维码关注公众号,回复: 7350899 查看本文章

三个接口:商城下单,支付宝返回二维码 ;支付宝回调;给前端查询订单状态

学习目标:

熟悉支付宝对接文档,调用支付宝支付功能官方demo;

解析支付宝SDK对接源码

RSA1和RSA2验证签名及加解密

避免支付宝重复通知和数据校验

nataApp外网穿透和tomcat remote debug

生成二维码并持久化到图片服务器

支付宝扫码支付的学习流程:

支付宝官方文档

沙箱调试环境

支付宝扫码支付的主要业务流程

支付宝扫码支付的 字段 和 细节

支付宝扫码支付的对接

支付宝扫码支付官方Demo

订单模块

功能:

  前端功能:创建订单;商品信息;订单列表;订单详情;取消订单;

  后端功能:订单列表;订单搜索;订单详情;订单发货;  

接口:

  创建订单:要校验 购物车是否为空,商品是否为在售状态,商品数量是不是大于购物车数量

注:

学习目标:

避免横向越权,纵向越权;

可以扩展的常量、枚举类;

    public enum PaymentTypeEnum{
        ONLINE_PAY(1,"在线支付");
        private String value;
        private int code;

        PaymentTypeEnum(int code, String value) {
            this.code=code;
            this.value=value;
        }

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }

        public static PaymentTypeEnum codeOf(int code){
            for(PaymentTypeEnum paymentTypeEnum:values()){
                if(paymentTypeEnum.code==code){
                    return paymentTypeEnum;
                }
            }
            throw new RuntimeException("没有找到对应的枚举");
        }
    }

 获得该枚举的描述:codeOf(1) 获得:在线支付   。 values() 为该枚举类的值

        public static PaymentTypeEnum codeOf(int code){
            for(PaymentTypeEnum paymentTypeEnum:values()){
                if(paymentTypeEnum.code==code){
                    return paymentTypeEnum;
                }
            }
            throw new RuntimeException("没有找到对应的枚举");
        }

订单号生成规则

Mybatis批量插入

猜你喜欢

转载自www.cnblogs.com/Lemonades/p/11508500.html