修改了微信sdk包的引用方式

master
seg_yinzy 2022-05-13 23:42:45 +08:00
commit 30fdb67273
1252 changed files with 157662 additions and 0 deletions

45
.gitignore vendored Normal file
View File

@ -0,0 +1,45 @@
######################################################################
# Build Tools
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
target/
!.mvn/wrapper/maven-wrapper.jar
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
nbproject/private/
build/*
nbbuild/
dist/
nbdist/
.nb-gradle/
######################################################################
# Others
*.log
*.xml.versionsBackup
*.swp
!*/build/*.java
!*/build/*.html
!*/build/*.xml
/logs/

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>

20
LICENSE Normal file
View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2018 RuoYi
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

85
README.md Normal file
View File

@ -0,0 +1,85 @@
## 平台简介
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
* 前端采用Vue、Element UI。
* 后端采用Spring Boot、Spring Security、Redis & Jwt。
* 权限认证使用Jwt支持多终端认证系统。
* 支持加载动态权限菜单,多方式轻松权限控制。
* 高效率开发,使用代码生成器可以一键生成前后端代码。
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast)Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
* 特别鸣谢:[element](https://github.com/ElemeFE/element)[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)[eladmin-web](https://github.com/elunez/eladmin-web)。
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)&nbsp;&nbsp;
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)&nbsp;&nbsp;
## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。
14. 系统接口根据业务代码自动生成相关的api接口文档。
15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。
16. 缓存监控:对系统的缓存信息查询,命令统计等。
17. 在线构建器拖动表单元素生成相应的HTML代码。
18. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。
## 在线体验
- admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://vue.ruoyi.vip
文档地址http://doc.ruoyi.vip
## 演示图
<table>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
</tr>
</table>
## 若依前后端分离交流群
QQ群 [![加入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) 点击按钮入群。

12
bin/clean.bat Normal file
View File

@ -0,0 +1,12 @@
@echo off
echo.
echo [信息] 清理工程target生成路径。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean
pause

12
bin/package.bat Normal file
View File

@ -0,0 +1,12 @@
@echo off
echo.
echo [信息] 打包Web工程生成war/jar包文件。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean package -Dmaven.test.skip=true
pause

14
bin/run.bat Normal file
View File

@ -0,0 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Web工程。
echo.
cd %~dp0
cd ../ruoyi-admin/target
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -jar %JAVA_OPTS% ruoyi-admin.jar
cd bin
pause

Binary file not shown.

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

BIN
libs/wxpay-sdk-0.0.1.jar Normal file

Binary file not shown.

363
pom.xml Normal file
View File

@ -0,0 +1,363 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<packaging>pom</packaging>
<version>3.6.0</version>
<name>ruoyi</name>
<url>http://www.ruoyi.vip</url>
<description>若依管理系统</description>
<properties>
<ruoyi.version>3.6.0</ruoyi.version>
<wxsdk.version>3.0.9</wxsdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<druid.version>1.2.6</druid.version>
<bitwalker.version>1.21</bitwalker.version>
<swagger.version>3.0.0</swagger.version>
<kaptcha.version>2.3.2</kaptcha.version>
<mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version>
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
<fastjson.version>1.2.76</fastjson.version>
<oshi.version>5.8.0</oshi.version>
<jna.version>5.8.0</jna.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.fileupload.version>1.4</commons.fileupload.version>
<commons.collections.version>3.2.2</commons.collections.version>
<poi.version>4.1.2</poi.version>
<velocity.version>1.7</velocity.version>
<jwt.version>0.9.1</jwt.version>
<alipay.version>4.8.10.ALL</alipay.version>
</properties>
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies>
<!-- 生成二维码的jar -->
<!-- https://mvnrepository.com/artifact/com.google.zxing/core -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId>
<version>${alipay.version}</version>
<exclusions>
<exclusion>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
<version>1.46</version>
</dependency>
<!--dom4j -->
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<!--腾讯云短信-->
<dependency>
<groupId>com.github.qcloudsms</groupId>
<artifactId>qcloudsms</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.0.6</version> <!-- 注:如提示报错,先升级基础包版,无法解决可联系技术支持 -->
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.1.0</version>
</dependency>
<!--腾讯云OSS-->
<dependency>
<groupId>com.qcloud</groupId>
<artifactId>cos_api</artifactId>
<version>5.6.8</version>
</dependency>
<!-- 阿里云OSS -->
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>2.5.0</version>
</dependency>
<!--lombok-->
<!-- <dependency>-->
<!-- <groupId>org.projectlombok</groupId>-->
<!-- <artifactId>lombok</artifactId>-->
<!-- <version>1.18.12</version>-->
<!-- </dependency>-->
<!-- SpringBoot的依赖配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.2.13.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- 阿里数据库连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- 解析客户端操作系统、浏览器等 -->
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>${bitwalker.version}</version>
</dependency>
<!-- SpringBoot集成mybatis框架 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis-spring-boot.version}</version>
</dependency>
<!-- pagehelper 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
</dependency>
<!-- 获取系统信息 -->
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>${oshi.version}</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>${jna.version}</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>${jna.version}</version>
</dependency>
<!-- Swagger3依赖 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${swagger.version}</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- io常用工具类 -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<!-- 文件上传工具类 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons.fileupload.version}</version>
</dependency>
<!-- excel工具 -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<!-- velocity代码生成使用模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocity.version}</version>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- collections工具类 -->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${commons.collections.version}</version>
</dependency>
<!-- 阿里JSON解析器 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- Token生成与解析-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jwt.version}</version>
</dependency>
<!-- 验证码 -->
<dependency>
<groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-quartz</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 系统模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- segchk服务层-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-segchk</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- segchk接口层-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-segchk-web</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<dependency>
<groupId>com.github.wxpay</groupId>
<artifactId>wxpay-sdk</artifactId>
<version>${wxsdk.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>ruoyi-segchk</module>
<module>ruoyi-segchk-web</module>
<module>ruoyi-admin</module>
<module>ruoyi-framework</module>
<module>ruoyi-system</module>
<module>ruoyi-quartz</module>
<module>ruoyi-generator</module>
<module>ruoyi-common</module>
<!-- 加入微信sdk-->
<module>wxpay-sdk</module>
</modules>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<meminitial>512m</meminitial>
<maxmem>1048m</maxmem>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>public</id>
<name>aliyun nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>aliyun nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

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>

98
ruoyi-admin/pom.xml Normal file
View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.0</version>
<!-- <relativePath>../pom.xml</relativePath>-->
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>ruoyi-admin</artifactId>
<description>
web服务入口
</description>
<dependencies>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<!-- swagger3-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
</dependency>
<!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-quartz</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
<configuration>
<fork>true</fork> <!-- 如果没有该配置devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>

View File

@ -0,0 +1,32 @@
package com.ruoyi;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
*
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{
public static void main(String[] args)
{
// 第一个参数为账户名 第二个参数为密码 第三个参数为盐对应用户表salt如果没有可以不用填
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

View File

@ -0,0 +1,18 @@
package com.ruoyi;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* web
*
* @author ruoyi
*/
public class RuoYiServletInitializer extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{
return application.sources(RuoYiApplication.class);
}
}

