# immall
**Repository Path**: 1033224232/immall
## Basic Information
- **Project Name**: immall
- **Description**: immall
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2017-05-09
- **Last Updated**: 2021-11-03
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# mmall
一个整合SSM框架的电商后台。
## 项目环境的搭建
* **操作系统** : Linux Centos 6.3 64位
* **IDE** :IntelliJ IDEA 2017.1.1 x64
* **JDK** : JDK1.8 建议使用JDK1.7以上版本。
* **Web容器** : Tomcat 9.0
* **数据库** :Mysql-5.6.17-WinX64
* **依赖管理工具** : Maven
* **ftp服务器** : vsftpd
* **上线的配置** :http://note.youdao.com/noteshare?id=34b8e5ffb3fc941d22a0d21333e4d9d3&sub=EE9B31928E9740B3B011CE6F1984C473
---
## 项目效果图
- 电商列表
前台页面暂未完成
---
### (一)java电商Dao层次的编写
#### 构建项目的基本骨架
* 首先我们要搭建出一个符合Maven约定的目录来,这里大致有两种方式,第一种:
1. 第一种使用命令行手动构建一个maven结构的目录,当然我基本不会这样构建
```
mvn archetype:generate -DgroupId=com.suny.seckill -DartifactId=seckill -Dpackage=com.suny.seckill -Dversion=1.0-SNAPSHOT -DarchetypeArtifactId=maven-archetype-webapp
```
这里要注意的是使用`archetype:generate`进行创建,在Maven老版本中是使用`archetype:create`,现在这种方法已经被弃用了,所以使用命令行创建的话注意了,稍微解释下这段语句的意思,就是构建一个一个`maven-archetype-webapp`骨架的Webapp项目,然后`groupId`为`com.suny.seckill `,`artifactId`为`seckill`,这里是Maven相关知识,可以按照自己的情况进行修改
2.第二种直接在IDE中进行创建,这里以IDEA为例
+ 点击左上角`File>New>Project>Maven`
+ 然后在里面勾选`Create from archetype`,然后再往下拉找到`org.apache.cocoon:cocoon-22-archetype-webapp`,选中它,注意要先勾选那个选项,否则选择不了,然后点击`Next`继续

+然后就填写你的Maven的那几个重要的坐标了,自己看着填吧

+再就配置你的Maven的相关信息,默认应该是配置好的

