├── .gitignore ├── README.md ├── pom.xml ├── src └── main │ ├── Java │ └── com │ │ ├── alipay │ │ └── demo │ │ │ └── trade │ │ │ ├── DemoHbRunner.java │ │ │ └── Main.java │ │ └── mall │ │ ├── common │ │ ├── Const.java │ │ ├── ResponseCode.java │ │ ├── ServerResponse.java │ │ └── TokenCache.java │ │ ├── controller │ │ ├── backend │ │ │ ├── CategoryManageController.java │ │ │ ├── OrderManageController.java │ │ │ ├── ProductManageController.java │ │ │ └── UserManageController.java │ │ └── portal │ │ │ ├── CartController.java │ │ │ ├── OrderController.java │ │ │ ├── ProductController.java │ │ │ ├── ShippingController.java │ │ │ └── UserController.java │ │ ├── dao │ │ ├── CartMapper.java │ │ ├── CategoryMapper.java │ │ ├── OrderItemMapper.java │ │ ├── OrderMapper.java │ │ ├── PayInfoMapper.java │ │ ├── ProductMapper.java │ │ ├── ShippingMapper.java │ │ └── UserMapper.java │ │ ├── pojo │ │ ├── Cart.java │ │ ├── Category.java │ │ ├── Order.java │ │ ├── OrderItem.java │ │ ├── PayInfo.java │ │ ├── Product.java │ │ ├── Shipping.java │ │ └── User.java │ │ ├── service │ │ ├── ICartService.java │ │ ├── ICategoryService.java │ │ ├── IFileService.java │ │ ├── IOrderService.java │ │ ├── IProductService.java │ │ ├── IShippingService.java │ │ ├── IUserService.java │ │ └── impl │ │ │ ├── CartServiceImpl.java │ │ │ ├── CategoryServiceImpl.java │ │ │ ├── FileServiceImpl.java │ │ │ ├── OrderServiceImpl.java │ │ │ ├── ProductServiceImpl.java │ │ │ ├── ShippingServiceImpl.java │ │ │ └── UserServiceImpl.java │ │ ├── util │ │ ├── BigDecimalUtil.java │ │ ├── DateTimeUtil.java │ │ ├── FTPUtil.java │ │ ├── MD5Util.java │ │ └── PropertiesUtil.java │ │ └── vo │ │ ├── CartProductVo.java │ │ ├── CartVo.java │ │ ├── OrderItemVo.java │ │ ├── OrderProductVo.java │ │ ├── OrderVo.java │ │ ├── ProductDetailVo.java │ │ ├── ProductListVo.java │ │ └── ShippingVo.java │ ├── resources │ ├── applicationContext-datasource.xml │ ├── applicationContext.xml │ ├── datasource.properties │ ├── generatorConfig.xml │ ├── logback.xml │ ├── mappers │ │ ├── CartMapper.xml │ │ ├── CategoryMapper.xml │ │ ├── OrderItemMapper.xml │ │ ├── OrderMapper.xml │ │ ├── PayInfoMapper.xml │ │ ├── ProductMapper.xml │ │ ├── ShippingMapper.xml │ │ └── UserMapper.xml │ ├── mmall.properties │ └── zfbinfo.properties │ └── webapp │ ├── WEB-INF │ ├── dispatcher-servlet.xml │ ├── lib │ │ ├── alipay-sdk-java20161213173952-source.jar │ │ ├── alipay-sdk-java20161213173952.jar │ │ ├── alipay-trade-sdk-20161215-source.jar │ │ └── alipay-trade-sdk-20161215.jar │ └── web.xml │ └── index.jsp └── 二维码.jpg /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | #package file 4 | 5 | *.war 6 | *.ear 7 | 8 | #kdiff3 ignore 9 | *.orig 10 | 11 | #maven ignore 12 | target/ 13 | 14 | #eclipse ignore 15 | target/ 16 | 17 | #eclipse ignore 18 | 19 | .settings/ 20 | .project 21 | .classpatch 22 | 23 | #idea 24 | 25 | .idea/ 26 | /idea/ 27 | *.ipr 28 | *.iml 29 | *.iws 30 | 31 | #temp file 32 | 33 | *.log 34 | *.cache 35 | *.diff 36 | *.patch 37 | *.tmp 38 | 39 | #system ignore 40 | .DS_Store 41 | Thumbs.db 42 | 43 | 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Wmall电商网站 (Wmall 后台接口实现) 2 | [![](https://img.shields.io/badge/JDK-1.8-brightgreen.svg)]() 3 | [![](https://img.shields.io/hexpm/l/plug.svg)]() 4 | [![](https://img.shields.io/badge/maven-v4.0.0-blue.svg)](http://maven.apache.org/) 5 | [![](https://img.shields.io/badge/mybatis-v3.4.1-lightgrey.svg)](http://www.mybatis.org) 6 | [![](https://img.shields.io/badge/springframework-v4.0.0-orange.svg)](http://spring.io/projects) 7 | [![](https://img.shields.io/badge/developer-WAng91An-red.svg)](https://github.com/WAng91An) 8 | #### 此项目利用SSM框架,使用了一下技术 9 | 1. nginx 负载均衡,图片上传图片服务器 10 | 2. mybatis分页插件使用 11 | 3. 支付宝真实对接 12 | 4. ftp服务器连接 13 | 5. 使用mybatis插件进行自动生成dao pojo层 14 | 15 | 16 | ### 商品接口(前台)(product) 17 | #### 根据关键字获取商品(关键字,分类id,第几页,页面大小,排序方式)(list.do) 18 | 1. 判断关键字和分类id为不为空 19 | 2. 数据库有没有此分类信息 20 | 3. 如果此分类存不在并且关键字为空,返回空的结果集 21 | 4. 分类存在,递归得到此分类和它所有子分类的集合 22 | 5. 初始化分页 23 | 6. 判断是增序还是降序 24 | 7. 服用sql语句,根据分类id或者关键字模糊查询,返回结果集 25 | 8. 把结果整合成ProductListVo对象 26 | 9. 返回分页后的集合 27 | 28 | #### 获取商品详情 (detail.do) 29 | 1. 传入的产品id合法不合法 30 | 2. 根据id查询相应的产品 31 | 3. 把产品整合成详情vo对象,带ImageHost,格式化后时间 32 | 4. 返回此对象 33 | 34 | ### 商品接口(后台)(manage/product/) 35 | #### 添加或者更新产品 (save.do) 36 | 37 | 1. 判断是不是管理员 38 | 2. 如果是调用增加或者更新商品接口 39 | 3. 增加或者更新商品接口 40 | 4. 设置产品的主图 41 | 5. 更新产品传入的有商品的id 42 | 6. 有id更新产品 43 | 7. 无id新增产品 44 | #### 更新销售状态 (set_sale_status.do) 45 | 46 | 1. 参数(商品id,需要更改的状态) 47 | 2. 判断参数合法性 48 | 3. 修改产品销售状态 49 | #### 获取商品详细信息 (detail.do) 50 | 51 | 1. 判断权限 52 | 2. 判断有没有此产品 53 | 3. 组装productDetailVo对象 54 | 4. 返回 55 | #### 后台查询分页商品list (list.do) 56 | 57 | 1. 判断权限 58 | 2. startPage-start 59 | 3. 查询所有的商品 60 | 4. 分页收尾 61 | #### 根据关键字还是id进行查询 (search.do) 62 | 63 | 1. 判断权限 64 | 2. startPage-start 65 | 3. 复用sql语句,查询商品id,或者名字查询所有的商品 66 | 4. 分页收尾 67 | 68 | #### 上传到upload然后放到ftp服务器 (upload.do) 69 | 70 | 1. 判断权限 71 | 2. 获取upload文件夹路径 72 | 3. 传入文件和路径开始上传 73 | 4. 获取上传文件的原始名,扩展名,设置一个唯一的文件上传名 74 | 5. 判断upload是否存在,不存在创建 75 | 6. 文件上传 76 | 7. 把目标文件上传到FTP服务器 77 | 8. 删除upload文件下的文件 78 | 9. 把上传后的文件返回 79 | 80 | #### 富文本上传 (richtext_img_upload.do) 81 | 82 | 1. 管理员登陆 83 | 2. 富文本中对于返回值有自己的要求,我们使用的是simditor所以按照simditor的要求进行返回 84 | 3. 传入文件和路径开始上传 85 | 4. 获取上传文件的原始名,扩展名,设置一个唯一的文件上传名 86 | 5. 判断upload是否存在,不存在创建 87 | 6. 文件上传 88 | 7. 把目标文件上传到FTP服务器 89 | 8. 删除upload文件下的文件 90 | 9. 把上传后的文件名返回 91 | 92 | ### 购物车接口(前台)(cart) 93 | 【注】:每次操作都会重新发挥一个 cartVo对象.即list.do 94 | #### 查询购物车(list.do) 95 | 96 | 1. 判断登陆情况 97 | 2. 根据userId查询此用户的购物车 98 | 3. 组合成cartVo,此vo包含 商品的vo对象,购物车的总价,是不是全部勾选了,图片发武器地址 99 | 4. 组合商品的vo对象,这时候应该对每个商品进行判断库存情况 100 | 5. 物品真实库存大于于购物车中的购买量充足商品的vo对象的limit属性success 101 | 6. 物品真实库存大于于购物车中的购买量充足商品的vo对象的limit属性fail 102 | 7. 库存中没那么多,必须连接数据库更新购物车中的库存 103 | 8. 判断够没够选,来计算最后的总价 104 | 9. 返回cartVo对象 105 | 106 | #### 添加到购物车(add.do) 107 | 108 | 1. 判断登陆情况 109 | 2. 传进来的productId和count合法性 110 | 3. 购物车有没有这个物品 111 | 4. 有物品count相加,没物品插入数据 112 | 5. 返回此用户的cartvo对象 113 | 114 | #### 更新购物车(update.do) 115 | 116 | 1. 判断登陆情况 117 | 2. 传进来的productId和count合法性 118 | 3. 根据userId,productId查询此购物记录 119 | 4. 此cart对象count重新赋值 120 | 5. 更新数据库信息 121 | 6. 返回更新后的cartVo对象 122 | 123 | #### 删除购物车物品 (delete_product.do) 124 | 【注】:允许多物品删除,用逗号分隔开 125 | 1. 判断登陆情况 126 | 2. 把字符串用逗号分开,添加到集合中 127 | 3. 把需要删除物品的集合用sql集中删除 128 | 4. sql怎么写:利用foreach遍历物品id的列表进行删除 129 | 130 | #### 购物车全选,全不选 131 | #### 单个商品选择,取消选择复用的一个方法 132 | 133 | 1. 判断登陆情况 134 | 2. 根据productId传没传进来,进行指定物品选中,还是全选 135 | 3. 重新获取cartVO对象返回 136 | 137 | #### 当前用户的购物车里面的产品数量(get_cart_product_count.do) 138 | 139 | 1. select IFNULL(sum(quantity),0) as count from mmall_cart where user_id = #{userId} 140 | 141 | ### 地址接口(前台)(shipping) 142 | 143 | #### 添加地址(add.do) 144 | 145 | 1. 判断用户 146 | 2. insert 147 | 148 | #### 删除地址(del.do) 149 | 150 | 1. 判断登陆 151 | 2. 传入shippingId 152 | 3. 删除语句 153 | 154 | #### 更新地址(update.do) 155 | 156 | 1. 判断登陆 157 | 2. 更新 where id and userid 158 | 159 | #### 根据地址id,查询地址的详细信息(select.do) 160 | 161 | 1. 判断登陆 162 | 2. 查询 163 | 164 | #### 获取用户的所有地址(list.do) 165 | 166 | 1. 判断登陆 167 | 2. 查询 168 | 3. 分页 169 | 170 | 171 | ### 订单接口(order) 172 | 173 | #### 创建订单 (create.do) 174 | ``` 175 | { 176 | "status": 0, 177 | "data": { 178 | "orderNo": 1485158223095, 179 | "payment": 2999.11, 180 | "paymentType": 1, 181 | "postage": 0, 182 | "status": 10, 183 | "paymentTime": null, 184 | "sendTime": null, 185 | "endTime": null, 186 | "closeTime": null, 187 | "createTime": 1485158223095, 188 | "orderItemVoList": [ 189 | { 190 | "orderNo": 1485158223095, 191 | "productId": 2, 192 | "productName": "oppo R8", 193 | "productImage": "mainimage.jpg", 194 | "currentUnitPrice": 2999.11, 195 | "quantity": 1, 196 | "totalPrice": 2999.11, 197 | "createTime": null 198 | } 199 | ], 200 | "shippingId": 5, 201 | "shippingVo": null 202 | } 203 | } 204 | ``` 205 | 206 | 1. 判断用户登陆状态 207 | 2. 传入shippingId,userId 208 | 3. 获取此用户的购物车所有商品信息 209 | 4. 把购物车里面的商品组装成一个orderItemVoList 210 | - 遍历所有购物车中信息 211 | - 根据购物车中商品的id进行查询此产品的product表 212 | - 校验此商品是不是销售状态 213 | - 校验此商品的库存是不是满足下单的数量 214 | - 符合条件生成orderItemVoList 215 | 5. 遍历orderItemVoList购物车每条购物记录算出总价 216 | 6. 生成订单(userId,shippingId,payment) 217 | - 生成随机的订单号 218 | - 订单的状态(初始未支付) 219 | - 支付方式 220 | - shippingId 221 | - 数据库插入此订单信息 222 | 7. 遍历刚刚获取的orderItemVoList,为里面每一个购物记录增加订单号 223 | 8. 批量插入,orderItemVoList购物中的每一个物品都得写入orderItem数据表之中 224 | 9. 购物中的每一个物品减少库存 225 | 10. 清空购物车 226 | 11. 把生成的订单和orderItemVoList,整合后发给前端 227 | 228 | #### 取消订单(cancel.do) 229 | 230 | 1. 判断登陆状态 231 | 2. 传入userId,订单号 232 | 3. 如果是已付款无法取消订单 233 | 4. 把订单的status 设置成取消 234 | 5. 更新订单 235 | 236 | #### 获取已经选中的购物车订单信息(get_order_cart_product.do) 237 | ``` 238 | { 239 | "status": 0, 240 | "data": { 241 | "orderItemVoList": [ 242 | { 243 | "orderNo": null, 244 | "productId": 1, 245 | "productName": "iphone7", 246 | "productImage": "mmall/aa.jpg", 247 | "currentUnitPrice": 7999, 248 | "quantity": 10, 249 | "totalPrice": 79990, 250 | "createTime": "" 251 | } 252 | ], 253 | "imageHost": "http://image.qian.com/", 254 | "productTotalPrice": 79990 255 | } 256 | } 257 | ``` 258 | 259 | 1. 获取购物车list 260 | 2. 组合orderItemVoList对象 261 | 3. 添加总价钱,图片服务器地址等属性 262 | 4. 返回 263 | 264 | #### 查看订单详情(detail.do) 265 | 266 | 1. 根据订单号或者此订单在order,orderItem表中的信息 267 | 2. order,orderItem表中的信息进行整合成orderVo 268 | - order里面取订单号,总价,支付类型,支付状态 269 | - 根据order里面的ShippingId取收件人地址和信息 270 | - orderItem获取订单物品的详细信息 271 | 3. 合成orderVo的展示对象返回给前端 272 | 273 | #### 查看订单列表(list.do) 274 | ``` 275 | { 276 | "status": 0, 277 | "data": { 278 | "pageNum": 1, 279 | "pageSize": 3, 280 | "size": 3, 281 | "orderBy": null, 282 | "startRow": 1, 283 | "endRow": 3, 284 | "total": 16, 285 | "pages": 6, 286 | "list": [ 287 | { 288 | "orderNo": 1485158676346, 289 | "payment": 2999.11, 290 | "paymentType": 1, 291 | "paymentTypeDesc": "在线支付", 292 | "postage": 0, 293 | "status": 10, 294 | "statusDesc": "未支付", 295 | "paymentTime": "2017-02-11 12:27:18", 296 | "sendTime": "2017-02-11 12:27:18", 297 | "endTime": "2017-02-11 12:27:18", 298 | "closeTime": "2017-02-11 12:27:18", 299 | "createTime": "2017-01-23 16:04:36", 300 | "orderItemVoList": [ 301 | { 302 | "orderNo": 1485158676346, 303 | "productId": 2, 304 | "productName": "oppo R8", 305 | "productImage": "mainimage.jpg", 306 | "currentUnitPrice": 2999.11, 307 | "quantity": 1, 308 | "totalPrice": 2999.11, 309 | "createTime": "2017-01-23 16:04:36" 310 | } 311 | ], 312 | "imageHost": "http://img.happymmall.com/", 313 | "shippingId": 5, 314 | "receiverName": "geely", 315 | "shippingVo": null 316 | } 317 | ], 318 | "firstPage": 1, 319 | "prePage": 0, 320 | "nextPage": 2, 321 | "lastPage": 6, 322 | "isFirstPage": true, 323 | "isLastPage": false, 324 | "hasPreviousPage": false, 325 | "hasNextPage": true, 326 | "navigatePages": 8, 327 | "navigatepageNums": [ 328 | 1, 329 | 2, 330 | 3, 331 | 4, 332 | 5, 333 | 6 334 | ] 335 | } 336 | } 337 | ``` 338 | 1. order表查数据 339 | 2. 整合成orderVo对象 340 | - 遍历每一个order 341 | - order中的订单号,查询符合此订单号中每个物品 342 | - 利用此订单号中每个物品,和order中部分信息整合成orderVo 343 | - 遍历的每一个order整合后的orderVo加入到orderVoList 344 | 3. 把orderVoList返回 345 | 346 | #### 订单号,生成二维码(pay.do) 347 | 348 | 1. 获取二维码上传的路径 349 | 2. 传入订单号,路径,userId 350 | 3. 下单 351 | - 支付宝demo 352 |   - 下单,上传二维码到服务器 353 | #### 项目资源 354 | 获取更多项目资源请关注公众号:Web项目聚集地 355 | 356 | ![](https://github.com/WAng91An/Wmall/blob/master/二维码.jpg) 357 | -------------------------------------------------------------------------------- /src/main/Java/com/alipay/demo/trade/DemoHbRunner.java: -------------------------------------------------------------------------------- 1 | package com.alipay.demo.trade; 2 | 3 | import com.alipay.demo.trade.model.builder.AlipayHeartbeatSynRequestBuilder; 4 | import com.alipay.demo.trade.model.hb.*; 5 | import com.alipay.demo.trade.service.AlipayMonitorService; 6 | import com.alipay.demo.trade.service.impl.hb.AbsHbRunner; 7 | import com.alipay.demo.trade.service.impl.hb.HbQueue; 8 | import com.alipay.demo.trade.utils.Utils; 9 | 10 | import java.util.ArrayList; 11 | import java.util.Date; 12 | import java.util.List; 13 | 14 | /** 15 | * Created by liuyangkly on 15/10/23. 16 | 执行调度,主要任务由两个线程完成,交易线程(调用当面付2.0接口)和交易保障线程(轮询),具体需要做的事情 17 | 1.当面付程序每执行完一笔交易后将交易结果保存在临时队列 18 | 2.轮询线程读取临时队列,获取基础采集信息和最多30条trade_info信息,调用支付宝monitor.heartbeat.syn接口 19 | 示例代码仅封装了如何调用该接口api,采集数据,比如采集网络信息、交易耗时、异常信息等,需要系统商开发者自行完成。 20 | */ 21 | public class DemoHbRunner extends AbsHbRunner { 22 | 23 | public DemoHbRunner(AlipayMonitorService monitorService) { 24 | super(monitorService); 25 | } 26 | 27 | @Override 28 | public String getAppAuthToken() { 29 | // 对于系统商,如果是为了商户开发监控保障接口,则需要传此值,否则如果为系统商自己做交易保障接口开发,则可不传。 30 | return null; 31 | } 32 | 33 | @Override 34 | public AlipayHeartbeatSynRequestBuilder getBuilder() { 35 | // 系统商使用的交易信息格式,json字符串类型,从交易队列中获取 36 | List sysTradeInfoList = HbQueue.poll(); 37 | 38 | // 异常信息的采集,系统商自行完成 39 | List exceptionInfoList = new ArrayList(); 40 | // exceptionInfoList.add(ExceptionInfo.HE_SCANER); 41 | // exceptionInfoList.add(ExceptionInfo.HE_PRINTER); 42 | // exceptionInfoList.add(ExceptionInfo.HE_OTHER); 43 | 44 | AlipayHeartbeatSynRequestBuilder builder = new AlipayHeartbeatSynRequestBuilder() 45 | .setProduct(Product.FP).setType(Type.CR).setEquipmentId("cr1000001") 46 | .setEquipmentStatus(EquipStatus.NORMAL).setTime(Utils.toDate(new Date())) 47 | .setStoreId("store10001").setMac("0a:00:27:00:00:00").setNetworkType("LAN") 48 | .setProviderId("2088911212323549") // 设置系统商pid 49 | .setSysTradeInfoList(sysTradeInfoList) // 系统商同步trade_info信息 50 | .setExceptionInfoList(exceptionInfoList) // 填写异常信息,如果有的话 51 | ; 52 | return builder; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/common/Const.java: -------------------------------------------------------------------------------- 1 | package com.mall.common; 2 | 3 | import com.google.common.collect.Sets; 4 | 5 | import java.util.Set; 6 | 7 | /** 8 | * Created by 王乾 on 2017/12/11. 9 | */ 10 | public class Const { 11 | 12 | public static final String CURRENT_USER = "currentUser"; 13 | public static final String EMAIL = "email"; 14 | public static final String USERNAME = "username"; 15 | 16 | public interface ProductListOrderBy{ 17 | Set PRICE_ASC_DESC = Sets.newHashSet("price_desc","price_asc"); 18 | } 19 | 20 | public interface Cart{ 21 | int CHECKED = 1;//购物车为选中状态 22 | int UN_CHECKED = 0; //未选中状态 23 | String LIMIT_NUM_FAIL = "LIMIT_NUM_FAIL";//限制失败 24 | String LIMIT_NUM_SUCCESS = "LIMIT_NUM_SUCCESS";//限制成功 25 | } 26 | 27 | public interface Role{ 28 | int ROLE_CUSTOMER = 0;//普通用户 29 | int ROLE_ADMIN = 1;//管理员 30 | } 31 | 32 | public enum ProductStatusEnum{ 33 | ON_SALE(1,"在线"); 34 | private String value; 35 | private int code; 36 | ProductStatusEnum(int code,String value){ 37 | this.code = code; 38 | this.value = value; 39 | } 40 | 41 | public String getValue() { 42 | return value; 43 | } 44 | 45 | public int getCode() { 46 | return code; 47 | } 48 | } 49 | 50 | public enum OrderStatusEnum{ 51 | CANCELED(0,"已取消"), 52 | NO_PAY(10,"未支付"), 53 | PAID(20,"已付款"), 54 | SHIPPED(40,"已发货"), 55 | ORDER_SUCCESS(50,"订单完成"), 56 | ORDER_CLOSE(60,"订单关闭"); 57 | 58 | OrderStatusEnum (int code,String value){ 59 | this.code = code; 60 | this.value = value; 61 | } 62 | private String value; 63 | private int code; 64 | 65 | public String getValue() { 66 | return value; 67 | } 68 | 69 | public int getCode() { 70 | return code; 71 | } 72 | 73 | public static OrderStatusEnum codeOf(int code){ 74 | for(OrderStatusEnum orderStatusEnum : values()){ 75 | if(orderStatusEnum.getCode() == code){ 76 | return orderStatusEnum; 77 | } 78 | } 79 | throw new RuntimeException("没有找到相应的枚举"); 80 | } 81 | 82 | } 83 | 84 | public interface AlipayCallback{ 85 | String TRADE_STATUS_WAIT_BUYER_PAY = "WAIT_BUYER_PAY"; 86 | String TRADE_STATUS_TRADE_SUCCESS = "TRADE_SUCCESS"; 87 | 88 | String RESPONSE_SUCCESS = "success"; 89 | String RESPONSE_FAILED = "failed"; 90 | } 91 | 92 | public enum PayPlatformEnum{ 93 | ALIPAY(0,"支付宝"); 94 | private String value; 95 | private int code; 96 | PayPlatformEnum(int code,String value){ 97 | this.code = code; 98 | this.value = value; 99 | } 100 | 101 | public String getValue() { 102 | return value; 103 | } 104 | 105 | public int getCode() { 106 | return code; 107 | } 108 | } 109 | 110 | public enum PaymentTypeEnum{ 111 | ONLINE_PAY(1,"在线支付"); 112 | private String value; 113 | private int code; 114 | PaymentTypeEnum(int code,String value){ 115 | this.code = code; 116 | this.value = value; 117 | } 118 | 119 | public String getValue() { 120 | return value; 121 | } 122 | 123 | public int getCode() { 124 | return code; 125 | } 126 | 127 | public static PaymentTypeEnum codeOf(int code){ 128 | for(PaymentTypeEnum paymentTypeEnum : values()){ 129 | if(paymentTypeEnum.getCode() == code){ 130 | return paymentTypeEnum; 131 | } 132 | } 133 | throw new RuntimeException("没有找到相应的枚举"); 134 | } 135 | 136 | } 137 | 138 | 139 | 140 | } 141 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/common/ResponseCode.java: -------------------------------------------------------------------------------- 1 | package com.mall.common; 2 | 3 | /** 4 | * Created by 王乾 on 2017/12/11. 5 | */ 6 | public enum ResponseCode { 7 | 8 | SUCCESS(0,"SUCCESS"), 9 | ERROR(1,"ERROR"), 10 | NEED_LOGIN(10,"NEED_LOGIN"), 11 | ILLEGAL_ARGUMENT(2,"ILLEGAL_ARGUMENT"); 12 | 13 | private final int code; 14 | private final String desc; 15 | 16 | ResponseCode(int code,String desc){ 17 | this.code = code; 18 | this.desc = desc; 19 | } 20 | 21 | public int getCode(){ 22 | return code; 23 | } 24 | public String getDesc(){ 25 | return desc; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/common/ServerResponse.java: -------------------------------------------------------------------------------- 1 | package com.mall.common; 2 | 3 | import org.codehaus.jackson.annotate.JsonIgnore; 4 | import org.codehaus.jackson.map.annotate.JsonSerialize; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * Created by 王乾 on 2017/12/10. 10 | * 序列化返回给前端 11 | */ 12 | //下面这个注解的意思是空的值不会被序列化,key会消失 13 | @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) 14 | public class ServerResponse implements Serializable { 15 | 16 | private int status; 17 | private String msg; 18 | private T data; 19 | 20 | private ServerResponse(int status) { 21 | this.status = status; 22 | } 23 | 24 | private ServerResponse(int status, T data) { 25 | this.status = status; 26 | this.data = data; 27 | } 28 | 29 | private ServerResponse(int status, String msg, T data) { 30 | this.status = status; 31 | this.msg = msg; 32 | this.data = data; 33 | } 34 | 35 | private ServerResponse(int status, String msg) { 36 | this.status = status; 37 | this.msg = msg; 38 | } 39 | 40 | //下面这个注解是json序列化后不再显示在json中 41 | @JsonIgnore 42 | public boolean isSuccess() { 43 | return this.status == ResponseCode.SUCCESS.getCode(); 44 | } 45 | 46 | //下面三个将会被json序列化 47 | public int getStatus() { 48 | return status; 49 | } 50 | 51 | public T getData() { 52 | return data; 53 | } 54 | 55 | public String getMsg() { 56 | return msg; 57 | } 58 | 59 | public static ServerResponse createBySuccess() { 60 | return new ServerResponse(ResponseCode.SUCCESS.getCode()); 61 | } 62 | 63 | public static ServerResponse createBySuccessMessage(String msg) { 64 | return new ServerResponse(ResponseCode.SUCCESS.getCode(), msg); 65 | } 66 | 67 | public static ServerResponse createBySuccess(T data) { 68 | return new ServerResponse(ResponseCode.SUCCESS.getCode(), data); 69 | } 70 | 71 | public static ServerResponse createBySuccess(String msg, T data) { 72 | return new ServerResponse(ResponseCode.SUCCESS.getCode(), msg, data); 73 | } 74 | 75 | public static ServerResponse createByError() { 76 | return new ServerResponse(ResponseCode.ERROR.getCode(), ResponseCode.ERROR.getDesc()); 77 | } 78 | 79 | public static ServerResponse createByErrorMessage(String errorMessage) { 80 | return new ServerResponse(ResponseCode.ERROR.getCode(), errorMessage); 81 | } 82 | 83 | public static ServerResponse createByErrorCodeMessage(int errorCode, String errorMessage) { 84 | return new ServerResponse(errorCode, errorMessage); 85 | } 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/common/TokenCache.java: -------------------------------------------------------------------------------- 1 | package com.mall.common; 2 | 3 | import com.google.common.cache.CacheBuilder; 4 | import com.google.common.cache.CacheLoader; 5 | import com.google.common.cache.LoadingCache; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | import java.util.concurrent.TimeUnit; 10 | 11 | /** 12 | * Created by 王乾 on 2017/12/12. 13 | */ 14 | public class TokenCache { 15 | 16 | private static Logger logger = LoggerFactory.getLogger(TokenCache.class); 17 | public static final String TOKEN_PREFIX = "token_"; 18 | private static LoadingCache localCache = CacheBuilder.newBuilder().initialCapacity(1000).maximumSize(10000).expireAfterAccess(12, TimeUnit.HOURS) 19 | .build(new CacheLoader() { 20 | //默认的数据加载实现,当带哦用get取值的时候,如果key没有对应的值,就调用这个方法进行加载 21 | @Override 22 | public String load(String s) throws Exception { 23 | return "null"; 24 | } 25 | }); 26 | 27 | public static void setKey(String key,String value){ 28 | localCache.put(key,value); 29 | } 30 | 31 | public static String getKey(String key){ 32 | String value = null; 33 | try { 34 | value = localCache.get(key); 35 | if("null".equals(value)){ 36 | return null; 37 | } 38 | return value; 39 | }catch (Exception e){ 40 | logger.error("localCache get error",e); 41 | } 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/controller/backend/CategoryManageController.java: -------------------------------------------------------------------------------- 1 | package com.mall.controller.backend; 2 | 3 | import com.mall.common.Const; 4 | import com.mall.common.ResponseCode; 5 | import com.mall.common.ServerResponse; 6 | import com.mall.pojo.User; 7 | import com.mall.service.ICategoryService; 8 | import com.mall.service.IUserService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestMethod; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | import org.springframework.web.bind.annotation.ResponseBody; 15 | 16 | import javax.servlet.http.HttpSession; 17 | 18 | /** 19 | * Created by 王乾 on 2017/12/18. 20 | */ 21 | @Controller 22 | @RequestMapping("/manage/category") 23 | public class CategoryManageController { 24 | 25 | @Autowired 26 | private IUserService iUserService; 27 | 28 | @Autowired 29 | private ICategoryService iCategoryService; 30 | 31 | /** 32 | * 后台,添加分类 33 | * @param session 34 | * @param categoryName 35 | * @param parentId 36 | * @return 37 | */ 38 | @RequestMapping(value = "add_category.do",method = RequestMethod.GET) 39 | @ResponseBody 40 | public ServerResponse addCategory(HttpSession session,String categoryName,@RequestParam(value = "parentId",defaultValue = "0" ) int parentId){ 41 | User user = (User)session.getAttribute(Const.CURRENT_USER); 42 | if(user == null){ 43 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),"用户未登录,请登录"); 44 | } 45 | //检验是不是管理员 46 | if(iUserService.checkAdminRole(user).isSuccess()){ 47 | //是管理员 48 | //增加我们处理分类的逻辑 49 | return iCategoryService.addCategory(categoryName,parentId); 50 | }else{ 51 | return ServerResponse.createByErrorMessage("无权限操作,需要管理员权限"); 52 | } 53 | } 54 | 55 | /** 56 | * 后台,更改分类名字 57 | * @param session 58 | * @param categoryId 59 | * @param categoryName 60 | * @return 61 | */ 62 | @RequestMapping("set_category_name.do") 63 | @ResponseBody 64 | public ServerResponse setCategoryName(HttpSession session,Integer categoryId,String categoryName){ 65 | User user = (User)session.getAttribute(Const.CURRENT_USER); 66 | if(user == null){ 67 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),"用户未登录,请登录"); 68 | } 69 | //检验是不是管理员 70 | if(iUserService.checkAdminRole(user).isSuccess()){ 71 | //更新categoryName 72 | return iCategoryService.updateCategoryName(categoryId,categoryName); 73 | }else{ 74 | return ServerResponse.createByErrorMessage("无权限操作,需要管理员权限"); 75 | } 76 | } 77 | 78 | /** 79 | * 查询当前节点子节点的信息,平级的不递归 80 | * @param session 81 | * @param categoryId 82 | * @return 83 | */ 84 | @RequestMapping("get_category.do") 85 | @ResponseBody 86 | public ServerResponse getChildrenParalleCategory(HttpSession session,@RequestParam(value = "categoryId",defaultValue = "0" )Integer categoryId){ 87 | User user = (User)session.getAttribute(Const.CURRENT_USER); 88 | if(user == null){ 89 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),"用户未登录,请登录"); 90 | } 91 | //检验是不是管理员 92 | if(iUserService.checkAdminRole(user).isSuccess()){ 93 | //查询子节点的category信息,并且不递归 94 | return iCategoryService.getChildrenParallelCategory(categoryId); 95 | }else{ 96 | return ServerResponse.createByErrorMessage("无权限操作,需要管理员权限"); 97 | } 98 | } 99 | 100 | /** 101 | * 深度查询,查询此id 下的所有后代的id(递归) 102 | * @param session 103 | * @param categoryId 104 | * @return 105 | */ 106 | @RequestMapping("get_deep_category.do") 107 | @ResponseBody 108 | public ServerResponse getCategoryAndDeepChildrenCategory(HttpSession session,@RequestParam(value = "categoryId",defaultValue = "0" )Integer categoryId){ 109 | User user = (User)session.getAttribute(Const.CURRENT_USER); 110 | if(user == null){ 111 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),"用户未登录,请登录"); 112 | } 113 | //检验是不是管理员 114 | if(iUserService.checkAdminRole(user).isSuccess()){ 115 | //查询当前结点的id和递归子节点的id 116 | //0->10000->100000 传0进来10000 和 100000都得给它 117 | return iCategoryService.selectCategoryAndChidrenById(categoryId); 118 | }else{ 119 | return ServerResponse.createByErrorMessage("无权限操作,需要管理员权限"); 120 | } 121 | } 122 | 123 | 124 | 125 | 126 | } 127 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/controller/backend/OrderManageController.java: -------------------------------------------------------------------------------- 1 | package com.mall.controller.backend; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mall.common.Const; 5 | import com.mall.common.ResponseCode; 6 | import com.mall.common.ServerResponse; 7 | import com.mall.pojo.User; 8 | import com.mall.service.IOrderService; 9 | import com.mall.service.IUserService; 10 | import com.mall.vo.OrderVo; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RequestParam; 15 | import org.springframework.web.bind.annotation.ResponseBody; 16 | 17 | import javax.servlet.http.HttpSession; 18 | 19 | 20 | 21 | @Controller 22 | @RequestMapping("/manage/order") 23 | public class OrderManageController { 24 | 25 | @Autowired 26 | private IUserService iUserService; 27 | @Autowired 28 | private IOrderService iOrderService; 29 | 30 | @RequestMapping("list.do") 31 | @ResponseBody 32 | public ServerResponse orderList(HttpSession session, @RequestParam(value = "pageNum",defaultValue = "1") int pageNum, 33 | @RequestParam(value = "pageSize",defaultValue = "10")int pageSize){ 34 | 35 | User user = (User)session.getAttribute(Const.CURRENT_USER); 36 | if(user == null){ 37 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),"用户未登录,请登录管理员"); 38 | 39 | } 40 | if(iUserService.checkAdminRole(user).isSuccess()){ 41 | //填充我们增加产品的业务逻辑 42 | return iOrderService.manageList(pageNum,pageSize); 43 | }else{ 44 | return ServerResponse.createByErrorMessage("无权限操作"); 45 | } 46 | } 47 | 48 | @RequestMapping("detail.do") 49 | @ResponseBody 50 | public ServerResponse orderDetail(HttpSession session, Long orderNo){ 51 | 52 | User user = (User)session.getAttribute(Const.CURRENT_USER); 53 | if(user == null){ 54 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),"用户未登录,请登录管理员"); 55 | 56 | } 57 | if(iUserService.checkAdminRole(user).isSuccess()){ 58 | //填充我们增加产品的业务逻辑 59 | 60 | return iOrderService.manageDetail(orderNo); 61 | }else{ 62 | return ServerResponse.createByErrorMessage("无权限操作"); 63 | } 64 | } 65 | 66 | 67 | 68 | @RequestMapping("search.do") 69 | @ResponseBody 70 | public ServerResponse orderSearch(HttpSession session, Long orderNo,@RequestParam(value = "pageNum",defaultValue = "1") int pageNum, 71 | @RequestParam(value = "pageSize",defaultValue = "10")int pageSize){ 72 | User user = (User)session.getAttribute(Const.CURRENT_USER); 73 | if(user == null){ 74 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),"用户未登录,请登录管理员"); 75 | 76 | } 77 | if(iUserService.checkAdminRole(user).isSuccess()){ 78 | //填充我们增加产品的业务逻辑 79 | return iOrderService.manageSearch(orderNo,pageNum,pageSize); 80 | }else{ 81 | return ServerResponse.createByErrorMessage("无权限操作"); 82 | } 83 | } 84 | 85 | 86 | 87 | @RequestMapping("send_goods.do") 88 | @ResponseBody 89 | public ServerResponse orderSendGoods(HttpSession session, Long orderNo){ 90 | 91 | User user = (User)session.getAttribute(Const.CURRENT_USER); 92 | if(user == null){ 93 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),"用户未登录,请登录管理员"); 94 | 95 | } 96 | if(iUserService.checkAdminRole(user).isSuccess()){ 97 | //填充我们增加产品的业务逻辑 98 | return iOrderService.manageSendGoods(orderNo); 99 | }else{ 100 | return ServerResponse.createByErrorMessage("无权限操作"); 101 | } 102 | } 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | } 112 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/controller/backend/UserManageController.java: -------------------------------------------------------------------------------- 1 | package com.mall.controller.backend; 2 | 3 | import com.mall.common.Const; 4 | import com.mall.common.ServerResponse; 5 | import com.mall.pojo.User; 6 | import com.mall.service.IUserService; 7 | import org.omg.CORBA.PUBLIC_MEMBER; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestMethod; 12 | import org.springframework.web.bind.annotation.ResponseBody; 13 | 14 | import javax.servlet.http.HttpSession; 15 | 16 | /** 17 | * Created by 王乾 on 2017/12/12. 18 | */ 19 | @Controller 20 | @RequestMapping("/manage/user") 21 | public class UserManageController { 22 | 23 | @Autowired 24 | private IUserService iUserService; 25 | 26 | /** 27 | * 后台登陆 28 | * @param username 29 | * @param password 30 | * @param session 31 | * @return 32 | */ 33 | @RequestMapping(value = "login.do",method = RequestMethod.POST) 34 | @ResponseBody 35 | public ServerResponse login(String username, String password, HttpSession session){ 36 | ServerResponse response = iUserService.login(username,password); 37 | if(response.isSuccess()){ 38 | User user = response.getData(); 39 | if(user.getRole() == Const.Role.ROLE_ADMIN){ 40 | //说明登陆的是管理员 41 | session.setAttribute(Const.CURRENT_USER,user); 42 | return response; 43 | }else{ 44 | return ServerResponse.createByErrorMessage("不是管理员,无法登陆"); 45 | } 46 | } 47 | return response; 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/controller/portal/CartController.java: -------------------------------------------------------------------------------- 1 | package com.mall.controller.portal; 2 | 3 | import com.mall.common.Const; 4 | import com.mall.common.ResponseCode; 5 | import com.mall.common.ServerResponse; 6 | import com.mall.pojo.User; 7 | import com.mall.service.ICartService; 8 | import com.mall.vo.CartVo; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.ResponseBody; 13 | 14 | import javax.servlet.http.HttpSession; 15 | 16 | /** 17 | * Created by 王乾 on 2017/12/22. 18 | */ 19 | @Controller 20 | @RequestMapping("/cart/") 21 | public class CartController { 22 | 23 | @Autowired 24 | private ICartService iCartService; 25 | 26 | 27 | /** 28 | * 查询购物车 29 | * @param session 30 | * @return 31 | */ 32 | @RequestMapping("list.do") 33 | @ResponseBody 34 | public ServerResponse list(HttpSession session){ 35 | User user = (User)session.getAttribute(Const.CURRENT_USER); 36 | if(user == null){ 37 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 38 | } 39 | return iCartService.list(user.getId()); 40 | } 41 | /** 42 | * 添加到购物车 43 | * @param session 44 | * @param productId 45 | * @param count 46 | * @return 47 | */ 48 | @RequestMapping("add.do") 49 | @ResponseBody 50 | public ServerResponse add(HttpSession session, Integer productId, Integer count){ 51 | User user = (User)session.getAttribute(Const.CURRENT_USER); 52 | if(user == null){ 53 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 54 | } 55 | return iCartService.add(user.getId(),productId,count); 56 | } 57 | 58 | /** 59 | * 购物车中点击加减,更新购物车 60 | * @param session 61 | * @param productId 62 | * @param count 63 | * @return 64 | */ 65 | @RequestMapping("update.do") 66 | @ResponseBody 67 | public ServerResponse update(HttpSession session, Integer productId, Integer count){ 68 | User user = (User)session.getAttribute(Const.CURRENT_USER); 69 | if(user == null){ 70 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 71 | } 72 | return iCartService.update(user.getId(),productId,count); 73 | } 74 | 75 | /** 76 | * 删除产品,前端约定的是,删除多个产品,id用逗号分开 77 | * @param session 78 | * @param productIds 79 | * @return 80 | */ 81 | @RequestMapping("delete_product.do") 82 | @ResponseBody 83 | public ServerResponse deleteProduct(HttpSession session, String productIds){ 84 | User user = (User)session.getAttribute(Const.CURRENT_USER); 85 | if(user == null){ 86 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 87 | } 88 | return iCartService.deleteProduct(user.getId(),productIds); 89 | } 90 | 91 | /** 92 | * 全选 93 | * @param session 94 | * @return 95 | */ 96 | @RequestMapping("select_all.do") 97 | @ResponseBody 98 | public ServerResponse selectAll(HttpSession session){ 99 | User user = (User)session.getAttribute(Const.CURRENT_USER); 100 | if(user == null){ 101 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 102 | } 103 | return iCartService.selectOrUnselect(user.getId(),null,Const.Cart.CHECKED); 104 | } 105 | 106 | /** 107 | * 全不选 108 | * @param session 109 | * @return 110 | */ 111 | @RequestMapping("un_select_all.do") 112 | @ResponseBody 113 | public ServerResponse unSelectAll(HttpSession session){ 114 | User user = (User)session.getAttribute(Const.CURRENT_USER); 115 | if(user == null){ 116 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 117 | } 118 | return iCartService.selectOrUnselect(user.getId(),null,Const.Cart.UN_CHECKED); 119 | } 120 | 121 | 122 | /** 123 | * 单独选某个产品 124 | * @param session 125 | * @param productId 126 | * @return 127 | */ 128 | @RequestMapping("select.do") 129 | @ResponseBody 130 | public ServerResponse select(HttpSession session,Integer productId){ 131 | User user = (User)session.getAttribute(Const.CURRENT_USER); 132 | if(user == null){ 133 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 134 | } 135 | return iCartService.selectOrUnselect(user.getId(),productId,Const.Cart.CHECKED); 136 | } 137 | 138 | /** 139 | * 单独反选 140 | * @param session 141 | * @param productId 142 | * @return 143 | */ 144 | @RequestMapping("un_select.do") 145 | @ResponseBody 146 | public ServerResponse unSelect(HttpSession session, Integer productId){ 147 | User user = (User)session.getAttribute(Const.CURRENT_USER); 148 | if(user == null){ 149 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 150 | } 151 | return iCartService.selectOrUnselect(user.getId(),productId,Const.Cart.UN_CHECKED); 152 | } 153 | 154 | /** 155 | *查询当前用户的购物车里面的产品数量,放在右上角,按总体的数量算 156 | * @param session 157 | * @return 158 | */ 159 | @RequestMapping("get_cart_product_count.do") 160 | @ResponseBody 161 | public ServerResponse getCartProductCount(HttpSession session){ 162 | User user = (User)session.getAttribute(Const.CURRENT_USER); 163 | if(user == null){ 164 | return ServerResponse.createBySuccess(0); 165 | } 166 | return iCartService.getCartProductCount(user.getId()); 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/controller/portal/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.mall.controller.portal; 2 | 3 | import com.alipay.api.AlipayApiException; 4 | import com.alipay.api.internal.util.AlipaySignature; 5 | import com.alipay.demo.trade.config.Configs; 6 | import com.google.common.collect.Maps; 7 | import com.mall.common.Const; 8 | import com.mall.common.ResponseCode; 9 | import com.mall.common.ServerResponse; 10 | import com.mall.pojo.User; 11 | import com.mall.service.IOrderService; 12 | import org.omg.CORBA.Object; 13 | import org.slf4j.Logger; 14 | import org.slf4j.LoggerFactory; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.stereotype.Controller; 17 | import org.springframework.web.bind.annotation.RequestMapping; 18 | import org.springframework.web.bind.annotation.RequestParam; 19 | import org.springframework.web.bind.annotation.ResponseBody; 20 | 21 | import javax.servlet.http.HttpServletRequest; 22 | import javax.servlet.http.HttpSession; 23 | import java.util.Iterator; 24 | import java.util.Map; 25 | 26 | /** 27 | * Created by 王乾 on 2017/12/25. 28 | */ 29 | @Controller 30 | @RequestMapping("/order/") 31 | public class OrderController { 32 | 33 | private static final Logger logger = LoggerFactory.getLogger(OrderController.class); 34 | 35 | @Autowired 36 | private IOrderService iOrderService; 37 | 38 | /** 39 | * 创建订单 40 | * @param session 41 | * @param shippingId 42 | * @return 43 | */ 44 | 45 | @RequestMapping("create.do") 46 | @ResponseBody 47 | public ServerResponse create(HttpSession session,Integer shippingId){ 48 | User user = (User)session.getAttribute(Const.CURRENT_USER); 49 | if(user == null){ 50 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 51 | } 52 | return iOrderService.createOrder(user.getId(),shippingId); 53 | } 54 | 55 | /** 56 | * 取消订单接口 57 | * @param session 58 | * @param orderNo 59 | * @return 60 | */ 61 | @RequestMapping("cancel.do") 62 | @ResponseBody 63 | public ServerResponse cancel(HttpSession session,Long orderNo){ 64 | User user = (User)session.getAttribute(Const.CURRENT_USER); 65 | if(user == null){ 66 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 67 | } 68 | return iOrderService.cancel(user.getId(),orderNo); 69 | } 70 | 71 | 72 | /** 73 | * 获取已经选中的购物车订单信息的 接口 74 | * @param session 75 | * @return 76 | */ 77 | @RequestMapping("get_order_cart_product.do") 78 | @ResponseBody 79 | public ServerResponse getOrderCartProduct(HttpSession session){ 80 | User user = (User)session.getAttribute(Const.CURRENT_USER); 81 | if(user == null){ 82 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 83 | } 84 | return iOrderService.getOrderCartProduct(user.getId()); 85 | } 86 | 87 | 88 | /** 89 | * 查看订单详情 90 | * @param session 91 | * @param orderNo 92 | * @return 93 | */ 94 | @RequestMapping("detail.do") 95 | @ResponseBody 96 | public ServerResponse detail(HttpSession session,Long orderNo){ 97 | User user = (User)session.getAttribute(Const.CURRENT_USER); 98 | if(user == null){ 99 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 100 | } 101 | return iOrderService.getOrderDetail(user.getId(),orderNo); 102 | } 103 | 104 | /** 105 | * 查看订单列表 106 | * @param session 107 | * @param pageNum 108 | * @param pageSize 109 | * @return 110 | */ 111 | @RequestMapping("list.do") 112 | @ResponseBody 113 | public ServerResponse list(HttpSession session, @RequestParam(value = "pageNum",defaultValue = "1") int pageNum, @RequestParam(value = "pageSize",defaultValue = "10") int pageSize){ 114 | User user = (User)session.getAttribute(Const.CURRENT_USER); 115 | if(user == null){ 116 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 117 | } 118 | return iOrderService.getOrderList(user.getId(),pageNum,pageSize); 119 | } 120 | 121 | /** 122 | * 订单号,生成二维码 123 | * @param session 124 | * @param orderNo 125 | * @param request 126 | * @return 127 | */ 128 | @RequestMapping("pay.do") 129 | @ResponseBody 130 | public ServerResponse pay(HttpSession session, Long orderNo, HttpServletRequest request){ 131 | User user = (User)session.getAttribute(Const.CURRENT_USER); 132 | if(user == null){ 133 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 134 | } 135 | String path = request.getSession().getServletContext().getRealPath("upload"); 136 | return iOrderService.pay(orderNo,user.getId(),path); 137 | } 138 | 139 | /** 140 | * 处理回调,获取回调参数,传入service层 141 | * @param request 142 | * @return 143 | */ 144 | @RequestMapping("alipay_callback.do") 145 | @ResponseBody 146 | public java.lang.Object alipayCallback(HttpServletRequest request){ 147 | Map params = Maps.newHashMap(); 148 | 149 | Map requestParams = request.getParameterMap(); 150 | for(Iterator iter = requestParams.keySet().iterator();iter.hasNext();){ 151 | String name = (String)iter.next(); 152 | String[] values = (String[]) requestParams.get(name); 153 | String valueStr = ""; 154 | for(int i = 0; i < values.length;i++){ 155 | valueStr = (i == values.length-1)?valueStr + values[i]:valueStr + values[i] + ","; 156 | } 157 | params.put(name,valueStr); 158 | } 159 | logger.info("支付宝回调,sign:{},trade_status:{},参数:{}",params.get("sign"),params.get("trade_status"),params.toString()); 160 | 161 | //非常重要,验证回调的正确性,是不是支付宝发的,并且呢还要避免重复通知 162 | 163 | params.remove("sign_type"); 164 | try { 165 | boolean alipayRSACheckedV2 = AlipaySignature.rsaCheckV2(params, Configs.getAlipayPublicKey(),"utf-8",Configs.getSignType()); 166 | if(!alipayRSACheckedV2){ 167 | return ServerResponse.createByErrorMessage("非法请求,验证不通过,如果在恶意请求我就报警了"); 168 | } 169 | } catch (AlipayApiException e) { 170 | logger.error("支付宝回调异常",e); 171 | } 172 | 173 | // TODO: 2017/12/26 174 | 175 | ServerResponse serverResponse = iOrderService.aliCallback(params); 176 | if(serverResponse.isSuccess()){ 177 | return Const.AlipayCallback.RESPONSE_SUCCESS; 178 | } 179 | return Const.AlipayCallback.RESPONSE_FAILED; 180 | } 181 | 182 | /** 183 | * 查询订单支付接口 184 | * @param session 185 | * @param orderNo 186 | * @return 187 | */ 188 | @RequestMapping("query_order_pay_status.do") 189 | @ResponseBody 190 | public ServerResponse queryOrderPayStatus(HttpSession session, Long orderNo){ 191 | User user = (User)session.getAttribute(Const.CURRENT_USER); 192 | if(user == null){ 193 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 194 | } 195 | ServerResponse serverResponse = iOrderService.queryOrderPayStatus(user.getId(),orderNo); 196 | if(serverResponse.isSuccess()){ 197 | return ServerResponse.createBySuccess(true); 198 | } 199 | return ServerResponse.createBySuccess(false); 200 | } 201 | 202 | 203 | 204 | } 205 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/controller/portal/ProductController.java: -------------------------------------------------------------------------------- 1 | package com.mall.controller.portal; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mall.common.ServerResponse; 5 | import com.mall.service.IProductService; 6 | import com.mall.vo.ProductDetailVo; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestParam; 11 | import org.springframework.web.bind.annotation.ResponseBody; 12 | 13 | /** 14 | * Created by 王乾 on 2017/12/21. 15 | */ 16 | @Controller 17 | @RequestMapping("/product/") 18 | public class ProductController { 19 | @Autowired 20 | private IProductService iProductService; 21 | 22 | /** 23 | * 前端商品详情 24 | * @param productId 25 | * @return 26 | */ 27 | @RequestMapping("detail.do") 28 | @ResponseBody 29 | public ServerResponse detail(Integer productId){ 30 | return iProductService.getProductDetail(productId); 31 | } 32 | 33 | /** 34 | * 产品搜索 35 | * @param keyword 36 | * @param categoryId 37 | * @param pageNum 38 | * @param pageSize 39 | * @param orderBy 40 | * @return 41 | */ 42 | @RequestMapping("list.do") 43 | @ResponseBody 44 | public ServerResponse list(@RequestParam(value = "keyword",required = false)String keyword, 45 | @RequestParam(value = "categoryId",required = false)Integer categoryId, 46 | @RequestParam(value = "pageNum",defaultValue = "1")int pageNum, 47 | @RequestParam(value = "pageSize",defaultValue = "10")int pageSize, 48 | @RequestParam(value = "orderBy",defaultValue = "")String orderBy){ 49 | System.out.println(keyword); 50 | return iProductService.getProductByKeywordCategory(keyword,categoryId,pageNum,pageSize,orderBy); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/controller/portal/ShippingController.java: -------------------------------------------------------------------------------- 1 | package com.mall.controller.portal; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mall.common.Const; 5 | import com.mall.common.ResponseCode; 6 | import com.mall.common.ServerResponse; 7 | import com.mall.pojo.Shipping; 8 | import com.mall.pojo.User; 9 | import com.mall.service.IShippingService; 10 | import org.apache.ibatis.annotations.Param; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RequestParam; 15 | import org.springframework.web.bind.annotation.ResponseBody; 16 | 17 | import javax.servlet.http.HttpSession; 18 | 19 | /** 20 | * Created by 王乾 on 2017/12/25. 21 | */ 22 | @Controller 23 | @RequestMapping("/shipping/") 24 | public class ShippingController { 25 | 26 | @Autowired 27 | private IShippingService iShippingService; 28 | 29 | /** 30 | * 添加地址 31 | * @param session 32 | * @param shipping 33 | * @return 34 | */ 35 | @RequestMapping("add.do") 36 | @ResponseBody 37 | public ServerResponse add(HttpSession session, Shipping shipping){ 38 | User user = (User)session.getAttribute(Const.CURRENT_USER); 39 | if(user == null){ 40 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 41 | } 42 | return iShippingService.add(user.getId(),shipping); 43 | } 44 | 45 | /** 46 | * 删除地址 47 | * @param session 48 | * @param shippingId 49 | * @return 50 | */ 51 | @RequestMapping("del.do") 52 | @ResponseBody 53 | public ServerResponse del(HttpSession session, Integer shippingId){ 54 | User user = (User)session.getAttribute(Const.CURRENT_USER); 55 | if(user == null){ 56 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 57 | } 58 | return iShippingService.del(user.getId(),shippingId); 59 | } 60 | 61 | /** 62 | * 更新地址 63 | * @param session 64 | * @param shipping 65 | * @return 66 | */ 67 | @RequestMapping("update.do") 68 | @ResponseBody 69 | public ServerResponse update(HttpSession session, Shipping shipping){ 70 | User user = (User)session.getAttribute(Const.CURRENT_USER); 71 | if(user == null){ 72 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 73 | } 74 | return iShippingService.update(user.getId(),shipping); 75 | } 76 | 77 | /** 78 | * 根据地址id 查询地址的详细信息 79 | * @param session 80 | * @param shippingId 81 | * @return 82 | */ 83 | @RequestMapping("select.do") 84 | @ResponseBody 85 | public ServerResponse select(HttpSession session, Integer shippingId){ 86 | User user = (User)session.getAttribute(Const.CURRENT_USER); 87 | if(user == null){ 88 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 89 | } 90 | return iShippingService.select(user.getId(),shippingId); 91 | } 92 | 93 | /** 94 | * 地址分页获取 95 | * @param session 96 | * @param pageNum 97 | * @param pageSize 98 | * @return 99 | */ 100 | @RequestMapping("list.do") 101 | @ResponseBody 102 | public ServerResponse list(HttpSession session,@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,@RequestParam(value = "pageSize",defaultValue = "10") int pageSize){ 103 | User user = (User)session.getAttribute(Const.CURRENT_USER); 104 | if(user == null){ 105 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc()); 106 | } 107 | return iShippingService.list(user.getId(),pageNum,pageSize); 108 | } 109 | 110 | 111 | 112 | } 113 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/controller/portal/UserController.java: -------------------------------------------------------------------------------- 1 | package com.mall.controller.portal; 2 | 3 | 4 | import com.mall.common.Const; 5 | import com.mall.common.ResponseCode; 6 | import com.mall.common.ServerResponse; 7 | import com.mall.pojo.User; 8 | import com.mall.service.IUserService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestMethod; 13 | import org.springframework.web.bind.annotation.ResponseBody; 14 | 15 | import javax.servlet.http.HttpSession; 16 | 17 | /** 18 | * Created by 王乾 on 2017/12/10. 19 | */ 20 | @Controller 21 | @RequestMapping("/user/") 22 | public class UserController { 23 | //注入service 中注解为iUserService的service 24 | @Autowired 25 | private IUserService iUserService; 26 | /** 27 | * 用户登录 28 | * @param username 29 | * @param password 30 | * @param session 31 | * @return 32 | */ 33 | @RequestMapping(value = "login.do",method = RequestMethod.POST) 34 | @ResponseBody 35 | public ServerResponse login(String username, String password, HttpSession session){ 36 | //service -->mybatis ->dao 37 | ServerResponse response = iUserService.login(username,password); 38 | if(response.isSuccess()){ 39 | session.setAttribute(Const.CURRENT_USER,response.getData()); 40 | } 41 | return response; 42 | } 43 | 44 | /** 45 | * 用户登出 46 | * @param session 47 | * @return 48 | */ 49 | @RequestMapping(value = "logout.do",method = RequestMethod.POST) 50 | @ResponseBody 51 | public ServerResponse logout(HttpSession session){ 52 | session.removeAttribute(Const.CURRENT_USER); 53 | return ServerResponse.createBySuccess(); 54 | } 55 | 56 | /** 57 | * 注册 58 | * @param user 59 | * @return 60 | */ 61 | @RequestMapping(value = "register.do",method = RequestMethod.POST) 62 | @ResponseBody 63 | public ServerResponse register(User user){ 64 | return iUserService.register(user); 65 | } 66 | 67 | /** 68 | * 邮箱用户名校验 69 | * @param str 70 | * @param type 71 | * @return 72 | */ 73 | @RequestMapping(value = "check_valid.do",method = RequestMethod.POST) 74 | @ResponseBody 75 | public ServerResponse checkValid(String str,String type){ 76 | return iUserService.checkValid(str,type); 77 | } 78 | 79 | /** 80 | * 获取用户信息 81 | * @param session 82 | * @return 83 | */ 84 | @RequestMapping(value = "get_user_info.do",method = RequestMethod.POST) 85 | @ResponseBody 86 | public ServerResponse getUserInfo(HttpSession session){ 87 | User user = (User)session.getAttribute(Const.CURRENT_USER); 88 | if(user != null){ 89 | return ServerResponse.createBySuccess(user); 90 | } 91 | return ServerResponse.createByErrorMessage("用户未登录,无法获取当前用户信息"); 92 | } 93 | 94 | /** 95 | * 获取忘记密码提示 96 | * @param username 97 | * @return 98 | */ 99 | @RequestMapping(value = "forget_get_question.do",method = RequestMethod.POST) 100 | @ResponseBody 101 | public ServerResponse forgetGetQuestion(String username){ 102 | return iUserService.selectQuestion(username); 103 | } 104 | 105 | /** 106 | * 提交问题答案 107 | * @param username 108 | * @param question 109 | * @param answer 110 | * @return 111 | */ 112 | @RequestMapping(value = "forget_check_answer.do",method = RequestMethod.POST) 113 | @ResponseBody 114 | public ServerResponse forgetCheckAnswer(String username,String question,String answer){ 115 | return iUserService.checkAnswer(username,question,answer); 116 | } 117 | 118 | /** 119 | * 忘记密码中的重置密码 120 | * @param username 121 | * @param passwordNew 122 | * @param forgetToken 123 | * @return 124 | */ 125 | @RequestMapping(value = "forget_reset_password.do",method = RequestMethod.POST) 126 | @ResponseBody 127 | public ServerResponse forgetRestPassword(String username,String passwordNew,String forgetToken ){ 128 | return iUserService.forgetResetPassword(username,passwordNew,forgetToken); 129 | } 130 | 131 | 132 | /** 133 | * 登录状态的重置密码 134 | * @param session 135 | * @param passwordOld 136 | * @param passwordNew 137 | * @return 138 | */ 139 | @RequestMapping(value = "reset_password.do",method = RequestMethod.POST) 140 | @ResponseBody 141 | public ServerResponse resetPassword(HttpSession session,String passwordOld,String passwordNew){ 142 | User user = (User)session.getAttribute(Const.CURRENT_USER); 143 | if(user == null){ 144 | return ServerResponse.createByErrorMessage("用户未登录"); 145 | } 146 | return iUserService.resetPassword(passwordOld,passwordNew,user); 147 | } 148 | 149 | /** 150 | * 更新个人信息 151 | * @param session 152 | * @param user 153 | * @return 154 | */ 155 | @RequestMapping(value = "update_information.do",method = RequestMethod.POST) 156 | @ResponseBody 157 | public ServerResponse update_information(HttpSession session,User user){ 158 | User currentUser = (User)session.getAttribute(Const.CURRENT_USER); 159 | if(currentUser == null){ 160 | return ServerResponse.createByErrorMessage("用户未登录"); 161 | } 162 | user.setId(currentUser.getId()); 163 | user.setUsername(currentUser.getUsername()); 164 | ServerResponse response = iUserService.updateInformation(user); 165 | if(response.isSuccess()){ 166 | response.getData().setUsername(currentUser.getUsername()); 167 | session.setAttribute(Const.CURRENT_USER,response.getData()); 168 | } 169 | return response; 170 | } 171 | 172 | 173 | /** 174 | * 获取个人详细信息 175 | * @param session 176 | * @return 177 | */ 178 | @RequestMapping(value = "get_information.do",method = RequestMethod.POST) 179 | @ResponseBody 180 | public ServerResponse get_information(HttpSession session){ 181 | User currentUser = (User)session.getAttribute(Const.CURRENT_USER); 182 | if(currentUser == null){ 183 | return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),"未登录,需要强制登陆status=10"); 184 | } 185 | return iUserService.getInformation(currentUser.getId()); 186 | } 187 | 188 | 189 | 190 | } 191 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/dao/CartMapper.java: -------------------------------------------------------------------------------- 1 | package com.mall.dao; 2 | 3 | import com.mall.pojo.Cart; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | public interface CartMapper { 9 | int deleteByPrimaryKey(Integer id); 10 | 11 | int insert(Cart record); 12 | 13 | int insertSelective(Cart record); 14 | 15 | Cart selectByPrimaryKey(Integer id); 16 | 17 | int updateByPrimaryKeySelective(Cart record); 18 | 19 | int updateByPrimaryKey(Cart record); 20 | 21 | Cart selectByUserIdProductId(@Param("userId") Integer userId, @Param("productId")Integer productId); 22 | 23 | List selectCartByUserId(Integer userId); 24 | 25 | int selectCartProductCheckedStatusByUserId(Integer userId); 26 | 27 | int deleteByUserIdProductIds(@Param("userId") Integer userId, @Param("productIdList")List productIdList); 28 | 29 | int checkedOrUncheckedProduct(@Param("userId") Integer userId,@Param("productId")Integer productId,@Param("checked") Integer checked); 30 | 31 | int selectCartProductCount(@Param("userId") Integer userId); 32 | 33 | List selectCheckedCartByUserId(Integer userId); 34 | 35 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/dao/CategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.mall.dao; 2 | 3 | import com.mall.pojo.Category; 4 | 5 | import java.util.List; 6 | 7 | public interface CategoryMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(Category record); 11 | 12 | int insertSelective(Category record); 13 | 14 | Category selectByPrimaryKey(Integer id); 15 | 16 | int updateByPrimaryKeySelective(Category record); 17 | 18 | int updateByPrimaryKey(Category record); 19 | 20 | List selectCategoryChildrenByParentId(Integer parentId); 21 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/dao/OrderItemMapper.java: -------------------------------------------------------------------------------- 1 | package com.mall.dao; 2 | 3 | import com.mall.pojo.OrderItem; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | public interface OrderItemMapper { 9 | int deleteByPrimaryKey(Integer id); 10 | 11 | int insert(OrderItem record); 12 | 13 | int insertSelective(OrderItem record); 14 | 15 | OrderItem selectByPrimaryKey(Integer id); 16 | 17 | int updateByPrimaryKeySelective(OrderItem record); 18 | 19 | int updateByPrimaryKey(OrderItem record); 20 | 21 | List getByOrderNoUserId(@Param("orderNo")Long orderNo, @Param("userId")Integer userId); 22 | 23 | List getByOrderNo(@Param("orderNo")Long orderNo); 24 | 25 | void batchInsert(@Param("orderItemList") List orderItemList); 26 | 27 | 28 | 29 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/dao/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.mall.dao; 2 | 3 | import com.mall.pojo.Order; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | public interface OrderMapper { 9 | int deleteByPrimaryKey(Integer id); 10 | 11 | int insert(Order record); 12 | 13 | int insertSelective(Order record); 14 | 15 | Order selectByPrimaryKey(Integer id); 16 | 17 | int updateByPrimaryKeySelective(Order record); 18 | 19 | int updateByPrimaryKey(Order record); 20 | 21 | Order selectByUserIdAndOrderNo(@Param("userId") Integer userId,@Param("orderNo") Long orderNo); 22 | 23 | Order selectByOrderNo( Long orderNo); 24 | 25 | List selectByUserId(Integer userId); 26 | 27 | 28 | List selectAllOrder(); 29 | 30 | 31 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/dao/PayInfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.mall.dao; 2 | 3 | import com.mall.pojo.PayInfo; 4 | 5 | public interface PayInfoMapper { 6 | int deleteByPrimaryKey(Integer id); 7 | 8 | int insert(PayInfo record); 9 | 10 | int insertSelective(PayInfo record); 11 | 12 | PayInfo selectByPrimaryKey(Integer id); 13 | 14 | int updateByPrimaryKeySelective(PayInfo record); 15 | 16 | int updateByPrimaryKey(PayInfo record); 17 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/dao/ProductMapper.java: -------------------------------------------------------------------------------- 1 | package com.mall.dao; 2 | 3 | import com.mall.pojo.Product; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | public interface ProductMapper { 9 | int deleteByPrimaryKey(Integer id); 10 | 11 | int insert(Product record); 12 | 13 | int insertSelective(Product record); 14 | 15 | Product selectByPrimaryKey(Integer id); 16 | 17 | int updateByPrimaryKeySelective(Product record); 18 | 19 | int updateByPrimaryKey(Product record); 20 | 21 | List selectList(); 22 | 23 | List selectByNameAndProductId(@Param("productName")String productName,@Param("productId") Integer productId); 24 | 25 | List selectByNameAndCategoryIds(@Param("productName")String productName,@Param("categoryIdList")List categoryIdList); 26 | 27 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/dao/ShippingMapper.java: -------------------------------------------------------------------------------- 1 | package com.mall.dao; 2 | 3 | import com.mall.pojo.Shipping; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | public interface ShippingMapper { 9 | int deleteByPrimaryKey(Integer id); 10 | 11 | int insert(Shipping record); 12 | 13 | int insertSelective(Shipping record); 14 | 15 | Shipping selectByPrimaryKey(Integer id); 16 | 17 | int updateByPrimaryKeySelective(Shipping record); 18 | 19 | int updateByPrimaryKey(Shipping record); 20 | 21 | int deleteByShippingIdUserId(@Param("userId") Integer userId, @Param("shippingId") Integer shippingId); 22 | 23 | int updateByShipping(Shipping record); 24 | 25 | Shipping selectByShippingIdUserId(@Param("userId") Integer userId, @Param("shippingId") Integer shippingId); 26 | 27 | List selectByUserId(@Param("userId") Integer userId); 28 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/dao/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.mall.dao; 2 | 3 | import com.mall.pojo.User; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | public interface UserMapper { 7 | int deleteByPrimaryKey(Integer id); 8 | 9 | int insert(User record); 10 | 11 | int insertSelective(User record); 12 | 13 | User selectByPrimaryKey(Integer id); 14 | 15 | int updateByPrimaryKeySelective(User record); 16 | 17 | int updateByPrimaryKey(User record); 18 | 19 | int checkUsername(String username); 20 | 21 | int checkEmail(String email); 22 | //Param注解多个参数使用 23 | User selectLogin(@Param("username") String username,@Param("password")String password); 24 | 25 | String selectQuestionByUsername(String username); 26 | 27 | int checkAnswer(@Param("username") String username,@Param("question") String question,@Param("answer") String answer); 28 | 29 | int updatePasswordByUsername(@Param("username")String username,@Param("passwordNew")String passwordNew); 30 | 31 | int checkPassword(@Param("password")String password,@Param("userId")Integer userId); 32 | 33 | int checkEmailByUserId(@Param("email")String email,@Param("userId")Integer userId); 34 | 35 | 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/pojo/Cart.java: -------------------------------------------------------------------------------- 1 | package com.mall.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class Cart { 6 | private Integer id; 7 | 8 | private Integer userId; 9 | 10 | private Integer productId; 11 | 12 | private Integer quantity; 13 | 14 | private Integer checked; 15 | 16 | private Date createTime; 17 | 18 | private Date updateTime; 19 | 20 | public Cart(Integer id, Integer userId, Integer productId, Integer quantity, Integer checked, Date createTime, Date updateTime) { 21 | this.id = id; 22 | this.userId = userId; 23 | this.productId = productId; 24 | this.quantity = quantity; 25 | this.checked = checked; 26 | this.createTime = createTime; 27 | this.updateTime = updateTime; 28 | } 29 | 30 | public Cart() { 31 | super(); 32 | } 33 | 34 | public Integer getId() { 35 | return id; 36 | } 37 | 38 | public void setId(Integer id) { 39 | this.id = id; 40 | } 41 | 42 | public Integer getUserId() { 43 | return userId; 44 | } 45 | 46 | public void setUserId(Integer userId) { 47 | this.userId = userId; 48 | } 49 | 50 | public Integer getProductId() { 51 | return productId; 52 | } 53 | 54 | public void setProductId(Integer productId) { 55 | this.productId = productId; 56 | } 57 | 58 | public Integer getQuantity() { 59 | return quantity; 60 | } 61 | 62 | public void setQuantity(Integer quantity) { 63 | this.quantity = quantity; 64 | } 65 | 66 | public Integer getChecked() { 67 | return checked; 68 | } 69 | 70 | public void setChecked(Integer checked) { 71 | this.checked = checked; 72 | } 73 | 74 | public Date getCreateTime() { 75 | return createTime; 76 | } 77 | 78 | public void setCreateTime(Date createTime) { 79 | this.createTime = createTime; 80 | } 81 | 82 | public Date getUpdateTime() { 83 | return updateTime; 84 | } 85 | 86 | public void setUpdateTime(Date updateTime) { 87 | this.updateTime = updateTime; 88 | } 89 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/pojo/Category.java: -------------------------------------------------------------------------------- 1 | package com.mall.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class Category { 6 | private Integer id; 7 | 8 | private Integer parentId; 9 | 10 | private String name; 11 | 12 | private Boolean status; 13 | 14 | private Integer sortOrder; 15 | 16 | private Date createTime; 17 | 18 | private Date updateTime; 19 | 20 | public Category(Integer id, Integer parentId, String name, Boolean status, Integer sortOrder, Date createTime, Date updateTime) { 21 | this.id = id; 22 | this.parentId = parentId; 23 | this.name = name; 24 | this.status = status; 25 | this.sortOrder = sortOrder; 26 | this.createTime = createTime; 27 | this.updateTime = updateTime; 28 | } 29 | 30 | public Category() { 31 | super(); 32 | } 33 | 34 | public Integer getId() { 35 | return id; 36 | } 37 | 38 | public void setId(Integer id) { 39 | this.id = id; 40 | } 41 | 42 | public Integer getParentId() { 43 | return parentId; 44 | } 45 | 46 | public void setParentId(Integer parentId) { 47 | this.parentId = parentId; 48 | } 49 | 50 | public String getName() { 51 | return name; 52 | } 53 | 54 | public void setName(String name) { 55 | this.name = name == null ? null : name.trim(); 56 | } 57 | 58 | public Boolean getStatus() { 59 | return status; 60 | } 61 | 62 | public void setStatus(Boolean status) { 63 | this.status = status; 64 | } 65 | 66 | public Integer getSortOrder() { 67 | return sortOrder; 68 | } 69 | 70 | public void setSortOrder(Integer sortOrder) { 71 | this.sortOrder = sortOrder; 72 | } 73 | 74 | public Date getCreateTime() { 75 | return createTime; 76 | } 77 | 78 | public void setCreateTime(Date createTime) { 79 | this.createTime = createTime; 80 | } 81 | 82 | public Date getUpdateTime() { 83 | return updateTime; 84 | } 85 | 86 | public void setUpdateTime(Date updateTime) { 87 | this.updateTime = updateTime; 88 | } 89 | 90 | //id相同就是 相同 91 | @Override 92 | public boolean equals(Object o) { 93 | if (this == o) return true; 94 | if (o == null || getClass() != o.getClass()) return false; 95 | 96 | Category category = (Category) o; 97 | 98 | return id != null ? id.equals(category.id) : category.id == null; 99 | 100 | } 101 | 102 | @Override 103 | public int hashCode() { 104 | return id != null ? id.hashCode() : 0; 105 | } 106 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/pojo/Order.java: -------------------------------------------------------------------------------- 1 | package com.mall.pojo; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Date; 5 | 6 | public class Order { 7 | private Integer id; 8 | 9 | private Long orderNo; 10 | 11 | private Integer userId; 12 | 13 | private Integer shippingId; 14 | 15 | private BigDecimal payment; 16 | 17 | private Integer paymentType; 18 | 19 | private Integer postage; 20 | 21 | private Integer status; 22 | 23 | private Date paymentTime; 24 | 25 | private Date sendTime; 26 | 27 | private Date endTime; 28 | 29 | private Date closeTime; 30 | 31 | private Date createTime; 32 | 33 | private Date updateTime; 34 | 35 | public Order(Integer id, Long orderNo, Integer userId, Integer shippingId, BigDecimal payment, Integer paymentType, Integer postage, Integer status, Date paymentTime, Date sendTime, Date endTime, Date closeTime, Date createTime, Date updateTime) { 36 | this.id = id; 37 | this.orderNo = orderNo; 38 | this.userId = userId; 39 | this.shippingId = shippingId; 40 | this.payment = payment; 41 | this.paymentType = paymentType; 42 | this.postage = postage; 43 | this.status = status; 44 | this.paymentTime = paymentTime; 45 | this.sendTime = sendTime; 46 | this.endTime = endTime; 47 | this.closeTime = closeTime; 48 | this.createTime = createTime; 49 | this.updateTime = updateTime; 50 | } 51 | 52 | public Order() { 53 | super(); 54 | } 55 | 56 | public Integer getId() { 57 | return id; 58 | } 59 | 60 | public void setId(Integer id) { 61 | this.id = id; 62 | } 63 | 64 | public Long getOrderNo() { 65 | return orderNo; 66 | } 67 | 68 | public void setOrderNo(Long orderNo) { 69 | this.orderNo = orderNo; 70 | } 71 | 72 | public Integer getUserId() { 73 | return userId; 74 | } 75 | 76 | public void setUserId(Integer userId) { 77 | this.userId = userId; 78 | } 79 | 80 | public Integer getShippingId() { 81 | return shippingId; 82 | } 83 | 84 | public void setShippingId(Integer shippingId) { 85 | this.shippingId = shippingId; 86 | } 87 | 88 | public BigDecimal getPayment() { 89 | return payment; 90 | } 91 | 92 | public void setPayment(BigDecimal payment) { 93 | this.payment = payment; 94 | } 95 | 96 | public Integer getPaymentType() { 97 | return paymentType; 98 | } 99 | 100 | public void setPaymentType(Integer paymentType) { 101 | this.paymentType = paymentType; 102 | } 103 | 104 | public Integer getPostage() { 105 | return postage; 106 | } 107 | 108 | public void setPostage(Integer postage) { 109 | this.postage = postage; 110 | } 111 | 112 | public Integer getStatus() { 113 | return status; 114 | } 115 | 116 | public void setStatus(Integer status) { 117 | this.status = status; 118 | } 119 | 120 | public Date getPaymentTime() { 121 | return paymentTime; 122 | } 123 | 124 | public void setPaymentTime(Date paymentTime) { 125 | this.paymentTime = paymentTime; 126 | } 127 | 128 | public Date getSendTime() { 129 | return sendTime; 130 | } 131 | 132 | public void setSendTime(Date sendTime) { 133 | this.sendTime = sendTime; 134 | } 135 | 136 | public Date getEndTime() { 137 | return endTime; 138 | } 139 | 140 | public void setEndTime(Date endTime) { 141 | this.endTime = endTime; 142 | } 143 | 144 | public Date getCloseTime() { 145 | return closeTime; 146 | } 147 | 148 | public void setCloseTime(Date closeTime) { 149 | this.closeTime = closeTime; 150 | } 151 | 152 | public Date getCreateTime() { 153 | return createTime; 154 | } 155 | 156 | public void setCreateTime(Date createTime) { 157 | this.createTime = createTime; 158 | } 159 | 160 | public Date getUpdateTime() { 161 | return updateTime; 162 | } 163 | 164 | public void setUpdateTime(Date updateTime) { 165 | this.updateTime = updateTime; 166 | } 167 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/pojo/OrderItem.java: -------------------------------------------------------------------------------- 1 | package com.mall.pojo; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Date; 5 | 6 | public class OrderItem { 7 | private Integer id; 8 | 9 | private Integer userId; 10 | 11 | private Long orderNo; 12 | 13 | private Integer productId; 14 | 15 | private String productName; 16 | 17 | private String productImage; 18 | 19 | private BigDecimal currentUnitPrice; 20 | 21 | private Integer quantity; 22 | 23 | private BigDecimal totalPrice; 24 | 25 | private Date createTime; 26 | 27 | private Date updateTime; 28 | 29 | public OrderItem(Integer id, Integer userId, Long orderNo, Integer productId, String productName, String productImage, BigDecimal currentUnitPrice, Integer quantity, BigDecimal totalPrice, Date createTime, Date updateTime) { 30 | this.id = id; 31 | this.userId = userId; 32 | this.orderNo = orderNo; 33 | this.productId = productId; 34 | this.productName = productName; 35 | this.productImage = productImage; 36 | this.currentUnitPrice = currentUnitPrice; 37 | this.quantity = quantity; 38 | this.totalPrice = totalPrice; 39 | this.createTime = createTime; 40 | this.updateTime = updateTime; 41 | } 42 | 43 | public OrderItem() { 44 | super(); 45 | } 46 | 47 | public Integer getId() { 48 | return id; 49 | } 50 | 51 | public void setId(Integer id) { 52 | this.id = id; 53 | } 54 | 55 | public Integer getUserId() { 56 | return userId; 57 | } 58 | 59 | public void setUserId(Integer userId) { 60 | this.userId = userId; 61 | } 62 | 63 | public Long getOrderNo() { 64 | return orderNo; 65 | } 66 | 67 | public void setOrderNo(Long orderNo) { 68 | this.orderNo = orderNo; 69 | } 70 | 71 | public Integer getProductId() { 72 | return productId; 73 | } 74 | 75 | public void setProductId(Integer productId) { 76 | this.productId = productId; 77 | } 78 | 79 | public String getProductName() { 80 | return productName; 81 | } 82 | 83 | public void setProductName(String productName) { 84 | this.productName = productName == null ? null : productName.trim(); 85 | } 86 | 87 | public String getProductImage() { 88 | return productImage; 89 | } 90 | 91 | public void setProductImage(String productImage) { 92 | this.productImage = productImage == null ? null : productImage.trim(); 93 | } 94 | 95 | public BigDecimal getCurrentUnitPrice() { 96 | return currentUnitPrice; 97 | } 98 | 99 | public void setCurrentUnitPrice(BigDecimal currentUnitPrice) { 100 | this.currentUnitPrice = currentUnitPrice; 101 | } 102 | 103 | public Integer getQuantity() { 104 | return quantity; 105 | } 106 | 107 | public void setQuantity(Integer quantity) { 108 | this.quantity = quantity; 109 | } 110 | 111 | public BigDecimal getTotalPrice() { 112 | return totalPrice; 113 | } 114 | 115 | public void setTotalPrice(BigDecimal totalPrice) { 116 | this.totalPrice = totalPrice; 117 | } 118 | 119 | public Date getCreateTime() { 120 | return createTime; 121 | } 122 | 123 | public void setCreateTime(Date createTime) { 124 | this.createTime = createTime; 125 | } 126 | 127 | public Date getUpdateTime() { 128 | return updateTime; 129 | } 130 | 131 | public void setUpdateTime(Date updateTime) { 132 | this.updateTime = updateTime; 133 | } 134 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/pojo/PayInfo.java: -------------------------------------------------------------------------------- 1 | package com.mall.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class PayInfo { 6 | private Integer id; 7 | 8 | private Integer userId; 9 | 10 | private Long orderNo; 11 | 12 | private Integer payPlatform; 13 | 14 | private String platformNumber; 15 | 16 | private String platformStatus; 17 | 18 | private Date createTime; 19 | 20 | private Date updateTime; 21 | 22 | public PayInfo(Integer id, Integer userId, Long orderNo, Integer payPlatform, String platformNumber, String platformStatus, Date createTime, Date updateTime) { 23 | this.id = id; 24 | this.userId = userId; 25 | this.orderNo = orderNo; 26 | this.payPlatform = payPlatform; 27 | this.platformNumber = platformNumber; 28 | this.platformStatus = platformStatus; 29 | this.createTime = createTime; 30 | this.updateTime = updateTime; 31 | } 32 | 33 | public PayInfo() { 34 | super(); 35 | } 36 | 37 | public Integer getId() { 38 | return id; 39 | } 40 | 41 | public void setId(Integer id) { 42 | this.id = id; 43 | } 44 | 45 | public Integer getUserId() { 46 | return userId; 47 | } 48 | 49 | public void setUserId(Integer userId) { 50 | this.userId = userId; 51 | } 52 | 53 | public Long getOrderNo() { 54 | return orderNo; 55 | } 56 | 57 | public void setOrderNo(Long orderNo) { 58 | this.orderNo = orderNo; 59 | } 60 | 61 | public Integer getPayPlatform() { 62 | return payPlatform; 63 | } 64 | 65 | public void setPayPlatform(Integer payPlatform) { 66 | this.payPlatform = payPlatform; 67 | } 68 | 69 | public String getPlatformNumber() { 70 | return platformNumber; 71 | } 72 | 73 | public void setPlatformNumber(String platformNumber) { 74 | this.platformNumber = platformNumber == null ? null : platformNumber.trim(); 75 | } 76 | 77 | public String getPlatformStatus() { 78 | return platformStatus; 79 | } 80 | 81 | public void setPlatformStatus(String platformStatus) { 82 | this.platformStatus = platformStatus == null ? null : platformStatus.trim(); 83 | } 84 | 85 | public Date getCreateTime() { 86 | return createTime; 87 | } 88 | 89 | public void setCreateTime(Date createTime) { 90 | this.createTime = createTime; 91 | } 92 | 93 | public Date getUpdateTime() { 94 | return updateTime; 95 | } 96 | 97 | public void setUpdateTime(Date updateTime) { 98 | this.updateTime = updateTime; 99 | } 100 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/pojo/Product.java: -------------------------------------------------------------------------------- 1 | package com.mall.pojo; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Date; 5 | 6 | public class Product { 7 | private Integer id; 8 | 9 | private Integer categoryId; 10 | 11 | private String name; 12 | 13 | private String subtitle; 14 | 15 | private String mainImage; 16 | 17 | private String subImages; 18 | 19 | private String detail; 20 | 21 | private BigDecimal price; 22 | 23 | private Integer stock; 24 | 25 | private Integer status; 26 | 27 | private Date createTime; 28 | 29 | private Date updateTime; 30 | 31 | public Product(Integer id, Integer categoryId, String name, String subtitle, String mainImage, String subImages, String detail, BigDecimal price, Integer stock, Integer status, Date createTime, Date updateTime) { 32 | this.id = id; 33 | this.categoryId = categoryId; 34 | this.name = name; 35 | this.subtitle = subtitle; 36 | this.mainImage = mainImage; 37 | this.subImages = subImages; 38 | this.detail = detail; 39 | this.price = price; 40 | this.stock = stock; 41 | this.status = status; 42 | this.createTime = createTime; 43 | this.updateTime = updateTime; 44 | } 45 | 46 | public Product() { 47 | super(); 48 | } 49 | 50 | public Integer getId() { 51 | return id; 52 | } 53 | 54 | public void setId(Integer id) { 55 | this.id = id; 56 | } 57 | 58 | public Integer getCategoryId() { 59 | return categoryId; 60 | } 61 | 62 | public void setCategoryId(Integer categoryId) { 63 | this.categoryId = categoryId; 64 | } 65 | 66 | public String getName() { 67 | return name; 68 | } 69 | 70 | public void setName(String name) { 71 | this.name = name == null ? null : name.trim(); 72 | } 73 | 74 | public String getSubtitle() { 75 | return subtitle; 76 | } 77 | 78 | public void setSubtitle(String subtitle) { 79 | this.subtitle = subtitle == null ? null : subtitle.trim(); 80 | } 81 | 82 | public String getMainImage() { 83 | return mainImage; 84 | } 85 | 86 | public void setMainImage(String mainImage) { 87 | this.mainImage = mainImage == null ? null : mainImage.trim(); 88 | } 89 | 90 | public String getSubImages() { 91 | return subImages; 92 | } 93 | 94 | public void setSubImages(String subImages) { 95 | this.subImages = subImages == null ? null : subImages.trim(); 96 | } 97 | 98 | public String getDetail() { 99 | return detail; 100 | } 101 | 102 | public void setDetail(String detail) { 103 | this.detail = detail == null ? null : detail.trim(); 104 | } 105 | 106 | public BigDecimal getPrice() { 107 | return price; 108 | } 109 | 110 | public void setPrice(BigDecimal price) { 111 | this.price = price; 112 | } 113 | 114 | public Integer getStock() { 115 | return stock; 116 | } 117 | 118 | public void setStock(Integer stock) { 119 | this.stock = stock; 120 | } 121 | 122 | public Integer getStatus() { 123 | return status; 124 | } 125 | 126 | public void setStatus(Integer status) { 127 | this.status = status; 128 | } 129 | 130 | public Date getCreateTime() { 131 | return createTime; 132 | } 133 | 134 | public void setCreateTime(Date createTime) { 135 | this.createTime = createTime; 136 | } 137 | 138 | public Date getUpdateTime() { 139 | return updateTime; 140 | } 141 | 142 | public void setUpdateTime(Date updateTime) { 143 | this.updateTime = updateTime; 144 | } 145 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/pojo/Shipping.java: -------------------------------------------------------------------------------- 1 | package com.mall.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class Shipping { 6 | private Integer id; 7 | 8 | private Integer userId; 9 | 10 | private String receiverName; 11 | 12 | private String receiverPhone; 13 | 14 | private String receiverMobile; 15 | 16 | private String receiverProvince; 17 | 18 | private String receiverCity; 19 | 20 | private String receiverDistrict; 21 | 22 | private String receiverAddress; 23 | 24 | private String receiverZip; 25 | 26 | private Date createTime; 27 | 28 | private Date updateTime; 29 | 30 | public Shipping(Integer id, Integer userId, String receiverName, String receiverPhone, String receiverMobile, String receiverProvince, String receiverCity, String receiverDistrict, String receiverAddress, String receiverZip, Date createTime, Date updateTime) { 31 | this.id = id; 32 | this.userId = userId; 33 | this.receiverName = receiverName; 34 | this.receiverPhone = receiverPhone; 35 | this.receiverMobile = receiverMobile; 36 | this.receiverProvince = receiverProvince; 37 | this.receiverCity = receiverCity; 38 | this.receiverDistrict = receiverDistrict; 39 | this.receiverAddress = receiverAddress; 40 | this.receiverZip = receiverZip; 41 | this.createTime = createTime; 42 | this.updateTime = updateTime; 43 | } 44 | 45 | public Shipping() { 46 | super(); 47 | } 48 | 49 | public Integer getId() { 50 | return id; 51 | } 52 | 53 | public void setId(Integer id) { 54 | this.id = id; 55 | } 56 | 57 | public Integer getUserId() { 58 | return userId; 59 | } 60 | 61 | public void setUserId(Integer userId) { 62 | this.userId = userId; 63 | } 64 | 65 | public String getReceiverName() { 66 | return receiverName; 67 | } 68 | 69 | public void setReceiverName(String receiverName) { 70 | this.receiverName = receiverName == null ? null : receiverName.trim(); 71 | } 72 | 73 | public String getReceiverPhone() { 74 | return receiverPhone; 75 | } 76 | 77 | public void setReceiverPhone(String receiverPhone) { 78 | this.receiverPhone = receiverPhone == null ? null : receiverPhone.trim(); 79 | } 80 | 81 | public String getReceiverMobile() { 82 | return receiverMobile; 83 | } 84 | 85 | public void setReceiverMobile(String receiverMobile) { 86 | this.receiverMobile = receiverMobile == null ? null : receiverMobile.trim(); 87 | } 88 | 89 | public String getReceiverProvince() { 90 | return receiverProvince; 91 | } 92 | 93 | public void setReceiverProvince(String receiverProvince) { 94 | this.receiverProvince = receiverProvince == null ? null : receiverProvince.trim(); 95 | } 96 | 97 | public String getReceiverCity() { 98 | return receiverCity; 99 | } 100 | 101 | public void setReceiverCity(String receiverCity) { 102 | this.receiverCity = receiverCity == null ? null : receiverCity.trim(); 103 | } 104 | 105 | public String getReceiverDistrict() { 106 | return receiverDistrict; 107 | } 108 | 109 | public void setReceiverDistrict(String receiverDistrict) { 110 | this.receiverDistrict = receiverDistrict == null ? null : receiverDistrict.trim(); 111 | } 112 | 113 | public String getReceiverAddress() { 114 | return receiverAddress; 115 | } 116 | 117 | public void setReceiverAddress(String receiverAddress) { 118 | this.receiverAddress = receiverAddress == null ? null : receiverAddress.trim(); 119 | } 120 | 121 | public String getReceiverZip() { 122 | return receiverZip; 123 | } 124 | 125 | public void setReceiverZip(String receiverZip) { 126 | this.receiverZip = receiverZip == null ? null : receiverZip.trim(); 127 | } 128 | 129 | public Date getCreateTime() { 130 | return createTime; 131 | } 132 | 133 | public void setCreateTime(Date createTime) { 134 | this.createTime = createTime; 135 | } 136 | 137 | public Date getUpdateTime() { 138 | return updateTime; 139 | } 140 | 141 | public void setUpdateTime(Date updateTime) { 142 | this.updateTime = updateTime; 143 | } 144 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/pojo/User.java: -------------------------------------------------------------------------------- 1 | package com.mall.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class User { 6 | private Integer id; 7 | 8 | private String username; 9 | 10 | private String password; 11 | 12 | private String email; 13 | 14 | private String phone; 15 | 16 | private String question; 17 | 18 | private String answer; 19 | 20 | private Integer role; 21 | 22 | private Date createTime; 23 | 24 | private Date updateTime; 25 | 26 | public User(Integer id, String username, String password, String email, String phone, String question, String answer, Integer role, Date createTime, Date updateTime) { 27 | this.id = id; 28 | this.username = username; 29 | this.password = password; 30 | this.email = email; 31 | this.phone = phone; 32 | this.question = question; 33 | this.answer = answer; 34 | this.role = role; 35 | this.createTime = createTime; 36 | this.updateTime = updateTime; 37 | } 38 | 39 | public User() { 40 | super(); 41 | } 42 | 43 | public Integer getId() { 44 | return id; 45 | } 46 | 47 | public void setId(Integer id) { 48 | this.id = id; 49 | } 50 | 51 | public String getUsername() { 52 | return username; 53 | } 54 | 55 | public void setUsername(String username) { 56 | this.username = username == null ? null : username.trim(); 57 | } 58 | 59 | public String getPassword() { 60 | return password; 61 | } 62 | 63 | public void setPassword(String password) { 64 | this.password = password == null ? null : password.trim(); 65 | } 66 | 67 | public String getEmail() { 68 | return email; 69 | } 70 | 71 | public void setEmail(String email) { 72 | this.email = email == null ? null : email.trim(); 73 | } 74 | 75 | public String getPhone() { 76 | return phone; 77 | } 78 | 79 | public void setPhone(String phone) { 80 | this.phone = phone == null ? null : phone.trim(); 81 | } 82 | 83 | public String getQuestion() { 84 | return question; 85 | } 86 | 87 | public void setQuestion(String question) { 88 | this.question = question == null ? null : question.trim(); 89 | } 90 | 91 | public String getAnswer() { 92 | return answer; 93 | } 94 | 95 | public void setAnswer(String answer) { 96 | this.answer = answer == null ? null : answer.trim(); 97 | } 98 | 99 | public Integer getRole() { 100 | return role; 101 | } 102 | 103 | public void setRole(Integer role) { 104 | this.role = role; 105 | } 106 | 107 | public Date getCreateTime() { 108 | return createTime; 109 | } 110 | 111 | public void setCreateTime(Date createTime) { 112 | this.createTime = createTime; 113 | } 114 | 115 | public Date getUpdateTime() { 116 | return updateTime; 117 | } 118 | 119 | public void setUpdateTime(Date updateTime) { 120 | this.updateTime = updateTime; 121 | } 122 | } -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/ICartService.java: -------------------------------------------------------------------------------- 1 | package com.mall.service; 2 | 3 | import com.mall.common.ServerResponse; 4 | import com.mall.vo.CartVo; 5 | 6 | /** 7 | * Created by 王乾 on 2017/12/22. 8 | */ 9 | public interface ICartService { 10 | 11 | ServerResponse add(Integer userId, Integer productId, Integer count); 12 | 13 | ServerResponse update(Integer userId,Integer productId,Integer count); 14 | 15 | ServerResponse deleteProduct(Integer userId,String productIds); 16 | 17 | ServerResponse list(Integer userId); 18 | 19 | ServerResponse selectOrUnselect(Integer userId,Integer productId,Integer checked); 20 | 21 | ServerResponse getCartProductCount(Integer userId); 22 | 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/ICategoryService.java: -------------------------------------------------------------------------------- 1 | package com.mall.service; 2 | 3 | import com.mall.common.ServerResponse; 4 | import com.mall.pojo.Category; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by 王乾 on 2017/12/19. 10 | */ 11 | public interface ICategoryService { 12 | 13 | ServerResponse addCategory(String categoryName, Integer parentId); 14 | 15 | ServerResponse updateCategoryName(Integer categoryId,String categoryName); 16 | 17 | ServerResponse> getChildrenParallelCategory(Integer categoryId); 18 | 19 | ServerResponse> selectCategoryAndChidrenById(Integer categoryId); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/IFileService.java: -------------------------------------------------------------------------------- 1 | package com.mall.service; 2 | 3 | import org.springframework.web.multipart.MultipartFile; 4 | 5 | /** 6 | * Created by 王乾 on 2017/12/21. 7 | */ 8 | public interface IFileService { 9 | 10 | String upload(MultipartFile file, String path); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/IOrderService.java: -------------------------------------------------------------------------------- 1 | package com.mall.service; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mall.common.ServerResponse; 5 | import com.mall.vo.OrderVo; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * Created by 王乾 on 2017/12/25. 11 | */ 12 | public interface IOrderService { 13 | 14 | ServerResponse pay(Long orderNo, Integer userId, String path); 15 | 16 | ServerResponse aliCallback(Map params ); 17 | 18 | ServerResponse queryOrderPayStatus(Integer userId,Long orderNo ); 19 | 20 | ServerResponse createOrder(Integer userId,Integer shippingId); 21 | 22 | ServerResponse cancel(Integer userId,Long orderNo); 23 | 24 | ServerResponse getOrderCartProduct(Integer userId); 25 | 26 | ServerResponse getOrderDetail(Integer userId, Long orderNo); 27 | 28 | ServerResponse getOrderList(Integer userId, int pageNum, int pageSize); 29 | 30 | ServerResponse manageList(int pageNum,int pageSize); 31 | 32 | ServerResponse manageDetail(Long orderNo); 33 | 34 | ServerResponse manageSendGoods(Long orderNo); 35 | 36 | ServerResponse manageSearch(Long orderNo,int pageNum,int pageSize); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/IProductService.java: -------------------------------------------------------------------------------- 1 | package com.mall.service; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mall.common.ServerResponse; 5 | import com.mall.pojo.Product; 6 | import com.mall.vo.ProductDetailVo; 7 | 8 | /** 9 | * Created by 王乾 on 2017/12/19. 10 | */ 11 | public interface IProductService { 12 | 13 | ServerResponse saveOrUpdateProduct(Product product); 14 | 15 | ServerResponse setSaleStatus(Integer productId,Integer status); 16 | 17 | ServerResponse manageProductDetail(Integer productId); 18 | 19 | ServerResponse getProductList(int pageNum, int pageSize); 20 | 21 | ServerResponse searchProduct(String productName,Integer productId,int pageNum,int pageSize); 22 | 23 | ServerResponse getProductDetail(Integer productId); 24 | 25 | ServerResponse getProductByKeywordCategory(String keyword,Integer categoryId,int pageNum,int pageSize,String orderBy); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/IShippingService.java: -------------------------------------------------------------------------------- 1 | package com.mall.service; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.mall.common.ServerResponse; 5 | import com.mall.pojo.Shipping; 6 | 7 | /** 8 | * Created by 王乾 on 2017/12/25. 9 | */ 10 | public interface IShippingService { 11 | 12 | ServerResponse add(Integer userId, Shipping shipping); 13 | 14 | ServerResponse del(Integer userId,Integer shippingId); 15 | 16 | ServerResponse update(Integer userId, Shipping shipping); 17 | 18 | ServerResponse select(Integer userId, Integer shippingId); 19 | 20 | ServerResponse list(Integer userId, int pageNum, int pageSize); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.mall.service; 2 | 3 | import com.mall.common.ServerResponse; 4 | import com.mall.pojo.User; 5 | 6 | /** 7 | * Created by 王乾 on 2017/12/10. 8 | */ 9 | public interface IUserService { 10 | ServerResponse login(String username, String password); 11 | 12 | ServerResponse register(User user); 13 | 14 | ServerResponse checkValid(String str,String type); 15 | 16 | ServerResponse selectQuestion(String username); 17 | 18 | ServerResponse checkAnswer(String username,String question,String answer); 19 | 20 | ServerResponse forgetResetPassword(String username,String passwordNew,String forgetToken); 21 | 22 | ServerResponse resetPassword(String passwordOld,String passwordNew,User user); 23 | 24 | ServerResponse updateInformation(User user); 25 | 26 | ServerResponse getInformation(Integer userId); 27 | 28 | ServerResponse checkAdminRole(User user); 29 | 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/impl/CartServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mall.service.impl; 2 | 3 | import com.google.common.base.Splitter; 4 | import com.google.common.collect.Lists; 5 | import com.mall.common.Const; 6 | import com.mall.common.ResponseCode; 7 | import com.mall.common.ServerResponse; 8 | import com.mall.dao.CartMapper; 9 | import com.mall.dao.ProductMapper; 10 | import com.mall.pojo.Cart; 11 | import com.mall.pojo.Product; 12 | import com.mall.service.ICartService; 13 | import com.mall.util.BigDecimalUtil; 14 | import com.mall.util.PropertiesUtil; 15 | import com.mall.vo.CartProductVo; 16 | import com.mall.vo.CartVo; 17 | import org.apache.commons.collections.CollectionUtils; 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.stereotype.Service; 20 | 21 | import java.math.BigDecimal; 22 | import java.util.List; 23 | 24 | /** 25 | * Created by 王乾 on 2017/12/22. 26 | */ 27 | @Service("iCartService") 28 | public class CartServiceImpl implements ICartService{ 29 | 30 | @Autowired 31 | private CartMapper cartMapper; 32 | @Autowired 33 | private ProductMapper productMapper; 34 | 35 | /** 36 | * 添加到购物车,物品不存在,插入数据库存在 数量相加,更新数据库 37 | * @param userId 38 | * @param productId 39 | * @param count 40 | * @return 41 | */ 42 | public ServerResponse add(Integer userId,Integer productId,Integer count){ 43 | if(productId == null || count == null){ 44 | return ServerResponse.createByErrorCodeMessage(ResponseCode.ILLEGAL_ARGUMENT.getCode(),ResponseCode.ILLEGAL_ARGUMENT.getDesc()); 45 | } 46 | 47 | Cart cart = cartMapper.selectByUserIdProductId(userId,productId); 48 | if(cart == null){ 49 | //购物车是没有这个物品的,需要添加 50 | Cart careItem = new Cart(); 51 | careItem.setQuantity(count); 52 | careItem.setChecked(Const.Cart.CHECKED); 53 | careItem.setProductId(productId); 54 | careItem.setUserId(userId); 55 | cartMapper.insert(careItem); 56 | }else{ 57 | //这个产品已经在购物车里面了 58 | //count相加 59 | count = cart.getQuantity() + count; 60 | cart.setQuantity(count); 61 | cartMapper.updateByPrimaryKeySelective(cart); 62 | } 63 | return this.list(userId); 64 | } 65 | 66 | /** 67 | * 更新购物车 68 | * @param userId 69 | * @param productId 70 | * @param count 71 | * @return 72 | */ 73 | public ServerResponse update(Integer userId,Integer productId,Integer count){ 74 | 75 | if(productId == null || count == null){ 76 | return ServerResponse.createByErrorCodeMessage(ResponseCode.ILLEGAL_ARGUMENT.getCode(),ResponseCode.ILLEGAL_ARGUMENT.getDesc()); 77 | } 78 | Cart cart = cartMapper.selectByUserIdProductId(userId,productId); 79 | if(cart != null){ 80 | cart.setQuantity(count); 81 | } 82 | cartMapper.updateByPrimaryKeySelective(cart); 83 | return this.list(userId); 84 | } 85 | 86 | /** 87 | * 删除物品 88 | * @param userId 89 | * @param productIds 90 | * @return 91 | */ 92 | public ServerResponse deleteProduct(Integer userId,String productIds){ 93 | //把字符串用逗号分开,添加到集合中,guava中 94 | List productList = Splitter.on(",").splitToList(productIds); 95 | if(CollectionUtils.isEmpty(productList)){ 96 | return ServerResponse.createByErrorCodeMessage(ResponseCode.ILLEGAL_ARGUMENT.getCode(),ResponseCode.ILLEGAL_ARGUMENT.getDesc()); 97 | } 98 | cartMapper.deleteByUserIdProductIds(userId,productList); 99 | return this.list(userId); 100 | } 101 | 102 | 103 | /** 104 | * 查询 105 | * @param userId 106 | * @return 107 | */ 108 | public ServerResponse list(Integer userId){ 109 | CartVo cartVo = this.getCartVoLimit(userId); 110 | return ServerResponse.createBySuccess(cartVo); 111 | } 112 | /** 113 | * 可以复用的 全选或者全不选,或者单个商品的全选全不选 114 | * @param userId 115 | * @param productId 116 | * @param checked 117 | * @return 118 | */ 119 | public ServerResponse selectOrUnselect(Integer userId,Integer productId,Integer checked){ 120 | cartMapper.checkedOrUncheckedProduct(userId,productId,checked); 121 | return this.list(userId); 122 | } 123 | 124 | /** 125 | * 购物车数量 126 | * @param userId 127 | * @return 128 | */ 129 | public ServerResponse getCartProductCount(Integer userId){ 130 | if(userId == null){ 131 | return ServerResponse.createBySuccess(0); 132 | } 133 | return ServerResponse.createBySuccess(cartMapper.selectCartProductCount(userId)); 134 | } 135 | 136 | /** 137 | * 整合拼接后的一个cartVo对象,这个对象将会获得一个完整的 关于某用户的购物车信息 138 | * 购物车里面的信息,是product和cart拼接起来的,所以要要建立一个vo对象 139 | * [注]:如果调用这个函数,传入的产品id是db里面没有的是会报错的。 140 | * @param userId 141 | * @return 142 | */ 143 | private CartVo getCartVoLimit(Integer userId){ 144 | CartVo cartVo = new CartVo(); 145 | List cartList = cartMapper.selectCartByUserId(userId); 146 | List cartProductVoList = Lists.newArrayList(); 147 | 148 | BigDecimal cartTotalPrice = new BigDecimal("0"); 149 | 150 | if(CollectionUtils.isNotEmpty(cartList)){ 151 | for(Cart cartItem : cartList ){ 152 | CartProductVo cartProductVo = new CartProductVo(); 153 | cartProductVo.setId(cartItem.getId()); 154 | cartProductVo.setUserId(userId); 155 | cartProductVo.setProductId(cartItem.getProductId()); 156 | 157 | Product product = productMapper.selectByPrimaryKey(cartItem.getProductId()); 158 | if (product != null) { 159 | cartProductVo.setProductMainImage(product.getMainImage()); 160 | cartProductVo.setProductName(product.getName()); 161 | cartProductVo.setProductSubtitle(product.getSubtitle()); 162 | cartProductVo.setProductStatus(product.getStatus()); 163 | cartProductVo.setProductPrice(product.getPrice()); 164 | cartProductVo.setProductStock(product.getStock()); 165 | //判断库存 166 | int buyLimitCount = 0; 167 | if(product.getStock() >= cartItem.getQuantity()){ 168 | //库存充足 169 | buyLimitCount = cartItem.getQuantity(); 170 | cartProductVo.setLimitQuantity(Const.Cart.LIMIT_NUM_SUCCESS); 171 | }else { 172 | buyLimitCount = product.getStock(); 173 | cartProductVo.setLimitQuantity(Const.Cart.LIMIT_NUM_FAIL); 174 | //库存中没那么多,必须连接数据库更新购物车中的库存 175 | Cart cartForQuantity = new Cart(); 176 | cartForQuantity.setId(cartItem.getId()); 177 | cartForQuantity.setQuantity(buyLimitCount); 178 | cartMapper.updateByPrimaryKeySelective(cartForQuantity); 179 | } 180 | cartProductVo.setQuantity(buyLimitCount); 181 | //计算总价 182 | cartProductVo.setProductTotalPrice(BigDecimalUtil.mul(product.getPrice().doubleValue(),cartProductVo.getQuantity())); 183 | cartProductVo.setProductChecked(cartItem.getChecked()); 184 | } 185 | if(cartItem.getChecked() == Const.Cart.CHECKED ){ 186 | System.out.println(cartTotalPrice.doubleValue()); 187 | System.out.println(cartProductVo.getProductTotalPrice().doubleValue()); 188 | //如果已经勾选,增加到整个购物车总价之中 189 | cartTotalPrice = BigDecimalUtil.add(cartTotalPrice.doubleValue(),cartProductVo.getProductTotalPrice().doubleValue()); 190 | } 191 | cartProductVoList.add(cartProductVo); 192 | } 193 | } 194 | cartVo.setCartTotalPrice(cartTotalPrice); 195 | cartVo.setCartProductVoList(cartProductVoList); 196 | cartVo.setAllChecked(getAllCheckedStatus(userId)); 197 | cartVo.setImageHost(PropertiesUtil.getProperty("ftp.server.http.prefix")); 198 | 199 | return cartVo; 200 | } 201 | 202 | 203 | 204 | //返回此用户的allChecked 是不是全选中 205 | private boolean getAllCheckedStatus(Integer userId){ 206 | if(userId == null){ 207 | return false; 208 | } 209 | return cartMapper.selectCartProductCheckedStatusByUserId(userId) == 0; 210 | } 211 | 212 | 213 | } 214 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/impl/CategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mall.service.impl; 2 | 3 | import com.google.common.collect.Lists; 4 | import com.google.common.collect.Sets; 5 | import com.mall.common.ServerResponse; 6 | import com.mall.dao.CategoryMapper; 7 | import com.mall.pojo.Category; 8 | import com.mall.service.ICategoryService; 9 | import org.apache.commons.collections.CollectionUtils; 10 | import org.apache.commons.lang3.StringUtils; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Service; 15 | 16 | import java.util.List; 17 | import java.util.Set; 18 | 19 | /** 20 | * Created by 王乾 on 2017/12/19. 21 | */ 22 | @Service("iCategoryService") 23 | public class CategoryServiceImpl implements ICategoryService { 24 | 25 | private Logger logger = LoggerFactory.getLogger(CategoryServiceImpl.class); 26 | 27 | @Autowired 28 | private CategoryMapper categoryMapper; 29 | 30 | /** 31 | * 添加品类 32 | * @param categoryName 33 | * @param parentId 34 | * @return 35 | */ 36 | public ServerResponse addCategory(String categoryName,Integer parentId){ 37 | if(parentId == null || StringUtils.isBlank(categoryName)){ 38 | return ServerResponse.createByErrorMessage("添加品类参数错误"); 39 | } 40 | Category category = new Category(); 41 | category.setName(categoryName); 42 | category.setParentId(parentId); 43 | category.setStatus(true);//这个分类是可用的 44 | 45 | int rowCount = categoryMapper.insert(category); 46 | if(rowCount > 0 ){ 47 | return ServerResponse.createBySuccess("添加品类成功"); 48 | } 49 | return ServerResponse.createByErrorMessage("添加品类失败"); 50 | } 51 | 52 | /** 53 | * 后台,更新品类名字 54 | * @param categoryId 55 | * @param categoryName 56 | * @return 57 | */ 58 | public ServerResponse updateCategoryName(Integer categoryId,String categoryName){ 59 | if(categoryId == null || StringUtils.isBlank(categoryName)){ 60 | return ServerResponse.createByErrorMessage("更新品类参数错误"); 61 | } 62 | Category category = new Category(); 63 | category.setId(categoryId); 64 | category.setName(categoryName); 65 | 66 | int rowCount = categoryMapper.updateByPrimaryKeySelective(category); 67 | if(rowCount > 0 ){ 68 | return ServerResponse.createBySuccess("更新品类名字成功"); 69 | } 70 | return ServerResponse.createByErrorMessage("更新品类名字失败"); 71 | } 72 | 73 | /** 74 | * 后台,查询当前节点子节点的平级孩子的信息,不递归 75 | * @param categoryId 76 | * @return 77 | */ 78 | public ServerResponse> getChildrenParallelCategory(Integer categoryId){ 79 | List categoryList = categoryMapper.selectCategoryChildrenByParentId(categoryId); 80 | if(CollectionUtils.isEmpty(categoryList)){ 81 | logger.info("未找到当前分类的子分类"); 82 | } 83 | return ServerResponse.createBySuccess(categoryList); 84 | } 85 | 86 | /** 87 | * 获得当前id 和下面的子节点等后代的 id(递归) 88 | * @param categoryId 89 | * @return 90 | */ 91 | public ServerResponse> selectCategoryAndChidrenById(Integer categoryId){ 92 | //初始化Set集合,运行递归算法 把结果集填入categorySet中 93 | Set categorySet = Sets.newHashSet(); 94 | findChildCategory(categorySet,categoryId); 95 | //把categorySert中得到的子节点的id放入categoryList中 96 | List categoryIdList = Lists.newArrayList(); 97 | if(categoryId != null){ 98 | for(Category categoryItem : categorySet){ 99 | categoryIdList.add(categoryItem.getId()); 100 | } 101 | } 102 | return ServerResponse.createBySuccess(categoryIdList); 103 | } 104 | 105 | //递归算法,算出子节点(需要重写category的hashcode) 106 | private Set findChildCategory(Set categorySet,Integer categoryId){ 107 | Category category = categoryMapper.selectByPrimaryKey(categoryId); 108 | if(category != null){ 109 | categorySet.add(category); 110 | } 111 | //查找子节点,递归算法一定要有一个退出的条件 112 | List categoryList = categoryMapper.selectCategoryChildrenByParentId(categoryId); 113 | //categoryList为空的话进不去下面的for循环 114 | for(Category categoryItem : categoryList){ 115 | findChildCategory(categorySet,categoryItem.getId()); 116 | } 117 | return categorySet; 118 | } 119 | 120 | 121 | } 122 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/impl/FileServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mall.service.impl; 2 | 3 | import com.google.common.collect.Lists; 4 | import com.mall.service.IFileService; 5 | import com.mall.util.FTPUtil; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.web.multipart.MultipartFile; 10 | 11 | import java.io.File; 12 | import java.io.IOException; 13 | import java.util.UUID; 14 | 15 | /** 16 | * Created by 王乾 on 2017/12/21. 17 | */ 18 | @Service("iFileService") 19 | public class FileServiceImpl implements IFileService { 20 | 21 | private static Logger logger = LoggerFactory.getLogger(FileServiceImpl.class); 22 | 23 | /** 24 | * 文件上传 25 | * @param file 26 | * @param path 27 | * @return 28 | */ 29 | public String upload(MultipartFile file,String path){ 30 | String fileName = file.getOriginalFilename(); 31 | //扩展名 32 | String fileExtensionName = fileName.substring(fileName.lastIndexOf(".")+1); 33 | String uploadFileName = UUID.randomUUID().toString()+"."+fileExtensionName; 34 | logger.info("文件开始上传,上传文件的文件名:{},上传的路径为:{},新文件名为:{}",fileName,path,uploadFileName); 35 | 36 | File fileDir = new File(path); 37 | if(!fileDir.exists()){ 38 | fileDir.setWritable(true); 39 | fileDir.mkdirs(); 40 | } 41 | File targetFile = new File(path,uploadFileName); 42 | 43 | try { 44 | file.transferTo(targetFile); 45 | // 文件已经上传成功了 46 | FTPUtil.uploadFile(Lists.newArrayList(targetFile)); 47 | // 已经targetFile上传到FTP服务器上面 48 | targetFile.delete(); 49 | //上传完后,删除upload下面的文件 50 | 51 | } catch (IOException e) { 52 | logger.error("文件上传异常",e); 53 | return null; 54 | } 55 | return targetFile.getName(); 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/service/impl/ShippingServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mall.service.impl; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.google.common.collect.Maps; 6 | import com.mall.common.ServerResponse; 7 | import com.mall.dao.ShippingMapper; 8 | import com.mall.pojo.Shipping; 9 | import com.mall.service.IShippingService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | /** 17 | * Created by 王乾 on 2017/12/25. 18 | */ 19 | @Service("iShippingService") 20 | public class ShippingServiceImpl implements IShippingService { 21 | 22 | @Autowired 23 | private ShippingMapper shippingMapper; 24 | 25 | /** 26 | * 新建收货地址 27 | * @param userId 28 | * @param shipping 29 | * @return 30 | */ 31 | public ServerResponse add(Integer userId, Shipping shipping){ 32 | shipping.setUserId(userId); 33 | int rowCount = shippingMapper.insert(shipping); 34 | if(rowCount > 0){ 35 | Map result = Maps.newHashMap(); 36 | result.put("shippingId",shipping.getId()); 37 | return ServerResponse.createBySuccess("新建地址成功",result); 38 | } 39 | return ServerResponse.createByErrorMessage("新建地址创建失败"); 40 | } 41 | 42 | /** 43 | * 删除收获地址,要防止横向越权 44 | * @param userId 45 | * @param shippingId 46 | * @return 47 | */ 48 | public ServerResponse del(Integer userId,Integer shippingId){ 49 | int resultCount = shippingMapper.deleteByShippingIdUserId(userId,shippingId); 50 | if(resultCount > 0){ 51 | return ServerResponse.createBySuccess("删除地址成功"); 52 | } 53 | return ServerResponse.createByErrorMessage("删除地址创建失败"); 54 | } 55 | 56 | /** 57 | * 更新收获地址 58 | * @param userId 59 | * @param shipping 60 | * @return 61 | */ 62 | public ServerResponse update(Integer userId, Shipping shipping){ 63 | shipping.setUserId(userId); 64 | int rowCount = shippingMapper.updateByShipping(shipping); 65 | if(rowCount > 0){ 66 | return ServerResponse.createBySuccess("更新地址成功"); 67 | } 68 | return ServerResponse.createByErrorMessage("更新地址创建失败"); 69 | } 70 | 71 | /** 72 | * 查询地址 73 | * @param userId 74 | * @param shippingId 75 | * @return 76 | */ 77 | public ServerResponse select(Integer userId, Integer shippingId){ 78 | Shipping shipping = shippingMapper.selectByShippingIdUserId(userId,shippingId); 79 | if(shipping == null){ 80 | return ServerResponse.createByErrorMessage("无法查询到该地址"); 81 | } 82 | return ServerResponse.createBySuccess("查询地址成功",shipping); 83 | } 84 | 85 | /** 86 | * 获取用户的所有地址 87 | * @param userId 88 | * @param pageNum 89 | * @param pageSize 90 | * @return 91 | */ 92 | public ServerResponse list(Integer userId,int pageNum,int pageSize){ 93 | PageHelper.startPage(pageNum,pageSize); 94 | List shippingList = shippingMapper.selectByUserId(userId); 95 | PageInfo pageInfo = new PageInfo(shippingList); 96 | return ServerResponse.createBySuccess(pageInfo); 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/util/BigDecimalUtil.java: -------------------------------------------------------------------------------- 1 | package com.mall.util; 2 | 3 | import java.math.BigDecimal; 4 | 5 | /** 6 | * Created by 王乾 on 2017/12/22. 7 | */ 8 | public class BigDecimalUtil { 9 | 10 | /** 11 | * 防止丢失精度的一个工具类 12 | */ 13 | private BigDecimalUtil(){ 14 | 15 | } 16 | //+ 17 | public static BigDecimal add(double v1,double v2){ 18 | BigDecimal b1 = new BigDecimal(Double.toString(v1)); 19 | BigDecimal b2 = new BigDecimal(Double.toString(v2)); 20 | return b1.add(b2); 21 | } 22 | //- 23 | public static BigDecimal sub(double v1,double v2){ 24 | BigDecimal b1 = new BigDecimal(Double.toString(v1)); 25 | BigDecimal b2 = new BigDecimal(Double.toString(v2)); 26 | return b1.subtract(b2); 27 | } 28 | //* 29 | public static BigDecimal mul(double v1,double v2){ 30 | BigDecimal b1 = new BigDecimal(Double.toString(v1)); 31 | BigDecimal b2 = new BigDecimal(Double.toString(v2)); 32 | return b1.multiply(b2); 33 | } 34 | /// 35 | public static BigDecimal div(double v1,double v2){ 36 | BigDecimal b1 = new BigDecimal(Double.toString(v1)); 37 | BigDecimal b2 = new BigDecimal(Double.toString(v2)); 38 | return b1.divide(b2,2,BigDecimal.ROUND_HALF_UP);//4舍5入,保留两位位小数 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/util/DateTimeUtil.java: -------------------------------------------------------------------------------- 1 | package com.mall.util; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | import org.joda.time.DateTime; 5 | import org.joda.time.format.DateTimeFormat; 6 | import org.joda.time.format.DateTimeFormatter; 7 | 8 | 9 | import java.util.Date; 10 | 11 | /** 12 | * Created by 王乾 on 2017/12/19. 13 | */ 14 | public class DateTimeUtil { 15 | 16 | //joda-time 17 | 18 | //String -> Date 19 | //Date -> String 20 | public static final String STANDARD_FORMAT = "yyyy-MM-dd HH:mm:ss"; 21 | 22 | public static Date strToDate(String dateTimeStr,String formatStr){ 23 | DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(formatStr); 24 | DateTime dateTime = dateTimeFormatter.parseDateTime(dateTimeStr); 25 | return dateTime.toDate(); 26 | } 27 | 28 | public static String dateToStr(Date date,String formatStr){ 29 | if(date == null){ 30 | return StringUtils.EMPTY; 31 | } 32 | DateTime dateTime = new DateTime(date); 33 | return dateTime.toString(formatStr); 34 | } 35 | public static Date strToDate(String dateTimeStr){ 36 | DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(STANDARD_FORMAT); 37 | DateTime dateTime = dateTimeFormatter.parseDateTime(dateTimeStr); 38 | return dateTime.toDate(); 39 | } 40 | public static String dateToStr(Date date){ 41 | if(date == null){ 42 | return StringUtils.EMPTY; 43 | } 44 | DateTime dateTime = new DateTime(date); 45 | return dateTime.toString(STANDARD_FORMAT); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/util/FTPUtil.java: -------------------------------------------------------------------------------- 1 | package com.mall.util; 2 | 3 | import org.apache.commons.net.ftp.FTPClient; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | import java.io.File; 8 | import java.io.FileInputStream; 9 | import java.io.IOException; 10 | import java.util.List; 11 | 12 | /** 13 | * Created by 王乾 on 2017/12/21. 14 | * 接受List集合,把list上传到自定义的ftp服务器上面去 15 | */ 16 | public class FTPUtil { 17 | 18 | private static Logger logger = LoggerFactory.getLogger(FTPUtil.class); 19 | 20 | private static String ftpIp = PropertiesUtil.getProperty("ftp.server.ip"); 21 | private static String ftpUser = PropertiesUtil.getProperty("ftp.user"); 22 | private static String ftpPass = PropertiesUtil.getProperty("ftp.pass"); 23 | 24 | public FTPUtil(String ip,int port,String user,String pwd){ 25 | this.ip = ip; 26 | this.port = port; 27 | this.user = user; 28 | this.pwd = pwd; 29 | } 30 | 31 | //对面开放的upload方法 32 | public static boolean uploadFile(List fileList) throws IOException { 33 | FTPUtil ftpUtil = new FTPUtil(ftpIp,21,ftpUser,ftpPass); 34 | logger.info("开始连接ftp服务器"); 35 | boolean result = ftpUtil.uploadFile("img",fileList); 36 | logger.info("开始连接ftp服务器,结束上传,上传结果:{}",result); 37 | return result; 38 | } 39 | 40 | private boolean uploadFile(String remotePath,List fileList) throws IOException { 41 | boolean uploaded = true; 42 | FileInputStream fis = null; 43 | //连接ftp服务器 44 | if(connectServer(this.ip,this.port,this.user,this.pwd)){ 45 | try { 46 | ftpClient.changeWorkingDirectory(remotePath); 47 | ftpClient.setBufferSize(1024); 48 | ftpClient.setControlEncoding("UTF-8"); 49 | ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE); 50 | ftpClient.enterLocalPassiveMode(); 51 | for(File fileItem : fileList){ 52 | fis = new FileInputStream(fileItem); 53 | ftpClient.storeFile(fileItem.getName(),fis); 54 | } 55 | } catch (IOException e) { 56 | logger.error("上传文件到ftp服务器异常",e); 57 | uploaded = false; 58 | e.printStackTrace(); 59 | }finally { 60 | fis.close(); 61 | ftpClient.disconnect(); 62 | } 63 | } 64 | return uploaded; 65 | } 66 | 67 | //链接ftp 68 | private boolean connectServer(String ip,int port,String user,String pwd){ 69 | boolean isSuccess = false; 70 | ftpClient = new FTPClient(); 71 | try { 72 | ftpClient.connect(ip); 73 | isSuccess = ftpClient.login(user,pwd); 74 | } catch (IOException e){ 75 | logger.error("连接FTP服务器异常",e); 76 | e.printStackTrace(); 77 | } 78 | return isSuccess; 79 | } 80 | 81 | private String ip; 82 | private int port; 83 | private String user; 84 | private String pwd; 85 | private FTPClient ftpClient; 86 | 87 | public String getIp() { 88 | return ip; 89 | } 90 | 91 | public void setIp(String ip) { 92 | this.ip = ip; 93 | } 94 | 95 | public int getPort() { 96 | return port; 97 | } 98 | 99 | public void setPort(int port) { 100 | this.port = port; 101 | } 102 | 103 | public String getUser() { 104 | return user; 105 | } 106 | 107 | public void setUser(String user) { 108 | this.user = user; 109 | } 110 | 111 | public String getPwd() { 112 | return pwd; 113 | } 114 | 115 | public void setPwd(String pwd) { 116 | this.pwd = pwd; 117 | } 118 | 119 | public FTPClient getFtpClient() { 120 | return ftpClient; 121 | } 122 | 123 | public void setFtpClient(FTPClient ftpClient) { 124 | this.ftpClient = ftpClient; 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/util/MD5Util.java: -------------------------------------------------------------------------------- 1 | package com.mall.util; 2 | 3 | import org.springframework.util.StringUtils; 4 | 5 | import java.security.MessageDigest; 6 | 7 | /** 8 | * Created by qian 9 | */ 10 | public class MD5Util { 11 | 12 | private static String byteArrayToHexString(byte b[]) { 13 | StringBuffer resultSb = new StringBuffer(); 14 | for (int i = 0; i < b.length; i++) 15 | resultSb.append(byteToHexString(b[i])); 16 | 17 | return resultSb.toString(); 18 | } 19 | 20 | private static String byteToHexString(byte b) { 21 | int n = b; 22 | if (n < 0) 23 | n += 256; 24 | int d1 = n / 16; 25 | int d2 = n % 16; 26 | return hexDigits[d1] + hexDigits[d2]; 27 | } 28 | 29 | /** 30 | * 返回大写MD5 31 | * 32 | * @param origin 33 | * @param charsetname 34 | * @return 35 | */ 36 | private static String MD5Encode(String origin, String charsetname) { 37 | String resultString = null; 38 | try { 39 | resultString = new String(origin); 40 | MessageDigest md = MessageDigest.getInstance("MD5"); 41 | if (charsetname == null || "".equals(charsetname)) 42 | resultString = byteArrayToHexString(md.digest(resultString.getBytes())); 43 | else 44 | resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname))); 45 | } catch (Exception exception) { 46 | } 47 | return resultString.toUpperCase(); 48 | } 49 | 50 | public static String MD5EncodeUtf8(String origin) { 51 | origin = origin + PropertiesUtil.getProperty("password.salt", ""); 52 | return MD5Encode(origin, "utf-8"); 53 | } 54 | 55 | 56 | private static final String hexDigits[] = {"0", "1", "2", "3", "4", "5", 57 | "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/util/PropertiesUtil.java: -------------------------------------------------------------------------------- 1 | package com.mall.util; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | import java.io.IOException; 8 | import java.io.InputStreamReader; 9 | import java.util.Properties; 10 | 11 | /** 12 | * Created by qian 13 | */ 14 | public class PropertiesUtil { 15 | 16 | private static Logger logger = LoggerFactory.getLogger(PropertiesUtil.class); 17 | 18 | private static Properties props; 19 | 20 | static { 21 | String fileName = "mmall.properties"; 22 | props = new Properties(); 23 | try { 24 | props.load(new InputStreamReader(PropertiesUtil.class.getClassLoader().getResourceAsStream(fileName),"UTF-8")); 25 | } catch (IOException e) { 26 | logger.error("配置文件读取异常",e); 27 | } 28 | } 29 | 30 | public static String getProperty(String key){ 31 | String value = props.getProperty(key.trim()); 32 | if(StringUtils.isBlank(value)){ 33 | return null; 34 | } 35 | return value.trim(); 36 | } 37 | 38 | public static String getProperty(String key,String defaultValue){ 39 | 40 | String value = props.getProperty(key.trim()); 41 | if(StringUtils.isBlank(value)){ 42 | value = defaultValue; 43 | } 44 | return value.trim(); 45 | } 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/vo/CartProductVo.java: -------------------------------------------------------------------------------- 1 | package com.mall.vo; 2 | 3 | import java.math.BigDecimal; 4 | 5 | /** 6 | * Created by 王乾 on 2017/12/22. 7 | */ 8 | public class CartProductVo { 9 | 10 | //结合了产品和购物车的一个抽象对象 11 | 12 | private Integer id; 13 | private Integer userId; 14 | private Integer productId; 15 | private Integer quantity;//购物车中此物品的数量 16 | private String productName; 17 | private String productSubtitle; 18 | private String productMainImage; 19 | private BigDecimal productPrice; 20 | private Integer productStatus; 21 | private BigDecimal productTotalPrice; 22 | private Integer productStock;//库存 23 | private Integer productChecked;//此商品是否勾选 24 | 25 | private String limitQuantity;//限制数量的一个返回结果 26 | 27 | public Integer getProductChecked() { 28 | return productChecked; 29 | } 30 | 31 | public void setProductChecked(Integer productChecked) { 32 | this.productChecked = productChecked; 33 | } 34 | 35 | public Integer getId() { 36 | return id; 37 | } 38 | 39 | public void setId(Integer id) { 40 | this.id = id; 41 | } 42 | 43 | public Integer getUserId() { 44 | return userId; 45 | } 46 | 47 | public void setUserId(Integer userId) { 48 | this.userId = userId; 49 | } 50 | 51 | public Integer getProductId() { 52 | return productId; 53 | } 54 | 55 | public void setProductId(Integer productId) { 56 | this.productId = productId; 57 | } 58 | 59 | public Integer getQuantity() { 60 | return quantity; 61 | } 62 | 63 | public void setQuantity(Integer quantity) { 64 | this.quantity = quantity; 65 | } 66 | 67 | public String getProductName() { 68 | return productName; 69 | } 70 | 71 | public void setProductName(String productName) { 72 | this.productName = productName; 73 | } 74 | 75 | public String getProductSubtitle() { 76 | return productSubtitle; 77 | } 78 | 79 | public void setProductSubtitle(String productSubtitle) { 80 | this.productSubtitle = productSubtitle; 81 | } 82 | 83 | public String getProductMainImage() { 84 | return productMainImage; 85 | } 86 | 87 | public void setProductMainImage(String productMainImage) { 88 | this.productMainImage = productMainImage; 89 | } 90 | 91 | public BigDecimal getProductPrice() { 92 | return productPrice; 93 | } 94 | 95 | public void setProductPrice(BigDecimal productPrice) { 96 | this.productPrice = productPrice; 97 | } 98 | 99 | public Integer getProductStatus() { 100 | return productStatus; 101 | } 102 | 103 | public void setProductStatus(Integer productStatus) { 104 | this.productStatus = productStatus; 105 | } 106 | 107 | public BigDecimal getProductTotalPrice() { 108 | return productTotalPrice; 109 | } 110 | 111 | public void setProductTotalPrice(BigDecimal productTotalPrice) { 112 | this.productTotalPrice = productTotalPrice; 113 | } 114 | 115 | public Integer getProductStock() { 116 | return productStock; 117 | } 118 | 119 | public void setProductStock(Integer productStock) { 120 | this.productStock = productStock; 121 | } 122 | 123 | public String getLimitQuantity() { 124 | return limitQuantity; 125 | } 126 | 127 | public void setLimitQuantity(String limitQuantity) { 128 | this.limitQuantity = limitQuantity; 129 | } 130 | 131 | 132 | 133 | 134 | } 135 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/vo/CartVo.java: -------------------------------------------------------------------------------- 1 | package com.mall.vo; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by 王乾 on 2017/12/22. 8 | */ 9 | public class CartVo { 10 | 11 | private List cartProductVoList; 12 | private BigDecimal cartTotalPrice; 13 | private Boolean allChecked;//全部勾选 14 | private String imageHost; 15 | 16 | public List getCartProductVoList() { 17 | return cartProductVoList; 18 | } 19 | 20 | public void setCartProductVoList(List cartProductVoList) { 21 | this.cartProductVoList = cartProductVoList; 22 | } 23 | 24 | public BigDecimal getCartTotalPrice() { 25 | return cartTotalPrice; 26 | } 27 | 28 | public void setCartTotalPrice(BigDecimal cartTotalPrice) { 29 | this.cartTotalPrice = cartTotalPrice; 30 | } 31 | 32 | public Boolean getAllChecked() { 33 | return allChecked; 34 | } 35 | 36 | public void setAllChecked(Boolean allChecked) { 37 | this.allChecked = allChecked; 38 | } 39 | 40 | public String getImageHost() { 41 | return imageHost; 42 | } 43 | 44 | public void setImageHost(String imageHost) { 45 | this.imageHost = imageHost; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/vo/OrderItemVo.java: -------------------------------------------------------------------------------- 1 | package com.mall.vo; 2 | 3 | import java.math.BigDecimal; 4 | 5 | /** 6 | * Created by 王乾 on 2017/12/26. 7 | */ 8 | public class OrderItemVo { 9 | 10 | private Long orderNo; 11 | 12 | private Integer productId; 13 | 14 | private String productName; 15 | private String productImage; 16 | 17 | private BigDecimal currentUnitPrice; 18 | 19 | private Integer quantity; 20 | 21 | private BigDecimal totalPrice; 22 | 23 | private String createTime; 24 | 25 | public Long getOrderNo() { 26 | return orderNo; 27 | } 28 | 29 | public void setOrderNo(Long orderNo) { 30 | this.orderNo = orderNo; 31 | } 32 | 33 | public Integer getProductId() { 34 | return productId; 35 | } 36 | 37 | public void setProductId(Integer productId) { 38 | this.productId = productId; 39 | } 40 | 41 | public String getProductName() { 42 | return productName; 43 | } 44 | 45 | public void setProductName(String productName) { 46 | this.productName = productName; 47 | } 48 | 49 | public String getProductImage() { 50 | return productImage; 51 | } 52 | 53 | public void setProductImage(String productImage) { 54 | this.productImage = productImage; 55 | } 56 | 57 | public BigDecimal getCurrentUnitPrice() { 58 | return currentUnitPrice; 59 | } 60 | 61 | public void setCurrentUnitPrice(BigDecimal currentUnitPrice) { 62 | this.currentUnitPrice = currentUnitPrice; 63 | } 64 | 65 | public Integer getQuantity() { 66 | return quantity; 67 | } 68 | 69 | public void setQuantity(Integer quantity) { 70 | this.quantity = quantity; 71 | } 72 | 73 | public BigDecimal getTotalPrice() { 74 | return totalPrice; 75 | } 76 | 77 | public void setTotalPrice(BigDecimal totalPrice) { 78 | this.totalPrice = totalPrice; 79 | } 80 | 81 | public String getCreateTime() { 82 | return createTime; 83 | } 84 | 85 | public void setCreateTime(String createTime) { 86 | this.createTime = createTime; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/vo/OrderProductVo.java: -------------------------------------------------------------------------------- 1 | package com.mall.vo; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by 王乾 on 2017/12/26. 8 | */ 9 | public class OrderProductVo { 10 | 11 | private List orderItemVoList; 12 | private BigDecimal productTotalPrice; 13 | private String imageHost; 14 | 15 | public List getOrderItemVoList() { 16 | return orderItemVoList; 17 | } 18 | 19 | public void setOrderItemVoList(List orderItemVoList) { 20 | this.orderItemVoList = orderItemVoList; 21 | } 22 | 23 | public BigDecimal getProductTotalPrice() { 24 | return productTotalPrice; 25 | } 26 | 27 | public void setProductTotalPrice(BigDecimal productTotalPrice) { 28 | this.productTotalPrice = productTotalPrice; 29 | } 30 | 31 | public String getImageHost() { 32 | return imageHost; 33 | } 34 | 35 | public void setImageHost(String imageHost) { 36 | this.imageHost = imageHost; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/vo/OrderVo.java: -------------------------------------------------------------------------------- 1 | package com.mall.vo; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by 王乾 on 2017/12/26. 8 | */ 9 | public class OrderVo { 10 | 11 | 12 | private Long orderNo; 13 | 14 | private BigDecimal payment; 15 | 16 | private Integer paymentType; 17 | 18 | private String paymentTypeDesc; 19 | private Integer postage; 20 | 21 | private Integer status; 22 | 23 | 24 | private String statusDesc; 25 | 26 | private String paymentTime; 27 | 28 | private String sendTime; 29 | 30 | private String endTime; 31 | 32 | private String closeTime; 33 | 34 | private String createTime; 35 | 36 | //订单的明细 37 | private List orderItemVoList; 38 | 39 | private String imageHost; 40 | private Integer shippingId; 41 | private String receiverName; 42 | 43 | private ShippingVo shippingVo; 44 | 45 | public Long getOrderNo() { 46 | return orderNo; 47 | } 48 | 49 | public void setOrderNo(Long orderNo) { 50 | this.orderNo = orderNo; 51 | } 52 | 53 | public BigDecimal getPayment() { 54 | return payment; 55 | } 56 | 57 | public void setPayment(BigDecimal payment) { 58 | this.payment = payment; 59 | } 60 | 61 | public Integer getPaymentType() { 62 | return paymentType; 63 | } 64 | 65 | public void setPaymentType(Integer paymentType) { 66 | this.paymentType = paymentType; 67 | } 68 | 69 | public String getPaymentTypeDesc() { 70 | return paymentTypeDesc; 71 | } 72 | 73 | public void setPaymentTypeDesc(String paymentTypeDesc) { 74 | this.paymentTypeDesc = paymentTypeDesc; 75 | } 76 | 77 | public Integer getPostage() { 78 | return postage; 79 | } 80 | 81 | public void setPostage(Integer postage) { 82 | this.postage = postage; 83 | } 84 | 85 | public Integer getStatus() { 86 | return status; 87 | } 88 | 89 | public void setStatus(Integer status) { 90 | this.status = status; 91 | } 92 | 93 | public String getStatusDesc() { 94 | return statusDesc; 95 | } 96 | 97 | public void setStatusDesc(String statusDesc) { 98 | this.statusDesc = statusDesc; 99 | } 100 | 101 | public String getPaymentTime() { 102 | return paymentTime; 103 | } 104 | 105 | public void setPaymentTime(String paymentTime) { 106 | this.paymentTime = paymentTime; 107 | } 108 | 109 | public String getSendTime() { 110 | return sendTime; 111 | } 112 | 113 | public void setSendTime(String sendTime) { 114 | this.sendTime = sendTime; 115 | } 116 | 117 | public String getEndTime() { 118 | return endTime; 119 | } 120 | 121 | public void setEndTime(String endTime) { 122 | this.endTime = endTime; 123 | } 124 | 125 | public String getCloseTime() { 126 | return closeTime; 127 | } 128 | 129 | public void setCloseTime(String closeTime) { 130 | this.closeTime = closeTime; 131 | } 132 | 133 | public String getCreateTime() { 134 | return createTime; 135 | } 136 | 137 | public void setCreateTime(String createTime) { 138 | this.createTime = createTime; 139 | } 140 | 141 | public List getOrderItemVoList() { 142 | return orderItemVoList; 143 | } 144 | 145 | public void setOrderItemVoList(List orderItemVoList) { 146 | this.orderItemVoList = orderItemVoList; 147 | } 148 | 149 | public String getImageHost() { 150 | return imageHost; 151 | } 152 | 153 | public void setImageHost(String imageHost) { 154 | this.imageHost = imageHost; 155 | } 156 | 157 | public Integer getShippingId() { 158 | return shippingId; 159 | } 160 | 161 | public void setShippingId(Integer shippingId) { 162 | this.shippingId = shippingId; 163 | } 164 | 165 | public String getReceiverName() { 166 | return receiverName; 167 | } 168 | 169 | public void setReceiverName(String receiverName) { 170 | this.receiverName = receiverName; 171 | } 172 | 173 | public ShippingVo getShippingVo() { 174 | return shippingVo; 175 | } 176 | 177 | public void setShippingVo(ShippingVo shippingVo) { 178 | this.shippingVo = shippingVo; 179 | } 180 | 181 | 182 | } 183 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/vo/ProductDetailVo.java: -------------------------------------------------------------------------------- 1 | package com.mall.vo; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Date; 5 | 6 | /** 7 | * Created by 王乾 on 2017/12/19. 8 | */ 9 | public class ProductDetailVo { 10 | private Integer id; 11 | 12 | private Integer categoryId; 13 | 14 | private String name; 15 | 16 | private String subtitle; 17 | 18 | private String mainImage; 19 | 20 | private String subImages; 21 | 22 | private String detail; 23 | 24 | private BigDecimal price; 25 | 26 | private Integer stock; 27 | 28 | private Integer status; 29 | 30 | private String createTime; 31 | 32 | private String updateTime; 33 | 34 | private String imageHost; 35 | private Integer parentCategoryId; 36 | 37 | public Integer getId() { 38 | return id; 39 | } 40 | 41 | public void setId(Integer id) { 42 | this.id = id; 43 | } 44 | 45 | public Integer getCategoryId() { 46 | return categoryId; 47 | } 48 | 49 | public void setCategoryId(Integer categoryId) { 50 | this.categoryId = categoryId; 51 | } 52 | 53 | public String getName() { 54 | return name; 55 | } 56 | 57 | public void setName(String name) { 58 | this.name = name; 59 | } 60 | 61 | public String getSubtitle() { 62 | return subtitle; 63 | } 64 | 65 | public void setSubtitle(String subtitle) { 66 | this.subtitle = subtitle; 67 | } 68 | 69 | public String getMainImage() { 70 | return mainImage; 71 | } 72 | 73 | public void setMainImage(String mainImage) { 74 | this.mainImage = mainImage; 75 | } 76 | 77 | public String getSubImages() { 78 | return subImages; 79 | } 80 | 81 | public void setSubImages(String subImages) { 82 | this.subImages = subImages; 83 | } 84 | 85 | public String getDetail() { 86 | return detail; 87 | } 88 | 89 | public void setDetail(String detail) { 90 | this.detail = detail; 91 | } 92 | 93 | public BigDecimal getPrice() { 94 | return price; 95 | } 96 | 97 | public void setPrice(BigDecimal price) { 98 | this.price = price; 99 | } 100 | 101 | public Integer getStock() { 102 | return stock; 103 | } 104 | 105 | public void setStock(Integer stock) { 106 | this.stock = stock; 107 | } 108 | 109 | public Integer getStatus() { 110 | return status; 111 | } 112 | 113 | public void setStatus(Integer status) { 114 | this.status = status; 115 | } 116 | 117 | public String getCreateTime() { 118 | return createTime; 119 | } 120 | 121 | public void setCreateTime(String createTime) { 122 | this.createTime = createTime; 123 | } 124 | 125 | public String getUpdateTime() { 126 | return updateTime; 127 | } 128 | 129 | public void setUpdateTime(String updateTime) { 130 | this.updateTime = updateTime; 131 | } 132 | 133 | public String getImageHost() { 134 | return imageHost; 135 | } 136 | 137 | public void setImageHost(String imageHost) { 138 | this.imageHost = imageHost; 139 | } 140 | 141 | public Integer getParentCategoryId() { 142 | return parentCategoryId; 143 | } 144 | 145 | public void setParentCategoryId(Integer parentCategoryId) { 146 | this.parentCategoryId = parentCategoryId; 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/vo/ProductListVo.java: -------------------------------------------------------------------------------- 1 | package com.mall.vo; 2 | 3 | import java.math.BigDecimal; 4 | 5 | /** 6 | * Created by 王乾 on 2017/12/21. 7 | */ 8 | public class ProductListVo { 9 | private Integer id; 10 | private Integer categoryId; 11 | 12 | private String name; 13 | private String subtitle; 14 | private String mainImage; 15 | private BigDecimal price; 16 | 17 | private Integer status; 18 | 19 | private String imageHost; 20 | 21 | public Integer getId() { 22 | return id; 23 | } 24 | 25 | public void setId(Integer id) { 26 | this.id = id; 27 | } 28 | 29 | public Integer getCategoryId() { 30 | return categoryId; 31 | } 32 | 33 | public void setCategoryId(Integer categoryId) { 34 | this.categoryId = categoryId; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | public String getSubtitle() { 46 | return subtitle; 47 | } 48 | 49 | public void setSubtitle(String subtitle) { 50 | this.subtitle = subtitle; 51 | } 52 | 53 | public String getMainImage() { 54 | return mainImage; 55 | } 56 | 57 | public void setMainImage(String mainImage) { 58 | this.mainImage = mainImage; 59 | } 60 | 61 | public BigDecimal getPrice() { 62 | return price; 63 | } 64 | 65 | public void setPrice(BigDecimal price) { 66 | this.price = price; 67 | } 68 | 69 | public Integer getStatus() { 70 | return status; 71 | } 72 | 73 | public void setStatus(Integer status) { 74 | this.status = status; 75 | } 76 | 77 | public String getImageHost() { 78 | return imageHost; 79 | } 80 | 81 | public void setImageHost(String imageHost) { 82 | this.imageHost = imageHost; 83 | } 84 | 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/main/Java/com/mall/vo/ShippingVo.java: -------------------------------------------------------------------------------- 1 | package com.mall.vo; 2 | 3 | /** 4 | * Created by 王乾 on 2017/12/26. 5 | */ 6 | public class ShippingVo { 7 | 8 | private String receiverName; 9 | 10 | private String receiverPhone; 11 | 12 | private String receiverMobile; 13 | 14 | private String receiverProvince; 15 | 16 | private String receiverCity; 17 | 18 | private String receiverDistrict; 19 | 20 | private String receiverAddress; 21 | 22 | private String receiverZip; 23 | 24 | public String getReceiverName() { 25 | return receiverName; 26 | } 27 | 28 | public void setReceiverName(String receiverName) { 29 | this.receiverName = receiverName; 30 | } 31 | 32 | public String getReceiverPhone() { 33 | return receiverPhone; 34 | } 35 | 36 | public void setReceiverPhone(String receiverPhone) { 37 | this.receiverPhone = receiverPhone; 38 | } 39 | 40 | public String getReceiverMobile() { 41 | return receiverMobile; 42 | } 43 | 44 | public void setReceiverMobile(String receiverMobile) { 45 | this.receiverMobile = receiverMobile; 46 | } 47 | 48 | public String getReceiverProvince() { 49 | return receiverProvince; 50 | } 51 | 52 | public void setReceiverProvince(String receiverProvince) { 53 | this.receiverProvince = receiverProvince; 54 | } 55 | 56 | public String getReceiverCity() { 57 | return receiverCity; 58 | } 59 | 60 | public void setReceiverCity(String receiverCity) { 61 | this.receiverCity = receiverCity; 62 | } 63 | 64 | public String getReceiverDistrict() { 65 | return receiverDistrict; 66 | } 67 | 68 | public void setReceiverDistrict(String receiverDistrict) { 69 | this.receiverDistrict = receiverDistrict; 70 | } 71 | 72 | public String getReceiverAddress() { 73 | return receiverAddress; 74 | } 75 | 76 | public void setReceiverAddress(String receiverAddress) { 77 | this.receiverAddress = receiverAddress; 78 | } 79 | 80 | public String getReceiverZip() { 81 | return receiverZip; 82 | } 83 | 84 | public void setReceiverZip(String receiverZip) { 85 | this.receiverZip = receiverZip; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/resources/applicationContext-datasource.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | classpath:datasource.properties 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | dialect=mysql 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/main/resources/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/resources/datasource.properties: -------------------------------------------------------------------------------- 1 | db.driverLocation=/Users/wrq/mysql-connector-java-5.1.6-bin.jar 2 | db.driverClassName=com.mysql.jdbc.Driver 3 | 4 | #db.url=jdbc:mysql://192.1.1.1:3306/mmall?characterEncoding=utf-8 5 | db.url=jdbc:mysql://localhost:3306/mmall?characterEncoding=UTF-8 6 | db.username=root 7 | db.password=rootadmin 8 | 9 | 10 | db.initialSize = 20 11 | db.maxActive = 50 12 | db.maxIdle = 20 13 | db.minIdle = 10 14 | db.maxWait = 10 15 | db.defaultAutoCommit = true 16 | db.minEvictableIdleTimeMillis = 3600000 17 | -------------------------------------------------------------------------------- /src/main/resources/generatorConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | 80 | 81 | 82 |
83 |
84 | 85 | 86 | 87 |
88 |
-------------------------------------------------------------------------------- /src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UTF-8 5 | 6 | [%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n 7 | 8 | 9 | DEBUG 10 | 11 | 12 | 13 | 14 | 15 | D:\XAMPP\tomcat\logs\mall.log 16 | 17 | D:\XAMPP\tomcat\logs\mall.log.%d{yyyy-MM-dd}.gz 18 | true 19 | 10 20 | 21 | 22 | [%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n 23 | 24 | 25 | 26 | 27 | 28 | 29 | D:\XAMPP\tomcat\logs\error.log 30 | 31 | D:\XAMPP\tomcat\logs\error.log.%d{yyyy-MM-dd}.gz 32 | 33 | true 34 | 10 35 | 36 | 37 | [%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n 38 | 39 | 40 | ERROR 41 | ACCEPT 42 | DENY 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/main/resources/mappers/CartMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | id, user_id, product_id, quantity, checked, create_time, update_time 17 | 18 | 24 | 25 | delete from mmall_cart 26 | where id = #{id,jdbcType=INTEGER} 27 | 28 | 29 | insert into mmall_cart (id, user_id, product_id, 30 | quantity, checked, create_time, 31 | update_time) 32 | values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER}, 33 | #{quantity,jdbcType=INTEGER}, #{checked,jdbcType=INTEGER}, now(), 34 | now()) 35 | 36 | 37 | insert into mmall_cart 38 | 39 | 40 | id, 41 | 42 | 43 | user_id, 44 | 45 | 46 | product_id, 47 | 48 | 49 | quantity, 50 | 51 | 52 | checked, 53 | 54 | 55 | create_time, 56 | 57 | 58 | update_time, 59 | 60 | 61 | 62 | 63 | #{id,jdbcType=INTEGER}, 64 | 65 | 66 | #{userId,jdbcType=INTEGER}, 67 | 68 | 69 | #{productId,jdbcType=INTEGER}, 70 | 71 | 72 | #{quantity,jdbcType=INTEGER}, 73 | 74 | 75 | #{checked,jdbcType=INTEGER}, 76 | 77 | 78 | now(), 79 | 80 | 81 | now(), 82 | 83 | 84 | 85 | 86 | update mmall_cart 87 | 88 | 89 | user_id = #{userId,jdbcType=INTEGER}, 90 | 91 | 92 | product_id = #{productId,jdbcType=INTEGER}, 93 | 94 | 95 | quantity = #{quantity,jdbcType=INTEGER}, 96 | 97 | 98 | checked = #{checked,jdbcType=INTEGER}, 99 | 100 | 101 | create_time = #{createTime,jdbcType=TIMESTAMP}, 102 | 103 | 104 | update_time = now(), 105 | 106 | 107 | where id = #{id,jdbcType=INTEGER} 108 | 109 | 110 | update mmall_cart 111 | set user_id = #{userId,jdbcType=INTEGER}, 112 | product_id = #{productId,jdbcType=INTEGER}, 113 | quantity = #{quantity,jdbcType=INTEGER}, 114 | checked = #{checked,jdbcType=INTEGER}, 115 | create_time = #{createTime,jdbcType=TIMESTAMP}, 116 | update_time = now() 117 | where id = #{id,jdbcType=INTEGER} 118 | 119 | 126 | 132 | 135 | 136 | 137 | delete from mmall_cart 138 | where user_id = #{userId} 139 | 140 | and product_id in 141 | 142 | #{item} 143 | 144 | 145 | 146 | 147 | 148 | UPDATE mmall_cart 149 | set checked = #{checked}, 150 | update_time = now() 151 | where user_id = #{userId} 152 | 153 | and product_id = #{productId} 154 | 155 | 156 | 157 | 160 | 161 | 162 | 169 | -------------------------------------------------------------------------------- /src/main/resources/mappers/CategoryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | id, parent_id, name, status, sort_order, create_time, update_time 17 | 18 | 24 | 25 | delete from mmall_category 26 | where id = #{id,jdbcType=INTEGER} 27 | 28 | 29 | insert into mmall_category (id, parent_id, name, 30 | status, sort_order, create_time, 31 | update_time) 32 | values (#{id,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, 33 | #{status,jdbcType=BIT}, #{sortOrder,jdbcType=INTEGER}, now(), 34 | now()) 35 | 36 | 37 | insert into mmall_category 38 | 39 | 40 | id, 41 | 42 | 43 | parent_id, 44 | 45 | 46 | name, 47 | 48 | 49 | status, 50 | 51 | 52 | sort_order, 53 | 54 | 55 | create_time, 56 | 57 | 58 | update_time, 59 | 60 | 61 | 62 | 63 | #{id,jdbcType=INTEGER}, 64 | 65 | 66 | #{parentId,jdbcType=INTEGER}, 67 | 68 | 69 | #{name,jdbcType=VARCHAR}, 70 | 71 | 72 | #{status,jdbcType=BIT}, 73 | 74 | 75 | #{sortOrder,jdbcType=INTEGER}, 76 | 77 | 78 | now(), 79 | 80 | 81 | now(), 82 | 83 | 84 | 85 | 86 | update mmall_category 87 | 88 | 89 | parent_id = #{parentId,jdbcType=INTEGER}, 90 | 91 | 92 | name = #{name,jdbcType=VARCHAR}, 93 | 94 | 95 | status = #{status,jdbcType=BIT}, 96 | 97 | 98 | sort_order = #{sortOrder,jdbcType=INTEGER}, 99 | 100 | 101 | create_time = #{createTime,jdbcType=TIMESTAMP}, 102 | 103 | 104 | update_time = now(), 105 | 106 | 107 | where id = #{id,jdbcType=INTEGER} 108 | 109 | 110 | update mmall_category 111 | set parent_id = #{parentId,jdbcType=INTEGER}, 112 | name = #{name,jdbcType=VARCHAR}, 113 | status = #{status,jdbcType=BIT}, 114 | sort_order = #{sortOrder,jdbcType=INTEGER}, 115 | create_time = #{createTime,jdbcType=TIMESTAMP}, 116 | update_time = now() 117 | where id = #{id,jdbcType=INTEGER} 118 | 119 | 120 | 126 | 127 | -------------------------------------------------------------------------------- /src/main/resources/mappers/OrderItemMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | id, user_id, order_no, product_id, product_name, product_image, current_unit_price, 21 | quantity, total_price, create_time, update_time 22 | 23 | 29 | 30 | delete from mmall_order_item 31 | where id = #{id,jdbcType=INTEGER} 32 | 33 | 34 | insert into mmall_order_item (id, user_id, order_no, 35 | product_id, product_name, product_image, 36 | current_unit_price, quantity, total_price, 37 | create_time, update_time) 38 | values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{orderNo,jdbcType=BIGINT}, 39 | #{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, #{productImage,jdbcType=VARCHAR}, 40 | #{currentUnitPrice,jdbcType=DECIMAL}, #{quantity,jdbcType=INTEGER}, #{totalPrice,jdbcType=DECIMAL}, 41 | now(), now()) 42 | 43 | 44 | insert into mmall_order_item 45 | 46 | 47 | id, 48 | 49 | 50 | user_id, 51 | 52 | 53 | order_no, 54 | 55 | 56 | product_id, 57 | 58 | 59 | product_name, 60 | 61 | 62 | product_image, 63 | 64 | 65 | current_unit_price, 66 | 67 | 68 | quantity, 69 | 70 | 71 | total_price, 72 | 73 | 74 | create_time, 75 | 76 | 77 | update_time, 78 | 79 | 80 | 81 | 82 | #{id,jdbcType=INTEGER}, 83 | 84 | 85 | #{userId,jdbcType=INTEGER}, 86 | 87 | 88 | #{orderNo,jdbcType=BIGINT}, 89 | 90 | 91 | #{productId,jdbcType=INTEGER}, 92 | 93 | 94 | #{productName,jdbcType=VARCHAR}, 95 | 96 | 97 | #{productImage,jdbcType=VARCHAR}, 98 | 99 | 100 | #{currentUnitPrice,jdbcType=DECIMAL}, 101 | 102 | 103 | #{quantity,jdbcType=INTEGER}, 104 | 105 | 106 | #{totalPrice,jdbcType=DECIMAL}, 107 | 108 | 109 | now(), 110 | 111 | 112 | now(), 113 | 114 | 115 | 116 | 117 | update mmall_order_item 118 | 119 | 120 | user_id = #{userId,jdbcType=INTEGER}, 121 | 122 | 123 | order_no = #{orderNo,jdbcType=BIGINT}, 124 | 125 | 126 | product_id = #{productId,jdbcType=INTEGER}, 127 | 128 | 129 | product_name = #{productName,jdbcType=VARCHAR}, 130 | 131 | 132 | product_image = #{productImage,jdbcType=VARCHAR}, 133 | 134 | 135 | current_unit_price = #{currentUnitPrice,jdbcType=DECIMAL}, 136 | 137 | 138 | quantity = #{quantity,jdbcType=INTEGER}, 139 | 140 | 141 | total_price = #{totalPrice,jdbcType=DECIMAL}, 142 | 143 | 144 | create_time = #{createTime,jdbcType=TIMESTAMP}, 145 | 146 | 147 | update_time = now(), 148 | 149 | 150 | where id = #{id,jdbcType=INTEGER} 151 | 152 | 153 | update mmall_order_item 154 | set user_id = #{userId,jdbcType=INTEGER}, 155 | order_no = #{orderNo,jdbcType=BIGINT}, 156 | product_id = #{productId,jdbcType=INTEGER}, 157 | product_name = #{productName,jdbcType=VARCHAR}, 158 | product_image = #{productImage,jdbcType=VARCHAR}, 159 | current_unit_price = #{currentUnitPrice,jdbcType=DECIMAL}, 160 | quantity = #{quantity,jdbcType=INTEGER}, 161 | total_price = #{totalPrice,jdbcType=DECIMAL}, 162 | create_time = #{createTime,jdbcType=TIMESTAMP}, 163 | update_time = now() 164 | where id = #{id,jdbcType=INTEGER} 165 | 166 | 167 | 174 | 175 | 176 | insert into mmall_order_item (id, order_no,user_id, 177 | product_id, product_name, product_image, 178 | current_unit_price, quantity, total_price, 179 | create_time, update_time) 180 | values 181 | 182 | ( 183 | #{item.id},#{item.orderNo},#{item.userId},#{item.productId},#{item.productName},#{item.productImage},#{item.currentUnitPrice},#{item.quantity},#{item.totalPrice},now(),now() 184 | ) 185 | 186 | 187 | 188 | 189 | 190 | 196 | 197 | -------------------------------------------------------------------------------- /src/main/resources/mappers/PayInfoMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | id, user_id, order_no, pay_platform, platform_number, platform_status, create_time, 18 | update_time 19 | 20 | 26 | 27 | delete from mmall_pay_info 28 | where id = #{id,jdbcType=INTEGER} 29 | 30 | 31 | insert into mmall_pay_info (id, user_id, order_no, 32 | pay_platform, platform_number, platform_status, 33 | create_time, update_time) 34 | values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{orderNo,jdbcType=BIGINT}, 35 | #{payPlatform,jdbcType=INTEGER}, #{platformNumber,jdbcType=VARCHAR}, #{platformStatus,jdbcType=VARCHAR}, 36 | now(),now()) 37 | 38 | 39 | insert into mmall_pay_info 40 | 41 | 42 | id, 43 | 44 | 45 | user_id, 46 | 47 | 48 | order_no, 49 | 50 | 51 | pay_platform, 52 | 53 | 54 | platform_number, 55 | 56 | 57 | platform_status, 58 | 59 | 60 | create_time, 61 | 62 | 63 | update_time, 64 | 65 | 66 | 67 | 68 | #{id,jdbcType=INTEGER}, 69 | 70 | 71 | #{userId,jdbcType=INTEGER}, 72 | 73 | 74 | #{orderNo,jdbcType=BIGINT}, 75 | 76 | 77 | #{payPlatform,jdbcType=INTEGER}, 78 | 79 | 80 | #{platformNumber,jdbcType=VARCHAR}, 81 | 82 | 83 | #{platformStatus,jdbcType=VARCHAR}, 84 | 85 | 86 | now(), 87 | 88 | 89 | now(), 90 | 91 | 92 | 93 | 94 | update mmall_pay_info 95 | 96 | 97 | user_id = #{userId,jdbcType=INTEGER}, 98 | 99 | 100 | order_no = #{orderNo,jdbcType=BIGINT}, 101 | 102 | 103 | pay_platform = #{payPlatform,jdbcType=INTEGER}, 104 | 105 | 106 | platform_number = #{platformNumber,jdbcType=VARCHAR}, 107 | 108 | 109 | platform_status = #{platformStatus,jdbcType=VARCHAR}, 110 | 111 | 112 | create_time = #{createTime,jdbcType=TIMESTAMP}, 113 | 114 | 115 | update_time =now(), 116 | 117 | 118 | where id = #{id,jdbcType=INTEGER} 119 | 120 | 121 | update mmall_pay_info 122 | set user_id = #{userId,jdbcType=INTEGER}, 123 | order_no = #{orderNo,jdbcType=BIGINT}, 124 | pay_platform = #{payPlatform,jdbcType=INTEGER}, 125 | platform_number = #{platformNumber,jdbcType=VARCHAR}, 126 | platform_status = #{platformStatus,jdbcType=VARCHAR}, 127 | create_time = #{createTime,jdbcType=TIMESTAMP}, 128 | update_time = #{updateTime,jdbcType=TIMESTAMP} 129 | where id = #{id,jdbcType=INTEGER} 130 | 131 | -------------------------------------------------------------------------------- /src/main/resources/mappers/ProductMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | id, category_id, name, subtitle, main_image, sub_images, detail, price, stock, status, 22 | create_time, update_time 23 | 24 | 30 | 31 | delete from mmall_product 32 | where id = #{id,jdbcType=INTEGER} 33 | 34 | 35 | insert into mmall_product (id, category_id, name, 36 | subtitle, main_image, sub_images, 37 | detail, price, stock, 38 | status, create_time, update_time 39 | ) 40 | values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, 41 | #{subtitle,jdbcType=VARCHAR}, #{mainImage,jdbcType=VARCHAR}, #{subImages,jdbcType=VARCHAR}, 42 | #{detail,jdbcType=VARCHAR}, #{price,jdbcType=DECIMAL}, #{stock,jdbcType=INTEGER}, 43 | #{status,jdbcType=INTEGER}, now(),now() 44 | ) 45 | 46 | 47 | insert into mmall_product 48 | 49 | 50 | id, 51 | 52 | 53 | category_id, 54 | 55 | 56 | name, 57 | 58 | 59 | subtitle, 60 | 61 | 62 | main_image, 63 | 64 | 65 | sub_images, 66 | 67 | 68 | detail, 69 | 70 | 71 | price, 72 | 73 | 74 | stock, 75 | 76 | 77 | status, 78 | 79 | 80 | create_time, 81 | 82 | 83 | update_time, 84 | 85 | 86 | 87 | 88 | #{id,jdbcType=INTEGER}, 89 | 90 | 91 | #{categoryId,jdbcType=INTEGER}, 92 | 93 | 94 | #{name,jdbcType=VARCHAR}, 95 | 96 | 97 | #{subtitle,jdbcType=VARCHAR}, 98 | 99 | 100 | #{mainImage,jdbcType=VARCHAR}, 101 | 102 | 103 | #{subImages,jdbcType=VARCHAR}, 104 | 105 | 106 | #{detail,jdbcType=VARCHAR}, 107 | 108 | 109 | #{price,jdbcType=DECIMAL}, 110 | 111 | 112 | #{stock,jdbcType=INTEGER}, 113 | 114 | 115 | #{status,jdbcType=INTEGER}, 116 | 117 | 118 | now(), 119 | 120 | 121 | now(), 122 | 123 | 124 | 125 | 126 | update mmall_product 127 | 128 | 129 | category_id = #{categoryId,jdbcType=INTEGER}, 130 | 131 | 132 | name = #{name,jdbcType=VARCHAR}, 133 | 134 | 135 | subtitle = #{subtitle,jdbcType=VARCHAR}, 136 | 137 | 138 | main_image = #{mainImage,jdbcType=VARCHAR}, 139 | 140 | 141 | sub_images = #{subImages,jdbcType=VARCHAR}, 142 | 143 | 144 | detail = #{detail,jdbcType=VARCHAR}, 145 | 146 | 147 | price = #{price,jdbcType=DECIMAL}, 148 | 149 | 150 | stock = #{stock,jdbcType=INTEGER}, 151 | 152 | 153 | status = #{status,jdbcType=INTEGER}, 154 | 155 | 156 | create_time = #{createTime,jdbcType=TIMESTAMP}, 157 | 158 | 159 | update_time = now(), 160 | 161 | 162 | where id = #{id,jdbcType=INTEGER} 163 | 164 | 165 | update mmall_product 166 | set category_id = #{categoryId,jdbcType=INTEGER}, 167 | name = #{name,jdbcType=VARCHAR}, 168 | subtitle = #{subtitle,jdbcType=VARCHAR}, 169 | main_image = #{mainImage,jdbcType=VARCHAR}, 170 | sub_images = #{subImages,jdbcType=VARCHAR}, 171 | detail = #{detail,jdbcType=VARCHAR}, 172 | price = #{price,jdbcType=DECIMAL}, 173 | stock = #{stock,jdbcType=INTEGER}, 174 | status = #{status,jdbcType=INTEGER}, 175 | create_time = #{createTime,jdbcType=TIMESTAMP}, 176 | update_time =now() 177 | where id = #{id,jdbcType=INTEGER} 178 | 179 | 180 | 186 | 187 | 200 | 201 | 216 | -------------------------------------------------------------------------------- /src/main/resources/mappers/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | id, username, password, email, phone, question, answer, role, create_time, update_time 20 | 21 | 27 | 28 | delete from mmall_user 29 | where id = #{id,jdbcType=INTEGER} 30 | 31 | 32 | insert into mmall_user (id, username, password, 33 | email, phone, question, 34 | answer, role, create_time, 35 | update_time) 36 | values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, 37 | #{email,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{question,jdbcType=VARCHAR}, 38 | #{answer,jdbcType=VARCHAR}, #{role,jdbcType=INTEGER}, now(), 39 | now()) 40 | 41 | 42 | insert into mmall_user 43 | 44 | 45 | id, 46 | 47 | 48 | username, 49 | 50 | 51 | password, 52 | 53 | 54 | email, 55 | 56 | 57 | phone, 58 | 59 | 60 | question, 61 | 62 | 63 | answer, 64 | 65 | 66 | role, 67 | 68 | 69 | create_time, 70 | 71 | 72 | update_time, 73 | 74 | 75 | 76 | 77 | #{id,jdbcType=INTEGER}, 78 | 79 | 80 | #{username,jdbcType=VARCHAR}, 81 | 82 | 83 | #{password,jdbcType=VARCHAR}, 84 | 85 | 86 | #{email,jdbcType=VARCHAR}, 87 | 88 | 89 | #{phone,jdbcType=VARCHAR}, 90 | 91 | 92 | #{question,jdbcType=VARCHAR}, 93 | 94 | 95 | #{answer,jdbcType=VARCHAR}, 96 | 97 | 98 | #{role,jdbcType=INTEGER}, 99 | 100 | 101 | #{createTime,jdbcType=TIMESTAMP}, 102 | 103 | 104 | #{updateTime,jdbcType=TIMESTAMP}, 105 | 106 | 107 | 108 | 109 | update mmall_user 110 | 111 | 112 | username = #{username,jdbcType=VARCHAR}, 113 | 114 | 115 | password = #{password,jdbcType=VARCHAR}, 116 | 117 | 118 | email = #{email,jdbcType=VARCHAR}, 119 | 120 | 121 | phone = #{phone,jdbcType=VARCHAR}, 122 | 123 | 124 | question = #{question,jdbcType=VARCHAR}, 125 | 126 | 127 | answer = #{answer,jdbcType=VARCHAR}, 128 | 129 | 130 | role = #{role,jdbcType=INTEGER}, 131 | 132 | 133 | create_time = #{createTime,jdbcType=TIMESTAMP}, 134 | 135 | 136 | update_time = now(), 137 | 138 | 139 | where id = #{id,jdbcType=INTEGER} 140 | 141 | 142 | update mmall_user 143 | set username = #{username,jdbcType=VARCHAR}, 144 | password = #{password,jdbcType=VARCHAR}, 145 | email = #{email,jdbcType=VARCHAR}, 146 | phone = #{phone,jdbcType=VARCHAR}, 147 | question = #{question,jdbcType=VARCHAR}, 148 | answer = #{answer,jdbcType=VARCHAR}, 149 | role = #{role,jdbcType=INTEGER}, 150 | create_time = #{createTime,jdbcType=TIMESTAMP}, 151 | update_time = now() 152 | where id = #{id,jdbcType=INTEGER} 153 | 154 | 155 | 159 | 160 | 164 | 165 | 166 | 174 | 175 | 180 | 181 | 189 | 190 | 191 | UPDATE mmall_user 192 | set password = #{passwordNew},update_time = now() 193 | where username = #{username} 194 | 195 | 196 | 203 | 204 | 209 | 210 | 211 | -------------------------------------------------------------------------------- /src/main/resources/mmall.properties: -------------------------------------------------------------------------------- 1 | ftp.server.ip=127.0.0.1 2 | #192.168.43.92 3 | #192.168.123.191 4 | #192.168.0.140 5 | ftp.user=wangqian 6 | ftp.pass=wangqian 7 | ftp.server.http.prefix=http://image.qian.com/ 8 | 9 | 10 | alipay.callback.url=http://z4cj2d.natappfree.cc/order/alipay_callback.do 11 | 12 | password.salt = geelysdafaqj23ou89ZXcj@#$@#$#@KJdjklj;D../dSF., 13 | 14 | -------------------------------------------------------------------------------- /src/main/resources/zfbinfo.properties: -------------------------------------------------------------------------------- 1 | 2 | # 支付宝网关名、partnerId和appId 3 | open_api_domain = https://openapi.alipaydev.com/gateway.do 4 | mcloud_api_domain = http://mcloudmonitor.com/gateway.do 5 | pid = 2088102172380271 6 | appid = 2016082100303119 7 | 8 | 9 | # RSA私钥、公钥和支付宝公钥 10 | private_key = MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCFjYvo/LvJr0ER3t2hwC89vHWvpiRwZlSq7IuX25GVgZ+mREdiJ6pmWPshi5gqga+c3m+lXSzGvxxfYQU20cKk21mnQjaBpFVpI5FD7IyJvTgAKo6TF6n1CsYzS8Int4qgnBFp66Ff86jK2FPKLAx4dLvYvnUXhRCkdiQj7SIIR1kqJRvM5Fzk3FxQ0eH4uwemXXwgG+Jjpsxv9U33G7pEDp7TTrf30ltLGCwm9Nqv71Lu0iQTSHMaJk9EZK7Fprej94gylqK0kt/pyvGL/4EKwAYn7AiIEfJUEnPIpGi2wL+/fpb4Q7CjUTt76HUAQfzFnRs1jV4jVkClaBpXA3GTAgMBAAECggEAXONcIkpWGirIqTNHF09iDCBeAjMeOQcTcGZhmNdgZInpjm0C8SQBgnn1ARnkVfwpNoQHRw6NLBaUF0qVo9E0/hCKRKjq3DR+K0hPqtyFyu9OWd8/ltLopMQ/okHY4mLoCllCS1dVwDTqe1sGvCDy83zNgizFp/wm3RxGeq5d8z8bLn/1P2bH2g+dEKcI4PPxtV5c1DMPQ2u1Koza2l6lmtkNEw3lNyOhQtdp2yqXygf6flwrKsKQa2kJmZTx/Q4Wdd/Wq6lrEKwUzsvthb3Ma8cG4hhazwdcX0k/XDVFX6vZlJ8ngdMlXLXMq6R+nxRqXE6dul7G+kyBy14NlTPk8QKBgQDBZraRcj7IMJhsqcDKoNOmyp1ia2c/OlCwBxTN+QX/B03XpSepdpkwEq42N/nL0uRg4a8kcdTGOeYdFdDDRCOtcnHDTpetkII7z6XCvs0RUloO/Dy1Eb5Qp4wHrHXwthX7bB+eWpvlUzQRrNJ8+ycbccb0BZjMsWD11DXrSSxZfQKBgQCwx8iapRK+F1mtCtgzgNpYTZdnaMCGPC3W0qdAUd72O7dJeguO13Bz9ZxEY6lTMtDCGQz5afQcw1pC0FWDupKTvFUHOKqB7bc406g7C/2TSOhWZL0xbmJk+Ed7ou8v6xgB1+vwODvGmJobHrTcwtPQtebsSi4u7hdqhBjTowtkTwKBgCIHO3ot2sQIYNlFqOk+EN9Y6QYnFZx3WzkNleiDtz1fAKA/q9HSTzO5JbPed3IYYhx1uQY1jRVvnIBjlT62H3zmFQQjMObV9UQmzeiM/7HbhoL6eIf3Xj/8qtOy0XGP6CA7rviCwsk/sXqmqMZavk/C3hmTXoYtc3ztYKtMTaRVAoGAZQzueKeffRWv5yBp0Zb4OL2xrCTO2GyR71hezn9+KdacwN2IudAgschV2Sn24l4Lwse7CN8t8Tsh30tjdncxzk07dXNI1BhkQZGLeqUx//0PAkN3ekgU6o6ZnezXONbz1Cnu7lPWp4EXpiT5Ua/0kDtKkwscNytWK0bzQhbTLjUCgYEAwUHQPOgTiNbMdbD1275fvC72BWpJI5DiSsiRWUvB1AOuid98b/idjMp/KfU5O2AJluRkCLokHm8sD+Fglijl3KQFnGOpN6zSmw2XQunBprD8DF6VZJvXgJakbBh41sbbmspB0Ttl+g3o44yZ2tgIovoSW8/uXl7pbp4yyl5+TiI= 11 | public_key = MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhY2L6Py7ya9BEd7docAvPbx1r6YkcGZUquyLl9uRlYGfpkRHYieqZlj7IYuYKoGvnN5vpV0sxr8cX2EFNtHCpNtZp0I2gaRVaSORQ+yMib04ACqOkxep9QrGM0vCJ7eKoJwRaeuhX/OoythTyiwMeHS72L51F4UQpHYkI+0iCEdZKiUbzORc5NxcUNHh+LsHpl18IBviY6bMb/VN9xu6RA6e006399JbSxgsJvTar+9S7tIkE0hzGiZPRGSuxaa3o/eIMpaitJLf6crxi/+BCsAGJ+wIiBHyVBJzyKRotsC/v36W+EOwo1E7e+h1AEH8xZ0bNY1eI1ZApWgaVwNxkwIDAQAB 12 | 13 | #SHA1withRsa对应支付宝公钥 14 | #alipay_public_key = MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDI6d306Q8fIfCOaTXyiUeJHkrIvYISRcc73s3vF1ZT7XN8RNPwJxo8pWaJMmvyTn9N4HQ632qJBVHf8sxHi/fEsraprwCtzvzQETrNRwVxLO5jVmRGi60j8Ue1efIlzPXV9je9mkjzOmdssymZkh2QhUrCmZYI/FCEa3/cNMW0QIDAQAB 15 | 16 | #SHA256withRsa对应支付宝公钥 17 | alipay_public_key = MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmWlPfGJpjrAbIve0GpuVbI02RRmHA+kEp4ITnPOqpw7GKJqRG2luxbgw/THZK8qTmsJGd3BFgz8fD/N5bPUVuq/5Bm4Rlt1PpBxnZ2+/SEvWDKNMABg6nFA2/T1/vPhX1IHgpUyUHWbdpYHnz/4x0vI6vh13TGg7fHItlnPPfAQdbUrtRZ1hknv5ooiW9+ONQaUwwf/4J5FMNui0VZwfsB4UCq8HWdeXbnjGwXIoJeE57vRS0N4I0l15d0Hd3VHvECwH7G5cOBMoMb+xzse0SUmkBNxe0DR+oux2Z2sCkFWpXtoXesCvtjPnJ6LLRpMR7eh/cJ7cxoEIRKtPJw5zvQIDAQAB+V9JilLqSa7N7sVqwpvv8zWChgXhX/A96hEg97Oxe6GKUmzaZRNh0cZZ88vpkn5tlgL4mH/dhSr3Ip00kvM4rHq9PwuT4k7z1DpZAf1eghK8Q5BgxL88d0X07m9X96Ijd0yMkXArzD7jg+noqfbztEKoH3kPMRJC2w4ByVdweWUT2PwrlATpZZtYLmtDvUKG/sOkNAIKEMg3Rut1oKWpjyYanzDgS7Cg3awr1KPTl9rHCazk15aNYowmYtVabKwbGVToCAGK+qQ1gT3ELhkGnf3+h53fukNqRH+wIDAQAB 18 | 19 | # 签名类型: RSA->SHA1withRsa,RSA2->SHA256withRsa 20 | sign_type = RSA2 21 | # 当面付最大查询次数和查询间隔(毫秒) 22 | max_query_retry = 5 23 | query_duration = 5000 24 | 25 | # 当面付最大撤销次数和撤销间隔(毫秒) 26 | max_cancel_retry = 3 27 | cancel_duration = 2000 28 | 29 | # 交易保障线程第一次调度延迟和调度间隔(秒) 30 | heartbeat_delay = 5 31 | heartbeat_duration = 900 32 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/dispatcher-servlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | text/plain;charset=UTF-8 19 | text/html;charset=UTF-8 20 | 21 | 22 | 23 | 24 | 25 | 26 | application/json;charset=UTF-8 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/lib/alipay-sdk-java20161213173952-source.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WAng91An/Wmall/13cde876d75570b738c8173cc3810e10feee137c/src/main/webapp/WEB-INF/lib/alipay-sdk-java20161213173952-source.jar -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/lib/alipay-sdk-java20161213173952.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WAng91An/Wmall/13cde876d75570b738c8173cc3810e10feee137c/src/main/webapp/WEB-INF/lib/alipay-sdk-java20161213173952.jar -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/lib/alipay-trade-sdk-20161215-source.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WAng91An/Wmall/13cde876d75570b738c8173cc3810e10feee137c/src/main/webapp/WEB-INF/lib/alipay-trade-sdk-20161215-source.jar -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/lib/alipay-trade-sdk-20161215.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WAng91An/Wmall/13cde876d75570b738c8173cc3810e10feee137c/src/main/webapp/WEB-INF/lib/alipay-trade-sdk-20161215.jar -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Archetype Created Web Application 8 | 9 | 10 | characterEncodingFilter 11 | org.springframework.web.filter.CharacterEncodingFilter 12 | 13 | encoding 14 | UTF-8 15 | 16 | 17 | forceEncoding 18 | true 19 | 20 | 21 | 22 | characterEncodingFilter 23 | /* 24 | 25 | 26 | 27 | 28 | org.springframework.web.context.request.RequestContextListener 29 | 30 | 31 | 32 | org.springframework.web.context.ContextLoaderListener 33 | 34 | 35 | contextConfigLocation 36 | 37 | classpath:applicationContext.xml 38 | 39 | 40 | 41 | 42 | dispatcher 43 | org.springframework.web.servlet.DispatcherServlet 44 | 1 45 | 46 | 47 | 48 | 49 | 50 | dispatcher 51 | *.do 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | springmvc 11 |
12 | 13 | 14 |
15 | 16 | richtext_img_upload 17 |
18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /二维码.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WAng91An/Wmall/13cde876d75570b738c8173cc3810e10feee137c/二维码.jpg --------------------------------------------------------------------------------