View File

@ -0,0 +1,131 @@
package com.ruoyi.security;
import com.ruoyi.security.filter.JwtAuthenticationTokenFilter;
import com.ruoyi.security.handle.AuthenticationEntryPointImpl;
import com.ruoyi.security.handle.LogoutSuccessHandlerImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
/**
* spring security
*
* @author ruoyi
*/
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
/**
*
*/
@Autowired
private UserDetailsService userDetailsService;
/**
*
*/
@Autowired
private AuthenticationEntryPointImpl unauthorizedHandler;
/**
* 退
*/
@Autowired
private LogoutSuccessHandlerImpl logoutSuccessHandler;
/**
* token
*/
@Autowired
private JwtAuthenticationTokenFilter authenticationTokenFilter;
/**
* AuthenticationManager
*
* @return
* @throws Exception
*/
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
/**
* anyRequest |
* access | 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

@ -0,0 +1,43 @@
package com.ruoyi.security.filter;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* token token
*
* @author ruoyi
*/
@Component
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
@Autowired
private TokenService tokenService;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
logger.debug(request.getRequestURI());
LoginUser loginUser = tokenService.getLoginUser(request);
if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
tokenService.verifyToken(loginUser);
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
}
chain.doFilter(request, response);
}
}

View File

@ -0,0 +1,33 @@
package com.ruoyi.security.handle;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Serializable;
/**
*
*
* @author ruoyi
*/
@Component
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable {
private static final long serialVersionUID = -8970718410437077606L;
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e)
throws IOException {
int code = HttpStatus.UNAUTHORIZED;
String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI());
ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg)));
}
}

View File

@ -0,0 +1,51 @@
package com.ruoyi.security.handle;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.web.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 退
*
* @author ruoyi
*/
@Configuration
public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler {
@Autowired
private TokenService tokenService;
/**
* 退
*
* @return
*/
@Override
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
throws IOException, ServletException {
LoginUser loginUser = tokenService.getLoginUser(request);
if (StringUtils.isNotNull(loginUser)) {
String userName = loginUser.getUsername();
// 删除用户缓存记录
tokenService.delLoginUser(loginUser.getToken());
// 记录用户退出日志
AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功"));
}
ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(HttpStatus.SUCCESS, "退出成功")));
}
}

View File