+之后就是点`Finsh`,到此不出意外的话就应该创建成功了
#### 构建pom文件
项目基本的骨架我们就创建出来了,接下来我们要添加一些基本的JAR包的依赖,也就是在`pom.xml`中添加各种开源组件的三坐标了
```xml
4.0.0
com
mmall
war
1.0-SNAPSHOT
mmall Maven Webapp
http://maven.apache.org
UTF-8
UTF-8
UTF-8
4.0.0.RELEASE
3.4.1
1.3.0
org.json
json
20090211
org.apache.tomcat
tomcat-servlet-api
7.0.64
org.springframework
spring-webmvc
${org.springframework.version}
org.springframework
spring-oxm
${org.springframework.version}
org.springframework
spring-jdbc
${org.springframework.version}
org.springframework
spring-tx
${org.springframework.version}
org.springframework
spring-test
${org.springframework.version}
org.aspectj
aspectjweaver
1.7.3
org.mybatis
mybatis-spring
${org.mybatis.spring.version}
org.mybatis
mybatis
${org.mybatis.version}
org.aspectj
aspectjrt
1.6.11
org.codehaus.jackson
jackson-mapper-asl
1.9.12
commons-dbcp
commons-dbcp
1.4
ch.qos.logback
logback-classic
1.1.2
compile
ch.qos.logback
logback-core
1.1.2
compile
mysql
mysql-connector-java
5.1.6
com.google.guava
guava
20.0
org.apache.commons
commons-lang3
3.5
commons-collections
commons-collections
3.2.1
junit
junit
4.12
joda-time
joda-time
2.3
org.hashids
hashids
1.0.1
commons-net
commons-net
3.1
commons-fileupload
commons-fileupload
1.2.2
commons-io
commons-io
2.0.1
com.github.pagehelper
pagehelper
4.1.0
com.github.miemiedev
mybatis-paginator
1.2.17
com.github.jsqlparser
jsqlparser
0.9.4
commons-codec
commons-codec
1.10
commons-configuration
commons-configuration
1.10
commons-lang
commons-lang
2.6
commons-logging
commons-logging
1.1.1
com.google.zxing
core
2.1
com.google.code.gson
gson
2.3.1
org.hamcrest
hamcrest-core
1.3
redis.clients
jedis
2.9.0
org.jetbrains
annotations
RELEASE
mmall
org.mybatis.generator
mybatis-generator-maven-plugin
1.3.2
true
true
org.apache.maven.plugins
maven-compiler-plugin
1.8
1.8
UTF-8
${project.basedir}/src/main/webapp/WEB-INF/lib
```
#### 建立数据库
在根目录下有一个[sql](sql)文件夹里面有一个[sql数据库脚本](sql/mmall.sql).
```sql
-- 整个项目的数据库脚本
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
--创建商品表
DROP TABLE IF EXISTS `mmall_cart`;
CREATE TABLE `mmall_cart` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`product_id` int(11) DEFAULT NULL COMMENT '商品id',
`quantity` int(11) DEFAULT NULL COMMENT '数量',
`checked` int(11) DEFAULT NULL COMMENT '是否选择,1=已勾选,0=未勾选',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `user_id_index` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=146 DEFAULT CHARSET=utf8;
BEGIN;
INSERT INTO `mmall_cart` VALUES ('126', '21', '26', '1', '1', '2017-04-13 21:27:06', '2017-04-13 21:27:06');
COMMIT;
--创建商品类别表
DROP TABLE IF EXISTS `mmall_category`;
CREATE TABLE `mmall_category` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '类别Id',
`parent_id` int(11) DEFAULT NULL COMMENT '父类别id当id=0时说明是根节点,一级类别',
`name` varchar(50) DEFAULT NULL COMMENT '类别名称',
`status` tinyint(1) DEFAULT '1' COMMENT '类别状态1-正常,2-已废弃',
`sort_order` int(4) DEFAULT NULL COMMENT '排序编号,同类展示顺序,数值相等则自然排序',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=100032 DEFAULT CHARSET=utf8;
BEGIN;
INSERT INTO `mmall_category` VALUES ('100001', '0', '家用电器', '1', null, '2017-03-25 16:46:00', '2017-03-25 16:46:00'), ('100002', '0', '数码3C', '1', null, '2017-03-25 16:46:21', '2017-03-25 16:46:21'), ('100003', '0', '服装箱包', '1', null, '2017-03-25 16:49:53', '2017-03-25 16:49:53'), ('100004', '0', '食品生鲜', '1', null, '2017-03-25 16:50:19', '2017-03-25 16:50:19'), ('100005', '0', '酒水饮料', '1', null, '2017-03-25 16:50:29', '2017-03-25 16:50:29'), ('100006', '100001', '冰箱', '1', null, '2017-03-25 16:52:15', '2017-03-25 16:52:15'), ('100007', '100001', '电视', '1', null, '2017-03-25 16:52:26', '2017-03-25 16:52:26'), ('100008', '100001', '洗衣机', '1', null, '2017-03-25 16:52:39', '2017-03-25 16:52:39'), ('100009', '100001', '空调', '1', null, '2017-03-25 16:52:45', '2017-03-25 16:52:45'), ('100010', '100001', '电热水器', '1', null, '2017-03-25 16:52:54', '2017-03-25 16:52:54'), ('100011', '100002', '电脑', '1', null, '2017-03-25 16:53:18', '2017-03-25 16:53:18'), ('100012', '100002', '手机', '1', null, '2017-03-25 16:53:27', '2017-03-25 16:53:27'), ('100013', '100002', '平板电脑', '1', null, '2017-03-25 16:53:35', '2017-03-25 16:53:35'), ('100014', '100002', '数码相机', '1', null, '2017-03-25 16:53:56', '2017-03-25 16:53:56'), ('100015', '100002', '3C配件', '1', null, '2017-03-25 16:54:07', '2017-03-25 16:54:07'), ('100016', '100003', '女装', '1', null, '2017-03-25 16:54:44', '2017-03-25 16:54:44'), ('100017', '100003', '帽子', '1', null, '2017-03-25 16:54:51', '2017-03-25 16:54:51'), ('100018', '100003', '旅行箱', '1', null, '2017-03-25 16:55:02', '2017-03-25 16:55:02'), ('100019', '100003', '手提包', '1', null, '2017-03-25 16:55:09', '2017-03-25 16:55:09'), ('100020', '100003', '保暖内衣', '1', null, '2017-03-25 16:55:18', '2017-03-25 16:55:18'), ('100021', '100004', '零食', '1', null, '2017-03-25 16:55:30', '2017-03-25 16:55:30'), ('100022', '100004', '生鲜', '1', null, '2017-03-25 16:55:37', '2017-03-25 16:55:37'), ('100023', '100004', '半成品菜', '1', null, '2017-03-25 16:55:47', '2017-03-25 16:55:47'), ('100024', '100004', '速冻食品', '1', null, '2017-03-25 16:55:56', '2017-03-25 16:55:56'), ('100025', '100004', '进口食品', '1', null, '2017-03-25 16:56:06', '2017-03-25 16:56:06'), ('100026', '100005', '白酒', '1', null, '2017-03-25 16:56:22', '2017-03-25 16:56:22'), ('100027', '100005', '红酒', '1', null, '2017-03-25 16:56:30', '2017-03-25 16:56:30'), ('100028', '100005', '饮料', '1', null, '2017-03-25 16:56:37', '2017-03-25 16:56:37'), ('100029', '100005', '调制鸡尾酒', '1', null, '2017-03-25 16:56:45', '2017-03-25 16:56:45'), ('100030', '100005', '进口洋酒', '1', null, '2017-03-25 16:57:05', '2017-03-25 16:57:05');
COMMIT;
--创建订单表
DROP TABLE IF EXISTS `mmall_order`;
CREATE TABLE `mmall_order` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单id',
`order_no` bigint(20) DEFAULT NULL COMMENT '订单号',
`user_id` int(11) DEFAULT NULL COMMENT '用户id',
`shipping_id` int(11) DEFAULT NULL,
`payment` decimal(20,2) DEFAULT NULL COMMENT '实际付款金额,单位是元,保留两位小数',
`payment_type` int(4) DEFAULT NULL COMMENT '支付类型,1-在线支付',
`postage` int(10) DEFAULT NULL COMMENT '运费,单位是元',
`status` int(10) DEFAULT NULL COMMENT '订单状态:0-已取消-10-未付款,20-已付款,40-已发货,50-交易成功,60-交易关闭',
`payment_time` datetime DEFAULT NULL COMMENT '支付时间',
`send_time` datetime DEFAULT NULL COMMENT '发货时间',
`end_time` datetime DEFAULT NULL COMMENT '交易完成时间',
`close_time` datetime DEFAULT NULL COMMENT '交易关闭时间',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `order_no_index` (`order_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=118 DEFAULT CHARSET=utf8;
BEGIN;
INSERT INTO `mmall_order` VALUES ('103', '1491753014256', '1', '25', '13998.00', '1', '0', '10', null, null, null, null, '2017-04-09 23:50:14', '2017-04-09 23:50:14'), ('104', '1491830695216', '1', '26', '13998.00', '1', '0', '10', null, null, null, null, '2017-04-10 21:24:55', '2017-04-10 21:24:55'), ('105', '1492089528889', '1', '29', '3299.00', '1', '0', '10', null, null, null, null, '2017-04-13 21:18:48', '2017-04-13 21:18:48'), ('106', '1492090946105', '1', '29', '27894.00', '1', '0', '20', '2017-04-13 21:42:40', null, null, null, '2017-04-13 21:42:26', '2017-04-13 21:42:41'), ('107', '1492091003128', '1', '29', '8597.00', '1', '0', '20', '2017-04-13 21:43:38', null, null, null, '2017-04-13 21:43:23', '2017-04-13 21:43:38'), ('108', '1492091051313', '1', '29', '1999.00', '1', '0', '10', null, null, null, null, '2017-04-13 21:44:11', '2017-04-13 21:44:11'), ('109', '1492091061513', '1', '29', '6598.00', '1', '0', '10', null, null, null, null, '2017-04-13 21:44:21', '2017-04-13 21:44:21'), ('110', '1492091069563', '1', '29', '3299.00', '1', '0', '10', null, null, null, null, '2017-04-13 21:44:29', '2017-04-13 21:44:29'), ('111', '1492091076073', '1', '29', '4299.00', '1', '0', '10', null, null, null, null, '2017-04-13 21:44:36', '2017-04-13 21:44:36'), ('112', '1492091083720', '1', '29', '3299.00', '1', '0', '10', null, null, null, null, '2017-04-13 21:44:43', '2017-04-13 21:44:43'), ('113', '1492091089794', '1', '29', '6999.00', '1', '0', '10', null, null, null, null, '2017-04-13 21:44:49', '2017-04-13 21:44:49'), ('114', '1492091096400', '1', '29', '6598.00', '1', '0', '10', null, null, null, null, '2017-04-13 21:44:56', '2017-04-13 21:44:56'), ('115', '1492091102371', '1', '29', '3299.00', '1', '0', '10', null, null, null, null, '2017-04-13 21:45:02', '2017-04-13 21:45:02'), ('116', '1492091110004', '1', '29', '8598.00', '1', '0', '40', '2017-04-13 21:55:16', '2017-04-13 21:55:31', null, null, '2017-04-13 21:45:09', '2017-04-13 21:55:31'), ('117', '1492091141269', '1', '29', '22894.00', '1', '0', '20', '2017-04-13 21:46:06', null, null, null, '2017-04-13 21:45:41', '2017-04-13 21:46:07');
COMMIT;
--创建订单子表
DROP TABLE IF EXISTS `mmall_order_item`;
CREATE TABLE `mmall_order_item` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单子表id',
`user_id` int(11) DEFAULT NULL,
`order_no` bigint(20) DEFAULT NULL,
`product_id` int(11) DEFAULT NULL COMMENT '商品id',
`product_name` varchar(100) DEFAULT NULL COMMENT '商品名称',
`product_image` varchar(500) DEFAULT NULL COMMENT '商品图片地址',
`current_unit_price` decimal(20,2) DEFAULT NULL COMMENT '生成订单时的商品单价,单位是元,保留两位小数',
`quantity` int(10) DEFAULT NULL COMMENT '商品数量',
`total_price` decimal(20,2) DEFAULT NULL COMMENT '商品总价,单位是元,保留两位小数',
`create_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `order_no_index` (`order_no`) USING BTREE,
KEY `order_no_user_id_index` (`user_id`,`order_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=135 DEFAULT CHARSET=utf8;
BEGIN;
INSERT INTO `mmall_order_item` VALUES ('113', '1', '1491753014256', '26', 'Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机', '241997c4-9e62-4824-b7f0-7425c3c28917.jpeg', '6999.00', '2', '13998.00', '2017-04-09 23:50:14', '2017-04-09 23:50:14'), ('114', '1', '1491830695216', '26', 'Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机', '241997c4-9e62-4824-b7f0-7425c3c28917.jpeg', '6999.00', '2', '13998.00', '2017-04-10 21:24:55', '2017-04-10 21:24:55'), ('115', '1', '1492089528889', '27', 'Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg', '3299.00', '1', '3299.00', '2017-04-13 21:18:48', '2017-04-13 21:18:48'), ('116', '1', '1492090946105', '29', 'Haier/海尔HJ100-1HU1 10公斤滚筒洗衣机全自动带烘干家用大容量 洗烘一体', '173335a4-5dce-4afd-9f18-a10623724c4e.jpeg', '4299.00', '2', '8598.00', '2017-04-13 21:42:26', '2017-04-13 21:42:26'), ('117', '1', '1492090946105', '28', '4+64G送手环/Huawei/华为 nova 手机P9/P10plus青春', '0093f5d3-bdb4-4fb0-bec5-5465dfd26363.jpeg', '1999.00', '1', '1999.00', '2017-04-13 21:42:26', '2017-04-13 21:42:26'), ('118', '1', '1492090946105', '27', 'Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg', '3299.00', '1', '3299.00', '2017-04-13 21:42:26', '2017-04-13 21:42:26'), ('119', '1', '1492090946105', '26', 'Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机', '241997c4-9e62-4824-b7f0-7425c3c28917.jpeg', '6999.00', '2', '13998.00', '2017-04-13 21:42:26', '2017-04-13 21:42:26'), ('120', '1', '1492091003128', '27', 'Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg', '3299.00', '2', '6598.00', '2017-04-13 21:43:23', '2017-04-13 21:43:23'), ('121', '1', '1492091003128', '28', '4+64G送手环/Huawei/华为 nova 手机P9/P10plus青春', '0093f5d3-bdb4-4fb0-bec5-5465dfd26363.jpeg', '1999.00', '1', '1999.00', '2017-04-13 21:43:23', '2017-04-13 21:43:23'), ('122', '1', '1492091051313', '28', '4+64G送手环/Huawei/华为 nova 手机P9/P10plus青春', '0093f5d3-bdb4-4fb0-bec5-5465dfd26363.jpeg', '1999.00', '1', '1999.00', '2017-04-13 21:44:11', '2017-04-13 21:44:11'), ('123', '1', '1492091061513', '27', 'Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg', '3299.00', '2', '6598.00', '2017-04-13 21:44:21', '2017-04-13 21:44:21'), ('124', '1', '1492091069563', '27', 'Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg', '3299.00', '1', '3299.00', '2017-04-13 21:44:29', '2017-04-13 21:44:29'), ('125', '1', '1492091076073', '29', 'Haier/海尔HJ100-1HU1 10公斤滚筒洗衣机全自动带烘干家用大容量 洗烘一体', '173335a4-5dce-4afd-9f18-a10623724c4e.jpeg', '4299.00', '1', '4299.00', '2017-04-13 21:44:36', '2017-04-13 21:44:36'), ('126', '1', '1492091083720', '27', 'Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg', '3299.00', '1', '3299.00', '2017-04-13 21:44:43', '2017-04-13 21:44:43'), ('127', '1', '1492091089794', '26', 'Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机', '241997c4-9e62-4824-b7f0-7425c3c28917.jpeg', '6999.00', '1', '6999.00', '2017-04-13 21:44:49', '2017-04-13 21:44:49'), ('128', '1', '1492091096400', '27', 'Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg', '3299.00', '2', '6598.00', '2017-04-13 21:44:56', '2017-04-13 21:44:56'), ('129', '1', '1492091102371', '27', 'Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg', '3299.00', '1', '3299.00', '2017-04-13 21:45:02', '2017-04-13 21:45:02'), ('130', '1', '1492091110004', '29', 'Haier/海尔HJ100-1HU1 10公斤滚筒洗衣机全自动带烘干家用大容量 洗烘一体', '173335a4-5dce-4afd-9f18-a10623724c4e.jpeg', '4299.00', '2', '8598.00', '2017-04-13 21:45:09', '2017-04-13 21:45:09'), ('131', '1', '1492091141269', '26', 'Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机', '241997c4-9e62-4824-b7f0-7425c3c28917.jpeg', '6999.00', '1', '6999.00', '2017-04-13 21:45:41', '2017-04-13 21:45:41'), ('132', '1', '1492091141269', '27', 'Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg', '3299.00', '1', '3299.00', '2017-04-13 21:45:41', '2017-04-13 21:45:41'), ('133', '1', '1492091141269', '29', 'Haier/海尔HJ100-1HU1 10公斤滚筒洗衣机全自动带烘干家用大容量 洗烘一体', '173335a4-5dce-4afd-9f18-a10623724c4e.jpeg', '4299.00', '2', '8598.00', '2017-04-13 21:45:41', '2017-04-13 21:45:41'), ('134', '1', '1492091141269', '28', '4+64G送手环/Huawei/华为 nova 手机P9/P10plus青春', '0093f5d3-bdb4-4fb0-bec5-5465dfd26363.jpeg', '1999.00', '2', '3998.00', '2017-04-13 21:45:41', '2017-04-13 21:45:41');
COMMIT;
--创建支付订单表
DROP TABLE IF EXISTS `mmall_pay_info`;
CREATE TABLE `mmall_pay_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '用户id',
`order_no` bigint(20) DEFAULT NULL COMMENT '订单号',
`pay_platform` int(10) DEFAULT NULL COMMENT '支付平台:1-支付宝,2-微信',
`platform_number` varchar(200) DEFAULT NULL COMMENT '支付宝支付流水号',
`platform_status` varchar(20) DEFAULT NULL COMMENT '支付宝支付状态',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8;
BEGIN;
INSERT INTO `mmall_pay_info` VALUES ('53', '1', '1492090946105', '1', '2017041321001004300200116250', 'WAIT_BUYER_PAY', '2017-04-13 21:42:33', '2017-04-13 21:42:33'), ('54', '1', '1492090946105', '1', '2017041321001004300200116250', 'TRADE_SUCCESS', '2017-04-13 21:42:41', '2017-04-13 21:42:41'), ('55', '1', '1492091003128', '1', '2017041321001004300200116251', 'WAIT_BUYER_PAY', '2017-04-13 21:43:31', '2017-04-13 21:43:31'), ('56', '1', '1492091003128', '1', '2017041321001004300200116251', 'TRADE_SUCCESS', '2017-04-13 21:43:38', '2017-04-13 21:43:38'), ('57', '1', '1492091141269', '1', '2017041321001004300200116252', 'WAIT_BUYER_PAY', '2017-04-13 21:45:59', '2017-04-13 21:45:59'), ('58', '1', '1492091141269', '1', '2017041321001004300200116252', 'TRADE_SUCCESS', '2017-04-13 21:46:07', '2017-04-13 21:46:07'), ('59', '1', '1492091110004', '1', '2017041321001004300200116396', 'WAIT_BUYER_PAY', '2017-04-13 21:55:08', '2017-04-13 21:55:08'), ('60', '1', '1492091110004', '1', '2017041321001004300200116396', 'TRADE_SUCCESS', '2017-04-13 21:55:17', '2017-04-13 21:55:17');
COMMIT;
--创建商品信息表
DROP TABLE IF EXISTS `mmall_product`;
CREATE TABLE `mmall_product` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '商品id',
`category_id` int(11) NOT NULL COMMENT '分类id,对应mmall_category表的主键',
`name` varchar(100) NOT NULL COMMENT '商品名称',
`subtitle` varchar(200) DEFAULT NULL COMMENT '商品副标题',
`main_image` varchar(500) DEFAULT NULL COMMENT '产品主图,url相对地址',
`sub_images` text COMMENT '图片地址,json格式,扩展用',
`detail` text COMMENT '商品详情',
`price` decimal(20,2) NOT NULL COMMENT '价格,单位-元保留两位小数',
`stock` int(11) NOT NULL COMMENT '库存数量',
`status` int(6) DEFAULT '1' COMMENT '商品状态.1-在售 2-下架 3-删除',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
BEGIN;
INSERT INTO `mmall_product` VALUES ('26', '100002', 'Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机', 'iPhone 7,现更以红色呈现。', '241997c4-9e62-4824-b7f0-7425c3c28917.jpeg', '241997c4-9e62-4824-b7f0-7425c3c28917.jpeg,b6c56eb0-1748-49a9-98dc-bcc4b9788a54.jpeg,92f17532-1527-4563-aa1d-ed01baa0f7b2.jpeg,3adbe4f7-e374-4533-aa79-cc4a98c529bf.jpeg', '









', '6999.00', '9991', '1', null, '2017-04-13 21:45:41'), ('27', '100006', 'Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用', '送品牌烤箱,五一大促', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg', 'ac3e571d-13ce-4fad-89e8-c92c2eccf536.jpeg,4bb02f1c-62d5-48cc-b358-97b05af5740d.jpeg,36bdb49c-72ae-4185-9297-78829b54b566.jpeg', '



', '3299.00', '8876', '1', '2017-04-13 18:51:54', '2017-04-13 21:45:41'), ('28', '100012', '4+64G送手环/Huawei/华为 nova 手机P9/P10plus青春', 'NOVA青春版1999元', '0093f5d3-bdb4-4fb0-bec5-5465dfd26363.jpeg', '0093f5d3-bdb4-4fb0-bec5-5465dfd26363.jpeg,13da2172-4445-4eb5-a13f-c5d4ede8458c.jpeg,58d5d4b7-58d4-4948-81b6-2bae4f79bf02.jpeg', '



', '1999.00', '9994', '1', '2017-04-13 18:57:18', '2017-04-13 21:45:41'), ('29', '100008', 'Haier/海尔HJ100-1HU1 10公斤滚筒洗衣机全自动带烘干家用大容量 洗烘一体', '门店机型 德邦送货', '173335a4-5dce-4afd-9f18-a10623724c4e.jpeg', '173335a4-5dce-4afd-9f18-a10623724c4e.jpeg,42b1b8bc-27c7-4ee1-80ab-753d216a1d49.jpeg,2f1b3de1-1eb1-4c18-8ca2-518934931bec.jpeg', '


', '4299.00', '9993', '1', '2017-04-13 19:07:47', '2017-04-13 21:45:41');
COMMIT;
--创建收货地址表
DROP TABLE IF EXISTS `mmall_shipping`;
CREATE TABLE `mmall_shipping` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '用户id',
`receiver_name` varchar(20) DEFAULT NULL COMMENT '收货姓名',
`receiver_phone` varchar(20) DEFAULT NULL COMMENT '收货固定电话',
`receiver_mobile` varchar(20) DEFAULT NULL COMMENT '收货移动电话',
`receiver_province` varchar(20) DEFAULT NULL COMMENT '省份',
`receiver_city` varchar(20) DEFAULT NULL COMMENT '城市',
`receiver_district` varchar(20) DEFAULT NULL COMMENT '区/县',
`receiver_address` varchar(200) DEFAULT NULL COMMENT '详细地址',
`receiver_zip` varchar(6) DEFAULT NULL COMMENT '邮编',
`create_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8;
BEGIN;
INSERT INTO `mmall_shipping` VALUES ('4', '13', 'geely', '010', '18688888888', '北京', '北京市', '海淀区', '中关村', '100000', '2017-01-22 14:26:25', '2017-01-22 14:26:25'), ('7', '17', 'Rosen', '13800138000', '13800138000', '北京', '北京', null, '中关村', '100000', '2017-03-29 12:11:01', '2017-03-29 12:11:01'), ('29', '1', '吉利', '13800138000', '13800138000', '北京', '北京', '海淀区', '海淀区中关村', '100000', '2017-04-09 18:33:32', '2017-04-09 18:33:32');
COMMIT;
--创建用户表
DROP TABLE IF EXISTS `mmall_user`;
CREATE TABLE `mmall_user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户表id',
`username` varchar(50) NOT NULL COMMENT '用户名',
`password` varchar(50) NOT NULL COMMENT '用户密码,MD5加密',
`email` varchar(50) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
`question` varchar(100) DEFAULT NULL COMMENT '找回密码问题',
`answer` varchar(100) DEFAULT NULL COMMENT '找回密码答案',
`role` int(4) NOT NULL COMMENT '角色0-管理员,1-普通用户',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_time` datetime NOT NULL COMMENT '最后一次更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `user_name_unique` (`username`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
BEGIN;
INSERT INTO `mmall_user` VALUES ('1', 'admin', '427338237BD929443EC5D48E24FD2B1A', 'admin@happymmall.com', '13800138000', '问题', '答案', '1', '2016-11-06 16:56:45', '2017-04-04 19:27:36'), ('13', 'geely', '08E9A6EA287E70E7E3F7C982BF7923AC', 'geely@happymmall.com', '13800138000', '问题', '答案', '0', '2016-11-19 22:19:25', '2016-11-19 22:19:25'), ('17', 'rosen', '095AC193FE2212EEC7A93E8FEFF11902', 'rosen1@happymmall.com', '13800138000', '问题', '答案', '0', '2017-03-17 10:51:33', '2017-04-09 23:13:26'), ('21', 'soonerbetter', 'DE6D76FE7C40D5A1A8F04213F2BEFBEE', 'test06@happymmall.com', '13800138000', '105204', '105204', '0', '2017-04-13 21:26:22', '2017-04-13 21:26:22');
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
```
+ 在建立数据库的,如果按照我这里的数据库脚本建立的话应该是没问题的,但是我按照视频里面的数据库脚本建表的话发生了一个错误

这个报错看起来比较的诡异,我仔细检查`sql`也没有错误,它总提示我`end_time`要有一个默认的值,可我记得我以前就不会这样,然后视频里面也没有执行错误,然后我感觉可能时`MySQL`版本的差异,我查看了下我数据库版本,在登录`Mysql`控制台后输入指令,在控制台的我暂时知道的有两种方式:
```sql
select version();
select @@version;
```
---
#### 这里我们需要修改下`web.xml`中的servlet版本为`3.0`
打开`WEB-INF`下的`web.xml`,修改为以下代码:
```xml
```
修改的原因有以下几点:
* 高版本的Servlet支持更多的特性,更方便我们的Coding,特别是支持注解这一特性
* 在`Servlet2.3`中新加入了`Listener`接口的实现,,我们可以使用`Listener`引入`Spring`的`ContextLoaderListener`
举个栗子:
+ 在`Servlet2.3`以前我们这样配置`ContextLoaderListener`:
```xml
context
org.springframework.context.ContextLoaderServlet
1
```
+ 在`Servlet2.3`以后可以使用`Listener`配置,也就是我们项目中使用的方法
````xml
org.springframework.context.ContextLoaderListener
````
两种方法的效果都是一样的,主要不要同时使用,否则会报错的
#### 建立实体类
- 首先建立数据库所对应的实体类

#### 接下来书写`xml`配置文件
##### 建立对应的`mapper.xml`

```
- 建立`Spring`的配置文件`applicationContext-datasource.xml`
```xml
classpath:datasource.properties
dialect=mysql
```
#### 2017-5-23 13:46:28
---
### (二)Java电商之Service层

