From 31f2b1e91a65feb21d1c6314886aee604753595b Mon Sep 17 00:00:00 2001 From: Bosen Date: Mon, 6 Dec 2021 21:59:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2=E6=96=B9=E5=BC=8F=E7=94=B1wa?= =?UTF-8?q?r=E8=BD=AC=E4=B8=BAjar=E5=8C=85=EF=BC=9B=E4=BD=BF=E7=94=A8gitee?= =?UTF-8?q?=E5=9B=BE=E5=BA=8A=E4=BD=9C=E4=B8=BA=E5=9B=BE=E7=89=87=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 49 +++-- jieyue.sql | 39 ++-- pom.xml | 35 ++-- .../com/example/jieyue/JieyueApplication.java | 33 +--- .../admin/controller/AdminUiController.java | 15 +- .../admin/service/AdminMerchantService.java | 7 +- .../jieyue/admin/service/AdminUiService.java | 30 ++- .../admin/service/AdminUserService.java | 7 +- .../jieyue/common/task/SchedulerTask.java | 38 ++-- .../example/jieyue/common/utils/DateUtil.java | 22 --- .../example/jieyue/common/utils/FileUtil.java | 78 -------- .../jieyue/common/utils/GiteeImgBedUtils.java | 183 ++++++++++++++++++ .../jieyue/common/utils/IsEmptyUtil.java | 4 +- .../example/jieyue/common/utils/JsonUtil.java | 21 -- .../jieyue/common/utils/QRCodeUtil.java | 27 +-- .../jieyue/common/utils/StringUtil.java | 20 -- .../controller/MerchantGoodsController.java | 21 +- .../controller/MerchantLoginController.java | 4 +- .../controller/MerchantUiController.java | 15 ++ .../service/MerchantGoodsService.java | 41 ++-- .../service/MerchantOrderService.java | 24 ++- .../merchant/service/MerchantUiService.java | 40 ++-- .../merchant/service/MerchantUserService.java | 7 +- .../controller/UserCheckOutController.java | 2 +- .../user/controller/UserHomeController.java | 18 +- .../user/controller/UserInfoController.java | 2 +- .../user/controller/UserLoginController.java | 2 + .../user/controller/UserPayController.java | 11 +- .../controller/UserProductController.java | 2 +- .../jieyue/user/service/UserCartService.java | 3 +- .../jieyue/user/service/UserHomeService.java | 55 ++++-- .../jieyue/user/service/UserInfoService.java | 25 ++- .../jieyue/user/service/UserOrderService.java | 5 +- .../user/service/UserSearchService.java | 7 +- .../jieyue/user/service/UserShopService.java | 18 +- .../jieyue/user/service/WxPayService.java | 20 +- src/main/resources/application.yml | 4 + src/main/resources/banner.txt | 2 +- src/main/resources/static/favicon.ico | Bin 67646 -> 0 bytes .../static/image/merchant/default.jpg | Bin 0 -> 1502 bytes .../templates/admin/common/model.html | 5 + .../resources/templates/admin/ui/index.html | 25 +-- .../templates/merchant/common/model.html | 5 + .../templates/merchant/goods/index.html | 8 +- .../templates/merchant/ui/index.html | 9 +- .../templates/user/common/model.html | 6 + .../resources/templates/user/info/index.html | 3 +- 47 files changed, 560 insertions(+), 437 deletions(-) delete mode 100644 src/main/java/com/example/jieyue/common/utils/DateUtil.java delete mode 100644 src/main/java/com/example/jieyue/common/utils/FileUtil.java create mode 100644 src/main/java/com/example/jieyue/common/utils/GiteeImgBedUtils.java delete mode 100644 src/main/java/com/example/jieyue/common/utils/JsonUtil.java delete mode 100644 src/main/java/com/example/jieyue/common/utils/StringUtil.java delete mode 100644 src/main/resources/static/favicon.ico create mode 100644 src/main/resources/static/image/merchant/default.jpg diff --git a/README.md b/README.md index 563f14d..d783d99 100644 --- a/README.md +++ b/README.md @@ -129,17 +129,17 @@ ![](https://img-blog.csdnimg.cn/1281208680ff4461a48202f71629a285.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5LqR5Li26KiA,size_20,color_FFFFFF,t_70,g_se,x_16) ![](https://img-blog.csdnimg.cn/0c0547bf787c4877b62557cd2d17e729.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5LqR5Li26KiA,size_20,color_FFFFFF,t_70,g_se,x_16) ### 3.打包项目 -填写好项目配置信息后,就可以开始打包项目了:依次点击 **Build -> Build Artifacts -> jieyue.war -> Build**,项目将会开始打包~! -![](https://img-blog.csdnimg.cn/bf5814bfd67344dba8ece2211c32f5b9.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5LqR5Li26KiA,size_20,color_FFFFFF,t_70,g_se,x_16) -等待项目打包完后,相应的war包会存放在target目录下,名称为 **`ROOT.war`** (如下) -![](https://img-blog.csdnimg.cn/2c9057e8e6924c39a2b81154db104876.png) +填写好项目配置信息后,就可以开始打包项目了:按照下图所示的步骤依次执行,最后打包好的 **`jieyue.jar`** 将会存放在 **`target`** 目录中。 +![](https://img-blog.csdnimg.cn/11e170bd1863418d99b38caebcb12c10.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5LqR5Li26KiA,size_20,color_FFFFFF,t_70,g_se,x_16) + + ### 4.安装Docker docker的安装流程可参考下面这篇文章,笔者在这里就不再赘述了:**[https://www.runoob.com/docker/centos-docker-install.html](https://www.runoob.com/docker/centos-docker-install.html)**
### 5.安装MySQL -5.1:执行如下命令拉取MySQL的docker镜像 +5.1:执行如下命令拉取MySQL的Docker镜像 ```bash docker pull hub.c.163.com/library/mysql:latest ``` @@ -149,10 +149,10 @@ docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d hub.c.163. ``` 5.3:MySQL运行成功后,需要对MySQL的数据进行初始化,这里笔者推荐使用可视化工具Navicat,填入对应的信息即可成功连接 ![](https://img-blog.csdnimg.cn/3bc392ebdbf249dd93a765bcf8d41733.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5LqR5Li26KiA,size_20,color_FFFFFF,t_70,g_se,x_16) -5.4:新建一个名为jieyue的数据库,创建成功后双击该数据库创立连接,接着右击,选择**运行SQL文件**,运行项目根目录下的`jieyue.sql`文件即可。 +5.4:新建一个名为jieyue的数据库,创建成功后双击该数据库创立连接,接着右击,选择**运行SQL文件**,运行项目根目录下的 **`jieyue.sql`** 文件即可。 ![](https://img-blog.csdnimg.cn/be8eccc8a0084db8a087d8287034cfc3.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5LqR5Li26KiA,size_19,color_FFFFFF,t_70,g_se,x_16) ### 6.安装Redis -6.1:执行如下命令拉取Redis的docker镜像 +6.1:执行如下命令拉取Redis的Docker镜像 ```bash docker pull hub.c.163.com/library/redis:latest ``` @@ -162,24 +162,39 @@ docker run -d -p 6379:6379 --name redis hub.c.163.com/library/redis:latest ```
-### 7.安装Tomcat -7.1:执行如下命令拉取Tomcat的docker镜像(注意:tomcat的版本需要是`8.5`的) +### 7.安装OpenJDK +7.1:执行如下命令拉取OpenJDK的Docker镜像 + ```bash -docker pull hub.c.163.com/library/tomcat:8.5 +docker pull hub.c.163.com/cloudndp/library/openjdk:8-jessie ``` -7.2:执行如下命令运行Tomcat +7.2:在 **`jieyue.jar`** 包同一目录下创建 **`Dockerfile`** 文件,具体内容如下 + ```bash -docker run -d -p 80:8080 --name tomcat hub.c.163.com/library/tomcat:8.5 +FROM hub.c.163.com/cloudndp/library/openjdk:8-jessie + +COPY jieyue.jar /jieyue.jar + +CMD java -jar /jieyue.jar + +EXPOSE 80 ``` -7.3:将前面我们打包好的war包放入到启动好的tomcat容器中(执行下面的命令前,请确认war包在当前目录下) +7.3:在 **`jieyue.jar`** 包同一目录下执行如下命令,创建镜像 + ```bash -docker cp ROOT.war tomcat:/usr/local/tomcat/webapps +docker build -t jieyue-image . ``` -7.4:重启tomcat容器 +7.4:最后运行容器即可 ```bash -docker restart tomcat +docker run -d -p 80:80 --name jieyue jieyue-image ``` -7.5:重启tomcat后,访问配置文件中填写的服务器ip地址即可(如:笔者这里填写的是199.91.222.184,访问[http://119.91.222.184/](http://119.91.222.184/),就可以看到网站的主页)至此,捷阅网已成功部署~~!! +7.5:使用如下命令可查看项目运行日志(若有如下字眼出现,则表明容器运行成功) +```bash +docker logs jieyue +``` +![](https://img-blog.csdnimg.cn/1be4eb72a24a449d893a9d973310b073.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5LqR5Li26KiA,size_20,color_FFFFFF,t_70,g_se,x_16) + +7.6:成功运行后,访问配置文件中填写的服务器ip地址即可(如:笔者这里填写的是199.91.222.184,访问[http://119.91.222.184/](http://119.91.222.184/),就可以看到网站的主页)至此,捷阅网已成功部署~~!!
diff --git a/jieyue.sql b/jieyue.sql index 51d2b73..84acc54 100644 --- a/jieyue.sql +++ b/jieyue.sql @@ -11,7 +11,7 @@ Target Server Version : 50716 File Encoding : 65001 - Date: 07/08/2021 19:03:46 + Date: 06/12/2021 21:17:08 */ SET NAMES utf8mb4; @@ -201,17 +201,17 @@ INSERT INTO `sys_goods` VALUES (39, '棒球帽 ARCHIVE', 'PUMA彪马官方 杨 INSERT INTO `sys_goods` VALUES (40, '条纹棒球帽 ARCHIVE', 'PUMA彪马官方 新款条纹棒球帽 ARCHIVE LOGO 022554 粗呢蓝-条纹-09 均码', '/data/goods/9/20201112192208777150.jpg', 0.01, 0, 9, 0); INSERT INTO `sys_goods` VALUES (41, '运动休闲手提包', 'PUMA彪马官方娜扎同款新款女子运动休闲手提包 PRIME PUFFA 078192 银色 02 OSFA/均码', '/data/goods/9/20201112192355215509.jpg', 0.01, 0, 9, 0); INSERT INTO `sys_goods` VALUES (44, '测试商品(勿拍)', '测试商品(勿拍);测试商品(勿拍);测试商品(勿拍);测试商品(勿拍);测试商品(勿拍);测试商品(勿拍);测试商品(勿拍);测试商品(勿拍);测试商品(勿拍);测试商品(勿拍);测试商品(勿拍);测试商品(勿拍)测试商品(勿拍)!!!', '/data/goods/8/20210109201101998677.jpg', 0.01, 0, 8, 82); -INSERT INTO `sys_goods` VALUES (45, '国潮手绘皮卡丘帆布鞋', '回力官方旗舰 国潮手绘皮卡丘帆布鞋高帮男鞋联名爆改涂鸦鞋子2021新款春季潮流板鞋 黄色闪电(五天内发货) 42', '/data/goods/13/20210330212031740396.jpg', 0.01, 1, 13, 10); -INSERT INTO `sys_goods` VALUES (46, ' 国潮手绘高帮帆布鞋', '回力官方旗舰 国潮手绘高帮帆布鞋女士2021新款春季樱花鞋爆改休闲鞋男 缤纷樱花473SH(五天内发货) 42', '/data/goods/13/20210330212214866150.jpg', 0.01, 1, 13, 9); -INSERT INTO `sys_goods` VALUES (47, '本命年高帮帆布鞋', '回力官方旗舰 本命年高帮帆布鞋男鞋嘻哈透气男女休闲鞋潮流百搭学生情侣鞋子【国潮系列】 花布WXY-A363T 39', '/data/goods/13/20210330212245424549.jpg', 0.01, 1, 13, 9); -INSERT INTO `sys_goods` VALUES (48, '板鞋女鞋2021秋冬季新', '回力官方旗舰 板鞋女鞋2021秋冬季新款马卡龙撞色低帮透气百搭休闲运动小白鞋子女 白糖果WXYA562C 35', '/data/goods/13/20210330212317794584.jpg', 0.01, 1, 13, 9); -INSERT INTO `sys_goods` VALUES (49, '国潮手绘星球宇航员帆布鞋', '回力官方旗舰 国潮手绘星球宇航员帆布鞋情侣2021春夏季新款爆改NASA高帮女士板鞋男鞋子潮鞋子 星球宇航员(下单后五天内发货) 39', '/data/goods/13/20210330212343230193.jpg', 0.01, 1, 13, 10); -INSERT INTO `sys_goods` VALUES (50, '国潮手绘彩虹天使马帆布鞋', '回力官方旗舰 国潮手绘彩虹天使马帆布鞋男鞋子2021春夏季女士新款爆改手绘独角兽高帮板鞋潮鞋布鞋 彩虹天使马(下单后五天内发货) 37', '/data/goods/13/20210330212408614514.jpg', 0.01, 1, 13, 10); -INSERT INTO `sys_goods` VALUES (51, 'ins潮复古老爹鞋', '回力官方旗舰 跑步鞋男鞋2021秋季新款ins潮复古老爹鞋学生透气网面减震休闲运动鞋子男 军绿WXY0170 42', '/data/goods/13/20210330212444207204.jpg', 0.01, 1, 13, 10); -INSERT INTO `sys_goods` VALUES (52, '荧光手绘帆布鞋星际宇航员高帮鞋', '回力官方旗舰 荧光手绘帆布鞋星际宇航员高帮鞋2021新款春季男女鞋潮流休闲鞋国潮板鞋子男 夜光黑色星球宇航员 42', '/data/goods/13/20210330212516740293.jpg', 0.01, 1, 13, 10); -INSERT INTO `sys_goods` VALUES (53, '国潮手绘恶魔小丑高帮帆布鞋', '【手绘】回力官方旗舰 国潮手绘恶魔小丑高帮帆布鞋樱花爆改恶魔系情侣休闲鞋男女鞋涂鸦潮鞋子 恶魔小丑(下单后五天内发货) 42', '/data/goods/13/20210330212538705519.jpg', 0.01, 1, 13, 10); -INSERT INTO `sys_goods` VALUES (54, '国潮手绘浮世绘仙鹤鲸鱼帆布鞋', '【手绘】回力官方旗舰 国潮手绘浮世绘仙鹤鲸鱼帆布鞋男鞋手绘2021春夏季女爆改涂鸦中国风布鞋子 浮世绘仙鹤鲸鱼(下单后五天内发货) 42', '/data/goods/13/20210330212601581309.jpg', 0.01, 1, 13, 10); -INSERT INTO `sys_goods` VALUES (55, '小雏菊经典情侣高帮', '回力官方旗舰 小雏菊经典情侣高帮帆布休闲鞋男正品板鞋手绘印刷新款女高帮鞋子 黑色花(女生建议选小一码) 35', '/data/goods/13/20210330212628919032.jpg', 0.01, 1, 13, 10); +INSERT INTO `sys_goods` VALUES (45, '国潮手绘皮卡丘帆布鞋', '回力官方旗舰 国潮手绘皮卡丘帆布鞋高帮男鞋联名爆改涂鸦鞋子2021新款春季潮流板鞋 黄色闪电(五天内发货) 42', '/data/goods/13/20210330212031740396.jpg', 0.01, 1, 13, 9); +INSERT INTO `sys_goods` VALUES (46, ' 国潮手绘高帮帆布鞋', '回力官方旗舰 国潮手绘高帮帆布鞋女士2021新款春季樱花鞋爆改休闲鞋男 缤纷樱花473SH(五天内发货) 42', '/data/goods/13/20210330212214866150.jpg', 0.01, 1, 13, 8); +INSERT INTO `sys_goods` VALUES (47, '本命年高帮帆布鞋', '回力官方旗舰 本命年高帮帆布鞋男鞋嘻哈透气男女休闲鞋潮流百搭学生情侣鞋子【国潮系列】 花布WXY-A363T 39', '/data/goods/13/20210330212245424549.jpg', 0.01, 1, 13, 8); +INSERT INTO `sys_goods` VALUES (48, '板鞋女鞋2021秋冬季新', '回力官方旗舰 板鞋女鞋2021秋冬季新款马卡龙撞色低帮透气百搭休闲运动小白鞋子女 白糖果WXYA562C 35', '/data/goods/13/20210330212317794584.jpg', 0.01, 1, 13, 8); +INSERT INTO `sys_goods` VALUES (49, '国潮手绘星球宇航员帆布鞋', '回力官方旗舰 国潮手绘星球宇航员帆布鞋情侣2021春夏季新款爆改NASA高帮女士板鞋男鞋子潮鞋子 星球宇航员(下单后五天内发货) 39', '/data/goods/13/20210330212343230193.jpg', 0.01, 1, 13, 9); +INSERT INTO `sys_goods` VALUES (50, '国潮手绘彩虹天使马帆布鞋', '回力官方旗舰 国潮手绘彩虹天使马帆布鞋男鞋子2021春夏季女士新款爆改手绘独角兽高帮板鞋潮鞋布鞋 彩虹天使马(下单后五天内发货) 37', '/data/goods/13/20210330212408614514.jpg', 0.01, 1, 13, 9); +INSERT INTO `sys_goods` VALUES (51, 'ins潮复古老爹鞋', '回力官方旗舰 跑步鞋男鞋2021秋季新款ins潮复古老爹鞋学生透气网面减震休闲运动鞋子男 军绿WXY0170 42', '/data/goods/13/20210330212444207204.jpg', 0.01, 1, 13, 9); +INSERT INTO `sys_goods` VALUES (52, '荧光手绘帆布鞋星际宇航员高帮鞋', '回力官方旗舰 荧光手绘帆布鞋星际宇航员高帮鞋2021新款春季男女鞋潮流休闲鞋国潮板鞋子男 夜光黑色星球宇航员 42', '/data/goods/13/20210330212516740293.jpg', 0.01, 1, 13, 9); +INSERT INTO `sys_goods` VALUES (53, '国潮手绘恶魔小丑高帮帆布鞋', '【手绘】回力官方旗舰 国潮手绘恶魔小丑高帮帆布鞋樱花爆改恶魔系情侣休闲鞋男女鞋涂鸦潮鞋子 恶魔小丑(下单后五天内发货) 42', '/data/goods/13/20210330212538705519.jpg', 0.01, 1, 13, 9); +INSERT INTO `sys_goods` VALUES (54, '国潮手绘浮世绘仙鹤鲸鱼帆布鞋', '【手绘】回力官方旗舰 国潮手绘浮世绘仙鹤鲸鱼帆布鞋男鞋手绘2021春夏季女爆改涂鸦中国风布鞋子 浮世绘仙鹤鲸鱼(下单后五天内发货) 42', '/data/goods/13/20210330212601581309.jpg', 0.01, 1, 13, 9); +INSERT INTO `sys_goods` VALUES (55, '小雏菊经典情侣高帮', '回力官方旗舰 小雏菊经典情侣高帮帆布休闲鞋男正品板鞋手绘印刷新款女高帮鞋子 黑色花(女生建议选小一码) 35', '/data/goods/13/20210330212628919032.jpg', 0.01, 1, 13, 9); INSERT INTO `sys_goods` VALUES (56, '国潮蓝手绘经典款帆布鞋', '回力官方旗舰 国潮蓝手绘经典款帆布鞋高帮男女2021春季新款情侣国潮红百搭休闲爆改涂鸦鞋子 国潮蓝(下单后五天内发货) 41', '/data/goods/13/20210330212653590038.jpg', 0.01, 1, 13, 10); INSERT INTO `sys_goods` VALUES (57, '运动裤卫裤', '李宁运动裤卫裤女官方旗舰网运动时尚系列女子收口卫裤休闲长裤时尚 黑色A-5 M', '/data/goods/12/20210330213038709716.jpg', 0.01, 1, 12, 10); INSERT INTO `sys_goods` VALUES (59, 'T恤短袖女夏季新品', '李宁T恤短袖女夏季新品女子休闲运动短袖T恤青年薄款休闲跑步健身服圆领休闲上衣短袖官方旗舰网 浅桃粉-3 M', '/data/goods/12/20210330213112628569.jpg', 0.01, 1, 12, 10); @@ -359,7 +359,7 @@ CREATE TABLE `sys_order` ( `merchant_ratio` float(11, 1) NOT NULL DEFAULT 1.0 COMMENT '订单创建时商户的费率', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `order_id`(`order_id`) USING BTREE COMMENT '订单号唯一' -) ENGINE = InnoDB AUTO_INCREMENT = 94 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 112 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of sys_order @@ -375,6 +375,17 @@ INSERT INTO `sys_order` VALUES (90, 'WVW202012341002151359796', 1607185311336, 1 INSERT INTO `sys_order` VALUES (91, 'QAK202012341002151746672', 1607185311336, 1607185323819, 1, 1, 'SDW202012341002151596097', 1, 5, 0.01, 19, '', '测试', '测试', '测试', '', 0, '/data/pay/SDW202012341002151596097.jpg', '1', 0.1); INSERT INTO `sys_order` VALUES (92, 'YYT202012341004300490850', 1607186580573, 1607186595850, 1, 1, 'NFF202012341004300926613', 1, 8, 0.01, 34, '', '测试', '测试', '测试', '', 0, '/data/pay/NFF202012341004300926613.jpg', '13', 0.1); INSERT INTO `sys_order` VALUES (93, 'LID202012341004300509122', 1607186580573, 1607186595850, 1, 1, 'NFF202012341004300926613', 1, 5, 0.01, 19, '', '测试', '测试', '测试', '', 0, '/data/pay/NFF202012341004300926613.jpg', '10', 0.1); +INSERT INTO `sys_order` VALUES (101, 'GKJ202112340211010176213', 1638796210886, 1638796384928, 1, 1, 'GAU202112340211010908695', 1, 13, 0.01, 45, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/11f3333f-6d68-4adb-9cf6-035a39a4a551.jpg', NULL, 0.0); +INSERT INTO `sys_order` VALUES (102, 'ZSS202112340211024283551', 1638796224161, 1638796384928, 1, 1, 'ELN202112340211024324951', 1, 13, 0.01, 46, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/147fb8b1-18ac-480a-8d57-2c21635d9519.jpg', NULL, 0.0); +INSERT INTO `sys_order` VALUES (103, 'ZDK202112340211037495045', 1638796237222, 1638796384928, 1, 1, 'IJD202112340211037974203', 1, 13, 0.01, 47, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/4801e190-5640-4f14-a593-66029aa2d0ea.jpg', NULL, 0.0); +INSERT INTO `sys_order` VALUES (104, 'UWU202112340211051689881', 1638796251864, 1638796384928, 1, 1, 'NTP202112340211051560839', 1, 13, 0.01, 48, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/896bd6fa-e609-405c-b601-caa56d71659f.jpg', NULL, 0.0); +INSERT INTO `sys_order` VALUES (105, 'LAW202112340211111244316', 1638796271424, 1638796384928, 1, 1, 'EVM202112340211111457150', 1, 13, 0.01, 49, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/814b7cf6-3e81-4356-aa27-023bf2eb0609.jpg', NULL, 0.0); +INSERT INTO `sys_order` VALUES (106, 'QZG202112340211127932176', 1638796287661, 1638796384928, 1, 1, 'CKX202112340211127838508', 1, 13, 0.01, 50, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/2a3ecc4c-62e4-4964-aa75-1c2a3d082ba1.jpg', NULL, 0.0); +INSERT INTO `sys_order` VALUES (107, 'MVF202112340211155962656', 1638796315927, 1638796384928, 1, 1, 'GXI202112340211155762974', 1, 13, 0.01, 51, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/175a4dc6-1077-46ef-b64e-0e2a9ae66ee0.jpg', NULL, 0.0); +INSERT INTO `sys_order` VALUES (108, 'GYV202112340211210918392', 1638796330108, 1638796384928, 1, 1, 'NJY202112340211210411460', 1, 13, 0.01, 52, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/b7e61e0a-fea6-4022-b9bb-a3949220c085.jpg', NULL, 0.0); +INSERT INTO `sys_order` VALUES (109, 'XAB202112340211229316121', 1638796349401, 1638796384928, 1, 1, 'BGA202112340211229992111', 1, 13, 0.01, 53, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/9d358e5a-638e-4437-8a00-d9f942e5f58f.jpg', NULL, 0.0); +INSERT INTO `sys_order` VALUES (110, 'YUL202112340211250396901', 1638796370482, 1638796384928, 1, 1, 'OAX202112340211250369042', 1, 13, 0.01, 54, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/3db2f150-1b6d-41fa-8b6d-eca59c5f39cc.jpg', NULL, 0.0); +INSERT INTO `sys_order` VALUES (111, 'BHY202112340211304317807', 1638796384928, 1638796384928, 1, 1, 'ETZ202112340211304214293', 1, 13, 0.01, 55, '', 'xxxxxxxxxxxxx', 'Bosen', '123456', '', 0, 'data/pay/87b2e60d-464c-499a-90be-b93e1ea58911.jpg', NULL, 0.0); -- ---------------------------- -- Table structure for sys_role @@ -499,7 +510,7 @@ CREATE TABLE `sys_user` ( -- ---------------------------- -- Records of sys_user -- ---------------------------- -INSERT INTO `sys_user` VALUES (1, 'test', 'e10adc3949ba59abbe56e057f20f883e', 'bosen_once@163.com', 1, '/data/header/user/1.jpg'); +INSERT INTO `sys_user` VALUES (1, 'Bosen', 'e10adc3949ba59abbe56e057f20f883e', 'bosen_once@163.com', 1, '/data/header/user/1.jpg'); INSERT INTO `sys_user` VALUES (3, 'bosen_once@qq.com', 'e10adc3949ba59abbe56e057f20f883e', 'bosen_once@qq.com', 1, '/data/header/user/default.jpg'); INSERT INTO `sys_user` VALUES (4, 'test111', 'e10adc3949ba59abbe56e057f20f883e', '806317173@qq.com', 0, '/data/header/user/default.jpg'); INSERT INTO `sys_user` VALUES (5, 'lalalal', 'e10adc3949ba59abbe56e057f20f883e', '2390025288@qq.com', 0, '/data/header/user/default.jpg'); diff --git a/pom.xml b/pom.xml index 177bc77..bde6726 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.example jieyue 0.0.1-SNAPSHOT - war + jar jieyue Demo project for Spring Boot @@ -19,7 +19,6 @@ UTF-8 UTF-8 1.8 - 8.5.29 @@ -60,34 +59,32 @@ org.springframework.boot spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-tomcat - - + org.springframework.boot spring-boot-devtools true + mysql mysql-connector-java runtime + org.mybatis.spring.boot mybatis-spring-boot-starter 2.1.3 + org.projectlombok lombok true + org.springframework.boot spring-boot-starter-test @@ -127,11 +124,13 @@ qrgen 1.4 + com.alibaba fastjson 1.2.47 + org.springframework.data spring-data-redis @@ -158,15 +157,27 @@ org.springframework.boot spring-boot-starter-amqp + + + cn.hutool + hutool-all + 5.5.8 + + + org.springframework + spring-test + 5.3.12 + compile + - ROOT + jieyue - + org.apache.maven.plugins maven-compiler-plugin diff --git a/src/main/java/com/example/jieyue/JieyueApplication.java b/src/main/java/com/example/jieyue/JieyueApplication.java index d724c34..bbb3e5e 100644 --- a/src/main/java/com/example/jieyue/JieyueApplication.java +++ b/src/main/java/com/example/jieyue/JieyueApplication.java @@ -1,15 +1,9 @@ package com.example.jieyue; -import org.apache.catalina.connector.Connector; -import org.apache.coyote.http11.AbstractHttp11Protocol; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.servlet.ServletComponentScan; -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; -import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; /** @@ -21,35 +15,10 @@ import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @ServletComponentScan @EnableScheduling -public class JieyueApplication extends SpringBootServletInitializer { +public class JieyueApplication { public static void main(String[] args) { SpringApplication.run(JieyueApplication.class, args); } - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { - return builder.sources(JieyueApplication.class); - } - - /** - *

处理文件过大上传失败的问题

- */ - @Bean - public TomcatServletWebServerFactory containerFactory() { - return new TomcatServletWebServerFactory() { - protected void customizeConnector(Connector connector) { - int maxSize = 50000000; - super.customizeConnector(connector); - connector.setMaxPostSize(maxSize); - connector.setMaxSavePostSize(maxSize); - if (connector.getProtocolHandler() instanceof AbstractHttp11Protocol) { - - ((AbstractHttp11Protocol ) connector.getProtocolHandler()).setMaxSwallowSize(maxSize); - logger.info("Set MaxSwallowSize "+ maxSize); - } - } - }; - - } } diff --git a/src/main/java/com/example/jieyue/admin/controller/AdminUiController.java b/src/main/java/com/example/jieyue/admin/controller/AdminUiController.java index 30d8c75..b98ad66 100644 --- a/src/main/java/com/example/jieyue/admin/controller/AdminUiController.java +++ b/src/main/java/com/example/jieyue/admin/controller/AdminUiController.java @@ -4,6 +4,7 @@ import com.example.jieyue.admin.service.AdminUiService; import com.example.jieyue.common.entity.SysUi; import com.example.jieyue.user.service.UserHomeService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @@ -12,6 +13,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; import java.util.Map; +import java.util.Set; /** *

网页图片UI设置

@@ -24,6 +26,8 @@ public class AdminUiController { AdminUiService adminUiService; @Autowired UserHomeService userHomeService; + @Autowired + RedisTemplate redisTemplate; @RequestMapping("/admin/ui") public ModelAndView index(ModelAndView modelAndView){ @@ -46,7 +50,7 @@ public class AdminUiController { modelAndView.addObject("msg","文件上传失败"); }else{ modelAndView.addObject("msg","文件上传成功"); - + clearCache(); } } modelAndView.setViewName("redirect:ui"); @@ -61,9 +65,18 @@ public class AdminUiController { modelAndView.setViewName("redirect:ui"); if (adminUiService.delImg(width,height)){ modelAndView.addObject("msg","删除成功"); + clearCache(); }else{ modelAndView.addObject("msg","删除失败"); } return modelAndView; } + + /** + *

清首页缓存

+ */ + public void clearCache() { + Set keys = redisTemplate.keys("*"); + redisTemplate.delete(keys); + } } diff --git a/src/main/java/com/example/jieyue/admin/service/AdminMerchantService.java b/src/main/java/com/example/jieyue/admin/service/AdminMerchantService.java index 1afbf3d..65ab1f7 100644 --- a/src/main/java/com/example/jieyue/admin/service/AdminMerchantService.java +++ b/src/main/java/com/example/jieyue/admin/service/AdminMerchantService.java @@ -2,6 +2,7 @@ package com.example.jieyue.admin.service; import com.example.jieyue.common.entity.SysMt; import com.example.jieyue.common.mapper.SysMtMapper; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,7 +20,11 @@ public class AdminMerchantService { */ public List getMtInfo(int curPage,int pageSize){ int curRow = (curPage-1)*pageSize; - return mtMapper.findPage(curRow,pageSize); + List list = mtMapper.findPage(curRow,pageSize); + for (SysMt sysMt : list) { + sysMt.setHeader(GiteeImgBedUtils.PRE + sysMt.getHeader()); + } + return list; } /** diff --git a/src/main/java/com/example/jieyue/admin/service/AdminUiService.java b/src/main/java/com/example/jieyue/admin/service/AdminUiService.java index 80f9db3..bcd5ae9 100644 --- a/src/main/java/com/example/jieyue/admin/service/AdminUiService.java +++ b/src/main/java/com/example/jieyue/admin/service/AdminUiService.java @@ -1,22 +1,16 @@ package com.example.jieyue.admin.service; import com.example.jieyue.common.mapper.SysUiMapper; -import com.example.jieyue.common.utils.DateUtil; -import com.example.jieyue.common.utils.FileUtil; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.support.RedirectAttributes; -import org.thymeleaf.util.StringUtils; import javax.servlet.http.HttpServletRequest; @Service public class AdminUiService { - @Autowired - FileUtil fileUtil; - @Autowired - DateUtil dateUtil; @Autowired SysUiMapper uiMapper; @@ -28,32 +22,30 @@ public class AdminUiService { */ public String upImage(MultipartFile file, RedirectAttributes redirectAttributes, HttpServletRequest request, String url,int weight,int height) { - // 设置filename 文件名由年月日时分秒以及六位随机数组成 - String filename = dateUtil.getNMDHIS()+Math.round(Math.random()*(999999-100000)+100000); // 接收文件工具类返回的文件位置 - String result = fileUtil.upFile(file,redirectAttributes,request,url,filename); - if (result==null){ + String result = GiteeImgBedUtils.upload(url, file); + if (result == null){ return null; }else{ if (uiMapper.findByMark(weight,height) == null) { int insertRes = uiMapper.insert(result, weight, height); if (insertRes == 1) { - return filename; + return result; } else { // sql语句执行失败,将已上传的图片移除 - fileUtil.deleteFile(result); + GiteeImgBedUtils.delete(result); return null; } }else{ // 删除旧图片 - fileUtil.deleteFile(uiMapper.findByMark(weight,height).getUrl()); + GiteeImgBedUtils.delete(uiMapper.findByMark(weight,height).getUrl()); // 更改图片 int updateRes = uiMapper.updateUrl(result,weight,height); if (updateRes == 1) { - return filename; + return result; } else { // sql语句执行失败,将已上传的图片移除 - fileUtil.deleteFile(result); + GiteeImgBedUtils.delete(result); return null; } } @@ -64,11 +56,11 @@ public class AdminUiService { *

删除海报逻辑处理

*/ public boolean delImg(int width,int height){ - if (uiMapper.findByMark(width,height)==null){ + if (uiMapper.findByMark(width,height) == null){ return false; }else{ - fileUtil.deleteFile(uiMapper.findByMark(width,height).getUrl()); - int delResult = uiMapper.deleteByMark(width,height); + GiteeImgBedUtils.delete(uiMapper.findByMark(width, height).getUrl()); + int delResult = uiMapper.deleteByMark(width, height); if (delResult == 1) { return true; } diff --git a/src/main/java/com/example/jieyue/admin/service/AdminUserService.java b/src/main/java/com/example/jieyue/admin/service/AdminUserService.java index b491c84..7379a3d 100644 --- a/src/main/java/com/example/jieyue/admin/service/AdminUserService.java +++ b/src/main/java/com/example/jieyue/admin/service/AdminUserService.java @@ -2,6 +2,7 @@ package com.example.jieyue.admin.service; import com.example.jieyue.common.entity.SysUser; import com.example.jieyue.common.mapper.SysUserMapper; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -16,7 +17,11 @@ public class AdminUserService { *

获取用户信息

*/ public List getUserList(int page, int num){ - return userMapper.findLimit((page-1)*num,num); + List list = userMapper.findLimit((page-1)*num,num); + for (SysUser user : list) { + user.setHeader(GiteeImgBedUtils.PRE + user.getHeader()); + } + return list; } /** diff --git a/src/main/java/com/example/jieyue/common/task/SchedulerTask.java b/src/main/java/com/example/jieyue/common/task/SchedulerTask.java index 942d665..3d78cdd 100644 --- a/src/main/java/com/example/jieyue/common/task/SchedulerTask.java +++ b/src/main/java/com/example/jieyue/common/task/SchedulerTask.java @@ -5,7 +5,7 @@ import com.example.jieyue.common.mapper.SysGoodsMapper; import com.example.jieyue.common.mapper.SysNoticeMapper; import com.example.jieyue.common.mapper.SysOrderMapper; import com.example.jieyue.common.service.MailService; -import com.example.jieyue.common.utils.FileUtil; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.scheduling.annotation.Scheduled; @@ -13,7 +13,6 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,8 +28,6 @@ public class SchedulerTask { @Autowired SysGoodsMapper goodsMapper; @Autowired - FileUtil fileUtil; - @Autowired RedisTemplate redisTemplate; @Autowired SysNoticeMapper noticeMapper; @@ -43,15 +40,15 @@ public class SchedulerTask { @Scheduled(cron="0 0/1 * * * ?") @Transactional public void delOverOrder(){ - long time = 2*60*60*1000;// 订单过期时间,两小时 + // 订单过期时间,两小时 + long time = 2*60*60*1000; List list = orderMapper.findByState(0); for (SysOrder sysOrder : list) { - if (System.currentTimeMillis() > sysOrder.getCreateTime()+time){ - if (orderMapper.deleteById(sysOrder.getId())!=1 || + if (System.currentTimeMillis() > sysOrder.getCreateTime() + time + && sysOrder.getOrderState() == 0){ + if (orderMapper.deleteById(sysOrder.getId()) != 1 || goodsMapper.addStock(sysOrder.getGoodsId(),sysOrder.getGoodsNum()) != 1){ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - }else{ - fileUtil.deleteFile(sysOrder.getPayCodeUrl()); } } } @@ -62,11 +59,13 @@ public class SchedulerTask { */ @Scheduled(cron="0 0/1 * * * ?") public void delQRCode(){ - long time = 2*60*60*1000;// 订单过期时间,两小时 + // 订单过期时间,两小时 + long time = 2*60*60*1000; List list = orderMapper.findAll(); for (SysOrder sysOrder : list) { - if (System.currentTimeMillis() > sysOrder.getCreateTime()+time){ - fileUtil.deleteFile(sysOrder.getPayCodeUrl()); + if (System.currentTimeMillis() > sysOrder.getCreateTime() + time + && sysOrder.getOrderState() == 0){ + GiteeImgBedUtils.delete(sysOrder.getPayCodeUrl()); } } } @@ -83,19 +82,8 @@ public class SchedulerTask { int type = Integer.valueOf(map.get("type")); int receive = Integer.valueOf(map.get("receive")); long createTime = Long.valueOf(map.get("createTime")); - switch (type){ - case 0: - noticeMapper.insert(title,context,type,receive,createTime); - break; - case 1: - noticeMapper.insert(title,context,type,receive,createTime); - break; - case 2: - noticeMapper.insert(title,context,type,receive,createTime); - break; - default: - break; - } + + noticeMapper.insert(title,context,type,receive,createTime); } } diff --git a/src/main/java/com/example/jieyue/common/utils/DateUtil.java b/src/main/java/com/example/jieyue/common/utils/DateUtil.java deleted file mode 100644 index d9d9e99..0000000 --- a/src/main/java/com/example/jieyue/common/utils/DateUtil.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.example.jieyue.common.utils; - -import org.springframework.stereotype.Component; - -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - *

时间工具类

- * @author Bosen - * 2020/11/6 10:36 - */ -@Component -public class DateUtil { - /** - *

获取纯年月日时分秒的字符串

- */ - public String getNMDHIS(){ - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); - return sdf.format(new Date()); - } -} diff --git a/src/main/java/com/example/jieyue/common/utils/FileUtil.java b/src/main/java/com/example/jieyue/common/utils/FileUtil.java deleted file mode 100644 index 5e4e5d5..0000000 --- a/src/main/java/com/example/jieyue/common/utils/FileUtil.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.example.jieyue.common.utils; - -import org.apache.commons.io.FileUtils; -import org.springframework.stereotype.Component; -import org.springframework.util.ResourceUtils; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.servlet.mvc.support.RedirectAttributes; - -import javax.servlet.http.HttpServletRequest; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; - -/** - *

文件操作工具类

- * @author Bosen - * 2020/11/5 22:55 - */ -@Component -public class FileUtil { - - String classpath; - public FileUtil() throws FileNotFoundException { - this.classpath = ResourceUtils.getFile("classpath:/static").getPath()+"\\"; - } - - /** - *

文件上传逻辑处理

- * @return - * null 上传失败 - * 文件名 上传成功 - */ - public String upFile(MultipartFile file, RedirectAttributes redirectAttributes, - HttpServletRequest request,String url,String filename) { - // MultipartFile是对当前上传的文件的封装,当要同时上传多个文件时,可以给定多个MultipartFile参数(数组) - if (file.isEmpty()) { - redirectAttributes.addFlashAttribute("message", "Please select a file to upload"); - return null; - } - // 取文件格式后缀名 - // String type = file.getOriginalFilename().substring(file.getOriginalFilename().indexOf(".")); - - File savefile1 = new File(classpath+url); - //判断上传文件的保存目录是否存在 - if (!savefile1.exists() && !savefile1.isDirectory()) { - System.out.println(classpath+"目录不存在,需要创建"); - //创建目录 - savefile1.mkdir(); - } - String suffix = this.getSuffixName(file.getOriginalFilename()); - try { - // FileUtils.copyInputStreamToFile()这个方法里对IO进行了自动操作,不需要额外的再去关闭IO流 - // 加入原工程static目录 - FileUtils.copyInputStreamToFile(file.getInputStream(), new File(savefile1+"/"+filename+"."+suffix));// 复制临时文件到指定目录下 - } catch (IOException e) { - e.printStackTrace(); - } - return url+filename+"."+suffix; - } - - /** - *

获取文件后缀名

- */ - public String getSuffixName(String filename){ - String[] strArray = filename.split("\\."); - int suffixIndex = strArray.length -1; - return strArray[suffixIndex]; - } - - /** - *

删除文件

- */ - public void deleteFile(String url){ - File file1 = new File(classpath+url); - file1.delete(); - } - -} diff --git a/src/main/java/com/example/jieyue/common/utils/GiteeImgBedUtils.java b/src/main/java/com/example/jieyue/common/utils/GiteeImgBedUtils.java new file mode 100644 index 0000000..a54dc24 --- /dev/null +++ b/src/main/java/com/example/jieyue/common/utils/GiteeImgBedUtils.java @@ -0,0 +1,183 @@ +package com.example.jieyue.common.utils; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class GiteeImgBedUtils { + /** + * 码云私人令牌 + */ + private static final String ACCESS_TOKEN = "98016b93bd85d836c5158bf340c32d35"; + + /** + * 码云个人空间名 + */ + private static final String OWNER = "bosen-once"; + + /** + * 上传指定仓库 + */ + private static final String REPO = "cloud-disk"; + + /** + * 图片访问前缀 + */ + public static final String PRE = + "https://gitee.com/" + OWNER + "/" + REPO + "/raw/master/"; + + /** + * 新建(POST)、获取(GET)、删除(DELETE)文件:()中指的是使用对应的请求方式 + * %s =>仓库所属空间地址(企业、组织或个人的地址path) (owner) + * %s => 仓库路径(repo) + * %s => 文件的路径(path) + */ + private static final String API_CREATE_POST = + "https://gitee.com/api/v5/repos/%s/%s/contents/%s"; + + /** + * 用于提交描述 + */ + private static final String ADD_MESSAGE = "add file"; + private static final String DEL_MESSAGE = "del file"; + + /** + *

上传文件

+ * @param multipartFile 文件 + * @return 返回文件下载路径后缀 + */ + public static String upload(String path, MultipartFile multipartFile) { + String originalFilename = multipartFile.getOriginalFilename(); + if(originalFilename == null){ + return null; + } + String targetUrl = GiteeImgBedUtils.createUploadFileUrl(path, originalFilename); + // 请求体封装 + Map map = null; + try { + map = GiteeImgBedUtils.getUploadBodyMap(multipartFile.getBytes()); + } catch (IOException e) { + return null; + } + // 借助HttpUtil工具类发送POST请求 + String jsonResult = HttpUtil.post(targetUrl, map); + // 解析响应JSON字符串 + JSONObject jsonObj = JSONUtil.parseObj(jsonResult); + // 请求失败 + if(jsonObj.getObj("commit") == null){ + return null; + } + //请求成功:返回下载地址 + JSONObject content = JSONUtil.parseObj(jsonObj.getObj("content")); + return content.getObj("path").toString(); + } + + /** + *

删除

+ */ + public static boolean delete(String path) { + try { + String targetUrl = GiteeImgBedUtils.deleteFileUrl(path); + Map map = getDeleteBodyMap(path); + // 发送delete请求 + String jsonResult = HttpRequest.delete(targetUrl).form(map).execute().body(); + // 解析响应JSON字符串 + JSONObject jsonObj = JSONUtil.parseObj(jsonResult); + return jsonObj.getObj("commit") != null; + } catch (Exception e) { + return false; + } + } + + /** + *

获取sha信息

+ */ + private static String getShaInfo(String path) { + String targetUrl = GiteeImgBedUtils.deleteFileUrl(path); + Map map = getFileInfoBodyMap(); + // 借助HttpUtil工具类发送get请求 + String jsonResult = HttpUtil.get(targetUrl, map); + // 解析响应JSON字符串 + JSONObject jsonObj = JSONUtil.parseObj(jsonResult); + if (jsonObj.getObj("sha") == null) { + return null; + } + return jsonObj.getObj("sha").toString(); + } + + /** + * 生成创建(获取、删除)的指定文件路径 + */ + private static String createUploadFileUrl(String path, String originalFilename){ + //获取文件后缀 + String suffix = getFileSuffix(originalFilename); + //拼接存储的图片名称 + String fileName = UUID.randomUUID().toString() + suffix; + //填充请求路径 + return String.format(GiteeImgBedUtils.API_CREATE_POST, + GiteeImgBedUtils.OWNER, + GiteeImgBedUtils.REPO, + path + "/" + fileName); + } + + /** + *

生成删除链接

+ */ + private static String deleteFileUrl(String path) { + return String.format(GiteeImgBedUtils.API_CREATE_POST, + GiteeImgBedUtils.OWNER, + GiteeImgBedUtils.REPO, + path); + } + + /** + * 获取创建文件的请求体map集合:access_token、message、content + * @param multipartFile 文件字节数组 + * @return 封装成map的请求体集合 + */ + private static Map getUploadBodyMap(byte[] multipartFile){ + HashMap bodyMap = new HashMap<>(3); + bodyMap.put("access_token", GiteeImgBedUtils.ACCESS_TOKEN); + bodyMap.put("message", GiteeImgBedUtils.ADD_MESSAGE); + bodyMap.put("content", Base64.encode(multipartFile)); + return bodyMap; + } + + /** + * 获取删除文件的请求体map集合:access_token、path、sha、message + * @return 封装成map的请求体集合 + */ + private static Map getDeleteBodyMap(String path){ + HashMap bodyMap = new HashMap<>(3); + bodyMap.put("access_token", GiteeImgBedUtils.ACCESS_TOKEN); + bodyMap.put("message", GiteeImgBedUtils.DEL_MESSAGE); + bodyMap.put("sha", getShaInfo(path)); + return bodyMap; + } + + /** + * 获取sha的请求体map集合:access_token + * @return 封装成map的请求体集合 + */ + private static Map getFileInfoBodyMap(){ + HashMap bodyMap = new HashMap<>(3); + bodyMap.put("access_token", GiteeImgBedUtils.ACCESS_TOKEN); + return bodyMap; + } + + /** + * 获取文件名的后缀,如:changlu.jpg => .jpg + * @return 文件后缀名 + */ + private static String getFileSuffix(String fileName) { + return fileName.contains(".") ? fileName.substring(fileName.indexOf('.')) : null; + } +} \ No newline at end of file diff --git a/src/main/java/com/example/jieyue/common/utils/IsEmptyUtil.java b/src/main/java/com/example/jieyue/common/utils/IsEmptyUtil.java index a0d208b..27cfa9c 100644 --- a/src/main/java/com/example/jieyue/common/utils/IsEmptyUtil.java +++ b/src/main/java/com/example/jieyue/common/utils/IsEmptyUtil.java @@ -26,7 +26,7 @@ public class IsEmptyUtil { */ public boolean strings(String ... strings){ for (String string : strings) { - if (string==null || string.equals("")){ + if (string==null || "".equals(string)){ return true; } } @@ -37,7 +37,7 @@ public class IsEmptyUtil { *

单个字符串判空操作

*/ public boolean string(String string){ - if (string==null || string.equals("")){ + if (string==null || "".equals(string)){ return true; }else{ return false; diff --git a/src/main/java/com/example/jieyue/common/utils/JsonUtil.java b/src/main/java/com/example/jieyue/common/utils/JsonUtil.java deleted file mode 100644 index fb56850..0000000 --- a/src/main/java/com/example/jieyue/common/utils/JsonUtil.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.example.jieyue.common.utils; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import org.springframework.stereotype.Component; - -@Component -public class JsonUtil { - - /** - * 字符串转整数型数组 - */ - public int[] jsonToIntArray(String json){ - JSONArray jsonArray = JSON.parseArray(json); - int[] array = new int[jsonArray.size()]; - for (int i = 0;i < jsonArray.size();i++){ - array[i] = (Integer) jsonArray.get(i); - } - return array; - } -} diff --git a/src/main/java/com/example/jieyue/common/utils/QRCodeUtil.java b/src/main/java/com/example/jieyue/common/utils/QRCodeUtil.java index 8a865bb..8ee11e4 100644 --- a/src/main/java/com/example/jieyue/common/utils/QRCodeUtil.java +++ b/src/main/java/com/example/jieyue/common/utils/QRCodeUtil.java @@ -4,8 +4,7 @@ import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; +import java.io.*; import java.util.*; import javax.imageio.ImageIO; import com.google.zxing.BarcodeFormat; @@ -22,6 +21,8 @@ import com.google.zxing.client.j2se.BufferedImageLuminanceSource; import com.google.zxing.common.BitMatrix; import com.google.zxing.common.HybridBinarizer; import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.web.multipart.MultipartFile; /** * 二维码生成解析工具类 @@ -51,27 +52,27 @@ public class QRCodeUtil { * * @param content 二维码包含的内容,文本或网址 * @param path 生成的二维码图片存放位置 - * @param filename 生成的二维码图片存放位置 * @param size 生成的二维码图片尺寸 可以自定义或者默认(250) * @param logoPath logo的存放位置 */ - public static boolean zxingCodeCreate(String content, String path, String filename,Integer size, String logoPath) { + public static String zxingCodeCreate(String content, String path, Integer size, String logoPath) { try { //图片类型 String imageType = "jpg"; //获取二维码流的形式,写入到目录文件中 BufferedImage image = getBufferedImage(content, size, logoPath); - - //生成二维码存放文件 - File file = new File(path+filename+".jpg"); - if (!file.exists()) { - file.mkdirs(); - } - ImageIO.write(image, imageType, file); - return true; + //创建一个ByteArrayOutputStream + ByteArrayOutputStream os = new ByteArrayOutputStream(); + //把BufferedImage写入ByteArrayOutputStream + ImageIO.write(image, imageType, os); + //ByteArrayOutputStream转成InputStream + InputStream input = new ByteArrayInputStream(os.toByteArray()); + //InputStream转成MultipartFile + MultipartFile multipartFile = new MockMultipartFile("file", "file.jpg", "text/plain", input); + return GiteeImgBedUtils.upload(path, multipartFile); } catch (IOException e) { e.printStackTrace(); - return false; + return null; } } diff --git a/src/main/java/com/example/jieyue/common/utils/StringUtil.java b/src/main/java/com/example/jieyue/common/utils/StringUtil.java deleted file mode 100644 index 270a52c..0000000 --- a/src/main/java/com/example/jieyue/common/utils/StringUtil.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.example.jieyue.common.utils; - -import org.springframework.stereotype.Component; - -import java.util.Map; - -@Component -public class StringUtil { - public static String GetMapToXML(Map param){ - StringBuffer sb = new StringBuffer(); - sb.append(""); - for (Map.Entry entry : param.entrySet()) { - sb.append("<"+ entry.getKey() +">"); - sb.append(entry.getValue()); - sb.append(""); - } - sb.append(""); - return sb.toString(); - } -} diff --git a/src/main/java/com/example/jieyue/merchant/controller/MerchantGoodsController.java b/src/main/java/com/example/jieyue/merchant/controller/MerchantGoodsController.java index cf37c66..3bd8e0e 100644 --- a/src/main/java/com/example/jieyue/merchant/controller/MerchantGoodsController.java +++ b/src/main/java/com/example/jieyue/merchant/controller/MerchantGoodsController.java @@ -4,6 +4,7 @@ import com.example.jieyue.common.entity.SysGoods; import com.example.jieyue.common.entity.SysMt; import com.example.jieyue.merchant.service.MerchantGoodsService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -15,6 +16,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.math.BigDecimal; import java.util.List; +import java.util.Set; /** *

商户商品管理页面

@@ -25,6 +27,8 @@ import java.util.List; public class MerchantGoodsController { @Autowired MerchantGoodsService goodsService; + @Autowired + RedisTemplate redisTemplate; /** *

商品管理页面

@@ -77,6 +81,7 @@ public class MerchantGoodsController { break; case 1: modelAndView.addObject("msg","添加商品成功"); + clearCache(); break; case 2: modelAndView.addObject("msg","必填信息不能为空"); @@ -96,6 +101,7 @@ public class MerchantGoodsController { int res = goodsService.delGoods(id); if (res == 1){ modelAndView.addObject("msg","删除成功"); + clearCache(); }else{ modelAndView.addObject("msg","删除失败"); } @@ -110,8 +116,9 @@ public class MerchantGoodsController { public ModelAndView putGoods(ModelAndView modelAndView,int id){ if (goodsService.putGoods(id)){ modelAndView.addObject("msg","上架商品成功"); + clearCache(); }else{ - modelAndView.addObject("msg","上架商品成功"); + modelAndView.addObject("msg","上架商品失败"); } modelAndView.setViewName("redirect:goods"); return modelAndView; @@ -124,8 +131,9 @@ public class MerchantGoodsController { public ModelAndView OffGoods(ModelAndView modelAndView,int id){ if (goodsService.OffGoods(id)){ modelAndView.addObject("msg","下架商品成功"); + clearCache(); }else{ - modelAndView.addObject("msg","下架商品成功"); + modelAndView.addObject("msg","下架商品失败"); } modelAndView.setViewName("redirect:goods"); return modelAndView; @@ -164,6 +172,7 @@ public class MerchantGoodsController { break; case 1: modelAndView.addObject("msg","修改商品成功"); + clearCache(); break; case 2: modelAndView.addObject("msg","必填信息不能为空"); @@ -174,4 +183,12 @@ public class MerchantGoodsController { modelAndView.setViewName("redirect:goods"); return modelAndView; } + + /** + *

清首页缓存

+ */ + public void clearCache() { + Set keys = redisTemplate.keys("*"); + redisTemplate.delete(keys); + } } diff --git a/src/main/java/com/example/jieyue/merchant/controller/MerchantLoginController.java b/src/main/java/com/example/jieyue/merchant/controller/MerchantLoginController.java index 223e709..b345e19 100644 --- a/src/main/java/com/example/jieyue/merchant/controller/MerchantLoginController.java +++ b/src/main/java/com/example/jieyue/merchant/controller/MerchantLoginController.java @@ -1,6 +1,7 @@ package com.example.jieyue.merchant.controller; import com.example.jieyue.common.entity.SysMt; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import com.example.jieyue.merchant.service.MerchantLoginService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; @@ -50,7 +51,8 @@ public class MerchantLoginController { modelAndView.addObject("msg","您的账号处于停用状态,请等待管理员处理"); break; } - session.setAttribute("merchant",merchant); + merchant.setHeader(GiteeImgBedUtils.PRE + merchant.getHeader()); + session.setAttribute("merchant", merchant); break; default: break; diff --git a/src/main/java/com/example/jieyue/merchant/controller/MerchantUiController.java b/src/main/java/com/example/jieyue/merchant/controller/MerchantUiController.java index 1e9b007..805d0b3 100644 --- a/src/main/java/com/example/jieyue/merchant/controller/MerchantUiController.java +++ b/src/main/java/com/example/jieyue/merchant/controller/MerchantUiController.java @@ -3,6 +3,7 @@ package com.example.jieyue.merchant.controller; import com.example.jieyue.common.entity.SysMtUi; import com.example.jieyue.merchant.service.MerchantUiService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @@ -10,6 +11,7 @@ import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; +import java.util.Set; /** *

店铺样式设计

@@ -20,6 +22,8 @@ import javax.servlet.http.HttpServletRequest; public class MerchantUiController { @Autowired MerchantUiService uiService; + @Autowired + RedisTemplate redisTemplate; @RequestMapping("/merchant/ui") public ModelAndView index(ModelAndView modelAndView, HttpServletRequest request){ @@ -42,6 +46,7 @@ public class MerchantUiController { switch (res){ case 1: modelAndView.addObject("msg","图片删除成功"); + clearCache(); break; case 0: modelAndView.addObject("msg","图片删除失败"); @@ -63,6 +68,7 @@ public class MerchantUiController { switch (res){ case 1: modelAndView.addObject("msg","图片修改成功"); + clearCache(); break; case 0: modelAndView.addObject("msg","图片修改失败"); @@ -85,6 +91,7 @@ public class MerchantUiController { int result = uiService.updateHeard(redirectAttributes,request,img); if (result==1){ modelAndView.addObject("msg","修改logo成功"); + clearCache(); }else{ modelAndView.addObject("msg","修改logo失败"); } @@ -92,4 +99,12 @@ public class MerchantUiController { modelAndView.setViewName("redirect:/merchant/ui"); return modelAndView; } + + /** + *

清首页缓存

+ */ + public void clearCache() { + Set keys = redisTemplate.keys("*"); + redisTemplate.delete(keys); + } } diff --git a/src/main/java/com/example/jieyue/merchant/service/MerchantGoodsService.java b/src/main/java/com/example/jieyue/merchant/service/MerchantGoodsService.java index c1ee4e1..53c2760 100644 --- a/src/main/java/com/example/jieyue/merchant/service/MerchantGoodsService.java +++ b/src/main/java/com/example/jieyue/merchant/service/MerchantGoodsService.java @@ -3,15 +3,11 @@ package com.example.jieyue.merchant.service; import com.example.jieyue.common.entity.SysGoods; import com.example.jieyue.common.entity.SysMt; import com.example.jieyue.common.mapper.SysGoodsMapper; -import com.example.jieyue.common.utils.DateUtil; -import com.example.jieyue.common.utils.FileUtil; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import com.example.jieyue.common.utils.IsEmptyUtil; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.annotation.Id; import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @@ -24,10 +20,6 @@ public class MerchantGoodsService { @Autowired SysGoodsMapper goodsMapper; @Autowired - FileUtil fileUtil; - @Autowired - DateUtil dateUtil; - @Autowired IsEmptyUtil isEmptyUtil = new IsEmptyUtil(); /** @@ -49,7 +41,11 @@ public class MerchantGoodsService { */ public List getMtGoods(HttpSession session,int page,int num){ SysMt sysMt = (SysMt) session.getAttribute("merchant"); - return goodsMapper.findByMtLimit(sysMt.getId(),(page-1)*num,num); + List list = goodsMapper.findByMtLimit(sysMt.getId(),(page-1)*num,num); + for (SysGoods sysGoods : list) { + sysGoods.setImg(GiteeImgBedUtils.PRE + sysGoods.getImg()); + } + return list; } /** @@ -74,20 +70,17 @@ public class MerchantGoodsService { SysMt sysMt = (SysMt)request.getSession().getAttribute("merchant"); int merchant = sysMt.getId(); - if (img.getOriginalFilename().equals("")){ + if ("".equals(img.getOriginalFilename())){ // 执行插入 goodsMapperResult = goodsMapper.insert1(name,describe,price,merchant,stock); if(goodsMapperResult != 1){ return 0; } }else{ - // 设置filename 文件名由年月日时分秒以及六位随机数组成 - String filename = dateUtil.getNMDHIS()+Math.round(Math.random()*(999999-100000)+100000); // 获取商户id,一个商户对应一个文件夹 int id = ((SysMt) request.getSession().getAttribute("merchant")).getId(); // 接收文件工具类返回的文件位置 - String imgUrl = fileUtil.upFile(img,redirectAttributes,request, - "/data/goods/"+id+"/",filename); + String imgUrl = GiteeImgBedUtils.upload("/data/goods/" + id, img); // 文件上传失败 if (imgUrl == null){ return -1; @@ -96,7 +89,7 @@ public class MerchantGoodsService { goodsMapperResult = goodsMapper.insert2(name,describe,price,merchant,stock,imgUrl); if (goodsMapperResult != 1){ // sql语句执行失败,将已上传的图片移除 - fileUtil.deleteFile(imgUrl); + GiteeImgBedUtils.delete(imgUrl); return 0; } } @@ -117,11 +110,8 @@ public class MerchantGoodsService { if (sql!=1){ return -1; }else{ - // 当文件路径在/data下时,才执行文件的删除 - if (imgUrl.indexOf("/data") == 0){ - // 删除源文件,与编译文件中对应的goods图片信息 - fileUtil.deleteFile(imgUrl); - } + // 删除源文件,与编译文件中对应的goods图片信息 + GiteeImgBedUtils.delete(imgUrl); return 1; } } @@ -176,13 +166,10 @@ public class MerchantGoodsService { return 0; } }else{ - // 设置filename 文件名由年月日时分秒以及六位随机数组成 - String filename = dateUtil.getNMDHIS()+Math.round(Math.random()*(999999-100000)+100000); // 获取商户id,一个商户对应一个文件夹 int id = ((SysMt) request.getSession().getAttribute("merchant")).getId(); // 接收文件工具类返回的文件位置 - String imgUrl = fileUtil.upFile(img,redirectAttributes,request, - "/data/goods/"+id+"/",filename); + String imgUrl = GiteeImgBedUtils.upload("/data/goods/" + id, img); // 文件上传失败 if (imgUrl == null){ return -1; @@ -192,11 +179,11 @@ public class MerchantGoodsService { goodsMapperResult = goodsMapper.updateGoods2(name,describe,price,merchant,stock,goodsId,imgUrl); if (goodsMapperResult != 1){ // sql语句执行失败,将已上传的图片移除 - fileUtil.deleteFile(imgUrl); + GiteeImgBedUtils.delete(imgUrl); return 0; }else{ // 新图片已插入,将旧图删除 - fileUtil.deleteFile(tempGoods.getImg()); + GiteeImgBedUtils.delete(tempGoods.getImg()); } } return 1; diff --git a/src/main/java/com/example/jieyue/merchant/service/MerchantOrderService.java b/src/main/java/com/example/jieyue/merchant/service/MerchantOrderService.java index 516b374..c9fa212 100644 --- a/src/main/java/com/example/jieyue/merchant/service/MerchantOrderService.java +++ b/src/main/java/com/example/jieyue/merchant/service/MerchantOrderService.java @@ -18,12 +18,17 @@ public class MerchantOrderService { */ public List getOrderList(int merchantId,int page, int num, int flag){ switch (flag){ - case 0:// 未支付 + // 未支付 + case 0: return orderMapper.findNotPayLimitByMt(merchantId,(page-1)*num,num); - case 1:// 已支付 + // 已支付 + case 1: return orderMapper.findPayLimitByMt(merchantId,(page-1)*num,num); - case 2:// 全部订单 + // 全部订单 + case 2: return orderMapper.findLimitByMt(merchantId,(page-1)*num,num); + default: + break; } return null; } @@ -33,12 +38,17 @@ public class MerchantOrderService { */ public int getAllPage(int merchantId,int flag,int num){ switch (flag){ - case 0:// 未支付 + // 未支付 + case 0: return (int)Math.ceil((double)orderMapper.notPayCountByMt(merchantId)/(double)num); - case 1:// 已支付 + // 已支付 + case 1: return (int)Math.ceil((double)orderMapper.payCountByMt(merchantId)/(double)num); - case 2:// 全部订单 + // 全部订单 + case 2: return (int)Math.ceil((double)orderMapper.orderCountByMt(merchantId)/(double)num); + default: + break; } return 1; } @@ -49,7 +59,7 @@ public class MerchantOrderService { public List getOrderById(String orderId,int merchant){ SysOrder order = orderMapper.findByOrderIdAndMt(orderId,merchant); List list = new ArrayList<>(); - if (order!=null){ + if (order != null){ list.add(order); } return list; diff --git a/src/main/java/com/example/jieyue/merchant/service/MerchantUiService.java b/src/main/java/com/example/jieyue/merchant/service/MerchantUiService.java index af141b2..559d74d 100644 --- a/src/main/java/com/example/jieyue/merchant/service/MerchantUiService.java +++ b/src/main/java/com/example/jieyue/merchant/service/MerchantUiService.java @@ -4,8 +4,7 @@ import com.example.jieyue.common.entity.SysMt; import com.example.jieyue.common.entity.SysMtUi; import com.example.jieyue.common.mapper.SysMtMapper; import com.example.jieyue.common.mapper.SysMtUiMapper; -import com.example.jieyue.common.utils.DateUtil; -import com.example.jieyue.common.utils.FileUtil; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -19,10 +18,6 @@ public class MerchantUiService { @Autowired SysMtUiMapper mtUiMapper; @Autowired - FileUtil fileUtil; - @Autowired - DateUtil dateUtil; - @Autowired SysMtMapper merchantMapper; /** @@ -42,7 +37,11 @@ public class MerchantUiService { *

获取商户用于商城首页宣传的海报图片对象

*/ public SysMtUi getHomeImg(int width,int height,HttpSession session){ - return mtUiMapper.findByMark(width,height,getMtId(session)); + SysMtUi ui = mtUiMapper.findByMark(width,height,getMtId(session)); + if (ui != null) { + ui.setUrl(GiteeImgBedUtils.PRE + ui.getUrl()); + } + return ui; } /** @@ -51,8 +50,8 @@ public class MerchantUiService { public int delHomeImg(int id){ String url = mtUiMapper.findById(id).getUrl(); int sql = mtUiMapper.deleteById(id); - if (sql==1){ - fileUtil.deleteFile(url); + if (sql == 1){ + GiteeImgBedUtils.delete(url); return 1; }else{ return 0; @@ -68,11 +67,8 @@ public class MerchantUiService { int id = ((SysMt)request.getSession().getAttribute("merchant")).getId(); SysMtUi sysMtUi = mtUiMapper.findByMark(width,height,id); - // 设置filename 文件名由年月日时分秒以及六位随机数组成 - String filename = dateUtil.getNMDHIS()+Math.round(Math.random()*(999999-100000)+100000); // 接收文件工具类返回的文件位置 - String imgUrl = fileUtil.upFile(img,redirectAttributes,request, - "/data/mtui/"+id+"/",filename); + String imgUrl = GiteeImgBedUtils.upload("/data/mtui/" + id, img); if (imgUrl==null){ // 上传图片失败 return 0; @@ -83,10 +79,10 @@ public class MerchantUiService { int sql = mtUiMapper.updateUrl(imgUrl,width,height,id); if (sql==1){ // sql语句执行成功,将旧图删除,加入新图 - fileUtil.deleteFile(sysMtUi.getUrl()); + GiteeImgBedUtils.delete(sysMtUi.getUrl()); }else{ // sql语句执行失败,将已上传的新图删除 - fileUtil.deleteFile(imgUrl); + GiteeImgBedUtils.delete(imgUrl); } return sql; } @@ -105,19 +101,15 @@ public class MerchantUiService { public int updateHeard(RedirectAttributes redirectAttributes,HttpServletRequest request, MultipartFile img){ // 获取商户信息 SysMt merchant = (SysMt) request.getSession().getAttribute("merchant"); - // 设置filename 文件名由年月日时分秒以及六位随机数组成 - String filename = dateUtil.getNMDHIS()+Math.round(Math.random()*(999999-100000)+100000); - String headerUrl = fileUtil.upFile(img,redirectAttributes,request,"/data/header/merchant/",filename); + String headerUrl = GiteeImgBedUtils.upload("/data/header/merchant/", img); int sql = merchantMapper.updateHeader(merchant.getId(),headerUrl); - if (sql!=1){ - fileUtil.deleteFile(headerUrl); + if (sql != 1){ + GiteeImgBedUtils.delete(headerUrl); return -1; }else{ - if (!merchant.getHeader().equals("/lib/merchant/images/2.png")){ - fileUtil.deleteFile(merchant.getHeader()); - } + GiteeImgBedUtils.delete(merchant.getHeader()); // 修改会话信息 - merchant.setHeader(headerUrl); + merchant.setHeader(GiteeImgBedUtils.PRE + headerUrl); request.getSession().setAttribute("merchant",merchant); } return 1; diff --git a/src/main/java/com/example/jieyue/merchant/service/MerchantUserService.java b/src/main/java/com/example/jieyue/merchant/service/MerchantUserService.java index 90d2bbb..5b3d29e 100644 --- a/src/main/java/com/example/jieyue/merchant/service/MerchantUserService.java +++ b/src/main/java/com/example/jieyue/merchant/service/MerchantUserService.java @@ -2,6 +2,7 @@ package com.example.jieyue.merchant.service; import com.example.jieyue.common.entity.SysUser; import com.example.jieyue.common.mapper.SysUserMapper; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -16,7 +17,11 @@ public class MerchantUserService { *

获取用户信息

*/ public List getUserList(int page, int num){ - return userMapper.findLimit((page-1)*num,num); + List list = userMapper.findLimit((page-1)*num,num); + for (SysUser user : list) { + user.setHeader(GiteeImgBedUtils.PRE + user.getHeader()); + } + return list; } /** diff --git a/src/main/java/com/example/jieyue/user/controller/UserCheckOutController.java b/src/main/java/com/example/jieyue/user/controller/UserCheckOutController.java index c998fb2..35eb0bd 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserCheckOutController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserCheckOutController.java @@ -25,7 +25,7 @@ public class UserCheckOutController { @RequestMapping("/user/checkout") public ModelAndView index(ModelAndView modelAndView,String ids,@RequestParam(defaultValue = "-1")int num){ - if(ids == null || ids.equals("")){ + if(ids == null || "".equals(ids)){ modelAndView.addObject("msg","请选择您要结算的商品"); modelAndView.setViewName("redirect:/user/cart"); }else{ diff --git a/src/main/java/com/example/jieyue/user/controller/UserHomeController.java b/src/main/java/com/example/jieyue/user/controller/UserHomeController.java index b9dc4fb..da8e880 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserHomeController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserHomeController.java @@ -38,9 +38,7 @@ public class UserHomeController{ Map lowImg = null; if (redisTemplate.opsForHash().entries("homePageCache").size() != 0){ - Map map = redisTemplate.opsForHash().entries("homePageCache"); - // 商城主页宣传海报 imgMap = (Map) map.get("imgMap"); // 获取热卖商品列表 @@ -52,9 +50,7 @@ public class UserHomeController{ // 获取商户宣传店铺的海报 homeImg = (Map) map.get("homeImg"); lowImg = (Map) map.get("lowImg"); - }else{ - // 商城主页宣传海报 imgMap = homeService.getImage(); // 获取热卖商品列表 @@ -67,19 +63,17 @@ public class UserHomeController{ homeImg = homeService.getMtImg(400,320,3); lowImg = homeService.getMtImg(600,310,3); } - - modelAndView.addObject("imgMap",imgMap); - modelAndView.addObject("escGoodsMap",escGoodsMap); - modelAndView.addObject("descGoodsMap",descGoodsMap); - modelAndView.addObject("randGoodsMap",randGoodsMap); - modelAndView.addObject("homeImg",homeImg); - modelAndView.addObject("lowImg",lowImg); + modelAndView.addObject("imgMap", imgMap); + modelAndView.addObject("escGoodsMap", escGoodsMap); + modelAndView.addObject("descGoodsMap", descGoodsMap); + modelAndView.addObject("randGoodsMap", randGoodsMap); + modelAndView.addObject("homeImg", homeImg); + modelAndView.addObject("lowImg", lowImg); if (redisTemplate.opsForHash().entries("homePageCache").size() == 0){ // 设置缓存 十分钟内有效 homeService.setHomeCache(modelAndView); } - modelAndView.setViewName("user/home/index"); return modelAndView; } diff --git a/src/main/java/com/example/jieyue/user/controller/UserInfoController.java b/src/main/java/com/example/jieyue/user/controller/UserInfoController.java index 15a746e..a866b65 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserInfoController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserInfoController.java @@ -24,7 +24,7 @@ public class UserInfoController { @RequestMapping("/user/info") public ModelAndView index(ModelAndView modelAndView, HttpServletRequest request){ SysUser user = (SysUser) request.getSession().getAttribute("user"); - modelAndView.addObject("user",user); + modelAndView.addObject("user", user); modelAndView.setViewName("user/info/index"); return modelAndView; } diff --git a/src/main/java/com/example/jieyue/user/controller/UserLoginController.java b/src/main/java/com/example/jieyue/user/controller/UserLoginController.java index 47be45a..1bb827c 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserLoginController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserLoginController.java @@ -1,6 +1,7 @@ package com.example.jieyue.user.controller; import com.example.jieyue.common.entity.SysUser; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import com.example.jieyue.user.service.UserLoginService; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; @@ -51,6 +52,7 @@ public class UserLoginController { if (result==1){ // 登陆成功 SysUser user = service.userInfo(email); + user.setHeader(GiteeImgBedUtils.PRE + user.getHeader()); session.setAttribute("user",user); modelAndView.setViewName("redirect:/"); }else if (result==-1){ diff --git a/src/main/java/com/example/jieyue/user/controller/UserPayController.java b/src/main/java/com/example/jieyue/user/controller/UserPayController.java index c0f46f2..df7cecc 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserPayController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserPayController.java @@ -6,6 +6,7 @@ import com.example.jieyue.common.entity.SysOrder; import com.example.jieyue.common.mapper.SysGoodsMapper; import com.example.jieyue.common.mapper.SysMtMapper; import com.example.jieyue.common.mapper.SysOrderMapper; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import com.example.jieyue.user.service.WxPayService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -34,8 +35,8 @@ public class UserPayController { String orderMark = wxPayService.getOrderId(); // 添加订单 String res = wxPayService.addOrder(nums,orderMark,users,merchants,prices,notes,goods,address,name,phone,code,0,carts); - if(!res.equals("-1") && !res.equals("0") && !res.equals("")){ - modelAndView.addObject("orderMark",orderMark); + if(!"-1".equals(res) && !"0".equals(res) && !"".equals(res)){ + modelAndView.addObject("orderMark", orderMark); modelAndView.setViewName("redirect:/user/wxpay/index?mark="+orderMark); } return modelAndView; @@ -74,10 +75,10 @@ public class UserPayController { */ @RequestMapping("/user/wxpay/index") public ModelAndView wxNotify(ModelAndView modelAndView,String mark) { - String codeUrl = orderMapper.findByOrderMark(mark).get(0).getPayCodeUrl(); + String codeUrl = GiteeImgBedUtils.PRE + orderMapper.findByOrderMark(mark).get(0).getPayCodeUrl(); - modelAndView.addObject("codeUrl",codeUrl); - modelAndView.addObject("orderMark",mark); + modelAndView.addObject("codeUrl", codeUrl); + modelAndView.addObject("orderMark", mark); modelAndView.setViewName("user/pay/wx"); return modelAndView; diff --git a/src/main/java/com/example/jieyue/user/controller/UserProductController.java b/src/main/java/com/example/jieyue/user/controller/UserProductController.java index 131db24..4520352 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserProductController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserProductController.java @@ -54,7 +54,7 @@ public class UserProductController { */ @RequestMapping("/user/product/add-comment") public ModelAndView addComment(ModelAndView modelAndView,int goods,int merchant,String context,HttpServletRequest request){ - if (context.equals("")){ + if ("".equals(context)){ modelAndView.addObject("msg","评论内容不能为空"); }else{ int result = productService.addComment(goods,merchant,context,request); diff --git a/src/main/java/com/example/jieyue/user/service/UserCartService.java b/src/main/java/com/example/jieyue/user/service/UserCartService.java index 5ef3577..5699f68 100644 --- a/src/main/java/com/example/jieyue/user/service/UserCartService.java +++ b/src/main/java/com/example/jieyue/user/service/UserCartService.java @@ -7,6 +7,7 @@ import com.example.jieyue.common.entity.SysUser; import com.example.jieyue.common.mapper.SysCartMapper; import com.example.jieyue.common.mapper.SysGoodsMapper; import com.example.jieyue.common.mapper.SysMtMapper; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -63,7 +64,7 @@ public class UserCartService { SysGoods goods = goodsMapper.findById(cart.getGoodsId()); SysMt merchant = merchantMapper.findById(goods.getMerchant()); Map map = new HashMap<>(); - map.put("goodsImg",goods.getImg()); + map.put("goodsImg", GiteeImgBedUtils.PRE + goods.getImg()); map.put("cartId",cart.getId()+""); map.put("goodsId",goods.getId()+""); map.put("goodsPrice",goods.getPrice().toPlainString()); diff --git a/src/main/java/com/example/jieyue/user/service/UserHomeService.java b/src/main/java/com/example/jieyue/user/service/UserHomeService.java index 67e498c..6477d15 100644 --- a/src/main/java/com/example/jieyue/user/service/UserHomeService.java +++ b/src/main/java/com/example/jieyue/user/service/UserHomeService.java @@ -6,6 +6,7 @@ import com.example.jieyue.common.entity.SysUi; import com.example.jieyue.common.mapper.SysGoodsMapper; import com.example.jieyue.common.mapper.SysMtUiMapper; import com.example.jieyue.common.mapper.SysUiMapper; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -42,7 +43,7 @@ public class UserHomeService { redisTemplate.expire("homePageCache",10, TimeUnit.MINUTES); } - /* + /** * 获取商城网页的宣传海报 */ public Map getImage(){ @@ -55,6 +56,25 @@ public class UserHomeService { SysUi img3151 = uiMapper.findByMark(3151,282); SysUi img3152 = uiMapper.findByMark(3152,282); + if(img1920 != null) { + img1920.setUrl(GiteeImgBedUtils.PRE + img1920.getUrl()); + } + if(img1230 != null) { + img1230.setUrl(GiteeImgBedUtils.PRE + img1230.getUrl()); + } + if(img475 != null) { + img475.setUrl(GiteeImgBedUtils.PRE + img475.getUrl()); + } + if(img674 != null) { + img674.setUrl(GiteeImgBedUtils.PRE + img674.getUrl()); + } + if(img3151 != null) { + img3151.setUrl(GiteeImgBedUtils.PRE + img3151.getUrl()); + } + if(img3152 != null) { + img3152.setUrl(GiteeImgBedUtils.PRE + img3152.getUrl()); + } + map.put(1920+"",img1920); map.put(1230+"",img1230); map.put(475+"",img475); @@ -65,50 +85,45 @@ public class UserHomeService { return map; } - /* + /** * 获取热卖商品 */ public Map getEsc(int num){ - List list = goodsMapper.findAllEsc(num); - Map map = new HashMap<>(); - for (int i=0;i < list.size();i++) { - map.put(i+"",list.get(i)); - } - return map; + return common(goodsMapper.findAllEsc(num)); } - /* + /** * 获取新出商品 */ public Map getDesc(int num){ - List list = goodsMapper.findAllDesc(num); - Map map = new HashMap<>(); - for (int i=0;i < list.size();i++) { - map.put(i+"",list.get(i)); - } - return map; + return common(goodsMapper.findAllDesc(num)); } - /* + /** * 随机获取商品 */ public Map getRand(int num){ - List list = goodsMapper.findRand(num); + return common(goodsMapper.findRand(num)); + } + + public Map common(List list) { Map map = new HashMap<>(); for (int i=0;i < list.size();i++) { - map.put(i+"",list.get(i)); + list.get(i).setImg(GiteeImgBedUtils.PRE + list.get(i).getImg()); + map.put(i+"", list.get(i)); } return map; } - /* + /** * 获取商户宣传店铺的海报 */ public Map getMtImg(int width,int height,int num){ Map map = new HashMap<>(); List list = mtUiMapper.findLimit(width,height,num); for (int i=0;i getGoodsList(List orderList){ List list = new ArrayList<>(); for (SysOrder order : orderList) { - list.add(goodsMapper.findById(order.getGoodsId())); + SysGoods goods = goodsMapper.findById(order.getGoodsId()); + goods.setImg(GiteeImgBedUtils.PRE + goods.getImg()); + list.add(goods); } return list; } diff --git a/src/main/java/com/example/jieyue/user/service/UserSearchService.java b/src/main/java/com/example/jieyue/user/service/UserSearchService.java index b8ed25f..c83fc24 100644 --- a/src/main/java/com/example/jieyue/user/service/UserSearchService.java +++ b/src/main/java/com/example/jieyue/user/service/UserSearchService.java @@ -4,6 +4,7 @@ import com.example.jieyue.common.entity.SysGoods; import com.example.jieyue.common.index.GoodsIndex; import com.example.jieyue.common.mapper.SysGoodsMapper; import com.example.jieyue.common.repository.GoodsIndexRepository; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,7 +22,11 @@ public class UserSearchService { *

mysql通过关键字模糊查找商品

*/ public List mysqlSearchGoods(String keyword){ - return goodsMapper.search(keyword); + List list = goodsMapper.search(keyword); + for (SysGoods goods : list) { + goods.setImg(GiteeImgBedUtils.PRE + goods.getImg()); + } + return list; } /** diff --git a/src/main/java/com/example/jieyue/user/service/UserShopService.java b/src/main/java/com/example/jieyue/user/service/UserShopService.java index 9da8932..88ac7da 100644 --- a/src/main/java/com/example/jieyue/user/service/UserShopService.java +++ b/src/main/java/com/example/jieyue/user/service/UserShopService.java @@ -4,6 +4,7 @@ import com.example.jieyue.common.entity.SysGoods; import com.example.jieyue.common.entity.SysMt; import com.example.jieyue.common.mapper.SysGoodsMapper; import com.example.jieyue.common.mapper.SysMtMapper; +import com.example.jieyue.common.utils.GiteeImgBedUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -22,28 +23,29 @@ public class UserShopService { *

获取商户信息

*/ public SysMt getMerchantInfo(int merchantId){ - return merchantMapper.findById(merchantId); + SysMt merchant = merchantMapper.findById(merchantId); + merchant.setHeader(GiteeImgBedUtils.PRE + merchant.getHeader()); + return merchant; } /** *

获取商户商品信息

*/ public Map getGoodsList(int merchantId, int page, int num){ - List list = goodsMapper.findByMtLimit(merchantId,(page-1)*num,page*num); - Map map = new HashMap<>(); - for (int i = 0;i < list.size();i++){ - map.put(i,list.get(i)); - } - return map; + return common(goodsMapper.findByMtLimit(merchantId,(page-1)*num,page*num)); } /** *

随机获取商品

*/ public Map getRandGoodsMap(int merchant,int num){ - List list = goodsMapper.findMerchantRand(merchant,num); + return common(goodsMapper.findMerchantRand(merchant,num)); + } + + public Map common(List list) { Map map = new HashMap<>(); for (int i = 0;i < list.size();i++) { + list.get(i).setImg(GiteeImgBedUtils.PRE + list.get(i).getImg()); map.put(i,list.get(i)); } return map; diff --git a/src/main/java/com/example/jieyue/user/service/WxPayService.java b/src/main/java/com/example/jieyue/user/service/WxPayService.java index 085813d..018a469 100644 --- a/src/main/java/com/example/jieyue/user/service/WxPayService.java +++ b/src/main/java/com/example/jieyue/user/service/WxPayService.java @@ -8,7 +8,6 @@ import com.example.jieyue.common.mapper.SysMtMapper; import com.example.jieyue.common.mapper.SysOrderMapper; import com.example.jieyue.common.utils.IsEmptyUtil; import com.example.jieyue.common.utils.QRCodeUtil; -import com.example.jieyue.common.utils.StringUtil; import com.example.jieyue.wxpay.config.MyWXPayConfig; import com.example.jieyue.wxpay.sdk.WXPay; import com.example.jieyue.wxpay.sdk.WXPayConstants; @@ -28,7 +27,10 @@ import java.io.InputStreamReader; import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; /** *

微信支付服务类

@@ -37,8 +39,6 @@ import java.util.*; */ @Service public class WxPayService { - @Autowired - StringUtil stringUtil; @Autowired SysOrderMapper orderMapper; @Autowired @@ -91,7 +91,7 @@ public class WxPayService { SysMt merchant = merchantMapper.findById(Integer.valueOf(merchantsArr[i])); // 执行sql语句 int sql = -1; - if (cartArr[i].equals("0")){ + if ("0".equals(cartArr[i])){ sql = orderMapper.insert1(orderId,createTime,Integer.valueOf(numArr[i]),mark,Integer.valueOf(userArr[i]), Integer.valueOf(merchantsArr[i]),new BigDecimal(dfPrice.format(Double.valueOf(pricesArr[i]))), Integer.valueOf(goodsArr[i]),notes,address,name,phone,code,way,merchant.getRatio()); @@ -117,7 +117,6 @@ public class WxPayService { *

分割js传递的数组

*/ public String[] getStringArray(String array){ - List list = new ArrayList<>(); return array.split(","); } @@ -145,21 +144,20 @@ public class WxPayService { data.put("body", "捷阅网商品"); data.put("out_trade_no", orderMark); data.put("device_info", orderMark); - BigDecimal temp = new BigDecimal(100); data.put("total_fee", price); data.put("spbill_create_ip", "123.12.12.123"); - data.put("notify_url", siteUrl+"/user/wxpay/notify"); + data.put("notify_url", siteUrl + "/user/wxpay/notify"); data.put("trade_type", "NATIVE"); // 此处指定为扫码支付 data.put("product_id", orderMark); + String codeUrl = ""; try { Map resp = wxPay.unifiedOrder(data); System.out.println(resp); - QRCodeUtil.zxingCodeCreate(resp.get("code_url"),classPath+"/data/pay/",orderMark,500,""); + codeUrl = QRCodeUtil.zxingCodeCreate(resp.get("code_url"), "/data/pay/", 500, ""); } catch (Exception e) { e.printStackTrace(); } - String codeUrl = "/data/pay/"+orderMark+".jpg"; - orderMapper.updateCodeUrl(codeUrl,orderMark); + orderMapper.updateCodeUrl(codeUrl, orderMark); return codeUrl; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index f0d9a2f..0c9262c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -11,6 +11,10 @@ server: error: include-exception: true spring: + servlet: + multipart: + max-file-size: 50MB + max-request-size: 100MB jmx: enabled: false application: diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt index 537ae9d..76f4b03 100644 --- a/src/main/resources/banner.txt +++ b/src/main/resources/banner.txt @@ -4,4 +4,4 @@ | |_| | | __/ |_| | |_| | __/ \___/|_|\___|\__, |\__,_|\___| |___/ - @author: Bosen-once + 捷阅网购物商城 @author: Bosen diff --git a/src/main/resources/static/favicon.ico b/src/main/resources/static/favicon.ico deleted file mode 100644 index 65ecdadc99bd2c1d055cba1b898b85fe032738ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 67646 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 diff --git a/src/main/resources/static/image/merchant/default.jpg b/src/main/resources/static/image/merchant/default.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1da0394d70d72597bd7397e0b7ec230f32c744c7 GIT binary patch literal 1502 zcmeAS@N?(olHy`uVBq!ia0vp^FF}}t4M-j|7kCV$7>k44ofy`glL5)Fq&xaLGB9lH z=l+w(3gmMZctjR6FbI`^Fyp;6`3eRG)?!Z=$B>G+w|C;Rrn~rCP+OPH5 zzwcY})w%4K*B|fcEBVBH?{`fFL)q1)xc=p48mmhY@ak$%7 z7VSPK_kY1X%esa8Dvb6lt~?azKW+WhlgZM`w%-bCx7qAjta&K#eb1K4yi4~aGe7ri zDR;Z2`f!ChjNCK*S6TU+{0qwj-EP^KXM$9^-Lh7GduiIlzQ4S;Ob&VMR+0I7#ACL) zjA`22i}GK8pQ`_HXK&DZd-<0)XYIHC^#1?b&nNOv`9Dz0J$Y(+>8qa)zP&15w{8v3 z|J-lA6SqA%`MvbrlN&S2UKSVa+xJyHU5V4(ws3Npr^TzziDv#5ujWoPJMRm$F?Zg? zZ|9(v!L9sy&SUm-wYMNO9@XhfVukvulAz>S;l8Tv`y%Ggxgqhg(|hX%JD^Xo2N~f& z9a<`y?#SGnU%=wnqRjDJt+k-ty>6085Qn;qqW~oF_yH5oAwd%lU^Y7>*dh$fO$96u zTa+^SaBnzWJ&wE@YpyRxrW&C$J1ZFJJ!?p0QP|G{P1$Gq?NYi-|TybP0l+XkKjnk@f literal 0 HcmV?d00001 diff --git a/src/main/resources/templates/admin/common/model.html b/src/main/resources/templates/admin/common/model.html index 33325fa..bcb0089 100644 --- a/src/main/resources/templates/admin/common/model.html +++ b/src/main/resources/templates/admin/common/model.html @@ -78,6 +78,11 @@