Compare commits

...

99 Commits

Author SHA1 Message Date
1020109007@qq.com e1c9e88a52 使用nginx代理后,需要进行请求ip的重新提取,将真实的请求ip提取出来,否则无法微信请求 2021-12-21 15:15:02 +08:00
1020109007@qq.com d603e15ca8 最近完整 2021-12-19 12:39:15 +08:00
1020109007@qq.com 8a4bf18611 最近完整 2021-12-19 11:35:56 +08:00
1020109007@qq.com 1243a89f2a Merge remote-tracking branch 'origin/master' 2021-12-19 11:28:19 +08:00
1020109007@qq.com d5eafdd147 Revert "最近版本保存"
This reverts commit 30be2b01
2021-12-19 11:27:42 +08:00
laohan 35a1448ff4
删除文件 ruoyi-ui 2021-12-19 02:50:33 +00:00
1020109007@qq.com 30be2b01e2 最近版本保存 2021-12-14 15:55:31 +08:00
1020109007@qq.com 644e02547e 完善了会员卡列表,优惠券列表信息,并绑定了卡片的背景图 2021-11-05 16:52:00 +08:00
1020109007@qq.com d6ec6b1949 绑定时将用户微信信息写入redis,支付和提现时,先取redis,没有则重新向微信请求微信信息,并保存。超时7100秒 2021-11-05 14:50:41 +08:00
1020109007@qq.com ad00a1aeaf 多个项目 2021-11-05 10:03:40 +08:00
1020109007@qq.com 7445f7ac6a 多个项目 2021-11-04 19:28:38 +08:00
1020109007@qq.com 57f5b1b939 对后台管理界面对用户推荐设置增加重复检查 2021-11-04 19:16:41 +08:00
1020109007@qq.com cae2fbdc3c 对后台管理界面对商家图片增加重复检查 2021-11-04 11:02:29 +08:00
1020109007@qq.com b53fc86ce7 对后台管理界面对首页,商家标签,进行重复检查,如果禁止重复添加 2021-11-04 10:43:06 +08:00
1020109007@qq.com 91b51320c1 对后台管理界面完善了排序,增加了图片的展示,在商家基础信息表中,增加只修改商家详情内容的弹窗和功能 2021-11-03 19:01:10 +08:00
1020109007@qq.com 55b9415a74 对后台管理界面部分已开放的功能,增加了一些排序的方案 2021-11-02 14:09:16 +08:00
1020109007@qq.com d5023e4221 对后台管理中销售人员,会员推荐控制,商家累积评价,商户余额信息,商户提现记录表,商户核卡管理,商家图片,商家标签,商户奖励功能界面进行完善及相应的更新后台管理的接口 2021-11-02 11:25:47 +08:00
1020109007@qq.com b2f1e18a07 系统设置增加用户隐私协议,会员充值协议,解决了可买多张卡的bug,解决了商家赠卡核消bug。 2021-10-29 18:28:31 +08:00
1020109007@qq.com 441c0b01ac 解决平台基础信息设置,完善运营商管理功能 2021-10-28 18:21:16 +08:00
1020109007@qq.com 5259ee8419 增加用户优惠券列表带商户id,便于跳转到指定商户详情,增加用户协调接口及相关的类。后期需要把网站基础信息做成全局可用,便于从后台管理界面进行基础信息设置及管理 2021-10-25 15:22:48 +08:00
1020109007@qq.com 6557fc5f43 完善推荐人信息绑定,完善推荐人(商户,用户)返利计算,提示跨地区注册用户,完成赠卡流程,完善商户核消统计 2021-10-24 00:59:25 +08:00
1020109007@qq.com 69ac550fc0 小程序后端个人中心返回信息中,增加用户注册地,推荐人信息 2021-10-16 23:27:27 +08:00
1020109007@qq.com 630831b315 vue端完善给运营商相关的商家界面,完善了标签等管理。后台后商admin,完善了后台的相关接口。小程序后端完善了标签和搜索功能 2021-10-16 15:07:40 +08:00
1020109007@qq.com ab75d446bc 调试微信支付,已发现可能是绑定时微信openid获取不正确 2021-10-02 00:56:26 +08:00
1020109007@qq.com f513c18d3c 补充留存文件 2021-10-01 22:15:22 +08:00
1020109007@qq.com e9ec13475e 在每个controller增加调试信息 2021-10-01 09:59:26 +08:00
1020109007@qq.com cfae0404fc 增加了海报功能(未完善),redis选库,小程序后台去掉对frame中的jwt依赖 2021-09-24 13:40:20 +08:00
1020109007@qq.com d972b2b661 增加了海报功能(未完善),redis选库,小程序后台去掉对frame中的jwt依赖 2021-09-24 13:27:59 +08:00
1020109007@qq.com bda9c6054e segchk商城接口层进行了整理 2021-08-27 18:11:17 +08:00
1020109007@qq.com e4f6b13dd6 增加segchk相关代码mvc三层 2021-08-26 16:18:00 +08:00
1020109007@qq.com c9d9135ea2 增加segchk相关代码 2021-08-25 15:11:12 +08:00
1020109007@qq.com 0449ad1ddb 增加vue跳转js文件 2021-08-25 15:08:03 +08:00
1020109007@qq.com d18b4e53f9 初始版本 2021-08-22 00:40:59 +08:00
RuoYi cb5ee9c8a1 补充定时任务表字段注释 2021-08-20 11:04:15 +08:00
RuoYi 1e37f0430b 定时任务屏蔽ldap远程调用 2021-08-19 15:26:22 +08:00
若依 295173258c !295 update 优化 使用权限工具 获取用户信息
Merge pull request !295 from 疯狂的狮子Li/update
2021-08-19 06:55:13 +00:00
若依 fec90d0487 !294 update ruoyi-ui/src/layout/index.vue.
Merge pull request !294 from aasdd/N/A
2021-08-19 06:49:06 +00:00
疯狂的狮子li aead560227 update 优化 使用权限工具 获取用户信息 2021-08-19 11:13:59 +08:00
aasdd 8133c60ab3 update ruoyi-ui/src/layout/index.vue.
删掉此处代码,使右边栏动画生效。现在是没有动画的
2021-08-18 09:29:22 +00:00
RuoYi 5c155f5f11 支持自定义注解实现接口限流 2021-08-17 14:08:18 +08:00
RuoYi 03cf98d3c9 优化异常信息 2021-08-16 16:25:25 +08:00
若依 6f51f729ba !289 添加日期范围支持重复添加多组日期范围,请求参数中对象的属性为null、undefined不进行拼接
Merge pull request !289 from wangzhaoqiang/master
2021-08-16 08:23:27 +00:00
wangzhaoqiang 57b159eb98 添加日期范围支持重复添加多组日期范围,请求参数中对象的属性为null、undefined不进行拼接 2021-08-16 14:48:34 +08:00
若依 08da6834a5 !288 修正方法名单词拼写错误
Merge pull request !288 from 稚屿/N/A
2021-08-16 02:36:36 +00:00
若依 268468fb47 !287 更新到【默认首页使用keep-alive缓存】后报错
Merge pull request !287 from wangzhaoqiang/master
2021-08-16 02:36:29 +00:00
稚屿 333e19339c 修正方法名单词拼写错误 2021-08-15 10:26:05 +00:00
wangzhaoqiang 7b6ccd9b22 解决登录后浏览器后台Breadcrumb组件报错 2021-08-14 20:16:48 +08:00
RuoYi 5d6f134609 多图上传组件移除多余的api地址 2021-08-13 15:15:35 +08:00
RuoYi f02743bde5 代码生成主子表多选行数据 2021-08-13 14:50:35 +08:00
RuoYi 3003bb0f50 Excel注解图片导入兼容xls 2021-08-13 10:56:35 +08:00
RuoYi 5139265d32 默认首页使用keep-alive缓存 2021-08-13 10:10:29 +08:00
若依 8a67af6c26 !285 修复角色分配用户页面接收参数与传递参数类型不一致导致的错误
Merge pull request !285 from 稚屿/N/A
2021-08-13 01:55:58 +00:00
若依 8e4802505e !284 添加SysConfigservice,SysDictTypeService的实现方法遗漏的@Override注解
Merge pull request !284 from Old丶x/master
2021-08-13 01:55:52 +00:00
稚屿 8ee641c1bc 修复角色分配用户页面接收参数与传递参数类型不一致导致的错误 2021-08-13 01:08:00 +00:00
mroldx 779508989f 添加加载字典数据,清空字典数据,重置字典数据方法上遗漏的@Override注解 2021-08-12 17:30:31 +08:00
mroldx d9e805a6a5 添加获取验证码方法上遗漏的@Override注解 2021-08-12 17:19:56 +08:00
RuoYi 7be17ea89a Excel注解支持Image图片导入 2021-08-11 10:13:34 +08:00
RuoYi 1f07641d9b update bin 2021-08-11 10:11:13 +08:00
若依 c0f4f805d0 !281 补全注册用户方法上遗漏的@Override注解
Merge pull request !281 from 稚屿/N/A
2021-08-11 02:08:58 +00:00
稚屿 b84224d7ba 补全注册用户方法上遗漏的@Override注解 2021-08-08 14:08:52 +00:00
RuoYi 98a143f1fe 添加新群号:101456076 2021-08-08 19:50:50 +08:00
RuoYi 3243428009 优化用户不能删除自己 2021-08-08 19:12:52 +08:00
RuoYi 7736097f6b 提取通用方法到基类控制器 2021-08-08 19:12:12 +08:00
RuoYi fc60c003c3 升级element-ui到最新版本2.15.5 2021-08-06 14:31:39 +08:00
RuoYi 68ae4df2dc 升级commons.io到最新版本v2.11.0 2021-07-31 17:52:06 +08:00
RuoYi de33e6ecc8 优化代码生成模板 2021-07-30 22:18:20 +08:00
RuoYi a1cc346aca 优化代码生成模板 2021-07-30 21:50:47 +08:00
RuoYi 5397e345ca 新增是否开启用户注册功能 2021-07-30 21:23:35 +08:00
RuoYi 8ed7916b61 定时任务屏蔽http(s)远程调用 2021-07-30 11:28:46 +08:00
RuoYi 2de5cc52d1 启用父部门状态排除顶级节点 2021-07-30 11:28:04 +08:00
RuoYi f6bc28000e 防止错误token导致的解析异常 2021-07-29 17:32:55 +08:00
RuoYi 6b5dd4d2be 优化XSS跨站脚本过滤 2021-07-28 16:04:59 +08:00
RuoYi e6becb9337 BLOB下载时清除URL对象引用 2021-07-28 13:13:28 +08:00
RuoYi 8da55fb72a 添加新群号:101456076 2021-07-28 09:51:19 +08:00
RuoYi 6a5c86541a 跳转路由高亮相对应的菜单栏 2021-07-27 11:54:20 +08:00
RuoYi 3803ac78e2 升级oshi到最新版本v5.8.0 2021-07-27 11:53:59 +08:00
Ricky 4095a1b6ee !275 fix Issue #I42GRW 任意账户越权漏洞
Merge pull request !275 from lagXkjy/master
2021-07-27 02:08:04 +00:00
江强 3347ca4d74 fix:Issue #I42GRW 修复任意账户越权漏洞 2021-07-27 09:33:12 +08:00
RuoYi 9b1883988b 升级element-ui到最新版本2.15.3 2021-07-26 09:50:58 +08:00
RuoYi 49c8a007cc 修复定时任务日志执行状态显示 2021-07-26 09:50:33 +08:00
RuoYi 64f6d28441 角色&菜单新增字段属性提示信息 2021-07-25 20:08:55 +08:00
RuoYi c26d87c677 内链设置meta信息 2021-07-25 20:05:18 +08:00
RuoYi 97ae0eb7c7 密码框新增显示切换密码图标 2021-07-25 19:13:56 +08:00
RuoYi 6c1cccd031 导入用户样式调整 2021-07-25 19:08:00 +08:00
RuoYi 856d1ceba8 顶部菜单样式调整 2021-07-25 19:06:57 +08:00
RuoYi 60673b3b64 去除默认分页合理化参数 2021-07-25 10:35:37 +08:00
RuoYi 0a516e3001 更多操作按钮添加权限控制 2021-07-25 10:20:52 +08:00
RuoYi bb87f35797 富文本新增上传文件大小限制 2021-07-25 08:57:01 +08:00
RuoYi c43f9bc3c2 顶部菜单排除隐藏的默认路由 2021-07-24 18:20:55 +08:00
若依 46b43b1bd9 !269 code=401时request方法没有返回Promise.reject 修复
Merge pull request !269 from 严俊东/N/A
2021-07-24 02:48:01 +00:00
若依 8dbda47174 !268 修正方法名单词拼写错误
Merge pull request !268 from 稚屿/N/A
2021-07-23 11:34:30 +00:00
严俊东 cdace51197 code=401时request方法没有返回Promise.reject 修复 2021-07-20 04:49:22 +00:00
稚屿 c24fc4282c 修正方法名单词拼写错误 2021-07-20 00:54:50 +00:00
RuoYi b616a2f2e7 定时任务新增更多操作 2021-07-15 17:35:33 +08:00
RuoYi 60abdf1dbc 升级oshi到最新版本v5.7.5 2021-07-14 09:53:26 +08:00
RuoYi 7b894da43c 参数管理支持配置验证码开关 2021-07-13 10:30:40 +08:00
RuoYi c8b66f9b04 删除富文本video事件 2021-07-13 10:28:55 +08:00
若依 25d9edd5c9 !259 图片上传 - 多图时无法删除相应图片修复
Merge pull request !259 from 严俊东/N/A
2021-07-13 02:26:10 +00:00
严俊东 77a21d098f 图片上传 - 多图时无法删除相应图片修复 2021-07-12 03:01:50 +00:00
968 changed files with 122576 additions and 23486 deletions