### 太多了 太多了 代码里面都有注释
在这里开启了基于**注解**的事物,常见的事物操作有以下几种方法
+ 在Spring早期版本中是使用ProxyFactoryBean+XMl方式来配置事物.
+ 在Spring配置文件使用tx:advice+aop命名空间,好处就是一次配置永久生效,你无须去关心中间出的问题,不过出错了你很难找出来在哪里出了问题
+ 注解@Transactional的方式,注解可以在`方法定义`,`接口定义`,`类定义`,`public方法上`,但是不能注解在`private`,`final`,`static`等方法上,因为Spring的事物管理默认是使用Cglib动态代理的:
- private方法因为访问权限限制,无法被子类覆盖
- final方法无法被子类覆盖
- static时类级别的方法,无法被子类覆盖
- protected方法可以被子类覆盖,因此可以被动态字节码增强
##### 不能被Spring AOP事物增强的方法
| 序号 | 动态代理策略 |不能被事物增强的方法 |
|:-----:| :-----: |:-----:|
| 1 |基于接口的动态代理 |出了public以外的所有方法,并且 public static 的方法也不能被增强 |
| 2 |基于Cglib的动态代理 | private,static,final的方法 |
### (三)Java电商之Web层开发
#### 既然是Web层的会肯定要先引入SpringMvc了
+ 修改`web.xml`,引入`SpringMvc`的`dispatcher-servlet.xml`:
```xml
text/plain;charset=UTF-8
text/html;charset=UTF-8
application/json;charset=UTF-8
```
#### 接下来编写Controller

