修改了微信sdk包的引用方式
commit
30fdb67273
|
|
@ -0,0 +1,45 @@
|
|||
######################################################################
|
||||
# Build Tools
|
||||
|
||||
.gradle
|
||||
/build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
######################################################################
|
||||
# IDE
|
||||
|
||||
### 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
|
||||
*.swp
|
||||
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
||||
/logs/
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="test#1" type="HttpClient.HttpRequestRunConfigurationType" factoryName="HTTP Request" path="$PROJECT_DIR$/ruoyi-segchk-web/src/main/resources/test.http" runType="Run single request">
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 RuoYi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
## 平台简介
|
||||
|
||||
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
||||
|
||||
* 前端采用Vue、Element UI。
|
||||
* 后端采用Spring Boot、Spring Security、Redis & Jwt。
|
||||
* 权限认证使用Jwt,支持多终端认证系统。
|
||||
* 支持加载动态权限菜单,多方式轻松权限控制。
|
||||
* 高效率开发,使用代码生成器可以一键生成前后端代码。
|
||||
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
|
||||
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
|
||||
* 特别鸣谢:[element](https://github.com/ElemeFE/element),[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://github.com/elunez/eladmin-web)。
|
||||
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)
|
||||
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)
|
||||
|
||||
## 内置功能
|
||||
|
||||
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
|
||||
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
|
||||
3. 岗位管理:配置系统用户所属担任职务。
|
||||
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
|
||||
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
|
||||
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
|
||||
7. 参数管理:对系统动态配置常用参数。
|
||||
8. 通知公告:系统通知公告信息发布维护。
|
||||
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
|
||||
10. 登录日志:系统登录日志记录查询包含登录异常。
|
||||
11. 在线用户:当前系统中活跃用户状态监控。
|
||||
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
|
||||
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
|
||||
14. 系统接口:根据业务代码自动生成相关的api接口文档。
|
||||
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
|
||||
16. 缓存监控:对系统的缓存信息查询,命令统计等。
|
||||
17. 在线构建器:拖动表单元素生成相应的HTML代码。
|
||||
18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
|
||||
|
||||
## 在线体验
|
||||
|
||||
- admin/admin123
|
||||
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
|
||||
|
||||
演示地址:http://vue.ruoyi.vip
|
||||
文档地址:http://doc.ruoyi.vip
|
||||
|
||||
## 演示图
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
## 若依前后端分离交流群
|
||||
|
||||
QQ群: [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [](https://jq.qq.com/?_wv=1027&k=kOIINEb5) 点击按钮入群。
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 清理工程target生成路径。
|
||||
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 [信息] 使用Jar命令运行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
|
||||
Binary file not shown.
|
|
@ -0,0 +1,298 @@
|
|||
微信支付 Java SDK
|
||||
------
|
||||
|
||||
对[微信支付开发者文档](https://pay.weixin.qq.com/wiki/doc/api/index.html)中给出的API进行了封装。
|
||||
|
||||
com.github.wxpay.sdk.WXPay类下提供了对应的方法:
|
||||
|
||||
|方法名 | 说明 |
|
||||
|--------|--------|
|
||||
|microPay| 刷卡支付 |
|
||||
|unifiedOrder | 统一下单|
|
||||
|orderQuery | 查询订单 |
|
||||
|reverse | 撤销订单 |
|
||||
|closeOrder|关闭订单|
|
||||
|refund|申请退款|
|
||||
|refundQuery|查询退款|
|
||||
|downloadBill|下载对账单|
|
||||
|report|交易保障|
|
||||
|shortUrl|转换短链接|
|
||||
|authCodeToOpenid|授权码查询openid|
|
||||
|
||||
* 注意:
|
||||
* 证书文件不能放在web服务器虚拟目录,应放在有访问权限控制的目录中,防止被他人下载
|
||||
* 建议将证书文件名改为复杂且不容易猜测的文件名
|
||||
* 商户服务器要做好病毒和木马防护工作,不被非法侵入者窃取证书文件
|
||||
* 请妥善保管商户支付密钥、公众帐号SECRET,避免密钥泄露
|
||||
* 参数为`Map<String, String>`对象,返回类型也是`Map<String, String>`
|
||||
* 方法内部会将参数会转换成含有`appid`、`mch_id`、`nonce_str`、`sign\_type`和`sign`的XML
|
||||
* 可选HMAC-SHA256算法和MD5算法签名
|
||||
* 通过HTTPS请求得到返回数据后会对其做必要的处理(例如验证签名,签名错误则抛出异常)
|
||||
* 对于downloadBill,无论是否成功都返回Map,且都含有`return_code`和`return_msg`,若成功,其中`return_code`为`SUCCESS`,另外`data`对应对账单数据
|
||||
|
||||
|
||||
## 示例
|
||||
配置类MyConfig:
|
||||
```java
|
||||
import com.github.wxpay.sdk.WXPayConfig;
|
||||
import java.io.*;
|
||||
|
||||
public class MyConfig implements WXPayConfig{
|
||||
|
||||
private byte[] certData;
|
||||
|
||||
public MyConfig() throws Exception {
|
||||
String certPath = "/path/to/apiclient_cert.p12";
|
||||
File file = new File(certPath);
|
||||
InputStream certStream = new FileInputStream(file);
|
||||
this.certData = new byte[(int) file.length()];
|
||||
certStream.read(this.certData);
|
||||
certStream.close();
|
||||
}
|
||||
|
||||
public String getAppID() {
|
||||
return "wx8888888888888888";
|
||||
}
|
||||
|
||||
public String getMchID() {
|
||||
return "12888888";
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return "88888888888888888888888888888888";
|
||||
}
|
||||
|
||||
public InputStream getCertStream() {
|
||||
ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
|
||||
return certBis;
|
||||
}
|
||||
|
||||
public int getHttpConnectTimeoutMs() {
|
||||
return 8000;
|
||||
}
|
||||
|
||||
public int getHttpReadTimeoutMs() {
|
||||
return 10000;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
统一下单:
|
||||
|
||||
```java
|
||||
import com.github.wxpay.sdk.WXPay;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WXPayExample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
MyConfig config = new MyConfig();
|
||||
WXPay wxpay = new WXPay(config);
|
||||
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
data.put("body", "腾讯充值中心-QQ会员充值");
|
||||
data.put("out_trade_no", "2016090910595900000012");
|
||||
data.put("device_info", "");
|
||||
data.put("fee_type", "CNY");
|
||||
data.put("total_fee", "1");
|
||||
data.put("spbill_create_ip", "123.12.12.123");
|
||||
data.put("notify_url", "http://www.example.com/wxpay/notify");
|
||||
data.put("trade_type", "NATIVE"); // 此处指定为扫码支付
|
||||
data.put("product_id", "12");
|
||||
|
||||
try {
|
||||
Map<String, String> resp = wxpay.unifiedOrder(data);
|
||||
System.out.println(resp);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
订单查询:
|
||||
```java
|
||||
import com.github.wxpay.sdk.WXPay;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WXPayExample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
MyConfig config = new MyConfig();
|
||||
WXPay wxpay = new WXPay(config);
|
||||
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
data.put("out_trade_no", "2016090910595900000012");
|
||||
|
||||
try {
|
||||
Map<String, String> resp = wxpay.orderQuery(data);
|
||||
System.out.println(resp);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
退款查询:
|
||||
|
||||
```java
|
||||
import com.github.wxpay.sdk.WXPay;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WXPayExample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
MyConfig config = new MyConfig();
|
||||
WXPay wxpay = new WXPay(config);
|
||||
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
data.put("out_trade_no", "2016090910595900000012");
|
||||
|
||||
try {
|
||||
Map<String, String> resp = wxpay.refundQuery(data);
|
||||
System.out.println(resp);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
下载对账单:
|
||||
|
||||
```java
|
||||
import com.github.wxpay.sdk.WXPay;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WXPayExample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
MyConfig config = new MyConfig();
|
||||
WXPay wxpay = new WXPay(config);
|
||||
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
data.put("bill_date", "20140603");
|
||||
data.put("bill_type", "ALL");
|
||||
|
||||
try {
|
||||
Map<String, String> resp = wxpay.downloadBill(data);
|
||||
System.out.println(resp);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
其他API的使用和上面类似。
|
||||
|
||||
暂时不支持下载压缩格式的对账单,但可以使用该SDK生成请求用的XML数据:
|
||||
```java
|
||||
import com.github.wxpay.sdk.WXPay;
|
||||
import com.github.wxpay.sdk.WXPayUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WXPayExample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
MyConfig config = new MyConfig();
|
||||
WXPay wxpay = new WXPay(config);
|
||||
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
data.put("bill_date", "20140603");
|
||||
data.put("bill_type", "ALL");
|
||||
data.put("tar_type", "GZIP");
|
||||
|
||||
try {
|
||||
data = wxpay.fillRequestData(data);
|
||||
System.out.println(WXPayUtil.mapToXml(data));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
收到支付结果通知时,需要验证签名,可以这样做:
|
||||
```java
|
||||
|
||||
import com.github.wxpay.sdk.WXPay;
|
||||
import com.github.wxpay.sdk.WXPayUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class WXPayExample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
String notifyData = "...."; // 支付结果通知的xml格式数据
|
||||
|
||||
MyConfig config = new MyConfig();
|
||||
WXPay wxpay = new WXPay(config);
|
||||
|
||||
Map<String, String> notifyMap = WXPayUtil.xmlToMap(notifyData); // 转换成map
|
||||
|
||||
if (wxpay.isPayResultNotifySignatureValid(notifyMap)) {
|
||||
// 签名正确
|
||||
// 进行处理。
|
||||
// 注意特殊情况:订单已经退款,但收到了支付结果成功的通知,不应把商户侧订单状态从退款改成支付成功
|
||||
}
|
||||
else {
|
||||
// 签名错误,如果数据里没有sign字段,也认为是签名错误
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
HTTPS请求可选HMAC-SHA256算法和MD5算法签名:
|
||||
```
|
||||
import com.github.wxpay.sdk.WXPay;
|
||||
import com.github.wxpay.sdk.WXPayConstants;
|
||||
|
||||
public class WXPayExample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
MyConfig config = new MyConfig();
|
||||
WXPay wxpay = new WXPay(config, WXPayConstants.SignType.HMACSHA256);
|
||||
// ......
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
若需要使用sandbox环境:
|
||||
```
|
||||
import com.github.wxpay.sdk.WXPay;
|
||||
import com.github.wxpay.sdk.WXPayConstants;
|
||||
|
||||
public class WXPayExample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
MyConfig config = new MyConfig();
|
||||
WXPay wxpay = new WXPay(config, WXPayConstants.SignType.MD5, true);
|
||||
// ......
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
<?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>com.github.wxpay</groupId>
|
||||
<artifactId>wxpay-sdk</artifactId>
|
||||
<version>3.0.9</version>
|
||||
<name>wxpay-sdk</name>
|
||||
<description>wxpay sdk</description>
|
||||
<!-- <url>https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=11_1</url>-->
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>utf-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.21</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.21</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!--<licenses>
|
||||
<license>
|
||||
<name>The BSD 3-Clause License</name>
|
||||
<url>https://opensource.org/licenses/BSD-3-Clause</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<scm>
|
||||
<url></url>
|
||||
<connection></connection>
|
||||
<developerConnection></developerConnection>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>wxpay</name>
|
||||
<email></email>
|
||||
<url>https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=11_1</url>
|
||||
</developer>
|
||||
</developers>-->
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Source -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Javadoc -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Gpg Signature -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.github.wxpay.sdk;
|
||||
|
||||
/**
|
||||
* 域名管理,实现主备域名自动切换
|
||||
*/
|
||||
public abstract interface IWXPayDomain {
|
||||
/**
|
||||
* 上报域名网络状况
|
||||
* @param domain 域名。 比如:api.mch.weixin.qq.com
|
||||
* @param elapsedTimeMillis 耗时
|
||||
* @param ex 网络请求中出现的异常。
|
||||
* null表示没有异常
|
||||
* ConnectTimeoutException,表示建立网络连接异常
|
||||
* UnknownHostException, 表示dns解析异常
|
||||
*/
|
||||
abstract void report(final String domain, long elapsedTimeMillis, final Exception ex);
|
||||
|
||||
/**
|
||||
* 获取域名
|
||||
* @param config 配置
|
||||
* @return 域名
|
||||
*/
|
||||
abstract DomainInfo getDomain(final WXPayConfig config);
|
||||
|
||||
static class DomainInfo{
|
||||
public String domain; //域名
|
||||
public boolean primaryDomain; //该域名是否为主域名。例如:api.mch.weixin.qq.com为主域名
|
||||
public DomainInfo(String domain, boolean primaryDomain) {
|
||||
this.domain = domain;
|
||||
this.primaryDomain = primaryDomain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DomainInfo{" +
|
||||
"domain='" + domain + '\'' +
|
||||
", primaryDomain=" + primaryDomain +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,689 @@
|
|||
package com.github.wxpay.sdk;
|
||||
|
||||
import com.github.wxpay.sdk.WXPayConstants.SignType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WXPay {
|
||||
|
||||
private WXPayConfig config;
|
||||
private SignType signType;
|
||||
private boolean autoReport;
|
||||
private boolean useSandbox;
|
||||
private String notifyUrl;
|
||||
private WXPayRequest wxPayRequest;
|
||||
|
||||
public WXPay(final WXPayConfig config) throws Exception {
|
||||
this(config, null, true, false);
|
||||
}
|
||||
|
||||
public WXPay(final WXPayConfig config, final boolean autoReport) throws Exception {
|
||||
this(config, null, autoReport, false);
|
||||
}
|
||||
|
||||
|
||||
public WXPay(final WXPayConfig config, final boolean autoReport, final boolean useSandbox) throws Exception{
|
||||
this(config, null, autoReport, useSandbox);
|
||||
}
|
||||
|
||||
public WXPay(final WXPayConfig config, final String notifyUrl) throws Exception {
|
||||
this(config, notifyUrl, true, false);
|
||||
}
|
||||
|
||||
public WXPay(final WXPayConfig config, final String notifyUrl, final boolean autoReport) throws Exception {
|
||||
this(config, notifyUrl, autoReport, false);
|
||||
}
|
||||
|
||||
public WXPay(final WXPayConfig config, final String notifyUrl, final boolean autoReport, final boolean useSandbox) throws Exception {
|
||||
this.config = config;
|
||||
this.notifyUrl = notifyUrl;
|
||||
this.autoReport = autoReport;
|
||||
this.useSandbox = useSandbox;
|
||||
if (useSandbox) {
|
||||
this.signType = SignType.MD5; // 沙箱环境
|
||||
}
|
||||
else {
|
||||
this.signType = SignType.HMACSHA256;
|
||||
}
|
||||
this.wxPayRequest = new WXPayRequest(config);
|
||||
}
|
||||
|
||||
private void checkWXPayConfig() throws Exception {
|
||||
if (this.config == null) {
|
||||
throw new Exception("config is null");
|
||||
}
|
||||
if (this.config.getAppID() == null || this.config.getAppID().trim().length() == 0) {
|
||||
throw new Exception("appid in config is empty");
|
||||
}
|
||||
if (this.config.getMchID() == null || this.config.getMchID().trim().length() == 0) {
|
||||
throw new Exception("appid in config is empty");
|
||||
}
|
||||
if (this.config.getCertStream() == null) {
|
||||
throw new Exception("cert stream in config is empty");
|
||||
}
|
||||
if (this.config.getWXPayDomain() == null){
|
||||
throw new Exception("config.getWXPayDomain() is null");
|
||||
}
|
||||
|
||||
if (this.config.getHttpConnectTimeoutMs() < 10) {
|
||||
throw new Exception("http connect timeout is too small");
|
||||
}
|
||||
if (this.config.getHttpReadTimeoutMs() < 10) {
|
||||
throw new Exception("http read timeout is too small");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 向 Map 中添加 appid、mch_id、nonce_str、sign_type、sign <br>
|
||||
* 该函数适用于商户适用于统一下单等接口,不适用于红包、代金券接口
|
||||
*
|
||||
* @param reqData
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> fillRequestData(Map<String, String> reqData) throws Exception {
|
||||
reqData.put("appid", config.getAppID());
|
||||
reqData.put("mch_id", config.getMchID());
|
||||
reqData.put("nonce_str", WXPayUtil.generateNonceStr());
|
||||
if (SignType.MD5.equals(this.signType)) {
|
||||
reqData.put("sign_type", WXPayConstants.MD5);
|
||||
}
|
||||
else if (SignType.HMACSHA256.equals(this.signType)) {
|
||||
reqData.put("sign_type", WXPayConstants.HMACSHA256);
|
||||
}
|
||||
reqData.put("sign", WXPayUtil.generateSignature(reqData, config.getKey(), this.signType));
|
||||
return reqData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断xml数据的sign是否有效,必须包含sign字段,否则返回false。
|
||||
*
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return 签名是否有效
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean isResponseSignatureValid(Map<String, String> reqData) throws Exception {
|
||||
// 返回数据的签名方式和请求中给定的签名方式是一致的
|
||||
return WXPayUtil.isSignatureValid(reqData, this.config.getKey(), this.signType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断支付结果通知中的sign是否有效
|
||||
*
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return 签名是否有效
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean isPayResultNotifySignatureValid(Map<String, String> reqData) throws Exception {
|
||||
String signTypeInData = reqData.get(WXPayConstants.FIELD_SIGN_TYPE);
|
||||
SignType signType;
|
||||
if (signTypeInData == null) {
|
||||
signType = SignType.MD5;
|
||||
}
|
||||
else {
|
||||
signTypeInData = signTypeInData.trim();
|
||||
if (signTypeInData.length() == 0) {
|
||||
signType = SignType.MD5;
|
||||
}
|
||||
else if (WXPayConstants.MD5.equals(signTypeInData)) {
|
||||
signType = SignType.MD5;
|
||||
}
|
||||
else if (WXPayConstants.HMACSHA256.equals(signTypeInData)) {
|
||||
signType = SignType.HMACSHA256;
|
||||
}
|
||||
else {
|
||||
throw new Exception(String.format("Unsupported sign_type: %s", signTypeInData));
|
||||
}
|
||||
}
|
||||
return WXPayUtil.isSignatureValid(reqData, this.config.getKey(), signType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 不需要证书的请求
|
||||
* @param urlSuffix String
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public String requestWithoutCert(String urlSuffix, Map<String, String> reqData,
|
||||
int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String msgUUID = reqData.get("nonce_str");
|
||||
String reqBody = WXPayUtil.mapToXml(reqData);
|
||||
|
||||
String resp = this.wxPayRequest.requestWithoutCert(urlSuffix, msgUUID, reqBody, connectTimeoutMs, readTimeoutMs, autoReport);
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 需要证书的请求
|
||||
* @param urlSuffix String
|
||||
* @param reqData 向wxpay post的请求数据 Map
|
||||
* @param connectTimeoutMs 超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public String requestWithCert(String urlSuffix, Map<String, String> reqData,
|
||||
int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String msgUUID= reqData.get("nonce_str");
|
||||
String reqBody = WXPayUtil.mapToXml(reqData);
|
||||
|
||||
String resp = this.wxPayRequest.requestWithCert(urlSuffix, msgUUID, reqBody, connectTimeoutMs, readTimeoutMs, this.autoReport);
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 HTTPS API返回数据,转换成Map对象。return_code为SUCCESS时,验证签名。
|
||||
* @param xmlStr API返回的XML格式数据
|
||||
* @return Map类型数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> processResponseXml(String xmlStr) throws Exception {
|
||||
String RETURN_CODE = "return_code";
|
||||
String return_code;
|
||||
Map<String, String> respData = WXPayUtil.xmlToMap(xmlStr);
|
||||
if (respData.containsKey(RETURN_CODE)) {
|
||||
return_code = respData.get(RETURN_CODE);
|
||||
}
|
||||
else {
|
||||
throw new Exception(String.format("No `return_code` in XML: %s", xmlStr));
|
||||
}
|
||||
|
||||
if (return_code.equals(WXPayConstants.FAIL)) {
|
||||
return respData;
|
||||
}
|
||||
else if (return_code.equals(WXPayConstants.SUCCESS)) {
|
||||
if (this.isResponseSignatureValid(respData)) {
|
||||
return respData;
|
||||
}
|
||||
else {
|
||||
throw new Exception(String.format("Invalid sign value in XML: %s", xmlStr));
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Exception(String.format("return_code value %s is invalid in XML: %s", return_code, xmlStr));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 作用:提交刷卡支付<br>
|
||||
* 场景:刷卡支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> microPay(Map<String, String> reqData) throws Exception {
|
||||
return this.microPay(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:提交刷卡支付<br>
|
||||
* 场景:刷卡支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> microPay(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_MICROPAY_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.MICROPAY_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交刷卡支付,针对软POS,尽可能做成功
|
||||
* 内置重试机制,最多60s
|
||||
* @param reqData
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> microPayWithPos(Map<String, String> reqData) throws Exception {
|
||||
return this.microPayWithPos(reqData, this.config.getHttpConnectTimeoutMs());
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交刷卡支付,针对软POS,尽可能做成功
|
||||
* 内置重试机制,最多60s
|
||||
* @param reqData
|
||||
* @param connectTimeoutMs
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> microPayWithPos(Map<String, String> reqData, int connectTimeoutMs) throws Exception {
|
||||
int remainingTimeMs = 60*1000;
|
||||
long startTimestampMs = 0;
|
||||
Map<String, String> lastResult = null;
|
||||
Exception lastException = null;
|
||||
|
||||
while (true) {
|
||||
startTimestampMs = WXPayUtil.getCurrentTimestampMs();
|
||||
int readTimeoutMs = remainingTimeMs - connectTimeoutMs;
|
||||
if (readTimeoutMs > 1000) {
|
||||
try {
|
||||
lastResult = this.microPay(reqData, connectTimeoutMs, readTimeoutMs);
|
||||
String returnCode = lastResult.get("return_code");
|
||||
if (returnCode.equals("SUCCESS")) {
|
||||
String resultCode = lastResult.get("result_code");
|
||||
String errCode = lastResult.get("err_code");
|
||||
if (resultCode.equals("SUCCESS")) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// 看错误码,若支付结果未知,则重试提交刷卡支付
|
||||
if (errCode.equals("SYSTEMERROR") || errCode.equals("BANKERROR") || errCode.equals("USERPAYING")) {
|
||||
remainingTimeMs = remainingTimeMs - (int)(WXPayUtil.getCurrentTimestampMs() - startTimestampMs);
|
||||
if (remainingTimeMs <= 100) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
WXPayUtil.getLogger().info("microPayWithPos: try micropay again");
|
||||
if (remainingTimeMs > 5*1000) {
|
||||
Thread.sleep(5*1000);
|
||||
}
|
||||
else {
|
||||
Thread.sleep(1*1000);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
lastResult = null;
|
||||
lastException = ex;
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (lastResult == null) {
|
||||
throw lastException;
|
||||
}
|
||||
else {
|
||||
return lastResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 作用:统一下单<br>
|
||||
* 场景:公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> unifiedOrder(Map<String, String> reqData) throws Exception {
|
||||
return this.unifiedOrder(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:统一下单<br>
|
||||
* 场景:公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> unifiedOrder(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_UNIFIEDORDER_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.UNIFIEDORDER_URL_SUFFIX;
|
||||
}
|
||||
if(this.notifyUrl != null) {
|
||||
reqData.put("notify_url", this.notifyUrl);
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:查询订单<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> orderQuery(Map<String, String> reqData) throws Exception {
|
||||
return this.orderQuery(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:查询订单<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据 int
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> orderQuery(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_ORDERQUERY_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.ORDERQUERY_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:撤销订单<br>
|
||||
* 场景:刷卡支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> reverse(Map<String, String> reqData) throws Exception {
|
||||
return this.reverse(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:撤销订单<br>
|
||||
* 场景:刷卡支付<br>
|
||||
* 其他:需要证书
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> reverse(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_REVERSE_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.REVERSE_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:关闭订单<br>
|
||||
* 场景:公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> closeOrder(Map<String, String> reqData) throws Exception {
|
||||
return this.closeOrder(reqData, config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:关闭订单<br>
|
||||
* 场景:公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> closeOrder(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_CLOSEORDER_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.CLOSEORDER_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:申请退款<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> refund(Map<String, String> reqData) throws Exception {
|
||||
return this.refund(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:申请退款<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付<br>
|
||||
* 其他:需要证书
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> refund(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_REFUND_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.REFUND_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:退款查询<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> refundQuery(Map<String, String> reqData) throws Exception {
|
||||
return this.refundQuery(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:退款查询<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> refundQuery(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_REFUNDQUERY_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.REFUNDQUERY_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:对账单下载(成功时返回对账单数据,失败时返回XML格式数据)<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> downloadBill(Map<String, String> reqData) throws Exception {
|
||||
return this.downloadBill(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:对账单下载<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付<br>
|
||||
* 其他:无论是否成功都返回Map。若成功,返回的Map中含有return_code、return_msg、data,
|
||||
* 其中return_code为`SUCCESS`,data为对账单数据。
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return 经过封装的API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> downloadBill(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_DOWNLOADBILL_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.DOWNLOADBILL_URL_SUFFIX;
|
||||
}
|
||||
String respStr = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs).trim();
|
||||
Map<String, String> ret;
|
||||
// 出现错误,返回XML数据
|
||||
if (respStr.indexOf("<") == 0) {
|
||||
ret = WXPayUtil.xmlToMap(respStr);
|
||||
}
|
||||
else {
|
||||
// 正常返回csv数据
|
||||
ret = new HashMap<String, String>();
|
||||
ret.put("return_code", WXPayConstants.SUCCESS);
|
||||
ret.put("return_msg", "ok");
|
||||
ret.put("data", respStr);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:交易保障<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> report(Map<String, String> reqData) throws Exception {
|
||||
return this.report(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:交易保障<br>
|
||||
* 场景:刷卡支付、公共号支付、扫码支付、APP支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> report(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_REPORT_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.REPORT_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return WXPayUtil.xmlToMap(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:转换短链接<br>
|
||||
* 场景:刷卡支付、扫码支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> shortUrl(Map<String, String> reqData) throws Exception {
|
||||
return this.shortUrl(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:转换短链接<br>
|
||||
* 场景:刷卡支付、扫码支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> shortUrl(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_SHORTURL_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.SHORTURL_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:授权码查询OPENID接口<br>
|
||||
* 场景:刷卡支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> authCodeToOpenid(Map<String, String> reqData) throws Exception {
|
||||
return this.authCodeToOpenid(reqData, this.config.getHttpConnectTimeoutMs(), this.config.getHttpReadTimeoutMs());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作用:授权码查询OPENID接口<br>
|
||||
* 场景:刷卡支付
|
||||
* @param reqData 向wxpay post的请求数据
|
||||
* @param connectTimeoutMs 连接超时时间,单位是毫秒
|
||||
* @param readTimeoutMs 读超时时间,单位是毫秒
|
||||
* @return API返回数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> authCodeToOpenid(Map<String, String> reqData, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
String url;
|
||||
if (this.useSandbox) {
|
||||
url = WXPayConstants.SANDBOX_AUTHCODETOOPENID_URL_SUFFIX;
|
||||
}
|
||||
else {
|
||||
url = WXPayConstants.AUTHCODETOOPENID_URL_SUFFIX;
|
||||
}
|
||||
String respXml = this.requestWithoutCert(url, this.fillRequestData(reqData), connectTimeoutMs, readTimeoutMs);
|
||||
return this.processResponseXml(respXml);
|
||||
}
|
||||
|
||||
|
||||
} // end class
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package com.github.wxpay.sdk;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public abstract class WXPayConfig {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取 App ID
|
||||
*
|
||||
* @return App ID
|
||||
*/
|
||||
abstract String getAppID();
|
||||
|
||||
|
||||
/**
|
||||
* 获取 Mch ID
|
||||
*
|
||||
* @return Mch ID
|
||||
*/
|
||||
abstract String getMchID();
|
||||
|
||||
|
||||
/**
|
||||
* 获取 API 密钥
|
||||
*
|
||||
* @return API密钥
|
||||
*/
|
||||
abstract String getKey();
|
||||
|
||||
|
||||
/**
|
||||
* 获取商户证书内容
|
||||
*
|
||||
* @return 商户证书内容
|
||||
*/
|
||||
abstract InputStream getCertStream();
|
||||
|
||||
/**
|
||||
* HTTP(S) 连接超时时间,单位毫秒
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getHttpConnectTimeoutMs() {
|
||||
return 6*1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP(S) 读数据超时时间,单位毫秒
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getHttpReadTimeoutMs() {
|
||||
return 8*1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取WXPayDomain, 用于多域名容灾自动切换
|
||||
* @return
|
||||
*/
|
||||
abstract IWXPayDomain getWXPayDomain();
|
||||
|
||||
/**
|
||||
* 是否自动上报。
|
||||
* 若要关闭自动上报,子类中实现该函数返回 false 即可。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldAutoReport() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进行健康上报的线程的数量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getReportWorkerNum() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 健康上报缓存消息的最大数量。会有线程去独立上报
|
||||
* 粗略计算:加入一条消息200B,10000消息占用空间 2000 KB,约为2MB,可以接受
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getReportQueueMaxSize() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上报,一次最多上报多个数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getReportBatchSize() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.github.wxpay.sdk;
|
||||
|
||||
import org.apache.http.client.HttpClient;
|
||||
|
||||
/**
|
||||
* 常量
|
||||
*/
|
||||
public class WXPayConstants {
|
||||
|
||||
public enum SignType {
|
||||
MD5, HMACSHA256
|
||||
}
|
||||
|
||||
public static final String DOMAIN_API = "api.mch.weixin.qq.com";
|
||||
public static final String DOMAIN_API2 = "api2.mch.weixin.qq.com";
|
||||
public static final String DOMAIN_APIHK = "apihk.mch.weixin.qq.com";
|
||||
public static final String DOMAIN_APIUS = "apius.mch.weixin.qq.com";
|
||||
|
||||
|
||||
public static final String FAIL = "FAIL";
|
||||
public static final String SUCCESS = "SUCCESS";
|
||||
public static final String HMACSHA256 = "HMAC-SHA256";
|
||||
public static final String MD5 = "MD5";
|
||||
|
||||
public static final String FIELD_SIGN = "sign";
|
||||
public static final String FIELD_SIGN_TYPE = "sign_type";
|
||||
|
||||
public static final String WXPAYSDK_VERSION = "WXPaySDK/3.0.9";
|
||||
public static final String USER_AGENT = WXPAYSDK_VERSION +
|
||||
" (" + System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version") +
|
||||
") Java/" + System.getProperty("java.version") + " HttpClient/" + HttpClient.class.getPackage().getImplementationVersion();
|
||||
|
||||
public static final String MICROPAY_URL_SUFFIX = "/pay/micropay";
|
||||
public static final String UNIFIEDORDER_URL_SUFFIX = "/pay/unifiedorder";
|
||||
public static final String ORDERQUERY_URL_SUFFIX = "/pay/orderquery";
|
||||
public static final String REVERSE_URL_SUFFIX = "/secapi/pay/reverse";
|
||||
public static final String CLOSEORDER_URL_SUFFIX = "/pay/closeorder";
|
||||
public static final String REFUND_URL_SUFFIX = "/secapi/pay/refund";
|
||||
public static final String REFUNDQUERY_URL_SUFFIX = "/pay/refundquery";
|
||||
public static final String DOWNLOADBILL_URL_SUFFIX = "/pay/downloadbill";
|
||||
public static final String REPORT_URL_SUFFIX = "/payitil/report";
|
||||
public static final String SHORTURL_URL_SUFFIX = "/tools/shorturl";
|
||||
public static final String AUTHCODETOOPENID_URL_SUFFIX = "/tools/authcodetoopenid";
|
||||
|
||||
// sandbox
|
||||
public static final String SANDBOX_MICROPAY_URL_SUFFIX = "/sandboxnew/pay/micropay";
|
||||
public static final String SANDBOX_UNIFIEDORDER_URL_SUFFIX = "/sandboxnew/pay/unifiedorder";
|
||||
public static final String SANDBOX_ORDERQUERY_URL_SUFFIX = "/sandboxnew/pay/orderquery";
|
||||
public static final String SANDBOX_REVERSE_URL_SUFFIX = "/sandboxnew/secapi/pay/reverse";
|
||||
public static final String SANDBOX_CLOSEORDER_URL_SUFFIX = "/sandboxnew/pay/closeorder";
|
||||
public static final String SANDBOX_REFUND_URL_SUFFIX = "/sandboxnew/secapi/pay/refund";
|
||||
public static final String SANDBOX_REFUNDQUERY_URL_SUFFIX = "/sandboxnew/pay/refundquery";
|
||||
public static final String SANDBOX_DOWNLOADBILL_URL_SUFFIX = "/sandboxnew/pay/downloadbill";
|
||||
public static final String SANDBOX_REPORT_URL_SUFFIX = "/sandboxnew/payitil/report";
|
||||
public static final String SANDBOX_SHORTURL_URL_SUFFIX = "/sandboxnew/tools/shorturl";
|
||||
public static final String SANDBOX_AUTHCODETOOPENID_URL_SUFFIX = "/sandboxnew/tools/authcodetoopenid";
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
package com.github.wxpay.sdk;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.config.RegistryBuilder;
|
||||
import org.apache.http.conn.socket.ConnectionSocketFactory;
|
||||
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* 交易保障
|
||||
*/
|
||||
public class WXPayReport {
|
||||
|
||||
public static class ReportInfo {
|
||||
|
||||
/**
|
||||
* 布尔变量使用int。0为false, 1为true。
|
||||
*/
|
||||
|
||||
// 基本信息
|
||||
private String version = "v1";
|
||||
private String sdk = WXPayConstants.WXPAYSDK_VERSION;
|
||||
private String uuid; // 交易的标识
|
||||
private long timestamp; // 上报时的时间戳,单位秒
|
||||
private long elapsedTimeMillis; // 耗时,单位 毫秒
|
||||
|
||||
// 针对主域名
|
||||
private String firstDomain; // 第1次请求的域名
|
||||
private boolean primaryDomain; //是否主域名
|
||||
private int firstConnectTimeoutMillis; // 第1次请求设置的连接超时时间,单位 毫秒
|
||||
private int firstReadTimeoutMillis; // 第1次请求设置的读写超时时间,单位 毫秒
|
||||
private int firstHasDnsError; // 第1次请求是否出现dns问题
|
||||
private int firstHasConnectTimeout; // 第1次请求是否出现连接超时
|
||||
private int firstHasReadTimeout; // 第1次请求是否出现连接超时
|
||||
|
||||
public ReportInfo(String uuid, long timestamp, long elapsedTimeMillis, String firstDomain, boolean primaryDomain, int firstConnectTimeoutMillis, int firstReadTimeoutMillis, boolean firstHasDnsError, boolean firstHasConnectTimeout, boolean firstHasReadTimeout) {
|
||||
this.uuid = uuid;
|
||||
this.timestamp = timestamp;
|
||||
this.elapsedTimeMillis = elapsedTimeMillis;
|
||||
this.firstDomain = firstDomain;
|
||||
this.primaryDomain = primaryDomain;
|
||||
this.firstConnectTimeoutMillis = firstConnectTimeoutMillis;
|
||||
this.firstReadTimeoutMillis = firstReadTimeoutMillis;
|
||||
this.firstHasDnsError = firstHasDnsError?1:0;
|
||||
this.firstHasConnectTimeout = firstHasConnectTimeout?1:0;
|
||||
this.firstHasReadTimeout = firstHasReadTimeout?1:0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ReportInfo{" +
|
||||
"version='" + version + '\'' +
|
||||
", sdk='" + sdk + '\'' +
|
||||
", uuid='" + uuid + '\'' +
|
||||
", timestamp=" + timestamp +
|
||||
", elapsedTimeMillis=" + elapsedTimeMillis +
|
||||
", firstDomain='" + firstDomain + '\'' +
|
||||
", primaryDomain=" + primaryDomain +
|
||||
", firstConnectTimeoutMillis=" + firstConnectTimeoutMillis +
|
||||
", firstReadTimeoutMillis=" + firstReadTimeoutMillis +
|
||||
", firstHasDnsError=" + firstHasDnsError +
|
||||
", firstHasConnectTimeout=" + firstHasConnectTimeout +
|
||||
", firstHasReadTimeout=" + firstHasReadTimeout +
|
||||
'}';
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换成 csv 格式
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String toLineString(String key) {
|
||||
String separator = ",";
|
||||
Object[] objects = new Object[] {
|
||||
version, sdk, uuid, timestamp, elapsedTimeMillis,
|
||||
firstDomain, primaryDomain, firstConnectTimeoutMillis, firstReadTimeoutMillis,
|
||||
firstHasDnsError, firstHasConnectTimeout, firstHasReadTimeout
|
||||
};
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for(Object obj: objects) {
|
||||
sb.append(obj).append(separator);
|
||||
}
|
||||
try {
|
||||
String sign = WXPayUtil.HMACSHA256(sb.toString(), key);
|
||||
sb.append(sign);
|
||||
return sb.toString();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final String REPORT_URL = "http://report.mch.weixin.qq.com/wxpay/report/default";
|
||||
// private static final String REPORT_URL = "http://127.0.0.1:5000/test";
|
||||
|
||||
|
||||
private static final int DEFAULT_CONNECT_TIMEOUT_MS = 6*1000;
|
||||
private static final int DEFAULT_READ_TIMEOUT_MS = 8*1000;
|
||||
|
||||
private LinkedBlockingQueue<String> reportMsgQueue = null;
|
||||
private WXPayConfig config;
|
||||
private ExecutorService executorService;
|
||||
|
||||
private volatile static WXPayReport INSTANCE;
|
||||
|
||||
private WXPayReport(final WXPayConfig config) {
|
||||
this.config = config;
|
||||
reportMsgQueue = new LinkedBlockingQueue<String>(config.getReportQueueMaxSize());
|
||||
|
||||
// 添加处理线程
|
||||
executorService = Executors.newFixedThreadPool(config.getReportWorkerNum(), new ThreadFactory() {
|
||||
public Thread newThread(Runnable r) {
|
||||
Thread t = Executors.defaultThreadFactory().newThread(r);
|
||||
t.setDaemon(true);
|
||||
return t;
|
||||
}
|
||||
});
|
||||
|
||||
if (config.shouldAutoReport()) {
|
||||
WXPayUtil.getLogger().info("report worker num: {}", config.getReportWorkerNum());
|
||||
for (int i = 0; i < config.getReportWorkerNum(); ++i) {
|
||||
executorService.execute(new Runnable() {
|
||||
public void run() {
|
||||
while (true) {
|
||||
// 先用 take 获取数据
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String firstMsg = reportMsgQueue.take();
|
||||
WXPayUtil.getLogger().info("get first report msg: {}", firstMsg);
|
||||
String msg = null;
|
||||
sb.append(firstMsg); //会阻塞至有消息
|
||||
int remainNum = config.getReportBatchSize() - 1;
|
||||
for (int j=0; j<remainNum; ++j) {
|
||||
WXPayUtil.getLogger().info("try get remain report msg");
|
||||
// msg = reportMsgQueue.poll(); // 不阻塞了
|
||||
msg = reportMsgQueue.take();
|
||||
WXPayUtil.getLogger().info("get remain report msg: {}", msg);
|
||||
if (msg == null) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
sb.append("\n");
|
||||
sb.append(msg);
|
||||
}
|
||||
}
|
||||
// 上报
|
||||
WXPayReport.httpRequest(sb.toString(), DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
WXPayUtil.getLogger().warn("report fail. reason: {}", ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 单例,双重校验,请在 JDK 1.5及更高版本中使用
|
||||
*
|
||||
* @param config
|
||||
* @return
|
||||
*/
|
||||
public static WXPayReport getInstance(WXPayConfig config) {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (WXPayReport.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new WXPayReport(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void report(String uuid, long elapsedTimeMillis,
|
||||
String firstDomain, boolean primaryDomain, int firstConnectTimeoutMillis, int firstReadTimeoutMillis,
|
||||
boolean firstHasDnsError, boolean firstHasConnectTimeout, boolean firstHasReadTimeout) {
|
||||
long currentTimestamp = WXPayUtil.getCurrentTimestamp();
|
||||
ReportInfo reportInfo = new ReportInfo(uuid, currentTimestamp, elapsedTimeMillis,
|
||||
firstDomain, primaryDomain, firstConnectTimeoutMillis, firstReadTimeoutMillis,
|
||||
firstHasDnsError, firstHasConnectTimeout, firstHasReadTimeout);
|
||||
String data = reportInfo.toLineString(config.getKey());
|
||||
WXPayUtil.getLogger().info("report {}", data);
|
||||
if (data != null) {
|
||||
reportMsgQueue.offer(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
private void reportSync(final String data) throws Exception {
|
||||
httpRequest(data, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private void reportAsync(final String data) throws Exception {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
httpRequest(data, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_READ_TIMEOUT_MS);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
WXPayUtil.getLogger().warn("report fail. reason: {}", ex.getMessage());
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* http 请求
|
||||
* @param data
|
||||
* @param connectTimeoutMs
|
||||
* @param readTimeoutMs
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private static String httpRequest(String data, int connectTimeoutMs, int readTimeoutMs) throws Exception{
|
||||
BasicHttpClientConnectionManager connManager;
|
||||
connManager = new BasicHttpClientConnectionManager(
|
||||
RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
||||
.register("https", SSLConnectionSocketFactory.getSocketFactory())
|
||||
.build(),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
HttpClient httpClient = HttpClientBuilder.create()
|
||||
.setConnectionManager(connManager)
|
||||
.build();
|
||||
|
||||
HttpPost httpPost = new HttpPost(REPORT_URL);
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(readTimeoutMs).setConnectTimeout(connectTimeoutMs).build();
|
||||
httpPost.setConfig(requestConfig);
|
||||
|
||||
StringEntity postEntity = new StringEntity(data, "UTF-8");
|
||||
httpPost.addHeader("Content-Type", "text/xml");
|
||||
httpPost.addHeader("User-Agent", WXPayConstants.USER_AGENT);
|
||||
httpPost.setEntity(postEntity);
|
||||
|
||||
HttpResponse httpResponse = httpClient.execute(httpPost);
|
||||
HttpEntity httpEntity = httpResponse.getEntity();
|
||||
return EntityUtils.toString(httpEntity, "UTF-8");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,258 @@
|
|||
package com.github.wxpay.sdk;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.config.RegistryBuilder;
|
||||
import org.apache.http.conn.ConnectTimeoutException;
|
||||
import org.apache.http.conn.socket.ConnectionSocketFactory;
|
||||
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.io.InputStream;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import static com.github.wxpay.sdk.WXPayConstants.USER_AGENT;
|
||||
|
||||
public class WXPayRequest {
|
||||
private WXPayConfig config;
|
||||
public WXPayRequest(WXPayConfig config) throws Exception{
|
||||
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求,只请求一次,不做重试
|
||||
* @param domain
|
||||
* @param urlSuffix
|
||||
* @param uuid
|
||||
* @param data
|
||||
* @param connectTimeoutMs
|
||||
* @param readTimeoutMs
|
||||
* @param useCert 是否使用证书,针对退款、撤销等操作
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private String requestOnce(final String domain, String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean useCert) throws Exception {
|
||||
BasicHttpClientConnectionManager connManager;
|
||||
if (useCert) {
|
||||
// 证书
|
||||
char[] password = config.getMchID().toCharArray();
|
||||
InputStream certStream = config.getCertStream();
|
||||
KeyStore ks = KeyStore.getInstance("PKCS12");
|
||||
ks.load(certStream, password);
|
||||
|
||||
// 实例化密钥库 & 初始化密钥工厂
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
||||
kmf.init(ks, password);
|
||||
|
||||
// 创建 SSLContext
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(kmf.getKeyManagers(), null, new SecureRandom());
|
||||
|
||||
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(
|
||||
sslContext,
|
||||
new String[]{"TLSv1"},
|
||||
null,
|
||||
new DefaultHostnameVerifier());
|
||||
|
||||
connManager = new BasicHttpClientConnectionManager(
|
||||
RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
||||
.register("https", sslConnectionSocketFactory)
|
||||
.build(),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
else {
|
||||
connManager = new BasicHttpClientConnectionManager(
|
||||
RegistryBuilder.<ConnectionSocketFactory>create()
|
||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
||||
.register("https", SSLConnectionSocketFactory.getSocketFactory())
|
||||
.build(),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
HttpClient httpClient = HttpClientBuilder.create()
|
||||
.setConnectionManager(connManager)
|
||||
.build();
|
||||
|
||||
String url = "https://" + domain + urlSuffix;
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(readTimeoutMs).setConnectTimeout(connectTimeoutMs).build();
|
||||
httpPost.setConfig(requestConfig);
|
||||
|
||||
StringEntity postEntity = new StringEntity(data, "UTF-8");
|
||||
httpPost.addHeader("Content-Type", "text/xml");
|
||||
httpPost.addHeader("User-Agent", USER_AGENT + " " + config.getMchID());
|
||||
httpPost.setEntity(postEntity);
|
||||
|
||||
HttpResponse httpResponse = httpClient.execute(httpPost);
|
||||
HttpEntity httpEntity = httpResponse.getEntity();
|
||||
return EntityUtils.toString(httpEntity, "UTF-8");
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String request(String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean useCert, boolean autoReport) throws Exception {
|
||||
Exception exception = null;
|
||||
long elapsedTimeMillis = 0;
|
||||
long startTimestampMs = WXPayUtil.getCurrentTimestampMs();
|
||||
boolean firstHasDnsErr = false;
|
||||
boolean firstHasConnectTimeout = false;
|
||||
boolean firstHasReadTimeout = false;
|
||||
IWXPayDomain.DomainInfo domainInfo = config.getWXPayDomain().getDomain(config);
|
||||
if(domainInfo == null){
|
||||
throw new Exception("WXPayConfig.getWXPayDomain().getDomain() is empty or null");
|
||||
}
|
||||
try {
|
||||
String result = requestOnce(domainInfo.domain, urlSuffix, uuid, data, connectTimeoutMs, readTimeoutMs, useCert);
|
||||
elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
|
||||
config.getWXPayDomain().report(domainInfo.domain, elapsedTimeMillis, null);
|
||||
WXPayReport.getInstance(config).report(
|
||||
uuid,
|
||||
elapsedTimeMillis,
|
||||
domainInfo.domain,
|
||||
domainInfo.primaryDomain,
|
||||
connectTimeoutMs,
|
||||
readTimeoutMs,
|
||||
firstHasDnsErr,
|
||||
firstHasConnectTimeout,
|
||||
firstHasReadTimeout);
|
||||
return result;
|
||||
}
|
||||
catch (UnknownHostException ex) { // dns 解析错误,或域名不存在
|
||||
exception = ex;
|
||||
firstHasDnsErr = true;
|
||||
elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
|
||||
WXPayUtil.getLogger().warn("UnknownHostException for domainInfo {}", domainInfo);
|
||||
WXPayReport.getInstance(config).report(
|
||||
uuid,
|
||||
elapsedTimeMillis,
|
||||
domainInfo.domain,
|
||||
domainInfo.primaryDomain,
|
||||
connectTimeoutMs,
|
||||
readTimeoutMs,
|
||||
firstHasDnsErr,
|
||||
firstHasConnectTimeout,
|
||||
firstHasReadTimeout
|
||||
);
|
||||
}
|
||||
catch (ConnectTimeoutException ex) {
|
||||
exception = ex;
|
||||
firstHasConnectTimeout = true;
|
||||
elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
|
||||
WXPayUtil.getLogger().warn("connect timeout happened for domainInfo {}", domainInfo);
|
||||
WXPayReport.getInstance(config).report(
|
||||
uuid,
|
||||
elapsedTimeMillis,
|
||||
domainInfo.domain,
|
||||
domainInfo.primaryDomain,
|
||||
connectTimeoutMs,
|
||||
readTimeoutMs,
|
||||
firstHasDnsErr,
|
||||
firstHasConnectTimeout,
|
||||
firstHasReadTimeout
|
||||
);
|
||||
}
|
||||
catch (SocketTimeoutException ex) {
|
||||
exception = ex;
|
||||
firstHasReadTimeout = true;
|
||||
elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
|
||||
WXPayUtil.getLogger().warn("timeout happened for domainInfo {}", domainInfo);
|
||||
WXPayReport.getInstance(config).report(
|
||||
uuid,
|
||||
elapsedTimeMillis,
|
||||
domainInfo.domain,
|
||||
domainInfo.primaryDomain,
|
||||
connectTimeoutMs,
|
||||
readTimeoutMs,
|
||||
firstHasDnsErr,
|
||||
firstHasConnectTimeout,
|
||||
firstHasReadTimeout);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
exception = ex;
|
||||
elapsedTimeMillis = WXPayUtil.getCurrentTimestampMs()-startTimestampMs;
|
||||
WXPayReport.getInstance(config).report(
|
||||
uuid,
|
||||
elapsedTimeMillis,
|
||||
domainInfo.domain,
|
||||
domainInfo.primaryDomain,
|
||||
connectTimeoutMs,
|
||||
readTimeoutMs,
|
||||
firstHasDnsErr,
|
||||
firstHasConnectTimeout,
|
||||
firstHasReadTimeout);
|
||||
}
|
||||
config.getWXPayDomain().report(domainInfo.domain, elapsedTimeMillis, exception);
|
||||
throw exception;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 可重试的,非双向认证的请求
|
||||
* @param urlSuffix
|
||||
* @param uuid
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public String requestWithoutCert(String urlSuffix, String uuid, String data, boolean autoReport) throws Exception {
|
||||
return this.request(urlSuffix, uuid, data, config.getHttpConnectTimeoutMs(), config.getHttpReadTimeoutMs(), false, autoReport);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可重试的,非双向认证的请求
|
||||
* @param urlSuffix
|
||||
* @param uuid
|
||||
* @param data
|
||||
* @param connectTimeoutMs
|
||||
* @param readTimeoutMs
|
||||
* @return
|
||||
*/
|
||||
public String requestWithoutCert(String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean autoReport) throws Exception {
|
||||
return this.request(urlSuffix, uuid, data, connectTimeoutMs, readTimeoutMs, false, autoReport);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可重试的,双向认证的请求
|
||||
* @param urlSuffix
|
||||
* @param uuid
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public String requestWithCert(String urlSuffix, String uuid, String data, boolean autoReport) throws Exception {
|
||||
return this.request(urlSuffix, uuid, data, config.getHttpConnectTimeoutMs(), config.getHttpReadTimeoutMs(), true, autoReport);
|
||||
}
|
||||
|
||||
/**
|
||||
* 可重试的,双向认证的请求
|
||||
* @param urlSuffix
|
||||
* @param uuid
|
||||
* @param data
|
||||
* @param connectTimeoutMs
|
||||
* @param readTimeoutMs
|
||||
* @return
|
||||
*/
|
||||
public String requestWithCert(String urlSuffix, String uuid, String data, int connectTimeoutMs, int readTimeoutMs, boolean autoReport) throws Exception {
|
||||
return this.request(urlSuffix, uuid, data, connectTimeoutMs, readTimeoutMs, true, autoReport);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,295 @@
|
|||
package com.github.wxpay.sdk;
|
||||
|
||||
import com.github.wxpay.sdk.WXPayConstants.SignType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class WXPayUtil {
|
||||
|
||||
private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
private static final Random RANDOM = new SecureRandom();
|
||||
|
||||
/**
|
||||
* XML格式字符串转换为Map
|
||||
*
|
||||
* @param strXML XML字符串
|
||||
* @return XML数据转换后的Map
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Map<String, String> xmlToMap(String strXML) throws Exception {
|
||||
try {
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
DocumentBuilder documentBuilder = WXPayXmlUtil.newDocumentBuilder();
|
||||
InputStream stream = new ByteArrayInputStream(strXML.getBytes("UTF-8"));
|
||||
org.w3c.dom.Document doc = documentBuilder.parse(stream);
|
||||
doc.getDocumentElement().normalize();
|
||||
NodeList nodeList = doc.getDocumentElement().getChildNodes();
|
||||
for (int idx = 0; idx < nodeList.getLength(); ++idx) {
|
||||
Node node = nodeList.item(idx);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
org.w3c.dom.Element element = (org.w3c.dom.Element) node;
|
||||
data.put(element.getNodeName(), element.getTextContent());
|
||||
}
|
||||
}
|
||||
try {
|
||||
stream.close();
|
||||
} catch (Exception ex) {
|
||||
// do nothing
|
||||
}
|
||||
return data;
|
||||
} catch (Exception ex) {
|
||||
WXPayUtil.getLogger().warn("Invalid XML, can not convert to map. Error message: {}. XML content: {}", ex.getMessage(), strXML);
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Map转换为XML格式的字符串
|
||||
*
|
||||
* @param data Map类型数据
|
||||
* @return XML格式的字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String mapToXml(Map<String, String> data) throws Exception {
|
||||
org.w3c.dom.Document document = WXPayXmlUtil.newDocument();
|
||||
org.w3c.dom.Element root = document.createElement("xml");
|
||||
document.appendChild(root);
|
||||
for (String key: data.keySet()) {
|
||||
String value = data.get(key);
|
||||
if (value == null) {
|
||||
value = "";
|
||||
}
|
||||
value = value.trim();
|
||||
org.w3c.dom.Element filed = document.createElement(key);
|
||||
filed.appendChild(document.createTextNode(value));
|
||||
root.appendChild(filed);
|
||||
}
|
||||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Transformer transformer = tf.newTransformer();
|
||||
DOMSource source = new DOMSource(document);
|
||||
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
|
||||
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
StringWriter writer = new StringWriter();
|
||||
StreamResult result = new StreamResult(writer);
|
||||
transformer.transform(source, result);
|
||||
String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", "");
|
||||
try {
|
||||
writer.close();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成带有 sign 的 XML 格式字符串
|
||||
*
|
||||
* @param data Map类型数据
|
||||
* @param key API密钥
|
||||
* @return 含有sign字段的XML
|
||||
*/
|
||||
public static String generateSignedXml(final Map<String, String> data, String key) throws Exception {
|
||||
return generateSignedXml(data, key, SignType.MD5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成带有 sign 的 XML 格式字符串
|
||||
*
|
||||
* @param data Map类型数据
|
||||
* @param key API密钥
|
||||
* @param signType 签名类型
|
||||
* @return 含有sign字段的XML
|
||||
*/
|
||||
public static String generateSignedXml(final Map<String, String> data, String key, SignType signType) throws Exception {
|
||||
String sign = generateSignature(data, key, signType);
|
||||
data.put(WXPayConstants.FIELD_SIGN, sign);
|
||||
return mapToXml(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断签名是否正确
|
||||
*
|
||||
* @param xmlStr XML格式数据
|
||||
* @param key API密钥
|
||||
* @return 签名是否正确
|
||||
* @throws Exception
|
||||
*/
|
||||
public static boolean isSignatureValid(String xmlStr, String key) throws Exception {
|
||||
Map<String, String> data = xmlToMap(xmlStr);
|
||||
if (!data.containsKey(WXPayConstants.FIELD_SIGN) ) {
|
||||
return false;
|
||||
}
|
||||
String sign = data.get(WXPayConstants.FIELD_SIGN);
|
||||
return generateSignature(data, key).equals(sign);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断签名是否正确,必须包含sign字段,否则返回false。使用MD5签名。
|
||||
*
|
||||
* @param data Map类型数据
|
||||
* @param key API密钥
|
||||
* @return 签名是否正确
|
||||
* @throws Exception
|
||||
*/
|
||||
public static boolean isSignatureValid(Map<String, String> data, String key) throws Exception {
|
||||
return isSignatureValid(data, key, SignType.MD5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断签名是否正确,必须包含sign字段,否则返回false。
|
||||
*
|
||||
* @param data Map类型数据
|
||||
* @param key API密钥
|
||||
* @param signType 签名方式
|
||||
* @return 签名是否正确
|
||||
* @throws Exception
|
||||
*/
|
||||
public static boolean isSignatureValid(Map<String, String> data, String key, SignType signType) throws Exception {
|
||||
if (!data.containsKey(WXPayConstants.FIELD_SIGN) ) {
|
||||
return false;
|
||||
}
|
||||
String sign = data.get(WXPayConstants.FIELD_SIGN);
|
||||
return generateSignature(data, key, signType).equals(sign);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成签名
|
||||
*
|
||||
* @param data 待签名数据
|
||||
* @param key API密钥
|
||||
* @return 签名
|
||||
*/
|
||||
public static String generateSignature(final Map<String, String> data, String key) throws Exception {
|
||||
return generateSignature(data, key, SignType.MD5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成签名. 注意,若含有sign_type字段,必须和signType参数保持一致。
|
||||
*
|
||||
* @param data 待签名数据
|
||||
* @param key API密钥
|
||||
* @param signType 签名方式
|
||||
* @return 签名
|
||||
*/
|
||||
public static String generateSignature(final Map<String, String> data, String key, SignType signType) throws Exception {
|
||||
Set<String> keySet = data.keySet();
|
||||
String[] keyArray = keySet.toArray(new String[keySet.size()]);
|
||||
Arrays.sort(keyArray);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String k : keyArray) {
|
||||
if (k.equals(WXPayConstants.FIELD_SIGN)) {
|
||||
continue;
|
||||
}
|
||||
if (data.get(k).trim().length() > 0) // 参数值为空,则不参与签名
|
||||
sb.append(k).append("=").append(data.get(k).trim()).append("&");
|
||||
}
|
||||
sb.append("key=").append(key);
|
||||
if (SignType.MD5.equals(signType)) {
|
||||
return MD5(sb.toString()).toUpperCase();
|
||||
}
|
||||
else if (SignType.HMACSHA256.equals(signType)) {
|
||||
return HMACSHA256(sb.toString(), key);
|
||||
}
|
||||
else {
|
||||
throw new Exception(String.format("Invalid sign_type: %s", signType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取随机字符串 Nonce Str
|
||||
*
|
||||
* @return String 随机字符串
|
||||
*/
|
||||
public static String generateNonceStr() {
|
||||
char[] nonceChars = new char[32];
|
||||
for (int index = 0; index < nonceChars.length; ++index) {
|
||||
nonceChars[index] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length()));
|
||||
}
|
||||
return new String(nonceChars);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成 MD5
|
||||
*
|
||||
* @param data 待处理数据
|
||||
* @return MD5结果
|
||||
*/
|
||||
public static String MD5(String data) throws Exception {
|
||||
java.security.MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
byte[] array = md.digest(data.getBytes("UTF-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte item : array) {
|
||||
sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
|
||||
}
|
||||
return sb.toString().toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 HMACSHA256
|
||||
* @param data 待处理数据
|
||||
* @param key 密钥
|
||||
* @return 加密结果
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String HMACSHA256(String data, String key) throws Exception {
|
||||
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
|
||||
sha256_HMAC.init(secret_key);
|
||||
byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte item : array) {
|
||||
sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
|
||||
}
|
||||
return sb.toString().toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志
|
||||
* @return
|
||||
*/
|
||||
public static Logger getLogger() {
|
||||
Logger logger = LoggerFactory.getLogger("wxpay java sdk");
|
||||
return logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间戳,单位秒
|
||||
* @return
|
||||
*/
|
||||
public static long getCurrentTimestamp() {
|
||||
return System.currentTimeMillis()/1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间戳,单位毫秒
|
||||
* @return
|
||||
*/
|
||||
public static long getCurrentTimestampMs() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.github.wxpay.sdk;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
/**
|
||||
* 2018/7/3
|
||||
*/
|
||||
public final class WXPayXmlUtil {
|
||||
public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
|
||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
||||
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
documentBuilderFactory.setXIncludeAware(false);
|
||||
documentBuilderFactory.setExpandEntityReferences(false);
|
||||
|
||||
return documentBuilderFactory.newDocumentBuilder();
|
||||
}
|
||||
|
||||
public static Document newDocument() throws ParserConfigurationException {
|
||||
return newDocumentBuilder().newDocument();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
|
@ -0,0 +1,363 @@
|
|||
<?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>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.6.0</version>
|
||||
|
||||
<name>ruoyi</name>
|
||||
<url>http://www.ruoyi.vip</url>
|
||||
<description>若依管理系统</description>
|
||||
|
||||
<properties>
|
||||
<ruoyi.version>3.6.0</ruoyi.version>
|
||||
<wxsdk.version>3.0.9</wxsdk.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>
|
||||
<druid.version>1.2.6</druid.version>
|
||||
<bitwalker.version>1.21</bitwalker.version>
|
||||
<swagger.version>3.0.0</swagger.version>
|
||||
<kaptcha.version>2.3.2</kaptcha.version>
|
||||
<mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version>
|
||||
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
|
||||
<fastjson.version>1.2.76</fastjson.version>
|
||||
<oshi.version>5.8.0</oshi.version>
|
||||
<jna.version>5.8.0</jna.version>
|
||||
<commons.io.version>2.11.0</commons.io.version>
|
||||
<commons.fileupload.version>1.4</commons.fileupload.version>
|
||||
<commons.collections.version>3.2.2</commons.collections.version>
|
||||
<poi.version>4.1.2</poi.version>
|
||||
<velocity.version>1.7</velocity.version>
|
||||
<jwt.version>0.9.1</jwt.version>
|
||||
<alipay.version>4.8.10.ALL</alipay.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- 生成二维码的jar -->
|
||||
<!-- https://mvnrepository.com/artifact/com.google.zxing/core -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>${alipay.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<groupId>com.alibaba</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk16</artifactId>
|
||||
<version>1.46</version>
|
||||
</dependency>
|
||||
<!--dom4j -->
|
||||
<dependency>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>1.6.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--腾讯云短信-->
|
||||
<dependency>
|
||||
<groupId>com.github.qcloudsms</groupId>
|
||||
<artifactId>qcloudsms</artifactId>
|
||||
<version>1.0.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
<version>4.0.6</version> <!-- 注:如提示报错,先升级基础包版,无法解决可联系技术支持 -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
<!--腾讯云OSS-->
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
<artifactId>cos_api</artifactId>
|
||||
<version>5.6.8</version>
|
||||
</dependency>
|
||||
<!-- 阿里云OSS -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
<!--lombok-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.projectlombok</groupId>-->
|
||||
<!-- <artifactId>lombok</artifactId>-->
|
||||
<!-- <version>1.18.12</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- 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>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>
|
||||
|
||||
<!-- Swagger3依赖 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</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>
|
||||
|
||||
<!-- collections工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>${commons.collections.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Token生成与解析-->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>${jwt.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 验证码 -->
|
||||
<dependency>
|
||||
<groupId>com.github.penggle</groupId>
|
||||
<artifactId>kaptcha</artifactId>
|
||||
<version>${kaptcha.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-quartz</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- segchk服务层-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-segchk</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- segchk接口层-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-segchk-web</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.wxpay</groupId>
|
||||
<artifactId>wxpay-sdk</artifactId>
|
||||
<version>${wxsdk.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<modules>
|
||||
<module>ruoyi-segchk</module>
|
||||
<module>ruoyi-segchk-web</module>
|
||||
<module>ruoyi-admin</module>
|
||||
<module>ruoyi-framework</module>
|
||||
<module>ruoyi-system</module>
|
||||
<module>ruoyi-quartz</module>
|
||||
<module>ruoyi-generator</module>
|
||||
<module>ruoyi-common</module>
|
||||
|
||||
<!-- 加入微信sdk-->
|
||||
<module>wxpay-sdk</module>
|
||||
</modules>
|
||||
|
||||
|
||||
|
||||
<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>
|
||||
<meminitial>512m</meminitial>
|
||||
<maxmem>1048m</maxmem>
|
||||
</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,281 @@
|
|||
<?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>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<version>3.6.0</version>
|
||||
|
||||
<name>ruoyi</name>
|
||||
<url>http://www.ruoyi.vip</url>
|
||||
<description>若依管理系统</description>
|
||||
|
||||
<properties>
|
||||
<ruoyi.version>3.6.0</ruoyi.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>
|
||||
<druid.version>1.2.6</druid.version>
|
||||
<bitwalker.version>1.21</bitwalker.version>
|
||||
<swagger.version>3.0.0</swagger.version>
|
||||
<kaptcha.version>2.3.2</kaptcha.version>
|
||||
<mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version>
|
||||
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
|
||||
<fastjson.version>1.2.76</fastjson.version>
|
||||
<oshi.version>5.8.0</oshi.version>
|
||||
<jna.version>5.8.0</jna.version>
|
||||
<commons.io.version>2.11.0</commons.io.version>
|
||||
<commons.fileupload.version>1.4</commons.fileupload.version>
|
||||
<commons.collections.version>3.2.2</commons.collections.version>
|
||||
<poi.version>4.1.2</poi.version>
|
||||
<velocity.version>1.7</velocity.version>
|
||||
<jwt.version>0.9.1</jwt.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>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>
|
||||
|
||||
<!-- Swagger3依赖 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</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>
|
||||
|
||||
<!-- collections工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>${commons.collections.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Token生成与解析-->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>${jwt.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 验证码 -->
|
||||
<dependency>
|
||||
<groupId>com.github.penggle</groupId>
|
||||
<artifactId>kaptcha</artifactId>
|
||||
<version>${kaptcha.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-quartz</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- segchk服务层-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-segchk</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- segchk接口层-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-segchk-web</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<modules>
|
||||
<module>ruoyi-segchk</module>
|
||||
<module>ruoyi-segchk-web</module>
|
||||
<module>ruoyi-admin</module>
|
||||
<module>ruoyi-framework</module>
|
||||
<module>ruoyi-system</module>
|
||||
<module>ruoyi-quartz</module>
|
||||
<module>ruoyi-generator</module>
|
||||
<module>ruoyi-common</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,320 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<version>3.0.0</version>
|
||||
|
||||
<name>ruoyi</name>
|
||||
<url>http://www.ruoyi.vip</url>
|
||||
<description>魔金商城平台管理</description>
|
||||
|
||||
<properties>
|
||||
<ruoyi.version>3.0.0</ruoyi.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<mybatis.boot.version>1.3.2</mybatis.boot.version>
|
||||
<druid.version>1.1.14</druid.version>
|
||||
<bitwalker.version>1.19</bitwalker.version>
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
<pagehelper.boot.version>1.2.5</pagehelper.boot.version>
|
||||
<fastjson.version>1.2.70</fastjson.version>
|
||||
<oshi.version>3.9.1</oshi.version>
|
||||
<commons.io.version>2.5</commons.io.version>
|
||||
<commons.fileupload.version>1.3.3</commons.fileupload.version>
|
||||
<poi.version>3.17</poi.version>
|
||||
<velocity.version>1.7</velocity.version>
|
||||
<jwt.version>0.9.0</jwt.version>
|
||||
<alipay.version>4.8.10.ALL</alipay.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- 生成二维码的jar -->
|
||||
<!-- https://mvnrepository.com/artifact/com.google.zxing/core -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>${alipay.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<groupId>com.alibaba</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk16</artifactId>
|
||||
<version>1.46</version>
|
||||
</dependency>
|
||||
<!--dom4j -->
|
||||
<dependency>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>1.6.1</version>
|
||||
</dependency>
|
||||
<!--腾讯云短信-->
|
||||
<dependency>
|
||||
<groupId>com.github.qcloudsms</groupId>
|
||||
<artifactId>qcloudsms</artifactId>
|
||||
<version>1.0.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
<version>4.0.6</version> <!-- 注:如提示报错,先升级基础包版,无法解决可联系技术支持 -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
<!--腾讯云OSS-->
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
<artifactId>cos_api</artifactId>
|
||||
<version>5.6.8</version>
|
||||
</dependency>
|
||||
<!-- 阿里云OSS -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
<!--lombok-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.12</version>
|
||||
</dependency>
|
||||
<!--swagger2 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<!-- SpringBoot的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>2.1.1.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>eu.bitwalker</groupId>
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
<version>${bitwalker.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>
|
||||
|
||||
<!-- 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>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--Token生成与解析-->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>${jwt.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-quartz</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-mall</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<modules>
|
||||
<module>ruoyi-store</module>
|
||||
<!-- <module>ruoyi-web</module>-->
|
||||
<module>ruoyi-web</module>
|
||||
<module>ruoyi-admin</module>
|
||||
<module>ruoyi-framework</module>
|
||||
|
||||
<module>ruoyi-system</module>
|
||||
<module>ruoyi-mall</module>
|
||||
<module>ruoyi-quartz</module>
|
||||
<module>ruoyi-generator</module>
|
||||
<module>ruoyi-common</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,98 @@
|
|||
<?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>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.6.0</version>
|
||||
<!-- <relativePath>../pom.xml</relativePath>-->
|
||||
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>ruoyi-admin</artifactId>
|
||||
|
||||
<description>
|
||||
web服务入口
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- swagger3-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-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.1.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.ruoyi;
|
||||
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
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 RuoYiApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// 第一个参数为账户名 第二个参数为密码 第三个参数为盐对应用户表salt(如果没有可以不用填)
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(RuoYiApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.ruoyi;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
||||
{
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||
{
|
||||
return application.sources(RuoYiApplication.class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
package com.ruoyi.security;
|
||||
|
||||
import com.ruoyi.security.filter.JwtAuthenticationTokenFilter;
|
||||
import com.ruoyi.security.handle.AuthenticationEntryPointImpl;
|
||||
import com.ruoyi.security.handle.LogoutSuccessHandlerImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
|
||||
/**
|
||||
* spring security配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
/**
|
||||
* 自定义用户认证逻辑
|
||||
*/
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
/**
|
||||
* 认证失败处理类
|
||||
*/
|
||||
@Autowired
|
||||
private AuthenticationEntryPointImpl unauthorizedHandler;
|
||||
|
||||
/**
|
||||
* 退出处理类
|
||||
*/
|
||||
@Autowired
|
||||
private LogoutSuccessHandlerImpl logoutSuccessHandler;
|
||||
|
||||
/**
|
||||
* token认证过滤器
|
||||
*/
|
||||
@Autowired
|
||||
private JwtAuthenticationTokenFilter authenticationTokenFilter;
|
||||
|
||||
/**
|
||||
* 解决 无法直接注入 AuthenticationManager
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Bean
|
||||
@Override
|
||||
public AuthenticationManager authenticationManagerBean() throws Exception {
|
||||
return super.authenticationManagerBean();
|
||||
}
|
||||
|
||||
/**
|
||||
* anyRequest | 匹配所有请求路径
|
||||
* access | SpringEl表达式结果为true时可以访问
|
||||
* anonymous | 匿名可以访问
|
||||
* denyAll | 用户不能访问
|
||||
* fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录)
|
||||
* hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问
|
||||
* hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问
|
||||
*
|
||||
* @ss.hasPermi | 如果有参数,参数表示权限,则其权限可以访问
|
||||
* hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问
|
||||
* hasRole | 如果有参数,参数表示角色,则其角色可以访问
|
||||
* permitAll | 用户可以任意访问
|
||||
* rememberMe | 允许通过remember-me登录的用户访问
|
||||
* authenticated | 用户登录后可访问
|
||||
*/
|
||||
@Override
|
||||
protected void configure(HttpSecurity httpSecurity) throws Exception {
|
||||
httpSecurity
|
||||
// CRSF禁用,因为不使用session
|
||||
.csrf().disable()
|
||||
// 认证失败处理类
|
||||
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
|
||||
// 基于token,所以不需要session
|
||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
|
||||
// 过滤请求
|
||||
.authorizeRequests()
|
||||
// 对于登录login 验证码captchaImage 允许匿名访问
|
||||
.antMatchers("/login", "/captchaImage").anonymous()
|
||||
.antMatchers(
|
||||
HttpMethod.GET,
|
||||
"/*.html",
|
||||
"/**/*.html",
|
||||
"/**/*.css",
|
||||
"/**/*.js"
|
||||
).permitAll()
|
||||
.antMatchers("/profile/**").anonymous()
|
||||
.antMatchers("/common/download**").anonymous()
|
||||
.antMatchers("/common/download/resource**").anonymous()
|
||||
.antMatchers("/swagger-ui.html").anonymous()
|
||||
.antMatchers("/swagger-resources/**").anonymous()
|
||||
.antMatchers("/webjars/**").anonymous()
|
||||
.antMatchers("/*/api-docs").anonymous()
|
||||
.antMatchers("/druid/**").anonymous()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.headers().frameOptions().disable();
|
||||
httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
|
||||
// 添加JWT filter
|
||||
httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 强散列哈希加密实现
|
||||
*/
|
||||
@Bean
|
||||
public BCryptPasswordEncoder bCryptPasswordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 身份认证接口
|
||||
*/
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.ruoyi.security.filter;
|
||||
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* token过滤器 验证token有效性
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
||||
throws ServletException, IOException {
|
||||
logger.debug(request.getRequestURI());
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
|
||||
tokenService.verifyToken(loginUser);
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
|
||||
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
||||
}
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.ruoyi.security.handle;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 认证失败处理类 返回未授权
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable {
|
||||
private static final long serialVersionUID = -8970718410437077606L;
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e)
|
||||
throws IOException {
|
||||
int code = HttpStatus.UNAUTHORIZED;
|
||||
String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI());
|
||||
ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg)));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.ruoyi.security.handle;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 自定义退出处理类 返回成功
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler {
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 退出处理
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
|
||||
throws IOException, ServletException {
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
if (StringUtils.isNotNull(loginUser)) {
|
||||
String userName = loginUser.getUsername();
|
||||
// 删除用户缓存记录
|
||||
tokenService.delLoginUser(loginUser.getToken());
|
||||
// 记录用户退出日志
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功"));
|
||||
}
|
||||
ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(HttpStatus.SUCCESS, "退出成功")));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
package com.ruoyi.security.web.domain;
|
||||
|
||||
import com.ruoyi.common.utils.Arith;
|
||||
import com.ruoyi.common.utils.ip.IpUtils;
|
||||
import com.ruoyi.security.web.domain.server.*;
|
||||
import oshi.SystemInfo;
|
||||
import oshi.hardware.CentralProcessor;
|
||||
import oshi.hardware.CentralProcessor.TickType;
|
||||
import oshi.hardware.GlobalMemory;
|
||||
import oshi.hardware.HardwareAbstractionLayer;
|
||||
import oshi.software.os.FileSystem;
|
||||
import oshi.software.os.OSFileStore;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
import oshi.util.Util;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* 服务器相关信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class Server {
|
||||
private static final int OSHI_WAIT_SECOND = 1000;
|
||||
|
||||
/**
|
||||
* CPU相关信息
|
||||
*/
|
||||
private Cpu cpu = new Cpu();
|
||||
|
||||
/**
|
||||
* 內存相关信息
|
||||
*/
|
||||
private Mem mem = new Mem();
|
||||
|
||||
/**
|
||||
* JVM相关信息
|
||||
*/
|
||||
private Jvm jvm = new Jvm();
|
||||
|
||||
/**
|
||||
* 服务器相关信息
|
||||
*/
|
||||
private Sys sys = new Sys();
|
||||
|
||||
/**
|
||||
* 磁盘相关信息
|
||||
*/
|
||||
private List<SysFile> sysFiles = new LinkedList<SysFile>();
|
||||
|
||||
public Cpu getCpu() {
|
||||
return cpu;
|
||||
}
|
||||
|
||||
public void setCpu(Cpu cpu) {
|
||||
this.cpu = cpu;
|
||||
}
|
||||
|
||||
public Mem getMem() {
|
||||
return mem;
|
||||
}
|
||||
|
||||
public void setMem(Mem mem) {
|
||||
this.mem = mem;
|
||||
}
|
||||
|
||||
public Jvm getJvm() {
|
||||
return jvm;
|
||||
}
|
||||
|
||||
public void setJvm(Jvm jvm) {
|
||||
this.jvm = jvm;
|
||||
}
|
||||
|
||||
public Sys getSys() {
|
||||
return sys;
|
||||
}
|
||||
|
||||
public void setSys(Sys sys) {
|
||||
this.sys = sys;
|
||||
}
|
||||
|
||||
public List<SysFile> getSysFiles() {
|
||||
return sysFiles;
|
||||
}
|
||||
|
||||
public void setSysFiles(List<SysFile> sysFiles) {
|
||||
this.sysFiles = sysFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置磁盘信息
|
||||
*/
|
||||
private void setSysFiles(OperatingSystem os) {
|
||||
FileSystem fileSystem = os.getFileSystem();
|
||||
OSFileStore[] fsArray = fileSystem.getFileStores().toArray(new OSFileStore[0]);
|
||||
for (OSFileStore fs : fsArray) {
|
||||
long free = fs.getUsableSpace();
|
||||
long total = fs.getTotalSpace();
|
||||
long used = total - free;
|
||||
SysFile sysFile = new SysFile();
|
||||
sysFile.setDirName(fs.getMount());
|
||||
sysFile.setSysTypeName(fs.getType());
|
||||
sysFile.setTypeName(fs.getName());
|
||||
sysFile.setTotal(convertFileSize(total));
|
||||
sysFile.setFree(convertFileSize(free));
|
||||
sysFile.setUsed(convertFileSize(used));
|
||||
sysFile.setUsage(Arith.mul(Arith.div(used, total, 4), 100));
|
||||
sysFiles.add(sysFile);
|
||||
}
|
||||
}
|
||||
|
||||
public void copyTo() throws Exception {
|
||||
SystemInfo si = new SystemInfo();
|
||||
HardwareAbstractionLayer hal = si.getHardware();
|
||||
|
||||
setCpuInfo(hal.getProcessor());
|
||||
|
||||
setMemInfo(hal.getMemory());
|
||||
|
||||
setSysInfo();
|
||||
|
||||
setJvmInfo();
|
||||
|
||||
setSysFiles(si.getOperatingSystem());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置CPU信息
|
||||
*/
|
||||
private void setCpuInfo(CentralProcessor processor) {
|
||||
// CPU信息
|
||||
long[] prevTicks = processor.getSystemCpuLoadTicks();
|
||||
Util.sleep(OSHI_WAIT_SECOND);
|
||||
long[] ticks = processor.getSystemCpuLoadTicks();
|
||||
long nice = ticks[TickType.NICE.getIndex()] - prevTicks[TickType.NICE.getIndex()];
|
||||
long irq = ticks[TickType.IRQ.getIndex()] - prevTicks[TickType.IRQ.getIndex()];
|
||||
long softirq = ticks[TickType.SOFTIRQ.getIndex()] - prevTicks[TickType.SOFTIRQ.getIndex()];
|
||||
long steal = ticks[TickType.STEAL.getIndex()] - prevTicks[TickType.STEAL.getIndex()];
|
||||
long cSys = ticks[TickType.SYSTEM.getIndex()] - prevTicks[TickType.SYSTEM.getIndex()];
|
||||
long user = ticks[TickType.USER.getIndex()] - prevTicks[TickType.USER.getIndex()];
|
||||
long iowait = ticks[TickType.IOWAIT.getIndex()] - prevTicks[TickType.IOWAIT.getIndex()];
|
||||
long idle = ticks[TickType.IDLE.getIndex()] - prevTicks[TickType.IDLE.getIndex()];
|
||||
long totalCpu = user + nice + cSys + idle + iowait + irq + softirq + steal;
|
||||
cpu.setCpuNum(processor.getLogicalProcessorCount());
|
||||
cpu.setTotal(totalCpu);
|
||||
cpu.setSys(cSys);
|
||||
cpu.setUsed(user);
|
||||
cpu.setWait(iowait);
|
||||
cpu.setFree(idle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置内存信息
|
||||
*/
|
||||
private void setMemInfo(GlobalMemory memory) {
|
||||
mem.setTotal(memory.getTotal());
|
||||
mem.setUsed(memory.getTotal() - memory.getAvailable());
|
||||
mem.setFree(memory.getAvailable());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置服务器信息
|
||||
*/
|
||||
private void setSysInfo() {
|
||||
Properties props = System.getProperties();
|
||||
sys.setComputerName(IpUtils.getHostName());
|
||||
sys.setComputerIp(IpUtils.getHostIp());
|
||||
sys.setOsName(props.getProperty("os.name"));
|
||||
sys.setOsArch(props.getProperty("os.arch"));
|
||||
sys.setUserDir(props.getProperty("user.dir"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置Java虚拟机
|
||||
*/
|
||||
private void setJvmInfo() throws UnknownHostException {
|
||||
Properties props = System.getProperties();
|
||||
jvm.setTotal(Runtime.getRuntime().totalMemory());
|
||||
jvm.setMax(Runtime.getRuntime().maxMemory());
|
||||
jvm.setFree(Runtime.getRuntime().freeMemory());
|
||||
jvm.setVersion(props.getProperty("java.version"));
|
||||
jvm.setHome(props.getProperty("java.home"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 字节转换
|
||||
*
|
||||
* @param size 字节大小
|
||||
* @return 转换后值
|
||||
*/
|
||||
public String convertFileSize(long size) {
|
||||
long kb = 1024;
|
||||
long mb = kb * 1024;
|
||||
long gb = mb * 1024;
|
||||
if (size >= gb) {
|
||||
return String.format("%.1f GB", (float) size / gb);
|
||||
} else if (size >= mb) {
|
||||
float f = (float) size / mb;
|
||||
return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f);
|
||||
} else if (size >= kb) {
|
||||
float f = (float) size / kb;
|
||||
return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f);
|
||||
} else {
|
||||
return String.format("%d B", size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.ruoyi.security.web.domain.server;
|
||||
|
||||
import com.ruoyi.common.utils.Arith;
|
||||
|
||||
/**
|
||||
* CPU相关信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class Cpu {
|
||||
/**
|
||||
* 核心数
|
||||
*/
|
||||
private int cpuNum;
|
||||
|
||||
/**
|
||||
* CPU总的使用率
|
||||
*/
|
||||
private double total;
|
||||
|
||||
/**
|
||||
* CPU系统使用率
|
||||
*/
|
||||
private double sys;
|
||||
|
||||
/**
|
||||
* CPU用户使用率
|
||||
*/
|
||||
private double used;
|
||||
|
||||
/**
|
||||
* CPU当前等待率
|
||||
*/
|
||||
private double wait;
|
||||
|
||||
/**
|
||||
* CPU当前空闲率
|
||||
*/
|
||||
private double free;
|
||||
|
||||
public int getCpuNum() {
|
||||
return cpuNum;
|
||||
}
|
||||
|
||||
public void setCpuNum(int cpuNum) {
|
||||
this.cpuNum = cpuNum;
|
||||
}
|
||||
|
||||
public double getTotal() {
|
||||
return Arith.round(Arith.mul(total, 100), 2);
|
||||
}
|
||||
|
||||
public void setTotal(double total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public double getSys() {
|
||||
return Arith.round(Arith.mul(sys / total, 100), 2);
|
||||
}
|
||||
|
||||
public void setSys(double sys) {
|
||||
this.sys = sys;
|
||||
}
|
||||
|
||||
public double getUsed() {
|
||||
return Arith.round(Arith.mul(used / total, 100), 2);
|
||||
}
|
||||
|
||||
public void setUsed(double used) {
|
||||
this.used = used;
|
||||
}
|
||||
|
||||
public double getWait() {
|
||||
return Arith.round(Arith.mul(wait / total, 100), 2);
|
||||
}
|
||||
|
||||
public void setWait(double wait) {
|
||||
this.wait = wait;
|
||||
}
|
||||
|
||||
public double getFree() {
|
||||
return Arith.round(Arith.mul(free / total, 100), 2);
|
||||
}
|
||||
|
||||
public void setFree(double free) {
|
||||
this.free = free;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.ruoyi.security.web.domain.server;
|
||||
|
||||
import com.ruoyi.common.utils.Arith;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
/**
|
||||
* JVM相关信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class Jvm {
|
||||
/**
|
||||
* 当前JVM占用的内存总数(M)
|
||||
*/
|
||||
private double total;
|
||||
|
||||
/**
|
||||
* JVM最大可用内存总数(M)
|
||||
*/
|
||||
private double max;
|
||||
|
||||
/**
|
||||
* JVM空闲内存(M)
|
||||
*/
|
||||
private double free;
|
||||
|
||||
/**
|
||||
* JDK版本
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* JDK路径
|
||||
*/
|
||||
private String home;
|
||||
|
||||
public double getTotal() {
|
||||
return Arith.div(total, (1024 * 1024), 2);
|
||||
}
|
||||
|
||||
public void setTotal(double total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public double getMax() {
|
||||
return Arith.div(max, (1024 * 1024), 2);
|
||||
}
|
||||
|
||||
public void setMax(double max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public double getFree() {
|
||||
return Arith.div(free, (1024 * 1024), 2);
|
||||
}
|
||||
|
||||
public void setFree(double free) {
|
||||
this.free = free;
|
||||
}
|
||||
|
||||
public double getUsed() {
|
||||
return Arith.div(total - free, (1024 * 1024), 2);
|
||||
}
|
||||
|
||||
public double getUsage() {
|
||||
return Arith.mul(Arith.div(total - free, total, 4), 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取JDK名称
|
||||
*/
|
||||
public String getName() {
|
||||
return ManagementFactory.getRuntimeMXBean().getVmName();
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getHome() {
|
||||
return home;
|
||||
}
|
||||
|
||||
public void setHome(String home) {
|
||||
this.home = home;
|
||||
}
|
||||
|
||||
/**
|
||||
* JDK启动时间
|
||||
*/
|
||||
public String getStartTime() {
|
||||
return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getServerStartDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* JDK运行时间
|
||||
*/
|
||||
public String getRunTime() {
|
||||
return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.ruoyi.security.web.domain.server;
|
||||
|
||||
import com.ruoyi.common.utils.Arith;
|
||||
|
||||
/**
|
||||
* 內存相关信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class Mem {
|
||||
/**
|
||||
* 内存总量
|
||||
*/
|
||||
private double total;
|
||||
|
||||
/**
|
||||
* 已用内存
|
||||
*/
|
||||
private double used;
|
||||
|
||||
/**
|
||||
* 剩余内存
|
||||
*/
|
||||
private double free;
|
||||
|
||||
public double getTotal() {
|
||||
return Arith.div(total, (1024 * 1024 * 1024), 2);
|
||||
}
|
||||
|
||||
public void setTotal(long total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public double getUsed() {
|
||||
return Arith.div(used, (1024 * 1024 * 1024), 2);
|
||||
}
|
||||
|
||||
public void setUsed(long used) {
|
||||
this.used = used;
|
||||
}
|
||||
|
||||
public double getFree() {
|
||||
return Arith.div(free, (1024 * 1024 * 1024), 2);
|
||||
}
|
||||
|
||||
public void setFree(long free) {
|
||||
this.free = free;
|
||||
}
|
||||
|
||||
public double getUsage() {
|
||||
return Arith.mul(Arith.div(used, total, 4), 100);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.ruoyi.security.web.domain.server;
|
||||
|
||||
/**
|
||||
* 系统相关信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class Sys {
|
||||
/**
|
||||
* 服务器名称
|
||||
*/
|
||||
private String computerName;
|
||||
|
||||
/**
|
||||
* 服务器Ip
|
||||
*/
|
||||
private String computerIp;
|
||||
|
||||
/**
|
||||
* 项目路径
|
||||
*/
|
||||
private String userDir;
|
||||
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
private String osName;
|
||||
|
||||
/**
|
||||
* 系统架构
|
||||
*/
|
||||
private String osArch;
|
||||
|
||||
public String getComputerName() {
|
||||
return computerName;
|
||||
}
|
||||
|
||||
public void setComputerName(String computerName) {
|
||||
this.computerName = computerName;
|
||||
}
|
||||
|
||||
public String getComputerIp() {
|
||||
return computerIp;
|
||||
}
|
||||
|
||||
public void setComputerIp(String computerIp) {
|
||||
this.computerIp = computerIp;
|
||||
}
|
||||
|
||||
public String getUserDir() {
|
||||
return userDir;
|
||||
}
|
||||
|
||||
public void setUserDir(String userDir) {
|
||||
this.userDir = userDir;
|
||||
}
|
||||
|
||||
public String getOsName() {
|
||||
return osName;
|
||||
}
|
||||
|
||||
public void setOsName(String osName) {
|
||||
this.osName = osName;
|
||||
}
|
||||
|
||||
public String getOsArch() {
|
||||
return osArch;
|
||||
}
|
||||
|
||||
public void setOsArch(String osArch) {
|
||||
this.osArch = osArch;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package com.ruoyi.security.web.domain.server;
|
||||
|
||||
/**
|
||||
* 系统文件相关信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class SysFile {
|
||||
/**
|
||||
* 盘符路径
|
||||
*/
|
||||
private String dirName;
|
||||
|
||||
/**
|
||||
* 盘符类型
|
||||
*/
|
||||
private String sysTypeName;
|
||||
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 总大小
|
||||
*/
|
||||
private String total;
|
||||
|
||||
/**
|
||||
* 剩余大小
|
||||
*/
|
||||
private String free;
|
||||
|
||||
/**
|
||||
* 已经使用量
|
||||
*/
|
||||
private String used;
|
||||
|
||||
/**
|
||||
* 资源的使用率
|
||||
*/
|
||||
private double usage;
|
||||
|
||||
public String getDirName() {
|
||||
return dirName;
|
||||
}
|
||||
|
||||
public void setDirName(String dirName) {
|
||||
this.dirName = dirName;
|
||||
}
|
||||
|
||||
public String getSysTypeName() {
|
||||
return sysTypeName;
|
||||
}
|
||||
|
||||
public void setSysTypeName(String sysTypeName) {
|
||||
this.sysTypeName = sysTypeName;
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public void setTypeName(String typeName) {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public String getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(String total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public String getFree() {
|
||||
return free;
|
||||
}
|
||||
|
||||
public void setFree(String free) {
|
||||
this.free = free;
|
||||
}
|
||||
|
||||
public String getUsed() {
|
||||
return used;
|
||||
}
|
||||
|
||||
public void setUsed(String used) {
|
||||
this.used = used;
|
||||
}
|
||||
|
||||
public double getUsage() {
|
||||
return usage;
|
||||
}
|
||||
|
||||
public void setUsage(double usage) {
|
||||
this.usage = usage;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.ruoyi.security.web.exception;
|
||||
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.common.exception.DemoModeException;
|
||||
import com.ruoyi.common.exception.base.BaseException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.authentication.AccountExpiredException;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
/**
|
||||
* 全局异常处理器
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
/**
|
||||
* 基础异常
|
||||
*/
|
||||
@ExceptionHandler(BaseException.class)
|
||||
public AjaxResult baseException(BaseException e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*/
|
||||
@ExceptionHandler(CustomException.class)
|
||||
public AjaxResult businessException(CustomException e) {
|
||||
if (StringUtils.isNull(e.getCode())) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.error(e.getCode(), e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(NoHandlerFoundException.class)
|
||||
public AjaxResult handlerNoFoundException(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return AjaxResult.error(HttpStatus.NOT_FOUND, "路径不存在,请检查路径是否正确");
|
||||
}
|
||||
|
||||
@ExceptionHandler(AccessDeniedException.class)
|
||||
public AjaxResult handleAuthorizationException(AccessDeniedException e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权");
|
||||
}
|
||||
|
||||
@ExceptionHandler(AccountExpiredException.class)
|
||||
public AjaxResult handleAccountExpiredException(AccountExpiredException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(UsernameNotFoundException.class)
|
||||
public AjaxResult handleUsernameNotFoundException(UsernameNotFoundException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public AjaxResult handleException(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义验证异常
|
||||
*/
|
||||
@ExceptionHandler(BindException.class)
|
||||
public AjaxResult validatedBindException(BindException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
String message = e.getAllErrors().get(0).getDefaultMessage();
|
||||
return AjaxResult.error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义验证异常
|
||||
*/
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
public Object validExceptionHandler(MethodArgumentNotValidException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
String message = e.getBindingResult().getFieldError().getDefaultMessage();
|
||||
return AjaxResult.error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示模式异常
|
||||
*/
|
||||
@ExceptionHandler(DemoModeException.class)
|
||||
public AjaxResult demoModeException(DemoModeException e) {
|
||||
return AjaxResult.error("演示模式,不允许操作");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
package com.ruoyi.security.web.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* RuoYi首创 自定义权限实现,ss取自SpringSecurity首字母
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service("ss")
|
||||
public class PermissionService {
|
||||
/**
|
||||
* 所有权限标识
|
||||
*/
|
||||
private static final String ALL_PERMISSION = "*:*:*";
|
||||
|
||||
/**
|
||||
* 管理员角色权限标识
|
||||
*/
|
||||
private static final String SUPER_ADMIN = "admin";
|
||||
|
||||
private static final String ROLE_DELIMETER = ",";
|
||||
|
||||
private static final String PERMISSION_DELIMETER = ",";
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 验证用户是否具备某权限
|
||||
*
|
||||
* @param permission 权限字符串
|
||||
* @return 用户是否具备某权限
|
||||
*/
|
||||
public boolean hasPermi(String permission) {
|
||||
if (StringUtils.isEmpty(permission)) {
|
||||
return false;
|
||||
}
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) {
|
||||
return false;
|
||||
}
|
||||
return hasPermissions(loginUser.getPermissions(), permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用户是否不具备某权限,与 hasPermi逻辑相反
|
||||
*
|
||||
* @param permission 权限字符串
|
||||
* @return 用户是否不具备某权限
|
||||
*/
|
||||
public boolean lacksPermi(String permission) {
|
||||
return hasPermi(permission) != true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用户是否具有以下任意一个权限
|
||||
*
|
||||
* @param permissions 以 PERMISSION_NAMES_DELIMETER 为分隔符的权限列表
|
||||
* @return 用户是否具有以下任意一个权限
|
||||
*/
|
||||
public boolean hasAnyPermi(String permissions) {
|
||||
if (StringUtils.isEmpty(permissions)) {
|
||||
return false;
|
||||
}
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) {
|
||||
return false;
|
||||
}
|
||||
Set<String> authorities = loginUser.getPermissions();
|
||||
for (String permission : permissions.split(PERMISSION_DELIMETER)) {
|
||||
if (permission != null && hasPermissions(authorities, permission)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户是否拥有某个角色
|
||||
*
|
||||
* @param role 角色字符串
|
||||
* @return 用户是否具备某角色
|
||||
*/
|
||||
public boolean hasRole(String role) {
|
||||
if (StringUtils.isEmpty(role)) {
|
||||
return false;
|
||||
}
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) {
|
||||
return false;
|
||||
}
|
||||
for (SysRole sysRole : loginUser.getUser().getRoles()) {
|
||||
String roleKey = sysRole.getRoleKey();
|
||||
if (SUPER_ADMIN.contains(roleKey) || roleKey.contains(StringUtils.trim(role))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用户是否不具备某角色,与 isRole逻辑相反。
|
||||
*
|
||||
* @param role 角色名称
|
||||
* @return 用户是否不具备某角色
|
||||
*/
|
||||
public boolean lacksRole(String role) {
|
||||
return hasRole(role) != true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用户是否具有以下任意一个角色
|
||||
*
|
||||
* @param roles 以 ROLE_NAMES_DELIMETER 为分隔符的角色列表
|
||||
* @return 用户是否具有以下任意一个角色
|
||||
*/
|
||||
public boolean hasAnyRoles(String roles) {
|
||||
if (StringUtils.isEmpty(roles)) {
|
||||
return false;
|
||||
}
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) {
|
||||
return false;
|
||||
}
|
||||
for (String role : roles.split(ROLE_DELIMETER)) {
|
||||
if (hasRole(role)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否包含权限
|
||||
*
|
||||
* @param permissions 权限列表
|
||||
* @param permission 权限字符串
|
||||
* @return 用户是否具备某权限
|
||||
*/
|
||||
private boolean hasPermissions(Set<String> permissions, String permission) {
|
||||
return permissions.contains(ALL_PERMISSION) || permissions.contains(StringUtils.trim(permission));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.ruoyi.security.web.service;
|
||||
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.common.exception.user.CaptchaException;
|
||||
import com.ruoyi.common.exception.user.CaptchaExpireException;
|
||||
import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 登录校验方法
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
public class SysLoginService {
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Resource
|
||||
private AuthenticationManager authenticationManager;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @param code 验证码
|
||||
* @param uuid 唯一标识
|
||||
* @return 结果
|
||||
*/
|
||||
public String login(String username, String password, String code, String uuid) {
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
||||
String captcha = redisCache.getCacheObject(verifyKey);
|
||||
redisCache.deleteObject(verifyKey);
|
||||
if (captcha == null) {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
|
||||
throw new CaptchaExpireException();
|
||||
}
|
||||
if (!code.equalsIgnoreCase(captcha)) {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
|
||||
throw new CaptchaException();
|
||||
}
|
||||
// 用户验证
|
||||
Authentication authentication = null;
|
||||
try {
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager
|
||||
.authenticate(new UsernamePasswordAuthenticationToken(username, password));
|
||||
} catch (Exception e) {
|
||||
if (e instanceof BadCredentialsException) {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
} else {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
|
||||
throw new CustomException(e.getMessage());
|
||||
}
|
||||
}
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
// 生成token
|
||||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.ruoyi.security.web.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.segchk.service.ISegchkProviderMgtService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户权限处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
public class SysPermissionService {
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
/**
|
||||
* 获取角色数据权限
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 角色权限信息
|
||||
*/
|
||||
public Set<String> getRolePermission(SysUser user) {
|
||||
Set<String> roles = new HashSet<String>();
|
||||
// 管理员拥有所有权限
|
||||
if (user.isAdmin()) {
|
||||
roles.add("admin");
|
||||
} else {
|
||||
roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单数据权限
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 菜单权限信息
|
||||
*/
|
||||
public Set<String> getMenuPermission(SysUser user) {
|
||||
Set<String> perms = new HashSet<String>();
|
||||
// 管理员拥有所有权限
|
||||
if (user.isAdmin()) {
|
||||
perms.add("*:*:*");
|
||||
} else {
|
||||
perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId()));
|
||||
}
|
||||
return perms;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.ruoyi.security.web.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.enums.UserStatus;
|
||||
import com.ruoyi.common.exception.base.BaseException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户验证处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class UserDetailsServiceImpl implements UserDetailsService {
|
||||
private static final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
SysUser user = userService.selectUserByUserName(username);
|
||||
if (StringUtils.isNull(user)) {
|
||||
log.info("登录用户:{} 不存在.", username);
|
||||
throw new UsernameNotFoundException("登录用户:" + username + " 不存在");
|
||||
} else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||
log.info("登录用户:{} 已被删除.", username);
|
||||
throw new BaseException("对不起,您的账号:" + username + " 已被删除");
|
||||
} else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
||||
log.info("登录用户:{} 已被停用.", username);
|
||||
throw new BaseException("对不起,您的账号:" + username + " 已停用");
|
||||
}
|
||||
|
||||
return createLoginUser(user);
|
||||
}
|
||||
|
||||
public UserDetails createLoginUser(SysUser user) {
|
||||
return new LoginUser(user, permissionService.getMenuPermission(user));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.ruoyi.web.controller.common;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.sign.Base64;
|
||||
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 验证码操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class CaptchaController
|
||||
{
|
||||
@Resource(name = "captchaProducer")
|
||||
private Producer captchaProducer;
|
||||
|
||||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
// 验证码类型
|
||||
@Value("${ruoyi.captchaType}")
|
||||
private String captchaType;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
/**
|
||||
* 生成验证码
|
||||
*/
|
||||
@GetMapping("/captchaImage")
|
||||
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
boolean captchaOnOff = configService.selectCaptchaOnOff();
|
||||
ajax.put("captchaOnOff", captchaOnOff);
|
||||
if (!captchaOnOff)
|
||||
{
|
||||
return ajax;
|
||||
}
|
||||
|
||||
// 保存验证码信息
|
||||
String uuid = IdUtils.simpleUUID();
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
||||
|
||||
String capStr = null, code = null;
|
||||
BufferedImage image = null;
|
||||
|
||||
// 生成验证码
|
||||
if ("math".equals(captchaType))
|
||||
{
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||
image = captchaProducerMath.createImage(capStr);
|
||||
}
|
||||
else if ("char".equals(captchaType))
|
||||
{
|
||||
capStr = code = captchaProducer.createText();
|
||||
image = captchaProducer.createImage(capStr);
|
||||
}
|
||||
|
||||
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
// 转换流信息写出
|
||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||
try
|
||||
{
|
||||
ImageIO.write(image, "jpg", os);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
ajax.put("uuid", uuid);
|
||||
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,334 @@
|
|||
package com.ruoyi.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.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.framework.config.ServerConfig;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
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")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
log.debug("/common/upload with url: {{}}, filename: {{}}", url, fileName );
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传商家执照
|
||||
*/
|
||||
@PostMapping("/common/store_cert")
|
||||
public AjaxResult storeCert(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getProfile() + "/store_cert";
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
log.debug("/common/store_cert with url: {{}}, filename: {{}}", url, fileName );
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传商家小图标
|
||||
*/
|
||||
@PostMapping("/common/store_smallicon")
|
||||
public AjaxResult storeSmallicon(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getProfile() + "/store_smallicon";
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
log.debug("/common/store_smallicon with url: {{}}, filename: {{}}", url, fileName );
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传商家大图标
|
||||
*/
|
||||
@PostMapping("/common/store_bigicon")
|
||||
public AjaxResult storeBigicon(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getProfile() + "/store_bigicon";
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
log.debug("/common/store_bigicon with url: {{}}, filename: {{}}", url, fileName );
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传商家轮播图
|
||||
*/
|
||||
@PostMapping("/common/store_banner")
|
||||
public AjaxResult storeBanner(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getProfile() + "/store_banner";
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
log.debug("/common/store_banner with url: {{}}, filename: {{}}", url, fileName );
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传商家环境
|
||||
*/
|
||||
@PostMapping("/common/store_env")
|
||||
public AjaxResult storeEnv(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getProfile() + "/store_env";
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
log.debug("/common/store_env with url: {{}}, filename: {{}}", url, fileName );
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传商家详情
|
||||
*/
|
||||
@PostMapping("/common/store_details")
|
||||
public AjaxResult storeDetails(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getProfile() + "/store_details";
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
log.debug("/common/store_details with url: {{}}, filename: {{}}", url, fileName );
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传行业标签
|
||||
*/
|
||||
@PostMapping("/common/keyword")
|
||||
public AjaxResult keyword(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getProfile() + "/keyword";
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
log.debug("/common/keyword with url: {{}}, filename: {{}}", url, fileName );
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传优惠券
|
||||
*/
|
||||
@PostMapping("/common/preference")
|
||||
public AjaxResult preference(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getProfile() + "/preference";
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
log.debug("/common/preference with url: {{}}, filename: {{}}", url, 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,53 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 缓存监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/cache")
|
||||
public class CacheController
|
||||
{
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
||||
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
||||
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
||||
|
||||
Map<String, Object> result = new HashMap<>(3);
|
||||
result.put("info", info);
|
||||
result.put("dbSize", dbSize);
|
||||
|
||||
List<Map<String, String>> pieList = new ArrayList<>();
|
||||
commandStats.stringPropertyNames().forEach(key -> {
|
||||
Map<String, String> data = new HashMap<>(2);
|
||||
String property = commandStats.getProperty(key);
|
||||
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
|
||||
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
||||
pieList.add(data);
|
||||
});
|
||||
result.put("commandStats", pieList);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import com.ruoyi.security.web.domain.Server;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* 服务器监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/server")
|
||||
public class ServerController
|
||||
{
|
||||
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
return AjaxResult.success(server);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysLogininfor;
|
||||
import com.ruoyi.system.service.ISysLogininforService;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysLogininforService logininforService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysLogininfor logininfor)
|
||||
{
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysLogininfor logininfor)
|
||||
{
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||
return util.exportExcel(list, "登录日志");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] infoIds)
|
||||
{
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
logininforService.cleanLogininfor();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysOperLog;
|
||||
import com.ruoyi.system.service.ISysOperLogService;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/operlog")
|
||||
public class SysOperlogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysOperLog operLog)
|
||||
{
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||
@GetMapping("/export")
|
||||
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)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/{operIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.SysUserOnline;
|
||||
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/online")
|
||||
public class SysUserOnlineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String ipaddr, String userName)
|
||||
{
|
||||
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||
for (String key : keys)
|
||||
{
|
||||
LoginUser user = redisCache.getCacheObject(key);
|
||||
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
||||
{
|
||||
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||
}
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(ipaddr))
|
||||
{
|
||||
if (StringUtils.equals(ipaddr, user.getIpaddr()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||
}
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
||||
{
|
||||
if (StringUtils.equals(userName, user.getUsername()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||
}
|
||||
}
|
||||
Collections.reverse(userOnlineList);
|
||||
userOnlineList.removeAll(Collections.singleton(null));
|
||||
return getDataTable(userOnlineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强退用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@DeleteMapping("/{tokenId}")
|
||||
public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||
{
|
||||
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkCarouseMgt;
|
||||
import com.ruoyi.segchk.service.ISegchkCarouseMgtService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg首页轮播图管理Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_carouse_mgt")
|
||||
public class SegchkCarouseMgtController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkCarouseMgtService segchkCarouseMgtService;
|
||||
|
||||
/**
|
||||
* 查询seg首页轮播图管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkCarouseMgt segchkCarouseMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkCarouseMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkCarouseMgt> list = segchkCarouseMgtService.selectSegchkCarouseMgtList(segchkCarouseMgt);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg首页轮播图管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:export')")
|
||||
@Log(title = "seg首页轮播图管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkCarouseMgt segchkCarouseMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkCarouseMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkCarouseMgt> list = segchkCarouseMgtService.selectSegchkCarouseMgtList(segchkCarouseMgt);
|
||||
ExcelUtil<SegchkCarouseMgt> util = new ExcelUtil<SegchkCarouseMgt>(SegchkCarouseMgt.class);
|
||||
return util.exportExcel(list, "seg首页轮播图管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg首页轮播图管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:query')")
|
||||
@GetMapping(value = "/{carouseId}")
|
||||
public AjaxResult getInfo(@PathVariable("carouseId") Long carouseId)
|
||||
{
|
||||
return AjaxResult.success(segchkCarouseMgtService.selectSegchkCarouseMgtByCarouseId(carouseId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg首页轮播图管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:add')")
|
||||
@Log(title = "seg首页轮播图管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkCarouseMgt segchkCarouseMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkCarouseMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkCarouseMgtService.insertSegchkCarouseMgt(segchkCarouseMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg首页轮播图管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:edit')")
|
||||
@Log(title = "seg首页轮播图管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("edit_info")
|
||||
public AjaxResult edit(@RequestBody SegchkCarouseMgt segchkCarouseMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkCarouseMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkCarouseMgtService.updateSegchkCarouseMgt(segchkCarouseMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg首页轮播图管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:edit')")
|
||||
@Log(title = "seg首页轮播图管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/mgt_state")
|
||||
public AjaxResult mgt_state(@RequestBody SegchkCarouseMgt segchkCarouseMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkCarouseMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkCarouseMgtService.updateSegchkCarouseMgt(segchkCarouseMgt));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改seg首页轮播图管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:edit')")
|
||||
@Log(title = "seg首页轮播图管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/sort_update")
|
||||
public AjaxResult sort_update(@RequestBody String[] sortInfos)
|
||||
{
|
||||
logger.debug("sort_update with {}", sortInfos);
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
;
|
||||
}
|
||||
return toAjax(segchkCarouseMgtService.updateSegchkCarouseMgtSort(sortInfos));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg首页轮播图管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:remove')")
|
||||
@Log(title = "seg首页轮播图管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{carouseIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] carouseIds)
|
||||
{
|
||||
return toAjax(segchkCarouseMgtService.deleteSegchkCarouseMgtByCarouseIds(carouseIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkChargeCard;
|
||||
import com.ruoyi.segchk.service.ISegchkChargeCardService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg充值卡管理Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_charge_card")
|
||||
public class SegchkChargeCardController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkChargeCardService segchkChargeCardService;
|
||||
|
||||
/**
|
||||
* 查询seg充值卡管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_charge_card:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkChargeCard segchkChargeCard)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkChargeCard.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkChargeCard> list = segchkChargeCardService.selectSegchkChargeCardList(segchkChargeCard);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg充值卡管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_charge_card:export')")
|
||||
@Log(title = "seg充值卡管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkChargeCard segchkChargeCard)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkChargeCard.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkChargeCard> list = segchkChargeCardService.selectSegchkChargeCardList(segchkChargeCard);
|
||||
ExcelUtil<SegchkChargeCard> util = new ExcelUtil<SegchkChargeCard>(SegchkChargeCard.class);
|
||||
return util.exportExcel(list, "seg充值卡管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg充值卡管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_charge_card:query')")
|
||||
@GetMapping(value = "/{cardTypeId}")
|
||||
public AjaxResult getInfo(@PathVariable("cardTypeId") Long cardTypeId)
|
||||
{
|
||||
SegchkChargeCard segchkChargeCard = new SegchkChargeCard();
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkChargeCard.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return AjaxResult.success(segchkChargeCardService.selectSegchkChargeCardByCardTypeId(cardTypeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg充值卡管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_charge_card:add')")
|
||||
@Log(title = "seg充值卡管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkChargeCard segchkChargeCard)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
if(ObjectUtils.isEmpty(segchkChargeCard.getProviderId())){
|
||||
return AjaxResult.error("500", "请输入运营商id");
|
||||
}
|
||||
}
|
||||
else{
|
||||
segchkChargeCard.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkChargeCardService.insertSegchkChargeCard(segchkChargeCard));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg充值卡管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_charge_card:edit')")
|
||||
@Log(title = "seg充值卡管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkChargeCard segchkChargeCard)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkChargeCard.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkChargeCardService.updateSegchkChargeCard(segchkChargeCard));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg充值卡管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_charge_card:remove')")
|
||||
@Log(title = "seg充值卡管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{cardTypeIds}")
|
||||
public AjaxResult remove(@PathVariable String[] cardTypeIds)
|
||||
{
|
||||
return toAjax(segchkChargeCardService.deleteSegchkChargeCardByCardTypeIds(cardTypeIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkCommentAcc;
|
||||
import com.ruoyi.segchk.service.ISegchkCommentAccService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商家累积评价Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_comment_acc")
|
||||
public class SegchkCommentAccController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkCommentAccService segchkCommentAccService;
|
||||
|
||||
/**
|
||||
* 查询seg商家累积评价列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_comment_acc:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkCommentAcc segchkCommentAcc)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkCommentAcc.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkCommentAcc> list = segchkCommentAccService.selectSegchkCommentAccList(segchkCommentAcc);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商家累积评价列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_comment_acc:export')")
|
||||
@Log(title = "seg商家累积评价", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkCommentAcc segchkCommentAcc)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkCommentAcc.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkCommentAcc> list = segchkCommentAccService.selectSegchkCommentAccList(segchkCommentAcc);
|
||||
ExcelUtil<SegchkCommentAcc> util = new ExcelUtil<SegchkCommentAcc>(SegchkCommentAcc.class);
|
||||
return util.exportExcel(list, "seg商家累积评价数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商家累积评价详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_comment_acc:query')")
|
||||
@GetMapping(value = "/{updateId}")
|
||||
public AjaxResult getInfo(@PathVariable("updateId") Long updateId)
|
||||
{
|
||||
return AjaxResult.success(segchkCommentAccService.selectSegchkCommentAccByUpdateId(updateId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商家累积评价
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_comment_acc:add')")
|
||||
@Log(title = "seg商家累积评价", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkCommentAcc segchkCommentAcc)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkCommentAcc.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkCommentAccService.insertSegchkCommentAcc(segchkCommentAcc));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商家累积评价
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_comment_acc:edit')")
|
||||
@Log(title = "seg商家累积评价", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkCommentAcc segchkCommentAcc)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkCommentAcc.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkCommentAccService.updateSegchkCommentAcc(segchkCommentAcc));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商家累积评价
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_comment_acc:remove')")
|
||||
@Log(title = "seg商家累积评价", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{updateIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] updateIds)
|
||||
{
|
||||
return toAjax(segchkCommentAccService.deleteSegchkCommentAccByUpdateIds(updateIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkDistrictInfo;
|
||||
import com.ruoyi.segchk.service.ISegchkDistrictInfoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg行政区域代码Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_district_info")
|
||||
public class SegchkDistrictInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkDistrictInfoService segchkDistrictInfoService;
|
||||
|
||||
/**
|
||||
* 查询seg行政区域代码列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_district_info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkDistrictInfo segchkDistrictInfo)
|
||||
{
|
||||
startPage();
|
||||
List<SegchkDistrictInfo> list = segchkDistrictInfoService.selectSegchkDistrictInfoList(segchkDistrictInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg行政区域代码列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_district_info:export')")
|
||||
@Log(title = "seg行政区域代码", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkDistrictInfo segchkDistrictInfo)
|
||||
{
|
||||
List<SegchkDistrictInfo> list = segchkDistrictInfoService.selectSegchkDistrictInfoList(segchkDistrictInfo);
|
||||
ExcelUtil<SegchkDistrictInfo> util = new ExcelUtil<SegchkDistrictInfo>(SegchkDistrictInfo.class);
|
||||
return util.exportExcel(list, "seg行政区域代码数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg行政区域代码详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_district_info:query')")
|
||||
@GetMapping(value = "/{districtId}")
|
||||
public AjaxResult getInfo(@PathVariable("districtId") Integer districtId)
|
||||
{
|
||||
return AjaxResult.success(segchkDistrictInfoService.selectSegchkDistrictInfoByDistrictId(districtId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg行政区域代码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_district_info:add')")
|
||||
@Log(title = "seg行政区域代码", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkDistrictInfo segchkDistrictInfo)
|
||||
{
|
||||
return toAjax(segchkDistrictInfoService.insertSegchkDistrictInfo(segchkDistrictInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg行政区域代码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_district_info:edit')")
|
||||
@Log(title = "seg行政区域代码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkDistrictInfo segchkDistrictInfo)
|
||||
{
|
||||
return toAjax(segchkDistrictInfoService.updateSegchkDistrictInfo(segchkDistrictInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg行政区域代码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_district_info:remove')")
|
||||
@Log(title = "seg行政区域代码", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{districtIds}")
|
||||
public AjaxResult remove(@PathVariable Integer[] districtIds)
|
||||
{
|
||||
return toAjax(segchkDistrictInfoService.deleteSegchkDistrictInfoByDistrictIds(districtIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkKeywordLable;
|
||||
import com.ruoyi.segchk.service.ISegchkKeywordLableService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg关键字管理Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_keyword_lable")
|
||||
public class SegchkKeywordLableController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkKeywordLableService segchkKeywordLableService;
|
||||
|
||||
/**
|
||||
* 查询seg关键字管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_keyword_lable:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkKeywordLable segchkKeywordLable)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkKeywordLable.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkKeywordLable> list = segchkKeywordLableService.selectSegchkKeywordLableList(segchkKeywordLable);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg关键字管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_keyword_lable:export')")
|
||||
@Log(title = "seg关键字管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkKeywordLable segchkKeywordLable)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkKeywordLable.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkKeywordLable> list = segchkKeywordLableService.selectSegchkKeywordLableList(segchkKeywordLable);
|
||||
ExcelUtil<SegchkKeywordLable> util = new ExcelUtil<SegchkKeywordLable>(SegchkKeywordLable.class);
|
||||
return util.exportExcel(list, "seg关键字管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg关键字管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_keyword_lable:query')")
|
||||
@GetMapping(value = "/{keywordId}")
|
||||
public AjaxResult getInfo(@PathVariable("keywordId") Long keywordId)
|
||||
{
|
||||
return AjaxResult.success(segchkKeywordLableService.selectSegchkKeywordLableByKeywordId(keywordId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg关键字管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_keyword_lable:add')")
|
||||
@Log(title = "seg关键字管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkKeywordLable segchkKeywordLable)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkKeywordLable.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkKeywordLableService.insertSegchkKeywordLable(segchkKeywordLable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg关键字管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_keyword_lable:edit')")
|
||||
@Log(title = "seg关键字管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkKeywordLable segchkKeywordLable)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkKeywordLable.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkKeywordLableService.updateSegchkKeywordLable(segchkKeywordLable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg关键字管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_keyword_lable:remove')")
|
||||
@Log(title = "seg关键字管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{keywordIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] keywordIds)
|
||||
{
|
||||
return toAjax(segchkKeywordLableService.deleteSegchkKeywordLableByKeywordIds(keywordIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkLableMgt;
|
||||
import com.ruoyi.segchk.service.ISegchkLableMgtService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg首页标签管理Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_lable_mgt")
|
||||
public class SegchkLableMgtController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkLableMgtService segchkLableMgtService;
|
||||
|
||||
/**
|
||||
* 查询seg首页标签管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_lable_mgt:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkLableMgt segchkLableMgt)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
logger.debug("segchk:segchk_lable_mgt:list get with---user: {}",sysUser.toString());
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkLableMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkLableMgt> list = segchkLableMgtService.selectSegchkLableMgtList(segchkLableMgt);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg首页标签管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_lable_mgt:export')")
|
||||
@Log(title = "seg首页标签管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkLableMgt segchkLableMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkLableMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkLableMgt> list = segchkLableMgtService.selectSegchkLableMgtList(segchkLableMgt);
|
||||
ExcelUtil<SegchkLableMgt> util = new ExcelUtil<SegchkLableMgt>(SegchkLableMgt.class);
|
||||
return util.exportExcel(list, "seg首页标签管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg首页标签管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_lable_mgt:query')")
|
||||
@GetMapping(value = "/{mgtId}")
|
||||
public AjaxResult getInfo(@PathVariable("mgtId") Long mgtId)
|
||||
{
|
||||
return AjaxResult.success(segchkLableMgtService.selectSegchkLableMgtByMgtId(mgtId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg首页标签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_lable_mgt:add')")
|
||||
@Log(title = "seg首页标签管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkLableMgt segchkLableMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkLableMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkLableMgtService.insertSegchkLableMgt(segchkLableMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg首页标签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_lable_mgt:edit')")
|
||||
@Log(title = "seg首页标签管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit_info")
|
||||
public AjaxResult edit(@RequestBody SegchkLableMgt segchkLableMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkLableMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkLableMgtService.updateSegchkLableMgt(segchkLableMgt));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改seg首页标签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_lable_mgt:edit')")
|
||||
@Log(title = "seg首页标签管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/mgt_state")
|
||||
public AjaxResult mgt_state(@RequestBody SegchkLableMgt segchkLableMgt)
|
||||
{
|
||||
logger.debug("mgt_state with --- {}", segchkLableMgt.toString());
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkLableMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkLableMgtService.updateSegchkLableMgt(segchkLableMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg首页标签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_lable_mgt:remove')")
|
||||
@Log(title = "seg首页标签管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{mgtIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] mgtIds)
|
||||
{
|
||||
return toAjax(segchkLableMgtService.deleteSegchkLableMgtByProviderIds(mgtIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkLogionDetail;
|
||||
import com.ruoyi.segchk.service.ISegchkLogionDetailService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg登录记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_logion_detail")
|
||||
public class SegchkLogionDetailController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkLogionDetailService segchkLogionDetailService;
|
||||
|
||||
/**
|
||||
* 查询seg登录记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_logion_detail:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkLogionDetail segchkLogionDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkLogionDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkLogionDetail> list = segchkLogionDetailService.selectSegchkLogionDetailList(segchkLogionDetail);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg登录记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_logion_detail:export')")
|
||||
@Log(title = "seg登录记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkLogionDetail segchkLogionDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkLogionDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkLogionDetail> list = segchkLogionDetailService.selectSegchkLogionDetailList(segchkLogionDetail);
|
||||
ExcelUtil<SegchkLogionDetail> util = new ExcelUtil<SegchkLogionDetail>(SegchkLogionDetail.class);
|
||||
return util.exportExcel(list, "seg登录记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg登录记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_logion_detail:query')")
|
||||
@GetMapping(value = "/{loginId}")
|
||||
public AjaxResult getInfo(@PathVariable("loginId") Long loginId)
|
||||
{
|
||||
return AjaxResult.success(segchkLogionDetailService.selectSegchkLogionDetailByLoginId(loginId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg登录记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_logion_detail:add')")
|
||||
@Log(title = "seg登录记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkLogionDetail segchkLogionDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkLogionDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkLogionDetailService.insertSegchkLogionDetail(segchkLogionDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg登录记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_logion_detail:edit')")
|
||||
@Log(title = "seg登录记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkLogionDetail segchkLogionDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkLogionDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkLogionDetailService.updateSegchkLogionDetail(segchkLogionDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg登录记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_logion_detail:remove')")
|
||||
@Log(title = "seg登录记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{loginIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] loginIds)
|
||||
{
|
||||
return toAjax(segchkLogionDetailService.deleteSegchkLogionDetailByLoginIds(loginIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkMsgDetail;
|
||||
import com.ruoyi.segchk.service.ISegchkMsgDetailService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg消息记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_msg_detail")
|
||||
public class SegchkMsgDetailController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkMsgDetailService segchkMsgDetailService;
|
||||
|
||||
/**
|
||||
* 查询seg消息记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_msg_detail:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkMsgDetail segchkMsgDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkMsgDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkMsgDetail> list = segchkMsgDetailService.selectSegchkMsgDetailList(segchkMsgDetail);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg消息记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_msg_detail:export')")
|
||||
@Log(title = "seg消息记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkMsgDetail segchkMsgDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkMsgDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkMsgDetail> list = segchkMsgDetailService.selectSegchkMsgDetailList(segchkMsgDetail);
|
||||
ExcelUtil<SegchkMsgDetail> util = new ExcelUtil<SegchkMsgDetail>(SegchkMsgDetail.class);
|
||||
return util.exportExcel(list, "seg消息记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg消息记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_msg_detail:query')")
|
||||
@GetMapping(value = "/{msgId}")
|
||||
public AjaxResult getInfo(@PathVariable("msgId") Long msgId)
|
||||
{
|
||||
return AjaxResult.success(segchkMsgDetailService.selectSegchkMsgDetailByMsgId(msgId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg消息记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_msg_detail:add')")
|
||||
@Log(title = "seg消息记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkMsgDetail segchkMsgDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkMsgDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkMsgDetailService.insertSegchkMsgDetail(segchkMsgDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg消息记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_msg_detail:edit')")
|
||||
@Log(title = "seg消息记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkMsgDetail segchkMsgDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkMsgDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkMsgDetailService.updateSegchkMsgDetail(segchkMsgDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg消息记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_msg_detail:remove')")
|
||||
@Log(title = "seg消息记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{msgIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] msgIds)
|
||||
{
|
||||
return toAjax(segchkMsgDetailService.deleteSegchkMsgDetailByMsgIds(msgIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkPreferenceLable;
|
||||
import com.ruoyi.segchk.service.ISegchkPreferenceLableService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg优惠管理Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_preference_lable")
|
||||
public class SegchkPreferenceLableController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkPreferenceLableService segchkPreferenceLableService;
|
||||
|
||||
/**
|
||||
* 查询seg优惠管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_preference_lable:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkPreferenceLable segchkPreferenceLable)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkPreferenceLable.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkPreferenceLable> list = segchkPreferenceLableService.selectSegchkPreferenceLableList(segchkPreferenceLable);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg优惠管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_preference_lable:export')")
|
||||
@Log(title = "seg优惠管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkPreferenceLable segchkPreferenceLable)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkPreferenceLable.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkPreferenceLable> list = segchkPreferenceLableService.selectSegchkPreferenceLableList(segchkPreferenceLable);
|
||||
ExcelUtil<SegchkPreferenceLable> util = new ExcelUtil<SegchkPreferenceLable>(SegchkPreferenceLable.class);
|
||||
return util.exportExcel(list, "seg优惠管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg优惠管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_preference_lable:query')")
|
||||
@GetMapping(value = "/{preferenceId}")
|
||||
public AjaxResult getInfo(@PathVariable("preferenceId") Long preferenceId)
|
||||
{
|
||||
return AjaxResult.success(segchkPreferenceLableService.selectSegchkPreferenceLableByPreferenceId(preferenceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg优惠管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_preference_lable:add')")
|
||||
@Log(title = "seg优惠管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkPreferenceLable segchkPreferenceLable)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkPreferenceLable.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkPreferenceLableService.insertSegchkPreferenceLable(segchkPreferenceLable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg优惠管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_preference_lable:edit')")
|
||||
@Log(title = "seg优惠管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkPreferenceLable segchkPreferenceLable)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkPreferenceLable.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkPreferenceLableService.updateSegchkPreferenceLable(segchkPreferenceLable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg优惠管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_preference_lable:remove')")
|
||||
@Log(title = "seg优惠管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{preferenceIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] preferenceIds)
|
||||
{
|
||||
return toAjax(segchkPreferenceLableService.deleteSegchkPreferenceLableByPreferenceIds(preferenceIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkProviderMgt;
|
||||
import com.ruoyi.segchk.service.ISegchkProviderMgtService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg运营商管理Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_provider_mgt")
|
||||
public class SegchkProviderMgtController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkProviderMgtService segchkProviderMgtService;
|
||||
|
||||
/**
|
||||
* 查询seg运营商管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_provider_mgt:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkProviderMgt segchkProviderMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkProviderMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkProviderMgt> list = segchkProviderMgtService.selectSegchkProviderMgtList(segchkProviderMgt);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg运营商管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_provider_mgt:export')")
|
||||
@Log(title = "seg运营商管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkProviderMgt segchkProviderMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkProviderMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkProviderMgt> list = segchkProviderMgtService.selectSegchkProviderMgtList(segchkProviderMgt);
|
||||
ExcelUtil<SegchkProviderMgt> util = new ExcelUtil<SegchkProviderMgt>(SegchkProviderMgt.class);
|
||||
return util.exportExcel(list, "seg运营商管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg运营商管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_provider_mgt:query')")
|
||||
@GetMapping(value = "/{providerId}")
|
||||
public AjaxResult getInfo(@PathVariable("providerId") Long providerId)
|
||||
{
|
||||
return AjaxResult.success(segchkProviderMgtService.selectSegchkProviderMgtByProviderId(providerId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg运营商管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_provider_mgt:add')")
|
||||
@Log(title = "seg运营商管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkProviderMgt segchkProviderMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkProviderMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkProviderMgtService.insertSegchkProviderMgt(segchkProviderMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg运营商管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_provider_mgt:edit')")
|
||||
@Log(title = "seg运营商管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody SegchkProviderMgt segchkProviderMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkProviderMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkProviderMgtService.updateSegchkProviderMgt(segchkProviderMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg运营商管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_provider_mgt:edit')")
|
||||
@Log(title = "seg运营商管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/status")
|
||||
public AjaxResult status(@RequestBody SegchkProviderMgt segchkProviderMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkProviderMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkProviderMgtService.updateSegchkProviderMgt(segchkProviderMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg运营商管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_provider_mgt:remove')")
|
||||
@Log(title = "seg运营商管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{providerIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] providerIds)
|
||||
{
|
||||
return toAjax(segchkProviderMgtService.deleteSegchkProviderMgtByProviderIds(providerIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkRecommenderStore;
|
||||
import com.ruoyi.segchk.service.ISegchkRecommenderStoreService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg首页推荐商户Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_recommender_store")
|
||||
public class SegchkRecommenderStoreController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkRecommenderStoreService segchkRecommenderStoreService;
|
||||
|
||||
/**
|
||||
* 查询seg首页推荐商户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_recommender_store:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkRecommenderStore segchkRecommenderStore)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkRecommenderStore.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkRecommenderStore> list = segchkRecommenderStoreService.selectSegchkRecommenderStoreList(segchkRecommenderStore);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg首页推荐商户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_recommender_store:export')")
|
||||
@Log(title = "seg首页推荐商户", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkRecommenderStore segchkRecommenderStore)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkRecommenderStore.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkRecommenderStore> list = segchkRecommenderStoreService.selectSegchkRecommenderStoreList(segchkRecommenderStore);
|
||||
ExcelUtil<SegchkRecommenderStore> util = new ExcelUtil<SegchkRecommenderStore>(SegchkRecommenderStore.class);
|
||||
return util.exportExcel(list, "seg首页推荐商户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg首页推荐商户详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_recommender_store:query')")
|
||||
@GetMapping(value = "/{recommenderId}")
|
||||
public AjaxResult getInfo(@PathVariable("recommenderId") Long recommenderId)
|
||||
{
|
||||
return AjaxResult.success(segchkRecommenderStoreService.selectSegchkRecommenderStoreByRecommenderId(recommenderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg首页推荐商户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_recommender_store:add')")
|
||||
@Log(title = "seg首页推荐商户", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkRecommenderStore segchkRecommenderStore)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkRecommenderStore.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkRecommenderStoreService.insertSegchkRecommenderStore(segchkRecommenderStore));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg首页推荐商户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_recommender_store:edit')")
|
||||
@Log(title = "seg首页推荐商户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit_info")
|
||||
public AjaxResult edit(@RequestBody SegchkRecommenderStore segchkRecommenderStore)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkRecommenderStore.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkRecommenderStoreService.updateSegchkRecommenderStore(segchkRecommenderStore));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg首页推荐商户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_recommender_store:edit')")
|
||||
@Log(title = "seg首页推荐商户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/mgt_state")
|
||||
public AjaxResult mgt_state(@RequestBody SegchkRecommenderStore segchkRecommenderStore)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkRecommenderStore.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkRecommenderStoreService.updateSegchkRecommenderStore(segchkRecommenderStore));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg首页推荐商户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_recommender_store:remove')")
|
||||
@Log(title = "seg首页推荐商户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{recommenderIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] recommenderIds)
|
||||
{
|
||||
return toAjax(segchkRecommenderStoreService.deleteSegchkRecommenderStoreByRecommenderIds(recommenderIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkSalerInfo;
|
||||
import com.ruoyi.segchk.service.ISegchkSalerInfoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg销售人员信息Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_saler_info")
|
||||
public class SegchkSalerInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkSalerInfoService segchkSalerInfoService;
|
||||
|
||||
/**
|
||||
* 查询seg销售人员信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_saler_info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkSalerInfo segchkSalerInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSalerInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkSalerInfo> list = segchkSalerInfoService.selectSegchkSalerInfoList(segchkSalerInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg销售人员信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_saler_info:export')")
|
||||
@Log(title = "seg销售人员信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkSalerInfo segchkSalerInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSalerInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkSalerInfo> list = segchkSalerInfoService.selectSegchkSalerInfoList(segchkSalerInfo);
|
||||
ExcelUtil<SegchkSalerInfo> util = new ExcelUtil<SegchkSalerInfo>(SegchkSalerInfo.class);
|
||||
return util.exportExcel(list, "seg销售人员信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg销售人员信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_saler_info:query')")
|
||||
@GetMapping(value = "/{salerId}")
|
||||
public AjaxResult getInfo(@PathVariable("salerId") Integer salerId)
|
||||
{
|
||||
return AjaxResult.success(segchkSalerInfoService.selectSegchkSalerInfoBySalerId(salerId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg销售人员信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_saler_info:add')")
|
||||
@Log(title = "seg销售人员信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkSalerInfo segchkSalerInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSalerInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkSalerInfoService.insertSegchkSalerInfo(segchkSalerInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg销售人员信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_saler_info:edit')")
|
||||
@Log(title = "seg销售人员信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody SegchkSalerInfo segchkSalerInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSalerInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkSalerInfoService.updateSegchkSalerInfo(segchkSalerInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg销售人员信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_saler_info:edit')")
|
||||
@Log(title = "seg销售人员信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/update_status")
|
||||
public AjaxResult update_status(@RequestBody SegchkSalerInfo segchkSalerInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSalerInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkSalerInfoService.updateSegchkSalerInfo(segchkSalerInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg销售人员信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_saler_info:remove')")
|
||||
@Log(title = "seg销售人员信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{salerIds}")
|
||||
public AjaxResult remove(@PathVariable Integer[] salerIds)
|
||||
{
|
||||
return toAjax(segchkSalerInfoService.deleteSegchkSalerInfoBySalerIds(salerIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkSelfServiceChk;
|
||||
import com.ruoyi.segchk.service.ISegchkSelfServiceChkService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg自定义卡核消记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_self_service_chk")
|
||||
public class SegchkSelfServiceChkController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkSelfServiceChkService segchkSelfServiceChkService;
|
||||
|
||||
/**
|
||||
* 查询seg自定义卡核消记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk: segchk_self_service_chk:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkSelfServiceChk segchkSelfServiceChk)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSelfServiceChk.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkSelfServiceChk> list = segchkSelfServiceChkService.selectSegchkSelfServiceChkList(segchkSelfServiceChk);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg自定义卡核消记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk: segchk_self_service_chk:export')")
|
||||
@Log(title = "seg自定义卡核消记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkSelfServiceChk segchkSelfServiceChk)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSelfServiceChk.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkSelfServiceChk> list = segchkSelfServiceChkService.selectSegchkSelfServiceChkList(segchkSelfServiceChk);
|
||||
ExcelUtil<SegchkSelfServiceChk> util = new ExcelUtil<SegchkSelfServiceChk>(SegchkSelfServiceChk.class);
|
||||
return util.exportExcel(list, "seg自定义卡核消记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg自定义卡核消记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk: segchk_self_service_chk:query')")
|
||||
@GetMapping(value = "/{chkServiceId}")
|
||||
public AjaxResult getInfo(@PathVariable("chkServiceId") Long chkServiceId)
|
||||
{
|
||||
return AjaxResult.success(segchkSelfServiceChkService.selectSegchkSelfServiceChkByChkServiceId(chkServiceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg自定义卡核消记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk: segchk_self_service_chk:add')")
|
||||
@Log(title = "seg自定义卡核消记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkSelfServiceChk segchkSelfServiceChk)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSelfServiceChk.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkSelfServiceChkService.insertSegchkSelfServiceChk(segchkSelfServiceChk));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg自定义卡核消记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk: segchk_self_service_chk:edit')")
|
||||
@Log(title = "seg自定义卡核消记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkSelfServiceChk segchkSelfServiceChk)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSelfServiceChk.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkSelfServiceChkService.updateSegchkSelfServiceChk(segchkSelfServiceChk));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg自定义卡核消记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk: segchk_self_service_chk:remove')")
|
||||
@Log(title = "seg自定义卡核消记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{chkServiceIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] chkServiceIds)
|
||||
{
|
||||
return toAjax(segchkSelfServiceChkService.deleteSegchkSelfServiceChkByChkServiceIds(chkServiceIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkServiceChk;
|
||||
import com.ruoyi.segchk.service.ISegchkServiceChkService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg核消记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_service_chk")
|
||||
public class SegchkServiceChkController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkServiceChkService segchkServiceChkService;
|
||||
|
||||
/**
|
||||
* 查询seg核消记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_chk:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkServiceChk segchkServiceChk)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkServiceChk.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkServiceChk> list = segchkServiceChkService.selectSegchkServiceChkList(segchkServiceChk);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg核消记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_chk:export')")
|
||||
@Log(title = "seg核消记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkServiceChk segchkServiceChk)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkServiceChk.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkServiceChk> list = segchkServiceChkService.selectSegchkServiceChkList(segchkServiceChk);
|
||||
ExcelUtil<SegchkServiceChk> util = new ExcelUtil<SegchkServiceChk>(SegchkServiceChk.class);
|
||||
return util.exportExcel(list, "seg核消记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg核消记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_chk:query')")
|
||||
@GetMapping(value = "/{chkServiceId}")
|
||||
public AjaxResult getInfo(@PathVariable("chkServiceId") Long chkServiceId)
|
||||
{
|
||||
return AjaxResult.success(segchkServiceChkService.selectSegchkServiceChkByChkServiceId(chkServiceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg核消记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_chk:add')")
|
||||
@Log(title = "seg核消记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkServiceChk segchkServiceChk)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkServiceChk.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkServiceChkService.insertSegchkServiceChk(segchkServiceChk));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg核消记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_chk:edit')")
|
||||
@Log(title = "seg核消记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkServiceChk segchkServiceChk)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkServiceChk.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkServiceChkService.updateSegchkServiceChk(segchkServiceChk));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg核消记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_chk:remove')")
|
||||
@Log(title = "seg核消记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{chkServiceIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] chkServiceIds)
|
||||
{
|
||||
return toAjax(segchkServiceChkService.deleteSegchkServiceChkByChkServiceIds(chkServiceIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkServiceComment;
|
||||
import com.ruoyi.segchk.service.ISegchkServiceCommentService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg评价记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_service_comment")
|
||||
public class SegchkServiceCommentController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkServiceCommentService segchkServiceCommentService;
|
||||
|
||||
/**
|
||||
* 查询seg评价记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_comment:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkServiceComment segchkServiceComment)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkServiceComment.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkServiceComment> list = segchkServiceCommentService.selectSegchkServiceCommentList(segchkServiceComment);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg评价记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_comment:export')")
|
||||
@Log(title = "seg评价记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkServiceComment segchkServiceComment)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkServiceComment.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkServiceComment> list = segchkServiceCommentService.selectSegchkServiceCommentList(segchkServiceComment);
|
||||
ExcelUtil<SegchkServiceComment> util = new ExcelUtil<SegchkServiceComment>(SegchkServiceComment.class);
|
||||
return util.exportExcel(list, "seg评价记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg评价记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_comment:query')")
|
||||
@GetMapping(value = "/{commentId}")
|
||||
public AjaxResult getInfo(@PathVariable("commentId") Long commentId)
|
||||
{
|
||||
return AjaxResult.success(segchkServiceCommentService.selectSegchkServiceCommentByCommentId(commentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg评价记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_comment:add')")
|
||||
@Log(title = "seg评价记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkServiceComment segchkServiceComment)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkServiceComment.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkServiceCommentService.insertSegchkServiceComment(segchkServiceComment));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg评价记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_comment:edit')")
|
||||
@Log(title = "seg评价记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkServiceComment segchkServiceComment)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkServiceComment.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkServiceCommentService.updateSegchkServiceComment(segchkServiceComment));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg评价记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_service_comment:remove')")
|
||||
@Log(title = "seg评价记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{commentIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] commentIds)
|
||||
{
|
||||
return toAjax(segchkServiceCommentService.deleteSegchkServiceCommentByCommentIds(commentIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,304 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.UnAuth;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.segchk.domain.*;
|
||||
import com.ruoyi.segchk.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* seg首页轮播图管理Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/simple_list")
|
||||
public class SegchkSimpleListController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkProviderMgtService segchkProviderMgtService;
|
||||
@Autowired
|
||||
private ISegchkSalerInfoService segchkSalerInfoService;
|
||||
@Autowired
|
||||
private ISegchkStoreBasicInfoService segchkStoreBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private ISegchkChargeCardService segchkChargeCardService;
|
||||
|
||||
@Autowired
|
||||
private ISegchkKeywordLableService segchkKeywordLableService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISegchkPreferenceLableService segchkPreferenceLableService;
|
||||
|
||||
@Autowired
|
||||
private ISegchkDistrictInfoService segchkDistrictInfoService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询seg首页轮播图管理列表
|
||||
*/
|
||||
@UnAuth
|
||||
// @PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:list')")
|
||||
@GetMapping("/salerList")
|
||||
public TableDataInfo saler_list()
|
||||
{
|
||||
logger.debug("salerList is call");
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
// sysUser.getNickName();
|
||||
Long providerId = sysUser.getUserId() == 1 ? null : sysUser.getProviderId();
|
||||
startPage();
|
||||
SegchkSalerInfo segchkSalerInfo = new SegchkSalerInfo();
|
||||
segchkSalerInfo.setProviderId(providerId);
|
||||
List<SegchkSalerInfo> list = segchkSalerInfoService.selectSegchkSalerInfoList(segchkSalerInfo);
|
||||
List<SimpleListObj> collect = list.parallelStream().filter(v -> v.getSalerState() == 0).map(v -> {
|
||||
SimpleListObj simpleListObj1 = new SimpleListObj();
|
||||
simpleListObj1.setProviderId(String.valueOf(v.getProviderId()));
|
||||
simpleListObj1.setKey(String.valueOf(v.getSalerId()));
|
||||
simpleListObj1.setValue(String.valueOf(v.getSalerName()));
|
||||
return simpleListObj1;
|
||||
}).collect(Collectors.toList());
|
||||
return getDataTable(collect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询seg首页轮播图管理列表
|
||||
*/
|
||||
@UnAuth
|
||||
// @PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:list')")
|
||||
@GetMapping("/providerList")
|
||||
public TableDataInfo provider_list()
|
||||
{
|
||||
logger.debug("providerList is call");
|
||||
SimpleListObj simpleListObj = new SimpleListObj();
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
// sysUser.getNickName();
|
||||
Long providerId = sysUser.getUserId() == 1 ? null : sysUser.getProviderId();
|
||||
startPage();
|
||||
SegchkProviderMgt segchkProviderMgt = new SegchkProviderMgt();
|
||||
segchkProviderMgt.setProviderId(providerId);
|
||||
List<SegchkProviderMgt> list = segchkProviderMgtService.selectSegchkProviderMgtList(segchkProviderMgt);
|
||||
List<SimpleListObj> collect = list.parallelStream().map(v -> {
|
||||
SimpleListObj simpleListObj1 = new SimpleListObj();
|
||||
simpleListObj1.setProviderId(String.valueOf(v.getProviderId()));
|
||||
simpleListObj1.setKey(String.valueOf(v.getProviderId()));
|
||||
simpleListObj1.setValue(String.valueOf(v.getNickName()));
|
||||
return simpleListObj1;
|
||||
}).collect(Collectors.toList());
|
||||
collect.forEach(v -> logger.debug("providerList ret : {}", v.toString()));
|
||||
return getDataTable(collect);
|
||||
}
|
||||
/**
|
||||
* 查询seg首页轮播图管理列表
|
||||
*/
|
||||
@UnAuth
|
||||
// @PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:list')")
|
||||
@GetMapping("/storeList")
|
||||
public TableDataInfo store_list()
|
||||
{
|
||||
logger.debug("storeList is call");
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
// sysUser.getNickName();
|
||||
Long providerId = sysUser.getUserId() == 1 ? null : sysUser.getProviderId();
|
||||
startPage();
|
||||
SegchkStoreBasicInfo segchkStoreBasicInfo = new SegchkStoreBasicInfo();
|
||||
segchkStoreBasicInfo.setProviderId(providerId);
|
||||
List<SegchkStoreBasicInfo> list = segchkStoreBasicInfoService.selectSegchkStoreBasicInfoList(segchkStoreBasicInfo);
|
||||
List<SimpleListObj> collect = list.parallelStream().map(v -> {
|
||||
SimpleListObj simpleListObj1 = new SimpleListObj();
|
||||
simpleListObj1.setProviderId(String.valueOf(v.getProviderId()));
|
||||
simpleListObj1.setKey(String.valueOf(v.getStoreId()));
|
||||
simpleListObj1.setValue(String.valueOf(v.getStoreName()));
|
||||
return simpleListObj1;
|
||||
}).collect(Collectors.toList());
|
||||
collect.forEach(v -> logger.debug("providerList ret : {}", v.toString()));
|
||||
return getDataTable(collect);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询seg首页轮播图管理列表
|
||||
*/
|
||||
@UnAuth
|
||||
// @PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:list')")
|
||||
@GetMapping("/ChargeCardList")
|
||||
public TableDataInfo charge_card_list()
|
||||
{
|
||||
logger.debug("ChargeCardList is call");
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
// sysUser.getNickName();
|
||||
Long providerId = sysUser.getUserId() == 1 ? null : sysUser.getProviderId();
|
||||
startPage();
|
||||
SegchkChargeCard segchkChargeCard = new SegchkChargeCard();
|
||||
segchkChargeCard.setProviderId(providerId);
|
||||
List<SegchkChargeCard> list = segchkChargeCardService.selectSegchkChargeCardList(segchkChargeCard);
|
||||
List<SimpleListObj> collect = list.parallelStream().map(v -> {
|
||||
SimpleListObj simpleListObj1 = new SimpleListObj();
|
||||
simpleListObj1.setProviderId(String.valueOf(v.getProviderId()));
|
||||
simpleListObj1.setKey(String.valueOf(v.getCardTypeId()));
|
||||
simpleListObj1.setValue(String.valueOf(v.getCardTypeName()));
|
||||
return simpleListObj1;
|
||||
}).collect(Collectors.toList());
|
||||
collect.forEach(v -> logger.debug("ChargeCardList ret : {}", v.toString()));
|
||||
return getDataTable(collect);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询seg首页轮播图管理列表
|
||||
*/
|
||||
@UnAuth
|
||||
// @PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:list')")
|
||||
@GetMapping("/KerwordList")
|
||||
public TableDataInfo kerword_list()
|
||||
{
|
||||
logger.debug("KerwordList is call");
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
// sysUser.getNickName();
|
||||
Long providerId = sysUser.getUserId() == 1 ? null : sysUser.getProviderId();
|
||||
startPage();
|
||||
SegchkKeywordLable segchkKeywordLable = new SegchkKeywordLable();
|
||||
segchkKeywordLable.setProviderId(providerId);
|
||||
List<SegchkKeywordLable> list = segchkKeywordLableService.selectSegchkKeywordLableList(segchkKeywordLable);
|
||||
List<SimpleListObj> collect = list.parallelStream().map(v -> {
|
||||
SimpleListObj simpleListObj1 = new SimpleListObj();
|
||||
simpleListObj1.setProviderId(String.valueOf(v.getProviderId()));
|
||||
simpleListObj1.setKey(String.valueOf(v.getKeywordId()));
|
||||
simpleListObj1.setValue(String.valueOf(v.getKeywordName()));
|
||||
simpleListObj1.setImgUrl(String.valueOf(v.getKeywordUrl()));
|
||||
return simpleListObj1;
|
||||
}).collect(Collectors.toList());
|
||||
collect.forEach(v -> logger.debug("KerwordList ret : {}", v.toString()));
|
||||
return getDataTable(collect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询seg首页轮播图管理列表
|
||||
*/
|
||||
@UnAuth
|
||||
// @PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:list')")
|
||||
@GetMapping("/PreferenceLableList")
|
||||
public TableDataInfo preference_lable_list()
|
||||
{
|
||||
logger.debug("PreferenceLableList is call");
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
// sysUser.getNickName();
|
||||
Long providerId = sysUser.getUserId() == 1 ? null : sysUser.getProviderId();
|
||||
startPage();
|
||||
SegchkPreferenceLable segchkPreferenceLable = new SegchkPreferenceLable();
|
||||
segchkPreferenceLable.setProviderId(providerId);
|
||||
List<SegchkPreferenceLable> list = segchkPreferenceLableService.selectSegchkPreferenceLableList(segchkPreferenceLable);
|
||||
List<SimpleListObj> collect = list.parallelStream().map(v -> {
|
||||
SimpleListObj simpleListObj1 = new SimpleListObj();
|
||||
simpleListObj1.setProviderId(String.valueOf(v.getProviderId()));
|
||||
simpleListObj1.setKey(String.valueOf(v.getPreferenceId()));
|
||||
simpleListObj1.setValue(String.valueOf(v.getPreferenceName()));
|
||||
simpleListObj1.setImgUrl(String.valueOf(v.getPreferenceUrl()));
|
||||
return simpleListObj1;
|
||||
}).collect(Collectors.toList());
|
||||
collect.forEach(v -> logger.debug("PreferenceLableList ret : {}", v.toString()));
|
||||
return getDataTable(collect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询seg首页轮播图管理列表
|
||||
*/
|
||||
@UnAuth
|
||||
// @PreAuthorize("@ss.hasPermi('segchk:segchk_carouse_mgt:list')")
|
||||
@GetMapping("/DistictList")
|
||||
public TableDataInfo distict_list()
|
||||
{
|
||||
logger.debug("DistictList is call");
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
// sysUser.getNickName();
|
||||
Long providerId = sysUser.getUserId() == 1 ? null : sysUser.getProviderId();
|
||||
startPage();
|
||||
|
||||
SegchkDistrictInfo segchkDistrictInfo = new SegchkDistrictInfo();
|
||||
List<SegchkDistrictInfo> list = segchkDistrictInfoService.selectSegchkDistrictInfoList(segchkDistrictInfo);
|
||||
List<SimpleListObj> collect = list.parallelStream().filter(v -> v.getDistrictLevel() == 0 || v.getDistrictLevel() == 1).map(v -> {
|
||||
SimpleListObj simpleListObj1 = new SimpleListObj();
|
||||
simpleListObj1.setProviderId(String.valueOf(providerId));
|
||||
simpleListObj1.setKey(String.valueOf(v.getDistrictId()));
|
||||
simpleListObj1.setValue(String.valueOf(v.getDistrictName()));
|
||||
return simpleListObj1;
|
||||
}).collect(Collectors.toList());
|
||||
collect.forEach(v -> logger.debug("PreferenceLableList ret : {}", v.toString()));
|
||||
return getDataTable(collect);
|
||||
}
|
||||
|
||||
|
||||
private class SimpleListObj extends BaseEntity {
|
||||
private String providerId;
|
||||
private String key;
|
||||
private String value;
|
||||
private String imgUrl;
|
||||
|
||||
public String getProviderId() {
|
||||
return providerId;
|
||||
}
|
||||
|
||||
public void setProviderId(String providerId) {
|
||||
this.providerId = providerId;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SimpleListObj{" +
|
||||
"providerId='" + providerId + '\'' +
|
||||
", key='" + key + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
", imgUrl='" + imgUrl + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkSmsDetail;
|
||||
import com.ruoyi.segchk.service.ISegchkSmsDetailService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg短信记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_sms_detail")
|
||||
public class SegchkSmsDetailController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkSmsDetailService segchkSmsDetailService;
|
||||
|
||||
/**
|
||||
* 查询seg短信记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_sms_detail:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkSmsDetail segchkSmsDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSmsDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkSmsDetail> list = segchkSmsDetailService.selectSegchkSmsDetailList(segchkSmsDetail);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg短信记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_sms_detail:export')")
|
||||
@Log(title = "seg短信记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkSmsDetail segchkSmsDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSmsDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkSmsDetail> list = segchkSmsDetailService.selectSegchkSmsDetailList(segchkSmsDetail);
|
||||
ExcelUtil<SegchkSmsDetail> util = new ExcelUtil<SegchkSmsDetail>(SegchkSmsDetail.class);
|
||||
return util.exportExcel(list, "seg短信记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg短信记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_sms_detail:query')")
|
||||
@GetMapping(value = "/{shortMsgId}")
|
||||
public AjaxResult getInfo(@PathVariable("shortMsgId") Long shortMsgId)
|
||||
{
|
||||
return AjaxResult.success(segchkSmsDetailService.selectSegchkSmsDetailByShortMsgId(shortMsgId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg短信记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_sms_detail:add')")
|
||||
@Log(title = "seg短信记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkSmsDetail segchkSmsDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSmsDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkSmsDetailService.insertSegchkSmsDetail(segchkSmsDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg短信记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_sms_detail:edit')")
|
||||
@Log(title = "seg短信记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkSmsDetail segchkSmsDetail)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkSmsDetail.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkSmsDetailService.updateSegchkSmsDetail(segchkSmsDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg短信记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_sms_detail:remove')")
|
||||
@Log(title = "seg短信记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{shortMsgIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] shortMsgIds)
|
||||
{
|
||||
return toAjax(segchkSmsDetailService.deleteSegchkSmsDetailByShortMsgIds(shortMsgIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkStoreAccount;
|
||||
import com.ruoyi.segchk.service.ISegchkStoreAccountService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商户余额信息Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_store_account")
|
||||
public class SegchkStoreAccountController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkStoreAccountService segchkStoreAccountService;
|
||||
|
||||
/**
|
||||
* 查询seg商户余额信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_account:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkStoreAccount segchkStoreAccount)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreAccount.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkStoreAccount> list = segchkStoreAccountService.selectSegchkStoreAccountList(segchkStoreAccount);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商户余额信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_account:export')")
|
||||
@Log(title = "seg商户余额信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkStoreAccount segchkStoreAccount)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreAccount.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkStoreAccount> list = segchkStoreAccountService.selectSegchkStoreAccountList(segchkStoreAccount);
|
||||
ExcelUtil<SegchkStoreAccount> util = new ExcelUtil<SegchkStoreAccount>(SegchkStoreAccount.class);
|
||||
return util.exportExcel(list, "seg商户余额信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商户余额信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_account:query')")
|
||||
@GetMapping(value = "/{accountId}")
|
||||
public AjaxResult getInfo(@PathVariable("accountId") Long accountId)
|
||||
{
|
||||
return AjaxResult.success(segchkStoreAccountService.selectSegchkStoreAccountByAccountId(accountId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商户余额信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_account:add')")
|
||||
@Log(title = "seg商户余额信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkStoreAccount segchkStoreAccount)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreAccount.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreAccountService.insertSegchkStoreAccount(segchkStoreAccount));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商户余额信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_account:edit')")
|
||||
@Log(title = "seg商户余额信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkStoreAccount segchkStoreAccount)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreAccount.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreAccountService.updateSegchkStoreAccount(segchkStoreAccount));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商户余额信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_account:remove')")
|
||||
@Log(title = "seg商户余额信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{accountIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] accountIds)
|
||||
{
|
||||
return toAjax(segchkStoreAccountService.deleteSegchkStoreAccountByAccountIds(accountIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkStoreBasicInfo;
|
||||
import com.ruoyi.segchk.service.ISegchkStoreBasicInfoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商家基础信息Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_store_basic_info")
|
||||
public class SegchkStoreBasicInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkStoreBasicInfoService segchkStoreBasicInfoService;
|
||||
|
||||
/**
|
||||
* 查询seg商家基础信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkStoreBasicInfo segchkStoreBasicInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser sysUser = loginUser.getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
System.out.println("segchk:segchk_store_basic_info:list userinfo:" + loginUser.toString());
|
||||
System.out.println("segchk:segchk_store_basic_info:list userinfo:" + sysUser.getRoleId());
|
||||
sysUser.getRoles().forEach(it -> System.out.println(it.toString()));
|
||||
startPage();
|
||||
List<SegchkStoreBasicInfo> list = segchkStoreBasicInfoService.selectSegchkStoreBasicInfoList(segchkStoreBasicInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商家基础信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:export')")
|
||||
@Log(title = "seg商家基础信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkStoreBasicInfo segchkStoreBasicInfo)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkStoreBasicInfo> list = segchkStoreBasicInfoService.selectSegchkStoreBasicInfoList(segchkStoreBasicInfo);
|
||||
ExcelUtil<SegchkStoreBasicInfo> util = new ExcelUtil<SegchkStoreBasicInfo>(SegchkStoreBasicInfo.class);
|
||||
return util.exportExcel(list, "seg商家基础信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商家基础信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:query')")
|
||||
@GetMapping(value = "/{storeId}")
|
||||
public AjaxResult getInfo(@PathVariable("storeId") Long storeId)
|
||||
{
|
||||
return AjaxResult.success(segchkStoreBasicInfoService.selectSegchkStoreBasicInfoByStoreId(storeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商家基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:add')")
|
||||
@Log(title = "seg商家基础信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkStoreBasicInfo segchkStoreBasicInfo)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
int i = segchkStoreBasicInfoService.insertSegchkStoreBasicInfo(segchkStoreBasicInfo);
|
||||
if(i < 0){
|
||||
return AjaxResult.error(500, "手机号码已绑定商户");
|
||||
}
|
||||
else {
|
||||
return toAjax(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商家基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:edit')")
|
||||
@Log(title = "seg商家基础信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("edit_info")
|
||||
public AjaxResult edit(@RequestBody SegchkStoreBasicInfo segchkStoreBasicInfo)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
logger.debug("edit_info with ---> {}", segchkStoreBasicInfo.toString());
|
||||
int i = segchkStoreBasicInfoService.updateSegchkStoreBasicInfo(segchkStoreBasicInfo);
|
||||
if(i < 0){
|
||||
return AjaxResult.error(500, "手机号码已绑定商户");
|
||||
}
|
||||
else {
|
||||
return toAjax(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商家基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:edit')")
|
||||
@Log(title = "seg商家基础信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("update_detail")
|
||||
public AjaxResult update_detail(@RequestBody SegchkStoreBasicInfo segchkStoreBasicInfo)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
logger.debug("update_detail with ---> {}", segchkStoreBasicInfo.toString());
|
||||
int i = segchkStoreBasicInfoService.updateSegchkStoreDetail(segchkStoreBasicInfo);
|
||||
return toAjax(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商家服务状态
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:edit')")
|
||||
@Log(title = "seg商家基础信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("service_state")
|
||||
// public AjaxResult service_state(Long providerId, Long storeId, String serviceState)
|
||||
public AjaxResult service_state(@RequestBody SegchkStoreBasicInfo segchkStoreBasicInfo)
|
||||
{
|
||||
// SegchkStoreBasicInfo segchkStoreBasicInfo = new SegchkStoreBasicInfo();
|
||||
// segchkStoreBasicInfo.setProviderId(providerId);
|
||||
// segchkStoreBasicInfo.setStoreId(storeId);
|
||||
// segchkStoreBasicInfo.setServiceState(serviceState);
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
logger.debug("service_state with: {}", segchkStoreBasicInfo.toString());
|
||||
return toAjax(segchkStoreBasicInfoService.updateSegchkStoreServiceStatus(segchkStoreBasicInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商家基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:remove')")
|
||||
@Log(title = "seg商家基础信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{storeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] storeIds)
|
||||
{
|
||||
return toAjax(segchkStoreBasicInfoService.deleteSegchkStoreBasicInfoByStoreIds(storeIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkStoreCash;
|
||||
import com.ruoyi.segchk.service.ISegchkStoreCashService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商户户提现记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_store_cash")
|
||||
public class SegchkStoreCashController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkStoreCashService segchkStoreCashService;
|
||||
|
||||
/**
|
||||
* 查询seg商户户提现记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_cash:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkStoreCash segchkStoreCash)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreCash.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkStoreCash> list = segchkStoreCashService.selectSegchkStoreCashList(segchkStoreCash);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商户户提现记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_cash:export')")
|
||||
@Log(title = "seg商户户提现记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkStoreCash segchkStoreCash)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreCash.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkStoreCash> list = segchkStoreCashService.selectSegchkStoreCashList(segchkStoreCash);
|
||||
ExcelUtil<SegchkStoreCash> util = new ExcelUtil<SegchkStoreCash>(SegchkStoreCash.class);
|
||||
return util.exportExcel(list, "seg商户户提现记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商户户提现记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_cash:query')")
|
||||
@GetMapping(value = "/{cashId}")
|
||||
public AjaxResult getInfo(@PathVariable("cashId") Long cashId)
|
||||
{
|
||||
return AjaxResult.success(segchkStoreCashService.selectSegchkStoreCashByCashId(cashId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商户户提现记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_cash:add')")
|
||||
@Log(title = "seg商户户提现记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkStoreCash segchkStoreCash)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreCash.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreCashService.insertSegchkStoreCash(segchkStoreCash));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商户户提现记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_cash:edit')")
|
||||
@Log(title = "seg商户户提现记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkStoreCash segchkStoreCash)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreCash.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreCashService.updateSegchkStoreCash(segchkStoreCash));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商户户提现记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_cash:remove')")
|
||||
@Log(title = "seg商户户提现记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{cashIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] cashIds)
|
||||
{
|
||||
return toAjax(segchkStoreCashService.deleteSegchkStoreCashByCashIds(cashIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkStoreCharge;
|
||||
import com.ruoyi.segchk.service.ISegchkStoreChargeService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商户充值记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_store_charge")
|
||||
public class SegchkStoreChargeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkStoreChargeService segchkStoreChargeService;
|
||||
|
||||
/**
|
||||
* 查询seg商户充值记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_charge:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkStoreCharge segchkStoreCharge)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreCharge.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkStoreCharge> list = segchkStoreChargeService.selectSegchkStoreChargeList(segchkStoreCharge);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商户充值记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_charge:export')")
|
||||
@Log(title = "seg商户充值记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkStoreCharge segchkStoreCharge)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreCharge.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkStoreCharge> list = segchkStoreChargeService.selectSegchkStoreChargeList(segchkStoreCharge);
|
||||
ExcelUtil<SegchkStoreCharge> util = new ExcelUtil<SegchkStoreCharge>(SegchkStoreCharge.class);
|
||||
return util.exportExcel(list, "seg商户充值记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商户充值记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_charge:query')")
|
||||
@GetMapping(value = "/{chargeId}")
|
||||
public AjaxResult getInfo(@PathVariable("chargeId") Long chargeId)
|
||||
{
|
||||
return AjaxResult.success(segchkStoreChargeService.selectSegchkStoreChargeByChargeId(chargeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商户充值记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_charge:add')")
|
||||
@Log(title = "seg商户充值记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkStoreCharge segchkStoreCharge)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreCharge.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreChargeService.insertSegchkStoreCharge(segchkStoreCharge));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商户充值记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_charge:edit')")
|
||||
@Log(title = "seg商户充值记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkStoreCharge segchkStoreCharge)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreCharge.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreChargeService.updateSegchkStoreCharge(segchkStoreCharge));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商户充值记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_charge:remove')")
|
||||
@Log(title = "seg商户充值记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{chargeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] chargeIds)
|
||||
{
|
||||
return toAjax(segchkStoreChargeService.deleteSegchkStoreChargeByChargeIds(chargeIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkStoreChkMgt;
|
||||
import com.ruoyi.segchk.service.ISegchkStoreChkMgtService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商家核消卡管理Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_store_chk_mgt")
|
||||
public class SegchkStoreChkMgtController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkStoreChkMgtService segchkStoreChkMgtService;
|
||||
|
||||
/**
|
||||
* 查询seg商家核消卡管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_chk_mgt:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkStoreChkMgt segchkStoreChkMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreChkMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkStoreChkMgt> list = segchkStoreChkMgtService.selectSegchkStoreChkMgtList(segchkStoreChkMgt);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商家核消卡管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_chk_mgt:export')")
|
||||
@Log(title = "seg商家核消卡管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkStoreChkMgt segchkStoreChkMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreChkMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkStoreChkMgt> list = segchkStoreChkMgtService.selectSegchkStoreChkMgtList(segchkStoreChkMgt);
|
||||
ExcelUtil<SegchkStoreChkMgt> util = new ExcelUtil<SegchkStoreChkMgt>(SegchkStoreChkMgt.class);
|
||||
return util.exportExcel(list, "seg商家核消卡管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商家核消卡管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_chk_mgt:query')")
|
||||
@GetMapping(value = "/{mgtId}")
|
||||
public AjaxResult getInfo(@PathVariable("mgtId") Integer mgtId)
|
||||
{
|
||||
return AjaxResult.success(segchkStoreChkMgtService.selectSegchkStoreChkMgtByMgtId(mgtId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商家核消卡管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_chk_mgt:add')")
|
||||
@Log(title = "seg商家核消卡管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkStoreChkMgt segchkStoreChkMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreChkMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreChkMgtService.insertSegchkStoreChkMgt(segchkStoreChkMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商家核消卡管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_chk_mgt:edit')")
|
||||
@Log(title = "seg商家核消卡管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkStoreChkMgt segchkStoreChkMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreChkMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreChkMgtService.updateSegchkStoreChkMgt(segchkStoreChkMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商家核消卡管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_chk_mgt:remove')")
|
||||
@Log(title = "seg商家核消卡管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{mgtIds}")
|
||||
public AjaxResult remove(@PathVariable Integer[] mgtIds)
|
||||
{
|
||||
return toAjax(segchkStoreChkMgtService.deleteSegchkStoreChkMgtByMgtIds(mgtIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkStoreImage;
|
||||
import com.ruoyi.segchk.service.ISegchkStoreImageService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商家图片信息Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_store_image")
|
||||
public class SegchkStoreImageController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkStoreImageService segchkStoreImageService;
|
||||
|
||||
/**
|
||||
* 查询seg商家图片信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_image:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkStoreImage segchkStoreImage)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreImage.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkStoreImage> list = segchkStoreImageService.selectSegchkStoreImageList(segchkStoreImage);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商家图片信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_image:export')")
|
||||
@Log(title = "seg商家图片信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkStoreImage segchkStoreImage)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreImage.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkStoreImage> list = segchkStoreImageService.selectSegchkStoreImageList(segchkStoreImage);
|
||||
ExcelUtil<SegchkStoreImage> util = new ExcelUtil<SegchkStoreImage>(SegchkStoreImage.class);
|
||||
return util.exportExcel(list, "seg商家图片信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商家图片信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_image:query')")
|
||||
@GetMapping(value = "/{storeId}")
|
||||
public AjaxResult getInfo(@PathVariable("storeId") Long storeId)
|
||||
{
|
||||
return AjaxResult.success(segchkStoreImageService.selectSegchkStoreImageByStoreId(storeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商家图片信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_image:add')")
|
||||
@Log(title = "seg商家图片信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkStoreImage segchkStoreImage)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreImage.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreImageService.insertSegchkStoreImage(segchkStoreImage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商家图片信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_image:edit')")
|
||||
@Log(title = "seg商家图片信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkStoreImage segchkStoreImage)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreImage.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreImageService.updateSegchkStoreImage(segchkStoreImage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商家图片信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_image:remove')")
|
||||
@Log(title = "seg商家图片信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{storeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] storeIds)
|
||||
{
|
||||
return toAjax(segchkStoreImageService.deleteSegchkStoreImageByStoreIds(storeIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkStoreLableMgt;
|
||||
import com.ruoyi.segchk.service.ISegchkStoreLableMgtService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商家标签管理Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_store_lable_mgt")
|
||||
public class SegchkStoreLableMgtController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkStoreLableMgtService segchkStoreLableMgtService;
|
||||
|
||||
/**
|
||||
* 查询seg商家标签管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_lable_mgt:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkStoreLableMgt segchkStoreLableMgt)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreLableMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkStoreLableMgt> list = segchkStoreLableMgtService.selectSegchkStoreLableMgtList(segchkStoreLableMgt);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商家标签管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_lable_mgt:export')")
|
||||
@Log(title = "seg商家标签管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkStoreLableMgt segchkStoreLableMgt)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreLableMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkStoreLableMgt> list = segchkStoreLableMgtService.selectSegchkStoreLableMgtList(segchkStoreLableMgt);
|
||||
ExcelUtil<SegchkStoreLableMgt> util = new ExcelUtil<SegchkStoreLableMgt>(SegchkStoreLableMgt.class);
|
||||
return util.exportExcel(list, "seg商家标签管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商家标签管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_lable_mgt:query')")
|
||||
@GetMapping(value = "/{mgtId}")
|
||||
public AjaxResult getInfo(@PathVariable("mgtId") Integer mgtId)
|
||||
{
|
||||
return AjaxResult.success(segchkStoreLableMgtService.selectSegchkStoreLableMgtByMgtId(mgtId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商家标签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_lable_mgt:add')")
|
||||
@Log(title = "seg商家标签管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkStoreLableMgt segchkStoreLableMgt)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreLableMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreLableMgtService.insertSegchkStoreLableMgt(segchkStoreLableMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商家标签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_lable_mgt:edit')")
|
||||
@Log(title = "seg商家标签管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody SegchkStoreLableMgt segchkStoreLableMgt)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreLableMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreLableMgtService.updateSegchkStoreLableMgt(segchkStoreLableMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商家标签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_lable_mgt:edit')")
|
||||
@Log(title = "seg商家标签管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/update_status")
|
||||
public AjaxResult update_status(@RequestBody SegchkStoreLableMgt segchkStoreLableMgt)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreLableMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreLableMgtService.updateSegchkStoreLableMgt(segchkStoreLableMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商家标签管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_lable_mgt:remove')")
|
||||
@Log(title = "seg商家标签管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{mgtIds}")
|
||||
public AjaxResult remove(@PathVariable Integer[] mgtIds)
|
||||
{
|
||||
return toAjax(segchkStoreLableMgtService.deleteSegchkStoreLableMgtByMgtIds(mgtIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkStoreReward;
|
||||
import com.ruoyi.segchk.service.ISegchkStoreRewardService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商户奖励Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_store_reward")
|
||||
public class SegchkStoreRewardController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkStoreRewardService segchkStoreRewardService;
|
||||
|
||||
/**
|
||||
* 查询seg商户奖励列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_reward:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkStoreReward segchkStoreReward)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreReward.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkStoreReward> list = segchkStoreRewardService.selectSegchkStoreRewardList(segchkStoreReward);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商户奖励列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_reward:export')")
|
||||
@Log(title = "seg商户奖励", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkStoreReward segchkStoreReward)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreReward.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkStoreReward> list = segchkStoreRewardService.selectSegchkStoreRewardList(segchkStoreReward);
|
||||
ExcelUtil<SegchkStoreReward> util = new ExcelUtil<SegchkStoreReward>(SegchkStoreReward.class);
|
||||
return util.exportExcel(list, "seg商户奖励数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商户奖励详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_reward:query')")
|
||||
@GetMapping(value = "/{rewardId}")
|
||||
public AjaxResult getInfo(@PathVariable("rewardId") Long rewardId)
|
||||
{
|
||||
return AjaxResult.success(segchkStoreRewardService.selectSegchkStoreRewardByRewardId(rewardId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商户奖励
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_reward:add')")
|
||||
@Log(title = "seg商户奖励", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkStoreReward segchkStoreReward)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreReward.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreRewardService.insertSegchkStoreReward(segchkStoreReward));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商户奖励
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_reward:edit')")
|
||||
@Log(title = "seg商户奖励", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkStoreReward segchkStoreReward)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreReward.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreRewardService.updateSegchkStoreReward(segchkStoreReward));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商户奖励
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_reward:remove')")
|
||||
@Log(title = "seg商户奖励", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{rewardIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] rewardIds)
|
||||
{
|
||||
return toAjax(segchkStoreRewardService.deleteSegchkStoreRewardByRewardIds(rewardIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkStoreSecurity;
|
||||
import com.ruoyi.segchk.service.ISegchkStoreSecurityService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商户密码Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_store_security")
|
||||
public class SegchkStoreSecurityController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkStoreSecurityService segchkStoreSecurityService;
|
||||
|
||||
/**
|
||||
* 查询seg商户密码列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_security:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkStoreSecurity segchkStoreSecurity)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreSecurity.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkStoreSecurity> list = segchkStoreSecurityService.selectSegchkStoreSecurityList(segchkStoreSecurity);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商户密码列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_security:export')")
|
||||
@Log(title = "seg商户密码", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkStoreSecurity segchkStoreSecurity)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreSecurity.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkStoreSecurity> list = segchkStoreSecurityService.selectSegchkStoreSecurityList(segchkStoreSecurity);
|
||||
ExcelUtil<SegchkStoreSecurity> util = new ExcelUtil<SegchkStoreSecurity>(SegchkStoreSecurity.class);
|
||||
return util.exportExcel(list, "seg商户密码数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商户密码详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_security:query')")
|
||||
@GetMapping(value = "/{pwdId}")
|
||||
public AjaxResult getInfo(@PathVariable("pwdId") Long pwdId)
|
||||
{
|
||||
return AjaxResult.success(segchkStoreSecurityService.selectSegchkStoreSecurityByPwdId(pwdId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商户密码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_security:add')")
|
||||
@Log(title = "seg商户密码", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkStoreSecurity segchkStoreSecurity)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreSecurity.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreSecurityService.insertSegchkStoreSecurity(segchkStoreSecurity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商户密码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_security:edit')")
|
||||
@Log(title = "seg商户密码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkStoreSecurity segchkStoreSecurity)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreSecurity.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreSecurityService.updateSegchkStoreSecurity(segchkStoreSecurity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商户密码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_security:remove')")
|
||||
@Log(title = "seg商户密码", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{pwdIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] pwdIds)
|
||||
{
|
||||
return toAjax(segchkStoreSecurityService.deleteSegchkStoreSecurityByPwdIds(pwdIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkStoreSelfMgt;
|
||||
import com.ruoyi.segchk.service.ISegchkStoreSelfMgtService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg商家自定义卡管理Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_store_self_mgt")
|
||||
public class SegchkStoreSelfMgtController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkStoreSelfMgtService segchkStoreSelfMgtService;
|
||||
|
||||
/**
|
||||
* 查询seg商家自定义卡管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_self_mgt:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkStoreSelfMgt segchkStoreSelfMgt)
|
||||
{
|
||||
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreSelfMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkStoreSelfMgt> list = segchkStoreSelfMgtService.selectSegchkStoreSelfMgtList(segchkStoreSelfMgt);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg商家自定义卡管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_self_mgt:export')")
|
||||
@Log(title = "seg商家自定义卡管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkStoreSelfMgt segchkStoreSelfMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreSelfMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkStoreSelfMgt> list = segchkStoreSelfMgtService.selectSegchkStoreSelfMgtList(segchkStoreSelfMgt);
|
||||
ExcelUtil<SegchkStoreSelfMgt> util = new ExcelUtil<SegchkStoreSelfMgt>(SegchkStoreSelfMgt.class);
|
||||
return util.exportExcel(list, "seg商家自定义卡管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg商家自定义卡管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_self_mgt:query')")
|
||||
@GetMapping(value = "/{freeCardId}")
|
||||
public AjaxResult getInfo(@PathVariable("freeCardId") Long freeCardId)
|
||||
{
|
||||
return AjaxResult.success(segchkStoreSelfMgtService.selectSegchkStoreSelfMgtByFreeCardId(freeCardId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg商家自定义卡管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_self_mgt:add')")
|
||||
@Log(title = "seg商家自定义卡管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkStoreSelfMgt segchkStoreSelfMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreSelfMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreSelfMgtService.insertSegchkStoreSelfMgt(segchkStoreSelfMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg商家自定义卡管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_self_mgt:edit')")
|
||||
@Log(title = "seg商家自定义卡管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkStoreSelfMgt segchkStoreSelfMgt)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreSelfMgt.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkStoreSelfMgtService.updateSegchkStoreSelfMgt(segchkStoreSelfMgt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg商家自定义卡管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_self_mgt:remove')")
|
||||
@Log(title = "seg商家自定义卡管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{freeCardIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] freeCardIds)
|
||||
{
|
||||
return toAjax(segchkStoreSelfMgtService.deleteSegchkStoreSelfMgtByFreeCardIds(freeCardIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.annotation.UnAuth;
|
||||
import com.ruoyi.segchk.domain.BaseInfoSet;
|
||||
import com.ruoyi.segchk.domain.SegchkBaseInfoSet;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkSystemSetting;
|
||||
import com.ruoyi.segchk.service.ISegchkSystemSettingService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 系统设置Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-10-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_system_setting")
|
||||
public class SegchkSystemSettingController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkSystemSettingService segchkSystemSettingService;
|
||||
|
||||
/**
|
||||
* 查询系统设置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_system_setting:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkSystemSetting segchkSystemSetting)
|
||||
{
|
||||
startPage();
|
||||
List<SegchkSystemSetting> list = segchkSystemSettingService.selectSegchkSystemSettingList(segchkSystemSetting);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出系统设置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_system_setting:export')")
|
||||
@Log(title = "系统设置", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkSystemSetting segchkSystemSetting)
|
||||
{
|
||||
List<SegchkSystemSetting> list = segchkSystemSettingService.selectSegchkSystemSettingList(segchkSystemSetting);
|
||||
ExcelUtil<SegchkSystemSetting> util = new ExcelUtil<SegchkSystemSetting>(SegchkSystemSetting.class);
|
||||
return util.exportExcel(list, "系统设置数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统设置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_system_setting:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(segchkSystemSettingService.selectSegchkSystemSettingById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增系统设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_system_setting:add')")
|
||||
@Log(title = "系统设置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkSystemSetting segchkSystemSetting)
|
||||
{
|
||||
return toAjax(segchkSystemSettingService.insertSegchkSystemSetting(segchkSystemSetting));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_system_setting:edit')")
|
||||
@Log(title = "系统设置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody SegchkSystemSetting segchkSystemSetting)
|
||||
{
|
||||
return toAjax(segchkSystemSettingService.updateSegchkSystemSetting(segchkSystemSetting));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_system_setting:remove')")
|
||||
@Log(title = "系统设置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(segchkSystemSettingService.deleteSegchkSystemSettingByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@UnAuth
|
||||
@GetMapping("/query")
|
||||
public AjaxResult query()
|
||||
{
|
||||
BaseInfoSet baseInfoSet = segchkSystemSettingService.queryBaseInfoSet();
|
||||
return AjaxResult.success(baseInfoSet);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改系统设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_system_setting')")
|
||||
@Log(title = "系统设置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
public AjaxResult update(@RequestBody BaseInfoSet baseInfoSet)
|
||||
{
|
||||
logger.debug("update with --- {}", baseInfoSet.toString());
|
||||
return toAjax(segchkSystemSettingService.editBaseInfoSet(baseInfoSet, 1));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserAccount;
|
||||
import com.ruoyi.segchk.service.ISegchkUserAccountService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户余额信息Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_account")
|
||||
public class SegchkUserAccountController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserAccountService segchkUserAccountService;
|
||||
|
||||
/**
|
||||
* 查询seg用户余额信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_account:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserAccount segchkUserAccount)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserAccount.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserAccount> list = segchkUserAccountService.selectSegchkUserAccountList(segchkUserAccount);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户余额信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_account:export')")
|
||||
@Log(title = "seg用户余额信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserAccount segchkUserAccount)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserAccount.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserAccount> list = segchkUserAccountService.selectSegchkUserAccountList(segchkUserAccount);
|
||||
ExcelUtil<SegchkUserAccount> util = new ExcelUtil<SegchkUserAccount>(SegchkUserAccount.class);
|
||||
return util.exportExcel(list, "seg用户余额信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户余额信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_account:query')")
|
||||
@GetMapping(value = "/{accountId}")
|
||||
public AjaxResult getInfo(@PathVariable("accountId") Long accountId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserAccountService.selectSegchkUserAccountByAccountId(accountId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户余额信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_account:add')")
|
||||
@Log(title = "seg用户余额信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserAccount segchkUserAccount)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserAccount.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserAccountService.insertSegchkUserAccount(segchkUserAccount));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户余额信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_account:edit')")
|
||||
@Log(title = "seg用户余额信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserAccount segchkUserAccount)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserAccount.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserAccountService.updateSegchkUserAccount(segchkUserAccount));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户余额信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_account:remove')")
|
||||
@Log(title = "seg用户余额信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{accountIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] accountIds)
|
||||
{
|
||||
return toAjax(segchkUserAccountService.deleteSegchkUserAccountByAccountIds(accountIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserBasicInfo;
|
||||
import com.ruoyi.segchk.service.ISegchkUserBasicInfoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户基本信息Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_basic_info")
|
||||
public class SegchkUserBasicInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserBasicInfoService segchkUserBasicInfoService;
|
||||
|
||||
/**
|
||||
* 查询seg用户基本信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_basic_info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserBasicInfo segchkUserBasicInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserBasicInfo> list = segchkUserBasicInfoService.selectSegchkUserBasicInfoList(segchkUserBasicInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户基本信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_basic_info:export')")
|
||||
@Log(title = "seg用户基本信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserBasicInfo segchkUserBasicInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserBasicInfo> list = segchkUserBasicInfoService.selectSegchkUserBasicInfoList(segchkUserBasicInfo);
|
||||
ExcelUtil<SegchkUserBasicInfo> util = new ExcelUtil<SegchkUserBasicInfo>(SegchkUserBasicInfo.class);
|
||||
return util.exportExcel(list, "seg用户基本信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户基本信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_basic_info:query')")
|
||||
@GetMapping(value = "/{userId}")
|
||||
public AjaxResult getInfo(@PathVariable("userId") Long userId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserBasicInfoService.selectSegchkUserBasicInfoByUserId(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户基本信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_basic_info:add')")
|
||||
@Log(title = "seg用户基本信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserBasicInfo segchkUserBasicInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserBasicInfoService.insertSegchkUserBasicInfo(segchkUserBasicInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户基本信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_basic_info:edit')")
|
||||
@Log(title = "seg用户基本信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserBasicInfo segchkUserBasicInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserBasicInfoService.updateSegchkUserBasicInfo(segchkUserBasicInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户基本信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_basic_info:remove')")
|
||||
@Log(title = "seg用户基本信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||
{
|
||||
return toAjax(segchkUserBasicInfoService.deleteSegchkUserBasicInfoByUserIds(userIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserCash;
|
||||
import com.ruoyi.segchk.service.ISegchkUserCashService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户提现记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_cash")
|
||||
public class SegchkUserCashController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserCashService segchkUserCashService;
|
||||
|
||||
/**
|
||||
* 查询seg用户提现记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_cash:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserCash segchkUserCash)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCash.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserCash> list = segchkUserCashService.selectSegchkUserCashList(segchkUserCash);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户提现记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_cash:export')")
|
||||
@Log(title = "seg用户提现记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserCash segchkUserCash)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCash.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserCash> list = segchkUserCashService.selectSegchkUserCashList(segchkUserCash);
|
||||
ExcelUtil<SegchkUserCash> util = new ExcelUtil<SegchkUserCash>(SegchkUserCash.class);
|
||||
return util.exportExcel(list, "seg用户提现记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户提现记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_cash:query')")
|
||||
@GetMapping(value = "/{cashId}")
|
||||
public AjaxResult getInfo(@PathVariable("cashId") Long cashId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserCashService.selectSegchkUserCashByCashId(cashId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户提现记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_cash:add')")
|
||||
@Log(title = "seg用户提现记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserCash segchkUserCash)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCash.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserCashService.insertSegchkUserCash(segchkUserCash));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户提现记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_cash:edit')")
|
||||
@Log(title = "seg用户提现记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserCash segchkUserCash)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCash.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserCashService.updateSegchkUserCash(segchkUserCash));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户提现记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_cash:remove')")
|
||||
@Log(title = "seg用户提现记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{cashIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] cashIds)
|
||||
{
|
||||
return toAjax(segchkUserCashService.deleteSegchkUserCashByCashIds(cashIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserCertificationInfo;
|
||||
import com.ruoyi.segchk.service.ISegchkUserCertificationInfoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户实名认证信息Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_certification_info")
|
||||
public class SegchkUserCertificationInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserCertificationInfoService segchkUserCertificationInfoService;
|
||||
|
||||
/**
|
||||
* 查询seg用户实名认证信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_certification_info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserCertificationInfo segchkUserCertificationInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCertificationInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserCertificationInfo> list = segchkUserCertificationInfoService.selectSegchkUserCertificationInfoList(segchkUserCertificationInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户实名认证信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_certification_info:export')")
|
||||
@Log(title = "seg用户实名认证信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserCertificationInfo segchkUserCertificationInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCertificationInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserCertificationInfo> list = segchkUserCertificationInfoService.selectSegchkUserCertificationInfoList(segchkUserCertificationInfo);
|
||||
ExcelUtil<SegchkUserCertificationInfo> util = new ExcelUtil<SegchkUserCertificationInfo>(SegchkUserCertificationInfo.class);
|
||||
return util.exportExcel(list, "seg用户实名认证信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户实名认证信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_certification_info:query')")
|
||||
@GetMapping(value = "/{usercardId}")
|
||||
public AjaxResult getInfo(@PathVariable("usercardId") Long usercardId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserCertificationInfoService.selectSegchkUserCertificationInfoByUsercardId(usercardId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户实名认证信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_certification_info:add')")
|
||||
@Log(title = "seg用户实名认证信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserCertificationInfo segchkUserCertificationInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCertificationInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserCertificationInfoService.insertSegchkUserCertificationInfo(segchkUserCertificationInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户实名认证信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_certification_info:edit')")
|
||||
@Log(title = "seg用户实名认证信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserCertificationInfo segchkUserCertificationInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCertificationInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserCertificationInfoService.updateSegchkUserCertificationInfo(segchkUserCertificationInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户实名认证信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_certification_info:remove')")
|
||||
@Log(title = "seg用户实名认证信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{usercardIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] usercardIds)
|
||||
{
|
||||
return toAjax(segchkUserCertificationInfoService.deleteSegchkUserCertificationInfoByUsercardIds(usercardIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserCharge;
|
||||
import com.ruoyi.segchk.service.ISegchkUserChargeService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户充值记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_charge")
|
||||
public class SegchkUserChargeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserChargeService segchkUserChargeService;
|
||||
|
||||
/**
|
||||
* 查询seg用户充值记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_charge:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserCharge segchkUserCharge)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCharge.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserCharge> list = segchkUserChargeService.selectSegchkUserChargeList(segchkUserCharge);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户充值记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_charge:export')")
|
||||
@Log(title = "seg用户充值记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserCharge segchkUserCharge)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCharge.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserCharge> list = segchkUserChargeService.selectSegchkUserChargeList(segchkUserCharge);
|
||||
ExcelUtil<SegchkUserCharge> util = new ExcelUtil<SegchkUserCharge>(SegchkUserCharge.class);
|
||||
return util.exportExcel(list, "seg用户充值记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户充值记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_charge:query')")
|
||||
@GetMapping(value = "/{chargeId}")
|
||||
public AjaxResult getInfo(@PathVariable("chargeId") Long chargeId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserChargeService.selectSegchkUserChargeByChargeId(chargeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户充值记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_charge:add')")
|
||||
@Log(title = "seg用户充值记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserCharge segchkUserCharge)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCharge.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserChargeService.insertSegchkUserCharge(segchkUserCharge));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户充值记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_charge:edit')")
|
||||
@Log(title = "seg用户充值记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserCharge segchkUserCharge)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCharge.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserChargeService.updateSegchkUserCharge(segchkUserCharge));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户充值记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_charge:remove')")
|
||||
@Log(title = "seg用户充值记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{chargeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] chargeIds)
|
||||
{
|
||||
return toAjax(segchkUserChargeService.deleteSegchkUserChargeByChargeIds(chargeIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserCollect;
|
||||
import com.ruoyi.segchk.service.ISegchkUserCollectService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户收藏记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_collect")
|
||||
public class SegchkUserCollectController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserCollectService segchkUserCollectService;
|
||||
|
||||
/**
|
||||
* 查询seg用户收藏记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_collect:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserCollect segchkUserCollect)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCollect.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserCollect> list = segchkUserCollectService.selectSegchkUserCollectList(segchkUserCollect);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户收藏记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_collect:export')")
|
||||
@Log(title = "seg用户收藏记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserCollect segchkUserCollect)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCollect.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserCollect> list = segchkUserCollectService.selectSegchkUserCollectList(segchkUserCollect);
|
||||
ExcelUtil<SegchkUserCollect> util = new ExcelUtil<SegchkUserCollect>(SegchkUserCollect.class);
|
||||
return util.exportExcel(list, "seg用户收藏记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户收藏记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_collect:query')")
|
||||
@GetMapping(value = "/{collectId}")
|
||||
public AjaxResult getInfo(@PathVariable("collectId") Long collectId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserCollectService.selectSegchkUserCollectByCollectId(collectId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户收藏记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_collect:add')")
|
||||
@Log(title = "seg用户收藏记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserCollect segchkUserCollect)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCollect.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserCollectService.insertSegchkUserCollect(segchkUserCollect));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户收藏记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_collect:edit')")
|
||||
@Log(title = "seg用户收藏记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserCollect segchkUserCollect)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserCollect.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserCollectService.updateSegchkUserCollect(segchkUserCollect));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户收藏记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_collect:remove')")
|
||||
@Log(title = "seg用户收藏记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{collectIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] collectIds)
|
||||
{
|
||||
return toAjax(segchkUserCollectService.deleteSegchkUserCollectByCollectIds(collectIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserExtInfo;
|
||||
import com.ruoyi.segchk.service.ISegchkUserExtInfoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户扩展信息Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_ext_info")
|
||||
public class SegchkUserExtInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserExtInfoService segchkUserExtInfoService;
|
||||
|
||||
/**
|
||||
* 查询seg用户扩展信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_ext_info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserExtInfo segchkUserExtInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserExtInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserExtInfo> list = segchkUserExtInfoService.selectSegchkUserExtInfoList(segchkUserExtInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户扩展信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_ext_info:export')")
|
||||
@Log(title = "seg用户扩展信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserExtInfo segchkUserExtInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserExtInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserExtInfo> list = segchkUserExtInfoService.selectSegchkUserExtInfoList(segchkUserExtInfo);
|
||||
ExcelUtil<SegchkUserExtInfo> util = new ExcelUtil<SegchkUserExtInfo>(SegchkUserExtInfo.class);
|
||||
return util.exportExcel(list, "seg用户扩展信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户扩展信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_ext_info:query')")
|
||||
@GetMapping(value = "/{userId}")
|
||||
public AjaxResult getInfo(@PathVariable("userId") Long userId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserExtInfoService.selectSegchkUserExtInfoByUserId(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户扩展信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_ext_info:add')")
|
||||
@Log(title = "seg用户扩展信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserExtInfo segchkUserExtInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserExtInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserExtInfoService.insertSegchkUserExtInfo(segchkUserExtInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户扩展信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_ext_info:edit')")
|
||||
@Log(title = "seg用户扩展信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserExtInfo segchkUserExtInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserExtInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserExtInfoService.updateSegchkUserExtInfo(segchkUserExtInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户扩展信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_ext_info:remove')")
|
||||
@Log(title = "seg用户扩展信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||
{
|
||||
return toAjax(segchkUserExtInfoService.deleteSegchkUserExtInfoByUserIds(userIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserLikego;
|
||||
import com.ruoyi.segchk.service.ISegchkUserLikegoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户想去记录Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_likego")
|
||||
public class SegchkUserLikegoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserLikegoService segchkUserLikegoService;
|
||||
|
||||
/**
|
||||
* 查询seg用户想去记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_likego:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserLikego segchkUserLikego)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserLikego.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserLikego> list = segchkUserLikegoService.selectSegchkUserLikegoList(segchkUserLikego);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户想去记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_likego:export')")
|
||||
@Log(title = "seg用户想去记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserLikego segchkUserLikego)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserLikego.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserLikego> list = segchkUserLikegoService.selectSegchkUserLikegoList(segchkUserLikego);
|
||||
ExcelUtil<SegchkUserLikego> util = new ExcelUtil<SegchkUserLikego>(SegchkUserLikego.class);
|
||||
return util.exportExcel(list, "seg用户想去记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户想去记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_likego:query')")
|
||||
@GetMapping(value = "/{likegoId}")
|
||||
public AjaxResult getInfo(@PathVariable("likegoId") Long likegoId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserLikegoService.selectSegchkUserLikegoByLikegoId(likegoId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户想去记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_likego:add')")
|
||||
@Log(title = "seg用户想去记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserLikego segchkUserLikego)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserLikego.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserLikegoService.insertSegchkUserLikego(segchkUserLikego));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户想去记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_likego:edit')")
|
||||
@Log(title = "seg用户想去记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserLikego segchkUserLikego)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserLikego.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserLikegoService.updateSegchkUserLikego(segchkUserLikego));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户想去记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_likego:remove')")
|
||||
@Log(title = "seg用户想去记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{likegoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] likegoIds)
|
||||
{
|
||||
return toAjax(segchkUserLikegoService.deleteSegchkUserLikegoByLikegoIds(likegoIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserReward;
|
||||
import com.ruoyi.segchk.service.ISegchkUserRewardService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户奖励Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_reward")
|
||||
public class SegchkUserRewardController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserRewardService segchkUserRewardService;
|
||||
|
||||
/**
|
||||
* 查询seg用户奖励列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserReward segchkUserReward)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserReward.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserReward> list = segchkUserRewardService.selectSegchkUserRewardList(segchkUserReward);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户奖励列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward:export')")
|
||||
@Log(title = "seg用户奖励", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserReward segchkUserReward)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserReward.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserReward> list = segchkUserRewardService.selectSegchkUserRewardList(segchkUserReward);
|
||||
ExcelUtil<SegchkUserReward> util = new ExcelUtil<SegchkUserReward>(SegchkUserReward.class);
|
||||
return util.exportExcel(list, "seg用户奖励数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户奖励详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward:query')")
|
||||
@GetMapping(value = "/{rewardId}")
|
||||
public AjaxResult getInfo(@PathVariable("rewardId") Long rewardId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserRewardService.selectSegchkUserRewardByRewardId(rewardId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户奖励
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward:add')")
|
||||
@Log(title = "seg用户奖励", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserReward segchkUserReward)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserReward.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserRewardService.insertSegchkUserReward(segchkUserReward));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户奖励
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward:edit')")
|
||||
@Log(title = "seg用户奖励", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserReward segchkUserReward)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserReward.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserRewardService.updateSegchkUserReward(segchkUserReward));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户奖励
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward:remove')")
|
||||
@Log(title = "seg用户奖励", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{rewardIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] rewardIds)
|
||||
{
|
||||
return toAjax(segchkUserRewardService.deleteSegchkUserRewardByRewardIds(rewardIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserRewardCtl;
|
||||
import com.ruoyi.segchk.service.ISegchkUserRewardCtlService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg会员推荐控制Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_reward_ctl")
|
||||
public class SegchkUserRewardCtlController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserRewardCtlService segchkUserRewardCtlService;
|
||||
|
||||
/**
|
||||
* 查询seg会员推荐控制列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward_ctl:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserRewardCtl segchkUserRewardCtl)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserRewardCtl.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserRewardCtl> list = segchkUserRewardCtlService.selectSegchkUserRewardCtlList(segchkUserRewardCtl);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg会员推荐控制列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward_ctl:export')")
|
||||
@Log(title = "seg会员推荐控制", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserRewardCtl segchkUserRewardCtl)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserRewardCtl.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserRewardCtl> list = segchkUserRewardCtlService.selectSegchkUserRewardCtlList(segchkUserRewardCtl);
|
||||
ExcelUtil<SegchkUserRewardCtl> util = new ExcelUtil<SegchkUserRewardCtl>(SegchkUserRewardCtl.class);
|
||||
return util.exportExcel(list, "seg会员推荐控制数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg会员推荐控制详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward_ctl:query')")
|
||||
@GetMapping(value = "/{rewardCtlId}")
|
||||
public AjaxResult getInfo(@PathVariable("rewardCtlId") Integer rewardCtlId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserRewardCtlService.selectSegchkUserRewardCtlByRewardCtlId(rewardCtlId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg会员推荐控制
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward_ctl:add')")
|
||||
@Log(title = "seg会员推荐控制", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserRewardCtl segchkUserRewardCtl)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserRewardCtl.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserRewardCtlService.insertSegchkUserRewardCtl(segchkUserRewardCtl));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg会员推荐控制
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward_ctl:edit')")
|
||||
@Log(title = "seg会员推荐控制", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserRewardCtl segchkUserRewardCtl)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserRewardCtl.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserRewardCtlService.updateSegchkUserRewardCtl(segchkUserRewardCtl));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg会员推荐控制
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_reward_ctl:remove')")
|
||||
@Log(title = "seg会员推荐控制", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{rewardCtlIds}")
|
||||
public AjaxResult remove(@PathVariable Integer[] rewardCtlIds)
|
||||
{
|
||||
return toAjax(segchkUserRewardCtlService.deleteSegchkUserRewardCtlByRewardCtlIds(rewardCtlIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserSecurity;
|
||||
import com.ruoyi.segchk.service.ISegchkUserSecurityService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户密码Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_security")
|
||||
public class SegchkUserSecurityController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserSecurityService segchkUserSecurityService;
|
||||
|
||||
/**
|
||||
* 查询seg用户密码列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_security:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserSecurity segchkUserSecurity)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserSecurity.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserSecurity> list = segchkUserSecurityService.selectSegchkUserSecurityList(segchkUserSecurity);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户密码列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_security:export')")
|
||||
@Log(title = "seg用户密码", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserSecurity segchkUserSecurity)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserSecurity.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserSecurity> list = segchkUserSecurityService.selectSegchkUserSecurityList(segchkUserSecurity);
|
||||
ExcelUtil<SegchkUserSecurity> util = new ExcelUtil<SegchkUserSecurity>(SegchkUserSecurity.class);
|
||||
return util.exportExcel(list, "seg用户密码数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户密码详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_security:query')")
|
||||
@GetMapping(value = "/{pwdId}")
|
||||
public AjaxResult getInfo(@PathVariable("pwdId") Long pwdId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserSecurityService.selectSegchkUserSecurityByPwdId(pwdId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户密码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_security:add')")
|
||||
@Log(title = "seg用户密码", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserSecurity segchkUserSecurity)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserSecurity.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserSecurityService.insertSegchkUserSecurity(segchkUserSecurity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户密码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_security:edit')")
|
||||
@Log(title = "seg用户密码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserSecurity segchkUserSecurity)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserSecurity.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserSecurityService.updateSegchkUserSecurity(segchkUserSecurity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户密码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_security:remove')")
|
||||
@Log(title = "seg用户密码", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{pwdIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] pwdIds)
|
||||
{
|
||||
return toAjax(segchkUserSecurityService.deleteSegchkUserSecurityByPwdIds(pwdIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserVip;
|
||||
import com.ruoyi.segchk.service.ISegchkUserVipService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg会员卡Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_vip")
|
||||
public class SegchkUserVipController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserVipService segchkUserVipService;
|
||||
|
||||
/**
|
||||
* 查询seg会员卡列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_vip:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserVip segchkUserVip)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserVip.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserVip> list = segchkUserVipService.selectSegchkUserVipList(segchkUserVip);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg会员卡列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_vip:export')")
|
||||
@Log(title = "seg会员卡", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserVip segchkUserVip)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserVip.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserVip> list = segchkUserVipService.selectSegchkUserVipList(segchkUserVip);
|
||||
ExcelUtil<SegchkUserVip> util = new ExcelUtil<SegchkUserVip>(SegchkUserVip.class);
|
||||
return util.exportExcel(list, "seg会员卡数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg会员卡详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_vip:query')")
|
||||
@GetMapping(value = "/{cardId}")
|
||||
public AjaxResult getInfo(@PathVariable("cardId") Long cardId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserVipService.selectSegchkUserVipByCardId(cardId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg会员卡
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_vip:add')")
|
||||
@Log(title = "seg会员卡", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserVip segchkUserVip)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserVip.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserVipService.insertSegchkUserVip(segchkUserVip));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg会员卡
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_vip:edit')")
|
||||
@Log(title = "seg会员卡", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserVip segchkUserVip)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserVip.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserVipService.updateSegchkUserVip(segchkUserVip));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg会员卡
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_vip:remove')")
|
||||
@Log(title = "seg会员卡", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{cardIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] cardIds)
|
||||
{
|
||||
return toAjax(segchkUserVipService.deleteSegchkUserVipByCardIds(cardIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkUserWechat;
|
||||
import com.ruoyi.segchk.service.ISegchkUserWechatService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg用户微信信息Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_user_wechat")
|
||||
public class SegchkUserWechatController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkUserWechatService segchkUserWechatService;
|
||||
|
||||
/**
|
||||
* 查询seg用户微信信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_wechat:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkUserWechat segchkUserWechat)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserWechat.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkUserWechat> list = segchkUserWechatService.selectSegchkUserWechatList(segchkUserWechat);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg用户微信信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_wechat:export')")
|
||||
@Log(title = "seg用户微信信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkUserWechat segchkUserWechat)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserWechat.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkUserWechat> list = segchkUserWechatService.selectSegchkUserWechatList(segchkUserWechat);
|
||||
ExcelUtil<SegchkUserWechat> util = new ExcelUtil<SegchkUserWechat>(SegchkUserWechat.class);
|
||||
return util.exportExcel(list, "seg用户微信信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg用户微信信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_wechat:query')")
|
||||
@GetMapping(value = "/{userId}")
|
||||
public AjaxResult getInfo(@PathVariable("userId") Long userId)
|
||||
{
|
||||
return AjaxResult.success(segchkUserWechatService.selectSegchkUserWechatByUserId(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg用户微信信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_wechat:add')")
|
||||
@Log(title = "seg用户微信信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkUserWechat segchkUserWechat)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserWechat.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserWechatService.insertSegchkUserWechat(segchkUserWechat));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg用户微信信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_wechat:edit')")
|
||||
@Log(title = "seg用户微信信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkUserWechat segchkUserWechat)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkUserWechat.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkUserWechatService.updateSegchkUserWechat(segchkUserWechat));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg用户微信信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_user_wechat:remove')")
|
||||
@Log(title = "seg用户微信信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||
{
|
||||
return toAjax(segchkUserWechatService.deleteSegchkUserWechatByUserIds(userIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.segchk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.segchk.domain.SegchkVipSetInfo;
|
||||
import com.ruoyi.segchk.service.ISegchkVipSetInfoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* seg会员卡设置Controller
|
||||
*
|
||||
* @author yinzhiying
|
||||
* @date 2021-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/segchk/segchk_vip_set_info")
|
||||
public class SegchkVipSetInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISegchkVipSetInfoService segchkVipSetInfoService;
|
||||
|
||||
/**
|
||||
* 查询seg会员卡设置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_vip_set_info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SegchkVipSetInfo segchkVipSetInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkVipSetInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
startPage();
|
||||
List<SegchkVipSetInfo> list = segchkVipSetInfoService.selectSegchkVipSetInfoList(segchkVipSetInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出seg会员卡设置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_vip_set_info:export')")
|
||||
@Log(title = "seg会员卡设置", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SegchkVipSetInfo segchkVipSetInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkVipSetInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
List<SegchkVipSetInfo> list = segchkVipSetInfoService.selectSegchkVipSetInfoList(segchkVipSetInfo);
|
||||
ExcelUtil<SegchkVipSetInfo> util = new ExcelUtil<SegchkVipSetInfo>(SegchkVipSetInfo.class);
|
||||
return util.exportExcel(list, "seg会员卡设置数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取seg会员卡设置详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_vip_set_info:query')")
|
||||
@GetMapping(value = "/{modeId}")
|
||||
public AjaxResult getInfo(@PathVariable("modeId") Integer modeId)
|
||||
{
|
||||
return AjaxResult.success(segchkVipSetInfoService.selectSegchkVipSetInfoByModeId(modeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增seg会员卡设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_vip_set_info:add')")
|
||||
@Log(title = "seg会员卡设置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SegchkVipSetInfo segchkVipSetInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkVipSetInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkVipSetInfoService.insertSegchkVipSetInfo(segchkVipSetInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改seg会员卡设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_vip_set_info:edit')")
|
||||
@Log(title = "seg会员卡设置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SegchkVipSetInfo segchkVipSetInfo)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkVipSetInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
return toAjax(segchkVipSetInfoService.updateSegchkVipSetInfo(segchkVipSetInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除seg会员卡设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('segchk:segchk_vip_set_info:remove')")
|
||||
@Log(title = "seg会员卡设置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{modeIds}")
|
||||
public AjaxResult remove(@PathVariable Integer[] modeIds)
|
||||
{
|
||||
return toAjax(segchkVipSetInfoService.deleteSegchkVipSetInfoByModeIds(modeIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysConfig;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/config")
|
||||
public class SysConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
/**
|
||||
* 获取参数配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysConfig config)
|
||||
{
|
||||
startPage();
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysConfig config)
|
||||
{
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||
return util.exportExcel(list, "参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||
@GetMapping(value = "/{configId}")
|
||||
public AjaxResult getInfo(@PathVariable Long configId)
|
||||
{
|
||||
return AjaxResult.success(configService.selectConfigById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数键名查询参数值
|
||||
*/
|
||||
@GetMapping(value = "/configKey/{configKey}")
|
||||
public AjaxResult getConfigKey(@PathVariable String configKey)
|
||||
{
|
||||
return AjaxResult.success(configService.selectConfigByKey(configKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@RepeatSubmit
|
||||
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
{
|
||||
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(getUsername());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
{
|
||||
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(getUsername());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||
{
|
||||
configService.deleteConfigByIds(configIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新参数缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
configService.resetConfigCache();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dept")
|
||||
public class SysDeptController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
/**
|
||||
* 获取部门列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysDept dept)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
return AjaxResult.success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||
Iterator<SysDept> it = depts.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
SysDept d = (SysDept) it.next();
|
||||
if (d.getDeptId().intValue() == deptId
|
||||
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||
{
|
||||
return AjaxResult.success(deptService.selectDeptById(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门下拉树列表
|
||||
*/
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(SysDept dept)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色部门列表树
|
||||
*/
|
||||
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
|
||||
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
{
|
||||
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
dept.setCreateBy(getUsername());
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
{
|
||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
else if (dept.getParentId().equals(dept.getDeptId()))
|
||||
{
|
||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
}
|
||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
|
||||
{
|
||||
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||
}
|
||||
dept.setUpdateBy(getUsername());
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
public AjaxResult remove(@PathVariable Long deptId)
|
||||
{
|
||||
if (deptService.hasChildByDeptId(deptId))
|
||||
{
|
||||
return AjaxResult.error("存在下级部门,不允许删除");
|
||||
}
|
||||
if (deptService.checkDeptExistUser(deptId))
|
||||
{
|
||||
return AjaxResult.error("部门存在用户,不允许删除");
|
||||
}
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.ISysDictDataService;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/data")
|
||||
public class SysDictDataController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictData dictData)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysDictData dictData)
|
||||
{
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||
return util.exportExcel(list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典数据详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||
{
|
||||
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public AjaxResult dictType(@PathVariable String dictType)
|
||||
{
|
||||
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||
if (StringUtils.isNull(data))
|
||||
{
|
||||
data = new ArrayList<SysDictData>();
|
||||
}
|
||||
return AjaxResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||
{
|
||||
dictDataService.deleteDictDataByIds(dictCodes);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/type")
|
||||
public class SysDictTypeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictType dictType)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysDictType dictType)
|
||||
{
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||
return util.exportExcel(list, "字典类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典类型详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||
{
|
||||
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
{
|
||||
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
{
|
||||
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||
{
|
||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
dictTypeService.resetDictCache();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return AjaxResult.success(dictTypes);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysIndexController
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
@Autowired
|
||||
private RuoYiConfig ruoyiConfig;
|
||||
|
||||
/**
|
||||
* 访问首页,提示语
|
||||
*/
|
||||
@RequestMapping("/")
|
||||
public String index()
|
||||
{
|
||||
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.security.web.service.SysLoginService;
|
||||
import com.ruoyi.security.web.service.SysPermissionService;
|
||||
import com.ruoyi.segchk.service.ISegchkProviderMgtService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginBody;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysLoginController
|
||||
{
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISegchkProviderMgtService segchkProviderMgtService;
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
loginBody.getUuid());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
System.out.println("login token is : " + token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
public AjaxResult getInfo()
|
||||
{
|
||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
Long providerId = segchkProviderMgtService.getProviderIdByPhoneNo(user.getPhonenumber());
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
user.setProviderId(providerId);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
System.out.println("getInfo with " + user.toString());
|
||||
System.out.println("getInfo with " + String.join(",", roles));
|
||||
System.out.println("getInfo with " + String.join(",", permissions));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取路由信息
|
||||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@GetMapping("getRouters")
|
||||
public AjaxResult getRouters()
|
||||
{
|
||||
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
|
||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||
List<String> collect = menus.parallelStream().map(v -> v.toString()).collect(Collectors.toList());
|
||||
System.out.println(String.format("getRouters with {}---{}", userId, String.join(",", collect)));
|
||||
return AjaxResult.success(menuService.buildMenus(menus));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/menu")
|
||||
public class SysMenuController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysMenu menu)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return AjaxResult.success(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:query')")
|
||||
@GetMapping(value = "/{menuId}")
|
||||
public AjaxResult getInfo(@PathVariable Long menuId)
|
||||
{
|
||||
return AjaxResult.success(menuService.selectMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单下拉树列表
|
||||
*/
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(SysMenu menu)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色菜单列表树
|
||||
*/
|
||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
{
|
||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||
{
|
||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
menu.setCreateBy(getUsername());
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
{
|
||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||
{
|
||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
else if (menu.getMenuId().equals(menu.getParentId()))
|
||||
{
|
||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
}
|
||||
menu.setUpdateBy(getUsername());
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{menuId}")
|
||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||
{
|
||||
if (menuService.hasChildByMenuId(menuId))
|
||||
{
|
||||
return AjaxResult.error("存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.checkMenuExistRole(menuId))
|
||||
{
|
||||
return AjaxResult.error("菜单已分配,不允许删除");
|
||||
}
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.service.ISysNoticeService;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/notice")
|
||||
public class SysNoticeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
/**
|
||||
* 获取通知公告列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysNotice notice)
|
||||
{
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||
@GetMapping(value = "/{noticeId}")
|
||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||
{
|
||||
return AjaxResult.success(noticeService.selectNoticeById(noticeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setCreateBy(getUsername());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setUpdateBy(getUsername());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{noticeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] noticeIds)
|
||||
{
|
||||
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/post")
|
||||
public class SysPostController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysPost post)
|
||||
{
|
||||
startPage();
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysPost post)
|
||||
{
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||
return util.exportExcel(list, "岗位数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||
@GetMapping(value = "/{postId}")
|
||||
public AjaxResult getInfo(@PathVariable Long postId)
|
||||
{
|
||||
return AjaxResult.success(postService.selectPostById(postId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
{
|
||||
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
{
|
||||
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setCreateBy(getUsername());
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
{
|
||||
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
{
|
||||
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setUpdateBy(getUsername());
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] postIds)
|
||||
{
|
||||
return toAjax(postService.deletePostByIds(postIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysPost> posts = postService.selectPostAll();
|
||||
return AjaxResult.success(posts);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/user/profile")
|
||||
public class SysProfileController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping
|
||||
public AjaxResult profile()
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser user = loginUser.getUser();
|
||||
AjaxResult ajax = AjaxResult.success(user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
{
|
||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
{
|
||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser sysUser = loginUser.getUser();
|
||||
user.setUserId(sysUser.getUserId());
|
||||
user.setPassword(null);
|
||||
if (userService.updateUserProfile(user) > 0)
|
||||
{
|
||||
// 更新缓存用户信息
|
||||
sysUser.setNickName(user.getNickName());
|
||||
sysUser.setPhonenumber(user.getPhonenumber());
|
||||
sysUser.setEmail(user.getEmail());
|
||||
sysUser.setSex(user.getSex());
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String userName = loginUser.getUsername();
|
||||
String password = loginUser.getPassword();
|
||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||
{
|
||||
return AjaxResult.error("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (SecurityUtils.matchesPassword(newPassword, password))
|
||||
{
|
||||
return AjaxResult.error("新密码不能与旧密码相同");
|
||||
}
|
||||
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
|
||||
{
|
||||
// 更新缓存用户密码
|
||||
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传
|
||||
*/
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/avatar")
|
||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException
|
||||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
|
||||
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("imgUrl", avatar);
|
||||
// 更新缓存用户头像
|
||||
loginUser.getUser().setAvatar(avatar);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
return AjaxResult.error("上传图片异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
import com.ruoyi.framework.web.service.SysRegisterService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 注册验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysRegisterController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private SysRegisterService registerService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@PostMapping("/register")
|
||||
public AjaxResult register(@RequestBody RegisterBody user)
|
||||
{
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||
{
|
||||
return error("当前系统没有开启注册功能!");
|
||||
}
|
||||
String msg = registerService.register(user);
|
||||
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue