部署方式由war转为jar包;使用gitee图床作为图片服务
parent
a2a0320b9b
commit
31f2b1e91a
49
README.md
49
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)**
|
||||
|
||||
<br/>
|
||||
|
||||
### 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
|
|||
```
|
||||
<br/>
|
||||
|
||||
### 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/),就可以看到网站的主页)至此,捷阅网已成功部署~~!!
|
||||
|
||||
<br/>
|
||||
|
||||
|
|
39
jieyue.sql
39
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');
|
||||
|
|
35
pom.xml
35
pom.xml
|
@ -11,7 +11,7 @@
|
|||
<groupId>com.example</groupId>
|
||||
<artifactId>jieyue</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<packaging>jar</packaging>
|
||||
<name>jieyue</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<tomcat.version>8.5.29</tomcat.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -60,34 +59,32 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<!-- 移除嵌入式tomcat插件 -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- devtool -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- mysql -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- mybatis -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
<!-- lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
@ -127,11 +124,13 @@
|
|||
<artifactId>qrgen</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<!-- json -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.47</version>
|
||||
</dependency>
|
||||
<!-- redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
|
@ -158,15 +157,27 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
<!-- hutool -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.5.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>5.3.12</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>ROOT</finalName>
|
||||
<finalName>jieyue</finalName>
|
||||
<plugins>
|
||||
<!--<plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>-->
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>处理文件过大上传失败的问题</p>
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>网页图片UI设置</p>
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>清首页缓存</p>
|
||||
*/
|
||||
public void clearCache() {
|
||||
Set<String> keys = redisTemplate.keys("*");
|
||||
redisTemplate.delete(keys);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<SysMt> getMtInfo(int curPage,int pageSize){
|
||||
int curRow = (curPage-1)*pageSize;
|
||||
return mtMapper.findPage(curRow,pageSize);
|
||||
List<SysMt> list = mtMapper.findPage(curRow,pageSize);
|
||||
for (SysMt sysMt : list) {
|
||||
sysMt.setHeader(GiteeImgBedUtils.PRE + sysMt.getHeader());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 {
|
|||
* <p>删除海报逻辑处理</p>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
* <p>获取用户信息</p>
|
||||
*/
|
||||
public List<SysUser> getUserList(int page, int num){
|
||||
return userMapper.findLimit((page-1)*num,num);
|
||||
List<SysUser> list = userMapper.findLimit((page-1)*num,num);
|
||||
for (SysUser user : list) {
|
||||
user.setHeader(GiteeImgBedUtils.PRE + user.getHeader());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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<SysOrder> 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<SysOrder> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package com.example.jieyue.common.utils;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>时间工具类</p>
|
||||
* @author Bosen
|
||||
* 2020/11/6 10:36
|
||||
*/
|
||||
@Component
|
||||
public class DateUtil {
|
||||
/**
|
||||
* <p>获取纯年月日时分秒的字符串</p>
|
||||
*/
|
||||
public String getNMDHIS(){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
return sdf.format(new Date());
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>文件操作工具类</p>
|
||||
* @author Bosen
|
||||
* 2020/11/5 22:55
|
||||
*/
|
||||
@Component
|
||||
public class FileUtil {
|
||||
|
||||
String classpath;
|
||||
public FileUtil() throws FileNotFoundException {
|
||||
this.classpath = ResourceUtils.getFile("classpath:/static").getPath()+"\\";
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>文件上传逻辑处理</p>
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>获取文件后缀名</p>
|
||||
*/
|
||||
public String getSuffixName(String filename){
|
||||
String[] strArray = filename.split("\\.");
|
||||
int suffixIndex = strArray.length -1;
|
||||
return strArray[suffixIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>删除文件</p>
|
||||
*/
|
||||
public void deleteFile(String url){
|
||||
File file1 = new File(classpath+url);
|
||||
file1.delete();
|
||||
}
|
||||
|
||||
}
|
|
@ -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";
|
||||
|
||||
/**
|
||||
* <p>上传文件</p>
|
||||
* @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<String, Object> 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>删除</p>
|
||||
*/
|
||||
public static boolean delete(String path) {
|
||||
try {
|
||||
String targetUrl = GiteeImgBedUtils.deleteFileUrl(path);
|
||||
Map<String, Object> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>获取sha信息</p>
|
||||
*/
|
||||
private static String getShaInfo(String path) {
|
||||
String targetUrl = GiteeImgBedUtils.deleteFileUrl(path);
|
||||
Map<String, Object> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>生成删除链接</p>
|
||||
*/
|
||||
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<String,Object> getUploadBodyMap(byte[] multipartFile){
|
||||
HashMap<String, Object> 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<String,Object> getDeleteBodyMap(String path){
|
||||
HashMap<String, Object> 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<String,Object> getFileInfoBodyMap(){
|
||||
HashMap<String, Object> 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;
|
||||
}
|
||||
}
|
|
@ -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 {
|
|||
* <p>单个字符串判空操作</p>
|
||||
*/
|
||||
public boolean string(String string){
|
||||
if (string==null || string.equals("")){
|
||||
if (string==null || "".equals(string)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String,String> param){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("<xml>");
|
||||
for (Map.Entry<String,String> entry : param.entrySet()) {
|
||||
sb.append("<"+ entry.getKey() +">");
|
||||
sb.append(entry.getValue());
|
||||
sb.append("</"+ entry.getKey() +">");
|
||||
}
|
||||
sb.append("</xml>");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>商户商品管理页面</p>
|
||||
|
@ -25,6 +27,8 @@ import java.util.List;
|
|||
public class MerchantGoodsController {
|
||||
@Autowired
|
||||
MerchantGoodsService goodsService;
|
||||
@Autowired
|
||||
RedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* <p>商品管理页面</p>
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>清首页缓存</p>
|
||||
*/
|
||||
public void clearCache() {
|
||||
Set<String> keys = redisTemplate.keys("*");
|
||||
redisTemplate.delete(keys);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>店铺样式设计</p>
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>清首页缓存</p>
|
||||
*/
|
||||
public void clearCache() {
|
||||
Set<String> keys = redisTemplate.keys("*");
|
||||
redisTemplate.delete(keys);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<SysGoods> getMtGoods(HttpSession session,int page,int num){
|
||||
SysMt sysMt = (SysMt) session.getAttribute("merchant");
|
||||
return goodsMapper.findByMtLimit(sysMt.getId(),(page-1)*num,num);
|
||||
List<SysGoods> 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);
|
||||
}
|
||||
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;
|
||||
|
|
|
@ -18,12 +18,17 @@ public class MerchantOrderService {
|
|||
*/
|
||||
public List<SysOrder> 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<SysOrder> getOrderById(String orderId,int merchant){
|
||||
SysOrder order = orderMapper.findByOrderIdAndMt(orderId,merchant);
|
||||
List<SysOrder> list = new ArrayList<>();
|
||||
if (order!=null){
|
||||
if (order != null){
|
||||
list.add(order);
|
||||
}
|
||||
return list;
|
||||
|
|
|
@ -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 {
|
|||
* <p>获取商户用于商城首页宣传的海报图片对象</p>
|
||||
*/
|
||||
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;
|
||||
|
|
|
@ -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 {
|
|||
* <p>获取用户信息</p>
|
||||
*/
|
||||
public List<SysUser> getUserList(int page, int num){
|
||||
return userMapper.findLimit((page-1)*num,num);
|
||||
List<SysUser> list = userMapper.findLimit((page-1)*num,num);
|
||||
for (SysUser user : list) {
|
||||
user.setHeader(GiteeImgBedUtils.PRE + user.getHeader());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -38,9 +38,7 @@ public class UserHomeController{
|
|||
Map<String, SysMtUi> lowImg = null;
|
||||
|
||||
if (redisTemplate.opsForHash().entries("homePageCache").size() != 0){
|
||||
|
||||
Map map = redisTemplate.opsForHash().entries("homePageCache");
|
||||
|
||||
// 商城主页宣传海报
|
||||
imgMap = (Map<String, SysUi>) map.get("imgMap");
|
||||
// 获取热卖商品列表
|
||||
|
@ -52,9 +50,7 @@ public class UserHomeController{
|
|||
// 获取商户宣传店铺的海报
|
||||
homeImg = (Map<String, SysMtUi>) map.get("homeImg");
|
||||
lowImg = (Map<String, SysMtUi>) 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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<String,String> 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());
|
||||
|
|
|
@ -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<String,SysUi> 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<String, SysGoods> getEsc(int num){
|
||||
List<SysGoods> list = goodsMapper.findAllEsc(num);
|
||||
Map<String, SysGoods> 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<String, SysGoods> getDesc(int num){
|
||||
List<SysGoods> list = goodsMapper.findAllDesc(num);
|
||||
Map<String, SysGoods> 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<String, SysGoods> getRand(int num){
|
||||
List<SysGoods> list = goodsMapper.findRand(num);
|
||||
return common(goodsMapper.findRand(num));
|
||||
}
|
||||
|
||||
public Map<String, SysGoods> common(List<SysGoods> list) {
|
||||
Map<String, SysGoods> 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<String, SysMtUi> getMtImg(int width,int height,int num){
|
||||
Map<String, SysMtUi> map = new HashMap<>();
|
||||
List<SysMtUi> list = mtUiMapper.findLimit(width,height,num);
|
||||
for (int i=0;i<list.size();i++){
|
||||
map.put(i+"",list.get(i));
|
||||
list.get(i).setUrl(GiteeImgBedUtils.PRE + list.get(i).getUrl());
|
||||
map.put(i+"", list.get(i));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -3,9 +3,8 @@ package com.example.jieyue.user.service;
|
|||
import com.example.jieyue.common.entity.SysUser;
|
||||
import com.example.jieyue.common.mapper.SysUserMapper;
|
||||
import com.example.jieyue.common.service.MailService;
|
||||
import com.example.jieyue.common.utils.FileUtil;
|
||||
import com.example.jieyue.common.utils.GiteeImgBedUtils;
|
||||
import com.example.jieyue.common.utils.IsEmptyUtil;
|
||||
import com.sun.mail.smtp.DigestMD5;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
@ -23,9 +22,6 @@ public class UserInfoService {
|
|||
@Autowired
|
||||
SysUserMapper sysUserMapper;
|
||||
|
||||
@Autowired
|
||||
FileUtil fileUtil;
|
||||
|
||||
IsEmptyUtil isEmptyUtil = new IsEmptyUtil();
|
||||
|
||||
|
||||
|
@ -49,7 +45,7 @@ public class UserInfoService {
|
|||
|
||||
SysUser user = sysUserMapper.selectById(id);
|
||||
|
||||
if (!oldPwd.equals("") || !newPwd.equals("") || !rePwd.equals("")){
|
||||
if (!"".equals(oldPwd) || !"".equals(newPwd) || !"".equals(rePwd)){
|
||||
oldPwd = DigestUtils.md5DigestAsHex(oldPwd.getBytes());
|
||||
if (!user.getPassword().equals(oldPwd)){
|
||||
return 3;
|
||||
|
@ -58,7 +54,7 @@ public class UserInfoService {
|
|||
return 4;
|
||||
}
|
||||
}
|
||||
if (newPwd.equals("")){
|
||||
if ("".equals(newPwd)){
|
||||
newPwd = user.getPassword();
|
||||
}else{
|
||||
newPwd = DigestUtils.md5DigestAsHex(newPwd.getBytes());
|
||||
|
@ -66,15 +62,18 @@ public class UserInfoService {
|
|||
// 更新头像
|
||||
String header = user.getHeader();
|
||||
if (!img.isEmpty()){
|
||||
if (!user.getHeader().equals("/data/header/user/default.jpg")){
|
||||
fileUtil.deleteFile(user.getHeader());
|
||||
header = GiteeImgBedUtils.upload("/data/header/user/", img);
|
||||
if (!"".equals(header) && null != header &&
|
||||
!user.getHeader().equals(GiteeImgBedUtils.PRE + "/data/header/user/default.jpg")){
|
||||
GiteeImgBedUtils.delete(user.getHeader());
|
||||
}
|
||||
header = fileUtil.upFile(img,redirectAttributes,request,"/data/header/user/",""+id);
|
||||
}
|
||||
int sql = sysUserMapper.updateById(username,newPwd,header,email,id);
|
||||
if (sql==1){
|
||||
int sql = sysUserMapper.updateById(username, newPwd, header, email, id);
|
||||
if (sql == 1){
|
||||
// 更新用户信息
|
||||
request.getSession().setAttribute("user",sysUserMapper.selectById(id));
|
||||
SysUser newUser = sysUserMapper.selectById(id);
|
||||
newUser.setHeader(GiteeImgBedUtils.PRE + newUser.getHeader());
|
||||
request.getSession().setAttribute("user", newUser);
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.example.jieyue.common.entity.SysGoods;
|
|||
import com.example.jieyue.common.entity.SysOrder;
|
||||
import com.example.jieyue.common.mapper.SysGoodsMapper;
|
||||
import com.example.jieyue.common.mapper.SysOrderMapper;
|
||||
import com.example.jieyue.common.utils.GiteeImgBedUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -30,7 +31,9 @@ public class UserOrderService {
|
|||
public List<SysGoods> getGoodsList(List<SysOrder> orderList){
|
||||
List<SysGoods> 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;
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
* <p>mysql通过关键字模糊查找商品</p>
|
||||
*/
|
||||
public List<SysGoods> mysqlSearchGoods(String keyword){
|
||||
return goodsMapper.search(keyword);
|
||||
List<SysGoods> list = goodsMapper.search(keyword);
|
||||
for (SysGoods goods : list) {
|
||||
goods.setImg(GiteeImgBedUtils.PRE + goods.getImg());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 {
|
|||
* <p>获取商户信息</p>
|
||||
*/
|
||||
public SysMt getMerchantInfo(int merchantId){
|
||||
return merchantMapper.findById(merchantId);
|
||||
SysMt merchant = merchantMapper.findById(merchantId);
|
||||
merchant.setHeader(GiteeImgBedUtils.PRE + merchant.getHeader());
|
||||
return merchant;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>获取商户商品信息</p>
|
||||
*/
|
||||
public Map<Integer,SysGoods> getGoodsList(int merchantId, int page, int num){
|
||||
List<SysGoods> list = goodsMapper.findByMtLimit(merchantId,(page-1)*num,page*num);
|
||||
Map<Integer,SysGoods> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>随机获取商品</p>
|
||||
*/
|
||||
public Map<Integer,SysGoods> getRandGoodsMap(int merchant,int num){
|
||||
List<SysGoods> list = goodsMapper.findMerchantRand(merchant,num);
|
||||
return common(goodsMapper.findMerchantRand(merchant,num));
|
||||
}
|
||||
|
||||
public Map<Integer,SysGoods> common(List<SysGoods> list) {
|
||||
Map<Integer,SysGoods> 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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>微信支付服务类</p>
|
||||
|
@ -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 {
|
|||
* <p>分割js传递的数组</p>
|
||||
*/
|
||||
public String[] getStringArray(String array){
|
||||
List<String> 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<String, String> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@ server:
|
|||
error:
|
||||
include-exception: true
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 50MB
|
||||
max-request-size: 100MB
|
||||
jmx:
|
||||
enabled: false
|
||||
application:
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
| |_| | | __/ |_| | |_| | __/
|
||||
\___/|_|\___|\__, |\__,_|\___|
|
||||
|___/
|
||||
@author: Bosen-once
|
||||
捷阅网购物商城 @author: Bosen
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 66 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -78,6 +78,11 @@
|
|||
</div>
|
||||
<script th:fragment="alertMsg" th:inline="javascript">
|
||||
|
||||
function loading() {
|
||||
var img = document.getElementById("loading");
|
||||
img.style.display = "";
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
if ("[[${param.msg}]]" != "") {
|
||||
alert("[[${param.msg}]]");
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<img id="loading" th:src="@{/loading.gif}" style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 999; display: none; opacity: 0.8"/>
|
||||
<div id="wrapper">
|
||||
<div th:include="admin/common/model::nav"></div>
|
||||
|
||||
|
@ -45,14 +46,14 @@
|
|||
<h4>推荐尺寸:1920x737</h4>
|
||||
<form th:action="@{/admin/up-image}" method="post" enctype="multipart/form-data" style="text-align: right">
|
||||
<input type="file" name="file" style="display: none;" id="input1920" onchange="showImg(this,'img1920')">
|
||||
<input type="submit" value="修改">
|
||||
<input type="submit" value="修改" onclick="loading()">
|
||||
<input type="number" value="1920" name="width" hidden="hidden">
|
||||
<input type="number" value="737" name="height" hidden="hidden">
|
||||
</form>
|
||||
<form th:action="@{/admin/del-image}" method="post" style="text-align: right">
|
||||
<input type="number" value="1920" name="width" hidden="hidden">
|
||||
<input type="number" value="737" name="height" hidden="hidden">
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?')==false)return false; "/>
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?') == false) {return false;} else {loading();}"/>
|
||||
</form>
|
||||
<div style="width: 100%;text-align: center">
|
||||
<!--1920*737-->
|
||||
|
@ -73,12 +74,12 @@
|
|||
<input type="file" name="file" style="display: none;" id="input1230" onchange="showImg(this,'img1230')">
|
||||
<input type="number" value="1230" name="width" hidden="hidden">
|
||||
<input type="number" value="535" name="height" hidden="hidden">
|
||||
<input type="submit" value="修改">
|
||||
<input type="submit" value="修改" onclick="loading()">
|
||||
</form>
|
||||
<form th:action="@{/admin/del-image}" method="post" style="text-align: right">
|
||||
<input type="number" value="1230" name="width" hidden="hidden">
|
||||
<input type="number" value="535" name="height" hidden="hidden">
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?')==false)return false; "/>
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?') == false) {return false;} else {loading();}"/>
|
||||
</form>
|
||||
<div style="width: 100%;text-align: center">
|
||||
<!--1230*535-->
|
||||
|
@ -99,12 +100,12 @@
|
|||
<input type="file" name="file" style="display: none;" id="input3151" onchange="showImg(this,'img3151')">
|
||||
<input type="number" value="3151" name="width" hidden="hidden">
|
||||
<input type="number" value="282" name="height" hidden="hidden">
|
||||
<input type="submit" value="修改">
|
||||
<input type="submit" value="修改" onclick="loading()">
|
||||
</form>
|
||||
<form th:action="@{/admin/del-image}" method="post" style="text-align: right">
|
||||
<input type="number" value="3151" name="width" hidden="hidden">
|
||||
<input type="number" value="282" name="height" hidden="hidden">
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?')==false)return false; "/>
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?') == false) {return false;} else {loading();}"/>
|
||||
</form>
|
||||
<div style="width: 100%;text-align: center">
|
||||
<img th:if="${imgMap.get('3151')} eq null" th:src="@{/image/user/home/banner/3.jpg}" id="img3151" onclick="upImg('input3151')" >
|
||||
|
@ -124,12 +125,12 @@
|
|||
<input type="file" name="file" style="display: none;" id="input3152" onchange="showImg(this,'img3152')">
|
||||
<input type="number" value="3152" name="width" hidden="hidden">
|
||||
<input type="number" value="282" name="height" hidden="hidden">
|
||||
<input type="submit" value="修改">
|
||||
<input type="submit" value="修改" onclick="loading()">
|
||||
</form>
|
||||
<form th:action="@{/admin/del-image}" method="post" style="text-align: right">
|
||||
<input type="number" value="3152" name="width" hidden="hidden">
|
||||
<input type="number" value="282" name="height" hidden="hidden">
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?')==false)return false; "/>
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?') == false) {return false;} else {loading();}"/>
|
||||
</form>
|
||||
<div style="width: 100%;text-align: center">
|
||||
<img th:if="${imgMap.get('3152')} eq null" th:src="@{/image/user/home/banner/3.jpg}" id="img3152" onclick="upImg('input3152')" >
|
||||
|
@ -149,12 +150,12 @@
|
|||
<input type="file" name="file" style="display: none;" id="input475" onchange="showImg(this,'img475')">
|
||||
<input type="number" value="475" name="width" hidden="hidden">
|
||||
<input type="number" value="570" name="height" hidden="hidden">
|
||||
<input type="submit" value="修改">
|
||||
<input type="submit" value="修改" onclick="loading()">
|
||||
</form>
|
||||
<form th:action="@{/admin/del-image}" method="post" style="text-align: right">
|
||||
<input type="number" value="475" name="width" hidden="hidden">
|
||||
<input type="number" value="570" name="height" hidden="hidden">
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?')==false)return false; "/>
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?') == false) {return false;} else {loading();}"/>
|
||||
</form>
|
||||
<div style="width: 100%;text-align: center">
|
||||
<img th:if="${imgMap.get('475')} eq null" th:src="@{/image/user/home/banner/1.jpg}" id="img475" onclick="upImg('input475')" >
|
||||
|
@ -174,12 +175,12 @@
|
|||
<input type="file" name="file" style="display: none;" id="input674" onchange="showImg(this,'img674')">
|
||||
<input type="number" value="674" name="width" hidden="hidden">
|
||||
<input type="number" value="264" name="height" hidden="hidden">
|
||||
<input type="submit" value="修改">
|
||||
<input type="submit" value="修改" onclick="loading()">
|
||||
</form>
|
||||
<form th:action="@{/admin/del-image}" method="post" style="text-align: right">
|
||||
<input type="number" value="674" name="width" hidden="hidden">
|
||||
<input type="number" value="264" name="height" hidden="hidden">
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?')==false)return false; "/>
|
||||
<input type="submit" value="删除" onclick="if (confirm('确认删除?') == false) {return false;} else {loading();}"/>
|
||||
</form>
|
||||
<div style="width: 100%;text-align: center">
|
||||
<img th:if="${imgMap.get('674')} eq null" th:src="@{/image/user/home/banner/2.jpg}" id="img674" onclick="upImg('input674')" >
|
||||
|
|
|
@ -97,6 +97,11 @@
|
|||
<!--sidebar end-->
|
||||
<script th:fragment="alertMsg" th:inline="javascript">
|
||||
|
||||
function loading() {
|
||||
var img = document.getElementById("loading");
|
||||
img.style.display = "";
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
if ("[[${param.msg}]]" != "") {
|
||||
alert("[[${param.msg}]]");
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<img id="loading" th:src="@{/loading.gif}" style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 999; display: none; opacity: 0.8"/>
|
||||
<section id="container">
|
||||
<!--header start-->
|
||||
<header class="header fixed-top clearfix" th:include="merchant/common/model::header"></header>
|
||||
|
@ -90,7 +91,7 @@
|
|||
</p>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<img th:src="@{/image/user/home/product/5.jpg}" style="width: 144px;height: 181.8px"
|
||||
<img th:src="@{/image/merchant/default.jpg}" style="width: 144px;height: 181.8px"
|
||||
id="img0" onclick="upImg('input0')">
|
||||
<input style="display: none" type="file" name="img" id="input0"
|
||||
onchange="showImg(this,'img0')">
|
||||
|
@ -112,7 +113,7 @@
|
|||
style="text-align: center;height: 181.8px">
|
||||
</td>
|
||||
<td style="text-align: center;font-weight: bold;">
|
||||
<input type="submit" value="添加商品" style="text-align: center;height: 181.8px;color: purple">
|
||||
<input type="submit" onclick="loading()" value="添加商品" style="text-align: center;height: 181.8px;color: purple">
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
|
@ -157,7 +158,7 @@
|
|||
<b>删除</b>
|
||||
</button>
|
||||
<button type="submit" style="background: deepskyblue;color: white;border-radius: 5px;width: 50px;height: 30px"
|
||||
onclick="if (confirm('确认修改该商品的信息?')==false)return false; ">
|
||||
onclick="if (confirm('确认修改该商品的信息?')==false) {return false;} else {loading()} ">
|
||||
<b>修改</b>
|
||||
</button>
|
||||
|
||||
|
@ -230,6 +231,7 @@
|
|||
|
||||
function delGoods(goodsId) {
|
||||
if (confirm("确认删除此商品?")) {
|
||||
loading();
|
||||
window.location = "/merchant/del-goods?id=" + goodsId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<img id="loading" th:src="@{/loading.gif}" style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 999; display: none; opacity: 0.8"/>
|
||||
<section id="container">
|
||||
<!--header start-->
|
||||
<header class="header fixed-top clearfix" th:include="merchant/common/model::header"></header>
|
||||
|
@ -61,7 +62,7 @@
|
|||
<img th:src="@{${session.merchant.getHeader()}}" width="240" height="240" onclick="upImg('headerInput')" id="header" style="border-radius: 100%">
|
||||
<input style="display: none;" id="headerInput" type="file" name="img" onchange="showImg(this,'header')">
|
||||
<br/>
|
||||
<input type="submit" value="修改" style="background: purple;border-radius: 5px;color: white">
|
||||
<input type="submit" value="修改" onclick="loading()" style="background: purple;border-radius: 5px;color: white">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -76,8 +77,7 @@
|
|||
<input type="number" name="width" value="400" hidden>
|
||||
<input type="number" name="height" value="320" hidden>
|
||||
<br/>
|
||||
<input type="submit" value="修改" style="background: purple;border-radius: 5px;color: white">
|
||||
<a style="color: purple" th:if="${homeImg}!=null" th:href="@{/merchant/del-home-img(id=${homeImg.getId()})}">删除</a>
|
||||
<input type="submit" onclick="loading()" value="修改" style="background: purple;border-radius: 5px;color: white">
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
|
@ -90,8 +90,7 @@
|
|||
<input type="number" name="width" value="600" hidden>
|
||||
<input type="number" name="height" value="310" hidden>
|
||||
<br/>
|
||||
<input type="submit" value="修改" style="background: purple;border-radius: 5px;color: white">
|
||||
<a style="color: purple" th:if="${lowImg}!=null" th:href="@{/merchant/del-home-img(id=${lowImg.getId()})}">删除</a>
|
||||
<input type="submit" onclick="loading()" value="修改" style="background: purple;border-radius: 5px;color: white">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -270,6 +270,12 @@
|
|||
</footer>
|
||||
|
||||
<script th:fragment="alertMsg" th:inline="javascript">
|
||||
|
||||
function loading() {
|
||||
var img = document.getElementById("loading");
|
||||
img.style.display = "";
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
if ("[[${param.msg}]]" != "") {
|
||||
alert("[[${param.msg}]]");
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- entry-header-area end -->
|
||||
|
||||
<img id="loading" th:src="@{/loading.gif}" style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 999; display: none; opacity: 0.8"/>
|
||||
<!-- cart-main-area start -->
|
||||
<div class="cart-main-area">
|
||||
<div class="container">
|
||||
|
@ -170,6 +170,7 @@
|
|||
var form = document.getElementById("form");
|
||||
form.action = "/user/update-info";
|
||||
form.submit();
|
||||
loading();
|
||||
}
|
||||
|
||||
function showImg(input,id) {
|
||||
|
|
Loading…
Reference in New Issue