1
.gitignore vendored
View File

@ -42,3 +42,4 @@ nbdist/
!*/build/*.java
!*/build/*.html
!*/build/*.xml
/logs/

5
.run/test#1.run.xml Normal file
View File

@ -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>

View File

@ -82,4 +82,4 @@
## 若依前后端分离交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) 点击按钮入群。
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) 点击按钮入群。

View File

@ -1,6 +1,6 @@
@echo off
echo.
echo [信息] 清理生成路径。
echo [信息] 清理工程target生成路径。
echo.
%~d0

View File

@ -1,6 +1,6 @@
@echo off
echo.
echo [信息] 运行Web工程。
echo [信息] 使用Jar命令运行Web工程。
echo.
cd %~dp0

298
java_sdk_v3.0.9/README.md Normal file
View File

@ -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);
// ......
}
}
```

127
java_sdk_v3.0.9/pom.xml Normal file
View File

@ -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>

View File

@ -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 +
'}';
}
}
}

View File

@ -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 appidmch_idnonce_strsign_typesign <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;
}
/**
* xmlsignsignfalse
*
* @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 APIMapreturn_codeSUCCESS
* @param xmlStr APIXML
* @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>
* MapMapreturn_codereturn_msgdata
* 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

View File

@ -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;
}
/**
* 线
* 200B10000 2000 KB2MB
*
* @return
*/
public int getReportQueueMaxSize() {
return 10000;
}
/**
*
*
* @return
*/
public int getReportBatchSize() {
return 10;
}
}