####- 后台_产品接口 ProductManageController
1.产品list
2.产品搜索
3.图片上传
4.产品详情
5.产品上下架
6.新增OR更新产品
7.富文本上传图片
####- 后台_品类接口 OrderManageController
1.获取品类子节点(平级)
2.增加节点
3.修改品类名字
4.获取当前分类id及递归子节点categoryId
####- 后台_用户接口 UserManageController
1.后台管理员登录
####- 后台_订单接口 CategoryManageController
1.订单List
2.按订单号查询
3.订单详情
4.订单发货
####- 门户_产品接口 ProductController
1.产品搜索及动态排序List
2.产品detail
####- 门户_支付接口 OrderController
1.支付
2.查询订单支付状态
3.支付宝回调
####- 门户_收货地址接口 ShippingController
1.添加地址
2.删除地址
3.登录状态更新地址
4.选中查看具体的地址
5.地址列表
####- 门户_用户接口 UserController
1.登录
2.注册
3.检查用户名是否有效
4.获取登录用户信息
5.忘记密码
6.提交问题答案
7.忘记密码的重设密码
8.登录中状态重置密码
9.登录状态更新个人信息
10.获取当前登录用户的详细信息,并强制登录
11.退出登录
####- 门户_订单接口 OrderController
1.创建订单
2.获取订单的商品信息
3.订单List
4.订单详情detail
5.取消订单
####- 门户_购物车接口 CartController
1.购物车List列表
2.购物车添加商品
3.更新购物车某个产品数量
4.移除购物车某个产品
5.购物车选中某个商品
6.购物车取消选中某个商品
7.查询在购物车里的产品数量
8.购物车全选
9.购物车取消全选
#### 页面的编写
#暂未完成
### (四)Java电商之支付宝的处理
####根据支付宝的官方文档下载支付宝的sdk安装支付宝官方文档的配置,详情产考:
```
沙箱登录:https://openhome.alipay.com/platform/appDaily.htm
沙箱环境使用说明:https://doc.open.alipay.com/doc2/detail.htm?treeId=200&articleId=105311&docType=1
如何使用沙箱环境:https://support.open.alipay.com/support/hotProblemDetail.htm?spm=a219a.7386793.0.0.uS5uZ6&id=251932&tagId=100248
当面付产品介绍:https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.hV5Clx&treeId=193&articleId=105072&docType=1
扫码支付接入指引:https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.Ia6Wqy&treeId=193&articleId=106078&docType=1
当面付快速接入:https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.bROnXf&treeId=193&articleId=105170&docType=1
当面付接入必读:https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.hV5Clx&treeId=193&articleId=105322&docType=1
当面付进阶功能:https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.YFmkxI&treeId=193&articleId=105190&docType=1
当面付异步通知-仅用于扫码支付:https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.BykVSR&treeId=193&articleId=103296&docType=1
当面付SDK&DEMO:https://support.open.alipay.com/docs/doc.htm?spm=a219a.7386797.0.0.k0rwWc&treeId=193&articleId=105201&docType=1
服务端SDK:https://doc.open.alipay.com/doc2/detail?treeId=54&articleId=103419&docType=1
生成RSA密钥:https://doc.open.alipay.com/docs/doc.htm?treeId=291&articleId=105971&docType=1
线上创建应用说明:https://doc.open.alipay.com/doc2/detail.htm?treeId=200&articleId=105310&docType=1#s0
```
与支付宝对接的配置在 (zfbinfo.properties)
## 进行测试 好多好多测试