@ -0,0 +1,211 @@
package com.ruoyi.security.web.domain;
import com.ruoyi.common.utils.Arith;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.security.web.domain.server.*;
import oshi.SystemInfo;
import oshi.hardware.CentralProcessor;
import oshi.hardware.CentralProcessor.TickType;
import oshi.hardware.GlobalMemory;
import oshi.hardware.HardwareAbstractionLayer;
import oshi.software.os.FileSystem;
import oshi.software.os.OSFileStore;
import oshi.software.os.OperatingSystem;
import oshi.util.Util;
import java.net.UnknownHostException;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
/**
*
*
* @author ruoyi
*/
public class Server {
private static final int OSHI_WAIT_SECOND = 1000;
/**
* CPU
*/
private Cpu cpu = new Cpu();
/**
*
*/
private Mem mem = new Mem();
/**
* JVM
*/
private Jvm jvm = new Jvm();
/**
*
*/
private Sys sys = new Sys();
/**
*
*/
private List<SysFile> sysFiles = new LinkedList<SysFile>();
public Cpu getCpu() {
return cpu;
}
public void setCpu(Cpu cpu) {
this.cpu = cpu;
}
public Mem getMem() {
return mem;
}
public void setMem(Mem mem) {
this.mem = mem;
}
public Jvm getJvm() {
return jvm;
}
public void setJvm(Jvm jvm) {
this.jvm = jvm;
}
public Sys getSys() {
return sys;
}
public void setSys(Sys sys) {
this.sys = sys;
}
public List<SysFile> getSysFiles() {
return sysFiles;
}
public void setSysFiles(List<SysFile> sysFiles) {
this.sysFiles = sysFiles;
}
/**
*
*/
private void setSysFiles(OperatingSystem os) {
FileSystem fileSystem = os.getFileSystem();
OSFileStore[] fsArray = fileSystem.getFileStores().toArray(new OSFileStore[0]);
for (OSFileStore fs : fsArray) {
long free = fs.getUsableSpace();
long total = fs.getTotalSpace();
long used = total - free;
SysFile sysFile = new SysFile();
sysFile.setDirName(fs.getMount());
sysFile.setSysTypeName(fs.getType());
sysFile.setTypeName(fs.getName());
sysFile.setTotal(convertFileSize(total));
sysFile.setFree(convertFileSize(free));
sysFile.setUsed(convertFileSize(used));
sysFile.setUsage(Arith.mul(Arith.div(used, total, 4), 100));
sysFiles.add(sysFile);
}
}
public void copyTo() throws Exception {
SystemInfo si = new SystemInfo();
HardwareAbstractionLayer hal = si.getHardware();
setCpuInfo(hal.getProcessor());
setMemInfo(hal.getMemory());
setSysInfo();
setJvmInfo();
setSysFiles(si.getOperatingSystem());
}
/**
* CPU
*/
private void setCpuInfo(CentralProcessor processor) {
// CPU信息
long[] prevTicks = processor.getSystemCpuLoadTicks();
Util.sleep(OSHI_WAIT_SECOND);
long[] ticks = processor.getSystemCpuLoadTicks();
long nice = ticks[TickType.NICE.getIndex()] - prevTicks[TickType.NICE.getIndex()];
long irq = ticks[TickType.IRQ.getIndex()] - prevTicks[TickType.IRQ.getIndex()];
long softirq = ticks[TickType.SOFTIRQ.getIndex()] - prevTicks[TickType.SOFTIRQ.getIndex()];
long steal = ticks[TickType.STEAL.getIndex()] - prevTicks[TickType.STEAL.getIndex()];
long cSys = ticks[TickType.SYSTEM.getIndex()] - prevTicks[TickType.SYSTEM.getIndex()];
long user = ticks[TickType.USER.getIndex()] - prevTicks[TickType.USER.getIndex()];
long iowait = ticks[TickType.IOWAIT.getIndex()] - prevTicks[TickType.IOWAIT.getIndex()];
long idle = ticks[TickType.IDLE.getIndex()] - prevTicks[TickType.IDLE.getIndex()];
long totalCpu = user + nice + cSys + idle + iowait + irq + softirq + steal;
cpu.setCpuNum(processor.getLogicalProcessorCount());
cpu.setTotal(totalCpu);
cpu.setSys(cSys);
cpu.setUsed(user);
cpu.setWait(iowait);
cpu.setFree(idle);
}
/**
*
*/
private void setMemInfo(GlobalMemory memory) {
mem.setTotal(memory.getTotal());
mem.setUsed(memory.getTotal() - memory.getAvailable());
mem.setFree(memory.getAvailable());
}
/**
*
*/
private void setSysInfo() {
Properties props = System.getProperties();
sys.setComputerName(IpUtils.getHostName());
sys.setComputerIp(IpUtils.getHostIp());
sys.setOsName(props.getProperty("os.name"));
sys.setOsArch(props.getProperty("os.arch"));
sys.setUserDir(props.getProperty("user.dir"));
}
/**
* Java
*/
private void setJvmInfo() throws UnknownHostException {
Properties props = System.getProperties();
jvm.setTotal(Runtime.getRuntime().totalMemory());
jvm.setMax(Runtime.getRuntime().maxMemory());
jvm.setFree(Runtime.getRuntime().freeMemory());
jvm.setVersion(props.getProperty("java.version"));
jvm.setHome(props.getProperty("java.home"));
}
/**
*
*
* @param size
* @return
*/
public String convertFileSize(long size) {
long kb = 1024;
long mb = kb * 1024;
long gb = mb * 1024;
if (size >= gb) {
return String.format("%.1f GB", (float) size / gb);
} else if (size >= mb) {
float f = (float) size / mb;
return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f);
} else if (size >= kb) {
float f = (float) size / kb;
return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f);
} else {
return String.format("%d B", size);
}
}
}

View File

@ -0,0 +1,88 @@
package com.ruoyi.security.web.domain.server;
import com.ruoyi.common.utils.Arith;
/**
* CPU
*
* @author ruoyi
*/
public class Cpu {
/**
*
*/
private int cpuNum;
/**
* CPU使
*/
private double total;
/**
* CPU使
*/
private double sys;
/**
* CPU使
*/
private double used;
/**
* CPU
*/
private double wait;
/**
* CPU
*/
private double free;
public int getCpuNum() {
return cpuNum;
}
public void setCpuNum(int cpuNum) {
this.cpuNum = cpuNum;
}
public double getTotal() {
return Arith.round(Arith.mul(total, 100), 2);
}
public void setTotal(double total) {
this.total = total;
}
public double getSys() {
return Arith.round(Arith.mul(sys / total, 100), 2);
}
public void setSys(double sys) {
this.sys = sys;
}
public double getUsed() {
return Arith.round(Arith.mul(used / total, 100), 2);
}
public void setUsed(double used) {
this.used = used;
}
public double getWait() {
return Arith.round(Arith.mul(wait / total, 100), 2);
}
public void setWait(double wait) {
this.wait = wait;
}
public double getFree() {
return Arith.round(Arith.mul(free / total, 100), 2);
}
public void setFree(double free) {
this.free = free;
}
}

View File

@ -0,0 +1,107 @@
package com.ruoyi.security.web.domain.server;
import com.ruoyi.common.utils.Arith;
import com.ruoyi.common.utils.DateUtils;
import java.lang.management.ManagementFactory;
/**
* JVM
*
* @author ruoyi
*/
public class Jvm {
/**
* JVM(M)
*/
private double total;
/**
* JVM(M)
*/
private double max;
/**
* JVM(M)
*/
private double free;
/**
* JDK
*/
private String version;
/**
* JDK
*/
private String home;
public double getTotal() {
return Arith.div(total, (1024 * 1024), 2);
}
public void setTotal(double total) {
this.total = total;
}
public double getMax() {
return Arith.div(max, (1024 * 1024), 2);
}
public void setMax(double max) {
this.max = max;
}
public double getFree() {
return Arith.div(free, (1024 * 1024), 2);
}
public void setFree(double free) {
this.free = free;
}
public double getUsed() {
return Arith.div(total - free, (1024 * 1024), 2);
}
public double getUsage() {
return Arith.mul(Arith.div(total - free, total, 4), 100);
}
/**
* JDK
*/
public String getName() {
return ManagementFactory.getRuntimeMXBean().getVmName();
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getHome() {
return home;
}
public void setHome(String home) {
this.home = home;
}
/**
* JDK
*/
public String getStartTime() {
return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getServerStartDate());
}
/**
* JDK
*/
public String getRunTime() {
return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate());
}
}