View File

@ -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";
}

View File

@ -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 {
/**
* 使int0false 1true
*/
// 基本信息
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");
}
}

View File

@ -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);
}
}

View File

@ -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();
/**
* XMLMap
*
* @param strXML XML
* @return XMLMap
* @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;
}
}
/**
* MapXML
*
* @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 signXML
*/
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 signXML
*/
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);
}
/**
* signfalse使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);
}
/**
* signfalse
*
* @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_typesignType
*
* @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();
}
}

View File

@ -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();
}
}

102
pom.xml
View File

@ -6,6 +6,7 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<packaging>pom</packaging>
<version>3.6.0</version>
<name>ruoyi</name>
@ -14,6 +15,7 @@
<properties>
<ruoyi.version>3.6.0</ruoyi.version>
<wxsdk.version>3.0.9</wxsdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
@ -25,19 +27,86 @@
<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.7.4</oshi.version>
<oshi.version>5.8.0</oshi.version>
<jna.version>5.8.0</jna.version>
<commons.io.version>2.10.0</commons.io.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>
@ -205,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>
@ -233,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>

281
pom.xmlbak Normal file
View File

@ -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>

320
pom1.xml Normal file
View File

@ -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>

View File

@ -6,6 +6,8 @@
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.0</version>
<!-- <relativePath>../pom.xml</relativePath>-->
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

View File

@ -1,147 +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 | SpringEltrue访
* anonymous | 访
* denyAll | 访
* fullyAuthenticated | 访remember-me
* hasAnyAuthority | 访
* hasAnyRole | 访
* hasAuthority | 访
* hasIpAddress | IPIP访
* 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",
"/profile/**"
).permitAll()
.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 | SpringEltrue访
* anonymous | 访
* denyAll | 访
* fullyAuthenticated | 访remember-me
* hasAnyAuthority | 访
* hasAnyRole | 访
*
* @ss.hasPermi | 访
* hasIpAddress | IPIP访
* 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());
}
}

View File

@ -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);
}
}

View File

@ -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)));
}
}

View File

@ -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, "退出成功")));
}
}

View File

@ -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);
}
}
}

View File

@ -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;
}
}

View File

@ -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());
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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("演示模式,不允许操作");
}
}

View File

@ -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 ssSpringSecurity
*
* @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 ssSpringSecurity
*
* @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));
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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;
/**
*

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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 + '\'' +
'}';
}
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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;
/**
* segController
*
* @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));
}
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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));
}
}

View File

@ -17,12 +17,8 @@ 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;
/**
@ -37,9 +33,6 @@ public class SysMenuController extends BaseController
@Autowired
private ISysMenuService menuService;
@Autowired
private TokenService tokenService;
/**
*
*/
@ -47,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);
}
@ -69,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));
}
@ -81,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));
@ -105,7 +93,7 @@ public class SysMenuController extends BaseController
{
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
}
menu.setCreateBy(SecurityUtils.getUsername());
menu.setCreateBy(getUsername());
return toAjax(menuService.insertMenu(menu));
}
@ -129,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));
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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))
{

View File

@ -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);
}
}

View File

@ -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;
@ -21,11 +23,8 @@ 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;
@ -97,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));
}
@ -119,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()));
@ -157,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));
}

View File

@ -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,7 @@ 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));
}

View File

@ -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/uploadPathLinux配置 /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

View File

@ -0,0 +1,118 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.6.0
# 版权年份
copyrightYear: 2021
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /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

View File

@ -1,40 +1,40 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.6.0
# 版权年份
copyrightYear: 2021
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /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/uploadPathLinux配置 /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/*

View File

@ -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=未知错误,请重新登录

View File

@ -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" />

View File

@ -6,6 +6,8 @@
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.0</version>
<!-- <relativePath>../pom.xml</relativePath>-->
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -14,5 +14,5 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
public @interface Excels
{
Excel[] value();
public Excel[] value();
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.common.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.enums.LimitType;
/**
*
*
* @author ruoyi
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RateLimiter
{
/**
* key
*/
public String key() default Constants.RATE_LIMIT_KEY;
/**
* ,
*/
public int time() default 60;
/**
*
*/
public int count() default 100;
/**
*
*/
public LimitType limitType() default LimitType.DEFAULT;
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.common.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface UnAuth {
}

Some files were not shown because too many files have changed in this diff Show More