Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
865eddf72d |
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
*.js linguist-language=java
|
||||||
|
*.css linguist-language=java
|
||||||
|
*.html linguist-language=java
|
||||||
@@ -1,7 +1,52 @@
|
|||||||
/.git
|
######################################################################
|
||||||
/.idea
|
# Build Tools
|
||||||
|
|
||||||
|
.gradle
|
||||||
|
/build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# IDE
|
||||||
|
*.classpath
|
||||||
|
*.project
|
||||||
|
*.iml
|
||||||
|
*.factorypath
|
||||||
|
target
|
||||||
|
.idea/
|
||||||
*.log
|
*.log
|
||||||
*.DS_Store
|
logs
|
||||||
/yshop-drink-boot3/target/
|
|
||||||
/yshop-drink-vue3/node_modules
|
|
||||||
/yshop-drink-uniapp-vue3/node_moduls
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
nbproject/private/
|
||||||
|
build/*
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
nbdist/
|
||||||
|
.nb-gradle/
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Others
|
||||||
|
*.log
|
||||||
|
*.xml.versionsBackup
|
||||||
|
|
||||||
|
!*/build/*.java
|
||||||
|
!*/build/*.html
|
||||||
|
!*/build/*.xml
|
||||||
@@ -1,21 +1,20 @@
|
|||||||
MIT License
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2023 yshop
|
Copyright (c) 2018 RuoYi
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
in the Software without restriction, including without limitation the rights
|
the Software without restriction, including without limitation the rights to
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
furnished to do so, subject to the following conditions:
|
subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
SOFTWARE.
|
|
||||||
@@ -1,152 +1,133 @@
|
|||||||
|
|
||||||
|
|
||||||
## 平台简介
|
|
||||||
|
### supplier2.0已经发布:
|
||||||
意象点餐(扫码点餐)系统,在线点餐(外卖与自取)小程序模式,支持多门店模式,SaaS多租户模式,基础技术Java17,springboot3、vue3、uniapp(vue3)(支持H5、微信小程序)
|
1、移除Light Security jwt 验证更改为shaun pac4j-jwt
|
||||||
采用当前流行技术组合的前后端分离点餐系统: SpringBoot3、Spring Security OAuth2、MybatisPlus、SpringSecurity、jwt、redis、Vue3的前后端分离的系统,
|
|
||||||
包含外卖与自取、商品管理(多规格sku)、店铺管理、云小票打印、图片素材库、订单管理、积分兑换(积分+金额)、充值、优惠券、充值、多门店、微信公众号、商家中心、提前预约、桌面扫码点餐(单人或者多人协同)、收银台(支持扫码枪与扫码盒子收款)、会员卡、桌台点餐、自定义装修等功能,更适合企业或个人二次开发.
|
2、mapstruct更新1.3.1 同时修复不能编译成对象的问题
|
||||||
|
|
||||||
官网地址:[https://www.yixiang.co/](https://www.yixiang.co/)
|
3、新的目录结构
|
||||||
|
|
||||||
|
4、同步ruoyi最新版本V4.6.1
|
||||||
|
|
||||||
## 演示地址
|
5、喜欢的小伙伴记得star下
|
||||||
|
|
||||||
| 后台登陆: | https://dc.yixiang.co 账号/密码:admin/admin123 |
|
6、本项目全开源 请自行下载的哦
|
||||||
|---|---|
|
|
||||||
| 门店登陆: | https://dc.yixiang.co 账号/密码:yixiang001/123456789 |
|
### supplier2.1即将发布:
|
||||||
| 移动端演示:关注右边公众号点击菜单其他系统体验点餐小程序与点餐H5,其中如果演示使用验证码登陆的点击下验证码默认验证码是9999 |  |
|
- 新的重构版本正在开发中,喜欢的小伙伴记得star下
|
||||||
|
- 新版本移动端将使用uniapp
|
||||||
## 视频资料
|
|
||||||
如果对您有帮助,您可以点右上角 "Star" 支持一下,这样我们才有继续免费下去的动力,谢谢! QQ交流群 (入群前,请在网页右上角点 "Star" ),群里有视频教程与开发文档哦!!
|
|
||||||
|
### **商城概况:**
|
||||||
交流QQ群:544263002
|
|
||||||
|
|
||||||
## 项目说明
|
本商城系统是一套完整的商城系统,包括小程序+小程序API+后台商城管理!!
|
||||||
|
|
||||||
|
**系统基础组合来源:**
|
||||||
```
|
|
||||||
yshop-drink. Java工程
|
程序员就要坚持着不要重复造轮子想法,所有就在gitee里找自己合适的轮子::
|
||||||
yshop-drink-vue 后台前端vue3工程
|
|
||||||
yshop-drink-uniapp-vue3 移动端uniapp(vue3版本)工程,支持微信小程序、h5
|
1、若依管理后台:用它做后台管理
|
||||||
```
|
|
||||||
|
2、shaun pac4j-jwt:强大jwt权限框架
|
||||||
|
|
||||||
## 本地快速启动
|
当然他们本身已经完成了很多功能,这里不多说,大家可以直接去码云搜索即可,后面会放上他们连接。
|
||||||
##### 1、环境要求
|
|
||||||
|
本系统主要包括三部分:
|
||||||
```
|
|
||||||
jdk17
|
第一:商城后台,完成完整的商城管理系统,目前已经完成,至于有bug大家可以直接issue或者进群交流(后面会打出来的(⊙o⊙)?!!),
|
||||||
mysql8
|
功能大概包括:商品管理,商品多规格属性管理,商品分类,商品品牌,商品订单,会员信息等等。
|
||||||
redis6+
|
涉及到技术: **springboot+Thymeleaf+mybatis**
|
||||||
node16+
|
|
||||||
maven3.8+
|
大致效果如下:
|
||||||
|
<table>
|
||||||
```
|
<tr>
|
||||||
##### 2、开发工具
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/180715_7394c4c4_477893.png"/></td>
|
||||||
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/180732_b2055281_477893.png"/></td>
|
||||||
```
|
</tr>
|
||||||
idea
|
<tr>
|
||||||
vscode
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/180740_8cc475d4_477893.png"/></td>
|
||||||
hbuilder
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/180752_45e9b4ce_477893.png"/></td>
|
||||||
|
</tr>
|
||||||
```
|
<tr>
|
||||||
##### 3、后端启动
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/180800_31df8e35_477893.png"/></td>
|
||||||
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/180809_4147d2e2_477893.png"/></td>
|
||||||
|
</tr>
|
||||||
- 3.1 请使用idea打开Java工程,自动会安装依赖
|
</table>
|
||||||
- 3.2 创建数据库且导入工程目录下sql/yixiang-drink.sql 文件
|
|
||||||
- 3.3 找到项目下的yshop-server 的yml,修改数据库相关信息和redis相关信息,如图:
|
|
||||||

|
|
||||||
- 3.4 工程下输入
|
|
||||||
```
|
第二:小程序API,目前API模块已经基本完成,
|
||||||
mvn clean install package '-Dmaven.test.skip=true
|
涉及到技术: **springboot+mybatis-plus+jwt+mapstruct+lombok+redis+swagger**
|
||||||
```
|
|
||||||
- 3.5 启动项目,如图
|
大致如下效果:
|
||||||

|
|
||||||
|
<table>
|
||||||
##### 4、后台vue启动
|
<tr>
|
||||||
|
<td><img src="https://images.gitee.com/uploads/images/2019/0914/145813_85d0bdc7_477893.png"/></td>
|
||||||
- 4.1 vscode 打开vue工程,在目录下输入命令:
|
<td><img src="https://images.gitee.com/uploads/images/2019/0916/164354_34a2cf90_477893.png"/></td>
|
||||||
```
|
</tr>
|
||||||
pnpm install
|
<tr>
|
||||||
```
|
<td><img src="https://images.gitee.com/uploads/images/2019/0928/174546_7531f0ca_477893.png"/></td>
|
||||||
- 4.2 配置api如图
|
<td></td>
|
||||||

|
</tr>
|
||||||
- 4.3 本地启动:
|
</table>
|
||||||
```
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
第三:mpvue小程序,小程序主要是用 **mpvue** 框架开发,这里就不说它的好处。
|
||||||
##### 5 移动端uniapp启动
|
|
||||||
|
|
||||||
- 5.1 hbuilder导入uniapp项目,
|
|
||||||
- 5.2 配置api
|
mpvue 小程序运行步骤:
|
||||||

|
|
||||||
- 5.3 配置小程序
|
1、安装node环境
|
||||||

|
node 是8版本,这边开发版本是8.12.0,由于mpvue属于老牌小程序框架了,目前这边验证的只是这个node版本,
|
||||||
- 5.4 运行小程序
|
当然新的小程序UNIAPP发布之后没用此限制拉
|
||||||

|
|
||||||
- 5.5 运行h5
|
2、设置npm淘宝镜像
|
||||||
|
|
||||||

|
npm set registry https://registry.npm.taobao.org/
|
||||||
-
|
|
||||||
|
3、npm install
|
||||||
|
|
||||||
|
4、npm run dev
|
||||||
## 小程序截图
|
|
||||||
|
|
||||||
| |  |
|
大致效果如下:
|
||||||
|---|---|
|
<table>
|
||||||
|  |  |
|
<tr>
|
||||||
|  |  |
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/181113_1b7f255a_477893.jpeg"/></td>
|
||||||
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/181123_0c86c94c_477893.jpeg"/></td>
|
||||||
## 后台截图
|
</tr>
|
||||||
|
<tr>
|
||||||
|  |
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/181132_b729a89b_477893.jpeg"/></td>
|
||||||
| |
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/181140_08e362ad_477893.jpeg"/></td>
|
||||||
|---|---|
|
</tr>
|
||||||
|  |
|
<tr>
|
||||||
|  |
|
<td><img src="https://images.gitee.com/uploads/images/2019/0830/181150_b5e0cd3e_477893.jpeg"/></td>
|
||||||
|  |  |
|
<td></td>
|
||||||

|
</tr>
|
||||||

|
</table>
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
## 技术栈
|
|
||||||
- Spring Boot3
|
**学习交流**
|
||||||
|
|
||||||
- Spring Security oauth2
|
|
||||||
|
其他:欢迎star或者提出你们宝贵的建议哦!!!
|
||||||
- MyBatis
|
|
||||||
|
****Requirement:****
|
||||||
- MyBatisPlus
|
- JDK1.8+,
|
||||||
|
- mysql5.7+
|
||||||
- Redis
|
|
||||||
|
**特别鸣谢**
|
||||||
- lombok
|
|
||||||
|
若依系统:[ruoyi](https://gitee.com/y_project/RuoYi)
|
||||||
- hutool
|
|
||||||
|
强大jwt权限框架:[shaun](https://gitee.com/baomidou/shaun)
|
||||||
- Vue3
|
|
||||||
|
|
||||||
- Element UI
|
|
||||||
|
|
||||||
- uniapp(vue3)
|
|
||||||
|
|
||||||
## 特别鸣谢
|
|
||||||
|
|
||||||
|
|
||||||
- ruoyi-vue-pro:https://gitee.com/zhijiantianya/ruoyi-vue-pro
|
|
||||||
- element-plus:https://element-plus.gitee.io/zh-CN/
|
|
||||||
- vue:https://cn.vuejs.org/
|
|
||||||
- pay-java-parent:https://gitee.com/egzosn/pay-java-parent
|
|
||||||
- uvui:https://www.uvui.cn/
|
|
||||||
- uniapp:https://uniapp.dcloud.net.cn/
|
|
||||||
|
|
||||||
|
|
||||||
## 开源协议
|
|
||||||
|
|
||||||
本项目采用比 Apache 2.0 更宽松的 [MIT License](https://gitee.com/guchengwuyue/yshop-drink/blob/master/LICENSE) 开源协议,个人与企业可 100% 免费使用,不用保留类作者、Copyright 信息。
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 3.0 MiB |
|
Before Width: | Height: | Size: 536 KiB |
|
Before Width: | Height: | Size: 211 KiB |
|
Before Width: | Height: | Size: 360 KiB |
|
Before Width: | Height: | Size: 233 KiB |
|
Before Width: | Height: | Size: 213 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 300 KiB |
|
Before Width: | Height: | Size: 245 KiB |
|
Before Width: | Height: | Size: 183 KiB |
|
Before Width: | Height: | Size: 194 KiB |
|
Before Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 385 KiB |
|
Before Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 211 KiB |
|
Before Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 391 KiB |
|
Before Width: | Height: | Size: 288 KiB |
|
Before Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 474 KiB |
|
Before Width: | Height: | Size: 316 KiB |
|
Before Width: | Height: | Size: 609 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 266 KiB |
|
Before Width: | Height: | Size: 595 KiB |
|
Before Width: | Height: | Size: 322 KiB |
|
Before Width: | Height: | Size: 542 KiB |
|
Before Width: | Height: | Size: 311 KiB |
|
Before Width: | Height: | Size: 386 KiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 544 KiB |
|
Before Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 198 KiB |
|
Before Width: | Height: | Size: 170 KiB |
|
Before Width: | Height: | Size: 198 KiB |
|
Before Width: | Height: | Size: 167 KiB |
|
Before Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 162 KiB |
|
Before Width: | Height: | Size: 430 KiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 3.1 MiB |
|
Before Width: | Height: | Size: 263 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 642 KiB |
|
Before Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 528 KiB |
@@ -0,0 +1,12 @@
|
|||||||
|
@echo off
|
||||||
|
echo.
|
||||||
|
echo [信息] 清理生成路径。
|
||||||
|
echo.
|
||||||
|
|
||||||
|
%~d0
|
||||||
|
cd %~dp0
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
call mvn clean
|
||||||
|
|
||||||
|
pause
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
@echo off
|
||||||
|
echo.
|
||||||
|
echo [信息] 打包Web工程,生成war/jar包文件。
|
||||||
|
echo.
|
||||||
|
|
||||||
|
%~d0
|
||||||
|
cd %~dp0
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
call mvn clean package -Dmaven.test.skip=true
|
||||||
|
|
||||||
|
pause
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
@echo off
|
||||||
|
echo.
|
||||||
|
echo [信息] 运行Web工程。
|
||||||
|
echo.
|
||||||
|
|
||||||
|
cd %~dp0
|
||||||
|
cd ../ruoyi-admin/target
|
||||||
|
|
||||||
|
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
|
java -jar %JAVA_OPTS% ruoyi-admin.jar
|
||||||
|
|
||||||
|
cd bin
|
||||||
|
pause
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "yshop-drink",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,291 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>co.yixiang</groupId>
|
||||||
|
<artifactId>supplier</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
|
||||||
|
<name>supplier</name>
|
||||||
|
<url>https://www.yixiang.co</url>
|
||||||
|
<description>供货管理系统</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<supplier.version>2.0.0</supplier.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||||
|
<shiro.version>1.7.1</shiro.version>
|
||||||
|
<thymeleaf.extras.shiro.version>2.0.0</thymeleaf.extras.shiro.version>
|
||||||
|
<druid.version>1.2.6</druid.version>
|
||||||
|
<bitwalker.version>1.21</bitwalker.version>
|
||||||
|
<kaptcha.version>2.3.2</kaptcha.version>
|
||||||
|
<swagger.version>2.9.2</swagger.version>
|
||||||
|
<mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version>
|
||||||
|
<pagehelper.boot.version>1.3.0</pagehelper.boot.version>
|
||||||
|
<fastjson.version>1.2.76</fastjson.version>
|
||||||
|
<oshi.version>5.6.0</oshi.version>
|
||||||
|
<jna.version>5.7.0</jna.version>
|
||||||
|
<commons.io.version>2.5</commons.io.version>
|
||||||
|
<commons.fileupload.version>1.3.3</commons.fileupload.version>
|
||||||
|
<poi.version>4.1.2</poi.version>
|
||||||
|
<velocity.version>1.7</velocity.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<!-- 依赖声明 -->
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringBoot的依赖配置-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>2.2.13.RELEASE</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--阿里数据库连接池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>${druid.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--验证码 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.penggle</groupId>
|
||||||
|
<artifactId>kaptcha</artifactId>
|
||||||
|
<version>${kaptcha.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--Shiro核心框架 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-core</artifactId>
|
||||||
|
<version>${shiro.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Shiro使用Spring框架 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-spring</artifactId>
|
||||||
|
<version>${shiro.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Shiro使用EhCache缓存框架 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<artifactId>shiro-ehcache</artifactId>
|
||||||
|
<version>${shiro.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- thymeleaf模板引擎和shiro框架的整合 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.theborakompanioni</groupId>
|
||||||
|
<artifactId>thymeleaf-extras-shiro</artifactId>
|
||||||
|
<version>${thymeleaf.extras.shiro.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 解析客户端操作系统、浏览器等 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>eu.bitwalker</groupId>
|
||||||
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
|
<version>${bitwalker.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot集成mybatis框架 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>${mybatis-spring-boot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>${pagehelper.boot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 获取系统信息 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.oshi</groupId>
|
||||||
|
<artifactId>oshi-core</artifactId>
|
||||||
|
<version>${oshi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.java.dev.jna</groupId>
|
||||||
|
<artifactId>jna</artifactId>
|
||||||
|
<version>${jna.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.java.dev.jna</groupId>
|
||||||
|
<artifactId>jna-platform</artifactId>
|
||||||
|
<version>${jna.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger2-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
<version>${swagger.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger2-UI-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>${swagger.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--io常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>${commons.io.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--文件上传工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
<version>${commons.fileupload.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- excel工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>${poi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--velocity代码生成使用模板 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
<artifactId>velocity</artifactId>
|
||||||
|
<version>${velocity.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>commons-collections</groupId>
|
||||||
|
<artifactId>commons-collections</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里JSON解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>${fastjson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 定时任务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>co.yixiang</groupId>
|
||||||
|
<artifactId>supplier-quartz</artifactId>
|
||||||
|
<version>${supplier.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 代码生成-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>co.yixiang</groupId>
|
||||||
|
<artifactId>supplier-generator</artifactId>
|
||||||
|
<version>${supplier.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>co.yixiang</groupId>
|
||||||
|
<artifactId>supplier-framework</artifactId>
|
||||||
|
<version>${supplier.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 系统模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>co.yixiang</groupId>
|
||||||
|
<artifactId>supplier-system</artifactId>
|
||||||
|
<version>${supplier.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 通用工具-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>co.yixiang</groupId>
|
||||||
|
<artifactId>supplier-common</artifactId>
|
||||||
|
<version>${supplier.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>supplier-admin</module>
|
||||||
|
<module>supplier-framework</module>
|
||||||
|
<module>supplier-system</module>
|
||||||
|
<module>supplier-quartz</module>
|
||||||
|
<module>supplier-generator</module>
|
||||||
|
<module>supplier-common</module>
|
||||||
|
<module>supplier-api</module>
|
||||||
|
</modules>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
AppName=RuoYi.jar
|
||||||
|
|
||||||
|
#JVM参数
|
||||||
|
JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
|
||||||
|
APP_HOME=`pwd`
|
||||||
|
LOG_PATH=$APP_HOME/logs/$AppName.log
|
||||||
|
|
||||||
|
if [ "$1" = "" ];
|
||||||
|
then
|
||||||
|
echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$AppName" = "" ];
|
||||||
|
then
|
||||||
|
echo -e "\033[0;31m 未输入应用名 \033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
function start()
|
||||||
|
{
|
||||||
|
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
|
||||||
|
|
||||||
|
if [ x"$PID" != x"" ]; then
|
||||||
|
echo "$AppName is running..."
|
||||||
|
else
|
||||||
|
nohup java -jar $JVM_OPTS target/$AppName > /dev/null 2>&1 &
|
||||||
|
echo "Start $AppName success..."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop()
|
||||||
|
{
|
||||||
|
echo "Stop $AppName"
|
||||||
|
|
||||||
|
PID=""
|
||||||
|
query(){
|
||||||
|
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
|
||||||
|
}
|
||||||
|
|
||||||
|
query
|
||||||
|
if [ x"$PID" != x"" ]; then
|
||||||
|
kill -TERM $PID
|
||||||
|
echo "$AppName (pid:$PID) exiting..."
|
||||||
|
while [ x"$PID" != x"" ]
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
query
|
||||||
|
done
|
||||||
|
echo "$AppName exited."
|
||||||
|
else
|
||||||
|
echo "$AppName already stopped."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function restart()
|
||||||
|
{
|
||||||
|
stop
|
||||||
|
sleep 2
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
function status()
|
||||||
|
{
|
||||||
|
PID=`ps -ef |grep java|grep $AppName|grep -v grep|wc -l`
|
||||||
|
if [ $PID != 0 ];then
|
||||||
|
echo "$AppName is running..."
|
||||||
|
else
|
||||||
|
echo "$AppName is not running..."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
start)
|
||||||
|
start;;
|
||||||
|
stop)
|
||||||
|
stop;;
|
||||||
|
restart)
|
||||||
|
restart;;
|
||||||
|
status)
|
||||||
|
status;;
|
||||||
|
*)
|
||||||
|
|
||||||
|
esac
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>supplier</artifactId>
|
||||||
|
<groupId>co.yixiang</groupId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<artifactId>supplier-admin</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
web服务入口
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringBoot集成thymeleaf模板 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- spring-boot-devtools -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger2-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>1.5.21</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
<version>1.5.21</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger2-UI-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql驱动包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>co.yixiang</groupId>
|
||||||
|
<artifactId>supplier-framework</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 定时任务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>co.yixiang</groupId>
|
||||||
|
<artifactId>supplier-quartz</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 代码生成-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>co.yixiang</groupId>
|
||||||
|
<artifactId>supplier-generator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>2.1.1.RELEASE</version>
|
||||||
|
<configuration>
|
||||||
|
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
<warName>${project.artifactId}</warName>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!-- YUI Compressor (CSS/JS压缩)
|
||||||
|
<plugin>
|
||||||
|
<groupId>net.alchim31.maven</groupId>
|
||||||
|
<artifactId>yuicompressor-maven-plugin</artifactId>
|
||||||
|
<version>1.5.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>prepare-package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>compress</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<jswarn>false</jswarn>
|
||||||
|
<nosuffix>true</nosuffix>
|
||||||
|
<linebreakpos>50000</linebreakpos>
|
||||||
|
<sourceDirectory>src/main/resources/static</sourceDirectory>
|
||||||
|
<force>true</force>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.js</include>
|
||||||
|
<include>**/*.css</include>
|
||||||
|
</includes>
|
||||||
|
<excludes>
|
||||||
|
<exclude>**/*.min.js</exclude>
|
||||||
|
<exclude>**/*.min.css</exclude>
|
||||||
|
<exclude>**/fileinput.js</exclude>
|
||||||
|
<exclude>**/bootstrap-table/**</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin> -->
|
||||||
|
</plugins>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package co.yixiang;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动程序
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||||
|
public class AdminApplication
|
||||||
|
{
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||||
|
SpringApplication.run(AdminApplication.class, args);
|
||||||
|
System.out.println("(♥◠‿◠)ノ゙ ========== ლ(´ڡ`ლ)゙ \n" +
|
||||||
|
"\n管理端启动成功 \n官网:https://www.yixiang.co 提供技术支持゙ \n");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package co.yixiang;
|
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web容器中进行部署
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class AdminServletInitializer extends SpringBootServletInitializer
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||||
|
{
|
||||||
|
return application.sources(AdminApplication.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
package co.yixiang.web.controller.common;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import co.yixiang.common.config.RuoYiConfig;
|
||||||
|
import co.yixiang.common.config.ServerConfig;
|
||||||
|
import co.yixiang.common.constant.Constants;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.StringUtils;
|
||||||
|
import co.yixiang.common.utils.file.FileUploadUtils;
|
||||||
|
import co.yixiang.common.utils.file.FileUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用请求处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class CommonController
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ServerConfig serverConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用下载请求
|
||||||
|
*
|
||||||
|
* @param fileName 文件名称
|
||||||
|
* @param delete 是否删除
|
||||||
|
*/
|
||||||
|
@GetMapping("common/download")
|
||||||
|
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!FileUtils.checkAllowDownload(fileName))
|
||||||
|
{
|
||||||
|
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||||
|
}
|
||||||
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||||
|
String filePath = RuoYiConfig.getDownloadPath() + fileName;
|
||||||
|
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||||
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||||
|
if (delete)
|
||||||
|
{
|
||||||
|
FileUtils.deleteFile(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("下载文件失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用上传请求
|
||||||
|
*/
|
||||||
|
@PostMapping("/common/upload")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 上传文件路径
|
||||||
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
|
// 上传并返回新文件名称
|
||||||
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
|
String url = serverConfig.getUrl() + fileName;
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("fileName", fileName);
|
||||||
|
ajax.put("url", url);
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本地资源通用下载
|
||||||
|
*/
|
||||||
|
@GetMapping("/common/download/resource")
|
||||||
|
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!FileUtils.checkAllowDownload(resource))
|
||||||
|
{
|
||||||
|
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||||
|
}
|
||||||
|
// 本地资源路径
|
||||||
|
String localPath = RuoYiConfig.getProfile();
|
||||||
|
// 数据库资源地址
|
||||||
|
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||||
|
// 下载名称
|
||||||
|
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||||
|
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("下载文件失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package co.yixiang.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模态窗口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/modal")
|
||||||
|
public class DemoDialogController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/modal";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模态窗口
|
||||||
|
*/
|
||||||
|
@GetMapping("/dialog")
|
||||||
|
public String dialog()
|
||||||
|
{
|
||||||
|
return prefix + "/dialog";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 弹层组件
|
||||||
|
*/
|
||||||
|
@GetMapping("/layer")
|
||||||
|
public String layer()
|
||||||
|
{
|
||||||
|
return prefix + "/layer";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单
|
||||||
|
*/
|
||||||
|
@GetMapping("/form")
|
||||||
|
public String form()
|
||||||
|
{
|
||||||
|
return prefix + "/form";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格
|
||||||
|
*/
|
||||||
|
@GetMapping("/table")
|
||||||
|
public String table()
|
||||||
|
{
|
||||||
|
return prefix + "/table";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格check
|
||||||
|
*/
|
||||||
|
@GetMapping("/check")
|
||||||
|
public String check()
|
||||||
|
{
|
||||||
|
return prefix + "/table/check";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格radio
|
||||||
|
*/
|
||||||
|
@GetMapping("/radio")
|
||||||
|
public String radio()
|
||||||
|
{
|
||||||
|
return prefix + "/table/radio";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格回传父窗体
|
||||||
|
*/
|
||||||
|
@GetMapping("/parent")
|
||||||
|
public String parent()
|
||||||
|
{
|
||||||
|
return prefix + "/table/parent";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,390 @@
|
|||||||
|
package co.yixiang.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.domain.CxSelect;
|
||||||
|
import co.yixiang.common.json.JSONObject;
|
||||||
|
import co.yixiang.common.json.JSONObject.JSONArray;
|
||||||
|
import co.yixiang.common.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单相关
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/form")
|
||||||
|
public class DemoFormController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/form";
|
||||||
|
|
||||||
|
private final static List<UserFormModel> users = new ArrayList<UserFormModel>();
|
||||||
|
{
|
||||||
|
users.add(new UserFormModel(1, "1000001", "测试1", "15888888888"));
|
||||||
|
users.add(new UserFormModel(2, "1000002", "测试2", "15666666666"));
|
||||||
|
users.add(new UserFormModel(3, "1000003", "测试3", "15666666666"));
|
||||||
|
users.add(new UserFormModel(4, "1000004", "测试4", "15666666666"));
|
||||||
|
users.add(new UserFormModel(5, "1000005", "测试5", "15666666666"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按钮页
|
||||||
|
*/
|
||||||
|
@GetMapping("/button")
|
||||||
|
public String button()
|
||||||
|
{
|
||||||
|
return prefix + "/button";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉框
|
||||||
|
*/
|
||||||
|
@GetMapping("/select")
|
||||||
|
public String select()
|
||||||
|
{
|
||||||
|
return prefix + "/select";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间轴
|
||||||
|
*/
|
||||||
|
@GetMapping("/timeline")
|
||||||
|
public String timeline()
|
||||||
|
{
|
||||||
|
return prefix + "/timeline";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单校验
|
||||||
|
*/
|
||||||
|
@GetMapping("/validate")
|
||||||
|
public String validate()
|
||||||
|
{
|
||||||
|
return prefix + "/validate";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能扩展(包含文件上传)
|
||||||
|
*/
|
||||||
|
@GetMapping("/jasny")
|
||||||
|
public String jasny()
|
||||||
|
{
|
||||||
|
return prefix + "/jasny";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拖动排序
|
||||||
|
*/
|
||||||
|
@GetMapping("/sortable")
|
||||||
|
public String sortable()
|
||||||
|
{
|
||||||
|
return prefix + "/sortable";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单据打印
|
||||||
|
*/
|
||||||
|
@GetMapping("/invoice")
|
||||||
|
public String invoice()
|
||||||
|
{
|
||||||
|
return prefix + "/invoice";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签 & 提示
|
||||||
|
*/
|
||||||
|
@GetMapping("/labels_tips")
|
||||||
|
public String labels_tips()
|
||||||
|
{
|
||||||
|
return prefix + "/labels_tips";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项卡 & 面板
|
||||||
|
*/
|
||||||
|
@GetMapping("/tabs_panels")
|
||||||
|
public String tabs_panels()
|
||||||
|
{
|
||||||
|
return prefix + "/tabs_panels";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 栅格
|
||||||
|
*/
|
||||||
|
@GetMapping("/grid")
|
||||||
|
public String grid()
|
||||||
|
{
|
||||||
|
return prefix + "/grid";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单向导
|
||||||
|
*/
|
||||||
|
@GetMapping("/wizard")
|
||||||
|
public String wizard()
|
||||||
|
{
|
||||||
|
return prefix + "/wizard";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传
|
||||||
|
*/
|
||||||
|
@GetMapping("/upload")
|
||||||
|
public String upload()
|
||||||
|
{
|
||||||
|
return prefix + "/upload";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期和时间页
|
||||||
|
*/
|
||||||
|
@GetMapping("/datetime")
|
||||||
|
public String datetime()
|
||||||
|
{
|
||||||
|
return prefix + "/datetime";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 左右互选组件
|
||||||
|
*/
|
||||||
|
@GetMapping("/duallistbox")
|
||||||
|
public String duallistbox()
|
||||||
|
{
|
||||||
|
return prefix + "/duallistbox";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基本表单
|
||||||
|
*/
|
||||||
|
@GetMapping("/basic")
|
||||||
|
public String basic()
|
||||||
|
{
|
||||||
|
return prefix + "/basic";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/cards")
|
||||||
|
public String cards()
|
||||||
|
{
|
||||||
|
return prefix + "/cards";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* summernote 富文本编辑器
|
||||||
|
*/
|
||||||
|
@GetMapping("/summernote")
|
||||||
|
public String summernote()
|
||||||
|
{
|
||||||
|
return prefix + "/summernote";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索自动补全
|
||||||
|
*/
|
||||||
|
@GetMapping("/autocomplete")
|
||||||
|
public String autocomplete()
|
||||||
|
{
|
||||||
|
return prefix + "/autocomplete";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多级联动下拉
|
||||||
|
*/
|
||||||
|
@GetMapping("/cxselect")
|
||||||
|
public String cxselect(ModelMap mmap)
|
||||||
|
{
|
||||||
|
CxSelect cxSelectTB = new CxSelect();
|
||||||
|
cxSelectTB.setN("淘宝");
|
||||||
|
cxSelectTB.setV("taobao");
|
||||||
|
CxSelect cxSelectTm = new CxSelect();
|
||||||
|
cxSelectTm.setN("天猫");
|
||||||
|
cxSelectTm.setV("tm");
|
||||||
|
CxSelect cxSelectJhs = new CxSelect();
|
||||||
|
cxSelectJhs.setN("聚划算");
|
||||||
|
cxSelectJhs.setV("jhs");
|
||||||
|
List<CxSelect> tmList = new ArrayList<CxSelect>();
|
||||||
|
tmList.add(cxSelectTm);
|
||||||
|
tmList.add(cxSelectJhs);
|
||||||
|
cxSelectTB.setS(tmList);
|
||||||
|
|
||||||
|
CxSelect cxSelectJD = new CxSelect();
|
||||||
|
cxSelectJD.setN("京东");
|
||||||
|
cxSelectJD.setV("jd");
|
||||||
|
CxSelect cxSelectCs = new CxSelect();
|
||||||
|
cxSelectCs.setN("京东超市");
|
||||||
|
cxSelectCs.setV("jdcs");
|
||||||
|
CxSelect cxSelectSx = new CxSelect();
|
||||||
|
cxSelectSx.setN("京东生鲜");
|
||||||
|
cxSelectSx.setV("jdsx");
|
||||||
|
List<CxSelect> jdList = new ArrayList<CxSelect>();
|
||||||
|
jdList.add(cxSelectCs);
|
||||||
|
jdList.add(cxSelectSx);
|
||||||
|
cxSelectJD.setS(jdList);
|
||||||
|
|
||||||
|
List<CxSelect> cxList = new ArrayList<CxSelect>();
|
||||||
|
cxList.add(cxSelectTB);
|
||||||
|
cxList.add(cxSelectJD);
|
||||||
|
|
||||||
|
mmap.put("data", JSON.toJSON(cxList));
|
||||||
|
return prefix + "/cxselect";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 局部刷新
|
||||||
|
*/
|
||||||
|
@GetMapping("/localrefresh")
|
||||||
|
public String localRefresh(ModelMap mmap)
|
||||||
|
{
|
||||||
|
JSONArray list = new JSONArray();
|
||||||
|
JSONObject item = new JSONObject();
|
||||||
|
item.put("name", "这条任务数据是由ModelMap传递到页面的,点击添加按钮后会将这条数据替换为新数据");
|
||||||
|
item.put("type", "默认");
|
||||||
|
item.put("date", "2020.06.10");
|
||||||
|
list.add(item);
|
||||||
|
mmap.put("tasks", list);
|
||||||
|
mmap.put("min", 2);
|
||||||
|
mmap.put("max", 10);
|
||||||
|
return prefix + "/localrefresh";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 局部刷新-添加任务
|
||||||
|
*
|
||||||
|
* @param fragment 页面中的模板名称
|
||||||
|
* @param taskName 任务名称
|
||||||
|
*/
|
||||||
|
@PostMapping("/localrefresh/task")
|
||||||
|
public String localRefreshTask(String fragment, String taskName, ModelMap mmap)
|
||||||
|
{
|
||||||
|
JSONArray list = new JSONArray();
|
||||||
|
JSONObject item = new JSONObject();
|
||||||
|
item.put("name", StringUtils.defaultIfBlank(taskName, "通过电话销售过程中了解各盛市的设备仪器使用、采购情况及相关重要追踪人"));
|
||||||
|
item.put("type", "新增");
|
||||||
|
item.put("date", "2018.06.10");
|
||||||
|
list.add(item);
|
||||||
|
item = new JSONObject();
|
||||||
|
item.put("name", "提高自己电话营销技巧,灵活专业地与客户进行电话交流");
|
||||||
|
item.put("type", "新增");
|
||||||
|
item.put("date", "2018.06.12");
|
||||||
|
list.add(item);
|
||||||
|
mmap.put("tasks", list);
|
||||||
|
return prefix + "/localrefresh::" + fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模拟数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/cityData")
|
||||||
|
@ResponseBody
|
||||||
|
public String cityData()
|
||||||
|
{
|
||||||
|
String data = "[{\"n\":\"湖南省\",\"s\":[{\"n\":\"长沙市\",\"s\":[{\"n\":\"芙蓉区\"},{\"n\":\"天心区\"},{\"n\":\"岳麓区\"},{\"n\":\"开福区\"},{\"n\":\"雨花区\"},{\"n\":\"望城区\"},{\"n\":\"长沙县\"},{\"n\":\"宁乡县\"},{\"n\":\"浏阳市\"}]},{\"n\":\"株洲市\",\"s\":[{\"n\":\"荷塘区\"},{\"n\":\"芦淞区\"},{\"n\":\"石峰区\"},{\"n\":\"天元区\"},{\"n\":\"株洲县\"},{\"n\":\"攸县\"},{\"n\":\"茶陵县\"},{\"n\":\"炎陵县\"},{\"n\":\"醴陵市\"}]},{\"n\":\"湘潭市\",\"s\":[{\"n\":\"雨湖区\"},{\"n\":\"岳塘区\"},{\"n\":\"湘潭县\"},{\"n\":\"湘乡市\"},{\"n\":\"韶山市\"}]},{\"n\":\"衡阳市\",\"s\":[{\"n\":\"珠晖区\"},{\"n\":\"雁峰区\"},{\"n\":\"石鼓区\"},{\"n\":\"蒸湘区\"},{\"n\":\"南岳区\"},{\"n\":\"衡阳县\"},{\"n\":\"衡南县\"},{\"n\":\"衡山县\"},{\"n\":\"衡东县\"},{\"n\":\"祁东县\"},{\"n\":\"耒阳市\"},{\"n\":\"常宁市\"}]},{\"n\":\"邵阳市\",\"s\":[{\"n\":\"双清区\"},{\"n\":\"大祥区\"},{\"n\":\"北塔区\"},{\"n\":\"邵东县\"},{\"n\":\"新邵县\"},{\"n\":\"邵阳县\"},{\"n\":\"隆回县\"},{\"n\":\"洞口县\"},{\"n\":\"绥宁县\"},{\"n\":\"新宁县\"},{\"n\":\"城步苗族自治县\"},{\"n\":\"武冈市\"}]},{\"n\":\"岳阳市\",\"s\":[{\"n\":\"岳阳楼区\"},{\"n\":\"云溪区\"},{\"n\":\"君山区\"},{\"n\":\"岳阳县\"},{\"n\":\"华容县\"},{\"n\":\"湘阴县\"},{\"n\":\"平江县\"},{\"n\":\"汨罗市\"},{\"n\":\"临湘市\"}]},{\"n\":\"常德市\",\"s\":[{\"n\":\"武陵区\"},{\"n\":\"鼎城区\"},{\"n\":\"安乡县\"},{\"n\":\"汉寿县\"},{\"n\":\"澧县\"},{\"n\":\"临澧县\"},{\"n\":\"桃源县\"},{\"n\":\"石门县\"},{\"n\":\"津市市\"}]},{\"n\":\"张家界市\",\"s\":[{\"n\":\"永定区\"},{\"n\":\"武陵源区\"},{\"n\":\"慈利县\"},{\"n\":\"桑植县\"}]},{\"n\":\"益阳市\",\"s\":[{\"n\":\"资阳区\"},{\"n\":\"赫山区\"},{\"n\":\"南县\"},{\"n\":\"桃江县\"},{\"n\":\"安化县\"},{\"n\":\"沅江市\"}]},{\"n\":\"郴州市\",\"s\":[{\"n\":\"北湖区\"},{\"n\":\"苏仙区\"},{\"n\":\"桂阳县\"},{\"n\":\"宜章县\"},{\"n\":\"永兴县\"},{\"n\":\"嘉禾县\"},{\"n\":\"临武县\"},{\"n\":\"汝城县\"},{\"n\":\"桂东县\"},{\"n\":\"安仁县\"},{\"n\":\"资兴市\"}]},{\"n\":\"永州市\",\"s\":[{\"n\":\"零陵区\"},{\"n\":\"冷水滩区\"},{\"n\":\"祁阳县\"},{\"n\":\"东安县\"},{\"n\":\"双牌县\"},{\"n\":\"道县\"},{\"n\":\"江永县\"},{\"n\":\"宁远县\"},{\"n\":\"蓝山县\"},{\"n\":\"新田县\"},{\"n\":\"江华瑶族自治县\"}]},{\"n\":\"怀化市\",\"s\":[{\"n\":\"鹤城区\"},{\"n\":\"中方县\"},{\"n\":\"沅陵县\"},{\"n\":\"辰溪县\"},{\"n\":\"溆浦县\"},{\"n\":\"会同县\"},{\"n\":\"麻阳苗族自治县\"},{\"n\":\"新晃侗族自治县\"},{\"n\":\"芷江侗族自治县\"},{\"n\":\"靖州苗族侗族自治县\"},{\"n\":\"通道侗族自治县\"},{\"n\":\"洪江市\"}]},{\"n\":\"娄底市\",\"s\":[{\"n\":\"娄星区\"},{\"n\":\"双峰县\"},{\"n\":\"新化县\"},{\"n\":\"冷水江市\"},{\"n\":\"涟源市\"}]},{\"n\":\"湘西土家族苗族自治州\",\"s\":[{\"n\":\"吉首市\"},{\"n\":\"泸溪县\"},{\"n\":\"凤凰县\"},{\"n\":\"花垣县\"},{\"n\":\"保靖县\"},{\"n\":\"古丈县\"},{\"n\":\"永顺县\"},{\"n\":\"龙山县\"}]}]},{\"n\":\"广东省\",\"s\":[{\"n\":\"广州市\",\"s\":[{\"n\":\"荔湾区\"},{\"n\":\"越秀区\"},{\"n\":\"海珠区\"},{\"n\":\"天河区\"},{\"n\":\"白云区\"},{\"n\":\"黄埔区\"},{\"n\":\"番禺区\"},{\"n\":\"花都区\"},{\"n\":\"南沙区\"},{\"n\":\"萝岗区\"},{\"n\":\"增城市\"},{\"n\":\"从化市\"}]},{\"n\":\"韶关市\",\"s\":[{\"n\":\"武江区\"},{\"n\":\"浈江区\"},{\"n\":\"曲江区\"},{\"n\":\"始兴县\"},{\"n\":\"仁化县\"},{\"n\":\"翁源县\"},{\"n\":\"乳源瑶族自治县\"},{\"n\":\"新丰县\"},{\"n\":\"乐昌市\"},{\"n\":\"南雄市\"}]},{\"n\":\"深圳市\",\"s\":[{\"n\":\"罗湖区\"},{\"n\":\"福田区\"},{\"n\":\"南山区\"},{\"n\":\"宝安区\"},{\"n\":\"龙岗区\"},{\"n\":\"盐田区\"}]},{\"n\":\"珠海市\",\"s\":[{\"n\":\"香洲区\"},{\"n\":\"斗门区\"},{\"n\":\"金湾区\"}]},{\"n\":\"汕头市\",\"s\":[{\"n\":\"龙湖区\"},{\"n\":\"金平区\"},{\"n\":\"濠江区\"},{\"n\":\"潮阳区\"},{\"n\":\"潮南区\"},{\"n\":\"澄海区\"},{\"n\":\"南澳县\"}]},{\"n\":\"佛山市\",\"s\":[{\"n\":\"禅城区\"},{\"n\":\"南海区\"},{\"n\":\"顺德区\"},{\"n\":\"三水区\"},{\"n\":\"高明区\"}]},{\"n\":\"江门市\",\"s\":[{\"n\":\"蓬江区\"},{\"n\":\"江海区\"},{\"n\":\"新会区\"},{\"n\":\"台山市\"},{\"n\":\"开平市\"},{\"n\":\"鹤山市\"},{\"n\":\"恩平市\"}]},{\"n\":\"湛江市\",\"s\":[{\"n\":\"赤坎区\"},{\"n\":\"霞山区\"},{\"n\":\"坡头区\"},{\"n\":\"麻章区\"},{\"n\":\"遂溪县\"},{\"n\":\"徐闻县\"},{\"n\":\"廉江市\"},{\"n\":\"雷州市\"},{\"n\":\"吴川市\"}]},{\"n\":\"茂名市\",\"s\":[{\"n\":\"茂南区\"},{\"n\":\"茂港区\"},{\"n\":\"电白县\"},{\"n\":\"高州市\"},{\"n\":\"化州市\"},{\"n\":\"Line truncated
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/userModel")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult userModel()
|
||||||
|
{
|
||||||
|
AjaxResult ajax = new AjaxResult();
|
||||||
|
|
||||||
|
ajax.put("code", 200);
|
||||||
|
ajax.put("value", users);
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据集合
|
||||||
|
*/
|
||||||
|
@GetMapping("/collection")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult collection()
|
||||||
|
{
|
||||||
|
String[] array = { "ruoyi 1", "ruoyi 2", "ruoyi 3", "ruoyi 4", "ruoyi 5" };
|
||||||
|
AjaxResult ajax = new AjaxResult();
|
||||||
|
ajax.put("value", array);
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserFormModel
|
||||||
|
{
|
||||||
|
/** 用户ID */
|
||||||
|
private int userId;
|
||||||
|
|
||||||
|
/** 用户编号 */
|
||||||
|
private String userCode;
|
||||||
|
|
||||||
|
/** 用户姓名 */
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/** 用户手机 */
|
||||||
|
private String userPhone;
|
||||||
|
|
||||||
|
public UserFormModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserFormModel(int userId, String userCode, String userName, String userPhone)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
this.userCode = userCode;
|
||||||
|
this.userName = userName;
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(int userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserCode()
|
||||||
|
{
|
||||||
|
return userCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserCode(String userCode)
|
||||||
|
{
|
||||||
|
this.userCode = userCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName()
|
||||||
|
{
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName)
|
||||||
|
{
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserPhone()
|
||||||
|
{
|
||||||
|
return userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserPhone(String userPhone)
|
||||||
|
{
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package co.yixiang.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图标相关
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/icon")
|
||||||
|
public class DemoIconController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/icon";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FontAwesome图标
|
||||||
|
*/
|
||||||
|
@GetMapping("/fontawesome")
|
||||||
|
public String fontAwesome()
|
||||||
|
{
|
||||||
|
return prefix + "/fontawesome";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Glyphicons图标
|
||||||
|
*/
|
||||||
|
@GetMapping("/glyphicons")
|
||||||
|
public String glyphicons()
|
||||||
|
{
|
||||||
|
return prefix + "/glyphicons";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,329 @@
|
|||||||
|
package co.yixiang.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import co.yixiang.web.controller.demo.domain.CustomerModel;
|
||||||
|
import co.yixiang.web.controller.demo.domain.UserOperateModel;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.page.PageDomain;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
import co.yixiang.common.core.page.TableSupport;
|
||||||
|
import co.yixiang.common.core.text.Convert;
|
||||||
|
import co.yixiang.common.exception.BusinessException;
|
||||||
|
import co.yixiang.common.utils.StringUtils;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.web.controller.demo.domain.CustomerModel;
|
||||||
|
import co.yixiang.web.controller.demo.domain.UserOperateModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作控制
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/operate")
|
||||||
|
public class DemoOperateController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/operate";
|
||||||
|
|
||||||
|
private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>();
|
||||||
|
{
|
||||||
|
users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
||||||
|
users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||||
|
users.put(3, new UserOperateModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||||
|
users.put(4, new UserOperateModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||||
|
users.put(5, new UserOperateModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
|
||||||
|
users.put(6, new UserOperateModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
|
||||||
|
users.put(7, new UserOperateModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||||
|
users.put(8, new UserOperateModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
|
||||||
|
users.put(9, new UserOperateModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||||
|
users.put(10, new UserOperateModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||||
|
users.put(11, new UserOperateModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||||
|
users.put(12, new UserOperateModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||||
|
users.put(13, new UserOperateModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
|
||||||
|
users.put(14, new UserOperateModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
|
||||||
|
users.put(15, new UserOperateModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||||
|
users.put(16, new UserOperateModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
|
||||||
|
users.put(17, new UserOperateModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||||
|
users.put(18, new UserOperateModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
|
||||||
|
users.put(19, new UserOperateModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||||
|
users.put(20, new UserOperateModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||||
|
users.put(21, new UserOperateModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||||
|
users.put(22, new UserOperateModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
|
||||||
|
users.put(23, new UserOperateModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
|
||||||
|
users.put(24, new UserOperateModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||||
|
users.put(25, new UserOperateModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||||
|
users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格
|
||||||
|
*/
|
||||||
|
@GetMapping("/table")
|
||||||
|
public String table()
|
||||||
|
{
|
||||||
|
return prefix + "/table";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他
|
||||||
|
*/
|
||||||
|
@GetMapping("/other")
|
||||||
|
public String other()
|
||||||
|
{
|
||||||
|
return prefix + "/other";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(UserOperateModel userModel)
|
||||||
|
{
|
||||||
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
|
List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values());
|
||||||
|
// 查询条件过滤
|
||||||
|
if (StringUtils.isNotEmpty(userModel.getSearchValue()))
|
||||||
|
{
|
||||||
|
userList.clear();
|
||||||
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||||
|
{
|
||||||
|
if (entry.getValue().getUserName().equals(userModel.getSearchValue()))
|
||||||
|
{
|
||||||
|
userList.add(entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(userModel.getUserName()))
|
||||||
|
{
|
||||||
|
userList.clear();
|
||||||
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||||
|
{
|
||||||
|
if (entry.getValue().getUserName().equals(userModel.getUserName()))
|
||||||
|
{
|
||||||
|
userList.add(entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
||||||
|
{
|
||||||
|
rspData.setRows(userList);
|
||||||
|
rspData.setTotal(userList.size());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||||
|
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||||
|
if (pageSize > userList.size())
|
||||||
|
{
|
||||||
|
pageSize = userList.size();
|
||||||
|
}
|
||||||
|
rspData.setRows(userList.subList(pageNum, pageSize));
|
||||||
|
rspData.setTotal(userList.size());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add(ModelMap mmap)
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存用户
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(UserOperateModel user)
|
||||||
|
{
|
||||||
|
Integer userId = users.size() + 1;
|
||||||
|
user.setUserId(userId);
|
||||||
|
return AjaxResult.success(users.put(userId, user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存主子表信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/customer/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(CustomerModel customerModel)
|
||||||
|
{
|
||||||
|
System.out.println(customerModel.toString());
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{userId}")
|
||||||
|
public String edit(@PathVariable("userId") Integer userId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("user", users.get(userId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存用户
|
||||||
|
*/
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(UserOperateModel user)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出
|
||||||
|
*/
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(UserOperateModel user)
|
||||||
|
{
|
||||||
|
List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values());
|
||||||
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
|
return util.exportExcel(list, "用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载模板
|
||||||
|
*/
|
||||||
|
@GetMapping("/importTemplate")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult importTemplate()
|
||||||
|
{
|
||||||
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
|
return util.importTemplateExcel("用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/importData")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||||
|
{
|
||||||
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
|
List<UserOperateModel> userList = util.importExcel(file.getInputStream());
|
||||||
|
String message = importUser(userList, updateSupport);
|
||||||
|
return AjaxResult.success(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*/
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
Integer[] userIds = Convert.toIntArray(ids);
|
||||||
|
for (Integer userId : userIds)
|
||||||
|
{
|
||||||
|
users.remove(userId);
|
||||||
|
}
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看详细
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail/{userId}")
|
||||||
|
public String detail(@PathVariable("userId") Integer userId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("user", users.get(userId));
|
||||||
|
return prefix + "/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/clean")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
users.clear();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入用户数据
|
||||||
|
*
|
||||||
|
* @param userList 用户数据列表
|
||||||
|
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNull(userList) || userList.size() == 0)
|
||||||
|
{
|
||||||
|
throw new BusinessException("导入用户数据不能为空!");
|
||||||
|
}
|
||||||
|
int successNum = 0;
|
||||||
|
int failureNum = 0;
|
||||||
|
StringBuilder successMsg = new StringBuilder();
|
||||||
|
StringBuilder failureMsg = new StringBuilder();
|
||||||
|
for (UserOperateModel user : userList)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 验证是否存在这个用户
|
||||||
|
boolean userFlag = false;
|
||||||
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||||
|
{
|
||||||
|
if (entry.getValue().getUserName().equals(user.getUserName()))
|
||||||
|
{
|
||||||
|
userFlag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!userFlag)
|
||||||
|
{
|
||||||
|
Integer userId = users.size() + 1;
|
||||||
|
user.setUserId(userId);
|
||||||
|
users.put(userId, user);
|
||||||
|
successNum++;
|
||||||
|
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功");
|
||||||
|
}
|
||||||
|
else if (isUpdateSupport)
|
||||||
|
{
|
||||||
|
users.put(user.getUserId(), user);
|
||||||
|
successNum++;
|
||||||
|
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
failureNum++;
|
||||||
|
failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
failureNum++;
|
||||||
|
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
|
||||||
|
failureMsg.append(msg + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (failureNum > 0)
|
||||||
|
{
|
||||||
|
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||||
|
throw new BusinessException(failureMsg.toString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||||
|
}
|
||||||
|
return successMsg.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package co.yixiang.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报表
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/report")
|
||||||
|
public class DemoReportController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/report";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 百度ECharts
|
||||||
|
*/
|
||||||
|
@GetMapping("/echarts")
|
||||||
|
public String echarts()
|
||||||
|
{
|
||||||
|
return prefix + "/echarts";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图表插件
|
||||||
|
*/
|
||||||
|
@GetMapping("/peity")
|
||||||
|
public String peity()
|
||||||
|
{
|
||||||
|
return prefix + "/peity";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线状图插件
|
||||||
|
*/
|
||||||
|
@GetMapping("/sparkline")
|
||||||
|
public String sparkline()
|
||||||
|
{
|
||||||
|
return prefix + "/sparkline";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图表组合
|
||||||
|
*/
|
||||||
|
@GetMapping("/metrics")
|
||||||
|
public String metrics()
|
||||||
|
{
|
||||||
|
return prefix + "/metrics";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,590 @@
|
|||||||
|
package co.yixiang.web.controller.demo.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import co.yixiang.common.annotation.Excel;
|
||||||
|
import co.yixiang.common.annotation.Excel.ColumnType;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.page.PageDomain;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
import co.yixiang.common.core.page.TableSupport;
|
||||||
|
import co.yixiang.common.core.text.Convert;
|
||||||
|
import co.yixiang.common.utils.DateUtils;
|
||||||
|
import co.yixiang.common.utils.StringUtils;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格相关
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/demo/table")
|
||||||
|
public class DemoTableController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "demo/table";
|
||||||
|
|
||||||
|
private final static List<UserTableModel> users = new ArrayList<UserTableModel>();
|
||||||
|
{
|
||||||
|
users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
||||||
|
users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||||
|
users.add(new UserTableModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||||
|
users.add(new UserTableModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||||
|
users.add(new UserTableModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
|
||||||
|
users.add(new UserTableModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
|
||||||
|
users.add(new UserTableModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||||
|
users.add(new UserTableModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
|
||||||
|
users.add(new UserTableModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||||
|
users.add(new UserTableModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||||
|
users.add(new UserTableModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||||
|
users.add(new UserTableModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||||
|
users.add(new UserTableModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
|
||||||
|
users.add(new UserTableModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
|
||||||
|
users.add(new UserTableModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||||
|
users.add(new UserTableModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
|
||||||
|
users.add(new UserTableModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||||
|
users.add(new UserTableModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
|
||||||
|
users.add(new UserTableModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||||
|
users.add(new UserTableModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||||
|
users.add(new UserTableModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||||
|
users.add(new UserTableModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
|
||||||
|
users.add(new UserTableModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
|
||||||
|
users.add(new UserTableModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||||
|
users.add(new UserTableModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||||
|
users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static List<UserTableColumn> columns = new ArrayList<UserTableColumn>();
|
||||||
|
{
|
||||||
|
columns.add(new UserTableColumn("用户ID", "userId"));
|
||||||
|
columns.add(new UserTableColumn("用户编号", "userCode"));
|
||||||
|
columns.add(new UserTableColumn("用户姓名", "userName"));
|
||||||
|
columns.add(new UserTableColumn("用户手机", "userPhone"));
|
||||||
|
columns.add(new UserTableColumn("用户邮箱", "userEmail"));
|
||||||
|
columns.add(new UserTableColumn("用户状态", "status"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索相关
|
||||||
|
*/
|
||||||
|
@GetMapping("/search")
|
||||||
|
public String search()
|
||||||
|
{
|
||||||
|
return prefix + "/search";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据汇总
|
||||||
|
*/
|
||||||
|
@GetMapping("/footer")
|
||||||
|
public String footer()
|
||||||
|
{
|
||||||
|
return prefix + "/footer";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组合表头
|
||||||
|
*/
|
||||||
|
@GetMapping("/groupHeader")
|
||||||
|
public String groupHeader()
|
||||||
|
{
|
||||||
|
return prefix + "/groupHeader";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格导出
|
||||||
|
*/
|
||||||
|
@GetMapping("/export")
|
||||||
|
public String export()
|
||||||
|
{
|
||||||
|
return prefix + "/export";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格导出选择列
|
||||||
|
*/
|
||||||
|
@GetMapping("/exportSelected")
|
||||||
|
public String exportSelected()
|
||||||
|
{
|
||||||
|
return prefix + "/exportSelected";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/exportData")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult exportSelected(UserTableModel userModel, String userIds)
|
||||||
|
{
|
||||||
|
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
|
||||||
|
Collections.copy(userList, users);
|
||||||
|
|
||||||
|
// 条件过滤
|
||||||
|
if (StringUtils.isNotEmpty(userIds))
|
||||||
|
{
|
||||||
|
userList.clear();
|
||||||
|
for (Long userId : Convert.toLongArray(userIds))
|
||||||
|
{
|
||||||
|
for (UserTableModel user : users)
|
||||||
|
{
|
||||||
|
if (user.getUserId() == userId)
|
||||||
|
{
|
||||||
|
userList.add(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ExcelUtil<UserTableModel> util = new ExcelUtil<UserTableModel>(UserTableModel.class);
|
||||||
|
return util.exportExcel(userList, "用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻页记住选择
|
||||||
|
*/
|
||||||
|
@GetMapping("/remember")
|
||||||
|
public String remember()
|
||||||
|
{
|
||||||
|
return prefix + "/remember";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转至指定页
|
||||||
|
*/
|
||||||
|
@GetMapping("/pageGo")
|
||||||
|
public String pageGo()
|
||||||
|
{
|
||||||
|
return prefix + "/pageGo";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义查询参数
|
||||||
|
*/
|
||||||
|
@GetMapping("/params")
|
||||||
|
public String params()
|
||||||
|
{
|
||||||
|
return prefix + "/params";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多表格
|
||||||
|
*/
|
||||||
|
@GetMapping("/multi")
|
||||||
|
public String multi()
|
||||||
|
{
|
||||||
|
return prefix + "/multi";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击按钮加载表格
|
||||||
|
*/
|
||||||
|
@GetMapping("/button")
|
||||||
|
public String button()
|
||||||
|
{
|
||||||
|
return prefix + "/button";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直接加载表格数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/data")
|
||||||
|
public String data(ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("users", users);
|
||||||
|
return prefix + "/data";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格冻结列
|
||||||
|
*/
|
||||||
|
@GetMapping("/fixedColumns")
|
||||||
|
public String fixedColumns()
|
||||||
|
{
|
||||||
|
return prefix + "/fixedColumns";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义触发事件
|
||||||
|
*/
|
||||||
|
@GetMapping("/event")
|
||||||
|
public String event()
|
||||||
|
{
|
||||||
|
return prefix + "/event";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格细节视图
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public String detail()
|
||||||
|
{
|
||||||
|
return prefix + "/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格父子视图
|
||||||
|
*/
|
||||||
|
@GetMapping("/child")
|
||||||
|
public String child()
|
||||||
|
{
|
||||||
|
return prefix + "/child";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格图片预览
|
||||||
|
*/
|
||||||
|
@GetMapping("/image")
|
||||||
|
public String image()
|
||||||
|
{
|
||||||
|
return prefix + "/image";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态增删改查
|
||||||
|
*/
|
||||||
|
@GetMapping("/curd")
|
||||||
|
public String curd()
|
||||||
|
{
|
||||||
|
return prefix + "/curd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格行拖拽操作
|
||||||
|
*/
|
||||||
|
@GetMapping("/reorderRows")
|
||||||
|
public String reorderRows()
|
||||||
|
{
|
||||||
|
return prefix + "/reorderRows";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格列拖拽操作
|
||||||
|
*/
|
||||||
|
@GetMapping("/reorderColumns")
|
||||||
|
public String reorderColumns()
|
||||||
|
{
|
||||||
|
return prefix + "/reorderColumns";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格列宽拖动
|
||||||
|
*/
|
||||||
|
@GetMapping("/resizable")
|
||||||
|
public String resizable()
|
||||||
|
{
|
||||||
|
return prefix + "/resizable";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格行内编辑操作
|
||||||
|
*/
|
||||||
|
@GetMapping("/editable")
|
||||||
|
public String editable()
|
||||||
|
{
|
||||||
|
return prefix + "/editable";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主子表提交
|
||||||
|
*/
|
||||||
|
@GetMapping("/subdata")
|
||||||
|
public String subdata()
|
||||||
|
{
|
||||||
|
return prefix + "/subdata";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格自动刷新
|
||||||
|
*/
|
||||||
|
@GetMapping("/refresh")
|
||||||
|
public String refresh()
|
||||||
|
{
|
||||||
|
return prefix + "/refresh";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格打印配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/print")
|
||||||
|
public String print()
|
||||||
|
{
|
||||||
|
return prefix + "/print";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格标题格式化
|
||||||
|
*/
|
||||||
|
@GetMapping("/headerStyle")
|
||||||
|
public String headerStyle()
|
||||||
|
{
|
||||||
|
return prefix + "/headerStyle";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格动态列
|
||||||
|
*/
|
||||||
|
@GetMapping("/dynamicColumns")
|
||||||
|
public String dynamicColumns()
|
||||||
|
{
|
||||||
|
return prefix + "/dynamicColumns";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格其他操作
|
||||||
|
*/
|
||||||
|
@GetMapping("/other")
|
||||||
|
public String other()
|
||||||
|
{
|
||||||
|
return prefix + "/other";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态获取列
|
||||||
|
*/
|
||||||
|
@PostMapping("/ajaxColumns")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult ajaxColumns(UserTableColumn userColumn)
|
||||||
|
{
|
||||||
|
List<UserTableColumn> columnList = new ArrayList<UserTableColumn>(Arrays.asList(new UserTableColumn[columns.size()]));
|
||||||
|
Collections.copy(columnList, columns);
|
||||||
|
if (userColumn != null && "userBalance".equals(userColumn.getField()))
|
||||||
|
{
|
||||||
|
columnList.add(new UserTableColumn("用户余额", "userBalance"));
|
||||||
|
}
|
||||||
|
return AjaxResult.success(columnList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(UserTableModel userModel)
|
||||||
|
{
|
||||||
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
|
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
|
||||||
|
Collections.copy(userList, users);
|
||||||
|
// 查询条件过滤
|
||||||
|
if (StringUtils.isNotEmpty(userModel.getUserName()))
|
||||||
|
{
|
||||||
|
userList.clear();
|
||||||
|
for (UserTableModel user : users)
|
||||||
|
{
|
||||||
|
if (user.getUserName().equals(userModel.getUserName()))
|
||||||
|
{
|
||||||
|
userList.add(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
||||||
|
{
|
||||||
|
rspData.setRows(userList);
|
||||||
|
rspData.setTotal(userList.size());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||||
|
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||||
|
if (pageSize > userList.size())
|
||||||
|
{
|
||||||
|
pageSize = userList.size();
|
||||||
|
}
|
||||||
|
rspData.setRows(userList.subList(pageNum, pageSize));
|
||||||
|
rspData.setTotal(userList.size());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserTableColumn
|
||||||
|
{
|
||||||
|
/** 表头 */
|
||||||
|
private String title;
|
||||||
|
/** 字段 */
|
||||||
|
private String field;
|
||||||
|
|
||||||
|
public UserTableColumn()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserTableColumn(String title, String field)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
this.field = field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField()
|
||||||
|
{
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField(String field)
|
||||||
|
{
|
||||||
|
this.field = field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserTableModel
|
||||||
|
{
|
||||||
|
/** 用户ID */
|
||||||
|
private int userId;
|
||||||
|
|
||||||
|
/** 用户编号 */
|
||||||
|
@Excel(name = "用户编号", cellType = ColumnType.NUMERIC)
|
||||||
|
private String userCode;
|
||||||
|
|
||||||
|
/** 用户姓名 */
|
||||||
|
@Excel(name = "用户姓名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/** 用户性别 */
|
||||||
|
private String userSex;
|
||||||
|
|
||||||
|
/** 用户手机 */
|
||||||
|
@Excel(name = "用户手机")
|
||||||
|
private String userPhone;
|
||||||
|
|
||||||
|
/** 用户邮箱 */
|
||||||
|
@Excel(name = "用户邮箱")
|
||||||
|
private String userEmail;
|
||||||
|
|
||||||
|
/** 用户余额 */
|
||||||
|
@Excel(name = "用户余额", cellType = ColumnType.NUMERIC)
|
||||||
|
private double userBalance;
|
||||||
|
|
||||||
|
/** 用户状态(0正常 1停用) */
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public UserTableModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
||||||
|
String userEmail, double userBalance, String status)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
this.userCode = userCode;
|
||||||
|
this.userName = userName;
|
||||||
|
this.userSex = userSex;
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
this.userEmail = userEmail;
|
||||||
|
this.userBalance = userBalance;
|
||||||
|
this.status = status;
|
||||||
|
this.createTime = DateUtils.getNowDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(int userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserCode()
|
||||||
|
{
|
||||||
|
return userCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserCode(String userCode)
|
||||||
|
{
|
||||||
|
this.userCode = userCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName()
|
||||||
|
{
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName)
|
||||||
|
{
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserSex()
|
||||||
|
{
|
||||||
|
return userSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserSex(String userSex)
|
||||||
|
{
|
||||||
|
this.userSex = userSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserPhone()
|
||||||
|
{
|
||||||
|
return userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserPhone(String userPhone)
|
||||||
|
{
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserEmail()
|
||||||
|
{
|
||||||
|
return userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserEmail(String userEmail)
|
||||||
|
{
|
||||||
|
this.userEmail = userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getUserBalance()
|
||||||
|
{
|
||||||
|
return userBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserBalance(double userBalance)
|
||||||
|
{
|
||||||
|
this.userBalance = userBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus()
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status)
|
||||||
|
{
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime()
|
||||||
|
{
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime)
|
||||||
|
{
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package co.yixiang.web.controller.demo.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户测试信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class CustomerModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 客户姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户手机
|
||||||
|
*/
|
||||||
|
private String phonenumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户性别
|
||||||
|
*/
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户生日
|
||||||
|
*/
|
||||||
|
private String birthday;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户描述
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品信息
|
||||||
|
*/
|
||||||
|
private List<GoodsModel> goods;
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhonenumber()
|
||||||
|
{
|
||||||
|
return phonenumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhonenumber(String phonenumber)
|
||||||
|
{
|
||||||
|
this.phonenumber = phonenumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getSex()
|
||||||
|
{
|
||||||
|
return sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSex(String sex)
|
||||||
|
{
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBirthday()
|
||||||
|
{
|
||||||
|
return birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirthday(String birthday)
|
||||||
|
{
|
||||||
|
this.birthday = birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark()
|
||||||
|
{
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark)
|
||||||
|
{
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GoodsModel> getGoods()
|
||||||
|
{
|
||||||
|
return goods;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoods(List<GoodsModel> goods)
|
||||||
|
{
|
||||||
|
this.goods = goods;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("name", getName())
|
||||||
|
.append("phonenumber", getPhonenumber())
|
||||||
|
.append("sex", getSex())
|
||||||
|
.append("birthday", getBirthday())
|
||||||
|
.append("goods", getGoods())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package co.yixiang.web.controller.demo.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品测试信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class GoodsModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品重量
|
||||||
|
*/
|
||||||
|
private Integer weight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品价格
|
||||||
|
*/
|
||||||
|
private Double price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品日期
|
||||||
|
*/
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品种类
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getWeight()
|
||||||
|
{
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeight(Integer weight)
|
||||||
|
{
|
||||||
|
this.weight = weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getPrice()
|
||||||
|
{
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Double price)
|
||||||
|
{
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate()
|
||||||
|
{
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date)
|
||||||
|
{
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type)
|
||||||
|
{
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("name", getName())
|
||||||
|
.append("weight", getWeight())
|
||||||
|
.append("price", getPrice())
|
||||||
|
.append("date", getDate())
|
||||||
|
.append("type", getType())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package co.yixiang.web.controller.demo.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import co.yixiang.common.annotation.Excel;
|
||||||
|
import co.yixiang.common.annotation.Excel.Type;
|
||||||
|
import co.yixiang.common.core.domain.BaseEntity;
|
||||||
|
import co.yixiang.common.utils.DateUtils;
|
||||||
|
|
||||||
|
public class UserOperateModel extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private int userId;
|
||||||
|
|
||||||
|
@Excel(name = "用户编号")
|
||||||
|
private String userCode;
|
||||||
|
|
||||||
|
@Excel(name = "用户姓名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||||
|
private String userSex;
|
||||||
|
|
||||||
|
@Excel(name = "用户手机")
|
||||||
|
private String userPhone;
|
||||||
|
|
||||||
|
@Excel(name = "用户邮箱")
|
||||||
|
private String userEmail;
|
||||||
|
|
||||||
|
@Excel(name = "用户余额")
|
||||||
|
private double userBalance;
|
||||||
|
|
||||||
|
@Excel(name = "用户状态", readConverterExp = "0=正常,1=停用")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public UserOperateModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
||||||
|
String userEmail, double userBalance, String status)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
this.userCode = userCode;
|
||||||
|
this.userName = userName;
|
||||||
|
this.userSex = userSex;
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
this.userEmail = userEmail;
|
||||||
|
this.userBalance = userBalance;
|
||||||
|
this.status = status;
|
||||||
|
this.createTime = DateUtils.getNowDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(int userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserCode()
|
||||||
|
{
|
||||||
|
return userCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserCode(String userCode)
|
||||||
|
{
|
||||||
|
this.userCode = userCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName()
|
||||||
|
{
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName)
|
||||||
|
{
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserSex()
|
||||||
|
{
|
||||||
|
return userSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserSex(String userSex)
|
||||||
|
{
|
||||||
|
this.userSex = userSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserPhone()
|
||||||
|
{
|
||||||
|
return userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserPhone(String userPhone)
|
||||||
|
{
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserEmail()
|
||||||
|
{
|
||||||
|
return userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserEmail(String userEmail)
|
||||||
|
{
|
||||||
|
this.userEmail = userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getUserBalance()
|
||||||
|
{
|
||||||
|
return userBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserBalance(double userBalance)
|
||||||
|
{
|
||||||
|
this.userBalance = userBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus()
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status)
|
||||||
|
{
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date getCreateTime()
|
||||||
|
{
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCreateTime(Date createTime)
|
||||||
|
{
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package co.yixiang.web.controller.monitor;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.framework.web.service.CacheService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/cache")
|
||||||
|
public class CacheController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/cache";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CacheService cacheService;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public String cache(ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("cacheNames", cacheService.getCacheNames());
|
||||||
|
return prefix + "/cache";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getNames")
|
||||||
|
public String getCacheNames(String fragment, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("cacheNames", cacheService.getCacheNames());
|
||||||
|
return prefix + "/cache::" + fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getKeys")
|
||||||
|
public String getCacheKeys(String fragment, String cacheName, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("cacheName", cacheName);
|
||||||
|
mmap.put("cacheKyes", cacheService.getCacheKeys(cacheName));
|
||||||
|
return prefix + "/cache::" + fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getValue")
|
||||||
|
public String getCacheValue(String fragment, String cacheName, String cacheKey, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("cacheName", cacheName);
|
||||||
|
mmap.put("cacheKey", cacheKey);
|
||||||
|
mmap.put("cacheValue", cacheService.getCacheValue(cacheName, cacheKey));
|
||||||
|
return prefix + "/cache::" + fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/clearCacheName")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clearCacheName(String cacheName, ModelMap mmap)
|
||||||
|
{
|
||||||
|
cacheService.clearCacheName(cacheName);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/clearCacheKey")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clearCacheKey(String cacheName, String cacheKey, ModelMap mmap)
|
||||||
|
{
|
||||||
|
cacheService.clearCacheKey(cacheName, cacheKey);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/clearAll")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clearAll(ModelMap mmap)
|
||||||
|
{
|
||||||
|
cacheService.clearAll();
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package co.yixiang.web.controller.monitor;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* druid 监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/data")
|
||||||
|
public class DruidController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "/druid";
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:data:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String index()
|
||||||
|
{
|
||||||
|
return redirect(prefix + "/index.html");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package co.yixiang.web.controller.monitor;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.framework.web.domain.Server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/server")
|
||||||
|
public class ServerController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/server";
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:server:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String server(ModelMap mmap) throws Exception
|
||||||
|
{
|
||||||
|
Server server = new Server();
|
||||||
|
server.copyTo();
|
||||||
|
mmap.put("server", server);
|
||||||
|
return prefix + "/server";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package co.yixiang.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import co.yixiang.framework.shiro.service.SysPasswordService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.system.domain.SysLogininfor;
|
||||||
|
import co.yixiang.system.service.ISysLogininforService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统访问记录
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/logininfor")
|
||||||
|
public class SysLogininforController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/logininfor";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysLogininforService logininforService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String logininfor()
|
||||||
|
{
|
||||||
|
return prefix + "/logininfor";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysLogininfor logininfor)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("monitor:logininfor:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysLogininfor logininfor)
|
||||||
|
{
|
||||||
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
|
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||||
|
return util.exportExcel(list, "登录日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:remove")
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(logininforService.deleteLogininforByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:remove")
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||||
|
@PostMapping("/clean")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
logininforService.cleanLogininfor();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:logininfor:unlock")
|
||||||
|
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||||
|
@PostMapping("/unlock")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult unlock(String loginName)
|
||||||
|
{
|
||||||
|
passwordService.clearLoginRecordCache(loginName);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package co.yixiang.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.system.domain.SysOperLog;
|
||||||
|
import co.yixiang.system.service.ISysOperLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志记录
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/operlog")
|
||||||
|
public class SysOperlogController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/operlog";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysOperLogService operLogService;
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:operlog:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String operlog()
|
||||||
|
{
|
||||||
|
return prefix + "/operlog";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:operlog:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysOperLog operLog)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("monitor:operlog:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysOperLog operLog)
|
||||||
|
{
|
||||||
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
|
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||||
|
return util.exportExcel(list, "操作日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(operLogService.deleteOperLogByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:operlog:detail")
|
||||||
|
@GetMapping("/detail/{operId}")
|
||||||
|
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
||||||
|
return prefix + "/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||||
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
|
@PostMapping("/clean")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult clean()
|
||||||
|
{
|
||||||
|
operLogService.cleanOperLog();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package co.yixiang.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import co.yixiang.system.service.ISysUserOnlineService;
|
||||||
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
import co.yixiang.common.core.text.Convert;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.enums.OnlineStatus;
|
||||||
|
import co.yixiang.common.utils.ShiroUtils;
|
||||||
|
import co.yixiang.framework.shiro.session.OnlineSession;
|
||||||
|
import co.yixiang.framework.shiro.session.OnlineSessionDAO;
|
||||||
|
import co.yixiang.system.domain.SysUserOnline;
|
||||||
|
import co.yixiang.system.service.ISysUserOnlineService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线用户监控
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/monitor/online")
|
||||||
|
public class SysUserOnlineController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "monitor/online";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserOnlineService userOnlineService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OnlineSessionDAO onlineSessionDAO;
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:online:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String online()
|
||||||
|
{
|
||||||
|
return prefix + "/online";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("monitor:online:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysUserOnline userOnline)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
|
||||||
|
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
|
@PostMapping("/batchForceLogout")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult batchForceLogout(String ids)
|
||||||
|
{
|
||||||
|
for (String sessionId : Convert.toStrArray(ids))
|
||||||
|
{
|
||||||
|
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||||
|
if (online == null)
|
||||||
|
{
|
||||||
|
return error("用户已下线");
|
||||||
|
}
|
||||||
|
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||||
|
if (onlineSession == null)
|
||||||
|
{
|
||||||
|
return error("用户已下线");
|
||||||
|
}
|
||||||
|
if (sessionId.equals(ShiroUtils.getSessionId()))
|
||||||
|
{
|
||||||
|
return error("当前登录用户无法强退");
|
||||||
|
}
|
||||||
|
onlineSessionDAO.delete(onlineSession);
|
||||||
|
online.setStatus(OnlineStatus.off_line);
|
||||||
|
userOnlineService.saveOnline(online);
|
||||||
|
userOnlineService.removeUserCache(online.getLoginName(), sessionId);
|
||||||
|
}
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package co.yixiang.web.controller.shop;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.shop.domain.StoreCoupon;
|
||||||
|
import co.yixiang.shop.service.IStoreCouponService;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券主Controller
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2019-08-29
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/shop/coupon")
|
||||||
|
public class StoreCouponController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "shop/coupon";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreCouponService storeCouponService;
|
||||||
|
|
||||||
|
@RequiresPermissions("shop:coupon:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String coupon()
|
||||||
|
{
|
||||||
|
return prefix + "/coupon";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询优惠券主列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:coupon:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(StoreCoupon storeCoupon)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<StoreCoupon> list = storeCouponService.selectStoreCouponList(storeCoupon);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出优惠券主列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:coupon:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(StoreCoupon storeCoupon)
|
||||||
|
{
|
||||||
|
List<StoreCoupon> list = storeCouponService.selectStoreCouponList(storeCoupon);
|
||||||
|
ExcelUtil<StoreCoupon> util = new ExcelUtil<StoreCoupon>(StoreCoupon.class);
|
||||||
|
return util.exportExcel(list, "coupon");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增优惠券主
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存优惠券主
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:coupon:add")
|
||||||
|
@Log(title = "优惠券主", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(StoreCoupon storeCoupon)
|
||||||
|
{
|
||||||
|
return toAjax(storeCouponService.insertStoreCoupon(storeCoupon));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改优惠券主
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
StoreCoupon storeCoupon = storeCouponService.selectStoreCouponById(id);
|
||||||
|
mmap.put("storeCoupon", storeCoupon);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存优惠券主
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:coupon:edit")
|
||||||
|
@Log(title = "优惠券主", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(StoreCoupon storeCoupon)
|
||||||
|
{
|
||||||
|
return toAjax(storeCouponService.updateStoreCoupon(storeCoupon));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除优惠券主
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:coupon:remove")
|
||||||
|
@Log(title = "优惠券主", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(storeCouponService.deleteStoreCouponByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package co.yixiang.web.controller.shop;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.shop.domain.StoreGoodsAttribute;
|
||||||
|
import co.yixiang.shop.service.IStoreGoodsAttributeService;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品的属性(独立)Controller
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2019-08-24
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/shop/attribute")
|
||||||
|
public class StoreGoodsAttributeController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "shop/attribute";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreGoodsAttributeService storeGoodsAttributeService;
|
||||||
|
|
||||||
|
@RequiresPermissions("shop:attribute:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String attribute()
|
||||||
|
{
|
||||||
|
return prefix + "/attribute";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品的属性(独立)列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:attribute:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(StoreGoodsAttribute storeGoodsAttribute)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<StoreGoodsAttribute> list = storeGoodsAttributeService.selectStoreGoodsAttributeList(storeGoodsAttribute);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出商品的属性(独立)列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:attribute:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(StoreGoodsAttribute storeGoodsAttribute)
|
||||||
|
{
|
||||||
|
List<StoreGoodsAttribute> list = storeGoodsAttributeService.selectStoreGoodsAttributeList(storeGoodsAttribute);
|
||||||
|
ExcelUtil<StoreGoodsAttribute> util = new ExcelUtil<StoreGoodsAttribute>(StoreGoodsAttribute.class);
|
||||||
|
return util.exportExcel(list, "attribute");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商品的属性(独立)
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存商品的属性(独立)
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:attribute:add")
|
||||||
|
@Log(title = "商品的属性(独立)", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(StoreGoodsAttribute storeGoodsAttribute)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsAttributeService.insertStoreGoodsAttribute(storeGoodsAttribute));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品的属性(独立)
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{attrId}")
|
||||||
|
public String edit(@PathVariable("attrId") Long attrId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
StoreGoodsAttribute storeGoodsAttribute = storeGoodsAttributeService.selectStoreGoodsAttributeById(attrId);
|
||||||
|
mmap.put("storeGoodsAttribute", storeGoodsAttribute);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存商品的属性(独立)
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:attribute:edit")
|
||||||
|
@Log(title = "商品的属性(独立)", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(StoreGoodsAttribute storeGoodsAttribute)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsAttributeService.updateStoreGoodsAttribute(storeGoodsAttribute));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品的属性(独立)
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:attribute:remove")
|
||||||
|
@Log(title = "商品的属性(独立)", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsAttributeService.deleteStoreGoodsAttributeByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package co.yixiang.web.controller.shop;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.shop.domain.StoreGoodsBrand;
|
||||||
|
import co.yixiang.shop.service.IStoreGoodsBrandService;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品品牌Controller
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2019-08-23
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/shop/brand")
|
||||||
|
public class StoreGoodsBrandController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "shop/brand";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreGoodsBrandService storeGoodsBrandService;
|
||||||
|
|
||||||
|
@RequiresPermissions("shop:brand:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String brand()
|
||||||
|
{
|
||||||
|
return prefix + "/brand";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询产品品牌列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:brand:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(StoreGoodsBrand storeGoodsBrand)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<StoreGoodsBrand> list = storeGoodsBrandService.selectStoreGoodsBrandList(storeGoodsBrand);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出产品品牌列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:brand:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(StoreGoodsBrand storeGoodsBrand)
|
||||||
|
{
|
||||||
|
List<StoreGoodsBrand> list = storeGoodsBrandService.selectStoreGoodsBrandList(storeGoodsBrand);
|
||||||
|
ExcelUtil<StoreGoodsBrand> util = new ExcelUtil<StoreGoodsBrand>(StoreGoodsBrand.class);
|
||||||
|
return util.exportExcel(list, "brand");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增产品品牌
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存产品品牌
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:brand:add")
|
||||||
|
@Log(title = "产品品牌", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(StoreGoodsBrand storeGoodsBrand)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsBrandService.insertStoreGoodsBrand(storeGoodsBrand));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改产品品牌
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
StoreGoodsBrand storeGoodsBrand = storeGoodsBrandService.selectStoreGoodsBrandById(id);
|
||||||
|
mmap.put("storeGoodsBrand", storeGoodsBrand);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存产品品牌
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:brand:edit")
|
||||||
|
@Log(title = "产品品牌", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(StoreGoodsBrand storeGoodsBrand)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsBrandService.updateStoreGoodsBrand(storeGoodsBrand));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除产品品牌
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:brand:remove")
|
||||||
|
@Log(title = "产品品牌", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsBrandService.deleteStoreGoodsBrandByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
package co.yixiang.web.controller.shop;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.shop.domain.StoreGoodsCate;
|
||||||
|
import co.yixiang.shop.service.IStoreGoodsCateService;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.common.utils.StringUtils;
|
||||||
|
import co.yixiang.common.core.domain.Ztree;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城商品分类Controller
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2019-08-22
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/shop/cate")
|
||||||
|
public class StoreGoodsCateController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "shop/cate";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreGoodsCateService storeGoodsCateService;
|
||||||
|
|
||||||
|
@RequiresPermissions("shop:cate:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String cate()
|
||||||
|
{
|
||||||
|
return prefix + "/cate";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商城商品分类树列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:cate:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public List<StoreGoodsCate> list(StoreGoodsCate storeGoodsCate)
|
||||||
|
{
|
||||||
|
List<StoreGoodsCate> list = storeGoodsCateService.selectStoreGoodsCateList(storeGoodsCate);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出商城商品分类列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:cate:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(StoreGoodsCate storeGoodsCate)
|
||||||
|
{
|
||||||
|
List<StoreGoodsCate> list = storeGoodsCateService.selectStoreGoodsCateList(storeGoodsCate);
|
||||||
|
ExcelUtil<StoreGoodsCate> util = new ExcelUtil<StoreGoodsCate>(StoreGoodsCate.class);
|
||||||
|
return util.exportExcel(list, "cate");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商城商品分类
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/add/{id}", "/add/" })
|
||||||
|
public String add(@PathVariable(value = "id", required = false) Long id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("storeGoodsCate", storeGoodsCateService.selectStoreGoodsCateById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存商城商品分类
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:cate:add")
|
||||||
|
@Log(title = "商城商品分类", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(StoreGoodsCate storeGoodsCate)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsCateService.insertStoreGoodsCate(storeGoodsCate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商城商品分类
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
StoreGoodsCate storeGoodsCate = storeGoodsCateService.selectStoreGoodsCateById(id);
|
||||||
|
mmap.put("storeGoodsCate", storeGoodsCate);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存商城商品分类
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:cate:edit")
|
||||||
|
@Log(title = "商城商品分类", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(StoreGoodsCate storeGoodsCate)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsCateService.updateStoreGoodsCate(storeGoodsCate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:cate:remove")
|
||||||
|
@Log(title = "商城商品分类", businessType = BusinessType.DELETE)
|
||||||
|
@GetMapping("/remove/{id}")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsCateService.deleteStoreGoodsCateById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择商城商品分类树
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/selectCateTree/{id}", "/selectCateTree/" })
|
||||||
|
public String selectCateTree(@PathVariable(value = "id", required = false) Long id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(id))
|
||||||
|
{
|
||||||
|
mmap.put("storeGoodsCate", storeGoodsCateService.selectStoreGoodsCateById(id));
|
||||||
|
}
|
||||||
|
return prefix + "/tree";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载商城商品分类树列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> treeData()
|
||||||
|
{
|
||||||
|
List<Ztree> ztrees = storeGoodsCateService.selectStoreGoodsCateTree();
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,513 @@
|
|||||||
|
package co.yixiang.web.controller.shop;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import co.yixiang.shop.domain.*;
|
||||||
|
import co.yixiang.shop.service.*;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import co.yixiang.common.utils.StringUtils;
|
||||||
|
import co.yixiang.shop.domain.*;
|
||||||
|
import co.yixiang.shop.service.*;
|
||||||
|
import co.yixiang.shop.vo.SpecVO;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品主Controller
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2019-08-25
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/shop/goods")
|
||||||
|
public class StoreGoodsController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "shop/goods";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreGoodsService storeGoodsService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreGoodsTypeService storeGoodsTypeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreSpecService storeSpecService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreSpecItemService storeSpecItemService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreGoodsAttributeService storeGoodsAttributeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected IStoreGoodsAttrService storeGoodsAttrService;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreSpecGoodsPriceService storeSpecGoodsPriceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreGoodsCateService storeGoodsCateService;
|
||||||
|
|
||||||
|
@RequiresPermissions("shop:goods:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String goods()
|
||||||
|
{
|
||||||
|
return prefix + "/goods";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品主列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:goods:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(StoreGoods storeGoods)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<StoreGoods> list = storeGoodsService.selectStoreGoodsList(storeGoods);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出商品主列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:goods:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(StoreGoods storeGoods)
|
||||||
|
{
|
||||||
|
List<StoreGoods> list = storeGoodsService.selectStoreGoodsList(storeGoods);
|
||||||
|
ExcelUtil<StoreGoods> util = new ExcelUtil<StoreGoods>(StoreGoods.class);
|
||||||
|
return util.exportExcel(list, "goods");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商品主
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存商品主
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:goods:add")
|
||||||
|
@Log(title = "商品主", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(StoreGoods storeGoods)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsService.insertStoreGoods(storeGoods));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param goodsId
|
||||||
|
* @param typeId
|
||||||
|
* @param mmap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/editSpec/{goodsId}/{typeId}")
|
||||||
|
public String editSpecAttr(@PathVariable("goodsId") Integer goodsId,
|
||||||
|
@PathVariable("typeId") Integer typeId,
|
||||||
|
ModelMap mmap){
|
||||||
|
|
||||||
|
StoreGoods storeGoods = storeGoodsService.selectStoreGoodsById(goodsId);
|
||||||
|
|
||||||
|
//StoreGoodsType goodsType = new StoreGoodsType();
|
||||||
|
//goodsType.setId(typeId);
|
||||||
|
List<StoreGoodsType> typeList = storeGoodsTypeService.selectStoreGoodsTypeList(null);
|
||||||
|
//System.out.println(typeList);
|
||||||
|
mmap.put("storeGoods", storeGoods);
|
||||||
|
mmap.put("goodsTypes",typeList);
|
||||||
|
return prefix + "/spec";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param goodsId
|
||||||
|
* @param typeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/ajaxSpec")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult ajaxSpec(@RequestParam(value = "goods_id",defaultValue = "-1") Integer goodsId,
|
||||||
|
@RequestParam(value = "type_id",defaultValue = "0") Integer typeId){
|
||||||
|
|
||||||
|
//System.out.println("typeId:"+typeId);
|
||||||
|
if(typeId == 0) return AjaxResult.success("success","");
|
||||||
|
StoreSpec storeSpec = new StoreSpec();
|
||||||
|
storeSpec.setTypeId(typeId.longValue());
|
||||||
|
List<StoreSpec> specs = storeSpecService.selectStoreSpecList(storeSpec);
|
||||||
|
List<StoreSpecItem> specItems = null;
|
||||||
|
StoreSpecItem specItem = new StoreSpecItem();
|
||||||
|
for (StoreSpec spec : specs) {
|
||||||
|
specItem.setSpecId(spec.getId());
|
||||||
|
specItems = storeSpecItemService.selectStoreSpecItemList(specItem);
|
||||||
|
//System.out.println("goodsID:"+goodsId);
|
||||||
|
if(goodsId > 0){
|
||||||
|
String itemStr = storeGoodsService.getGoodsItems(goodsId.longValue());
|
||||||
|
if(StringUtils.isNotEmpty(itemStr)){
|
||||||
|
String[] strs = itemStr.split("_");
|
||||||
|
for (StoreSpecItem item : specItems) {
|
||||||
|
if(Arrays.asList(strs).contains(item.getId().toString())){
|
||||||
|
item.setSelected(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
spec.setStoreSpecItems(specItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
HashMap<String,Object> map = new HashMap<>();
|
||||||
|
map.put("data",specs);
|
||||||
|
//System.out.println(specs);
|
||||||
|
return AjaxResult.success("success",map);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param goodsId
|
||||||
|
* @param typeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/ajaxGetAttrInput")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult ajaxGetAttrInput(@RequestParam(value = "goods_id",defaultValue = "0") Integer goodsId,
|
||||||
|
@RequestParam(value = "type_id",defaultValue = "0") Integer typeId){
|
||||||
|
|
||||||
|
if(typeId == 0) return AjaxResult.success("success","");
|
||||||
|
StoreGoodsAttribute attribute = new StoreGoodsAttribute();
|
||||||
|
attribute.setTypeId(typeId);
|
||||||
|
List<StoreGoodsAttribute> attributeList = storeGoodsAttributeService
|
||||||
|
.selectStoreGoodsAttributeList(attribute);
|
||||||
|
//System.out.println("attributeList:"+attributeList);
|
||||||
|
String str = "";
|
||||||
|
StoreGoodsAttr storeGoodsAttr = null;
|
||||||
|
StoreGoodsAttr goodsAttrOption = new StoreGoodsAttr();
|
||||||
|
goodsAttrOption.setGoodsId(goodsId);
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
for (StoreGoodsAttribute attr : attributeList) {
|
||||||
|
goodsAttrOption.setAttrId(attr.getAttrId().intValue());
|
||||||
|
List<StoreGoodsAttr> goodsAttrList = storeGoodsAttrService
|
||||||
|
.selectStoreGoodsAttrList(goodsAttrOption);
|
||||||
|
|
||||||
|
if(goodsAttrList.isEmpty()){
|
||||||
|
StoreGoodsAttr emptyAttr = new StoreGoodsAttr();
|
||||||
|
emptyAttr.setGoodsId(0);
|
||||||
|
emptyAttr.setAttrId(0);
|
||||||
|
emptyAttr.setGoodsAttrId(0);
|
||||||
|
emptyAttr.setAttrValue("无");
|
||||||
|
emptyAttr.setAttrPrice("");
|
||||||
|
goodsAttrList.add(emptyAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (StoreGoodsAttr goodsAttr : goodsAttrList) {
|
||||||
|
//str = String.format("<tr class='attr_{}'>",attr.getAttrId());
|
||||||
|
stringBuilder.append(MessageFormat.format("<tr class=attr_{0}>",attr.getAttrId()));
|
||||||
|
//System.out.println(attr.getAttrId());
|
||||||
|
stringBuilder.append(MessageFormat.format("<td>{0}</td> <td>",attr.getAttrName()));
|
||||||
|
stringBuilder.append(MessageFormat.format("<input class='layui-input' type='text' size='40' value={0} name=attr_{1}[] />",
|
||||||
|
goodsAttr.getAttrValue(),attr.getAttrId()));
|
||||||
|
|
||||||
|
stringBuilder.append("</td></tr>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
str = stringBuilder.toString();
|
||||||
|
|
||||||
|
|
||||||
|
return AjaxResult.success("success",str);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/ajaxGetSpecInput")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult ajaxGetSpecInput(@RequestBody String jsonStr){
|
||||||
|
|
||||||
|
SpecVO data=JSON.parseObject(jsonStr,SpecVO.class);
|
||||||
|
|
||||||
|
//Map<String,Object> map = (Map<String,Object>)jsonObject;
|
||||||
|
Map<String,List<Integer>> map2 = new HashMap<>();
|
||||||
|
//重新组合map有相同键值的组合成list
|
||||||
|
for (String str : data.getList()) {
|
||||||
|
Map<String,Object> map = (Map<String,Object>)JSONObject.parseObject(str);
|
||||||
|
String newKey = map.get("specId").toString();
|
||||||
|
String newValue = map.get("itemId").toString();
|
||||||
|
List<Integer> tmpList = new ArrayList<>();
|
||||||
|
if(map2.containsKey(newKey)){
|
||||||
|
tmpList = map2.get(newKey);
|
||||||
|
tmpList.add(Integer.parseInt(newValue));
|
||||||
|
map2.put(newKey,tmpList);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
tmpList.add(Integer.parseInt(newValue));
|
||||||
|
map2.put(newKey,tmpList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Iterator<Map.Entry<String, List<Integer>>> it = map2.entrySet().iterator();
|
||||||
|
|
||||||
|
Map<String, Integer> unsortMap =
|
||||||
|
new HashMap<String, Integer>();
|
||||||
|
|
||||||
|
//迭代map把原来值换成列表大小
|
||||||
|
while (it.hasNext()){
|
||||||
|
Map.Entry<String, List<Integer>> entry = it.next();
|
||||||
|
unsortMap.put(entry.getKey(),entry.getValue().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
//定义一个有序的列表map
|
||||||
|
Map<String, Integer> sortMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
//升序排序
|
||||||
|
Stream<Map.Entry<String, Integer>> st = unsortMap.entrySet().stream();
|
||||||
|
st.sorted(Comparator.comparing(e -> e.getValue()))
|
||||||
|
.forEachOrdered(e -> sortMap.put(e.getKey(), e.getValue()));
|
||||||
|
|
||||||
|
//根据排序后组合最终的MAP
|
||||||
|
Map<String, List<Integer>> finalMap = new LinkedHashMap<>();
|
||||||
|
for(String key : sortMap.keySet()){
|
||||||
|
finalMap.put(key,map2.get(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//列表笛卡儿积
|
||||||
|
ArrayList ls = new ArrayList();
|
||||||
|
for(List<Integer> value : finalMap.values()){
|
||||||
|
ls.add(value);
|
||||||
|
}
|
||||||
|
if(ls.isEmpty()) return AjaxResult.success("success","");
|
||||||
|
List Dlist = StringUtils.Dikaerji0(ls);
|
||||||
|
|
||||||
|
|
||||||
|
//todo 组合数据
|
||||||
|
String str = "<table class='table table-bordered' id='spec_input_tab'><tr>";;
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
stringBuilder.append(str);
|
||||||
|
|
||||||
|
for(String key : finalMap.keySet()){
|
||||||
|
StoreSpec storeSpec = storeSpecService
|
||||||
|
.selectStoreSpecById(Long.valueOf(key));
|
||||||
|
stringBuilder.append(MessageFormat.format("<td><b>{0}</b></td>",
|
||||||
|
storeSpec.getName()));
|
||||||
|
}
|
||||||
|
stringBuilder.append("<td><b>进货价</b></td><td><b>零售价</b></td><td><b>库存</b></td><td><b>操作</b></td></tr>");
|
||||||
|
|
||||||
|
|
||||||
|
//获取商品规格列表
|
||||||
|
StoreSpecGoodsPrice storeSpecGoodsPrice = new StoreSpecGoodsPrice();
|
||||||
|
storeSpecGoodsPrice.setGoodsId(Long.valueOf(data.getGoodsId()));
|
||||||
|
|
||||||
|
//开始迭代笛卡儿积
|
||||||
|
Iterator<ArrayList> iter = Dlist.iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
//System.out.println(iter.next());
|
||||||
|
List<String> itemName = new ArrayList<>();
|
||||||
|
stringBuilder.append("<tr>");
|
||||||
|
List<Integer> iterList = iter.next();
|
||||||
|
Collections.sort(iterList);
|
||||||
|
iterList.forEach(item-> {
|
||||||
|
StoreSpecItem storeSpecItem = storeSpecItemService
|
||||||
|
.selectStoreSpecItemById(Long.valueOf(item.toString()));
|
||||||
|
stringBuilder.append(MessageFormat.format("<td>{0}</td>",
|
||||||
|
storeSpecItem.getItem()));
|
||||||
|
StoreSpec storeSpec2 = storeSpecService
|
||||||
|
.selectStoreSpecById(Long.valueOf(storeSpecItem.getSpecId()));
|
||||||
|
|
||||||
|
itemName.add(storeSpec2.getName()+":"+storeSpecItem.getItem());
|
||||||
|
});
|
||||||
|
|
||||||
|
String itemKeyStr = org.apache.commons.lang.StringUtils.join(iterList.toArray(), "_");
|
||||||
|
String itemNameStr = org.apache.commons.lang.StringUtils.join(itemName.toArray(), ",");
|
||||||
|
//while (iter.next().forEach();)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
double keyPrice = 0;
|
||||||
|
double keyMarketPrice = 0;
|
||||||
|
int keyStoreCount = 0;
|
||||||
|
|
||||||
|
//获取商品规格价格列表
|
||||||
|
storeSpecGoodsPrice.setKey(itemKeyStr);
|
||||||
|
List<StoreSpecGoodsPrice> storeSpecGoodsPrices = storeSpecGoodsPriceService
|
||||||
|
.selectStoreSpecGoodsPriceList(storeSpecGoodsPrice);
|
||||||
|
|
||||||
|
|
||||||
|
//System.out.println(storeSpecGoodsPrices);
|
||||||
|
if(!storeSpecGoodsPrices.isEmpty()){
|
||||||
|
StoreSpecGoodsPrice goodsPrice = storeSpecGoodsPrices.get(0);
|
||||||
|
if(goodsPrice != null){
|
||||||
|
keyPrice = goodsPrice.getPrice();
|
||||||
|
keyMarketPrice = goodsPrice.getMarketPrice();
|
||||||
|
keyStoreCount = goodsPrice.getStoreCount().intValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(MessageFormat.format("<td><input name=item[{0}][price] value={1} /></td>",
|
||||||
|
itemKeyStr,String.valueOf(keyPrice)));
|
||||||
|
stringBuilder.append(MessageFormat.format("<td><input name=item[{0}][market_price] value={1} /></td>",
|
||||||
|
itemKeyStr,String.valueOf(keyMarketPrice)));
|
||||||
|
stringBuilder.append(MessageFormat.format("<td><input name=item[{0}][store_count] value={1} /></td>",
|
||||||
|
itemKeyStr,String.valueOf(keyStoreCount)));
|
||||||
|
stringBuilder.append(MessageFormat.format("<td>无<input type='hidden' name=item[{0}][key_name] value={1} /></td>",
|
||||||
|
itemKeyStr,itemNameStr));
|
||||||
|
stringBuilder.append("</tr>");
|
||||||
|
//System.out.println(storeSpecGoodsPrices);
|
||||||
|
|
||||||
|
}
|
||||||
|
stringBuilder.append("</table>");
|
||||||
|
|
||||||
|
//str = stringBuilder.toString();
|
||||||
|
return AjaxResult.success("success",stringBuilder.toString());
|
||||||
|
//return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/saveSpecAttr")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult saveSpecAttr(HttpServletRequest request){
|
||||||
|
//获取所有表单参数
|
||||||
|
Enumeration<String> paramNames = request.getParameterNames();
|
||||||
|
Map<String,Map<String,String>> specDataMap = new HashMap<>();
|
||||||
|
Map<String,String> attrDataMap = new HashMap<>();
|
||||||
|
Map<String,String> tmpMap = null;
|
||||||
|
String goodsId = request.getParameter("goodsId");
|
||||||
|
String goodsType = request.getParameter("type_id");
|
||||||
|
if(StringUtils.isEmpty(goodsId) || Integer.valueOf(goodsId) == 0){
|
||||||
|
return AjaxResult.error("参数有误");
|
||||||
|
}
|
||||||
|
if(StringUtils.isEmpty(goodsType) || Integer.valueOf(goodsType) == 0){
|
||||||
|
return AjaxResult.error("请选择模型");
|
||||||
|
}
|
||||||
|
//过滤参数
|
||||||
|
while (paramNames.hasMoreElements()) {
|
||||||
|
String name = paramNames.nextElement();
|
||||||
|
String[] values = request.getParameterValues(name);
|
||||||
|
if(values != null && values.length > 0){
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
builder.append(values[i]+" ");
|
||||||
|
}
|
||||||
|
//过滤规格组合新的规格数据集合
|
||||||
|
if(name.contains("item")){
|
||||||
|
String pattern = "item\\[(\\d+[_\\d+]*)]\\[([a-z]+_?[a-z]+)]";
|
||||||
|
//String pattern = "item\\[(\\d+_\\d+)]\\[([a-z]+_?[a-z]+)]";
|
||||||
|
Pattern r = Pattern.compile(pattern);
|
||||||
|
Matcher m = r.matcher(name);
|
||||||
|
if (m.find( )) {
|
||||||
|
String keyOne = m.group(1).trim();
|
||||||
|
System.out.println("keyOne:"+keyOne);
|
||||||
|
String keyTwo = m.group(2).trim();
|
||||||
|
System.out.println("keyTwo:"+keyTwo);
|
||||||
|
String keyValue = builder.toString().trim();
|
||||||
|
|
||||||
|
if(!specDataMap.containsKey(keyOne)){
|
||||||
|
tmpMap = new HashMap<>();
|
||||||
|
}
|
||||||
|
tmpMap.put(keyTwo,keyValue);
|
||||||
|
specDataMap.put(keyOne,tmpMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//过滤属性组合新的属性集合
|
||||||
|
if(name.contains("attr_")){
|
||||||
|
String pattern2= "attr_(\\d+)\\[]";
|
||||||
|
Pattern r2 = Pattern.compile(pattern2);
|
||||||
|
Matcher m2 = r2.matcher(name);
|
||||||
|
//System.out.println(name+" : "+builder.toString());
|
||||||
|
if (m2.find( )) {
|
||||||
|
attrDataMap.put(m2.group(1),builder.toString().trim());
|
||||||
|
}else{
|
||||||
|
System.out.println("no");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(specDataMap.isEmpty()){
|
||||||
|
return AjaxResult.error("请选择规格项目");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(attrDataMap.isEmpty()){
|
||||||
|
return AjaxResult.error("请填写商品属性");
|
||||||
|
}
|
||||||
|
|
||||||
|
storeGoodsService.saveSpecAttr(specDataMap,attrDataMap,goodsId,goodsType);
|
||||||
|
|
||||||
|
return AjaxResult.success("操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品主
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{goodsId}")
|
||||||
|
public String edit(@PathVariable("goodsId") Integer goodsId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
StoreGoods storeGoods = storeGoodsService.selectStoreGoodsById(goodsId);
|
||||||
|
StoreGoodsCate storeGoodsCate = storeGoodsCateService
|
||||||
|
.selectStoreGoodsCateById(storeGoods.getCateId());
|
||||||
|
storeGoods.setCateName(storeGoodsCate.getCateTitle());
|
||||||
|
mmap.put("storeGoods", storeGoods);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存商品主
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:goods:edit")
|
||||||
|
@Log(title = "商品主", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(StoreGoods storeGoods)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsService.updateStoreGoods(storeGoods));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品主
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:goods:remove")
|
||||||
|
@Log(title = "商品主", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsService.deleteStoreGoodsByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping( "/changeStatus")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult changeStatus(StoreGoods storeGoods){
|
||||||
|
return toAjax(storeGoodsService.updateStoreGoods(storeGoods));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package co.yixiang.web.controller.shop;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.shop.domain.StoreGoodsType;
|
||||||
|
import co.yixiang.shop.service.IStoreGoodsTypeService;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品类型(商品模型)Controller
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2019-08-24
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/shop/type")
|
||||||
|
public class StoreGoodsTypeController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "shop/type";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreGoodsTypeService storeGoodsTypeService;
|
||||||
|
|
||||||
|
@RequiresPermissions("shop:type:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String type()
|
||||||
|
{
|
||||||
|
return prefix + "/type";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品类型(商品模型)列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:type:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(StoreGoodsType storeGoodsType)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<StoreGoodsType> list = storeGoodsTypeService.selectStoreGoodsTypeList(storeGoodsType);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出商品类型(商品模型)列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:type:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(StoreGoodsType storeGoodsType)
|
||||||
|
{
|
||||||
|
List<StoreGoodsType> list = storeGoodsTypeService.selectStoreGoodsTypeList(storeGoodsType);
|
||||||
|
ExcelUtil<StoreGoodsType> util = new ExcelUtil<StoreGoodsType>(StoreGoodsType.class);
|
||||||
|
return util.exportExcel(list, "type");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商品类型(商品模型)
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存商品类型(商品模型)
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:type:add")
|
||||||
|
@Log(title = "商品类型(商品模型)", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(StoreGoodsType storeGoodsType)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsTypeService.insertStoreGoodsType(storeGoodsType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品类型(商品模型)
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
StoreGoodsType storeGoodsType = storeGoodsTypeService.selectStoreGoodsTypeById(id);
|
||||||
|
mmap.put("storeGoodsType", storeGoodsType);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存商品类型(商品模型)
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:type:edit")
|
||||||
|
@Log(title = "商品类型(商品模型)", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(StoreGoodsType storeGoodsType)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsTypeService.updateStoreGoodsType(storeGoodsType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品类型(商品模型)
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:type:remove")
|
||||||
|
@Log(title = "商品类型(商品模型)", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(storeGoodsTypeService.deleteStoreGoodsTypeByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package co.yixiang.web.controller.shop;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.shop.domain.StoreMember;
|
||||||
|
import co.yixiang.shop.service.IStoreMemberService;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城会员信息Controller
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2019-08-30
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/shop/member")
|
||||||
|
public class StoreMemberController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "shop/member";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreMemberService storeMemberService;
|
||||||
|
|
||||||
|
@RequiresPermissions("shop:member:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String member()
|
||||||
|
{
|
||||||
|
return prefix + "/member";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商城会员信息列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:member:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(StoreMember storeMember)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<StoreMember> list = storeMemberService.selectStoreMemberList(storeMember);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出商城会员信息列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:member:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(StoreMember storeMember)
|
||||||
|
{
|
||||||
|
List<StoreMember> list = storeMemberService.selectStoreMemberList(storeMember);
|
||||||
|
ExcelUtil<StoreMember> util = new ExcelUtil<StoreMember>(StoreMember.class);
|
||||||
|
return util.exportExcel(list, "member");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商城会员信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存商城会员信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:member:add")
|
||||||
|
@Log(title = "商城会员信息", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(StoreMember storeMember)
|
||||||
|
{
|
||||||
|
return toAjax(storeMemberService.insertStoreMember(storeMember));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商城会员信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
StoreMember storeMember = storeMemberService.selectStoreMemberById(id);
|
||||||
|
mmap.put("storeMember", storeMember);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存商城会员信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:member:edit")
|
||||||
|
@Log(title = "商城会员信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(StoreMember storeMember)
|
||||||
|
{
|
||||||
|
return toAjax(storeMemberService.updateStoreMember(storeMember));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商城会员信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:member:remove")
|
||||||
|
@Log(title = "商城会员信息", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(storeMemberService.deleteStoreMemberByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
package co.yixiang.web.controller.shop;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.shop.domain.StoreOrder;
|
||||||
|
import co.yixiang.shop.service.IStoreOrderService;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单主Controller
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2019-08-29
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/shop/order")
|
||||||
|
public class StoreOrderController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "shop/order";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreOrderService storeOrderService;
|
||||||
|
|
||||||
|
@RequiresPermissions("shop:order:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String order()
|
||||||
|
{
|
||||||
|
return prefix + "/order";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单主列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:order:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(StoreOrder storeOrder)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
if(storeOrder.getOrderStatus() != null){
|
||||||
|
switch (storeOrder.getOrderStatus()){
|
||||||
|
case -1:
|
||||||
|
storeOrder.setDeleted(1);
|
||||||
|
storeOrder.setOrderStatus(0);
|
||||||
|
storeOrder.setPayStatus(0);
|
||||||
|
storeOrder.setShippingStatus(0);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
storeOrder.setDeleted(0);
|
||||||
|
storeOrder.setOrderStatus(0);
|
||||||
|
storeOrder.setPayStatus(0);
|
||||||
|
storeOrder.setShippingStatus(0);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
storeOrder.setDeleted(0);
|
||||||
|
storeOrder.setPayStatus(1);
|
||||||
|
storeOrder.setOrderStatus(0);
|
||||||
|
storeOrder.setShippingStatus(0);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
storeOrder.setDeleted(0);
|
||||||
|
storeOrder.setPayStatus(1);
|
||||||
|
storeOrder.setOrderStatus(0);
|
||||||
|
storeOrder.setShippingStatus(1);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
storeOrder.setDeleted(0);
|
||||||
|
storeOrder.setPayStatus(1);
|
||||||
|
storeOrder.setOrderStatus(0);
|
||||||
|
storeOrder.setShippingStatus(2);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
storeOrder.setDeleted(0);
|
||||||
|
storeOrder.setPayStatus(1);
|
||||||
|
storeOrder.setOrderStatus(0);
|
||||||
|
storeOrder.setShippingStatus(3);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
storeOrder.setDeleted(0);
|
||||||
|
storeOrder.setPayStatus(1);
|
||||||
|
storeOrder.setOrderStatus(1);
|
||||||
|
storeOrder.setShippingStatus(0);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
storeOrder.setDeleted(0);
|
||||||
|
storeOrder.setPayStatus(1);
|
||||||
|
storeOrder.setOrderStatus(2);
|
||||||
|
storeOrder.setShippingStatus(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//System.out.println(storeOrder);
|
||||||
|
List<StoreOrder> list = storeOrderService.selectStoreOrderList(storeOrder);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出订单主列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:order:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(StoreOrder storeOrder)
|
||||||
|
{
|
||||||
|
List<StoreOrder> list = storeOrderService.selectStoreOrderList(storeOrder);
|
||||||
|
ExcelUtil<StoreOrder> util = new ExcelUtil<StoreOrder>(StoreOrder.class);
|
||||||
|
return util.exportExcel(list, "order");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增订单主
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存订单主
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:order:add")
|
||||||
|
@Log(title = "订单主", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(StoreOrder storeOrder)
|
||||||
|
{
|
||||||
|
return toAjax(storeOrderService.insertStoreOrder(storeOrder));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单主
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{orderId}")
|
||||||
|
public String edit(@PathVariable("orderId") Integer orderId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
StoreOrder storeOrder = storeOrderService.selectStoreOrderById(orderId);
|
||||||
|
mmap.put("storeOrder", storeOrder);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存订单主
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:order:edit")
|
||||||
|
@Log(title = "订单主", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated StoreOrder storeOrder)
|
||||||
|
{
|
||||||
|
return toAjax(storeOrderService.updateStoreOrder(storeOrder));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除订单主
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:order:remove")
|
||||||
|
@Log(title = "订单主", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(storeOrderService.deleteStoreOrderByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package co.yixiang.web.controller.shop;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.shop.domain.StoreSpec;
|
||||||
|
import co.yixiang.shop.service.IStoreSpecService;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格(独立)Controller
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2019-08-25
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/shop/spec")
|
||||||
|
public class StoreSpecController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "shop/spec";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStoreSpecService storeSpecService;
|
||||||
|
|
||||||
|
@RequiresPermissions("shop:spec:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String spec()
|
||||||
|
{
|
||||||
|
return prefix + "/spec";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品规格(独立)列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:spec:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(StoreSpec storeSpec)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<StoreSpec> list = storeSpecService.selectStoreSpecList(storeSpec);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出商品规格(独立)列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:spec:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(StoreSpec storeSpec)
|
||||||
|
{
|
||||||
|
List<StoreSpec> list = storeSpecService.selectStoreSpecList(storeSpec);
|
||||||
|
ExcelUtil<StoreSpec> util = new ExcelUtil<StoreSpec>(StoreSpec.class);
|
||||||
|
return util.exportExcel(list, "spec");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商品规格(独立)
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存商品规格(独立)
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:spec:add")
|
||||||
|
@Log(title = "商品规格(独立)", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(StoreSpec storeSpec)
|
||||||
|
{
|
||||||
|
return toAjax(storeSpecService.insertStoreSpec(storeSpec));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品规格(独立)
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
StoreSpec storeSpec = storeSpecService.selectStoreSpecById(id);
|
||||||
|
mmap.put("storeSpec", storeSpec);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存商品规格(独立)
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:spec:edit")
|
||||||
|
@Log(title = "商品规格(独立)", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(StoreSpec storeSpec)
|
||||||
|
{
|
||||||
|
return toAjax(storeSpecService.updateStoreSpec(storeSpec));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品规格(独立)
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("shop:spec:remove")
|
||||||
|
@Log(title = "商品规格(独立)", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(storeSpecService.deleteStoreSpecByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import com.google.code.kaptcha.Constants;
|
||||||
|
import com.google.code.kaptcha.Producer;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片验证码(支持算术形式)
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/captcha")
|
||||||
|
public class SysCaptchaController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource(name = "captchaProducer")
|
||||||
|
private Producer captchaProducer;
|
||||||
|
|
||||||
|
@Resource(name = "captchaProducerMath")
|
||||||
|
private Producer captchaProducerMath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证码生成
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/captchaImage")
|
||||||
|
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
{
|
||||||
|
ServletOutputStream out = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
response.setDateHeader("Expires", 0);
|
||||||
|
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
||||||
|
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
|
||||||
|
response.setHeader("Pragma", "no-cache");
|
||||||
|
response.setContentType("image/jpeg");
|
||||||
|
|
||||||
|
String type = request.getParameter("type");
|
||||||
|
String capStr = null;
|
||||||
|
String code = null;
|
||||||
|
BufferedImage bi = null;
|
||||||
|
if ("math".equals(type))
|
||||||
|
{
|
||||||
|
String capText = captchaProducerMath.createText();
|
||||||
|
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||||
|
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||||
|
bi = captchaProducerMath.createImage(capStr);
|
||||||
|
}
|
||||||
|
else if ("char".equals(type))
|
||||||
|
{
|
||||||
|
capStr = code = captchaProducer.createText();
|
||||||
|
bi = captchaProducer.createImage(capStr);
|
||||||
|
}
|
||||||
|
session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);
|
||||||
|
out = response.getOutputStream();
|
||||||
|
ImageIO.write(bi, "jpg", out);
|
||||||
|
out.flush();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (out != null)
|
||||||
|
{
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import co.yixiang.system.service.ISysConfigService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.constant.UserConstants;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.utils.ShiroUtils;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.system.domain.SysConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数配置 信息操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/config")
|
||||||
|
public class SysConfigController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/config";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:config:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String config()
|
||||||
|
{
|
||||||
|
return prefix + "/config";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询参数配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysConfig config)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:config:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysConfig config)
|
||||||
|
{
|
||||||
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
|
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||||
|
return util.exportExcel(list, "参数数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增参数配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:add")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysConfig config)
|
||||||
|
{
|
||||||
|
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||||
|
{
|
||||||
|
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
|
}
|
||||||
|
config.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(configService.insertConfig(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改参数配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{configId}")
|
||||||
|
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("config", configService.selectConfigById(configId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:edit")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysConfig config)
|
||||||
|
{
|
||||||
|
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||||
|
{
|
||||||
|
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
|
}
|
||||||
|
config.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(configService.updateConfig(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:remove")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
configService.deleteConfigByIds(ids);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新参数缓存
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:config:remove")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||||
|
@GetMapping("/refreshCache")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult refreshCache()
|
||||||
|
{
|
||||||
|
configService.resetConfigCache();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验参数键名
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkConfigKeyUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkConfigKeyUnique(SysConfig config)
|
||||||
|
{
|
||||||
|
return configService.checkConfigKeyUnique(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import co.yixiang.system.service.ISysDeptService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.constant.UserConstants;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.domain.Ztree;
|
||||||
|
import co.yixiang.common.core.domain.entity.SysDept;
|
||||||
|
import co.yixiang.common.core.domain.entity.SysRole;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.utils.ShiroUtils;
|
||||||
|
import co.yixiang.common.utils.StringUtils;
|
||||||
|
import co.yixiang.system.service.ISysDeptService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/dept")
|
||||||
|
public class SysDeptController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/dept";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dept:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String dept()
|
||||||
|
{
|
||||||
|
return prefix + "/dept";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dept:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public List<SysDept> list(SysDept dept)
|
||||||
|
{
|
||||||
|
List<SysDept> deptList = deptService.selectDeptList(dept);
|
||||||
|
return deptList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增部门
|
||||||
|
*/
|
||||||
|
@GetMapping("/add/{parentId}")
|
||||||
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
if (!ShiroUtils.getSysUser().isAdmin())
|
||||||
|
{
|
||||||
|
parentId = ShiroUtils.getSysUser().getDeptId();
|
||||||
|
}
|
||||||
|
mmap.put("dept", deptService.selectDeptById(parentId));
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存部门
|
||||||
|
*/
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("system:dept:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysDept dept)
|
||||||
|
{
|
||||||
|
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||||
|
{
|
||||||
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
|
}
|
||||||
|
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(deptService.insertDept(dept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{deptId}")
|
||||||
|
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysDept dept = deptService.selectDeptById(deptId);
|
||||||
|
if (StringUtils.isNotNull(dept) && 100L == deptId)
|
||||||
|
{
|
||||||
|
dept.setParentName("无");
|
||||||
|
}
|
||||||
|
mmap.put("dept", dept);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*/
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:dept:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysDept dept)
|
||||||
|
{
|
||||||
|
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||||
|
{
|
||||||
|
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
|
}
|
||||||
|
else if (dept.getParentId().equals(dept.getDeptId()))
|
||||||
|
{
|
||||||
|
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
|
}
|
||||||
|
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||||
|
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
|
||||||
|
{
|
||||||
|
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||||
|
}
|
||||||
|
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(deptService.updateDept(dept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("system:dept:remove")
|
||||||
|
@GetMapping("/remove/{deptId}")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
||||||
|
{
|
||||||
|
if (deptService.selectDeptCount(deptId) > 0)
|
||||||
|
{
|
||||||
|
return AjaxResult.warn("存在下级部门,不允许删除");
|
||||||
|
}
|
||||||
|
if (deptService.checkDeptExistUser(deptId))
|
||||||
|
{
|
||||||
|
return AjaxResult.warn("部门存在用户,不允许删除");
|
||||||
|
}
|
||||||
|
return toAjax(deptService.deleteDeptById(deptId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验部门名称
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkDeptNameUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkDeptNameUnique(SysDept dept)
|
||||||
|
{
|
||||||
|
return deptService.checkDeptNameUnique(dept);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择部门树
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @param excludeId 排除ID
|
||||||
|
*/
|
||||||
|
@GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" })
|
||||||
|
public String selectDeptTree(@PathVariable("deptId") Long deptId,
|
||||||
|
@PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dept", deptService.selectDeptById(deptId));
|
||||||
|
mmap.put("excludeId", excludeId);
|
||||||
|
return prefix + "/tree";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载部门列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> treeData()
|
||||||
|
{
|
||||||
|
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载部门列表树(排除下级)
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeData/{excludeId}")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
|
||||||
|
{
|
||||||
|
SysDept dept = new SysDept();
|
||||||
|
dept.setDeptId(excludeId);
|
||||||
|
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载角色部门(数据权限)列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/roleDeptTreeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> deptTreeData(SysRole role)
|
||||||
|
{
|
||||||
|
List<Ztree> ztrees = deptService.roleDeptTreeData(role);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import co.yixiang.system.service.ISysDictDataService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.domain.entity.SysDictData;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.utils.ShiroUtils;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.system.service.ISysDictDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据字典信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/dict/data")
|
||||||
|
public class SysDictDataController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/dict/data";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictDataService dictDataService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dict:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String dictData()
|
||||||
|
{
|
||||||
|
return prefix + "/data";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
@RequiresPermissions("system:dict:list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysDictData dictData)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:dict:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysDictData dictData)
|
||||||
|
{
|
||||||
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
|
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||||
|
return util.exportExcel(list, "字典数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@GetMapping("/add/{dictType}")
|
||||||
|
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dictType", dictType);
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存字典类型
|
||||||
|
*/
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("system:dict:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysDictData dict)
|
||||||
|
{
|
||||||
|
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典类型
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{dictCode}")
|
||||||
|
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典类型
|
||||||
|
*/
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:dict:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysDictData dict)
|
||||||
|
{
|
||||||
|
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("system:dict:remove")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
dictDataService.deleteDictDataByIds(ids);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import co.yixiang.system.service.ISysDictTypeService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.constant.UserConstants;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.domain.Ztree;
|
||||||
|
import co.yixiang.common.core.domain.entity.SysDictType;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.utils.ShiroUtils;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据字典信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/dict")
|
||||||
|
public class SysDictTypeController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/dict/type";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dict:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String dictType()
|
||||||
|
{
|
||||||
|
return prefix + "/type";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
@RequiresPermissions("system:dict:list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysDictType dictType)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:dict:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysDictType dictType)
|
||||||
|
{
|
||||||
|
|
||||||
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
|
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||||
|
return util.exportExcel(list, "字典类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存字典类型
|
||||||
|
*/
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("system:dict:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysDictType dict)
|
||||||
|
{
|
||||||
|
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||||
|
{
|
||||||
|
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
|
}
|
||||||
|
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(dictTypeService.insertDictType(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典类型
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{dictId}")
|
||||||
|
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典类型
|
||||||
|
*/
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:dict:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysDictType dict)
|
||||||
|
{
|
||||||
|
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||||
|
{
|
||||||
|
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
|
}
|
||||||
|
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(dictTypeService.updateDictType(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("system:dict:remove")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
dictTypeService.deleteDictTypeByIds(ids);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新字典缓存
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:remove")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
|
@GetMapping("/refreshCache")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult refreshCache()
|
||||||
|
{
|
||||||
|
dictTypeService.resetDictCache();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典详细
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dict:list")
|
||||||
|
@GetMapping("/detail/{dictId}")
|
||||||
|
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||||
|
mmap.put("dictList", dictTypeService.selectDictTypeAll());
|
||||||
|
return "system/dict/data/data";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典类型
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkDictTypeUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkDictTypeUnique(SysDictType dictType)
|
||||||
|
{
|
||||||
|
return dictTypeService.checkDictTypeUnique(dictType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择字典树
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectDictTree/{columnId}/{dictType}")
|
||||||
|
public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
|
||||||
|
ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("columnId", columnId);
|
||||||
|
mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
|
||||||
|
return prefix + "/tree";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载字典列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> treeData()
|
||||||
|
{
|
||||||
|
List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType());
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import co.yixiang.system.service.ISysConfigService;
|
||||||
|
import co.yixiang.system.service.ISysMenuService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.config.RuoYiConfig;
|
||||||
|
import co.yixiang.common.constant.ShiroConstants;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.domain.entity.SysMenu;
|
||||||
|
import co.yixiang.common.core.domain.entity.SysUser;
|
||||||
|
import co.yixiang.common.core.text.Convert;
|
||||||
|
import co.yixiang.common.utils.CookieUtils;
|
||||||
|
import co.yixiang.common.utils.DateUtils;
|
||||||
|
import co.yixiang.common.utils.ServletUtils;
|
||||||
|
import co.yixiang.common.utils.ShiroUtils;
|
||||||
|
import co.yixiang.common.utils.StringUtils;
|
||||||
|
import co.yixiang.framework.shiro.service.SysPasswordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页 业务处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class SysIndexController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
// 系统首页
|
||||||
|
@GetMapping("/index")
|
||||||
|
public String index(ModelMap mmap)
|
||||||
|
{
|
||||||
|
// 取身份信息
|
||||||
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
|
// 根据用户id取出菜单
|
||||||
|
List<SysMenu> menus = menuService.selectMenusByUser(user);
|
||||||
|
mmap.put("menus", menus);
|
||||||
|
mmap.put("user", user);
|
||||||
|
mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
|
||||||
|
mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
|
||||||
|
mmap.put("ignoreFooter", configService.selectConfigByKey("sys.index.ignoreFooter"));
|
||||||
|
mmap.put("copyrightYear", RuoYiConfig.getCopyrightYear());
|
||||||
|
mmap.put("demoEnabled", RuoYiConfig.isDemoEnabled());
|
||||||
|
mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
||||||
|
mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
||||||
|
|
||||||
|
// 菜单导航显示风格
|
||||||
|
String menuStyle = configService.selectConfigByKey("sys.index.menuStyle");
|
||||||
|
// 移动端,默认使左侧导航菜单,否则取默认配置
|
||||||
|
String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle;
|
||||||
|
|
||||||
|
// 优先Cookie配置导航菜单
|
||||||
|
Cookie[] cookies = ServletUtils.getRequest().getCookies();
|
||||||
|
for (Cookie cookie : cookies)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName()))
|
||||||
|
{
|
||||||
|
indexStyle = cookie.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String webIndex = "topnav".equalsIgnoreCase(indexStyle) ? "index-topnav" : "index";
|
||||||
|
return webIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 锁定屏幕
|
||||||
|
@GetMapping("/lockscreen")
|
||||||
|
public String lockscreen(ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("user", ShiroUtils.getSysUser());
|
||||||
|
ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true);
|
||||||
|
return "lock";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解锁屏幕
|
||||||
|
@PostMapping("/unlockscreen")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult unlockscreen(String password)
|
||||||
|
{
|
||||||
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
|
if (StringUtils.isNull(user))
|
||||||
|
{
|
||||||
|
return AjaxResult.error("服务器超时,请重新登陆");
|
||||||
|
}
|
||||||
|
if (passwordService.matches(user, password))
|
||||||
|
{
|
||||||
|
ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
return AjaxResult.error("密码不正确,请重新输入。");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换主题
|
||||||
|
@GetMapping("/system/switchSkin")
|
||||||
|
public String switchSkin()
|
||||||
|
{
|
||||||
|
return "skin";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换菜单
|
||||||
|
@GetMapping("/system/menuStyle/{style}")
|
||||||
|
public void menuStyle(@PathVariable String style, HttpServletResponse response)
|
||||||
|
{
|
||||||
|
CookieUtils.setCookie(response, "nav-style", style);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 系统介绍
|
||||||
|
@GetMapping("/system/main")
|
||||||
|
public String main(ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("version", RuoYiConfig.getVersion());
|
||||||
|
return "main2";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查初始密码是否提醒修改
|
||||||
|
public boolean initPasswordIsModify(Date pwdUpdateDate)
|
||||||
|
{
|
||||||
|
Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify"));
|
||||||
|
return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查密码是否过期
|
||||||
|
public boolean passwordIsExpiration(Date pwdUpdateDate)
|
||||||
|
{
|
||||||
|
Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays"));
|
||||||
|
if (passwordValidateDays != null && passwordValidateDays > 0)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNull(pwdUpdateDate))
|
||||||
|
{
|
||||||
|
// 如果从未修改过初始密码,直接提醒过期
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Date nowDate = DateUtils.getNowDate();
|
||||||
|
return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
|
import org.apache.shiro.subject.Subject;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.utils.ServletUtils;
|
||||||
|
import co.yixiang.common.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录验证
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class SysLoginController extends BaseController
|
||||||
|
{
|
||||||
|
@GetMapping("/login")
|
||||||
|
public String login(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
{
|
||||||
|
// 如果是Ajax请求,返回Json字符串。
|
||||||
|
if (ServletUtils.isAjaxRequest(request))
|
||||||
|
{
|
||||||
|
return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return "login";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/login")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe)
|
||||||
|
{
|
||||||
|
UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);
|
||||||
|
Subject subject = SecurityUtils.getSubject();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
subject.login(token);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
catch (AuthenticationException e)
|
||||||
|
{
|
||||||
|
String msg = "用户或密码错误";
|
||||||
|
if (StringUtils.isNotEmpty(e.getMessage()))
|
||||||
|
{
|
||||||
|
msg = e.getMessage();
|
||||||
|
}
|
||||||
|
return error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/unauth")
|
||||||
|
public String unauth()
|
||||||
|
{
|
||||||
|
return "error/unauth";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import co.yixiang.system.service.ISysMenuService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.constant.UserConstants;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.domain.Ztree;
|
||||||
|
import co.yixiang.common.core.domain.entity.SysMenu;
|
||||||
|
import co.yixiang.common.core.domain.entity.SysRole;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.utils.ShiroUtils;
|
||||||
|
import co.yixiang.framework.shiro.util.AuthorizationUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/menu")
|
||||||
|
public class SysMenuController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/menu";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:menu:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String menu()
|
||||||
|
{
|
||||||
|
return prefix + "/menu";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:menu:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public List<SysMenu> list(SysMenu menu)
|
||||||
|
{
|
||||||
|
Long userId = ShiroUtils.getUserId();
|
||||||
|
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
|
||||||
|
return menuList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除菜单
|
||||||
|
*/
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("system:menu:remove")
|
||||||
|
@GetMapping("/remove/{menuId}")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||||
|
{
|
||||||
|
if (menuService.selectCountMenuByParentId(menuId) > 0)
|
||||||
|
{
|
||||||
|
return AjaxResult.warn("存在子菜单,不允许删除");
|
||||||
|
}
|
||||||
|
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
|
||||||
|
{
|
||||||
|
return AjaxResult.warn("菜单已分配,不允许删除");
|
||||||
|
}
|
||||||
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
return toAjax(menuService.deleteMenuById(menuId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@GetMapping("/add/{parentId}")
|
||||||
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysMenu menu = null;
|
||||||
|
if (0L != parentId)
|
||||||
|
{
|
||||||
|
menu = menuService.selectMenuById(parentId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu = new SysMenu();
|
||||||
|
menu.setMenuId(0L);
|
||||||
|
menu.setMenuName("主目录");
|
||||||
|
}
|
||||||
|
mmap.put("menu", menu);
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存菜单
|
||||||
|
*/
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("system:menu:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysMenu menu)
|
||||||
|
{
|
||||||
|
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||||
|
{
|
||||||
|
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
|
}
|
||||||
|
menu.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
return toAjax(menuService.insertMenu(menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改菜单
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{menuId}")
|
||||||
|
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存菜单
|
||||||
|
*/
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("system:menu:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysMenu menu)
|
||||||
|
{
|
||||||
|
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||||
|
{
|
||||||
|
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
|
}
|
||||||
|
menu.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
return toAjax(menuService.updateMenu(menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择菜单图标
|
||||||
|
*/
|
||||||
|
@GetMapping("/icon")
|
||||||
|
public String icon()
|
||||||
|
{
|
||||||
|
return prefix + "/icon";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验菜单名称
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkMenuNameUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkMenuNameUnique(SysMenu menu)
|
||||||
|
{
|
||||||
|
return menuService.checkMenuNameUnique(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载角色菜单列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/roleMenuTreeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> roleMenuTreeData(SysRole role)
|
||||||
|
{
|
||||||
|
Long userId = ShiroUtils.getUserId();
|
||||||
|
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载所有菜单列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/menuTreeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> menuTreeData()
|
||||||
|
{
|
||||||
|
Long userId = ShiroUtils.getUserId();
|
||||||
|
List<Ztree> ztrees = menuService.menuTreeData(userId);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择菜单树
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectMenuTree/{menuId}")
|
||||||
|
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||||
|
return prefix + "/tree";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.utils.ShiroUtils;
|
||||||
|
import co.yixiang.system.domain.SysNotice;
|
||||||
|
import co.yixiang.system.service.ISysNoticeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告 信息操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/notice")
|
||||||
|
public class SysNoticeController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/notice";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysNoticeService noticeService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:notice:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String notice()
|
||||||
|
{
|
||||||
|
return prefix + "/notice";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公告列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:notice:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysNotice notice)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增公告
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存公告
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:notice:add")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(SysNotice notice)
|
||||||
|
{
|
||||||
|
notice.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改公告
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{noticeId}")
|
||||||
|
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存公告
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:notice:edit")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(SysNotice notice)
|
||||||
|
{
|
||||||
|
notice.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除公告
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:notice:remove")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(noticeService.deleteNoticeByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.constant.UserConstants;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.page.TableDataInfo;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.utils.ShiroUtils;
|
||||||
|
import co.yixiang.common.utils.poi.ExcelUtil;
|
||||||
|
import co.yixiang.system.domain.SysPost;
|
||||||
|
import co.yixiang.system.service.ISysPostService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位信息操作处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/post")
|
||||||
|
public class SysPostController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "system/post";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysPostService postService;
|
||||||
|
|
||||||
|
@RequiresPermissions("system:post:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String operlog()
|
||||||
|
{
|
||||||
|
return prefix + "/post";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:post:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(SysPost post)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:post:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(SysPost post)
|
||||||
|
{
|
||||||
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
|
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||||
|
return util.exportExcel(list, "岗位数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:post:remove")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return toAjax(postService.deletePostByIds(ids));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增岗位
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存岗位
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:post:add")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(@Validated SysPost post)
|
||||||
|
{
|
||||||
|
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||||
|
{
|
||||||
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
|
}
|
||||||
|
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||||
|
{
|
||||||
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
|
}
|
||||||
|
post.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(postService.insertPost(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改岗位
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{postId}")
|
||||||
|
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("post", postService.selectPostById(postId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存岗位
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:post:edit")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(@Validated SysPost post)
|
||||||
|
{
|
||||||
|
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||||
|
{
|
||||||
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
|
}
|
||||||
|
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||||
|
{
|
||||||
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
|
}
|
||||||
|
post.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(postService.updatePost(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验岗位名称
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkPostNameUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkPostNameUnique(SysPost post)
|
||||||
|
{
|
||||||
|
return postService.checkPostNameUnique(post);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验岗位编码
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkPostCodeUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkPostCodeUnique(SysPost post)
|
||||||
|
{
|
||||||
|
return postService.checkPostCodeUnique(post);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package co.yixiang.web.controller.system;
|
||||||
|
|
||||||
|
import co.yixiang.system.service.ISysUserService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import co.yixiang.common.annotation.Log;
|
||||||
|
import co.yixiang.common.config.RuoYiConfig;
|
||||||
|
import co.yixiang.common.constant.UserConstants;
|
||||||
|
import co.yixiang.common.core.controller.BaseController;
|
||||||
|
import co.yixiang.common.core.domain.AjaxResult;
|
||||||
|
import co.yixiang.common.core.domain.entity.SysUser;
|
||||||
|
import co.yixiang.common.enums.BusinessType;
|
||||||
|
import co.yixiang.common.utils.DateUtils;
|
||||||
|
import co.yixiang.common.utils.ShiroUtils;
|
||||||
|
import co.yixiang.common.utils.StringUtils;
|
||||||
|
import co.yixiang.common.utils.file.FileUploadUtils;
|
||||||
|
import co.yixiang.framework.shiro.service.SysPasswordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息 业务处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/system/user/profile")
|
||||||
|
public class SysProfileController extends BaseController
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
||||||
|
|
||||||
|
private String prefix = "system/user/profile";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息
|
||||||
|
*/
|
||||||
|
@GetMapping()
|
||||||
|
public String profile(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
|
mmap.put("user", user);
|
||||||
|
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
||||||
|
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
|
||||||
|
return prefix + "/profile";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/checkPassword")
|
||||||
|
@ResponseBody
|
||||||
|
public boolean checkPassword(String password)
|
||||||
|
{
|
||||||
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
|
if (passwordService.matches(user, password))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/resetPwd")
|
||||||
|
public String resetPwd(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
|
return prefix + "/resetPwd";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/resetPwd")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult resetPwd(String oldPassword, String newPassword)
|
||||||
|
{
|
||||||
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
|
if (!passwordService.matches(user, oldPassword))
|
||||||
|
{
|
||||||
|
return error("修改密码失败,旧密码错误");
|
||||||
|
}
|
||||||
|
if (passwordService.matches(user, newPassword))
|
||||||
|
{
|
||||||
|
return error("新密码不能与旧密码相同");
|
||||||
|
}
|
||||||
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
||||||
|
user.setPwdUpdateDate(DateUtils.getNowDate());
|
||||||
|
if (userService.resetUserPwd(user) > 0)
|
||||||
|
{
|
||||||
|
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error("修改密码异常,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit")
|
||||||
|
public String edit(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改头像
|
||||||
|
*/
|
||||||
|
@GetMapping("/avatar")
|
||||||
|
public String avatar(ModelMap mmap)
|
||||||
|
{
|
||||||
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
|
return prefix + "/avatar";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/update")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult update(SysUser user)
|
||||||
|
{
|
||||||
|
SysUser currentUser = ShiroUtils.getSysUser();
|
||||||
|
currentUser.setUserName(user.getUserName());
|
||||||
|
currentUser.setEmail(user.getEmail());
|
||||||
|
currentUser.setPhonenumber(user.getPhonenumber());
|
||||||
|
currentUser.setSex(user.getSex());
|
||||||
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
|
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(currentUser)))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + currentUser.getLoginName() + "'失败,手机号码已存在");
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
|
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(currentUser)))
|
||||||
|
{
|
||||||
|
return error("修改用户'" + currentUser.getLoginName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
if (userService.updateUserInfo(currentUser) > 0)
|
||||||
|
{
|
||||||
|
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存头像
|
||||||
|
*/
|
||||||
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/updateAvatar")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
|
||||||
|
{
|
||||||
|
SysUser currentUser = ShiroUtils.getSysUser();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!file.isEmpty())
|
||||||
|
{
|
||||||
|
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
|
||||||
|
currentUser.setAvatar(avatar);
|
||||||
|
if (userService.updateUserInfo(currentUser) > 0)
|
||||||
|
{
|
||||||
|
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("修改头像失败!", e);
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||