View File

@ -0,0 +1,53 @@
package com.ruoyi.security.web.domain.server;
import com.ruoyi.common.utils.Arith;
/**
*
*
* @author ruoyi
*/
public class Mem {
/**
*
*/
private double total;
/**
*
*/
private double used;
/**
*
*/
private double free;
public double getTotal() {
return Arith.div(total, (1024 * 1024 * 1024), 2);
}
public void setTotal(long total) {
this.total = total;
}
public double getUsed() {
return Arith.div(used, (1024 * 1024 * 1024), 2);
}
public void setUsed(long used) {
this.used = used;
}
public double getFree() {
return Arith.div(free, (1024 * 1024 * 1024), 2);
}
public void setFree(long free) {
this.free = free;
}
public double getUsage() {
return Arith.mul(Arith.div(used, total, 4), 100);
}
}

View File

@ -0,0 +1,73 @@
package com.ruoyi.security.web.domain.server;
/**
*
*
* @author ruoyi
*/
public class Sys {
/**
*
*/
private String computerName;
/**
* Ip
*/
private String computerIp;
/**
*
*/
private String userDir;
/**
*
*/
private String osName;
/**
*
*/
private String osArch;
public String getComputerName() {
return computerName;
}
public void setComputerName(String computerName) {
this.computerName = computerName;
}
public String getComputerIp() {
return computerIp;
}
public void setComputerIp(String computerIp) {
this.computerIp = computerIp;
}
public String getUserDir() {
return userDir;
}
public void setUserDir(String userDir) {
this.userDir = userDir;
}
public String getOsName() {
return osName;
}
public void setOsName(String osName) {
this.osName = osName;
}
public String getOsArch() {
return osArch;
}
public void setOsArch(String osArch) {
this.osArch = osArch;
}
}

View File

@ -0,0 +1,99 @@
package com.ruoyi.security.web.domain.server;
/**
*
*
* @author ruoyi
*/
public class SysFile {
/**
*
*/
private String dirName;
/**
*
*/
private String sysTypeName;
/**
*
*/
private String typeName;
/**
*
*/
private String total;
/**
*
*/
private String free;
/**
* 使
*/
private String used;
/**
* 使
*/
private double usage;
public String getDirName() {
return dirName;
}
public void setDirName(String dirName) {
this.dirName = dirName;
}
public String getSysTypeName() {
return sysTypeName;
}
public void setSysTypeName(String sysTypeName) {
this.sysTypeName = sysTypeName;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getTotal() {
return total;
}
public void setTotal(String total) {
this.total = total;
}
public String getFree() {
return free;
}
public void setFree(String free) {
this.free = free;
}
public String getUsed() {
return used;
}
public void setUsed(String used) {
this.used = used;
}
public double getUsage() {
return usage;
}
public void setUsage(double usage) {
this.usage = usage;
}
}

View File

@ -0,0 +1,105 @@
package com.ruoyi.security.web.exception;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.exception.DemoModeException;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.AccountExpiredException;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.validation.BindException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.NoHandlerFoundException;
/**
*
*
* @author ruoyi
*/
@RestControllerAdvice
public class GlobalExceptionHandler {
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
/**
*
*/
@ExceptionHandler(BaseException.class)
public AjaxResult baseException(BaseException e) {
return AjaxResult.error(e.getMessage());
}
/**
*
*/
@ExceptionHandler(CustomException.class)
public AjaxResult businessException(CustomException e) {
if (StringUtils.isNull(e.getCode())) {
return AjaxResult.error(e.getMessage());
}
return AjaxResult.error(e.getCode(), e.getMessage());
}
@ExceptionHandler(NoHandlerFoundException.class)
public AjaxResult handlerNoFoundException(Exception e) {
log.error(e.getMessage(), e);
return AjaxResult.error(HttpStatus.NOT_FOUND, "路径不存在,请检查路径是否正确");
}
@ExceptionHandler(AccessDeniedException.class)
public AjaxResult handleAuthorizationException(AccessDeniedException e) {
log.error(e.getMessage());
return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权");
}
@ExceptionHandler(AccountExpiredException.class)
public AjaxResult handleAccountExpiredException(AccountExpiredException e) {
log.error(e.getMessage(), e);
return AjaxResult.error(e.getMessage());
}
@ExceptionHandler(UsernameNotFoundException.class)
public AjaxResult handleUsernameNotFoundException(UsernameNotFoundException e) {
log.error(e.getMessage(), e);
return AjaxResult.error(e.getMessage());
}
@ExceptionHandler(Exception.class)
public AjaxResult handleException(Exception e) {
log.error(e.getMessage(), e);
return AjaxResult.error(e.getMessage());
}
/**
*
*/
@ExceptionHandler(BindException.class)
public AjaxResult validatedBindException(BindException e) {
log.error(e.getMessage(), e);
String message = e.getAllErrors().get(0).getDefaultMessage();
return AjaxResult.error(message);
}
/**
*
*/
@ExceptionHandler(MethodArgumentNotValidException.class)
public Object validExceptionHandler(MethodArgumentNotValidException e) {
log.error(e.getMessage(), e);
String message = e.getBindingResult().getFieldError().getDefaultMessage();
return AjaxResult.error(message);
}
/**
*
*/
@ExceptionHandler(DemoModeException.class)
public AjaxResult demoModeException(DemoModeException e) {
return AjaxResult.error("演示模式,不允许操作");
}
}

View File

@ -0,0 +1,153 @@
package com.ruoyi.security.web.service;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Set;
/**
* RuoYi 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

@ -0,0 +1,80 @@
package com.ruoyi.security.web.service;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.exception.user.CaptchaException;
import com.ruoyi.common.exception.user.CaptchaExpireException;
import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.web.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
*
*
* @author ruoyi
*/
@Component
public class SysLoginService {
@Autowired
private TokenService tokenService;
@Resource
private AuthenticationManager authenticationManager;
@Autowired
private RedisCache redisCache;
/**
*
*
* @param username
* @param password
* @param code
* @param uuid
* @return
*/
public String login(String username, String password, String code, String uuid) {
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String captcha = redisCache.getCacheObject(verifyKey);
redisCache.deleteObject(verifyKey);
if (captcha == null) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
throw new CaptchaExpireException();
}
if (!code.equalsIgnoreCase(captcha)) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
throw new CaptchaException();
}
// 用户验证
Authentication authentication = null;
try {
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager
.authenticate(new UsernamePasswordAuthenticationToken(username, password));
} catch (Exception e) {
if (e instanceof BadCredentialsException) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
} else {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
throw new CustomException(e.getMessage());
}
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
// 生成token
return tokenService.createToken(loginUser);
}
}

