Compare commits
145 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
e1c9e88a52 | |
|
|
d603e15ca8 | |
|
|
8a4bf18611 | |
|
|
1243a89f2a | |
|
|
d5eafdd147 | |
|
|
35a1448ff4 | |
|
|
30be2b01e2 | |
|
|
644e02547e | |
|
|
d6ec6b1949 | |
|
|
ad00a1aeaf | |
|
|
7445f7ac6a | |
|
|
57f5b1b939 | |
|
|
cae2fbdc3c | |
|
|
b53fc86ce7 | |
|
|
91b51320c1 | |
|
|
55b9415a74 | |
|
|
d5023e4221 | |
|
|
b2f1e18a07 | |
|
|
441c0b01ac | |
|
|
5259ee8419 | |
|
|
6557fc5f43 | |
|
|
69ac550fc0 | |
|
|
630831b315 | |
|
|
ab75d446bc | |
|
|
f513c18d3c | |
|
|
e9ec13475e | |
|
|
cfae0404fc | |
|
|
d972b2b661 | |
|
|
bda9c6054e | |
|
|
e4f6b13dd6 | |
|
|
c9d9135ea2 | |
|
|
0449ad1ddb | |
|
|
d18b4e53f9 | |
|
|
cb5ee9c8a1 | |
|
|
1e37f0430b | |
|
|
295173258c | |
|
|
fec90d0487 | |
|
|
aead560227 | |
|
|
8133c60ab3 | |
|
|
5c155f5f11 | |
|
|
03cf98d3c9 | |
|
|
6f51f729ba | |
|
|
57b159eb98 | |
|
|
08da6834a5 | |
|
|
268468fb47 | |
|
|
333e19339c | |
|
|
7b6ccd9b22 | |
|
|
5d6f134609 | |
|
|
f02743bde5 | |
|
|
3003bb0f50 | |
|
|
5139265d32 | |
|
|
8a67af6c26 | |
|
|
8e4802505e | |
|
|
8ee641c1bc | |
|
|
779508989f | |
|
|
d9e805a6a5 | |
|
|
7be17ea89a | |
|
|
1f07641d9b | |
|
|
c0f4f805d0 | |
|
|
b84224d7ba | |
|
|
98a143f1fe | |
|
|
3243428009 | |
|
|
7736097f6b | |
|
|
fc60c003c3 | |
|
|
68ae4df2dc | |
|
|
de33e6ecc8 | |
|
|
a1cc346aca | |
|
|
5397e345ca | |
|
|
8ed7916b61 | |
|
|
2de5cc52d1 | |
|
|
f6bc28000e | |
|
|
6b5dd4d2be | |
|
|
e6becb9337 | |
|
|
8da55fb72a | |
|
|
6a5c86541a | |
|
|
3803ac78e2 | |
|
|
4095a1b6ee | |
|
|
3347ca4d74 | |
|
|
9b1883988b | |
|
|
49c8a007cc | |
|
|
64f6d28441 | |
|
|
c26d87c677 | |
|
|
97ae0eb7c7 | |
|
|
6c1cccd031 | |
|
|
856d1ceba8 | |
|
|
60673b3b64 | |
|
|
0a516e3001 | |
|
|
bb87f35797 | |
|
|
c43f9bc3c2 | |
|
|
46b43b1bd9 | |
|
|
8dbda47174 | |
|
|
cdace51197 | |
|
|
c24fc4282c | |
|
|
b616a2f2e7 | |
|
|
60abdf1dbc | |
|
|
7b894da43c | |
|
|
c8b66f9b04 | |
|
|
25d9edd5c9 | |
|
|
77a21d098f | |
|
|
170cfb356c | |
|
|
5879c2484a | |
|
|
c02dad2ca3 | |
|
|
1bfa14e3c6 | |
|
|
5dec58e7f5 | |
|
|
8321f92d2c | |
|
|
da1095e298 | |
|
|
f56da498ab | |
|
|
e259093e01 | |
|
|
e963a86b15 | |
|
|
e447fb806b | |
|
|
90c41d498c | |
|
|
ce6bea4ba0 | |
|
|
9c7901f526 | |
|
|
04f5a93aa8 | |
|
|
751ca90690 | |
|
|
1dfeae6a03 | |
|
|
1ed60c79c0 | |
|
|
aee1e53140 | |
|
|
253e2b2de1 | |
|
|
b1413f021e | |
|
|
60c22b6a43 | |
|
|
3f05ed6ffa | |
|
|
090ad5323a | |
|
|
3e90fd010d | |
|
|
462862ba65 | |
|
|
7601a72faf | |
|
|
7ab14ff293 | |
|
|
200106df39 | |
|
|
ea66e20282 | |
|
|
a209b39552 | |
|
|
557672ba9f | |
|
|
a3116cd27d | |
|
|
2ace3257f9 | |
|
|
c16ee7fc2c | |
|
|
fd33fe869d | |
|
|
b7446f8d0f | |
|
|
19924cd184 | |
|
|
85470a1549 | |
|
|
2a604c0548 | |
|
|
b7f3c68eca | |
|
|
edd2981076 | |
|
|
c105a63c8b | |
|
|
01fef0b9e1 | |
|
|
af9cfb40a4 | |
|
|
6fa3bfe051 |
|
|
@ -42,3 +42,4 @@ nbdist/
|
|||
!*/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>
|
||||
|
|
@ -82,4 +82,4 @@
|
|||
|
||||
## 若依前后端分离交流群
|
||||
|
||||
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) 点击按钮入群。
|
||||
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) 点击按钮入群。
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 清理生成路径。
|
||||
echo [信息] 清理工程target生成路径。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 运行Web工程。
|
||||
echo [信息] 使用Jar命令运行Web工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
141
pom.xml
141
pom.xml
|
|
@ -6,38 +6,107 @@
|
|||
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.6.0</version>
|
||||
|
||||
<name>ruoyi</name>
|
||||
<url>http://www.ruoyi.vip</url>
|
||||
<description>若依管理系统</description>
|
||||
|
||||
<properties>
|
||||
<ruoyi.version>3.5.0</ruoyi.version>
|
||||
<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>2.9.2</swagger.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.0</pagehelper.boot.version>
|
||||
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
|
||||
<fastjson.version>1.2.76</fastjson.version>
|
||||
<oshi.version>5.6.0</oshi.version>
|
||||
<jna.version>5.7.0</jna.version>
|
||||
<commons.io.version>2.5</commons.io.version>
|
||||
<commons.fileupload.version>1.3.3</commons.fileupload.version>
|
||||
<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>
|
||||
|
|
@ -48,7 +117,7 @@
|
|||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!--阿里数据库连接池 -->
|
||||
<!-- 阿里数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
|
|
@ -95,16 +164,12 @@
|
|||
<version>${jna.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-->
|
||||
<!-- Swagger3依赖 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<artifactId>springfox-boot-starter</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>
|
||||
|
|
@ -112,21 +177,14 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-UI-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--io常用工具类 -->
|
||||
<!-- 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>
|
||||
|
|
@ -140,7 +198,7 @@
|
|||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--velocity代码生成使用模板 -->
|
||||
<!-- velocity代码生成使用模板 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
|
|
@ -167,14 +225,14 @@
|
|||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--Token生成与解析-->
|
||||
<!-- Token生成与解析-->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>${jwt.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--验证码 -->
|
||||
<!-- 验证码 -->
|
||||
<dependency>
|
||||
<groupId>com.github.penggle</groupId>
|
||||
<artifactId>kaptcha</artifactId>
|
||||
|
|
@ -216,18 +274,42 @@
|
|||
<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>java_sdk_v3.0.9</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
|
@ -244,7 +326,10 @@
|
|||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
<meminitial>512m</meminitial>
|
||||
<maxmem>1048m</maxmem>
|
||||
</configuration>
|
||||
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -5,7 +5,9 @@
|
|||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.5.0</version>
|
||||
<version>3.6.0</version>
|
||||
<!-- <relativePath>../pom.xml</relativePath>-->
|
||||
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
|
@ -24,29 +26,17 @@
|
|||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-->
|
||||
<!-- swagger3-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.21</version>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-UI-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
|
|
|
|||
|
|
@ -1,146 +1,131 @@
|
|||
package com.ruoyi.framework.config;
|
||||
|
||||
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;
|
||||
import org.springframework.security.web.authentication.logout.LogoutFilter;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
|
||||
import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
|
||||
import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 跨域过滤器
|
||||
*/
|
||||
@Autowired
|
||||
private CorsFilter corsFilter;
|
||||
|
||||
/**
|
||||
* 解决 无法直接注入 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 | 如果有参数,参数表示角色,则其中任何一个角色可以访问
|
||||
* hasAuthority | 如果有参数,参数表示权限,则其权限可以访问
|
||||
* hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问
|
||||
* hasRole | 如果有参数,参数表示角色,则其角色可以访问
|
||||
* permitAll | 用户可以任意访问
|
||||
* rememberMe | 允许通过remember-me登录的用户访问
|
||||
* authenticated | 用户登录后可访问
|
||||
*/
|
||||
@Override
|
||||
protected void configure(HttpSecurity httpSecurity) throws Exception
|
||||
{
|
||||
httpSecurity
|
||||
// CSRF禁用,因为不使用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);
|
||||
// 添加CORS filter
|
||||
httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
|
||||
httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 强散列哈希加密实现
|
||||
*/
|
||||
@Bean
|
||||
public BCryptPasswordEncoder bCryptPasswordEncoder()
|
||||
{
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 身份认证接口
|
||||
*/
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception
|
||||
{
|
||||
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,44 +1,43 @@
|
|||
package com.ruoyi.framework.security.filter;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
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 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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +1,33 @@
|
|||
package com.ruoyi.framework.security.handle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 认证失败处理类 返回未授权
|
||||
*
|
||||
* @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)));
|
||||
}
|
||||
}
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +1,51 @@
|
|||
package com.ruoyi.framework.security.handle;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
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 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;
|
||||
|
||||
/**
|
||||
* 自定义退出处理类 返回成功
|
||||
*
|
||||
* @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, "退出成功")));
|
||||
}
|
||||
}
|
||||
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, "退出成功")));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,240 +1,211 @@
|
|||
package com.ruoyi.framework.web.domain;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import com.ruoyi.common.utils.Arith;
|
||||
import com.ruoyi.common.utils.ip.IpUtils;
|
||||
import com.ruoyi.framework.web.domain.server.Cpu;
|
||||
import com.ruoyi.framework.web.domain.server.Jvm;
|
||||
import com.ruoyi.framework.web.domain.server.Mem;
|
||||
import com.ruoyi.framework.web.domain.server.Sys;
|
||||
import com.ruoyi.framework.web.domain.server.SysFile;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 服务器相关信息
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置磁盘信息
|
||||
*/
|
||||
private void setSysFiles(OperatingSystem os)
|
||||
{
|
||||
FileSystem fileSystem = os.getFileSystem();
|
||||
List<OSFileStore> fsArray = fileSystem.getFileStores();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字节转换
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,101 +1,88 @@
|
|||
package com.ruoyi.framework.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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,122 +1,107 @@
|
|||
package com.ruoyi.framework.web.domain.server;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import com.ruoyi.common.utils.Arith;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
||||
/**
|
||||
* 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());
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +1,53 @@
|
|||
package com.ruoyi.framework.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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,84 +1,73 @@
|
|||
package com.ruoyi.framework.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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,114 +1,99 @@
|
|||
package com.ruoyi.framework.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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,117 +1,105 @@
|
|||
package com.ruoyi.framework.web.exception;
|
||||
|
||||
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;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.exception.BaseException;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.common.exception.DemoModeException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 全局异常处理器
|
||||
*
|
||||
* @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("演示模式,不允许操作");
|
||||
}
|
||||
}
|
||||
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("演示模式,不允许操作");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,169 +1,153 @@
|
|||
package com.ruoyi.framework.web.service;
|
||||
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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.equals(roleKey) || roleKey.equals(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));
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,107 +1,80 @@
|
|||
package com.ruoyi.framework.web.service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
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 com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
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.DateUtils;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.ip.IpUtils;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 登录校验方法
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
public class SysLoginService
|
||||
{
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Resource
|
||||
private AuthenticationManager authenticationManager;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @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();
|
||||
recordLoginInfo(loginUser.getUser());
|
||||
// 生成token
|
||||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*/
|
||||
public void recordLoginInfo(SysUser user)
|
||||
{
|
||||
user.setLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
||||
user.setLoginDate(DateUtils.getNowDate());
|
||||
userService.updateUserProfile(user);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,66 +1,58 @@
|
|||
package com.ruoyi.framework.web.service;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
|
||||
/**
|
||||
* 用户权限处理
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +1,52 @@
|
|||
package com.ruoyi.framework.web.service;
|
||||
|
||||
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;
|
||||
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.BaseException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 用户验证处理
|
||||
*
|
||||
* @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));
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ 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;
|
||||
|
||||
/**
|
||||
* 验证码操作处理
|
||||
|
|
@ -38,13 +39,23 @@ public class CaptchaController
|
|||
// 验证码类型
|
||||
@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;
|
||||
|
|
@ -78,7 +89,6 @@ public class CaptchaController
|
|||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("uuid", uuid);
|
||||
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||
return ajax;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,9 @@ public class CommonController
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
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;
|
||||
import com.ruoyi.framework.web.domain.Server;
|
||||
|
||||
/**
|
||||
* 服务器监控
|
||||
|
|
|
|||
|
|
@ -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,206 @@
|
|||
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.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)
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
if(sysUser.getUserId() == 1){
|
||||
// 说明是超级管理员
|
||||
;
|
||||
}
|
||||
else{
|
||||
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,6 @@ 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.SecurityUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysConfig;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
|
|
@ -90,7 +89,7 @@ public class SysConfigController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(SecurityUtils.getUsername());
|
||||
config.setCreateBy(getUsername());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +105,7 @@ public class SysConfigController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(SecurityUtils.getUsername());
|
||||
config.setUpdateBy(getUsername());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
|
|
@ -118,18 +117,19 @@ public class SysConfigController extends BaseController
|
|||
@DeleteMapping("/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||
{
|
||||
return toAjax(configService.deleteConfigByIds(configIds));
|
||||
configService.deleteConfigByIds(configIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
* 刷新参数缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clearCache")
|
||||
public AjaxResult clearCache()
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
configService.clearCache();
|
||||
configService.resetConfigCache();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ 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.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
|
||||
|
|
@ -113,7 +112,7 @@ public class SysDeptController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
dept.setCreateBy(SecurityUtils.getUsername());
|
||||
dept.setCreateBy(getUsername());
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +137,7 @@ public class SysDeptController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||
}
|
||||
dept.setUpdateBy(SecurityUtils.getUsername());
|
||||
dept.setUpdateBy(getUsername());
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ 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.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.ISysDictDataService;
|
||||
|
|
@ -91,7 +90,7 @@ public class SysDictDataController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setCreateBy(SecurityUtils.getUsername());
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +102,7 @@ public class SysDictDataController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(SecurityUtils.getUsername());
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
|
|
@ -115,6 +114,7 @@ public class SysDictDataController extends BaseController
|
|||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||
{
|
||||
return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
|
||||
dictDataService.deleteDictDataByIds(dictCodes);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ 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.SecurityUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
|
||||
|
|
@ -76,7 +75,7 @@ public class SysDictTypeController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(SecurityUtils.getUsername());
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +91,7 @@ public class SysDictTypeController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(SecurityUtils.getUsername());
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
|
|
@ -104,18 +103,19 @@ public class SysDictTypeController extends BaseController
|
|||
@DeleteMapping("/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||
{
|
||||
return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
|
||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
* 刷新字典缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clearCache")
|
||||
public AjaxResult clearCache()
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
dictTypeService.clearCache();
|
||||
dictTypeService.resetDictCache();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,13 @@ 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;
|
||||
|
|
@ -12,11 +18,7 @@ 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.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
|
|
@ -36,9 +38,10 @@ public class SysLoginController
|
|||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISegchkProviderMgtService segchkProviderMgtService;
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
|
|
@ -53,6 +56,7 @@ public class SysLoginController
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -64,16 +68,20 @@ public class SysLoginController
|
|||
@GetMapping("getInfo")
|
||||
public AjaxResult getInfo()
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
SysUser user = loginUser.getUser();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -85,10 +93,10 @@ public class SysLoginController
|
|||
@GetMapping("getRouters")
|
||||
public AjaxResult getRouters()
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// 用户信息
|
||||
SysUser user = loginUser.getUser();
|
||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(user.getUserId());
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,17 +13,12 @@ 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.Constants;
|
||||
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.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
|
|
@ -38,9 +33,6 @@ public class SysMenuController extends BaseController
|
|||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
|
|
@ -48,9 +40,7 @@ public class SysMenuController extends BaseController
|
|||
@GetMapping("/list")
|
||||
public AjaxResult list(SysMenu menu)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
Long userId = loginUser.getUser().getUserId();
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, userId);
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return AjaxResult.success(menus);
|
||||
}
|
||||
|
||||
|
|
@ -70,9 +60,7 @@ public class SysMenuController extends BaseController
|
|||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(SysMenu menu)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
Long userId = loginUser.getUser().getUserId();
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, userId);
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
|
|
@ -82,8 +70,7 @@ public class SysMenuController extends BaseController
|
|||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
List<SysMenu> menus = menuService.selectMenuList(loginUser.getUser().getUserId());
|
||||
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||
|
|
@ -102,12 +89,11 @@ public class SysMenuController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
|
||||
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||
{
|
||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
menu.setCreateBy(SecurityUtils.getUsername());
|
||||
menu.setCreateBy(getUsername());
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
|
|
@ -123,8 +109,7 @@ public class SysMenuController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
|
||||
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||
{
|
||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
|
|
@ -132,7 +117,7 @@ public class SysMenuController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
}
|
||||
menu.setUpdateBy(SecurityUtils.getUsername());
|
||||
menu.setUpdateBy(getUsername());
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ 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.SecurityUtils;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.service.ISysNoticeService;
|
||||
|
||||
|
|
@ -63,7 +62,7 @@ public class SysNoticeController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setCreateBy(SecurityUtils.getUsername());
|
||||
notice.setCreateBy(getUsername());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +74,7 @@ public class SysNoticeController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setUpdateBy(SecurityUtils.getUsername());
|
||||
notice.setUpdateBy(getUsername());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ 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.SecurityUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
|
|
@ -83,7 +82,7 @@ public class SysPostController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setCreateBy(SecurityUtils.getUsername());
|
||||
post.setCreateBy(getUsername());
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +102,7 @@ public class SysPostController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setUpdateBy(SecurityUtils.getUsername());
|
||||
post.setUpdateBy(getUsername());
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ 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.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
|
|
@ -46,7 +45,7 @@ public class SysProfileController extends BaseController
|
|||
@GetMapping
|
||||
public AjaxResult profile()
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser user = loginUser.getUser();
|
||||
AjaxResult ajax = AjaxResult.success(user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||
|
|
@ -71,14 +70,17 @@ public class SysProfileController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser sysUser = loginUser.getUser();
|
||||
user.setUserId(sysUser.getUserId());
|
||||
user.setPassword(null);
|
||||
if (userService.updateUserProfile(user) > 0)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// 更新缓存用户信息
|
||||
loginUser.getUser().setNickName(user.getNickName());
|
||||
loginUser.getUser().setPhonenumber(user.getPhonenumber());
|
||||
loginUser.getUser().setEmail(user.getEmail());
|
||||
loginUser.getUser().setSex(user.getSex());
|
||||
sysUser.setNickName(user.getNickName());
|
||||
sysUser.setPhonenumber(user.getPhonenumber());
|
||||
sysUser.setEmail(user.getEmail());
|
||||
sysUser.setSex(user.getSex());
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
|
@ -92,7 +94,7 @@ public class SysProfileController extends BaseController
|
|||
@PutMapping("/updatePwd")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String userName = loginUser.getUsername();
|
||||
String password = loginUser.getPassword();
|
||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||
|
|
@ -122,7 +124,7 @@ public class SysProfileController extends BaseController
|
|||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
|
||||
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.security.web.service.SysPermissionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -17,15 +19,14 @@ 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.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
|
|
@ -95,7 +96,7 @@ public class SysRoleController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setCreateBy(SecurityUtils.getUsername());
|
||||
role.setCreateBy(getUsername());
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
|
@ -117,12 +118,12 @@ public class SysRoleController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setUpdateBy(SecurityUtils.getUsername());
|
||||
role.setUpdateBy(getUsername());
|
||||
|
||||
if (roleService.updateRole(role) > 0)
|
||||
{
|
||||
// 更新缓存用户权限
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
||||
{
|
||||
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||
|
|
@ -155,7 +156,7 @@ public class SysRoleController extends BaseController
|
|||
public AjaxResult changeStatus(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
role.setUpdateBy(SecurityUtils.getUsername());
|
||||
role.setUpdateBy(getUsername());
|
||||
return toAjax(roleService.updateRoleStatus(role));
|
||||
}
|
||||
|
||||
|
|
@ -179,4 +180,61 @@ public class SysRoleController extends BaseController
|
|||
{
|
||||
return AjaxResult.success(roleService.selectRoleAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/allocatedList")
|
||||
public TableDataInfo allocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未分配用户角色列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/unallocatedList")
|
||||
public TableDataInfo unallocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancel")
|
||||
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancelAll")
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量选择用户授权
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/selectAll")
|
||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
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;
|
||||
|
|
@ -20,14 +21,11 @@ import com.ruoyi.common.core.controller.BaseController;
|
|||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
|
@ -50,9 +48,6 @@ public class SysUserController extends BaseController
|
|||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
|
|
@ -82,8 +77,7 @@ public class SysUserController extends BaseController
|
|||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
String operName = loginUser.getUsername();
|
||||
String operName = getUsername();
|
||||
String message = userService.importUser(userList, updateSupport, operName);
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
|
@ -137,7 +131,7 @@ public class SysUserController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setCreateBy(getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
|
@ -161,7 +155,7 @@ public class SysUserController extends BaseController
|
|||
{
|
||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
|
|
@ -173,6 +167,10 @@ public class SysUserController extends BaseController
|
|||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||
{
|
||||
if (ArrayUtils.contains(userIds, getUserId()))
|
||||
{
|
||||
return error("当前用户不能删除");
|
||||
}
|
||||
return toAjax(userService.deleteUserByIds(userIds));
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +184,7 @@ public class SysUserController extends BaseController
|
|||
{
|
||||
userService.checkUserAllowed(user);
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +197,34 @@ public class SysUserController extends BaseController
|
|||
public AjaxResult changeStatus(@RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.updateUserStatus(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取授权角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping("/authRole/{userId}")
|
||||
public AjaxResult authRole(@PathVariable("userId") Long userId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authRole")
|
||||
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
||||
{
|
||||
userService.insertUserAuth(userId, roleIds);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ 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.core.controller.BaseController;
|
||||
|
|
@ -16,6 +17,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|||
import com.ruoyi.common.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -55,34 +57,38 @@ public class TestController extends BaseController
|
|||
}
|
||||
else
|
||||
{
|
||||
return AjaxResult.error("用户不存在");
|
||||
return error("用户不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("新增用户")
|
||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String"),
|
||||
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"),
|
||||
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String")
|
||||
})
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return AjaxResult.error("用户ID不能为空");
|
||||
return error("用户ID不能为空");
|
||||
}
|
||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户")
|
||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||
@PutMapping("/update")
|
||||
public AjaxResult update(UserEntity user)
|
||||
public AjaxResult update(@RequestBody UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return AjaxResult.error("用户ID不能为空");
|
||||
return error("用户ID不能为空");
|
||||
}
|
||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
||||
{
|
||||
return AjaxResult.error("用户不存在");
|
||||
return error("用户不存在");
|
||||
}
|
||||
users.remove(user.getUserId());
|
||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||
|
|
@ -96,16 +102,16 @@ public class TestController extends BaseController
|
|||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
users.remove(userId);
|
||||
return AjaxResult.success();
|
||||
return success();
|
||||
}
|
||||
else
|
||||
{
|
||||
return AjaxResult.error("用户不存在");
|
||||
return error("用户不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModel("用户实体")
|
||||
@ApiModel(value = "UserEntity", description = "用户实体")
|
||||
class UserEntity
|
||||
{
|
||||
@ApiModelProperty("用户ID")
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.models.auth.In;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
|
|
@ -16,10 +17,10 @@ import springfox.documentation.service.ApiKey;
|
|||
import springfox.documentation.service.AuthorizationScope;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.service.SecurityReference;
|
||||
import springfox.documentation.service.SecurityScheme;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* Swagger2的接口配置
|
||||
|
|
@ -27,7 +28,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
|
|
@ -48,7 +48,7 @@ public class SwaggerConfig
|
|||
@Bean
|
||||
public Docket createRestApi()
|
||||
{
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
// 是否启用Swagger
|
||||
.enable(enabled)
|
||||
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||
|
|
@ -71,10 +71,10 @@ public class SwaggerConfig
|
|||
/**
|
||||
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||
*/
|
||||
private List<ApiKey> securitySchemes()
|
||||
private List<SecurityScheme> securitySchemes()
|
||||
{
|
||||
List<ApiKey> apiKeyList = new ArrayList<ApiKey>();
|
||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
|
||||
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
||||
return apiKeyList;
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ public class SwaggerConfig
|
|||
securityContexts.add(
|
||||
SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.forPaths(PathSelectors.regex("^(?!auth).*$"))
|
||||
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||
.build());
|
||||
return securityContexts;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,57 +1,119 @@
|
|||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: password
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.6.0
|
||||
# 版权年份
|
||||
copyrightYear: 2021
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath F:\ideaproj\RuoYi-Vue\uploadPath)
|
||||
profile: F:\ideaproj\RuoYi-Vue\uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数组计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 7070
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# tomcat最大线程数,默认为200
|
||||
max-threads: 800
|
||||
# Tomcat启动初始化的线程数,默认值25
|
||||
min-spare-threads: 30
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: debug
|
||||
org.springframework: warn
|
||||
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://10.1.192.113:13306/yzy_ruoyi_vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
username: yzyuser
|
||||
password: yzy123456
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 10.1.192.113
|
||||
# 端口,默认为6379
|
||||
port: 63795
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: retinabd@2020
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
debug: true
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.6.0
|
||||
# 版权年份
|
||||
copyrightYear: 2021
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: /home/segchk/data/uploadPath/applet
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数组计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 7070
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# tomcat最大线程数,默认为200
|
||||
max-threads: 800
|
||||
# Tomcat启动初始化的线程数,默认值25
|
||||
min-spare-threads: 30
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: debug
|
||||
org.springframework: warn
|
||||
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:8306/segchksaas?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
username: segchksaas
|
||||
password: 2wsx@WSX
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 63795
|
||||
# 数据库索引
|
||||
database: 3
|
||||
# 密码
|
||||
password: 3edc#EDC
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
|
@ -1,40 +1,40 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.5.0
|
||||
# 版权年份
|
||||
copyrightYear: 2021
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数组计算 char 字符验证
|
||||
captchaType: math
|
||||
#ruoyi:
|
||||
# # 名称
|
||||
# name: RuoYi
|
||||
# # 版本
|
||||
# version: 3.6.0
|
||||
# # 版权年份
|
||||
# copyrightYear: 2021
|
||||
# # 实例演示开关
|
||||
# demoEnabled: true
|
||||
# # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
# profile: D:/ruoyi/uploadPath
|
||||
# # 获取ip地址开关
|
||||
# addressEnabled: false
|
||||
# # 验证码类型 math 数组计算 char 字符验证
|
||||
# captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8080
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# tomcat最大线程数,默认为200
|
||||
max-threads: 800
|
||||
# Tomcat启动初始化的线程数,默认值25
|
||||
min-spare-threads: 30
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: debug
|
||||
org.springframework: warn
|
||||
## 开发环境配置
|
||||
#server:
|
||||
# # 服务器的HTTP端口,默认为8080
|
||||
# port: 7070
|
||||
# servlet:
|
||||
# # 应用的访问路径
|
||||
# context-path: /
|
||||
# tomcat:
|
||||
# # tomcat的URI编码
|
||||
# uri-encoding: UTF-8
|
||||
# # tomcat最大线程数,默认为200
|
||||
# max-threads: 800
|
||||
# # Tomcat启动初始化的线程数,默认值25
|
||||
# min-spare-threads: 30
|
||||
#
|
||||
## 日志配置
|
||||
#logging:
|
||||
# level:
|
||||
# com.ruoyi: debug
|
||||
# org.springframework: warn
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
|
|
@ -43,7 +43,7 @@ spring:
|
|||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: druid
|
||||
active: test
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
|
|
@ -56,28 +56,6 @@ spring:
|
|||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
# token配置
|
||||
token:
|
||||
|
|
@ -100,7 +78,6 @@ mybatis:
|
|||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
reasonable: true
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
|
|
@ -116,6 +93,6 @@ xss:
|
|||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice/*
|
||||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ user.password.not.valid=* 5-50个字符
|
|||
user.email.not.valid=邮箱格式错误
|
||||
user.mobile.phone.number.not.valid=手机号格式错误
|
||||
user.login.success=登录成功
|
||||
user.register.success=注册成功
|
||||
user.notfound=请重新登录
|
||||
user.forcelogout=管理员强制退出,请重新登录
|
||||
user.unknown.error=未知错误,请重新登录
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/home/ruoyi/logs" />
|
||||
<property name="log.path" value="adminlogs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.5.0</version>
|
||||
<version>3.6.0</version>
|
||||
<!-- <relativePath>../pom.xml</relativePath>-->
|
||||
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue