支付模塊
功能:
支付寶對接;支付回調;查詢支付狀態;
注:
支付寶-當面付 里邊封裝的demo 應該使用 java8 ,過高的版本不能運行(java9也不行)
request 得到的 path 結束是沒有 / 的,在拼接地址的時候要加上
定義常量類,需要 文字、數組 ,用ENUM 枚舉;只需要字符串描述,使用 interface ;
接口:
三個接口:商城下單,支付寶返回二維碼 ;支付寶回調;給前端查詢訂單狀態
學習目標:
熟悉支付寶對接文檔,調用支付寶支付功能官方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批量插入