View File

@ -0,0 +1,58 @@
package com.ruoyi.security.web.service;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.segchk.service.ISegchkProviderMgtService;
import com.ruoyi.system.service.ISysMenuService;
import com.ruoyi.system.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashSet;
import java.util.Set;
/**
*
*
* @author ruoyi
*/
@Component
public class SysPermissionService {
@Autowired
private ISysRoleService roleService;
@Autowired
private ISysMenuService menuService;
/**
*
*
* @param user
* @return
*/
public Set<String> getRolePermission(SysUser user) {
Set<String> roles = new HashSet<String>();
// 管理员拥有所有权限
if (user.isAdmin()) {
roles.add("admin");
} else {
roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
}
return roles;
}
/**
*
*
* @param user
* @return
*/
public Set<String> getMenuPermission(SysUser user) {
Set<String> perms = new HashSet<String>();
// 管理员拥有所有权限
if (user.isAdmin()) {
perms.add("*:*:*");
} else {
perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId()));
}
return perms;
}
}

View File

@ -0,0 +1,52 @@
package com.ruoyi.security.web.service;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
/**
*
*
* @author ruoyi
*/
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
private static final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class);
@Autowired
private ISysUserService userService;
@Autowired
private SysPermissionService permissionService;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
SysUser user = userService.selectUserByUserName(username);
if (StringUtils.isNull(user)) {
log.info("登录用户:{} 不存在.", username);
throw new UsernameNotFoundException("登录用户:" + username + " 不存在");
} else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
log.info("登录用户:{} 已被删除.", username);
throw new BaseException("对不起,您的账号:" + username + " 已被删除");
} else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
log.info("登录用户:{} 已被停用.", username);
throw new BaseException("对不起,您的账号:" + username + " 已停用");
}
return createLoginUser(user);
}
public UserDetails createLoginUser(SysUser user) {
return new LoginUser(user, permissionService.getMenuPermission(user));
}
}

View File

@ -0,0 +1,96 @@
package com.ruoyi.web.controller.common;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysConfigService;
/**
*
*
* @author ruoyi
*/
@RestController
public class CaptchaController
{
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
// 验证码类型
@Value("${ruoyi.captchaType}")
private String captchaType;
@Autowired
private ISysConfigService configService;
/**
*
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException
{
AjaxResult ajax = AjaxResult.success();
boolean captchaOnOff = configService.selectCaptchaOnOff();
ajax.put("captchaOnOff", captchaOnOff);
if (!captchaOnOff)
{
return ajax;
}
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
if ("math".equals(captchaType))
{
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
}
else if ("char".equals(captchaType))
{
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try
{
ImageIO.write(image, "jpg", os);
}
catch (IOException e)
{
return AjaxResult.error(e.getMessage());
}
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}

View File

@ -0,0 +1,334 @@
package com.ruoyi.web.controller.common;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.framework.config.ServerConfig;
/**
*
*
* @author ruoyi
*/
@RestController
public class CommonController
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired
private ServerConfig serverConfig;
/**
*
*
* @param fileName
* @param delete
*/
@GetMapping("common/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{
try
{
if (!FileUtils.checkAllowDownload(fileName))
{
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = RuoYiConfig.getDownloadPath() + fileName;
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete)
{
FileUtils.deleteFile(filePath);
}
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
/**
*
*/
@PostMapping("/common/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
log.debug("/common/upload with url: {{}}, filename: {{}}", url, fileName );
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@PostMapping("/common/store_cert")
public AjaxResult storeCert(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getProfile() + "/store_cert";
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
log.debug("/common/store_cert with url: {{}}, filename: {{}}", url, fileName );
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@PostMapping("/common/store_smallicon")
public AjaxResult storeSmallicon(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getProfile() + "/store_smallicon";
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
log.debug("/common/store_smallicon with url: {{}}, filename: {{}}", url, fileName );
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@PostMapping("/common/store_bigicon")
public AjaxResult storeBigicon(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getProfile() + "/store_bigicon";
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
log.debug("/common/store_bigicon with url: {{}}, filename: {{}}", url, fileName );
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@PostMapping("/common/store_banner")
public AjaxResult storeBanner(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getProfile() + "/store_banner";
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
log.debug("/common/store_banner with url: {{}}, filename: {{}}", url, fileName );
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@PostMapping("/common/store_env")
public AjaxResult storeEnv(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getProfile() + "/store_env";
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
log.debug("/common/store_env with url: {{}}, filename: {{}}", url, fileName );
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@PostMapping("/common/store_details")
public AjaxResult storeDetails(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getProfile() + "/store_details";
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
log.debug("/common/store_details with url: {{}}, filename: {{}}", url, fileName );
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@PostMapping("/common/keyword")
public AjaxResult keyword(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getProfile() + "/keyword";
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
log.debug("/common/keyword with url: {{}}, filename: {{}}", url, fileName );
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@PostMapping("/common/preference")
public AjaxResult preference(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getProfile() + "/preference";
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
log.debug("/common/preference with url: {{}}, filename: {{}}", url, fileName );
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@GetMapping("/common/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception
{
try
{
if (!FileUtils.checkAllowDownload(resource))
{
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
}
// 本地资源路径
String localPath = RuoYiConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
}

View File

@ -0,0 +1,53 @@
package com.ruoyi.web.controller.monitor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/cache")
public class CacheController
{
@Autowired
private RedisTemplate<String, String> redisTemplate;
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
Map<String, Object> result = new HashMap<>(3);
result.put("info", info);
result.put("dbSize", dbSize);
List<Map<String, String>> pieList = new ArrayList<>();
commandStats.stringPropertyNames().forEach(key -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
result.put("commandStats", pieList);
return AjaxResult.success(result);
}
}

View File

@ -0,0 +1,27 @@
package com.ruoyi.web.controller.monitor;
import com.ruoyi.security.web.domain.Server;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.domain.AjaxResult;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/server")
public class ServerController
{
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Server server = new Server();
server.copyTo();
return AjaxResult.success(server);
}
}

View File

@ -0,0 +1,67 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService;
/**
* 访
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController
{
@Autowired
private ISysLogininforService logininforService;
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor)
{
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@GetMapping("/export")
public AjaxResult export(SysLogininfor logininfor)
{
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
return util.exportExcel(list, "登录日志");
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds)
{
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean()
{
logininforService.cleanLogininfor();
return AjaxResult.success();
}
}

View File

@ -0,0 +1,67 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.service.ISysOperLogService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController
{
@Autowired
private ISysOperLogService operLogService;
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog)
{
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@GetMapping("/export")
public AjaxResult export(SysOperLog operLog)
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
return util.exportExcel(list, "操作日志");
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds)
{
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean")
public AjaxResult clean()
{
operLogService.cleanOperLog();
return AjaxResult.success();
}
}

View File

@ -0,0 +1,92 @@
package com.ruoyi.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.ISysUserOnlineService;
/**
* 线
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController
{
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private RedisCache redisCache;
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName)
{
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys)
{
LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
{
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
}
else if (StringUtils.isNotEmpty(ipaddr))
{
if (StringUtils.equals(ipaddr, user.getIpaddr()))
{
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
}
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
{
if (StringUtils.equals(userName, user.getUsername()))
{
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
}
else
{
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 退
*/
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
return AjaxResult.success();
}
}

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,213 @@
package com.ruoyi.web.controller.segchk;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.segchk.domain.SegchkStoreBasicInfo;
import com.ruoyi.segchk.service.ISegchkStoreBasicInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 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)
{
// 获取当前登录用户信息
LoginUser loginUser = getLoginUser();
SysUser sysUser = loginUser.getUser();
if(sysUser.getUserId() == 1){
// 说明是超级管理员
;
}
else{
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
}
System.out.println("segchk:segchk_store_basic_info:list userinfo:" + loginUser.toString());
System.out.println("segchk:segchk_store_basic_info:list userinfo:" + sysUser.getRoleId());
sysUser.getRoles().forEach(it -> System.out.println(it.toString()));
startPage();
List<SegchkStoreBasicInfo> list = segchkStoreBasicInfoService.selectSegchkStoreBasicInfoList(segchkStoreBasicInfo);
return getDataTable(list);
}
/**
* seg
*/
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:export')")
@Log(title = "seg商家基础信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SegchkStoreBasicInfo segchkStoreBasicInfo)
{
// 获取当前登录用户信息
SysUser sysUser = getLoginUser().getUser();
if(sysUser.getUserId() == 1){
// 说明是超级管理员
;
}
else{
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
}
List<SegchkStoreBasicInfo> list = segchkStoreBasicInfoService.selectSegchkStoreBasicInfoList(segchkStoreBasicInfo);
ExcelUtil<SegchkStoreBasicInfo> util = new ExcelUtil<SegchkStoreBasicInfo>(SegchkStoreBasicInfo.class);
return util.exportExcel(list, "seg商家基础信息数据");
}
/**
* seg
*/
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:query')")
@GetMapping(value = "/{storeId}")
public AjaxResult getInfo(@PathVariable("storeId") Long storeId)
{
return AjaxResult.success(segchkStoreBasicInfoService.selectSegchkStoreBasicInfoByStoreId(storeId));
}
/**
* seg
*/
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:add')")
@Log(title = "seg商家基础信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SegchkStoreBasicInfo segchkStoreBasicInfo)
{
// 获取当前登录用户信息
SysUser sysUser = getLoginUser().getUser();
if(sysUser.getUserId() == 1){
// 说明是超级管理员
;
}
else{
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
}
int i = segchkStoreBasicInfoService.insertSegchkStoreBasicInfo(segchkStoreBasicInfo);
if(i < 0){
return AjaxResult.error(500, "手机号码已绑定商户");
}
else {
return toAjax(i);
}
}
/**
* seg
*/
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:edit')")
@Log(title = "seg商家基础信息", businessType = BusinessType.UPDATE)
@PutMapping("edit_info")
public AjaxResult edit(@RequestBody SegchkStoreBasicInfo segchkStoreBasicInfo)
{
// 获取当前登录用户信息
SysUser sysUser = getLoginUser().getUser();
if(sysUser.getUserId() == 1){
// 说明是超级管理员
;
}
else{
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
}
logger.debug("edit_info with ---> {}", segchkStoreBasicInfo.toString());
int i = segchkStoreBasicInfoService.updateSegchkStoreBasicInfo(segchkStoreBasicInfo);
if(i < 0){
return AjaxResult.error(500, "手机号码已绑定商户");
}
else {
return toAjax(i);
}
}
/**
* seg
*/
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:edit')")
@Log(title = "seg商家基础信息", businessType = BusinessType.UPDATE)
@PutMapping("update_detail")
public AjaxResult update_detail(@RequestBody SegchkStoreBasicInfo segchkStoreBasicInfo)
{
// 获取当前登录用户信息
SysUser sysUser = getLoginUser().getUser();
if(sysUser.getUserId() == 1){
// 说明是超级管理员
;
}
else{
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
}
logger.debug("update_detail with ---> {}", segchkStoreBasicInfo.toString());
int i = segchkStoreBasicInfoService.updateSegchkStoreDetail(segchkStoreBasicInfo);
return toAjax(i);
}
/**
* seg
*/
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:edit')")
@Log(title = "seg商家基础信息", businessType = BusinessType.UPDATE)
@PutMapping("service_state")
// public AjaxResult service_state(Long providerId, Long storeId, String serviceState)
public AjaxResult service_state(@RequestBody SegchkStoreBasicInfo segchkStoreBasicInfo)
{
// SegchkStoreBasicInfo segchkStoreBasicInfo = new SegchkStoreBasicInfo();
// segchkStoreBasicInfo.setProviderId(providerId);
// segchkStoreBasicInfo.setStoreId(storeId);
// segchkStoreBasicInfo.setServiceState(serviceState);
// 获取当前登录用户信息
SysUser sysUser = getLoginUser().getUser();
if(sysUser.getUserId() == 1){
// 说明是超级管理员
;
}
else{
segchkStoreBasicInfo.setProviderId(sysUser.getProviderId());
}
logger.debug("service_state with: {}", segchkStoreBasicInfo.toString());
return toAjax(segchkStoreBasicInfoService.updateSegchkStoreServiceStatus(segchkStoreBasicInfo));
}
/**
* seg
*/
@PreAuthorize("@ss.hasPermi('segchk:segchk_store_basic_info:remove')")
@Log(title = "seg商家基础信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{storeIds}")
public AjaxResult remove(@PathVariable Long[] storeIds)
{
return toAjax(segchkStoreBasicInfoService.deleteSegchkStoreBasicInfoByStoreIds(storeIds));
}
}

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

@ -0,0 +1,135 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/config")
public class SysConfigController extends BaseController
{
@Autowired
private ISysConfigService configService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list")
public TableDataInfo list(SysConfig config)
{
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')")
@GetMapping("/export")
public AjaxResult export(SysConfig config)
{
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
return util.exportExcel(list, "参数数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId)
{
return AjaxResult.success(configService.selectConfigById(configId));
}
/**
*
*/
@GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey)
{
return AjaxResult.success(configService.selectConfigByKey(configKey));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
@RepeatSubmit
public AjaxResult add(@Validated @RequestBody SysConfig config)
{
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(getUsername());
return toAjax(configService.insertConfig(config));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config)
{
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(getUsername());
return toAjax(configService.updateConfig(config));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds)
{
configService.deleteConfigByIds(configIds);
return success();
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
configService.resetConfigCache();
return AjaxResult.success();
}
}

View File

@ -0,0 +1,162 @@
package com.ruoyi.web.controller.system;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
{
@Autowired
private ISysDeptService deptService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list")
public AjaxResult list(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(depts);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
{
List<SysDept> depts = deptService.selectDeptList(new SysDept());
Iterator<SysDept> it = depts.iterator();
while (it.hasNext())
{
SysDept d = (SysDept) it.next();
if (d.getDeptId().intValue() == deptId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
{
it.remove();
}
}
return AjaxResult.success(depts);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId)
{
return AjaxResult.success(deptService.selectDeptById(deptId));
}
/**
*
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
}
/**
*
*/
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
{
List<SysDept> depts = deptService.selectDeptList(new SysDept());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
return ajax;
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept)
{
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(getUsername());
return toAjax(deptService.insertDept(dept));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept)
{
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
else if (dept.getParentId().equals(dept.getDeptId()))
{
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
{
return AjaxResult.error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(getUsername());
return toAjax(deptService.updateDept(dept));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId)
{
if (deptService.hasChildByDeptId(deptId))
{
return AjaxResult.error("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
return AjaxResult.error("部门存在用户,不允许删除");
}
return toAjax(deptService.deleteDeptById(deptId));
}
}

View File

@ -0,0 +1,120 @@
package com.ruoyi.web.controller.system;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController
{
@Autowired
private ISysDictDataService dictDataService;
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
{
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export")
public AjaxResult export(SysDictData dictData)
{
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
return util.exportExcel(list, "字典数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode)
{
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
}
/**
*
*/
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType)
{
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data))
{
data = new ArrayList<SysDictData>();
}
return AjaxResult.success(data);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict)
{
dict.setCreateBy(getUsername());
return toAjax(dictDataService.insertDictData(dict));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
{
dict.setUpdateBy(getUsername());
return toAjax(dictDataService.updateDictData(dict));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes)
{
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
}

View File

@ -0,0 +1,131 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictTypeService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/type")
public class SysDictTypeController extends BaseController
{
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictType dictType)
{
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export")
public AjaxResult export(SysDictType dictType)
{
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
return util.exportExcel(list, "字典类型");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId)
{
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict)
{
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(getUsername());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
{
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(getUsername());
return toAjax(dictTypeService.updateDictType(dict));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds)
{
dictTypeService.deleteDictTypeByIds(dictIds);
return success();
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
dictTypeService.resetDictCache();
return AjaxResult.success();
}
/**
*
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return AjaxResult.success(dictTypes);
}
}

View File

@ -0,0 +1,29 @@
package com.ruoyi.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.StringUtils;
/**
*
*
* @author ruoyi
*/
@RestController
public class SysIndexController
{
/** 系统基础配置 */
@Autowired
private RuoYiConfig ruoyiConfig;
/**
* 访
*/
@RequestMapping("/")
public String index()
{
return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
}
}

View File

@ -0,0 +1,102 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import com.ruoyi.security.web.service.SysLoginService;
import com.ruoyi.security.web.service.SysPermissionService;
import com.ruoyi.segchk.service.ISegchkProviderMgtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.service.ISysMenuService;
/**
*
*
* @author ruoyi
*/
@RestController
public class SysLoginController
{
@Autowired
private SysLoginService loginService;
@Autowired
private ISysMenuService menuService;
@Autowired
private SysPermissionService permissionService;
@Autowired
private ISegchkProviderMgtService segchkProviderMgtService;
/**
*
*
* @param loginBody
* @return
*/
@PostMapping("/login")
public AjaxResult login(@RequestBody LoginBody loginBody)
{
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid());
ajax.put(Constants.TOKEN, token);
System.out.println("login token is : " + token);
return ajax;
}
/**
*
*
* @return
*/
@GetMapping("getInfo")
public AjaxResult getInfo()
{
SysUser user = SecurityUtils.getLoginUser().getUser();
Long providerId = segchkProviderMgtService.getProviderIdByPhoneNo(user.getPhonenumber());
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
user.setProviderId(providerId);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
System.out.println("getInfo with " + user.toString());
System.out.println("getInfo with " + String.join(",", roles));
System.out.println("getInfo with " + String.join(",", permissions));
return ajax;
}
/**
*
*
* @return
*/
@GetMapping("getRouters")
public AjaxResult getRouters()
{
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
List<String> collect = menus.parallelStream().map(v -> v.toString()).collect(Collectors.toList());
System.out.println(String.format("getRouters with {}---{}", userId, String.join(",", collect)));
return AjaxResult.success(menuService.buildMenus(menus));
}
}

View File

@ -0,0 +1,142 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysMenuService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/menu")
public class SysMenuController extends BaseController
{
@Autowired
private ISysMenuService menuService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:menu:list')")
@GetMapping("/list")
public AjaxResult list(SysMenu menu)
{
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return AjaxResult.success(menus);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:menu:query')")
@GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId)
{
return AjaxResult.success(menuService.selectMenuById(menuId));
}
/**
*
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysMenu menu)
{
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
}
/**
*
*/
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
{
List<SysMenu> menus = menuService.selectMenuList(getUserId());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return ajax;
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:menu:add')")
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysMenu menu)
{
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
}
menu.setCreateBy(getUsername());
return toAjax(menuService.insertMenu(menu));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
{
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
}
else if (menu.getMenuId().equals(menu.getParentId()))
{
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
}
menu.setUpdateBy(getUsername());
return toAjax(menuService.updateMenu(menu));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId)
{
if (menuService.hasChildByMenuId(menuId))
{
return AjaxResult.error("存在子菜单,不允许删除");
}
if (menuService.checkMenuExistRole(menuId))
{
return AjaxResult.error("菜单已分配,不允许删除");
}
return toAjax(menuService.deleteMenuById(menuId));
}
}

View File

@ -0,0 +1,91 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/notice")
public class SysNoticeController extends BaseController
{
@Autowired
private ISysNoticeService noticeService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list")
public TableDataInfo list(SysNotice notice)
{
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable Long noticeId)
{
return AjaxResult.success(noticeService.selectNoticeById(noticeId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:add')")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice)
{
notice.setCreateBy(getUsername());
return toAjax(noticeService.insertNotice(notice));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
{
notice.setUpdateBy(getUsername());
return toAjax(noticeService.updateNotice(notice));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds)
{
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}

View File

@ -0,0 +1,129 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/post")
public class SysPostController extends BaseController
{
@Autowired
private ISysPostService postService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:post:list')")
@GetMapping("/list")
public TableDataInfo list(SysPost post)
{
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
}
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')")
@GetMapping("/export")
public AjaxResult export(SysPost post)
{
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
return util.exportExcel(list, "岗位数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/{postId}")
public AjaxResult getInfo(@PathVariable Long postId)
{
return AjaxResult.success(postService.selectPostById(postId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:post:add')")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysPost post)
{
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
{
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(getUsername());
return toAjax(postService.insertPost(post));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:post:edit')")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysPost post)
{
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
{
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(getUsername());
return toAjax(postService.updatePost(post));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:post:remove')")
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
public AjaxResult remove(@PathVariable Long[] postIds)
{
return toAjax(postService.deletePostByIds(postIds));
}
/**
*
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysPost> posts = postService.selectPostAll();
return AjaxResult.success(posts);
}
}

View File

@ -0,0 +1,141 @@
package com.ruoyi.web.controller.system;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysUserService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/user/profile")
public class SysProfileController extends BaseController
{
@Autowired
private ISysUserService userService;
@Autowired
private TokenService tokenService;
/**
*
*/
@GetMapping
public AjaxResult profile()
{
LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser();
AjaxResult ajax = AjaxResult.success(user);
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
return ajax;
}
/**
*
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult updateProfile(@RequestBody SysUser user)
{
if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
}
if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
LoginUser loginUser = getLoginUser();
SysUser sysUser = loginUser.getUser();
user.setUserId(sysUser.getUserId());
user.setPassword(null);
if (userService.updateUserProfile(user) > 0)
{
// 更新缓存用户信息
sysUser.setNickName(user.getNickName());
sysUser.setPhonenumber(user.getPhonenumber());
sysUser.setEmail(user.getEmail());
sysUser.setSex(user.getSex());
tokenService.setLoginUser(loginUser);
return AjaxResult.success();
}
return AjaxResult.error("修改个人信息异常,请联系管理员");
}
/**
*
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public AjaxResult updatePwd(String oldPassword, String newPassword)
{
LoginUser loginUser = getLoginUser();
String userName = loginUser.getUsername();
String password = loginUser.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password))
{
return AjaxResult.error("修改密码失败,旧密码错误");
}
if (SecurityUtils.matchesPassword(newPassword, password))
{
return AjaxResult.error("新密码不能与旧密码相同");
}
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
{
// 更新缓存用户密码
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
tokenService.setLoginUser(loginUser);
return AjaxResult.success();
}
return AjaxResult.error("修改密码异常,请联系管理员");
}
/**
*
*/
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException
{
if (!file.isEmpty())
{
LoginUser loginUser = getLoginUser();
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
{
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar);
// 更新缓存用户头像
loginUser.getUser().setAvatar(avatar);
tokenService.setLoginUser(loginUser);
return ajax;
}
}
return AjaxResult.error("上传图片异常,请联系管理员");
}
}

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

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