# - 后台_产品接口
``` json
http://localhost:8080/manage/product/list.do
/manage/product/list.do
request
pageNum(default=1)
pageSize(default=10)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 10,
"size": 2,
"orderBy": null,
"startRow": 1,
"endRow": 2,
"total": 2,
"pages": 1,
"list": [
{
"id": 1,
"categoryId": 3,
"name": "iphone7",
"subtitle": "双十一促销",
"mainImage": "mainimage.jpg",
"status":1,
"price": 7199.22
},
{
"id": 2,
"categoryId": 2,
"name": "oppo R8",
"subtitle": "oppo促销进行中",
"mainImage": "mainimage.jpg",
"status":1,
"price": 2999.11
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 0,
"lastPage": 1,
"isFirstPage": true,
"isLastPage": true,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 8,
"navigatepageNums": [
1
]
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
2.产品搜索
http://localhost:8080/manage/product/search.do?productName=p
http://localhost:8080/manage/product/search.do?productId=1
/manage/product/search.do
request
productName
productId
pageNum(default=1)
pageSize(default=10)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 10,
"size": 1,
"orderBy": null,
"startRow": 1,
"endRow": 1,
"total": 1,
"pages": 1,
"list": [
{
"id": 1,
"categoryId": 3,
"name": "iphone7",
"subtitle": "双十一促销",
"mainImage": "mainimage.jpg",
"price": 7199.22
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 0,
"lastPage": 1,
"isFirstPage": true,
"isLastPage": true,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 8,
"navigatepageNums": [
1
]
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
3.图片上传
/manage/product/upload.do
request
response
success
{
"status": 0,
"data": {
"uri": "e6604558-c0ff-41b9-b6e1-30787a1e3412.jpg",
"url": "http://img.happymmall.com/e6604558-c0ff-41b9-b6e1-30787a1e3412.jpg"
}
}
fail
status!=0的时候
4.产品详情
http://localhost:8080/manage/product/detail.do?productId=2
/manage/product/detail.do
request
productId
response
success
{
"status": 0,
"data": {
"id": 2,
"categoryId": 2,
"parentCategoryId":1,
"name": "oppo R8",
"subtitle": "oppo促销进行中",
"imageHost": "http://img.happymmall.com/",
"mainImage": "mainimage.jpg",
"subImages": "[\"mmall/aa.jpg\",\"mmall/bb.jpg\",\"mmall/cc.jpg\",\"mmall/dd.jpg\",\"mmall/ee.jpg\"]",
"detail": "richtext",
"price": 2999.11,
"stock": 71,
"status": 1,
"createTime": "2016-11-20 14:21:53",
"updateTime": "2016-11-20 14:21:53"
}
}
fail
{
"status": 1,
"msg": "没有权限"
}
5.产品上下架
http://localhost:8080/manage/product/set_sale_status.do?productId=1&status=1
/manage/product/set_sale_status.do
request
productId
status
response
success
{
"status": 0,
"data": "修改产品状态成功"
}
fail
{
"status": 1,
"data": "修改产品状态失败"
}
6.新增OR更新产品
新增
新增 http://localhost:8080/manage/product/save.do?categoryId=1&name=三星洗衣机&subtitle=三星大促销&subImages=test.jpg,11.jpg,2.jpg,3.jpg&detail=detailtext&price=1000&stock=100&status=1
更新 http://localhost:8080/manage/product/save.do?categoryId=1&name=三星洗衣机&subtitle=三星大促销&subImages=test.jpg&detail=detailtext&price=1000&stock=100&status=1&id=3
/manage/product/save.do
request
categoryId=1&name=三星洗衣机&subtitle=三星大促销&mainImage=sss.jpg&subImages=test.jpg&detail=detailtext&price=1000&stock=100&status=1&id=3
response
success
{
"status": 0,
"data": "更新产品成功"
}
或
{
"status": 0,
"data": "新增产品成功"
}
fail
{
"status": 1,
"data": "更新产品失败"
}
7.富文本上传图片
/manage/product/richtext_img_upload.do
request
response
success
{
"file_path": "http://img.happymmall.com/5fb239f2-0007-40c1-b8e6-0dc11b22779c.jpg",
"msg": "上传成功",
"success": true
}
fail
{
"success": false,
"msg": "error message",
"file_path": "[real file path]"
}
```
# - 后台_品类接口
``` json
1.获取品类子节点(平级)
http://localhost:8080/manage/category/get_category.do http://localhost:8080/manage/category/get_category.do?categoryId=0
http://localhost:8080/manage/category/get_category.do?categoryId=2
/manage/category/get_category.do
request
categoryId(default=0)
response
success
{
"status": 0,
"data": [
{
"id": 2,
"parentId": 1,
"name": "手机",
"status": true,
"sortOrder": 3,
"createTime": 1479622913000,
"updateTime": 1479622913000
},
{
"id": 4,
"parentId": 1,
"name": "移动座机",
"status": true,
"sortOrder": 5,
"createTime": 1480059936000,
"updateTime": 1480491941000
}
]
}
http://localhost:8080/manage/category/get_category.do?categoryId=19
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
或
{
"status": 1,
"msg": "未找到该品类"
}
2.增加节点
/manage/category/add_category.do
request
parentId(default=0)
categoryName
response
success
{
"status": 0,
"msg": "添加品类成功"
}
fail
{
"status":1,
"msg": "添加品类失败"
}
3.修改品类名字
http://localhost:8080/manage/category/set_category_name.do?categoryId=999&categoryName=%E5%98%BB%E5%98%BB http://localhost:8080/manage/category/set_category_name.do?categoryId=1&categoryName=%E5%98%BB%E5%98%BB
/manage/category/set_category_name.do
request
categoryId
categoryName
response
success
{
"status": 0,
"msg": "更新品类名字成功"
}
fail
{
"status": 1,
"msg": "更新品类名字失败"
}
4.获取当前分类id及递归子节点categoryId
http://localhost:8080/manage/category/get_deep_category.do?categoryId=100001
/manage/category/get_deep_category.do
request
categoryId
response
success
{
"status": 0,
"data": [
100009,
100010,
100001,
100006,
100007,
100008
]
}
fail
{
"status": 1,
"msg": "无权限"
}
```
- 后台_用户接口
``` json
1.后台管理员登录
/manage/user/login.do
request
String username,
String password
response
success
{
"status": 0,
"data": {
"id": 12,
"username": "aaa",
"email": "aaa@163.com",
"phone": null,
"role": 0,
"createTime": 1479048325000,
"updateTime": 1479048325000
}
}
fail
{
"status": 1,
"msg": "密码错误"
}
2.模板
/REPLACE/.do
request
k
response
success
```
- 后台_订单接口
``` json
1.订单List
http://localhost:8080/manage/order/list.do?pageSize=3
/manage/order/list.do
request
pageSize(default=10)
pageNum(default=1)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 3,
"size": 3,
"orderBy": null,
"startRow": 1,
"endRow": 3,
"total": 16,
"pages": 6,
"list": [
{
"orderNo": 1485158676346,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:36",
"orderItemVoList": [
{
"orderNo": 1485158676346,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:36"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"shippingVo": null
},
{
"orderNo": 1485158675516,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675516,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
},
{
"orderNo": 1485158675316,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675316,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 2,
"lastPage": 6,
"isFirstPage": true,
"isLastPage": false,
"hasPreviousPage": false,
"hasNextPage": true,
"navigatePages": 8,
"navigatepageNums": [
1,
2,
3,
4,
5,
6
]
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
或
{
"status": 1,
"msg": "没有权限"
}
2.按订单号查询
http://localhost:8080/manage/order/search.do?orderNo=1480515829406
/manage/order/search.do
request
orderNo
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 3,
"size": 3,
"orderBy": null,
"startRow": 1,
"endRow": 3,
"total": 16,
"pages": 6,
"list": [
{
"orderNo": 1485158676346,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:36",
"orderItemVoList": [
{
"orderNo": 1485158676346,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:36"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"shippingVo": null
},
{
"orderNo": 1485158675516,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675516,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
},
{
"orderNo": 1485158675316,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675316,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 2,
"lastPage": 6,
"isFirstPage": true,
"isLastPage": false,
"hasPreviousPage": false,
"hasNextPage": true,
"navigatePages": 8,
"navigatepageNums": [
1,
2,
3,
4,
5,
6
]
}
}
fail
{
"status": 1,
"msg": "没有找到订单"
}
3.订单详情
http://localhost:8080/manage/order/detail.do?orderNo=1480515829406
/manage/order/detail.do
request
orderNo
response
success
{
"status": 0,
"data": {
"orderNo": 1480515829406,
"payment": 30000.00,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "",
"sendTime": "",
"endTime": "",
"closeTime": "",
"createTime": "2016-11-30 22:23:49",
"orderItemVoList": [
{
"orderNo": 1480515829406,
"productId": 1,
"productName": "iphone7",
"productImage": "mainimage.jpg",
"currentUnitPrice": 10000.00,
"quantity": 1,
"totalPrice": 10000.00,
"createTime": "2016-11-30 22:23:49"
},
{
"orderNo": 1480515829406,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 20000.00,
"quantity": 1,
"totalPrice": 20000.00,
"createTime": "2016-11-30 22:23:49"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 3,
"receiverName": "geely",
"shippingVo": {
"receiverName": "geely",
"receiverPhone": "0100",
"receiverMobile": "186",
"receiverProvince": "北京",
"receiverCity": "北京",
"receiverDistrict": "昌平区",
"receiverAddress": "矩阵小区",
"receiverZip": "100000"
}
}
}
fail
{
"status": 1,
"msg": "没有找到订单"
}
4.订单发货
http://localhost:8080/manage/order/send_goods.do?orderNo=1480515829406
/manage/order/send_goods.do
request
orderNo
response
success
{
"status": 0,
"data": "发货成功"
}
fail
{
"status": 1,
"msg": "发货失败"
}
```
- 门户_产品接口
``` json
1.产品搜索及动态排序List
/product/list.do
http://localhost:8080/product/list.do?keyword=&categoryId=1&orderBy=price_desc
request
categoryId
keyword
pageNum(default=1)
pageSize(default=10)
orderBy(default=""):排序参数:例如price_desc,price_asc
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 10,
"size": 2,
"orderBy": null,
"startRow": 1,
"endRow": 2,
"total": 2,
"pages": 1,
"list": [
{
"id": 1,
"categoryId": 3,
"name": "iphone7",
"subtitle": "双十一促销",
"mainImage": "mainimage.jpg",
"status":1,
"price": 7199.22
},
{
"id": 2,
"categoryId": 2,
"name": "oppo R8",
"subtitle": "oppo促销进行中",
"mainImage": "mainimage.jpg",
"status":1,
"price": 2999.11
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 0,
"lastPage": 1,
"isFirstPage": true,
"isLastPage": true,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 8,
"navigatepageNums": [
1
]
}
}
fail
{
"status": 1,
"msg": "参数错误"
}
2.产品detail
/product/detail.do
http://localhost:8080/product/detail.do?productId=2
request
productId
response
success
{
"status": 0,
"data": {
"id": 2,
"categoryId": 2,
"name": "oppo R8",
"subtitle": "oppo促销进行中",
"mainImage": "mainimage.jpg",
"subImages": "[\"mmall/aa.jpg\",\"mmall/bb.jpg\",\"mmall/cc.jpg\",\"mmall/dd.jpg\",\"mmall/ee.jpg\"]",
"detail": "richtext",
"price": 2999.11,
"stock": 71,
"status": 1,
"createTime": "2016-11-20 14:21:53",
"updateTime": "2016-11-20 14:21:53"
}
}
fail
{
"status": 1,
"msg": "该商品已下架或删除"
}
模板
/product/.do
request
k
response
success
k
fail
k
```
- 门户_支付接口
``` json
1.支付
/order/pay.do
http://localhost:8080/order/pay.do?orderNo=1485158676346
request
orderNo
response
success
{
"status": 0,
"data": {
"orderNo": "1485158676346",
"qrPath": "http://img.happymmall.com/qr-1492329044075.png"
}
}
fail
{
"status": 1,
"msg": "支付宝生成订单失败"
}
2.查询订单支付状态
/order/query_order_pay_status.do
http://localhost:8080/order/query_order_pay_status.do?orderNo=1485158676346
request
orderNo
response
success
{
"status": 0,
"data": true
}
fail
{
"status": 1,
"msg": "该用户并没有该订单,查询无效"
}
3.支付宝回调
参考支付宝回调文档: https://support.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.mFogPC&treeId=193&articleId=103296&docType=1
/order/alipay_callback.do
request
HttpServletRequest
response
success
success
fail
failed
0.模板
/REPLACE/.do
request
k
response
success
k
fail
k
```
- 门户_收货地址接口
``` json
1.添加地址
/shipping/add.do
http://localhost:8080/shipping/add.do?userId=1&receiverName=geely&receiverPhone=010&receiverMobile=18688888888&receiverProvince=%E5%8C%97%E4%BA%AC&receiverCity=%E5%8C%97%E4%BA%AC%E5%B8%82&receiverAddress=%E4%B8%AD%E5%85%B3%E6%9D%91&receiverZip=100000
request
userId=1
receiverName=geely
receiverPhone=010
receiverMobile=18688888888
receiverProvince=北京
receiverCity=北京市
receiverAddress=中关村
receiverZip=100000
response
success
{
"status": 0,
"msg": "新建地址成功",
"data": {
"shippingId": 28
}
}
fail
{
"status": 1,
"msg": "新建地址失败"
}
2.删除地址
/shipping/del.do
request
shippingId
response
success
{
"status": 0,
"msg": "删除地址成功"
}
fail
{
"status": 1,
"msg": "删除地址失败"
}
3.登录状态更新地址
/shipping/update.do
http://localhost:8080/shipping/update.do?id=5&receiverName=AAA&receiverPhone=010&receiverMobile=18688888888&receiverProvince=%E5%8C%97%E4%BA%AC&receiverCity=%E5%8C%97%E4%BA%AC%E5%B8%82&receiverDistrict=%E6%B5%B7%E6%B7%80%E5%8C%BA&receiverAddress=%E4%B8%AD%E5%85%B3%E6%9D%91&receiverZip=100000
request
id=1
receiverName=geely
receiverPhone=010
receiverMobile=18688888888
receiverProvince=北京
receiverCity=北京市
receiverAddress=中关村
receiverZip=100000
response
success
{
"status": 0,
"msg": "更新地址成功"
}
fail
{
"status": 1,
"msg": "更新地址失败"
}
4.选中查看具体的地址
/shipping/select.do
request
shippingId
response
success
{
"status": 0,
"data": {
"id": 4,
"userId": 13,
"receiverName": "geely",
"receiverPhone": "010",
"receiverMobile": "18688888888",
"receiverProvince": "北京",
"receiverCity": "北京市",
"receiverAddress": "中关村",
"receiverZip": "100000",
"createTime": 1485066385000,
"updateTime": 1485066385000
}
}
fail
{
"status": 1,
"msg": "请登录之后查询"
}
5.地址列表
/shipping/list.do
http://localhost:8080/shipping/list.do
request
pageNum(默认1),pageSize(默认10)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 10,
"size": 2,
"orderBy": null,
"startRow": 1,
"endRow": 2,
"total": 2,
"pages": 1,
"list": [
{
"id": 4,
"userId": 13,
"receiverName": "geely",
"receiverPhone": "010",
"receiverMobile": "18688888888",
"receiverProvince": "北京",
"receiverCity": "北京市",
"receiverAddress": "中关村",
"receiverZip": "100000",
"createTime": 1485066385000,
"updateTime": 1485066385000
},
{
"id": 5,
"userId": 13,
"receiverName": "AAA",
"receiverPhone": "010",
"receiverMobile": "18688888888",
"receiverProvince": "北京",
"receiverCity": "北京市",
"receiverAddress": "中关村",
"receiverZip": "100000",
"createTime": 1485066392000,
"updateTime": 1485075875000
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 0,
"lastPage": 1,
"isFirstPage": true,
"isLastPage": true,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 8,
"navigatepageNums": [
1
]
}
}
fail
{
"status": 1,
"msg": "请登录之后查询"
}
模板
/product/.do
request
k
response
success
k
fail
k
```
- 门户_用户接口
``` json
1.登录
/user/login.do post(代码需要post方式请求),开放get,方便调试
request
username,password
response
fail
{
"status": 1,
"msg": "密码错误"
}
success
{
"status": 0,
"data": {
"id": 12,
"username": "aaa",
"email": "aaa@163.com",
"phone": null,
"role": 0,
"createTime": 1479048325000,
"updateTime": 1479048325000
}
}
2.注册
/user/register.do
request
username,password,email,phone,question,answer
response
success
{
"status": 0,
"msg": "校验成功"
}
fail
{
"status": 1,
"msg": "用户已存在"
}
3.检查用户名是否有效
/user/check_valid.do
/check_valid.do?str=admin&type=username就是检查用户名。
request
str,type
str可以是用户名也可以是email。对应的type是username和email
response
success
{
"status": 0,
"msg": "校验成功"
}
fail
{
"status": 1,
"msg": "用户已存在"
}
4.获取登录用户信息
/user/get_user_info.do
request
无参数
response
success
{
"status": 0,
"data": {
"id": 12,
"username": "aaa",
"email": "aaa@163.com",
"phone": null,
"role": 0,
"createTime": 1479048325000,
"updateTime": 1479048325000
}
}
fail
{
"status": 1,
"msg": "用户未登录,无法获取当前用户信息"
}
5.忘记密码
/user/forget_get_question.do
localhost:8080/user/forget_get_question.do?username=geely
request
username
response
success
{
"status": 0,
"data": "这里是问题"
}
fail
{
"status": 1,
"msg": "该用户未设置找回密码问题"
}
6.提交问题答案
/user/forget_check_answer.do
localhost:8080/user/forget_check_answer.do?username=aaa&question=aa&answer=sss
request
username,question,answer
response
正确的返回值里面有一个token,修改密码的时候需要用这个。传递给下一个接口
success
{
"status": 0,
"data": "531ef4b4-9663-4e6d-9a20-fb56367446a5"
}
fail
{
"status": 1,
"msg": "问题答案错误"
}
7.忘记密码的重设密码
/user/forget_reset_password.do
localhost:8080/user/forget_reset_password.do?username=aaa&passwordNew=xxx&forgetToken=531ef4b4-9663-4e6d-9a20-fb56367446a5
request
username,passwordNew,forgetToken
response
success
{
"status": 0,
"msg": "修改密码成功"
}
fail
{
"status": 1,
"msg": "修改密码操作失效"
}
或
{
"status": 1,
"msg": "token已经失效"
}
8.登录中状态重置密码
/user/reset_password.do
request
passwordOld,passwordNew
response
success
{
"status": 0,
"msg": "修改密码成功"
}
fail
{
"status": 1,
"msg": "旧密码输入错误"
}
9.登录状态更新个人信息
/user/update_information.do
request
email,phone,question,answer
response
success
{
"status": 0,
"msg": "更新个人信息成功"
}
fail
{
"status": 1,
"msg": "用户未登录"
}
10.获取当前登录用户的详细信息,并强制登录
/user/get_information.do
request
无参数
response
success
{
"status": 0,
"data": {
"id": 1,
"username": "admin",
"password": "",
"email": "admin@163.com",
"phone": "13800138000",
"question": "question",
"answer": "answer",
"role": 1,
"createTime": 1478422605000,
"updateTime": 1491305256000
}
}
fail
{
"status": 10,
"msg": "用户未登录,无法获取当前用户信息,status=10,强制登录"
}
11.退出登录
/user/logout.do
request
无
response
success
{
"status": 0,
"msg": "退出成功"
}
fail
{
"status": 1,
"msg": "服务端异常"
}
模板
/user/.do
request
k
response
success
k
fail
k
```
- 门户_订单接口
``` json
1.创建订单
/order/create.do
引用已存在的收货地址id http://localhost:8080/order/create.do?shippingId=5
request
shippingId
response
success
{
"status": 0,
"data": {
"orderNo": 1485158223095,
"payment": 2999.11,
"paymentType": 1,
"postage": 0,
"status": 10,
"paymentTime": null,
"sendTime": null,
"endTime": null,
"closeTime": null,
"createTime": 1485158223095,
"orderItemVoList": [
{
"orderNo": 1485158223095,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": null
}
],
"shippingId": 5,
"shippingVo": null
}
}
fail
{
"status": 1,
"msg": "创建订单失败"
}
2.获取订单的商品信息
/order/get_order_cart_product.do
http://localhost:8080/order/get_order_cart_product.do
request
无
response
success
{
"status": 0,
"data": {
"orderItemVoList": [
{
"orderNo": null,
"productId": 1,
"productName": "iphone7",
"productImage": "mmall/aa.jpg",
"currentUnitPrice": 7999,
"quantity": 10,
"totalPrice": 79990,
"createTime": ""
}
],
"imageHost": "http://img.happymmall.com/",
"productTotalPrice": 79990
}
}
fail
{
"status": 1,
"msg": "用户未登录"
}
3.订单List
http://localhost:8080/order/list.do?pageSize=3
/order/list.do
request
pageSize(default=10)
pageNum(default=1)
response
success
{
"status": 0,
"data": {
"pageNum": 1,
"pageSize": 3,
"size": 3,
"orderBy": null,
"startRow": 1,
"endRow": 3,
"total": 16,
"pages": 6,
"list": [
{
"orderNo": 1485158676346,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:36",
"orderItemVoList": [
{
"orderNo": 1485158676346,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:36"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
},
{
"orderNo": 1485158675516,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675516,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
},
{
"orderNo": 1485158675316,
"payment": 2999.11,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "2017-02-11 12:27:18",
"sendTime": "2017-02-11 12:27:18",
"endTime": "2017-02-11 12:27:18",
"closeTime": "2017-02-11 12:27:18",
"createTime": "2017-01-23 16:04:35",
"orderItemVoList": [
{
"orderNo": 1485158675316,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 2999.11,
"quantity": 1,
"totalPrice": 2999.11,
"createTime": "2017-01-23 16:04:35"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 5,
"receiverName": "geely",
"shippingVo": null
}
],
"firstPage": 1,
"prePage": 0,
"nextPage": 2,
"lastPage": 6,
"isFirstPage": true,
"isLastPage": false,
"hasPreviousPage": false,
"hasNextPage": true,
"navigatePages": 8,
"navigatepageNums": [
1,
2,
3,
4,
5,
6
]
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
或
{
"status": 1,
"msg": "没有权限"
}
4.订单详情detail
http://localhost:8080/order/detail.do?orderNo=1480515829406
/order/detail.do
request
orderNo
response
success
{
"status": 0,
"data": {
"orderNo": 1480515829406,
"payment": 30000.00,
"paymentType": 1,
"paymentTypeDesc": "在线支付",
"postage": 0,
"status": 10,
"statusDesc": "未支付",
"paymentTime": "",
"sendTime": "",
"endTime": "",
"closeTime": "",
"createTime": "2016-11-30 22:23:49",
"orderItemVoList": [
{
"orderNo": 1480515829406,
"productId": 1,
"productName": "iphone7",
"productImage": "mainimage.jpg",
"currentUnitPrice": 10000.00,
"quantity": 1,
"totalPrice": 10000.00,
"createTime": "2016-11-30 22:23:49"
},
{
"orderNo": 1480515829406,
"productId": 2,
"productName": "oppo R8",
"productImage": "mainimage.jpg",
"currentUnitPrice": 20000.00,
"quantity": 1,
"totalPrice": 20000.00,
"createTime": "2016-11-30 22:23:49"
}
],
"imageHost": "http://img.happymmall.com/",
"shippingId": 3,
"receiverName": "geely",
"shippingVo": {
"receiverName": "geely",
"receiverPhone": "0100",
"receiverMobile": "186",
"receiverProvince": "北京",
"receiverCity": "北京",
"receiverDistrict": "昌平区",
"receiverAddress": "矩阵小区",
"receiverZip": "100000"
}
}
}
fail
{
"status": 1,
"msg": "没有找到订单"
}
5.取消订单
http://localhost:8080/order/cancel.do?orderNo=1480515829406
/order/cancel.do
request
orderNo
response
success
{
"status": 0
}
fail
{
"status": 1,
"msg": "该用户没有此订单"
}
或
{
"status": 1,
"msg": "此订单已付款,无法被取消"
}
5.模板
/REPLACE/.do
request
k
response
success
k
fail
k
```
- 门户_购物车接口
``` json
1.购物车List列表
/cart/list.do
http://localhost:8080/cart/list.do
注意点:
需要先登录,所有的密码都是123
NEED_LOGIN(10, "NEED_LOGIN"),//需要登录的错误编码
价格的单位是元,保留小数后2位
request
无参数,需要登录状态
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 1,
"userId": 13,
"productId": 1,
"quantity": 1,
"productName": "iphone7",
"productSubtitle": "双十一促销",
"productMainImage": "mainimage.jpg",
"productPrice": 7199.22,
"productStatus": 1,
"productTotalPrice": 7199.22,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
},
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促销进行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 10198.33
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
2.购物车添加商品
/cart/add.do
http://localhost:8080/cart/add.do?productId=1&count=10
请注意这个字段,超过数量会返回这样的标识"limitQuantity"
失败的:LIMIT_NUM_FAIL 成功的:LIMIT_NUM_SUCCESS
request
productId,count
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 1,
"userId": 13,
"productId": 1,
"quantity": 12,
"productName": "iphone7",
"productSubtitle": "双十一促销",
"productMainImage": "mainimage.jpg",
"productPrice": 7199.22,
"productStatus": 1,
"productTotalPrice": 86390.64,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
},
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促销进行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 89389.75
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
3.更新购物车某个产品数量
/cart/update.do
http://localhost:8080/cart/update.do?productId=1&count=2
request
productId,count
response
响应同2
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 1,
"userId": 13,
"productId": 1,
"quantity": 12,
"productName": "iphone7",
"productSubtitle": "双十一促销",
"productMainImage": "mainimage.jpg",
"productPrice": 7199.22,
"productStatus": 1,
"productTotalPrice": 86390.64,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
},
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促销进行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 89389.75
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
4.移除购物车某个产品
/cart/delete_product.do
http://localhost:8080/cart/delete_product.do?productIds=1,3
request
productIds
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促销进行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 2999.11
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
5.购物车选中某个商品
/cart/select.do
http://localhost:8080/cart/select.do?productId=1
request
productId
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促销进行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 1,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 2999.11
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
6.购物车取消选中某个商品
/cart/un_select.do
http://localhost:8080/cart/un_select.do?productId=2
注意返回值中的cartTotalPrice,如果反选之后总价的变化
request
productId
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促销进行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 0,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 0
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
7.查询在购物车里的产品数量
/cart/get_cart_product_count.do
http://localhost:8080/cart/get_cart_product_count.do
未登录返回0
request
无
response
success
{
"status": 0,
"data": 0
}
fail
{
"status": 10,
"msg": "出现异常"
}
8.购物车全选
/cart/select_all.do
http://localhost:8080/cart/select_all.do
注意返回值中的cartTotalPrice的变化
request
无
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促销进行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 0,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 2999.11
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
9.购物车取消全选
/cart/un_select_all.do
http://localhost:8080/cart/un_select_all.do
注意返回值中的cartTotalPrice总价的变化
request
无
response
success
{
"status": 0,
"data": {
"cartProductVoList": [
{
"id": 2,
"userId": 13,
"productId": 2,
"quantity": 1,
"productName": "oppo R8",
"productSubtitle": "oppo促销进行中",
"productMainImage": "mainimage.jpg",
"productPrice": 2999.11,
"productStatus": 1,
"productTotalPrice": 2999.11,
"productStock": 86,
"productChecked": 0,
"limitQuantity": "LIMIT_NUM_SUCCESS"
}
],
"allChecked": true,
"cartTotalPrice": 0
}
}
fail
{
"status": 10,
"msg": "用户未登录,请登录"
}
```