add file
This commit is contained in:
44
README.md
44
README.md
@@ -1,39 +1,7 @@
|
||||
# chaozhangguijava
|
||||
## 服务器相关配置
|
||||
|
||||
#### 介绍
|
||||
{**以下是 Gitee 平台说明,您可以替换此简介**
|
||||
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
|
||||
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
### rabbitmq
|
||||
启动rabbitmq命令:
|
||||
```shell
|
||||
systemctl start rabbitmq-server.service
|
||||
```
|
||||
22
autoStart.md
Normal file
22
autoStart.md
Normal file
@@ -0,0 +1,22 @@
|
||||
## autoStart.sh脚本使用说明
|
||||
|
||||
#### 1、将对应的脚本文件放到对应的jar包启动脚本下
|
||||
如`apiStart7004.sh`的脚本在`/home/syb/api`目录下.
|
||||
即将`pluss-api-page`下的`autoStart.sh`放到该目录下
|
||||
|
||||
#### 2.1、文件授权
|
||||
```chmod 777 ./autoStart.sh```
|
||||
|
||||
#### 2.2 文件编码调整
|
||||
```
|
||||
vi autoStart.out
|
||||
|
||||
:set ff=unix
|
||||
|
||||
:wq
|
||||
```
|
||||
|
||||
#### 3、脚本启动
|
||||
```nohup ./autoStart.sh >autoStart.out 2>&1 &```
|
||||
```nohup ./autoStartApi.sh >autoStart.out 2>&1 &```
|
||||
```nohup ./autoStartWap.sh >autoStart.out 2>&1 &```
|
||||
102
code-generator/pom.xml
Normal file
102
code-generator/pom.xml
Normal file
@@ -0,0 +1,102 @@
|
||||
<?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>pluss-parent</artifactId>
|
||||
<groupId>cn.pluss.platform</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>code-generator</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.pluss.platform</groupId>
|
||||
<artifactId>pluss-common-bundle</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>lombok</artifactId>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
<groupId>com.baomidou</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.49</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
<version>3.5.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
<groupId>com.baomidou</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>3.5.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-yaml</artifactId>
|
||||
<version>2.11.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.24</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ibeetl</groupId>
|
||||
<artifactId>beetl</artifactId>
|
||||
<version>3.10.0.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
3
code-generator/readme.md
Normal file
3
code-generator/readme.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## 代码生成器
|
||||
|
||||
用于通过数据表来生成对应的实体类,mybatis-plus Mapper文件,以及基本的controller
|
||||
18
code-generator/src/main/java/com/demo/DataSource.java
Normal file
18
code-generator/src/main/java/com/demo/DataSource.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.demo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@Data
|
||||
public class DataSource {
|
||||
|
||||
private String url;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
private String driverClassName;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.demo.util;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.baomidou.mybatisplus.generator.engine.BeetlTemplateEngine;
|
||||
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
|
||||
import com.demo.DataSource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CodeGenerator {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(CodeGenerator.class);
|
||||
|
||||
private final static String[] TABLE_ARRAY = {"tb_pluss_merc_member_set"};
|
||||
|
||||
private final static String MODULE_NAME = "code-generator";
|
||||
|
||||
/**
|
||||
* 表名前缀
|
||||
*/
|
||||
private final static String TABLE_PREFIX = "tb_pluss";
|
||||
|
||||
private final static String AUTHOR = "Djh";
|
||||
|
||||
private final static String PACKAGE_PREFIX = "cn.pluss.platform";
|
||||
|
||||
/**
|
||||
* 模板路径
|
||||
*/
|
||||
private final static String ENTITY = "templates/entity.java";
|
||||
private final static String MAPPER = "templates/mapper.java";
|
||||
// private final static String SERVICE = "templates/service.java";
|
||||
// private final static String SERVICE_IMPL = "templates/serviceImpl.java";
|
||||
private final static String CONTROLLER = "templates/controller.java";
|
||||
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
YamlUtils yamlUtils = new YamlUtils();
|
||||
DataSource dataSource = yamlUtils.readDefaultYaml();
|
||||
|
||||
String projectPath = System.getProperty("user.dir") + "/" + MODULE_NAME;// 获取项目根目录
|
||||
|
||||
BeetlTemplateEngine beetlTemplateEngine = new BeetlTemplateEngine();
|
||||
|
||||
FastAutoGenerator.create(dataSource.getUrl(), dataSource.getUsername(), dataSource.getPassword())
|
||||
.templateEngine(beetlTemplateEngine)
|
||||
.globalConfig(builder -> {
|
||||
builder.author(AUTHOR) // 设置作者
|
||||
.outputDir(projectPath + "/src/main/java"); // 指定输出目录
|
||||
})
|
||||
.packageConfig(builder -> {
|
||||
builder.parent(PACKAGE_PREFIX) // 设置父包模块名
|
||||
.pathInfo(Collections.singletonMap(OutputFile.xml, projectPath + "/src/main/resources/mapper")); // 设置mapperXml生成路径
|
||||
})
|
||||
.strategyConfig(builder -> {
|
||||
builder.addInclude(TABLE_ARRAY) // 设置需要生成的表名
|
||||
.addTablePrefix(TABLE_PREFIX) // 设置过滤表前缀
|
||||
.entityBuilder().enableLombok()
|
||||
.serviceBuilder().formatServiceFileName("%sService")
|
||||
.controllerBuilder().enableRestStyle();
|
||||
})
|
||||
.execute();
|
||||
|
||||
logger.debug("执行生成");
|
||||
// 执行生成
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.demo.util;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Djh
|
||||
*/
|
||||
@Data
|
||||
public class TableFieldEntity {
|
||||
|
||||
private String name;
|
||||
|
||||
private String type;
|
||||
}
|
||||
33
code-generator/src/main/java/com/demo/util/TableReader.java
Normal file
33
code-generator/src/main/java/com/demo/util/TableReader.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.demo.util;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class TableReader {
|
||||
|
||||
private String url;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
private String driverClassName;
|
||||
|
||||
public Map<String, Map<String, TableFieldEntity>> readTable(String... tableNames) {
|
||||
|
||||
Map<String, Map<String, TableFieldEntity>> result = new HashMap<>();
|
||||
Map<String, TableFieldEntity> tableMap = new HashMap<>();
|
||||
for (String tableName : tableNames) {
|
||||
tableMap = new HashMap<>();
|
||||
result.put(tableName, tableMap);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
36
code-generator/src/main/java/com/demo/util/YamlUtils.java
Normal file
36
code-generator/src/main/java/com/demo/util/YamlUtils.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.demo.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.demo.DataSource;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Djh
|
||||
*/
|
||||
public class YamlUtils {
|
||||
|
||||
public DataSource readDefaultYaml() throws FileNotFoundException {
|
||||
Yaml yaml = new Yaml();
|
||||
|
||||
URL url = this.getClass().getClassLoader().getResource("application.yml");
|
||||
if (url != null) {
|
||||
//获取test.yaml文件中的配置数据,然后转换为obj,
|
||||
//也可以将值转换为Map
|
||||
Map<String, Object> map = yaml.load(new FileInputStream(url.getFile()));
|
||||
System.out.println(map);
|
||||
return JSONObject.parseObject(JSONObject.toJSONString(map), DataSource.class);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
YamlUtils yamlUtils = new YamlUtils();
|
||||
yamlUtils.readDefaultYaml();
|
||||
}
|
||||
}
|
||||
4
code-generator/src/main/resources/application.yml
Normal file
4
code-generator/src/main/resources/application.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
239
code-generator/src/main/resources/logback.xml
Normal file
239
code-generator/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,239 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- 在此未说明属性为非必须的,那就表示属性必须设置 -->
|
||||
<!-- *****************最小配置文件结构介绍******************************* -->
|
||||
<!--
|
||||
<configuration>
|
||||
<appender></appender> //存在1或多个,功能指定记录输出目的地
|
||||
<root></root> //最多存在一个,根logger
|
||||
<logger><logger> //存在1或多个,普通logger
|
||||
</configuration>
|
||||
-->
|
||||
<!-- *************************各个标签详细介绍********************************** -->
|
||||
|
||||
<!-- debug(非必须)属性:true表示输出logback内部的日志信息(不影响配置和级别) ;
|
||||
scan(非必须)属性:默认为false,true表示扫描配置文件的变化并自动重新配置,默认每隔1分钟扫描一次;
|
||||
scanPeriod(非必须)属性:搭配scan属性使用,设置扫描的间隔时间
|
||||
-->
|
||||
<configuration debug="true" scan="true" scanPeriod="1 seconds">
|
||||
<!-- 用于指定logger上下文名称,默认为default -->
|
||||
<contextName>logback</contextName>
|
||||
|
||||
<!-- 设置变量FILE_PATH,用于指定名为FILE的appender的目的文件存放的目录 -->
|
||||
<property name="FILE_PATH" value="D:/"></property>
|
||||
<!--
|
||||
**********************配置TurboFilter类型的过滤器**********************************
|
||||
TurboFilter类型过滤器有三种:这里使用的是DuplicateMessageFilter
|
||||
子标签<cacheSize>:表示内部缓存对旧消息引用的个数上限
|
||||
子标签<allowedRepetitions>:表示允许消息出现的重复次数上限,超过次数上限的记录请求将被丢弃
|
||||
-->
|
||||
<!-- <!– 使用自定义的TurboFilter –>-->
|
||||
<!-- <turboFilter class="logback.SampleTurboFilter">-->
|
||||
<!-- </turboFilter>-->
|
||||
<!-- <!– 使用DuplicateTurboFilter –>-->
|
||||
<!-- <turboFilter class="ch.qos.logback.classic.turbo.DuplicateMessageFilter">-->
|
||||
<!-- <allowedRepetitions>1</allowedRepetitions>-->
|
||||
<!-- <cacheSize>20</cacheSize>-->
|
||||
<!-- </turboFilter>-->
|
||||
|
||||
<!-- ************************常用的Appender************************************** -->
|
||||
<!--
|
||||
<appender>标签包含2个属性:name、class
|
||||
name属性:指定appender名称;class属性:指定目的地类型 (比如ConsoleAppender、FileAppender等)
|
||||
class属性的值决定了<appender>标签包含的子标签的种类。
|
||||
-->
|
||||
<!-- 该appender的功能是将记录信息以特定格式写到控制台 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!--encoder:将事件转换为字符串
|
||||
默认配置为PatternLayoutEncoder类
|
||||
encoder用于替代Layout,encoder扩展了Layout功能
|
||||
Layout功能:只负责把事件转换为字符串,但是不能指定何时将记录写入到指定目的地
|
||||
encoder功能:即负责把事件转换为字符串,也可以指定何时将记录写入到指定目的地
|
||||
-->
|
||||
<encoder>
|
||||
<!-- 指定输出格式
|
||||
%d{} :表示时间
|
||||
%thread:请求记录所在的线程名
|
||||
%-5level:用5位显示请求级别
|
||||
%logger{36}:输出logger名,{36}表示logger名最大占用的字符位数,{0}表示最简短logger名(不包含包名)。
|
||||
-->
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0} -%msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- 该appender的功能是将记录信息以特定格式写到文件 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<!-- $使用变量FILE_PATH的格式,类似Linux中使用的格式:${FILE_PATH} -->
|
||||
<file>${FILE_PATH}/file.log</file>
|
||||
<encoder>
|
||||
<!-- 指定输出格式 -->
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0} -%msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--
|
||||
***********************以最小窗体为指定的滚动规则的appender*****************************
|
||||
RollingFileAppender类型的appender中必须包含4个子标签:<file>、<rollingPolicy>、<triggerPolicy>、<encoder>
|
||||
<rollingPolicy>标签用于指定滚动规则,该标签有一个属性class:用于指定实现具体的滚动规则的类。
|
||||
<triggerPolicy>标签用于指定发生滚动的条件,该标签有一个属性class:用于指定具体滚动条件的类。
|
||||
<rollingPolicy>和<triggerPolicy>中具体包含哪些子标签是由class属性指定的类来决定的,因为不同的类有不同的参数,从而需要不同的标签来传参
|
||||
-->
|
||||
<!-- 该appender的功能是将记录信息以特定格式写到文件,当文件达到20MB时,创建以特定规则新的 文件,之后的记录会写到新文件-->
|
||||
<appender name="rollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 在第一次触发滚动之前记录将会写到该文件中 -->
|
||||
<file>${FILE_PATH}/rolling.log</file>
|
||||
<!--
|
||||
前提条件:class的值为FixedWindowRollingPolicy,表示以最小窗体为指定的滚动规则
|
||||
RollingPolicy标签必须子标签:<fileNamePattern>、<minIndex>、<maxIndex>
|
||||
<fileNamePattern>:表示滚动条件达到后,创建文件名的规则,其中"%i"代表数字1~5。第一次触发条件,创建文件rolling1.log,并且记录开始写到这个文件中
|
||||
<minIndex>与<maxIndex>共同决定了文件的个数
|
||||
-->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<fileNamePattern>${FILE_PATH}/rolling%i.log</fileNamePattern>
|
||||
<minIndex>1</minIndex>
|
||||
<maxIndex>5</maxIndex>
|
||||
</rollingPolicy>
|
||||
<!--
|
||||
<triggeringPolicy>功能:用于限制文件大小
|
||||
前提条件:class的值为SizeBasedTriggeringPolicy,表示以文件大小为触发条件
|
||||
只有一个子标签<maxFileSize>用于指定触发条件
|
||||
-->
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<maxFileSize>20MB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0} -%msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--
|
||||
*****************************根据时间滚动 为滚动规则和条件的appender(最常用)***********************
|
||||
-->
|
||||
<!-- 该appender的功能:将记录信息以特定格式写到文件,当文件达到20MB时,创建以时间为特定规则新的 文件,之后的记录会写到新文件,
|
||||
文件个数最多维持10个,文件达到10个 后删除旧的文件-->
|
||||
<appender name="time_file" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- TimeBasedRollingPolicy实现了RollingPolicy与TriggeringPolicy,
|
||||
因此只需要<rollingPolicy>标签,不需要<TriggeringPolicy>标签
|
||||
<rollingPolicy>标签有两个子标签:<fileNamePattern>、<maxHistory>
|
||||
<fileNamePattern>:用于指定文件名命名规则
|
||||
<maxHistory>:保留文件的个数,超过了就删除创建时间最久的文件
|
||||
-->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 文件名 -->
|
||||
<fileNamePattern>${FILE_PATH}/java_log/test%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
|
||||
<maxHistory>10</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0} -%msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--
|
||||
***********************常规级别过滤器的使用****************************************
|
||||
本配置功能:过滤并接受请求级别为debug的请求,对于其他级别请求一律丢弃。
|
||||
-->
|
||||
<appender name="level_console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>debug</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0} -%msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--
|
||||
***********************常规临界值滤器的使用****************************************
|
||||
本配置功能:请求级别高于或等于info的请求响应NEUTRAL(进入下一个环节),低于info的级别请求响应DENY(表示丢弃)。
|
||||
-->
|
||||
<appender name="threshold_console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0} -%msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- appender的目的地为mysql数据库 -->
|
||||
<!-- <appender name="jdbc" class="ch.qos.logback.classic.db.DBAppender">-->
|
||||
<!-- <!– 这里只使用jdbc中的DriverManager获得连接,不使用任何数据源 –>-->
|
||||
<!-- <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">-->
|
||||
<!-- <driverClass>com.mysql.jdbc.Driver</driverClass>-->
|
||||
<!-- <url>jdbc:mysql://localhost:3306/logback?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC</url>-->
|
||||
<!-- <user>root</user>-->
|
||||
<!-- <password>Zp970321</password>-->
|
||||
<!-- </connectionSource>-->
|
||||
<!-- </appender>-->
|
||||
<!-- ******以下DBAppender类型的appender的目的地为mysql数据库******** -->
|
||||
|
||||
<!-- <appender name="c3p0_datasource" class="ch.qos.logback.classic.db.DBAppender">-->
|
||||
<!-- <!– 这里使用DataSource获得连接–>-->
|
||||
<!-- <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">-->
|
||||
<!-- <!– 实现DataSource的数据库连接池有很多,比如DBCP、c3p0、Druid等-->
|
||||
<!-- 这里使用的是c3p0-->
|
||||
<!-- –>-->
|
||||
<!-- <dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource">-->
|
||||
<!-- <user>root</user>-->
|
||||
<!-- <password>Zp970321</password>-->
|
||||
<!-- <driverClass>com.mysql.jdbc.Driver</driverClass>-->
|
||||
<!-- <jdbcUrl>jdbc:mysql://localhost:3306/logback?useUnicode=true&characterEncoding=utf8</jdbcUrl>-->
|
||||
<!-- </dataSource>-->
|
||||
<!-- </connectionSource>-->
|
||||
<!-- </appender>-->
|
||||
<!-- <appender name="Druid_datasource" class="ch.qos.logback.classic.db.DBAppender">-->
|
||||
<!-- <!– 这里使用DataSource获得连接–>-->
|
||||
<!-- <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">-->
|
||||
<!-- <!– 实现DataSource的数据库连接池有很多,比如DBCP、c3p0、Druid等-->
|
||||
<!-- 这里使用的是Druid-->
|
||||
<!-- –>-->
|
||||
<!-- <dataSource class="com.alibaba.druid.pool.DruidDataSource">-->
|
||||
<!-- <username>root</username>-->
|
||||
<!-- <password>Zp970321</password>-->
|
||||
<!-- <driverClassName>com.mysql.jdbc.Driver</driverClassName>-->
|
||||
<!-- <url>jdbc:mysql://localhost:3306/logback?useUnicode=true&characterEncoding=utf8</url>-->
|
||||
<!-- </dataSource>-->
|
||||
<!-- </connectionSource>-->
|
||||
<!-- </appender>-->
|
||||
<!-- <appender name="dbcp_datasource" class="ch.qos.logback.classic.db.DBAppender">-->
|
||||
<!-- <!– 这里使用DataSource获得连接–>-->
|
||||
<!-- <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">-->
|
||||
<!-- <!– 实现DataSource的数据库连接池有很多,比如DBCP、c3p0、Druid等-->
|
||||
<!-- 这里使用的是dbcp-->
|
||||
<!-- –>-->
|
||||
<!-- <dataSource class="org.apache.commons.dbcp.BasicDataSource">-->
|
||||
<!-- <username>root</username>-->
|
||||
<!-- <password>Zp970321</password>-->
|
||||
<!-- <driverClassName>com.mysql.jdbc.Driver</driverClassName>-->
|
||||
<!-- <url>jdbc:mysql://localhost:3306/logback?useUnicode=true&characterEncoding=utf8</url>-->
|
||||
<!-- </dataSource>-->
|
||||
<!-- </connectionSource>-->
|
||||
<!-- </appender>-->
|
||||
<!-- level属性:指定根logger的分配级别 -->
|
||||
<root level="debug">
|
||||
<!-- ref属性:指定根logger关联的appender -->
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
<!-- name:指定logger名称;level:指定logger的分配级别;additivity(非必须,默认为true):设置appender叠加性 -->
|
||||
<logger name="demo" level="debug" additivity="false">
|
||||
<appender-ref ref="FILE"></appender-ref>
|
||||
</logger>
|
||||
<logger name="demo2" level="debug">
|
||||
<appender-ref ref="rollingFile"></appender-ref>
|
||||
</logger>
|
||||
<logger name="demo3" level="debug">
|
||||
<appender-ref ref="time_file"></appender-ref>
|
||||
</logger>
|
||||
<logger name="demo4" level="debug" additivity="false">
|
||||
<appender-ref ref="level_console"></appender-ref>
|
||||
</logger>
|
||||
<logger name="demo5" level="debug" additivity="false">
|
||||
<appender-ref ref="threshold_console"></appender-ref>
|
||||
</logger>
|
||||
<!-- <logger name="demo6" level="debug" additivity="false">-->
|
||||
<!-- <appender-ref ref="jdbc"></appender-ref>-->
|
||||
<!-- </logger>-->
|
||||
<!-- <logger name="demo7" level="debug" additivity="false">-->
|
||||
<!-- <appender-ref ref="c3p0_datasource"></appender-ref>-->
|
||||
<!-- </logger>-->
|
||||
<!-- <logger name="demo8" level="debug" additivity="false">-->
|
||||
<!-- <appender-ref ref="Druid_datasource"></appender-ref>-->
|
||||
<!-- </logger>-->
|
||||
<!-- <logger name="demo9" level="debug" additivity="false">-->
|
||||
<!-- <appender-ref ref="dbcp_datasource"></appender-ref>-->
|
||||
<!-- </logger>-->
|
||||
</configuration>
|
||||
6
pluss-api-page/Dockerfile
Normal file
6
pluss-api-page/Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM openjdk:8-jdk-alpine
|
||||
VOLUME /tmp
|
||||
EXPOSE 7004
|
||||
ARG JAR_FILE
|
||||
ADD ${JAR_FILE} app.jar
|
||||
ENTRYPOINT ["java","-jar","/app.jar", "--spring.profiles.active=dev"]
|
||||
37
pluss-api-page/autoStart.sh
Normal file
37
pluss-api-page/autoStart.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
while true
|
||||
do
|
||||
ONE='one'
|
||||
ONE_FILE='./one/syb.jar'
|
||||
ONE_TIME=$(stat -c %Y $ONE_FILE)
|
||||
|
||||
ANOTHER='another'
|
||||
ANOTHER_FILE='./another/syb.jar'
|
||||
ANOTHER_TIME=$(stat -c %Y $ANOTHER_FILE)
|
||||
|
||||
if [ "$ONE_TIME" -gt "$ANOTHER_TIME" ]
|
||||
then
|
||||
FILE_NAME="$ONE_FILE"
|
||||
FOLD="$ONE"
|
||||
else
|
||||
FILE_NAME="$ANOTHER_FILE"
|
||||
FOLD="$ANOTHER"
|
||||
fi
|
||||
|
||||
echo "最新的文件是${FILE_NAME}"
|
||||
echo "最新的文件夹是${FOLD}"
|
||||
|
||||
# 先操作7004的端口
|
||||
proc70041=$(pgrep -f "${ONE_FILE} --spring.profiles.active=prod$")
|
||||
proc70042=$(pgrep -f "${ANOTHER_FILE} --spring.profiles.active=prod$")
|
||||
if [ "$proc70041"x == "x" ] && [ "$proc70042"x == "x" ] ; then
|
||||
./apiStart7004.sh $FOLD
|
||||
fi
|
||||
|
||||
# 再操作7014
|
||||
proc70141=$(pgrep -f "${ONE_FILE} --spring.profiles.active=prod --server.port=7014$")
|
||||
proc70142=$(pgrep -f "${ANOTHER_FILE} --spring.profiles.active=prod --server.port=7014$")
|
||||
if [ "$proc70141"x == "x" ] && [ "$proc70142"x == "x" ] ; then
|
||||
./apiStart7014.sh $FOLD
|
||||
fi
|
||||
sleep 30
|
||||
done
|
||||
187
pluss-api-page/pom.xml
Normal file
187
pluss-api-page/pom.xml
Normal file
@@ -0,0 +1,187 @@
|
||||
<?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>pluss-parent</artifactId>
|
||||
<groupId>cn.pluss.platform</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>pluss-api-page</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<docker.image.prefix>syb</docker.image.prefix>
|
||||
<log4j.version>2.5</log4j.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/com.alipay.sdk/alipay-sdk-java -->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.7.1.ALL</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.pluss.platform</groupId>
|
||||
<artifactId>pluss-common-bundle</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.pluss.platform</groupId>
|
||||
<artifactId>pluss-service-bundle</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--腾讯云 -->
|
||||
<dependency>
|
||||
<groupId>com.github.tencentyun</groupId>
|
||||
<artifactId>tls-sig-api</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 第三方推送消息 -->
|
||||
<dependency>
|
||||
<groupId>cn.jpush.api</groupId>
|
||||
<artifactId>jpush-client</artifactId>
|
||||
<version>3.4.6</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.14</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.hannesdorfmann</groupId>
|
||||
<artifactId>httpkit</artifactId>
|
||||
<version>1.5.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||
<version>1.9.6</version>
|
||||
</dependency>
|
||||
|
||||
<!--jsp支持 start -->
|
||||
|
||||
<!-- html 支持 -->
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>-->
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>czg</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>1.4.2.RELEASE</version>
|
||||
<!--这里写上main方法所在类的路径-->
|
||||
<configuration>
|
||||
<mainClass>cn.pluss.platform.ApiApplication</mainClass>
|
||||
<outputDirectory>./</outputDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>cn.smallbun.screw</groupId>-->
|
||||
<!-- <artifactId>screw-maven-plugin</artifactId>-->
|
||||
<!-- <version>1.0.3</version>-->
|
||||
<!-- <dependencies>-->
|
||||
<!-- <!– HikariCP –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.zaxxer</groupId>-->
|
||||
<!-- <artifactId>HikariCP</artifactId>-->
|
||||
<!-- <version>3.4.5</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <!–mysql driver–>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>mysql</groupId>-->
|
||||
<!-- <artifactId>mysql-connector-java</artifactId>-->
|
||||
<!-- <version>8.0.20</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- </dependencies>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <!–username–>-->
|
||||
<!-- <username>root</username>-->
|
||||
<!-- <!–password–>-->
|
||||
<!-- <password></password>-->
|
||||
<!-- <!–driver–>-->
|
||||
<!-- <driverClassName>com.mysql.cj.jdbc.Driver</driverClassName>-->
|
||||
<!-- <jdbcUrl>jdbc:mysql://localhost:3306/shouyinbei?useUnicode=truecharacterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8</jdbcUrl>-->
|
||||
<!-- <!–生成文件类型–>-->
|
||||
<!-- <fileType>HTML</fileType>-->
|
||||
<!-- <!–打开文件输出目录–>-->
|
||||
<!-- <openOutputDir>true</openOutputDir>-->
|
||||
<!-- <!–生成模板–>-->
|
||||
<!-- <produceType>freemarker</produceType>-->
|
||||
<!-- <!–文档名称 为空时:将采用[数据库名称-描述-版本号]作为文档名称–>-->
|
||||
<!-- <!– <docName>测试文档名称</docName>–>-->
|
||||
<!-- <!–描述–>-->
|
||||
<!-- <description>数据库文档生成</description>-->
|
||||
<!-- <!–版本–>-->
|
||||
<!-- <version>${project.version}</version>-->
|
||||
<!-- <!–标题–>-->
|
||||
<!-- <title>fire数据库文档</title>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <phase>compile</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>run</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.pluss.platform;
|
||||
|
||||
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.web.context.request.RequestContextListener;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
@Slf4j
|
||||
@MapperScan("cn.pluss.platform.mapper")
|
||||
@SpringBootApplication
|
||||
@EnableSwagger2
|
||||
@EnableAspectJAutoProxy(proxyTargetClass = true)
|
||||
@EnableSwaggerBootstrapUI
|
||||
public class ApiApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ApiApplication.class, args);
|
||||
log.info("Api Service Start Success");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RequestContextListener requestContextListener() {
|
||||
return new RequestContextListener();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.pluss.platform.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 标注的方法方法或者类下的接口需要完成实名认证才可调用
|
||||
*
|
||||
* @author DJH
|
||||
*/
|
||||
@Inherited
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Cert {
|
||||
|
||||
boolean check() default true;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.pluss.platform.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface OpLog {
|
||||
|
||||
/**
|
||||
* 操作日志code
|
||||
* @return 操作code
|
||||
*/
|
||||
String opCode() default "";
|
||||
|
||||
/**
|
||||
* 操作日志-详情
|
||||
* @return 操作详情
|
||||
*/
|
||||
String opDetail() default "";
|
||||
|
||||
/**
|
||||
* 操作日志名称
|
||||
* @return 操作名称
|
||||
*/
|
||||
String opName() default "";
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.pluss.platform.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Inherited
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ThirdAuth {
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.pluss.platform.aop;
|
||||
|
||||
import cn.pluss.platform.annotation.Cert;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 因为登录注册,以及忘记密码的时候,没有token,所以这三个操作的操作日志不通过注解实现
|
||||
* 保存APP操作日志,取请求头中的用户信息
|
||||
*/
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@Component
|
||||
public class CertAspect {
|
||||
|
||||
@Autowired
|
||||
private UserAppService userAppService;
|
||||
|
||||
// 定义切点
|
||||
// 记录后台接口的操作记录
|
||||
// 拦截Controller所在的包
|
||||
@Pointcut("(@within(cn.pluss.platform.annotation.Cert) && execution(* cn.pluss.platform.controller..*(..)))" +
|
||||
"|| (execution(* cn.pluss.platform.controller..*(..)) && @annotation(cn.pluss.platform.annotation.Cert))")
|
||||
public void executionService2() {
|
||||
}
|
||||
|
||||
|
||||
@Before(value = "executionService2()")
|
||||
public void after(JoinPoint point) {
|
||||
|
||||
MethodSignature signature = (MethodSignature) point.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
Class<?> declaringType = signature.getDeclaringType();
|
||||
Cert classCertAnno = declaringType.getAnnotation(Cert.class);
|
||||
Cert methodCertAnno = method.getAnnotation(Cert.class);
|
||||
|
||||
boolean classFlag = classCertAnno == null || classCertAnno.check();
|
||||
boolean annoExistFlag = classCertAnno != null || methodCertAnno != null;
|
||||
boolean methodFlag = methodCertAnno == null || methodCertAnno.check();
|
||||
|
||||
if (classFlag && methodFlag && annoExistFlag) {
|
||||
final UserApp userApp = userAppService.queryUserAppByToken();
|
||||
|
||||
if (!Objects.equals(3, userApp.getBankStatus())) {
|
||||
throw new MsgException("请先在APP中完成实名认证");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package cn.pluss.platform.aop;
|
||||
|
||||
import cn.pluss.platform.annotation.OpLog;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.entity.OperationRecord;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.operationRecord.OperationRecordService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* 因为登录注册,以及忘记密码的时候,没有token,所以这三个操作的操作日志不通过注解实现
|
||||
* 保存APP操作日志,取请求头中的用户信息
|
||||
*/
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@Component
|
||||
public class OpLogAspect {
|
||||
|
||||
@Autowired
|
||||
private OperationRecordService opRecordService;
|
||||
|
||||
@Autowired
|
||||
private UserAppService userAppService;
|
||||
|
||||
// 定义切点
|
||||
// 记录后台接口的操作记录
|
||||
// 拦截Controller所在的包
|
||||
@Pointcut("execution(* cn.pluss.platform.controller..*.*(..)) && @annotation(cn.pluss.platform.annotation.OpLog))")
|
||||
public void executionService() {
|
||||
}
|
||||
|
||||
|
||||
@AfterReturning(returning="rvt", value = "executionService()")
|
||||
public void after(JoinPoint point, Object rvt) {
|
||||
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request;
|
||||
if (attributes != null) {
|
||||
request = ((ServletRequestAttributes) attributes).getRequest();
|
||||
} else {
|
||||
log.warn("未获取到request");
|
||||
return;
|
||||
}
|
||||
|
||||
MethodSignature signature = (MethodSignature) point.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
OpLog annotation = method.getAnnotation(OpLog.class);
|
||||
|
||||
String token = request.getHeader("token");
|
||||
String myLoginName = request.getHeader("myLoginName");
|
||||
|
||||
UserApp ua;
|
||||
if (token == null || myLoginName == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
LambdaQueryWrapper<UserApp> qWrapper = Wrappers.lambdaQuery();
|
||||
qWrapper.eq(UserApp::getToken, token);
|
||||
ua = userAppService.getOne(qWrapper);
|
||||
|
||||
OperationRecord opRecord = new OperationRecord();
|
||||
opRecord.setDictValue(annotation.opCode());
|
||||
opRecord.setRemark(annotation.opDetail());
|
||||
opRecord.setOperator(ua.getUserId() + "");
|
||||
opRecord.setUserId(ua.getUserId() + "");
|
||||
|
||||
if (rvt instanceof Result) {
|
||||
Object data = ((Result) rvt).getData();
|
||||
try {
|
||||
JSONObject jsonObject = (JSONObject) JSON.toJSON(data);
|
||||
String orderNumber = jsonObject.getString("orderNumber");
|
||||
JSONObject extra = new JSONObject();
|
||||
extra.put("orderNumber", orderNumber);
|
||||
opRecord.setExtension(extra);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
opRecordService.save(opRecord);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package cn.pluss.platform.aop;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class TrimAspect {
|
||||
|
||||
private static final String PATTERN_COMPILE = "[\\s\\t\\n\\r]*";
|
||||
|
||||
// 定义切点
|
||||
// 记录后台接口的操作记录
|
||||
// 拦截Controller所在的包
|
||||
@Pointcut("execution(* cn.pluss.platform.controller..*.*(..))")
|
||||
public void executionService() {
|
||||
}
|
||||
|
||||
@Around("executionService()")
|
||||
public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
|
||||
// 数据校验注解优先于此AOP执行
|
||||
//重点 这里就是获取@RequestBody参数的关键 调试的情况下 可以看到arr变量已经获取到了请求的参数
|
||||
Object[] arr = pjp.getArgs();
|
||||
for (int i = 0; i < arr.length; ++i) {
|
||||
if (arr[i] instanceof HttpServletRequest) {
|
||||
// 特殊处理
|
||||
HttpServletRequest request = (HttpServletRequest) arr[i];
|
||||
Map<String, String[]> m = request.getParameterMap();
|
||||
Map<String, String[]> newM = new HashMap<>();
|
||||
if (m != null) {
|
||||
for (Map.Entry<String, String[]> entry : m.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String[] value = entry.getValue();
|
||||
if (value == null) {
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < value.length; ++j) {
|
||||
String temp = "";
|
||||
if (value[i] != null) {
|
||||
temp = value[i].replaceAll(PATTERN_COMPILE, "");
|
||||
}
|
||||
value[i] = temp.length() == 0 ? null : temp;
|
||||
}
|
||||
newM.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
request.setAttribute("The-result-after-removing-the-space", newM);
|
||||
arr[i] = request;
|
||||
} else {
|
||||
if (arr[i] != null) {
|
||||
// 考虑到类里面还有类 这里采用递归的方式处理
|
||||
arr[i] = dfs(arr[i].getClass(), arr[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 把 arr 放回去即可改变参数的值
|
||||
return pjp.proceed(arr);
|
||||
}
|
||||
|
||||
private Object dfs(Class<?> aClass, Object object) throws IllegalAccessException {
|
||||
if (object == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 如果是Java的基本数据类型就不需要继续递归了
|
||||
if (isPrimitive(aClass)) {
|
||||
if (!(object instanceof String)) {
|
||||
return object;
|
||||
}
|
||||
|
||||
try {
|
||||
DateUtil.parseDate(((String) object));
|
||||
return object;
|
||||
} catch (Exception e) {
|
||||
// 非时间字符串
|
||||
String temp = ((String) object).replaceAll(PATTERN_COMPILE, "");
|
||||
return temp.length() == 0 ? null : temp;
|
||||
}
|
||||
}
|
||||
|
||||
// 返回类所有字段
|
||||
// 注意: 会返回静态字段
|
||||
// 不要在Dto、Vo定义静态属性
|
||||
// 没有获取父类属性 可通过 “object.getClass().getSuperclass()” 获取
|
||||
for (Field item : object.getClass().getDeclaredFields()) {
|
||||
// static 和 final 修饰的字段忽略
|
||||
if (Modifier.isStatic(item.getModifiers())) {
|
||||
continue;
|
||||
}
|
||||
// 设置可见性
|
||||
item.setAccessible(true);
|
||||
// 递归处理
|
||||
item.set(object, dfs(item.getType(), item.get(object)));
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
// 判断是否为Java的基本类型或包装类
|
||||
// java.lang.* java.util.* 存放着Java的基本数据类型的包装类和集合类
|
||||
// 基本数据类型和包装类是JVM虚拟机运行需要的类,已嵌入到JVM内核
|
||||
// 不需要继承ClassLoader 用户自定义的需要
|
||||
private boolean isPrimitive(Class<?> aClass) {
|
||||
return aClass != null && aClass.getClassLoader() == null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.pluss.platform.configurer;
|
||||
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Parameter;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Configuration
|
||||
public class Swagger2Configurer implements WebMvcConfigurer {
|
||||
|
||||
@Value("${swagger.production}")
|
||||
private boolean isProd;
|
||||
|
||||
/**
|
||||
* 这个地方要重新注入一下资源文件,不然不会注入资源的,也没有注入requestHandlerMappping,相当于xml配置的
|
||||
* <!--swagger资源配置-->
|
||||
* <mvc:resources location="classpath:/META-INF/resources/" mapping="swagger-ui.html"/>
|
||||
* <mvc:resources location="classpath:/META-INF/resources/webjars/" mapping="/webjars/**"/>
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
List<Parameter> pars = new ArrayList<Parameter>();
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.enable(!isProd)
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage(ProjectConstant.CONTROLLER_PACKAGE))
|
||||
.paths(PathSelectors.any())
|
||||
.build().globalOperationParameters(pars);
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("API文档展示")
|
||||
.description("通过直接且美观的方式来查看和调试API")
|
||||
.version("1.0")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package cn.pluss.platform.configurer;
|
||||
|
||||
import cn.pluss.platform.configurer.extend.CurrentUserMethodArgumentResolver;
|
||||
import cn.pluss.platform.configurer.extend.FastJsonHttpMessageConverterEx;
|
||||
import cn.pluss.platform.interceptor.RequestInfoInterceptor;
|
||||
import cn.pluss.platform.interceptor.TokenRegistryInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Spring MVC 配置
|
||||
*/
|
||||
@Configuration
|
||||
public class WebConfigurer implements WebMvcConfigurer {
|
||||
|
||||
|
||||
@Override
|
||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
argumentResolvers.add(currentUserMethodArgumentResolver());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
//和页面有关的静态目录都放在项目的static目录下
|
||||
// registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
|
||||
//上传的图片在D盘下的OTA目录下,访问路径如:http://localhost:8081/OTA/d3cf0281-bb7f-40e0-ab77-406db95ccf2c.jpg
|
||||
//其中OTA表示访问的前缀。"file:D:/OTA/"是文件真实的存储路径
|
||||
registry.addResourceHandler("/Pictures/**").addResourceLocations("file:D:/Pictures/");
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用阿里 FastJson 作为JSON MessageConverter
|
||||
* @param converters
|
||||
*/
|
||||
@Override
|
||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
converters.clear();
|
||||
converters.add(fastJsonHttpMessageConverterEx());
|
||||
}
|
||||
|
||||
/**
|
||||
* 解决跨域问题
|
||||
* @param registry
|
||||
*/
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**").allowedMethods("*").allowedOrigins("*").allowedHeaders("*");
|
||||
}
|
||||
|
||||
// 添加拦截器
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 接口签名认证拦截器,该签名认证比较简单,实际项目中可以使用Json Web Token或其他更好的方式替代。
|
||||
List<String> excludes = new ArrayList<>();
|
||||
excludes.add("/webjars/**");
|
||||
excludes.add("/doc.html");
|
||||
excludes.add("/swagger-resources");
|
||||
excludes.add("/auditCallback/**");
|
||||
excludes.add("/wxCertCallback/**");
|
||||
excludes.add("/Pictures/**");
|
||||
excludes.add("/druid/**");
|
||||
excludes.add("/callback/**");
|
||||
registry.addInterceptor(new RequestInfoInterceptor());
|
||||
|
||||
registry.addInterceptor(tokenRegistryInterceptor()).excludePathPatterns(excludes);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TokenRegistryInterceptor tokenRegistryInterceptor() {
|
||||
return new TokenRegistryInterceptor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver() {
|
||||
return new CurrentUserMethodArgumentResolver();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FastJsonHttpMessageConverterEx fastJsonHttpMessageConverterEx() {
|
||||
return new FastJsonHttpMessageConverterEx();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.pluss.platform.configurer.extend;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultCode;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerExceptionResolver;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public class AllExceptionResolver implements HandlerExceptionResolver {
|
||||
private final Logger logger = LoggerFactory.getLogger(AllExceptionResolver.class);
|
||||
|
||||
@Override
|
||||
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception e) {
|
||||
Result result = new Result();
|
||||
// 业务失败的异常,如“账号或密码错误”
|
||||
if (e instanceof NoHandlerFoundException) {
|
||||
result.setCode(ResultCode.NOT_FOUND).setMessage("接口 [" + request.getRequestURI() + "] 不存在");
|
||||
} else if (e instanceof ServletException) {
|
||||
result.setCode(ResultCode.FAIL).setMessage(e.getMessage());
|
||||
} else {
|
||||
result.setCode(ResultCode.INTERNAL_SERVER_ERROR).setMessage("接口 [" + request.getRequestURI() + "] 内部错误,请联系管理员");
|
||||
String message;
|
||||
if (handler instanceof HandlerMethod) {
|
||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||
message = String.format("接口 [%s] 出现异常,方法:%s.%s,异常摘要:%s", request.getRequestURI(),handlerMethod.getBean().getClass().getName(), handlerMethod.getMethod().getName(),e.getMessage());
|
||||
} else {
|
||||
message = e.getMessage();
|
||||
}
|
||||
logger.error(message, e);
|
||||
}
|
||||
responseResult(response, result);
|
||||
return new ModelAndView();
|
||||
}
|
||||
|
||||
private void responseResult(HttpServletResponse response, Result result) {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-type", "application/json;charset=UTF-8");
|
||||
response.setStatus(200);
|
||||
try {
|
||||
response.getWriter().write(JSON.toJSONString(result));
|
||||
} catch (IOException ex) {
|
||||
logger.error(ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.pluss.platform.configurer.extend;
|
||||
|
||||
import cn.pluss.platform.vo.BaseUser;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
|
||||
|
||||
public class CurrentUserMethodArgumentResolver implements HandlerMethodArgumentResolver{
|
||||
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
|
||||
BaseUser user = (BaseUser) webRequest.getAttribute("currentUser", RequestAttributes.SCOPE_REQUEST);
|
||||
if (user == null) {
|
||||
throw new Exception("获取用户信息失败");
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return parameter.getParameterType().isAssignableFrom(BaseUser.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package cn.pluss.platform.configurer.extend;
|
||||
|
||||
import com.alibaba.fastjson.parser.ParserConfig;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
|
||||
public class FastJsonHttpMessageConverterEx extends FastJsonHttpMessageConverter {
|
||||
private static final SerializerFeature[] features = {
|
||||
// 输出空置字段
|
||||
SerializerFeature.WriteMapNullValue,
|
||||
// list字段如果为null,输出为[],而不是null
|
||||
SerializerFeature.WriteNullListAsEmpty,
|
||||
// 数值字段如果为null,输出为0,而不是null
|
||||
// SerializerFeature.WriteNullNumberAsZero,
|
||||
// SerializerFeature.WriteNullBooleanAsFalse,
|
||||
// Boolean字段如果为null,输出为false,而不是null
|
||||
// 字符类型字段如果为null,输出为"",而不是null
|
||||
SerializerFeature.WriteNullStringAsEmpty,
|
||||
// 关闭引用检测,解决$ref问题
|
||||
SerializerFeature.DisableCircularReferenceDetect
|
||||
};
|
||||
|
||||
public FastJsonHttpMessageConverterEx() {
|
||||
FastJsonConfig fastJsonConfig = getFastJsonConfig();
|
||||
fastJsonConfig.setSerializerFeatures(features);
|
||||
fastJsonConfig.setFeatures();
|
||||
fastJsonConfig.setSerializeFilters();
|
||||
setDefaultCharset(StandardCharsets.UTF_8);
|
||||
setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||
|
||||
ParserConfig globalInstance = ParserConfig.getGlobalInstance();
|
||||
// 只能过滤部分。对于接受参数为实体类的无法生效
|
||||
StringDeserializer stringDeserializer = new StringDeserializer();
|
||||
globalInstance.putDeserializer(String.class, stringDeserializer);
|
||||
globalInstance.putDeserializer(StringBuilder.class, stringDeserializer);
|
||||
globalInstance.putDeserializer(StringBuffer.class, stringDeserializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supports(Class<?> clazz) {
|
||||
return super.supports(clazz);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package cn.pluss.platform.configurer.extend;
|
||||
|
||||
import com.alibaba.fastjson.parser.DefaultJSONParser;
|
||||
import com.alibaba.fastjson.parser.JSONLexer;
|
||||
import com.alibaba.fastjson.parser.JSONToken;
|
||||
import com.alibaba.fastjson.serializer.StringCodec;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
public class StringDeserializer extends StringCodec {
|
||||
|
||||
@Override
|
||||
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
|
||||
if (clazz == StringBuffer.class) {
|
||||
final JSONLexer lexer = parser.lexer;
|
||||
if (lexer.token() == JSONToken.LITERAL_STRING) {
|
||||
String val = lexer.stringVal();
|
||||
val = val.replace("[\u0020\3000\n]", "");
|
||||
lexer.nextToken(JSONToken.COMMA);
|
||||
|
||||
return (T) new StringBuffer(val);
|
||||
}
|
||||
|
||||
Object value = parser.parse();
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (T) new StringBuffer(value.toString());
|
||||
}
|
||||
|
||||
if (clazz == StringBuilder.class) {
|
||||
final JSONLexer lexer = parser.lexer;
|
||||
if (lexer.token() == JSONToken.LITERAL_STRING) {
|
||||
String val = lexer.stringVal();
|
||||
val = val.replace("[\u0020\3000\n]", "");
|
||||
lexer.nextToken(JSONToken.COMMA);
|
||||
|
||||
return (T) new StringBuilder(val);
|
||||
}
|
||||
|
||||
Object value = parser.parse();
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (T) new StringBuilder(value.toString());
|
||||
}
|
||||
|
||||
return (T) deserialze(parser);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.app.AccountBalanceService;
|
||||
import cn.pluss.platform.entity.MakeMoney;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class AccountBalanceController {
|
||||
|
||||
private final AccountBalanceService accountBalanceService;
|
||||
|
||||
@GetMapping(value = "/queryBills")
|
||||
@ApiOperation(tags = {"页面-余额"}, value = "查询乐刷打款账单", notes = "查询乐刷打款账单", httpMethod = "POST")
|
||||
public Result<PageInfo<MakeMoney>> queryBills(Page<MakeMoney> page) {
|
||||
page.setSize(20);
|
||||
PageInfo<MakeMoney> result = accountBalanceService.queryBills(page);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.dto.AccountDTO;
|
||||
import cn.pluss.platform.dto.BankCardDTO;
|
||||
import cn.pluss.platform.entity.*;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.merchant.AccountService;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.vo.StoreSummaryVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Djh
|
||||
* 结算信息接口控制
|
||||
*/
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("account")
|
||||
public class AccountController {
|
||||
|
||||
@Autowired
|
||||
private UserAppService userAppService;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("accountService")
|
||||
private AccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private MerchantChannelStatusService mcsService;
|
||||
|
||||
@Autowired
|
||||
private MerchantBaseInfoService mbiService;
|
||||
|
||||
/**
|
||||
* 保存商户结算信息, 最新接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v3/save")
|
||||
public Result<Object> saveV3(@Validated @RequestBody AccountDTO accountDTO) {
|
||||
accountService.saveOrUpdate(accountDTO);
|
||||
return ResultGenerator.genSuccessResult("结算人信息保存成功", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存商户结算信息, 最新接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/save/v4")
|
||||
public Result<Object> saveV4(@Validated @RequestBody AccountDTO accountDTO) {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
MsgException.checkUnequals(userApp.getUserId() + "", accountDTO.getUserId(), "非法参数, 拒绝访问");
|
||||
accountService.saveOrUpdate(accountDTO);
|
||||
return ResultGenerator.genSuccessResult("结算人信息保存成功", "");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/v3/{userId}")
|
||||
public Result<Object> getAccountV3(@PathVariable("userId") String userId) {
|
||||
AccountDTO accountDTO = accountService.getAccount(userId);
|
||||
return ResultGenerator.genSuccessResult(accountDTO);
|
||||
}
|
||||
|
||||
@GetMapping("/v4")
|
||||
public Result<Object> getAccountV4(Account account) {
|
||||
UserApp tokenUa = userAppService.queryUserAppByToken();
|
||||
|
||||
if (account.getChannelType() == null) {
|
||||
|
||||
MerchantChannelStatus mcs = mcsService.getValidData(tokenUa.getMerchantCode());
|
||||
if (mcs == null || !Objects.equals(mcs.getChannel(), 4)) {
|
||||
account.setChannelType(Account.CHANNEL_TYPE_D1);
|
||||
} else {
|
||||
account.setChannelType(Account.CHANNEL_TYPE_D0);
|
||||
}
|
||||
}
|
||||
|
||||
AccountDTO accountDTO = accountService.getRealAccount(account);
|
||||
if (accountDTO == null) {
|
||||
accountDTO = new AccountDTO();
|
||||
}
|
||||
|
||||
if (accountDTO.getIdcard() == null && accountDTO.getBankCard() == null) {
|
||||
accountDTO.setIdcard(new IdCard());
|
||||
accountDTO.setBankCard(new BankCard());
|
||||
}
|
||||
|
||||
return ResultGenerator.genSuccessResult(accountDTO);
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public Result<Object> getAccounts(@RequestParam String userId) {
|
||||
Map<String, AccountDTO> result = accountService.getAccounts(userId);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
@GetMapping("/reckoner/v2")
|
||||
public Result<Object> reckonerV2(String userId, String merchantType) {
|
||||
StoreSummaryVO result = accountService.getReckonerV2(userId, merchantType);
|
||||
return ResultGenerator.genSuccessResult("请求成功", result);
|
||||
}
|
||||
|
||||
@GetMapping("/reckoner")
|
||||
public Result<Object> reckoner(String userId, String merchantType) {
|
||||
StoreSummaryVO result = accountService.getReckoner(userId, merchantType);
|
||||
return ResultGenerator.genSuccessResult("请求成功", result);
|
||||
}
|
||||
|
||||
@PostMapping("/editAccountBankCard")
|
||||
public Result<Object> editAccountBankCard(@RequestBody BankCard bankCard){
|
||||
// throw new MsgException("系统维护中,暂不支持修改结算卡");
|
||||
accountService.editAccountBankCard(bankCard);
|
||||
return ResultGenerator.genSuccessResult("结算账户修改已申请", null);
|
||||
}
|
||||
|
||||
@PostMapping("/editAccountBankCardV2")
|
||||
public Result<Object> editAccountBankCardV2(@RequestBody BankCardDTO bankCard){
|
||||
accountService.editAccountBankCardV2(bankCard);
|
||||
return ResultGenerator.genSuccessResult("结算账户修改已申请", null);
|
||||
}
|
||||
|
||||
@GetMapping("/canEditBankCard")
|
||||
public Result<Object> canEditBankCard() {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
boolean flag = accountService.canEditBankCard(userApp.getMerchantCode());
|
||||
return ResultGenerator.genSuccessResult("请求成功", flag);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.activityActivate.ActivityActivateService;
|
||||
import cn.pluss.platform.activityConsumReturn.ActivityConsumReturnService;
|
||||
import cn.pluss.platform.activityRecharge.ActivityRechargeService;
|
||||
import cn.pluss.platform.activityRecommend.ActivityRecommendService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.*;
|
||||
import cn.pluss.platform.merchantStore.MerchantStoreService;
|
||||
import cn.pluss.platform.util.EmojiUtil;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/activityActivate")
|
||||
@Api(value = "ActivityActivate控制类", tags = {"ActivityActivate接口"})
|
||||
public class ActivityActivateController {
|
||||
@Resource
|
||||
private ActivityActivateService activityActivateService;
|
||||
|
||||
@Resource
|
||||
private ActivityConsumReturnService activityConsumReturnService;
|
||||
|
||||
@Resource
|
||||
private ActivityRechargeService activityRechargeService;
|
||||
|
||||
@Resource
|
||||
private ActivityRecommendService activityRecommendService;
|
||||
|
||||
@Resource
|
||||
private MerchantStoreService merchantStoreService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")})
|
||||
public Result<PageInfo<ActivityActivate>> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<ActivityActivate> activityActivateList = activityActivateService.queryActivityActivatePage(map);
|
||||
|
||||
for (ActivityActivate activityActivate : activityActivateList) {
|
||||
activityActivate.setName(EmojiUtil.emojiRecovery2(activityActivate.getName()));
|
||||
}
|
||||
|
||||
Integer count = activityActivateService.queryActivityActivatePageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<ActivityActivate> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(),
|
||||
activityActivateList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
public Result<Object> add(@RequestBody ActivityActivate activityActivate) {
|
||||
|
||||
ActivityActivate activity = new ActivityActivate();
|
||||
activity.setMerchantCode(activityActivate.getMerchantCode());
|
||||
activity.setStoreId(activityActivate.getStoreId());
|
||||
List<ActivityActivate> activityList = activityActivateService.queryActivityActivateList(activity);
|
||||
for (ActivityActivate a : activityList) {
|
||||
activityActivateService.deleteActivityActivate(a);
|
||||
}
|
||||
if(StringUtil.isEmpty(activityActivate.getStoreId())){
|
||||
MerchantStore store = merchantStoreService.queryMerchantStore(new MerchantStore().setMerchantCode(activityActivate.getMerchantCode()));
|
||||
if(store == null){
|
||||
return ResultGenerator.genFailResult("门店信息有误!",null);
|
||||
}
|
||||
activityActivate.setStoreId(store.getStoreId());
|
||||
activityActivate.setStoreName(store.getStoreName());
|
||||
}
|
||||
activityActivate.setCreateDt(new Date());
|
||||
activityActivateService.saveActivityActivate(activityActivate);
|
||||
return ResultGenerator.genSuccessResult("添加成功!");
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)})
|
||||
public Result<Object> delete(@PathVariable Integer id) {
|
||||
ActivityActivate activityActivate = new ActivityActivate();
|
||||
activityActivate.setId(id);
|
||||
activityActivateService.deleteActivityActivate(activityActivate);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ActivityActivate", value = "更新的ActivityActivate实例", paramType = "body", dataType = "ActivityActivate", required = true)})
|
||||
public Result<Object> update(@RequestBody ActivityActivate activityActivate) {
|
||||
activityActivateService.updateActivityActivate(activityActivate);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")})
|
||||
public Result<Object> detail(@PathVariable Long id) {
|
||||
ActivityActivate activityActivate = new ActivityActivate();
|
||||
activityActivate.setId(id.intValue());
|
||||
activityActivate = activityActivateService.queryActivityActivate(activityActivate);
|
||||
return ResultGenerator.genSuccessResult(activityActivate);
|
||||
}
|
||||
|
||||
@GetMapping("/queryAcitvity")
|
||||
@ApiOperation(tags = {"页面-设置会员卡"}, value = "获取店铺活动", notes = "获取店铺活动", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "merchantCode", value = "商户Id", paramType = "merchantCode", required = true, dataType = "merchantCode"),
|
||||
@ApiImplicitParam(name = "storeId", value = "门店Id", paramType = "storeId", required = true, dataType = "storeId"),
|
||||
})
|
||||
public Result<Object> queryActivity(@RequestParam String merchantCode, String storeId) {
|
||||
Map<String, Object> result = new HashMap<>(16);
|
||||
if (StringUtil.isEmpty(merchantCode)) {
|
||||
return ResultGenerator.genFailResult("商家编码不能为空");
|
||||
}
|
||||
|
||||
ActivityActivate activityActivate = new ActivityActivate();
|
||||
activityActivate.setMerchantCode(merchantCode);
|
||||
activityActivate.setStoreId(storeId);
|
||||
List<ActivityActivate> queryActivityActivateList = activityActivateService.queryActivityActivateList(activityActivate);
|
||||
ActivityConsumReturn activityConsumReturn = new ActivityConsumReturn();
|
||||
activityConsumReturn.setMerchantCode(merchantCode);
|
||||
activityConsumReturn.setStoreId(storeId);
|
||||
List<ActivityConsumReturn> queryActivityConsumReturnList = activityConsumReturnService.queryActivityConsumReturnList(activityConsumReturn);
|
||||
ActivityRecharge activityRecharge = new ActivityRecharge();
|
||||
activityRecharge.setMerchantCode(merchantCode);
|
||||
activityRecharge.setStoreId(storeId);
|
||||
List<ActivityRecharge> queryActivityRechargeList = activityRechargeService.queryActivityRechargeList(activityRecharge);
|
||||
ActivityRecommend activityRecommend = new ActivityRecommend();
|
||||
activityRecommend.setMerchantCode(merchantCode);
|
||||
activityRecommend.setStoreId(storeId);
|
||||
List<ActivityRecommend> queryActivityRecommendList = activityRecommendService.queryActivityRecommendList(activityRecommend);
|
||||
result.put("activityActivateList", queryActivityActivateList);
|
||||
result.put("activityConsumReturnList", queryActivityConsumReturnList);
|
||||
result.put("activityRechargeList", queryActivityRechargeList);
|
||||
result.put("activityRecommendList", queryActivityRecommendList);
|
||||
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
@PostMapping("deleteAcitvityByType")
|
||||
@ApiOperation(value = "根据type删除对应的活动", notes = "根据type删除对应的活动 0:充值 1消费返 2激活送 ", httpMethod = "POST")
|
||||
public Result<Object> deleteActivityByType(@RequestBody ActivityActivate activityActivate) {
|
||||
String type = activityActivate.getType();
|
||||
Integer id = activityActivate.getId();
|
||||
|
||||
if ("0".equals(type)) {
|
||||
ActivityRecharge activityRecharge = new ActivityRecharge();
|
||||
activityRecharge.setId(id);
|
||||
activityRechargeService.deleteActivityRecharge(activityRecharge);
|
||||
} else if ("1".equals(type)) {
|
||||
ActivityConsumReturn activityConsumReturn = new ActivityConsumReturn();
|
||||
activityConsumReturn.setId(id);
|
||||
activityConsumReturnService.deleteActivityConsumReturn(activityConsumReturn);
|
||||
} else if ("2".equals(type)) {
|
||||
activityActivateService.deleteActivityActivate(activityActivate);
|
||||
} else {
|
||||
return ResultGenerator.genSuccessResult("删除失败");
|
||||
}
|
||||
return ResultGenerator.genSuccessResult("删除成功");
|
||||
}
|
||||
|
||||
@PostMapping("delActByType")
|
||||
public Result<Object> delActByType(@RequestBody ActivityActivate activityActivate) {
|
||||
activityActivateService.delActByType(activityActivate);
|
||||
return ResultGenerator.genSuccessResult("删除成功", null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.activityConsumReturn.ActivityConsumReturnService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.ActivityConsumReturn;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/activityConsumReturn")
|
||||
@Transactional
|
||||
@Api(value = "ActivityConsumReturn控制类", tags = {"ActivityConsumReturn接口"})
|
||||
public class ActivityConsumReturnController {
|
||||
|
||||
@Resource
|
||||
private ActivityConsumReturnService activityConsumReturnService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")})
|
||||
public Result<PageInfo<ActivityConsumReturn>> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<ActivityConsumReturn> activityConsumReturnList = activityConsumReturnService
|
||||
.queryActivityConsumReturnPage(map);
|
||||
Integer count = activityConsumReturnService.queryActivityConsumReturnPageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<ActivityConsumReturn> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(),
|
||||
activityConsumReturnList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
public Result<Object> add(@RequestBody List<ActivityConsumReturn> activityConsumReturn) {
|
||||
if (activityConsumReturn == null) {
|
||||
return ResultGenerator.genFailResult("参数错误!");
|
||||
}
|
||||
if (activityConsumReturn.size() > 0) {
|
||||
ActivityConsumReturn activity = new ActivityConsumReturn();
|
||||
activity.setMerchantCode(activityConsumReturn.get(0).getMerchantCode());
|
||||
activity.setStoreId(activityConsumReturn.get(0).getStoreId());
|
||||
List<ActivityConsumReturn> activityList = activityConsumReturnService.queryActivityConsumReturnList(activity);
|
||||
for (ActivityConsumReturn a : activityList) {
|
||||
activityConsumReturnService.deleteActivityConsumReturn(a);
|
||||
}
|
||||
}
|
||||
|
||||
for (ActivityConsumReturn activityConsumReturn2 : activityConsumReturn) {
|
||||
activityConsumReturn2.setCreateDt(new Date());
|
||||
activityConsumReturnService.saveActivityConsumReturn(activityConsumReturn2);
|
||||
}
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
ActivityConsumReturn activityConsumReturn = new ActivityConsumReturn();
|
||||
activityConsumReturn.setId(id);
|
||||
activityConsumReturnService.deleteActivityConsumReturn(activityConsumReturn);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ActivityConsumReturn", value = "更新的ActivityConsumReturn实例", paramType = "body", dataType = "ActivityConsumReturn", required = true)})
|
||||
public Result update(@RequestBody ActivityConsumReturn activityConsumReturn) {
|
||||
activityConsumReturnService.updateActivityConsumReturn(activityConsumReturn);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
ActivityConsumReturn activityConsumReturn = new ActivityConsumReturn();
|
||||
activityConsumReturn.setId(id.intValue());
|
||||
activityConsumReturn = activityConsumReturnService.queryActivityConsumReturn(activityConsumReturn);
|
||||
return ResultGenerator.genSuccessResult(activityConsumReturn);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.activityRecharge.ActivityRechargeService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.ActivityRecharge;
|
||||
import cn.pluss.platform.entity.MerchantBaseInfo;
|
||||
import cn.pluss.platform.entity.MerchantStore;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantStore.MerchantStoreService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activityRecharge")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Transactional
|
||||
@Api(value = "ActivityRecharge控制类", tags = {"ActivityRecharge接口"})
|
||||
public class ActivityRechargeController {
|
||||
|
||||
|
||||
private final ActivityRechargeService activityRechargeService;
|
||||
|
||||
private final MerchantStoreService merchantStoreService;
|
||||
|
||||
private final MerchantBaseInfoService merchantBaseInfoService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")})
|
||||
public Result<PageInfo<ActivityRecharge>> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<ActivityRecharge> activityRechargeList = activityRechargeService.queryActivityRechargePage(map);
|
||||
Integer count = activityRechargeService.queryActivityRechargePageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<ActivityRecharge> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(),
|
||||
activityRechargeList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
public Result<List<ActivityRecharge>> add(@RequestBody List<ActivityRecharge> activityRechargeList) {
|
||||
MerchantStore merchantStore;
|
||||
MerchantBaseInfo merchantBaseInfo;
|
||||
|
||||
if (activityRechargeList != null && !activityRechargeList.isEmpty()) {
|
||||
MerchantStore queryMerchantStore = new MerchantStore();
|
||||
queryMerchantStore.setMerchantCode(activityRechargeList.get(0).getMerchantCode());
|
||||
merchantStore = merchantStoreService.queryMerchantStore(queryMerchantStore);
|
||||
|
||||
MerchantBaseInfo queryMerchantBaseInfo = new MerchantBaseInfo();
|
||||
queryMerchantBaseInfo.setMerchantCode(activityRechargeList.get(0).getMerchantCode());
|
||||
merchantBaseInfo = merchantBaseInfoService.queryMerchantBaseInfo(queryMerchantBaseInfo);
|
||||
|
||||
ActivityRecharge activity = new ActivityRecharge();
|
||||
activity.setMerchantCode(merchantStore.getMerchantCode());
|
||||
List<ActivityRecharge> activityList = activityRechargeService.queryActivityRechargeList(activity);
|
||||
for (ActivityRecharge a : activityList) {
|
||||
activityRechargeService.deleteActivityRecharge(a);
|
||||
}
|
||||
|
||||
for (ActivityRecharge activityRecharge2 : activityRechargeList) {
|
||||
activityRecharge2.setCreateDt(new Date());
|
||||
activityRecharge2.setMerchantName(merchantBaseInfo.getAlias());
|
||||
activityRecharge2.setStoreId(merchantStore.getStoreId());
|
||||
activityRecharge2.setStoreName(merchantStore.getStoreName());
|
||||
activityRechargeService.saveActivityRecharge(activityRecharge2);
|
||||
}
|
||||
}
|
||||
return ResultGenerator.genSuccessResult(activityRechargeList);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)})
|
||||
public Result<?> delete(@PathVariable Integer id) {
|
||||
ActivityRecharge activityRecharge = new ActivityRecharge();
|
||||
activityRecharge.setId(id);
|
||||
activityRechargeService.deleteActivityRecharge(activityRecharge);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ActivityRecharge", value = "更新的ActivityRecharge实例", paramType = "body", dataType = "ActivityRecharge", required = true)})
|
||||
public Result update(@RequestBody ActivityRecharge activityRecharge) {
|
||||
activityRechargeService.updateActivityRecharge(activityRecharge);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
ActivityRecharge activityRecharge = new ActivityRecharge();
|
||||
activityRecharge.setId(id.intValue());
|
||||
activityRecharge = activityRechargeService.queryActivityRecharge(activityRecharge);
|
||||
return ResultGenerator.genSuccessResult(activityRecharge);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.activityRecommend.ActivityRecommendService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.ActivityRecommend;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/activityRecommend")
|
||||
@Transactional
|
||||
@Api(value = "ActivityRecommend控制类", tags = {"ActivityRecommend接口"})
|
||||
public class ActivityRecommendController {
|
||||
|
||||
@Resource
|
||||
private ActivityRecommendService activityRecommendService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<ActivityRecommend>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<ActivityRecommend> activityRecommendList = activityRecommendService.queryActivityRecommendPage(map);
|
||||
Integer count = activityRecommendService.queryActivityRecommendPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), activityRecommendList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ActivityRecommend", value = "待添加的ActivityRecommend实例", paramType = "body", dataType = "ActivityRecommend", required = true)
|
||||
})
|
||||
public Result add(@RequestBody ActivityRecommend activityRecommend) {
|
||||
|
||||
ActivityRecommend activity = new ActivityRecommend();
|
||||
activity.setMerchantCode(activityRecommend.getMerchantCode());
|
||||
// activity.setStoreId(activityRecommend.getStoreId());
|
||||
List<ActivityRecommend> activityList = activityRecommendService.queryActivityRecommendList(activity);
|
||||
for (ActivityRecommend a : activityList) {
|
||||
activityRecommendService.deleteActivityRecommend(a);
|
||||
}
|
||||
|
||||
activityRecommendService.saveActivityRecommend(activityRecommend);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
ActivityRecommend activityRecommend = new ActivityRecommend();
|
||||
activityRecommend.setId(id);
|
||||
activityRecommendService.deleteActivityRecommend(activityRecommend);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ActivityRecommend", value = "更新的ActivityRecommend实例", paramType = "body", dataType = "ActivityRecommend", required = true)
|
||||
})
|
||||
public Result update(@RequestBody ActivityRecommend activityRecommend) {
|
||||
activityRecommendService.updateActivityRecommend(activityRecommend);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
ActivityRecommend activityRecommend = new ActivityRecommend();
|
||||
activityRecommend.setId(id.intValue());
|
||||
activityRecommend = activityRecommendService.queryActivityRecommend(activityRecommend);
|
||||
return ResultGenerator.genSuccessResult(activityRecommend);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.agent.AgentService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.dto.UserInfoDTO;
|
||||
import cn.pluss.platform.entity.MerchantRateNew;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.service.agent.AgentStaffService;
|
||||
import cn.pluss.platform.util.PageUtils;
|
||||
import cn.pluss.platform.vo.AgentInfo;
|
||||
import cn.pluss.platform.vo.AgentStaffVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 超级服务商相关功能
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("agent")
|
||||
public class AgentInfoController {
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private AgentService agentService;
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private AgentStaffService agentStaffService;
|
||||
|
||||
|
||||
@PostMapping("saveOrUpdateStaff")
|
||||
public Result<?> saveOrUpdateStaff(@RequestBody @Valid UserInfoDTO userInfoDTO) {
|
||||
agentStaffService.saveOrUpdateStaff(userInfoDTO);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PostMapping("saveStaff")
|
||||
public Result<?> saveStaff(@RequestBody @Valid UserInfoDTO userInfoDTO) {
|
||||
agentStaffService.saveStaff(userInfoDTO);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PostMapping("updateStaff")
|
||||
public Result<?> updateStaff(@RequestBody @Valid UserInfoDTO userInfoDTO) {
|
||||
agentStaffService.updateStaff(userInfoDTO);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "delStaff/{userId}", method = {RequestMethod.DELETE, RequestMethod.GET})
|
||||
public Result<?> delStaff(@PathVariable String userId) {
|
||||
agentStaffService.delStaff(userId);
|
||||
return ResultGenerator.genSuccessResult("删除成功", null);
|
||||
}
|
||||
|
||||
@GetMapping("staff/{userId}")
|
||||
public Result<AgentStaffVO> getStaff(@PathVariable String userId) {
|
||||
AgentStaffVO staff = agentStaffService.getStaff(userId);
|
||||
return ResultGenerator.genSuccessResult(staff);
|
||||
}
|
||||
|
||||
@GetMapping("staffPage")
|
||||
public Result<PageInfo<AgentStaffVO>> staffPage(Page<AgentStaffVO> page, UserInfoDTO userInfoDTO) {
|
||||
if (userInfoDTO.getPId() == null) {
|
||||
throw new MsgException("超级服务商id必传");
|
||||
}
|
||||
|
||||
Page<AgentStaffVO> result = agentStaffService.staffPage(page, userInfoDTO);
|
||||
return ResultGenerator.genSuccessResult(PageUtils.page(result));
|
||||
}
|
||||
|
||||
@GetMapping("page")
|
||||
public Result<Page<AgentInfo>> page(Page<AgentInfo> page, AgentInfo agentInfo, OrderItem orderItem) {
|
||||
page = agentService.page(page, agentInfo, orderItem);
|
||||
return ResultGenerator.genSuccessResult(page);
|
||||
}
|
||||
|
||||
@PostMapping("save")
|
||||
public Result<String> save(@RequestBody @Valid AgentInfo agentInfo) {
|
||||
agentService.save(agentInfo);
|
||||
return ResultGenerator.genSuccessResult("保存成功", "保存成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商户费率的最小费率阈值
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("minSettingRateNew")
|
||||
public Result<MerchantRateNew> minSettingRateNew() {
|
||||
MerchantRateNew minSettingRateNew = agentService.getMinSettingRateNew();
|
||||
return ResultGenerator.genSuccessResult(minSettingRateNew);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.agreement.AgreementService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.Agreement;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/agreement")
|
||||
@Transactional
|
||||
@Api(value = "Agreement控制类", tags = {"Agreement接口"})
|
||||
public class AgreementController {
|
||||
|
||||
@Resource
|
||||
private AgreementService agreementService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<Agreement>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<Agreement> agreementList = agreementService.queryAgreementPage(map);
|
||||
Integer count = agreementService.queryAgreementPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<Agreement>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), agreementList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Agreement", value = "待添加的Agreement实例", paramType = "body", dataType = "Agreement", required = true)
|
||||
})
|
||||
public Result add(@RequestBody Agreement agreement) {
|
||||
agreementService.saveAgreement(agreement);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
Agreement agreement = new Agreement();
|
||||
agreement.setId(id);
|
||||
agreementService.deleteAgreement(agreement);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Agreement", value = "更新的Agreement实例", paramType = "body", dataType = "Agreement", required = true)
|
||||
})
|
||||
public Result update(@RequestBody Agreement agreement) {
|
||||
agreementService.updateAgreement(agreement);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/getAgreementOne")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "discern", value = "协议标识", paramType = "String", dataType = "discern", required = true)
|
||||
public Result<Agreement> detail(String discern) {
|
||||
Agreement agreement = new Agreement();
|
||||
agreement.setDiscern(discern);
|
||||
List<Agreement> queryAgreementList = agreementService.queryAgreementList(agreement);
|
||||
if (queryAgreementList != null && queryAgreementList.size() > 0) {
|
||||
agreement = queryAgreementList.get(0);
|
||||
}
|
||||
return ResultGenerator.genSuccessResult(agreement);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,443 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.dto.*;
|
||||
import cn.pluss.platform.entity.MerchantBaseInfo;
|
||||
import cn.pluss.platform.entity.MerchantIncome;
|
||||
import cn.pluss.platform.entity.MerchantOrder;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantIncome.MerchantIncomeService;
|
||||
import cn.pluss.platform.merchantOrder.MerchantOrderService;
|
||||
import cn.pluss.platform.notice.NoticeService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.AliPayParam;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.FileItem;
|
||||
import com.alipay.api.request.AlipayOpenAgentConfirmRequest;
|
||||
import com.alipay.api.request.AlipayOpenAgentCreateRequest;
|
||||
import com.alipay.api.request.AlipayOpenAgentFacetofaceSignRequest;
|
||||
import com.alipay.api.request.AlipayOpenAgentOrderQueryRequest;
|
||||
import com.alipay.api.response.AlipayOpenAgentConfirmResponse;
|
||||
import com.alipay.api.response.AlipayOpenAgentCreateResponse;
|
||||
import com.alipay.api.response.AlipayOpenAgentFacetofaceSignResponse;
|
||||
import com.alipay.api.response.AlipayOpenAgentOrderQueryResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import order.OrderQueryVO;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuchen
|
||||
*
|
||||
* @Description
|
||||
*/
|
||||
@Deprecated
|
||||
@RestController
|
||||
@RequestMapping("/alipay")
|
||||
@Transactional
|
||||
@Api(value = "支付宝控制类",tags={"支付宝接口"})
|
||||
public class AlipayController {
|
||||
|
||||
private final static String APP_ID="2019092467786259";
|
||||
|
||||
private final static String PRI="MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCN1NubOHroItIz7eLWWBDprPzToDr1cggn/V90ghPaoBWgmnZhD/CejX+KxHmQVQLEBVN6ehQgNSVGBj0hSHxkj1OCCU7Eu9qAIqRzkWY1RkZKoKOIcJbU+yL20XTs3kATgNm5jx8ejVQDsNqekS1bBrRX6xlU/mjMVFtKoZC/Vpv8yAmP6R9onkum4O0OgCWARKC40NuYVp9hPUgRpWJ/NIPSlO4j8zIPYFkjfsh84c8moVLZdhYDDbbEY3vnHutDa0A3d5f4MI4qXBZ6tW5wO5WG93U5E5jat73RUzBOc0zN+3U/Rsk+gq722ChLj4/ifp0NLqgjbKecs4wlM8A3AgMBAAECggEAQ1QjuAjU17QIA1zPTR9bUAKttqyesHukgY9XLBC/6g4KlkYdIjCV8j6LqE1iw/CHMpSwrziaqztvaVF23YDyhC5B3z4Z5Wyj6iYH2VDRq0KkBbNCTnfcMljRnUeLcRKEan3FXcAibrd6hZIEBjg2xrplDENvsBhhmXYGLGSMOTfoRFlc1DhvPdr3qxR9mljD2YcvIrxDVDPZ3P4wTcsIM6xZmXGrsFbI0sGxgm4a4fzMLUYxSvuMtc+auwasQ/393Le/kjdVBWr/hBJZbGIU5/NQN0EesOJD6dIFU07wDDuy4LYLVVjSN3EiynWfMJIrvLbnR1sMgKJ775wY61hIaQKBgQC/mFKwZdZvzsqnEMQmUfkUT5+v8BJvS4JApPpt+O2GMUAKoynk220U0rJW/QyEkTz6A/lR8ZStT6TyM14ulpOYDMJquZqSCoIHMrIdjhZRMqAVONUJHsYVvpLQLbJaDDEaCksnWE+77ULBstZaevkBgLmNsy6V4CxwLJKj0xMDEwKBgQC9giRaS4t2J5ZcNycuDEBhwPteSoFun/6bX4yPsZYdeB88NGs7j1oOk9MXrvQq69X0uXE8zv2DHrDvuoGI920m56bU/4wCuKoqpnLi0xFM1al0na12He6UmFKWa+kGBkH5p5BggPyaCFMwJI/qL3gZft56aWjliviwWSmI8pvOzQKBgHZw8d0+d1vTGJBC2x9dWX9m4a7f2GWY5kKUOoQ1eJCWbaKlz0Y9J6fRwJHqCQ0CxBFC16QClgi1zaA0hSqDx2YdrSpQ5u8VM+DDRDzlE4LKqw+zfG8Q6R+UGio7tZ/ZHZmdd2wxOclRGQ2pQr3Ye4qkSxEADfJ1DMOjqltAJualAoGALafl9C8RGVUuP2c2NDzVYfepV60hg7JeF7asWY4SOWVQOSPz1bSSoMJyb9lBj/mjYUMwCdNgdi91tzu6q3HYxS+4HMa4R4uPy5iwQv9Qwq8TFTpLqRJLAVe1RfIXgNEPIgOBoA5TTRTGXenhFi17hMDw/pLYp7yUb3/7pre0W90CgYAWb86ocBIpS8cKhZY2fcrHALzKh4cuxl68sNQcOxevt3tIak0KG+o/5/5l0uBW2qYSOJOl2u831VWuOWEJBk+h5brYCtTNIsa6lKdknhRP/NfAfWUiWEesPV5nfYKL85s8bf2x/gFv9Ah0S5K4cI+SCMVIzaQzQ2dN+cmlvM8rfQ==";
|
||||
private final static String PUB="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjdTbmzh66CLSM+3i1lgQ6az806A69XIIJ/1fdIIT2qAVoJp2YQ/wno1/isR5kFUCxAVTenoUIDUlRgY9IUh8ZI9TgglOxLvagCKkc5FmNUZGSqCjiHCW1Psi9tF07N5AE4DZuY8fHo1UA7DanpEtWwa0V+sZVP5ozFRbSqGQv1ab/MgJj+kfaJ5LpuDtDoAlgESguNDbmFafYT1IEaVifzSD0pTuI/MyD2BZI37IfOHPJqFS2XYWAw22xGN75x7rQ2tAN3eX+DCOKlwWerVucDuVhvd1OROY2re90VMwTnNMzft1P0bJPoKu9tgoS4+P4n6dDS6oI2ynnLOMJTPANwIDAQAB";
|
||||
|
||||
@Resource
|
||||
private UserAppService userAppService;
|
||||
|
||||
@Resource
|
||||
private MerchantBaseInfoService merchantBaseInfoService;
|
||||
|
||||
@Resource
|
||||
private MerchantOrderService merchantOrderService;
|
||||
|
||||
@Resource
|
||||
private NoticeService noticeService;
|
||||
|
||||
@Resource
|
||||
private MerchantIncomeService merchantIncomeService;
|
||||
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "开启代商户签约、创建应用事务",notes = "返回BatchNo",httpMethod = "POST")
|
||||
public Result<?> get(@RequestBody AccountInfoDTO dto) throws AlipayApiException{
|
||||
AlipayClient alipayClient = getAlipayClient();
|
||||
AlipayOpenAgentCreateRequest request = new AlipayOpenAgentCreateRequest();
|
||||
if(StringUtil.isEmpty(dto.getAccount())) {
|
||||
return ResultGenerator.genFailResult("请输入支付宝账号");
|
||||
}
|
||||
if(StringUtil.isEmpty(dto.getContactName())) {
|
||||
return ResultGenerator.genFailResult("请输入姓名");
|
||||
}
|
||||
|
||||
request.setBizContent("{" +
|
||||
"\"account\":\""+dto.getAccount()+"\"," +
|
||||
"\"contact_info\":{" +
|
||||
"\"contact_name\":\""+dto.getContactName()+"\"," +
|
||||
"\"contact_mobile\":\""+dto.getContactMobile()+"\"," +
|
||||
"\"contact_email\":\""+dto.getContactEmail()+"\"" +
|
||||
" }," +"}");
|
||||
AlipayOpenAgentCreateResponse response = alipayClient.execute(request);
|
||||
if(response.isSuccess()){
|
||||
if("10000".equals(response.getCode())) {
|
||||
return ResultGenerator.genSuccessResult(response.getBatchNo());
|
||||
}else {
|
||||
return ResultGenerator.genFailResult("调用失败");
|
||||
}
|
||||
} else {
|
||||
return ResultGenerator.genFailResult("调用失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/facetofaceSign")
|
||||
@ApiOperation(value = "代签约当面付产品",httpMethod = "POST")
|
||||
public Result<String> facetofaceSign(@RequestBody BatchInfoDTO dto) throws AlipayApiException{
|
||||
AlipayClient alipayClient = getAlipayClient();
|
||||
FileItem BusinessLicensePic = new FileItem(dto.getBusinessLicensePic());
|
||||
FileItem ShopSignBoardPic = new FileItem(dto.getShopSignBoardPic());
|
||||
AlipayOpenAgentFacetofaceSignRequest request = new AlipayOpenAgentFacetofaceSignRequest();
|
||||
request.setBatchNo(dto.getBatchNo());
|
||||
request.setMccCode(dto.getMccCode());
|
||||
request.setBusinessLicenseNo(dto.getBusinessLicenseNo());
|
||||
request.setBusinessLicensePic(BusinessLicensePic);
|
||||
request.setShopSignBoardPic(ShopSignBoardPic);
|
||||
AlipayOpenAgentFacetofaceSignResponse response = alipayClient.execute(request);
|
||||
if(response.isSuccess()){
|
||||
if("10000".equals(response.getCode())) {
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}else {
|
||||
return ResultGenerator.genFailResult("调用失败");
|
||||
}
|
||||
} else {
|
||||
return ResultGenerator.genFailResult("调用失败");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/agentConfirm")
|
||||
@ApiOperation(value = "提交代商户签约、创建应用事务",httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "batchNo",value = "ISV代商户操作事务编号", paramType = "batchNo",dataType = "String",required=true)
|
||||
public Result<String> agentConfirm(String batchNo) throws AlipayApiException{
|
||||
AlipayClient alipayClient = getAlipayClient();
|
||||
AlipayOpenAgentConfirmRequest request = new AlipayOpenAgentConfirmRequest();
|
||||
request.setBizContent("{" +
|
||||
"\"batch_no\":\""+batchNo+"\"" +
|
||||
" }");
|
||||
AlipayOpenAgentConfirmResponse response = alipayClient.execute(request);
|
||||
if(response.isSuccess()){
|
||||
if("10000".equals(response.getCode())) {
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}else {
|
||||
return ResultGenerator.genFailResult("调用失败");
|
||||
}
|
||||
} else {
|
||||
return ResultGenerator.genFailResult("调用失败");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/orderQuery")
|
||||
@ApiOperation(value = "查询申请单状态",httpMethod = "GET")
|
||||
public Result<OrderQueryVO> orderQuery(String batchNo) throws AlipayApiException{
|
||||
AlipayClient alipayClient = getAlipayClient();
|
||||
AlipayOpenAgentOrderQueryRequest request = new AlipayOpenAgentOrderQueryRequest();
|
||||
request.setBizContent("{" +
|
||||
"\"batch_no\":\""+batchNo+"\"" +
|
||||
" }");
|
||||
AlipayOpenAgentOrderQueryResponse response = alipayClient.execute(request);
|
||||
if(response.isSuccess()){
|
||||
if("10000".equals(response.getCode())) {
|
||||
OrderQueryVO orderQueryVO=new OrderQueryVO();
|
||||
orderQueryVO.setAgentAppId(response.getAgentAppId());
|
||||
orderQueryVO.setConfirmUrl(response.getConfirmUrl());
|
||||
orderQueryVO.setMerchantPid(response.getMerchantPid());
|
||||
if("MERCHANT_INFO_HOLD".equals(response.getOrderStatus())) {
|
||||
orderQueryVO.setOrderStatus("暂存");
|
||||
}else if("MERCHANT_AUDITING".equals(response.getOrderStatus())) {
|
||||
orderQueryVO.setOrderStatus("审核中");
|
||||
}else if("MERCHANT_CONFIRM".equals(response.getOrderStatus())) {
|
||||
orderQueryVO.setOrderStatus("待商户确认");
|
||||
}else if("MERCHANT_CONFIRM_SUCCESS".equals(response.getOrderStatus())) {
|
||||
orderQueryVO.setOrderStatus("商户确认成功");
|
||||
}else if("MERCHANT_CONFIRM_TIME_OUT".equals(response.getOrderStatus())) {
|
||||
orderQueryVO.setOrderStatus("商户超时未确认");
|
||||
}else if("MERCHANT_APPLY_ORDER_CANCELED".equals(response.getOrderStatus())) {
|
||||
orderQueryVO.setOrderStatus("审核失败或商户拒绝");
|
||||
}
|
||||
orderQueryVO.setRejectReason(response.getRejectReason());
|
||||
return ResultGenerator.genSuccessResult(orderQueryVO);
|
||||
}else {
|
||||
return ResultGenerator.genFailResult("调用失败");
|
||||
}
|
||||
} else {
|
||||
return ResultGenerator.genFailResult("调用失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@PostMapping("/tradePay")
|
||||
@ApiOperation(value = "统一收单交易支付接口",httpMethod = "POST")
|
||||
public Result<String> tradePay(@RequestBody TradePayDTO dto) throws AlipayApiException{
|
||||
throw new MsgException("接口暂不支持");
|
||||
// if(StringUtil.isEmpty(dto.getUserId())) {
|
||||
// return ResultGenerator.genFailResult("用户id不能为空");
|
||||
// }
|
||||
// UserApp userApp = getUserApp(dto.getUserId());
|
||||
// if(StringUtil.isEmpty(userApp.getAppAuthToken())) {
|
||||
// return ResultGenerator.genFailResult(ParametersUtil.domain+"/wap/aliPay/index?userId"+dto.getUserId());//跳转到商家授权H5页面(暂时缺失)
|
||||
// }
|
||||
// if(StringUtil.isEmpty(dto.getOutTradeNo())) {
|
||||
// return ResultGenerator.genFailResult("商户订单号不能为空");
|
||||
// }
|
||||
// if(StringUtil.isEmpty(dto.getAuthCode())) {
|
||||
// return ResultGenerator.genFailResult("支付授权码不能为空");
|
||||
// }
|
||||
// if(StringUtil.isEmpty(dto.getTotalAmount())) {
|
||||
// return ResultGenerator.genFailResult("订单总额不能为空");
|
||||
// }
|
||||
// AlipayClient alipayClient = getAlipayClient();
|
||||
// AlipayTradePayRequest request = new AlipayTradePayRequest();
|
||||
// request.putOtherTextParam("app_auth_token", userApp.getAppAuthToken());
|
||||
// request.setBizContent("{"+
|
||||
// "\"out_trade_no\":\""+dto.getOutTradeNo()+"\"," +
|
||||
// "\"scene\":\"bar_code\"," +
|
||||
// "\"auth_code\":\""+dto.getAuthCode()+"\"," +
|
||||
// "\"subject\":\""+dto.getSubject()+"\"," +
|
||||
// "\"total_amount\":\""+dto.getTotalAmount()+"\"" +
|
||||
// " }");
|
||||
// AlipayTradePayResponse response = alipayClient.execute(request);
|
||||
// if(response.isSuccess()){
|
||||
// if("10000".equals(response.getCode())) {
|
||||
// return ResultGenerator.genSuccessResult(response.getBody());
|
||||
// }else {
|
||||
// return ResultGenerator.genFailResult("支付失败");
|
||||
// }
|
||||
// } else {
|
||||
// return ResultGenerator.genFailResult("支付失败");
|
||||
// }
|
||||
}
|
||||
|
||||
@PostMapping("/tradeRefund")
|
||||
@ApiOperation(value = "统一收单交易退款接口",httpMethod = "POST")
|
||||
public Result<String> tradeRefund(@RequestBody TradeRefundDTO dto) throws AlipayApiException{
|
||||
throw new MsgException("暂不支持该接口");
|
||||
// if(StringUtil.isEmpty(dto.getUserId())) {
|
||||
// return ResultGenerator.genFailResult("用户id不能为空");
|
||||
// }
|
||||
// AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
|
||||
// if(StringUtil.isEmpty(dto.getOutTradeNo())) {
|
||||
// if(StringUtil.isEmpty(dto.getTradeNo())) {
|
||||
// return ResultGenerator.genFailResult("支付宝交易号和商户订单号必须填一个");
|
||||
// }else {
|
||||
// request.setBizContent("{" +
|
||||
// "\"trade_no\":\""+dto.getTradeNo()+"\"," +
|
||||
// "\"refund_amount\":"+dto.getRefundAmount()+"" +
|
||||
// " }");
|
||||
// }
|
||||
// }else {
|
||||
// if(StringUtil.isEmpty(dto.getTradeNo())) {
|
||||
// request.setBizContent("{" +
|
||||
// "\"out_trade_no\":\""+dto.getOutTradeNo()+"\"," +
|
||||
// "\"refund_amount\":"+dto.getRefundAmount()+"" +
|
||||
// " }");
|
||||
// }else {
|
||||
// request.setBizContent("{" +
|
||||
// "\"out_trade_no\":\""+dto.getOutTradeNo()+"\"," +
|
||||
// "\"trade_no\":\""+dto.getTradeNo()+"\"," +
|
||||
// "\"refund_amount\":"+dto.getRefundAmount()+"" +
|
||||
// " }");
|
||||
// }
|
||||
// }
|
||||
// UserApp userApp = getUserApp(dto.getUserId());
|
||||
// if(StringUtil.isEmpty(userApp.getAppAuthToken())) {
|
||||
// //跳转到商家授权H5页面(暂时缺失)
|
||||
// return ResultGenerator.genFailResult(ParametersUtil.domain+"/wap/aliPay/index?userId="+dto.getUserId());
|
||||
// }else {
|
||||
// request.putOtherTextParam("app_auth_token", userApp.getAppAuthToken());
|
||||
// }
|
||||
// AlipayClient alipayClient = getAlipayClient();
|
||||
// AlipayTradeRefundResponse response = alipayClient.execute(request);
|
||||
// if(response.isSuccess()){
|
||||
// return ResultGenerator.genSuccessResult("退款成功");
|
||||
// } else {
|
||||
// return ResultGenerator.genFailResult("退款失败");
|
||||
// }
|
||||
}
|
||||
|
||||
@PostMapping("/tradeQuery")
|
||||
@ApiOperation(value = "统一收单线下交易查询接口",httpMethod = "POST")
|
||||
public Result<String> tradeQuery(@RequestBody QueryOrderDTO queryOrderDTO) throws AlipayApiException{
|
||||
throw new MsgException("暂不支持该接口");
|
||||
// if(StringUtil.isEmpty(queryOrderDTO.getUserId())) {
|
||||
// return ResultGenerator.genFailResult("用户userId不能为空");
|
||||
// }
|
||||
// if(StringUtil.isEmpty(queryOrderDTO.getOrderNumber())) {
|
||||
// return ResultGenerator.genFailResult("商家订单号不能为空");
|
||||
// }
|
||||
// UserApp userApp = getUserApp(queryOrderDTO.getUserId());
|
||||
// if(StringUtil.isEmpty(userApp.getAppAuthToken())) {
|
||||
// return ResultGenerator.genFailResult(ParametersUtil.domain+"/wap/aliPay/index?userId="+queryOrderDTO.getUserId()); //跳转到商家授权H5页面(暂时缺失)
|
||||
// }
|
||||
// MerchantBaseInfo merchantBaseInfo=new MerchantBaseInfo();
|
||||
// merchantBaseInfo.setMerchantCode(queryOrderDTO.getMerchantCode());
|
||||
// List<MerchantBaseInfo> queryMerchantBaseInfoList = merchantBaseInfoService.queryMerchantBaseInfoList(merchantBaseInfo);
|
||||
// if(queryMerchantBaseInfoList==null||queryMerchantBaseInfoList.size()==0) {
|
||||
// return ResultGenerator.genFailResult("该商户不存在");
|
||||
// }
|
||||
// merchantBaseInfo=queryMerchantBaseInfoList.get(0);
|
||||
// AlipayClient alipayClient = getAlipayClient();
|
||||
// AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
|
||||
// request.putOtherTextParam("app_auth_token", userApp.getAppAuthToken());
|
||||
// request.setBizContent("{" +
|
||||
// "\"out_trade_no\":\""+queryOrderDTO.getOrderNumber()+"\"" +
|
||||
// " }");
|
||||
// AlipayTradeQueryResponse response = alipayClient.execute(request);
|
||||
// if(response.isSuccess()){
|
||||
// String tradeStatus = response.getTradeStatus();
|
||||
// if("WAIT_BUYER_PAY".equals(tradeStatus)) {
|
||||
// tradeStatus="交易创建,等待买家付款";
|
||||
// return ResultGenerator.genTransunKonwResult(tradeStatus);
|
||||
// }else if("TRADE_CLOSED".equals(tradeStatus)) {
|
||||
// tradeStatus="未付款交易超时关闭,或支付完成后全额退款";
|
||||
// return ResultGenerator.genFailResult(tradeStatus);
|
||||
// }else if("TRADE_SUCCESS".equals(tradeStatus)) {
|
||||
// tradeStatus="交易支付成功";
|
||||
// Date sendPayDate = response.getSendPayDate();
|
||||
// String tradeNo = response.getTradeNo();
|
||||
// MerchantOrder order = queryOrderDTO.convertMerchantOrder();
|
||||
// order.setTransDt(sendPayDate);
|
||||
// merchantIncome(order, "1");
|
||||
// saveMerchantOrderStatus(tradeNo,order, merchantBaseInfo);
|
||||
// return ResultGenerator.genSuccessResult(tradeStatus);
|
||||
// }else if("TRADE_FINISHED".equals(tradeStatus)) {
|
||||
// tradeStatus="交易结束,不可退款";
|
||||
// return ResultGenerator.genFailResult(tradeStatus);
|
||||
// }
|
||||
// } else {
|
||||
// return ResultGenerator.genFailResult("查询失败");
|
||||
// }
|
||||
// return ResultGenerator.genFailResult("查询失败");
|
||||
}
|
||||
|
||||
private MerchantOrder saveMerchantOrderStatus(String outTradeNo,MerchantOrder merchantOrder, MerchantBaseInfo merchantBaseInfo) {
|
||||
return null;
|
||||
// String payTypeCode = merchantOrder.getPayTypeCode();//当前订单支付方式
|
||||
// if("wechatPay".equalsIgnoreCase(payTypeCode)) {
|
||||
// merchantOrder.setWeChatTransNo(outTradeNo);
|
||||
// }else if("aliPay".equalsIgnoreCase(payTypeCode)) {
|
||||
// merchantOrder.setAliPayTransNo(outTradeNo);
|
||||
// }else if("leshuaPay0".equalsIgnoreCase(payTypeCode)||"leshuaPay1".equals(payTypeCode)) {
|
||||
// merchantOrder.setLeshuaTransNo(outTradeNo);
|
||||
// }
|
||||
// merchantOrder.setStatus("1");
|
||||
// merchantOrderService.updateById(merchantOrder);
|
||||
// if (!StringUtil.isEmpty(merchantBaseInfo.getUserId())) {//更新上级推广员的交易金额
|
||||
// UserApp userApp = new UserApp();
|
||||
// userApp.setUserId(Long.parseLong(merchantBaseInfo.getUserId()));
|
||||
// List<UserApp> queryUserAppList = userAppService.queryUserAppList(userApp);//查询当前商户的用户信息
|
||||
// if (queryUserAppList != null && queryUserAppList.size()>0) {
|
||||
// userApp = queryUserAppList.get(0);//当前商户的用户信息
|
||||
// Long parentId = userApp.getParentId();//推荐人的userId
|
||||
// UserApp userApp2 = new UserApp();
|
||||
// userApp2.setUserId(parentId);
|
||||
// if(StringUtil.isNotEmpty(parentId)) {
|
||||
// userApp2=userAppService.queryUserApp(userApp2);
|
||||
// Double tradeMoney = userApp2.getTradeMoney()==null?0d:userApp2.getTradeMoney();//当前推广员的交易额
|
||||
// Double consumeFee = merchantOrder.getConsumeFee()==null?0d:merchantOrder.getConsumeFee();//这一笔订单的消费金额
|
||||
// userApp2.setTradeMoney(StringUtil.bigDecimal(tradeMoney+consumeFee));
|
||||
// double extendProfit = userApp2.getExtendProfit()==null?0d:userApp2.getExtendProfit();//当前推广员的推广分润
|
||||
// double shareMoney = StringUtil.bigDecimal(Double.parseDouble(merchantOrder.getShareMoney()));
|
||||
// extendProfit=extendProfit+shareMoney;
|
||||
// userApp2.setExtendProfit(extendProfit);
|
||||
// userAppService.updateUserApp(userApp2);
|
||||
// if (shareMoney > 0.01) {
|
||||
// // 生成分润通知
|
||||
// Notice notice = new Notice(0, 6, userApp);
|
||||
// notice.setConrtent("您有一笔" + merchantOrder.getShareMoney() + "元的商户分润");
|
||||
// noticeService.saveNotice(notice);
|
||||
// List<String> alias = new ArrayList<String>();
|
||||
// alias.add(userApp.getUserId().toString());
|
||||
// GeneralPushUtil.sendAllPlatByAlias(alias, "商户分润通知", "您有一笔" + merchantOrder.getShareMoney() + "元的商户分润", "0");
|
||||
//// JpushClientUtil.sendToRegistrationId2(alias, "商户分润通知", "商户分润通知","您有一笔" + merchantOrder.getShareMoney() + "元的商户分润",
|
||||
//// "0", DateUtils.currentYourDate("yyyy-MM-dd HH:mm:ss"));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return merchantOrder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* merchantIncome:(添加收益记录). <br/>
|
||||
*
|
||||
* @author Administrator
|
||||
* @since JDK 1.8
|
||||
*/
|
||||
private void merchantIncome(MerchantOrder merchantOrder,String payTypeCode){
|
||||
MerchantIncome merchantIncome=new MerchantIncome();
|
||||
if("1".equals(payTypeCode)) {
|
||||
merchantIncome.setMerchantCode(merchantOrder.getMerchantCode());
|
||||
merchantIncome.setMerchantName(merchantOrder.getMerchantName());
|
||||
merchantIncome.setStoreId(merchantOrder.getStoreId());
|
||||
merchantIncome.setStoreName(merchantOrder.getStoreName());
|
||||
merchantIncome.setDealFee(merchantOrder.getConsumeFee());
|
||||
merchantIncome.setIncomeFee(merchantOrder.getEnterFee());
|
||||
merchantIncome.setPayTypeCode(payTypeCode);
|
||||
merchantIncome.setPayTypeName("微信");
|
||||
merchantIncome.setCreateTime(merchantOrder.getTransDt());
|
||||
merchantIncomeService.saveMerchantIncome(merchantIncome);
|
||||
}else if("0".equals(payTypeCode)) {
|
||||
merchantIncome.setMerchantCode(merchantOrder.getMerchantCode());
|
||||
merchantIncome.setMerchantName(merchantOrder.getMerchantName());
|
||||
merchantIncome.setStoreId(merchantOrder.getStoreId());
|
||||
merchantIncome.setStoreName(merchantOrder.getStoreName());
|
||||
merchantIncome.setDealFee(merchantOrder.getConsumeFee());
|
||||
merchantIncome.setIncomeFee(merchantOrder.getEnterFee());
|
||||
merchantIncome.setPayTypeCode(payTypeCode);
|
||||
merchantIncome.setPayTypeName("支付宝");
|
||||
merchantIncome.setCreateTime(merchantOrder.getTransDt());
|
||||
merchantIncomeService.saveMerchantIncome(merchantIncome);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public AlipayClient getAlipayClient() {
|
||||
return new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AliPayParam.getAppId(),AliPayParam.getPri(),"json","UTF-8",AliPayParam.getPub(),"RSA2");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* getUserApp:(获取userApp 并得到对应的token). <br/>
|
||||
*
|
||||
* @author Administrator
|
||||
* @param userId
|
||||
* @return
|
||||
* @since JDK 1.8
|
||||
*/
|
||||
public UserApp getUserApp(String userId) {
|
||||
UserApp userApp=new UserApp();
|
||||
userApp.setUserId(Long.valueOf(userId));
|
||||
List<UserApp> queryUserAppList = userAppService.queryUserAppList(userApp);
|
||||
if(queryUserAppList!=null&&queryUserAppList.size()>0) {
|
||||
userApp = queryUserAppList.get(0);
|
||||
}
|
||||
return userApp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.common.AliyunService;
|
||||
import cn.pluss.platform.config.OssConfig;
|
||||
import cn.pluss.platform.config.StsConfig;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.oss.common.auth.ServiceSignature;
|
||||
import com.aliyuncs.auth.sts.AssumeRoleResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
|
||||
/**
|
||||
* 阿里云相关接口,获取stsToken等
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("aliyun")
|
||||
@Slf4j
|
||||
public class AliyunController {
|
||||
|
||||
private final UserAppService userAppService;
|
||||
|
||||
private final AliyunService aliyunService;
|
||||
|
||||
private final OssConfig ossConfig;
|
||||
|
||||
private final StsConfig stsConfig;
|
||||
|
||||
/**
|
||||
* 获取上传图片签名
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/signature")
|
||||
public Result<String> getSignature(String content) throws UnsupportedEncodingException {
|
||||
String toSign = URLDecoder.decode(content, "UTF-8");
|
||||
String s = ServiceSignature.create().computeSignature(ossConfig.getKeysecret(), toSign);
|
||||
|
||||
String result = "OSS " + ossConfig.getKeyid() + ":" + s;
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
@GetMapping("/stsToken")
|
||||
public Object getStsToken() {
|
||||
JSONObject result = new JSONObject();
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
AssumeRoleResponse.Credentials credentials = aliyunService.stsToken(userApp.getUserId() + "");
|
||||
JSONObject json = (JSONObject) JSON.toJSON(credentials);
|
||||
result.putAll(json);
|
||||
result.put("statusCode", 200);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.hutool.core.comparator.CompareUtil;
|
||||
import cn.pluss.platform.AppMenuService;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.base.BaseModelController;
|
||||
import cn.pluss.platform.entity.AppMenu;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RequestMapping("appMenu")
|
||||
@RestController
|
||||
public class AppMenuController extends BaseModelController<AppMenuService, AppMenu> {
|
||||
|
||||
@GetMapping("homePageMenu")
|
||||
public Result<List<Map<String, Object>>> getHomePageMenu(HttpServletRequest request) {
|
||||
List<Map<String, Object>> homeMenu = baseService.getHomeMenu(request);
|
||||
return ResultGenerator.genSuccessResult(homeMenu);
|
||||
}
|
||||
|
||||
@GetMapping("spreadPageMenu")
|
||||
public Result<List<Map<String, Object>>> getPromoterPageMenu(HttpServletRequest request) {
|
||||
List<Map<String, Object>> homeMenu = baseService.getSpreadPageMenu(request);
|
||||
return ResultGenerator.genSuccessResult(homeMenu);
|
||||
}
|
||||
|
||||
@GetMapping("menuIsUpdated")
|
||||
public Result<?> getInfoByName(String name, String cacheTime) throws ParseException {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd ahh:mm:ss");
|
||||
|
||||
Date mCacheTime = null;
|
||||
if (StringUtils.isNotEmpty(cacheTime) ) {
|
||||
if (((cacheTime.contains("上午")) || (cacheTime.contains("下午")))) {
|
||||
mCacheTime = sdf2.parse(cacheTime);
|
||||
} else {
|
||||
mCacheTime = sdf.parse(cacheTime);
|
||||
}
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<AppMenu> qWrapper = Wrappers.lambdaQuery();
|
||||
qWrapper.eq(AppMenu::getName, name);
|
||||
final AppMenu one = baseService.getOne(qWrapper);
|
||||
|
||||
return ResultGenerator.genSuccessResult(CompareUtil.compare(one.getUpdateTime(), mCacheTime) > 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.BankCardService;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.base.BaseModelController;
|
||||
import cn.pluss.platform.entity.BankCard;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 银行卡信息 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Djh
|
||||
* @since 2020-10-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bankCard")
|
||||
public class BankCardController extends BaseModelController<BankCardService, BankCard> {
|
||||
|
||||
@Autowired
|
||||
private BankCardService bankCardService;
|
||||
|
||||
@Autowired
|
||||
private UserAppService uaService;
|
||||
|
||||
@GetMapping("/accBankCardList")
|
||||
public Result<List<Map<String, Object>>> bankCardList() {
|
||||
UserApp userApp = uaService.queryUserAppByToken();
|
||||
List<Map<String, Object>> res = bankCardService.getAccBankCardList(userApp.getUserId() + "");
|
||||
return ResultGenerator.genSuccessResult(res);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.banner.BannerService;
|
||||
import cn.pluss.platform.entity.Banner;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/banner")
|
||||
@Api(value = "Banner控制类", tags = {"Banner接口"})
|
||||
public class BannerController {
|
||||
|
||||
@Resource
|
||||
private BannerService bannerService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Banner", value = "待添加的Banner实例", paramType = "body", dataType = "Banner", required = true)})
|
||||
public Result<Object> add(@RequestBody Banner banner) {
|
||||
bannerService.saveBanner(banner);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PostMapping("/queryBannerList")
|
||||
@ApiOperation(tags = {"页面-首页"}, value = "查询所有的轮播图", notes = "查询所有的轮播图", httpMethod = "POST")
|
||||
public Result<List<Banner>> queryBannerList(@RequestBody Banner banner) {
|
||||
if (banner == null) {
|
||||
return ResultGenerator.genFailResult("参数错误!");
|
||||
}
|
||||
if (banner.getType() == null || StringUtil.isEmpty(banner.getType())) {
|
||||
return ResultGenerator.genFailResult("查询参数错误!");
|
||||
}
|
||||
|
||||
Banner queryBanner = new Banner();
|
||||
queryBanner.setType(banner.getType());
|
||||
List<Banner> banners = bannerService.queryBannerList(queryBanner);
|
||||
return ResultGenerator.genSuccessResult(banners);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)})
|
||||
public Result<Object> delete(@PathVariable Integer id) {
|
||||
Banner banner = new Banner();
|
||||
banner.setId(id);
|
||||
bannerService.deleteBanner(banner);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Banner", value = "更新的Banner实例", paramType = "body", dataType = "Banner", required = true)})
|
||||
public Result<Object> update(@RequestBody Banner banner) {
|
||||
bannerService.updateBanner(banner);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.bestNewActivity.BestNewActivityService;
|
||||
import cn.pluss.platform.entity.BestNewActivity;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bestNewActivity")
|
||||
@Transactional
|
||||
@Api(value = "BestNewActivity控制类", tags = {"BestNewActivity接口"})
|
||||
public class BestNewActivityController {
|
||||
|
||||
@Resource
|
||||
private BestNewActivityService bestNewActivityService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(tags = {"页面-最新活动"}, value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<BestNewActivity>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size, @RequestParam(defaultValue = "3") String type) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
map.put("type", type);
|
||||
List<BestNewActivity> bestNewActivityList = bestNewActivityService.queryBestNewActivityPage(map);
|
||||
Integer count = bestNewActivityService.queryBestNewActivityPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), bestNewActivityList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "BestNewActivity", value = "待添加的BestNewActivity实例", paramType = "body", dataType = "BestNewActivity", required = true)
|
||||
})
|
||||
public Result add(@RequestBody BestNewActivity bestNewActivity) {
|
||||
bestNewActivityService.saveBestNewActivity(bestNewActivity);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
BestNewActivity bestNewActivity = new BestNewActivity();
|
||||
bestNewActivity.setId(id);
|
||||
bestNewActivityService.deleteBestNewActivity(bestNewActivity);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "BestNewActivity", value = "更新的BestNewActivity实例", paramType = "body", dataType = "BestNewActivity", required = true)
|
||||
})
|
||||
public Result update(@RequestBody BestNewActivity bestNewActivity) {
|
||||
bestNewActivityService.updateBestNewActivity(bestNewActivity);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PostMapping("/detail")
|
||||
@ApiOperation(value = "获取单个值", notes = "传id", httpMethod = "POST")
|
||||
public Result detail(@RequestBody BestNewActivity bestNewActivity) {
|
||||
bestNewActivity = bestNewActivityService.queryBestNewActivity(bestNewActivity);
|
||||
return ResultGenerator.genSuccessResult(bestNewActivity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.base.BaseModelController;
|
||||
import cn.pluss.platform.cashAccount.CashAccountService;
|
||||
import cn.pluss.platform.entity.CashAccount;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author bzg
|
||||
* @since 2021-07-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cashAccount")
|
||||
public class CashAccountController extends BaseModelController<CashAccountService, CashAccount> {
|
||||
|
||||
@ApiOperation(tags = {"提现账户-保存"}, value = "保存提现账号", notes = "保存提现账号", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "cashAccount", value = "保存的cashAccount实例", paramType = "body", dataType = "CashAccount", required = true) })
|
||||
@Override
|
||||
public Result<String> save(@Valid @RequestBody CashAccount entity) {
|
||||
try {
|
||||
baseService.apiSave(entity);
|
||||
return ResultGenerator.genSuccessResult("保存成功", null);
|
||||
}catch (RuntimeException e){
|
||||
MsgException.throwException(e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping(value = "get/{userId}")
|
||||
@ApiOperation(tags = {"获取提现-查询"}, value = "查询提现账号", notes = "查询提现账号", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "cashAccount", value = "查询cashAccount实例", paramType = "params", required = true) })
|
||||
public Result<CashAccount> get(@PathVariable("userId") Integer userId) {
|
||||
return super.get(new CashAccount().setUserId(userId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.cash.CashService;
|
||||
import cn.pluss.platform.entity.Cash;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.entity.WxBankCode;
|
||||
import cn.pluss.platform.util.*;
|
||||
import cn.pluss.platform.wxBankCode.WxBankCodeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@RequestMapping("/cash")
|
||||
@Api(value = "Cash控制类", tags = { "Cash接口" })
|
||||
public class CashController {
|
||||
|
||||
private final CashService cashService;
|
||||
|
||||
private final WxBankCodeService wxBankCodeService;
|
||||
|
||||
@GetMapping({ "", "/v3" })
|
||||
@ApiOperation(tags = { "页面-提现记录" }, value = "获取分页提现记录", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "type", value = "提现类型 0粉丝分润 1推广分润 99其他 ", paramType = "type", dataType = "Integer", required = true),
|
||||
@ApiImplicitParam(name = "status", value = "提现状态 0 申请提现 1 提现成功 2 提现失败", paramType = "status", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "merchantCode", value = "商家Code", paramType = "merchantCode", dataType = "String", required = true), })
|
||||
public Result<PageInfo<Cash>> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size, Integer type, Integer status, String merchantCode,
|
||||
String userId) {
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
|
||||
if (StringUtil.isEmpty(userId)) {
|
||||
return ResultGenerator.genFailResult("无用户id");
|
||||
}
|
||||
|
||||
// map.put("type", type);
|
||||
map.put("userId", userId);
|
||||
List<Cash> cashList = cashService.queryCashPage(map);
|
||||
Integer count = cashService.queryCashPageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<Cash> pageInfo = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size),
|
||||
page.longValue(), size.longValue(), cashList);
|
||||
return ResultGenerator.genSuccessResult(pageInfo);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(tags = { "页面-提现" }, value = "提现接口", notes = "添加新的提现记录", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Cash", value = "待添加的Cash实例", paramType = "body", dataType = "Cash", required = true) })
|
||||
public Result<Object> add(@RequestBody Cash cash) {
|
||||
cashService.apiSaveCash(cash);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PostMapping("/v2")
|
||||
public Result<Object> addV2(@RequestBody Cash cash) {
|
||||
cashService.apiSaveCashV2(cash);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/v3/preDetail")
|
||||
public Result<Object> detail(Cash cash) {
|
||||
Cash result = cashService.cashDetail(cash);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
@PostMapping("/v3")
|
||||
public Result<Object> addV3(@RequestBody Cash cash) {
|
||||
cashService.apiSaveCashV3(cash);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.device.DeviceService;
|
||||
import cn.pluss.platform.entity.Device;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/device")
|
||||
@Transactional
|
||||
@Api(value = "Device控制类", tags = {"Device接口"})
|
||||
public class DeviceController {
|
||||
|
||||
@Resource
|
||||
private DeviceService deviceService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<Device>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
map.put("status", "1");
|
||||
List<Device> deviceList = deviceService.queryDevicePage(map);
|
||||
Integer count = deviceService.queryDevicePageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), deviceList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Device", value = "待添加的Device实例", paramType = "body", dataType = "Device", required = true)
|
||||
})
|
||||
public Result add(@RequestBody Device device) {
|
||||
device.setCreateDt(new Date());
|
||||
deviceService.saveDevice(device);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
Device device = new Device();
|
||||
device.setId(id);
|
||||
deviceService.deleteDevice(device);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Device", value = "更新的Device实例", paramType = "body", dataType = "Device", required = true)
|
||||
})
|
||||
public Result update(@RequestBody Device device) {
|
||||
deviceService.updateDevice(device);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
Device device = new Device();
|
||||
device.setId(id.intValue());
|
||||
device = deviceService.queryDevice(device);
|
||||
return ResultGenerator.genSuccessResult(device);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
|
||||
import cn.pluss.platform.DeviceGoodsService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.base.BaseModelController;
|
||||
import cn.pluss.platform.device.DeviceGoodTagService;
|
||||
import cn.pluss.platform.entity.DeviceGoodTag;
|
||||
import cn.pluss.platform.entity.DeviceGoods;
|
||||
import cn.pluss.platform.vo.DeviceGoodsVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备商品展示表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Djh
|
||||
* @since 2020-11-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/deviceGoods")
|
||||
public class DeviceGoodsController extends BaseModelController<DeviceGoodsService, DeviceGoods> {
|
||||
|
||||
@Autowired
|
||||
private DeviceGoodTagService goodTagService;
|
||||
|
||||
@GetMapping("/goodList")
|
||||
public Result<PageInfo<DeviceGoodsVO>> goodList(@RequestParam(name = "page", defaultValue = "1") Integer page
|
||||
, @RequestParam(name = "size", defaultValue = "10") Integer size, DeviceGoods condition) {
|
||||
PageInfo<DeviceGoodsVO> pageData = baseService.goodList(page, size, condition);
|
||||
return ResultGenerator.genSuccessResult(pageData);
|
||||
}
|
||||
|
||||
@GetMapping("/goodListSimple")
|
||||
public Result<PageInfo<DeviceGoodsVO>> goodListSimple(@RequestParam(name = "page", defaultValue = "1") Integer page
|
||||
, @RequestParam(name = "size", defaultValue = "10") Integer size, DeviceGoods condition) {
|
||||
PageInfo<DeviceGoodsVO> pageData = baseService.goodListSimple(page, size, condition);
|
||||
return ResultGenerator.genSuccessResult(pageData);
|
||||
}
|
||||
|
||||
@GetMapping("/deviceDetail/{code}")
|
||||
public Result<DeviceGoods> deviceDetail(@PathVariable("code") String code) {
|
||||
LambdaQueryWrapper<DeviceGoods> qWrapper = Wrappers.lambdaQuery();
|
||||
qWrapper.eq(DeviceGoods::getCode, code);
|
||||
DeviceGoods entity = baseService.getOne(qWrapper);
|
||||
return ResultGenerator.genSuccessResult("获取成功", entity);
|
||||
}
|
||||
|
||||
@GetMapping("/tagList")
|
||||
public Result<List<DeviceGoodTag>> tagList() {
|
||||
LambdaQueryWrapper<DeviceGoodTag> qWrapper = Wrappers.lambdaQuery();
|
||||
qWrapper.orderByAsc(DeviceGoodTag::getSort);
|
||||
List<DeviceGoodTag> result = goodTagService.list(qWrapper.last("limit 20"));
|
||||
return ResultGenerator.genSuccessResult("数据获取成功", result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.jiguang.common.utils.StringUtils;
|
||||
import cn.pluss.platform.ali.AliService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.device.DeviceOrderInfoService;
|
||||
import cn.pluss.platform.deviceDetail.DeviceDetailService;
|
||||
import cn.pluss.platform.deviceMerchantBuy.DeviceMerchantBuyService;
|
||||
import cn.pluss.platform.dto.DeviceMerchantBuyDTO;
|
||||
import cn.pluss.platform.entity.DeviceMerchantBuy;
|
||||
import cn.pluss.platform.entity.DeviceOrderInfo;
|
||||
import cn.pluss.platform.entity.MerchantChannelStatus;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import cn.pluss.platform.vo.DeviceMerchantBuyVO;
|
||||
import cn.pluss.platform.wechat.WechatService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/deviceMerchantBuy")
|
||||
@Api(value = "DeviceMerchantBuy控制类", tags = {"DeviceMerchantBuy接口"})
|
||||
public class DeviceMerchantBuyController {
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private DeviceMerchantBuyService deviceMerchantBuyService;
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private AliService aliService;
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private WechatService wechatService;
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private UserAppService userAppService;
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private MerchantBaseInfoService mbiService;
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private MerchantChannelStatusService mcsService;
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private DeviceDetailService deviceDetailService;
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private DeviceOrderInfoService doiService;
|
||||
|
||||
@Autowired
|
||||
private DeviceMerchantBuyService dmbService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<DeviceMerchantBuy>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<DeviceMerchantBuy> deviceMerchantBuyList = deviceMerchantBuyService.queryDeviceMerchantBuyPage(map);
|
||||
Integer count = deviceMerchantBuyService.queryDeviceMerchantBuyPageCount(map);
|
||||
//返回参数
|
||||
PageInfo<DeviceMerchantBuy> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), deviceMerchantBuyList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "DeviceMerchantBuy", value = "待添加的DeviceMerchantBuy实例", paramType = "body", dataType = "DeviceMerchantBuy", required = true)
|
||||
})
|
||||
public Result<?> add(@RequestBody DeviceMerchantBuy deviceMerchantBuy) {
|
||||
deviceMerchantBuyService.saveDeviceMerchantBuy(deviceMerchantBuy);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result<?> delete(@PathVariable Integer id) {
|
||||
DeviceMerchantBuy deviceMerchantBuy = new DeviceMerchantBuy();
|
||||
deviceMerchantBuy.setId(id);
|
||||
deviceMerchantBuyService.deleteDeviceMerchantBuy(deviceMerchantBuy);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "DeviceMerchantBuy", value = "更新的DeviceMerchantBuy实例", paramType = "body", dataType = "DeviceMerchantBuy", required = true)
|
||||
})
|
||||
public Result<?> update(@RequestBody DeviceMerchantBuy deviceMerchantBuy) {
|
||||
deviceMerchantBuyService.updateDeviceMerchantBuy(deviceMerchantBuy);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<?> detail(@PathVariable Long id) {
|
||||
DeviceMerchantBuy deviceMerchantBuy = new DeviceMerchantBuy();
|
||||
deviceMerchantBuy.setId(id.intValue());
|
||||
deviceMerchantBuy = deviceMerchantBuyService.queryDeviceMerchantBuy(deviceMerchantBuy);
|
||||
return ResultGenerator.genSuccessResult(deviceMerchantBuy);
|
||||
}
|
||||
|
||||
@PostMapping("/buyDevice")
|
||||
@ApiOperation(value = "购买设备生成订单", notes = "购买设备生成订单", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceMerchantBuyDTO", value = "订单信息", paramType = "DeviceMerchantBuyDTO", required = true, dataType = "DeviceMerchantBuyDTO")
|
||||
})
|
||||
public Result<?> buyDevice(@RequestBody DeviceMerchantBuyDTO deviceMerchantBuyDTO) {
|
||||
String orderNo = StringUtil.genRandomNum(3) + StringUtil.getBillno() + StringUtil.genRandomNum(3);
|
||||
Map<String, String> map = deviceMerchantBuyDTO.convert(orderNo);
|
||||
if ("aliPay".equals(deviceMerchantBuyDTO.getPayCode())) {
|
||||
return aliService.appPayParam(map, deviceMerchantBuyDTO);
|
||||
} else if ("wechatPay".equals(deviceMerchantBuyDTO.getPayCode())) {
|
||||
return wechatService.appPayParam(request, map, deviceMerchantBuyDTO);
|
||||
} else {
|
||||
return ResultGenerator.genFailResult("请选择正确的支付方式");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/v2/buyDevice")
|
||||
@ApiOperation(value = "购买设备生成订单", notes = "购买设备生成订单", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceMerchantBuyDTO", value = "订单信息", paramType = "DeviceMerchantBuyDTO", required = true, dataType = "DeviceMerchantBuyDTO")
|
||||
})
|
||||
public Result<?> buyDeviceV2(@RequestBody DeviceMerchantBuyDTO deviceMerchantBuyDTO) {
|
||||
if (deviceMerchantBuyDTO.getCode() == null) {
|
||||
throw new MsgException("缺少设备code");
|
||||
}
|
||||
|
||||
if (Objects.equals(deviceMerchantBuyDTO.getQuantity(), 0)) {
|
||||
throw new MsgException("数量不能为0");
|
||||
}
|
||||
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
if (deviceMerchantBuyDTO.getCode().startsWith("MP_NEW")) {
|
||||
if (StringUtils.isEmpty(userApp.getMerchantCode())) {
|
||||
throw new MsgException("非商户不允许购买新商户礼包");
|
||||
} else {
|
||||
MerchantChannelStatus mcs = mcsService.getValidData(userApp.getMerchantCode());
|
||||
if (!MerchantChannelStatus.isAudited(mcs)) {
|
||||
throw new MsgException("非商户不允许购买新商户礼包");
|
||||
}
|
||||
|
||||
if (!Objects.equals(deviceMerchantBuyDTO.getQuantity(), 1)) {
|
||||
throw new MsgException("新商户礼包只能下单一个");
|
||||
}
|
||||
|
||||
QueryWrapper<DeviceOrderInfo> qWrapper = new QueryWrapper<DeviceOrderInfo>()
|
||||
.eq("userId", userApp.getUserId())
|
||||
.eq("code", "MP_NEW");
|
||||
List<DeviceOrderInfo> data = doiService.list(qWrapper);
|
||||
for (DeviceOrderInfo datum : data) {
|
||||
QueryWrapper<DeviceMerchantBuy> qWrapper2 = new QueryWrapper<>();
|
||||
qWrapper2.eq("orderNo", datum.getOrderNo());
|
||||
DeviceMerchantBuy one = dmbService.getOne(qWrapper2);
|
||||
if (one != null && "1".equals(one.getStatus())) {
|
||||
throw new MsgException("新商户礼包只能下单一次");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// List<DeviceDetailVO> deviceDetailsList = deviceDetailService.listByCode(Collections.singletonList(deviceMerchantBuyDTO.getCode()));
|
||||
// DeviceDetailVO devDetail = deviceDetailsList.get(0);
|
||||
// Long leftStock = devDetail.getTotalCount() - devDetail.getTotalSold();
|
||||
// BigDecimal leftGroup = leftStock.divideToIntegralValue(new BigDecimal(devDetail.get("groupSize").toString()));
|
||||
// if (leftGroup.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// throw new MsgException("暂无库存");
|
||||
// }
|
||||
|
||||
String orderNo = StringUtil.genRandomNum(3) + StringUtil.getBillno() + StringUtil.genRandomNum(3);
|
||||
Map<String, String> map = deviceMerchantBuyDTO.convert(orderNo);
|
||||
if ("aliPay".equals(deviceMerchantBuyDTO.getPayCode())) {
|
||||
return aliService.appPayParamV2(map, deviceMerchantBuyDTO);
|
||||
} else if ("wechatPay".equals(deviceMerchantBuyDTO.getPayCode())) {
|
||||
return wechatService.appPayParamV2(request, map, deviceMerchantBuyDTO);
|
||||
} else {
|
||||
return ResultGenerator.genFailResult("请选择正确的支付方式");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/deviceRefund")
|
||||
@ApiOperation(value = "设备订单退款", notes = "设备订单退款", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderNo", value = "订单号", paramType = "query", dataType = "orderNo"),
|
||||
})
|
||||
public Result<?> deviceRefund(String orderNo) {
|
||||
DeviceMerchantBuy deviceMerchantBuy = new DeviceMerchantBuy();
|
||||
deviceMerchantBuy.setOrderNo(orderNo);
|
||||
deviceMerchantBuy = deviceMerchantBuyService.queryDeviceMerchantBuy(deviceMerchantBuy);
|
||||
String payCode = deviceMerchantBuy.getPayCode();
|
||||
if ("aliPay".equals(payCode)) {//支付宝
|
||||
return aliService.appRefund(deviceMerchantBuy);
|
||||
} else if ("wechatPay".equals(payCode)) {//微信
|
||||
return wechatService.appRefund(deviceMerchantBuy);
|
||||
}
|
||||
return ResultGenerator.genFailResult("退款失败");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/deviceOrderShow")
|
||||
@ApiOperation(value = "订单信息回显", notes = "订单信息回显", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "10")
|
||||
})
|
||||
public Result<?> deviceOrderShow(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
try {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
Map<String, Object> map = new HashMap<String, Object>(16);
|
||||
map.put("userId", userApp.getUserId());
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
map.put("status", "1");
|
||||
List<DeviceMerchantBuyVO> deviceOrderShowPage = deviceMerchantBuyService.deviceOrderShowPage(map);
|
||||
Integer count = deviceMerchantBuyService.deviceOrderShowPageCount(map);
|
||||
PageInfo pageInfo = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), deviceOrderShowPage);
|
||||
return ResultGenerator.genSuccessResult(pageInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultGenerator.genFailResult("系统繁忙,请稍后再试");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.deviceMerchantBuyDetail.DeviceMerchantBuyDetailService;
|
||||
import cn.pluss.platform.entity.DeviceMerchantBuyDetail;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/deviceMerchantBuyDetail")
|
||||
@Api(value = "DeviceMerchantBuyDetail控制类", tags = {"DeviceMerchantBuyDetail接口"})
|
||||
public class DeviceMerchantBuyDetailController {
|
||||
|
||||
@Resource
|
||||
private DeviceMerchantBuyDetailService deviceMerchantBuyDetailService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<DeviceMerchantBuyDetail>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<DeviceMerchantBuyDetail> deviceMerchantBuyDetailList = deviceMerchantBuyDetailService.queryDeviceMerchantBuyDetailPage(map);
|
||||
Integer count = deviceMerchantBuyDetailService.queryDeviceMerchantBuyDetailPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<DeviceMerchantBuyDetail>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), deviceMerchantBuyDetailList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "DeviceMerchantBuyDetail", value = "待添加的DeviceMerchantBuyDetail实例", paramType = "body", dataType = "DeviceMerchantBuyDetail", required = true)
|
||||
})
|
||||
public Result add(@RequestBody DeviceMerchantBuyDetail deviceMerchantBuyDetail) {
|
||||
deviceMerchantBuyDetailService.saveDeviceMerchantBuyDetail(deviceMerchantBuyDetail);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
DeviceMerchantBuyDetail deviceMerchantBuyDetail = new DeviceMerchantBuyDetail();
|
||||
deviceMerchantBuyDetail.setId(id);
|
||||
deviceMerchantBuyDetailService.deleteDeviceMerchantBuyDetail(deviceMerchantBuyDetail);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "DeviceMerchantBuyDetail", value = "更新的DeviceMerchantBuyDetail实例", paramType = "body", dataType = "DeviceMerchantBuyDetail", required = true)
|
||||
})
|
||||
public Result update(@RequestBody DeviceMerchantBuyDetail deviceMerchantBuyDetail) {
|
||||
deviceMerchantBuyDetailService.updateDeviceMerchantBuyDetail(deviceMerchantBuyDetail);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
DeviceMerchantBuyDetail deviceMerchantBuyDetail = new DeviceMerchantBuyDetail();
|
||||
deviceMerchantBuyDetail.setId(id.intValue());
|
||||
deviceMerchantBuyDetail = deviceMerchantBuyDetailService.queryDeviceMerchantBuyDetail(deviceMerchantBuyDetail);
|
||||
return ResultGenerator.genSuccessResult(deviceMerchantBuyDetail);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.deviceSignUnbind.DeviceSignUnbindService;
|
||||
import cn.pluss.platform.entity.DeviceSignUnbind;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/deviceSignUnbind")
|
||||
@Api(value = "DeviceSignUnbind控制类", tags = {"DeviceSignUnbind接口"})
|
||||
public class DeviceSignUnbindController {
|
||||
|
||||
@Resource
|
||||
private DeviceSignUnbindService deviceSignUnbindService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<DeviceSignUnbind>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<DeviceSignUnbind> deviceSignUnbindList = deviceSignUnbindService.queryDeviceSignUnbindPage(map);
|
||||
Integer count = deviceSignUnbindService.queryDeviceSignUnbindPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), deviceSignUnbindList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "DeviceSignUnbind", value = "待添加的DeviceSignUnbind实例", paramType = "body", dataType = "DeviceSignUnbind", required = true)
|
||||
})
|
||||
public Result add(@RequestBody DeviceSignUnbind deviceSignUnbind) {
|
||||
deviceSignUnbindService.save(deviceSignUnbind);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
deviceSignUnbindService.removeById(id);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "DeviceSignUnbind", value = "更新的DeviceSignUnbind实例", paramType = "body", dataType = "DeviceSignUnbind", required = true)
|
||||
})
|
||||
public Result update(@RequestBody DeviceSignUnbind deviceSignUnbind) {
|
||||
deviceSignUnbindService.updateById(deviceSignUnbind);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
DeviceSignUnbind deviceSignUnbind = new DeviceSignUnbind();
|
||||
deviceSignUnbind.setId(id.intValue());
|
||||
deviceSignUnbind = deviceSignUnbindService.queryDeviceSignUnbind(deviceSignUnbind);
|
||||
return ResultGenerator.genSuccessResult(deviceSignUnbind);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/applyDeviceSignUnbind")
|
||||
@ApiOperation(value = "设备激活/解绑申请", notes = "设备激活/解绑申请", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderNo", value = "订单号", paramType = "orderNo", required = true, dataType = "orderNo"),
|
||||
@ApiImplicitParam(name = "soleCode", value = "唯一编码", paramType = "soleCode", required = true, dataType = "soleCode"),
|
||||
@ApiImplicitParam(name = "sn", value = "sn码", paramType = "sn", required = true, dataType = "sn"),
|
||||
})
|
||||
public Result applyDeviceSignUnbind(@RequestParam(value = "orderNo") String orderNo, @RequestParam(value = "soleCode") String soleCode, @RequestParam(value = "sn") String sn) {
|
||||
return deviceSignUnbindService.applyDeviceSignUnbind(orderNo, soleCode, sn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.cash.CashService;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.*;
|
||||
import cn.pluss.platform.fans.FansService;
|
||||
import cn.pluss.platform.fansConsumReturn.FansConsumReturnService;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantOrder.MerchantOrderService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.DateUtils;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import cn.pluss.platform.vo.FansSumRewardsInfoVO;
|
||||
import cn.pluss.platform.vo.PageFansConsumReturnVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/fansConsumReturn")
|
||||
@Transactional
|
||||
@Api(value = "FansConsumReturn控制类", tags = { "FansConsumReturn接口" })
|
||||
public class FansConsumReturnController {
|
||||
|
||||
@Resource
|
||||
private FansConsumReturnService fansConsumReturnService;
|
||||
@Resource
|
||||
private FansService fansService;
|
||||
|
||||
@Autowired
|
||||
private UserAppService uaService;
|
||||
|
||||
@Resource
|
||||
private CashService cashService;
|
||||
|
||||
@Resource
|
||||
private MerchantBaseInfoService merchantBaseInfoService;
|
||||
@Resource
|
||||
private MerchantOrderService merchantOrderService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(tags = {"页面-粉丝_粉丝消费"}, value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "merchantCode", value = "商家Code", paramType = "query", dataType = "String", required = true), })
|
||||
public Result<PageFansConsumReturnVO> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size, String merchantCode,String startTime ,String endTime) {
|
||||
UserApp userApp = uaService.queryUserAppByToken();
|
||||
merchantCode = userApp.getMerchantCode();
|
||||
|
||||
PageFansConsumReturnVO pageVO = new PageFansConsumReturnVO();
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
map.put("lastMerchantCode", merchantCode);
|
||||
try {
|
||||
if(StringUtil.isNotEmpty(startTime)) {
|
||||
map.put("startTime", sdf.parse(startTime));
|
||||
}
|
||||
if(StringUtil.isNotEmpty(endTime)) {
|
||||
map.put("endTime", sdf.parse(endTime));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
Double fansConsumMonyNowDayCount=fansService.queryFansSumConsumMoney(map);//消费金额
|
||||
if(fansConsumMonyNowDayCount==null) {
|
||||
fansConsumMonyNowDayCount=0d;
|
||||
}
|
||||
Double fansReturnMoneyNowDayCount=fansService.queryFansSumShareMoney(map);//奖励金额
|
||||
if(fansReturnMoneyNowDayCount==null) {
|
||||
fansReturnMoneyNowDayCount=0d;
|
||||
}
|
||||
|
||||
List<Fans> fansConsumReturnList = fansService.queryFansPage(map);
|
||||
for (Fans fans : fansConsumReturnList) {
|
||||
MerchantOrder merchantOrder=new MerchantOrder();
|
||||
merchantOrder.setOrderNumber(fans.getOrderNumber());
|
||||
List<MerchantOrder> merchantOrderList=merchantOrderService.list(new QueryWrapper<>(merchantOrder));
|
||||
if(merchantOrderList!=null&&merchantOrderList.size()>0) {
|
||||
MerchantBaseInfo merchantBaseInfo=new MerchantBaseInfo();
|
||||
merchantBaseInfo.setMerchantCode(merchantOrderList.get(0).getMerchantCode());
|
||||
merchantBaseInfo=merchantBaseInfoService.queryMerchantBaseInfo(merchantBaseInfo);
|
||||
if(null!=merchantBaseInfo&&StringUtil.isNotEmpty(merchantBaseInfo.getAlias())) {
|
||||
fans.setAlias(merchantBaseInfo.getAlias());
|
||||
}
|
||||
}
|
||||
if(!StringUtil.isEmpty(fans.getNickName())) {
|
||||
try {
|
||||
fans.setNickName(URLDecoder.decode(fans.getNickName(), "UTF-8"));
|
||||
fans.setNickName(URLDecoder.decode(fans.getNickName(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Integer count = fansService.queryFansPageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<Fans> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count,size), page.longValue(), size.longValue(), fansConsumReturnList);
|
||||
pageVO.setPageInfo(pager);
|
||||
// FansInfoCountVO fansInfoCountVO = fansConsumReturnService.sumFansConsumReturnInfo(merchantCode);
|
||||
// if (fansInfoCountVO != null) {
|
||||
pageVO.setFansConsumMonyNowDayCount(StringUtil.bigDecimal(fansConsumMonyNowDayCount));
|
||||
pageVO.setFansReturnMoneyNowDayCount(StringUtil.bigDecimal(fansReturnMoneyNowDayCount));
|
||||
// }
|
||||
return ResultGenerator.genSuccessResult(pageVO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "FansConsumReturn", value = "待添加的FansConsumReturn实例", paramType = "body", dataType = "FansConsumReturn", required = true) })
|
||||
public Result add(@RequestBody FansConsumReturn fansConsumReturn) {
|
||||
fansConsumReturnService.saveFansConsumReturn(fansConsumReturn);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "FansConsumReturn", value = "更新的FansConsumReturn实例", paramType = "body", dataType = "FansConsumReturn", required = true) })
|
||||
public Result update(@RequestBody FansConsumReturn fansConsumReturn) {
|
||||
fansConsumReturnService.updateFansConsumReturn(fansConsumReturn);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0") })
|
||||
public Result detail(@PathVariable Long id) {
|
||||
FansConsumReturn fansConsumReturn = new FansConsumReturn();
|
||||
fansConsumReturn.setId(id.intValue());
|
||||
fansConsumReturn = fansConsumReturnService.queryFansConsumReturn(fansConsumReturn);
|
||||
return ResultGenerator.genSuccessResult(fansConsumReturn);
|
||||
}
|
||||
|
||||
@GetMapping("/rewards")
|
||||
@ApiOperation(tags = {"页面-粉丝_粉丝消费", "页面-粉丝_粉丝奖励"}, value = "获取粉丝奖励数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "merchantCode", value = "商家Code", paramType = "merchantCode", dataType = "String", required = true), })
|
||||
public Result<FansSumRewardsInfoVO> listRewards(String merchantCode) {
|
||||
UserApp tokenUa = uaService.queryUserAppByToken();
|
||||
merchantCode = tokenUa.getMerchantCode();
|
||||
Map<String, Object> map= new HashMap<>();
|
||||
map.put("merchantCode", merchantCode);
|
||||
FansSumRewardsInfoVO fVO = new FansSumRewardsInfoVO();
|
||||
Double sumFansAllowCashMoney = fansConsumReturnService.sumFansAllowCashMoney(map);//可提现总金额
|
||||
Double sumSuccessCash = cashService.sumFansSuccessCash(map);//已经被提现的金额
|
||||
Double allowCashMoney = StringUtil.bigDecimal(sumFansAllowCashMoney - sumSuccessCash);//可提现金额
|
||||
Double sumAreadlyCash = cashService.sumFansAlreadyCash(map);//已经提现金额
|
||||
// Double noCashMoney = fansConsumReturnService.sumFansNotAllowCashMoney(map);//不可提现金额
|
||||
Double sumAllShareMoney = fansConsumReturnService.sumAllShareMoney(map);//累计分润
|
||||
map.put("startTime", DateUtils.getDayBegin());
|
||||
map.put("endTime", DateUtils.getDayEnd());
|
||||
Double sumNowDayShareMoney = fansConsumReturnService.sumNowDayShareMoney(map);// 今日分润
|
||||
Double noCashMoney=sumNowDayShareMoney;
|
||||
fVO.setAllowCashMoney(allowCashMoney);
|
||||
fVO.setNoCashMoney(noCashMoney);
|
||||
fVO.setSumAllShareMoney(sumAllShareMoney);
|
||||
fVO.setSumAreadlyCash(sumAreadlyCash);
|
||||
fVO.setSumNowDayShareMoney(sumNowDayShareMoney);
|
||||
return ResultGenerator.genSuccessResult(fVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.Fans;
|
||||
import cn.pluss.platform.entity.MerchantBaseInfo;
|
||||
import cn.pluss.platform.entity.MerchantOrder;
|
||||
import cn.pluss.platform.fans.FansService;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantOrder.MerchantOrderService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import cn.pluss.platform.vo.PageFansVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/fans")
|
||||
@Transactional
|
||||
@Api(value = "Fans控制类", tags = { "Fans接口" })
|
||||
public class FansController {
|
||||
|
||||
@Resource
|
||||
private FansService fansService;
|
||||
|
||||
@Resource
|
||||
private MerchantBaseInfoService merchantBaseInfoService;
|
||||
@Resource
|
||||
private MerchantOrderService merchantOrderService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(tags = {"页面-粉丝_粉丝"}, value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "merchantCode", value = "商家Code", paramType = "merchantCode", dataType = "String", required = true), })
|
||||
public Result<PageFansVO> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size, String merchantCode,String startTime ,String endTime) {
|
||||
PageFansVO pageVO = new PageFansVO();
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
|
||||
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("merchantCode", merchantCode);
|
||||
map.put("offset", (page - 1) * size);
|
||||
try {
|
||||
if(StringUtil.isNotEmpty(startTime)) {
|
||||
map.put("startTime", sdf.parse(startTime));
|
||||
}
|
||||
if(StringUtil.isNotEmpty(endTime)) {
|
||||
map.put("endTime", sdf.parse(endTime));
|
||||
}
|
||||
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<Fans> fansList = fansService.queryFansPage(map);
|
||||
for (Fans fans : fansList) {
|
||||
MerchantOrder merchantOrder=new MerchantOrder();
|
||||
merchantOrder.setOrderNumber(fans.getOrderNumber());
|
||||
List<MerchantOrder> merchantOrderList=merchantOrderService.list(new QueryWrapper<>(merchantOrder));
|
||||
if(merchantOrderList!=null&&merchantOrderList.size()>0) {
|
||||
MerchantBaseInfo merchantBaseInfo=new MerchantBaseInfo();
|
||||
merchantBaseInfo.setMerchantCode(merchantOrderList.get(0).getMerchantCode());
|
||||
merchantBaseInfo=merchantBaseInfoService.queryMerchantBaseInfo(merchantBaseInfo);
|
||||
if(null!=merchantBaseInfo&&StringUtil.isNotEmpty(merchantBaseInfo.getAlias())) {
|
||||
fans.setAlias(merchantBaseInfo.getAlias());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!StringUtil.isEmpty(fans.getNickName())) {
|
||||
try {
|
||||
fans.setNickName(URLDecoder.decode(fans.getNickName(), "UTF-8"));
|
||||
fans.setNickName(URLDecoder.decode(fans.getNickName(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Fans.updateOrderTypeDesc(fans);
|
||||
}
|
||||
Integer count = fansService.queryFansPageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<Fans> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count,size), page.longValue(), size.longValue(), fansList);
|
||||
pageVO.setPageInfo(pager);
|
||||
pageVO.setFansCount(count);
|
||||
Double fansDealMoney = fansService.sumConsumMoneyByMerchantCode(map);
|
||||
pageVO.setFansDealMoney(fansDealMoney);
|
||||
return ResultGenerator.genSuccessResult(pageVO);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Fans", value = "待添加的Fans实例", paramType = "body", dataType = "Fans", required = true) })
|
||||
public Result add(@RequestBody Fans fans) {
|
||||
fansService.saveFans(fans);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true) })
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
Fans fans = new Fans();
|
||||
fans.setId(id);
|
||||
fansService.deleteFans(fans);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Fans", value = "更新的Fans实例", paramType = "body", dataType = "Fans", required = true) })
|
||||
public Result update(@RequestBody Fans fans) {
|
||||
fansService.updateFans(fans);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0") })
|
||||
public Result detail(@PathVariable Long id) {
|
||||
Fans fans = new Fans();
|
||||
fans.setId(id.intValue());
|
||||
fans = fansService.queryFans(fans);
|
||||
return ResultGenerator.genSuccessResult(fans);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.HelpVideo;
|
||||
import cn.pluss.platform.helpVideo.HelpVideoService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/helpVideo")
|
||||
@Transactional
|
||||
@Api(value = "HelpVideo控制类",tags={"HelpVideo接口"})
|
||||
public class HelpVideoController{
|
||||
|
||||
@Resource
|
||||
private HelpVideoService helpVideoService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部",notes = "返回分页过后的数据",httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page",value = "查询页码", paramType = "query",dataType = "Integer",defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size",value = "每页数据量", paramType = "query",dataType = "Integer",defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<HelpVideo>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if(size==null||size==0) {
|
||||
size=ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if(page==null||page==0) {
|
||||
page=1;
|
||||
}
|
||||
Map<String,Object> map= new HashMap<>();
|
||||
map.put("pageSize",size);
|
||||
map.put("offset", (page-1)*size);
|
||||
List<HelpVideo> helpVideoList = helpVideoService.queryHelpVideoPage(map);
|
||||
Integer count= helpVideoService.queryHelpVideoPageCount(map);
|
||||
//返回参数
|
||||
PageInfo<HelpVideo> pager=new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count,size), page.longValue(), size.longValue(), helpVideoList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据",notes = "添加新的数据",httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "HelpVideo",value = "待添加的HelpVideo实例",paramType = "body",dataType = "HelpVideo",required = true)
|
||||
})
|
||||
public Result add(@RequestBody HelpVideo helpVideo) {
|
||||
helpVideoService.saveHelpVideo(helpVideo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据",notes = "根据id删除数据",httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id",value = "查询的id实例",paramType = "path",dataType = "Integer",required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
HelpVideo helpVideo = new HelpVideo();
|
||||
helpVideo.setId(id);
|
||||
helpVideoService.deleteHelpVideo(helpVideo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据",notes = "根据内容更新数据",httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "HelpVideo",value = "更新的HelpVideo实例",paramType = "body",dataType = "HelpVideo",required = true)
|
||||
})
|
||||
public Result update(@RequestBody HelpVideo helpVideo) {
|
||||
helpVideoService.updateHelpVideo(helpVideo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值",notes = "查看单个项目的内容",httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id",value = "查询的id", paramType = "path",required = true,dataType = "Integer",defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
HelpVideo helpVideo = new HelpVideo();
|
||||
helpVideo.setId(id.intValue());
|
||||
helpVideo=helpVideoService.queryHelpVideo(helpVideo);
|
||||
return ResultGenerator.genSuccessResult(helpVideo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/home")
|
||||
public class HomePageController {
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
|
||||
import cn.pluss.platform.IdCardService;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.base.BaseModelController;
|
||||
import cn.pluss.platform.entity.IdCard;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 身份证信息表, 图片信息在tb_pluss_merchant_image表中 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Djh
|
||||
* @since 2020-10-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/idcard")
|
||||
public class IdcardController extends BaseModelController<IdCardService, IdCard> {
|
||||
|
||||
@Autowired
|
||||
private IdCardService idCardService;
|
||||
|
||||
@GetMapping("/faceCertInfo")
|
||||
public Result<IdCard> faceCertInfo() {
|
||||
IdCard idCard = idCardService.apiGetFaceCertInfo();
|
||||
return ResultGenerator.genSuccessResult(idCard);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.jiguang.common.utils.StringUtils;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.appGuide.AppGuideService;
|
||||
import cn.pluss.platform.entity.AppGuide;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author djh
|
||||
* 简介富文本内容
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/intro")
|
||||
public class IntroduceController {
|
||||
|
||||
@Autowired
|
||||
private AppGuideService appGuideService;
|
||||
|
||||
@GetMapping({"/common", "/common/{code}"})
|
||||
public Result<String> billIntro(@PathVariable(value = "code", required = false) String code) {
|
||||
if (StringUtils.isEmpty(code)) {
|
||||
String html = "<p><img src=\"https://www.shouyinbei.net/resources/images/upload/82031620725808697.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/86751620725811158.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/38401620725814105.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/14561620725816223.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/45071620725822267.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/31221620725827105.jpg\" style=\"\"/></p><p><img src=\"https://www.shouyinbei.net/resources/images/upload/68211620725829889.jpg\" style=\"\"/></p><p><br/></p>";
|
||||
return ResultGenerator.genSuccessResult(html);
|
||||
}
|
||||
|
||||
AppGuide entity = appGuideService.getByCode(code);
|
||||
return ResultGenerator.genSuccessResult(entity == null? "": entity.getContent());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.LeshuaMakeMoney;
|
||||
import cn.pluss.platform.leshuaMakeMoney.LeshuaMakeMoneyService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/leshuaMakeMoney")
|
||||
@Api(value = "LeshuaMakeMoney控制类", tags = {"LeshuaMakeMoney接口"})
|
||||
public class LeshuaMakeMoneyController {
|
||||
|
||||
@Resource
|
||||
private LeshuaMakeMoneyService leshuaMakeMoneyService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<LeshuaMakeMoney>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<LeshuaMakeMoney> leshuaMakeMoneyList = leshuaMakeMoneyService.queryLeshuaMakeMoneyPage(map);
|
||||
Integer count = leshuaMakeMoneyService.queryLeshuaMakeMoneyPageCount(map);
|
||||
//返回参数
|
||||
PageInfo<LeshuaMakeMoney> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), leshuaMakeMoneyList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "LeshuaMakeMoney", value = "更新的LeshuaMakeMoney实例", paramType = "body", dataType = "LeshuaMakeMoney", required = true)
|
||||
})
|
||||
public Result update(@RequestBody LeshuaMakeMoney leshuaMakeMoney) {
|
||||
leshuaMakeMoneyService.updateLeshuaMakeMoney(leshuaMakeMoney);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
LeshuaMakeMoney leshuaMakeMoney = new LeshuaMakeMoney();
|
||||
leshuaMakeMoney.setId(id);
|
||||
leshuaMakeMoney = leshuaMakeMoneyService.queryLeshuaMakeMoney(leshuaMakeMoney);
|
||||
return ResultGenerator.genSuccessResult(leshuaMakeMoney);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.Level;
|
||||
import cn.pluss.platform.entity.SystemConfig;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.level.LevelService;
|
||||
import cn.pluss.platform.systemConfig.SystemConfigService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/level")
|
||||
@RequiredArgsConstructor
|
||||
@Api(value = "Level控制类", tags = {"Level接口"})
|
||||
public class LevelController {
|
||||
|
||||
private final UserAppService userAppService;
|
||||
private final LevelService levelService;
|
||||
|
||||
private final SystemConfigService configService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<Level>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<Level> levelList = levelService.queryLevelPage(map);
|
||||
Integer count = levelService.queryLevelPageCount(map);
|
||||
//返回参数
|
||||
PageInfo<Level> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), levelList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Level", value = "待添加的Level实例", paramType = "body", dataType = "Level", required = true)
|
||||
})
|
||||
public Result add(@RequestBody Level level) {
|
||||
levelService.saveLevel(level);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Long id) {
|
||||
Level level = new Level();
|
||||
level.setId(id);
|
||||
levelService.deleteLevel(level);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Level", value = "更新的Level实例", paramType = "body", dataType = "Level", required = true)
|
||||
})
|
||||
public Result update(@RequestBody Level level) {
|
||||
levelService.updateLevel(level);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<Object> detail(@PathVariable Long id) {
|
||||
Level level = new Level();
|
||||
level.setId(id);
|
||||
level = levelService.queryLevel(level);
|
||||
return ResultGenerator.genSuccessResult(level);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/upgradeImg")
|
||||
public Result<String> getUpgradeImg() {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
|
||||
SystemConfig systemConfig = new SystemConfig();
|
||||
if (userApp.getLevel() == 1) {
|
||||
systemConfig.setPropertyKey("twoUpVipImg");
|
||||
} else if (userApp.getLevel() == 2) {
|
||||
systemConfig.setPropertyKey("threeUpVipImg");
|
||||
} else {
|
||||
return ResultGenerator.genSuccessResult("当前商户已是最高级别", null);
|
||||
}
|
||||
|
||||
systemConfig = configService.querySystemConfig(systemConfig);
|
||||
return ResultGenerator.genSuccessResult(systemConfig.getPropertyValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.app.MainPageService;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class MainPageController {
|
||||
|
||||
@Autowired
|
||||
private UserAppService userAppService;
|
||||
|
||||
@Autowired
|
||||
private MainPageService promoterMainPageService;
|
||||
|
||||
@Autowired
|
||||
private MainPageService agentStaffMainPageService;
|
||||
|
||||
/**
|
||||
* @page 商户推广
|
||||
* 查询推广页统计数据
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/userApp/queryPromotePageData")
|
||||
@ApiOperation(tags = {"页面-商户推广"}, value = "查询推广页统计数据", notes = "查询推广页统计数据", httpMethod = "POST")
|
||||
public Result<?> getSpreadData() {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
Map<String, Object> resultMap;
|
||||
|
||||
if ("agent_staff".equals(userApp.getUserType())) {
|
||||
resultMap = agentStaffMainPageService.getSpreadData(userApp.getUserId() + "");
|
||||
} else {
|
||||
resultMap = promoterMainPageService.getSpreadData(userApp.getUserId() + "");
|
||||
}
|
||||
|
||||
return ResultGenerator.genSuccessResult(resultMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.SxfMccInfoService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.entity.SxfMccInfo;
|
||||
import cn.pluss.platform.util.PageUtils;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mccInfo")
|
||||
@Transactional
|
||||
@Api(value = "MccInfo控制类", tags = {"MccInfo接口"})
|
||||
public class MccInfoController {
|
||||
|
||||
@Autowired
|
||||
private SxfMccInfoService sxfMccInfoService;
|
||||
|
||||
@GetMapping("/pageData")
|
||||
public Result<PageInfo<SxfMccInfo>> pageData(Page<SxfMccInfo> page, String keyWord) {
|
||||
Page<SxfMccInfo> sxfMccInfoPage = sxfMccInfoService.pageData(page, keyWord);
|
||||
return ResultGenerator.genSuccessResult(PageUtils.page(sxfMccInfoPage));
|
||||
}
|
||||
|
||||
@GetMapping("/treeData")
|
||||
public Result<JSONArray> treeData() {
|
||||
JSONArray resultArr = sxfMccInfoService.treeData();
|
||||
return ResultGenerator.genSuccessResult(resultArr);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,355 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.PageVO;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.*;
|
||||
import cn.pluss.platform.memberOrder.MemberOrderService;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantMenber.MerchantMenberService;
|
||||
import cn.pluss.platform.merchantMenberComsume.MerchantMenberComsumeService;
|
||||
import cn.pluss.platform.merchantMenberRecharge.MerchantMenberRechargeService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.DateUtils;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import cn.pluss.platform.vo.MemberOrderNumberVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.val;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/memberOrder")
|
||||
@Transactional
|
||||
@Api(value = "MemberOrder控制类", tags = {"MemberOrder接口"})
|
||||
public class MemberOrderController {
|
||||
|
||||
private final MemberOrderService memberOrderService;
|
||||
|
||||
private final MerchantMenberService merchantMenberService;
|
||||
|
||||
private final MerchantMenberComsumeService merchantMenberComsumeService;
|
||||
|
||||
private final MerchantMenberRechargeService merchantMenberRechargeService;
|
||||
|
||||
private final MerchantBaseInfoService merchantBaseInfoService;
|
||||
|
||||
private final UserAppService userAppService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "memberCode", value = "要查询的会员编码", paramType = "query", dataType = "String", required = true)})
|
||||
public Result<PageInfo<MemberOrder>> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size, @RequestParam String memberCode) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
map.put("memberCode", memberCode);
|
||||
map.put("orderStatus", "1");
|
||||
List<MemberOrder> memberOrderList = memberOrderService.queryMemberOrderPage(map);
|
||||
for (MemberOrder memberOrder : memberOrderList) {
|
||||
if ("1".equals(memberOrder.getOrderType())) {
|
||||
MerchantMenberRecharge merchantMenberRecharge = new MerchantMenberRecharge();
|
||||
merchantMenberRecharge.setOrderNumber(memberOrder.getOrderNumber());
|
||||
merchantMenberRecharge = merchantMenberRechargeService.queryMerchantMenberRecharge(merchantMenberRecharge);
|
||||
if (null != merchantMenberRecharge) {
|
||||
memberOrder.setGiveMoney(StringUtil.bigDecimal(merchantMenberRecharge.getGiveMoney() == null ? new Double(0) : merchantMenberRecharge.getGiveMoney()) + "");
|
||||
}
|
||||
} else if ("0".equals(memberOrder.getOrderType())) {
|
||||
MerchantMenberComsume menberComsume = new MerchantMenberComsume();
|
||||
menberComsume.setOrderNumber(memberOrder.getOrderNumber());
|
||||
menberComsume = merchantMenberComsumeService.queryMerchantMenberComsume(menberComsume);
|
||||
if (null != menberComsume) {
|
||||
memberOrder.setGiveMoney(StringUtil.bigDecimal(menberComsume.getGiveMoney() == null ? new Double(0) : menberComsume.getGiveMoney()) + "");
|
||||
}
|
||||
}
|
||||
|
||||
MemberOrder.updateOrderTypeDesc(memberOrder);
|
||||
}
|
||||
Integer count = memberOrderService.queryMemberOrderPageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<MemberOrder> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count,size), page.longValue(), size.longValue(),
|
||||
memberOrderList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MemberOrder", value = "待添加的MemberOrder实例", paramType = "body", dataType = "MemberOrder", required = true)})
|
||||
public Result add(@RequestBody MemberOrder memberOrder) {
|
||||
memberOrderService.saveMemberOrder(memberOrder);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PostMapping("/queryMemberOrderCensusData")
|
||||
@ApiOperation(value = "查询会员订单统计数据", notes = "查询会员订单统计数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MemberOrder", value = "需要查询的会员信息", paramType = "body", dataType = "MemberOrder", required = true)})
|
||||
public Result queryMemberOrderCensusData(@RequestBody MemberOrder memberOrder) throws ParseException {
|
||||
UserApp tokenUa = userAppService.queryUserAppByToken();
|
||||
memberOrder.setMerchantCode(tokenUa.getMerchantCode());
|
||||
|
||||
if (StringUtil.isEmpty(memberOrder.getMerchantCode())) {
|
||||
return ResultGenerator.genFailResult("无商家编码!");
|
||||
}
|
||||
|
||||
Map<String, Object> queryMap = new HashMap<String, Object>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
//校验查询条件
|
||||
if (!StringUtil.isEmpty(memberOrder.getStartTime()) && !DateUtils.isDate(memberOrder.getStartTime(), "yyyy-MM-dd HH:mm")) {
|
||||
return ResultGenerator.genFailResult("初始时间不正确!");
|
||||
}
|
||||
if (!StringUtil.isEmpty(memberOrder.getEndTime()) && !DateUtils.isDate(memberOrder.getEndTime(), "yyyy-MM-dd HH:mm")) {
|
||||
|
||||
return ResultGenerator.genFailResult("结束时间不正确!");
|
||||
}
|
||||
|
||||
if (memberOrder.getSize() == null || memberOrder.getSize() == 0) {
|
||||
memberOrder.setSize(ProjectConstant.PAGE_SIZE);
|
||||
}
|
||||
if (memberOrder.getPage() == null || memberOrder.getPage() == 0) {
|
||||
memberOrder.setPage(1);
|
||||
}
|
||||
|
||||
|
||||
if (StringUtil.isEmpty(memberOrder.getStartTime())) {
|
||||
queryMap.put("startTime", DateUtils.getDayBegin());
|
||||
} else {
|
||||
queryMap.put("startTime", DateUtils.getDayStartTime(sdf.parse(memberOrder.getStartTime())));
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(memberOrder.getEndTime())) {
|
||||
queryMap.put("endTime", DateUtils.getDayEnd());
|
||||
} else {
|
||||
queryMap.put("endTime", DateUtils.getDayEndTime(sdf.parse(memberOrder.getEndTime())));
|
||||
}
|
||||
queryMap.put("merchantCode", memberOrder.getMerchantCode());
|
||||
queryMap.put("pageSize", memberOrder.getSize());
|
||||
queryMap.put("offset", (memberOrder.getPage() - 1) * memberOrder.getSize());
|
||||
List<MemberOrder> memberOrderList = memberOrderService.queryMemberOrderPageByTime(queryMap);
|
||||
Integer count = memberOrderService.queryMemberOrderPageCountByTime(queryMap);
|
||||
// 返回参数
|
||||
PageInfo pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, memberOrder.getSize()), memberOrder.getPage().longValue(), memberOrder.getSize().longValue(),
|
||||
memberOrderList);
|
||||
|
||||
//查询会员充值金额
|
||||
queryMap.put("orderType", 1);
|
||||
Double totalRechargeFee = memberOrderService.queryMemberOrderTotalOrderFeeByTime(queryMap);
|
||||
|
||||
//查询会员消费金额
|
||||
queryMap.put("orderType", 0);
|
||||
Double totalConsumeFee = memberOrderService.queryMemberOrderTotalOrderFeeByTime(queryMap);
|
||||
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("totalRechargeFee", totalRechargeFee);
|
||||
result.put("totalConsumeFee", totalConsumeFee);
|
||||
result.put("pager", pager);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
MemberOrder memberOrder = new MemberOrder();
|
||||
memberOrder.setId(id);
|
||||
memberOrderService.deleteMemberOrder(memberOrder);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MemberOrder", value = "更新的MemberOrder实例", paramType = "body", dataType = "MemberOrder", required = true)})
|
||||
public Result update(@RequestBody MemberOrder memberOrder) {
|
||||
memberOrderService.updateMemberOrder(memberOrder);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
MemberOrder memberOrder = new MemberOrder();
|
||||
memberOrder.setId(id.intValue());
|
||||
memberOrder = memberOrderService.queryMemberOrder(memberOrder);
|
||||
return ResultGenerator.genSuccessResult(memberOrder);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/queryMemberOrderList")
|
||||
@ApiOperation(tags = {"页面-账单_会员"}, value = "查询当前商家会员订单集合", notes = "查询当前商家会员订单集合", httpMethod = "POST")
|
||||
public Result<PageVO<MemberOrderNumberVO>> queryMemberOrderList(@RequestBody MemberOrder memberOrder) {
|
||||
UserApp tokenUa = userAppService.queryUserAppByToken();
|
||||
memberOrder.setMerchantCode(tokenUa.getMerchantCode());
|
||||
|
||||
if (StringUtil.isEmpty(memberOrder.getMerchantCode())) {
|
||||
return ResultGenerator.genFailResult("无商家编码!");
|
||||
}
|
||||
|
||||
Map<String, Object> queryMap = new HashMap<>();
|
||||
SimpleDateFormat sdfLong = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if (StringUtil.isNotEmpty(memberOrder.getStartTime())) {
|
||||
queryMap.put("startTime", memberOrder.getStartTime());
|
||||
} else {
|
||||
queryMap.put("startTime", sdfLong.format(DateUtils.getDayBegin()));
|
||||
}
|
||||
if (StringUtil.isNotEmpty(memberOrder.getEndTime())) {
|
||||
queryMap.put("endTime", memberOrder.getEndTime());
|
||||
} else {
|
||||
queryMap.put("endTime", sdfLong.format(DateUtils.getDayEnd()));
|
||||
}
|
||||
if (StringUtil.isNotEmpty(memberOrder.getOrderType())) {//订单类型 0:会员消费 1:会员充值
|
||||
queryMap.put("orderType", memberOrder.getOrderType());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(memberOrder.getRechargeType())) {
|
||||
queryMap.put("rechargeType", memberOrder.getRechargeType());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(memberOrder.getMerchantCode())) {
|
||||
queryMap.put("merchantCode", memberOrder.getMerchantCode());
|
||||
}
|
||||
if (memberOrder.getSize() == null || memberOrder.getSize() == 0) {
|
||||
memberOrder.setSize(ProjectConstant.PAGE_SIZE);
|
||||
}
|
||||
if (memberOrder.getPage() == null || memberOrder.getPage() == 0) {
|
||||
memberOrder.setPage(1);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(memberOrder.getStaffCode())) {//员工集合
|
||||
String[] staffCode = memberOrder.getStaffCode().split(",");
|
||||
List<String> staffCodeList = new ArrayList<>(Arrays.asList(staffCode));
|
||||
queryMap.put("staffCodeList", staffCodeList);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(memberOrder.getStoreId())) {//门店集合
|
||||
String[] storeId = memberOrder.getStoreId().split(",");
|
||||
List<String> storeIdList = new ArrayList<>(Arrays.asList(storeId));
|
||||
queryMap.put("storeIdList", storeIdList);
|
||||
}
|
||||
queryMap.put("pageSize", memberOrder.getSize());
|
||||
queryMap.put("orderStatus", "1");
|
||||
queryMap.put("offset", (memberOrder.getPage() - 1) * memberOrder.getSize());
|
||||
List<MemberOrder> memberOrderList = memberOrderService.queryMemberOrderPageByTime(queryMap);
|
||||
List<MemberOrder> orderList = new ArrayList<>();
|
||||
|
||||
if (memberOrderList != null && memberOrderList.size() > 0) {
|
||||
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();
|
||||
merchantBaseInfo.setMerchantCode(memberOrderList.get(0).getMerchantCode());
|
||||
merchantBaseInfo = merchantBaseInfoService.queryMerchantBaseInfo(merchantBaseInfo);
|
||||
|
||||
UserApp userApp = new UserApp();
|
||||
userApp.setUserType("promoter");
|
||||
userApp.setMerchantCode(memberOrderList.get(0).getMerchantCode());
|
||||
userApp = userAppService.queryUserApp(userApp);
|
||||
|
||||
for (MemberOrder o : memberOrderList) {
|
||||
//待支付剔除
|
||||
if ("0".equals(o.getOrderStatus())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MerchantMenber member = new MerchantMenber();
|
||||
member.setMemberCode(o.getMemberCode());
|
||||
member = merchantMenberService.queryMerchantMenber(member);
|
||||
if (member != null && StringUtil.isNotEmpty(member.getLogo())) {
|
||||
o.setLogo(member.getLogo());
|
||||
}
|
||||
String orderType = o.getOrderType();
|
||||
if (StringUtil.isNotEmpty(orderType)) {
|
||||
if ("1".equals(orderType)) {
|
||||
MerchantMenberRecharge merchantMenberRecharge = new MerchantMenberRecharge();
|
||||
merchantMenberRecharge.setOrderNumber(o.getOrderNumber());
|
||||
merchantMenberRecharge = merchantMenberRechargeService.queryMerchantMenberRecharge(merchantMenberRecharge);
|
||||
if (null != merchantMenberRecharge) {
|
||||
o.setGiveMoney(StringUtil.bigDecimal(merchantMenberRecharge.getGiveMoney() == null ? new Double(0) : merchantMenberRecharge.getGiveMoney()) + "");
|
||||
}
|
||||
} else if ("0".equals(orderType)) {
|
||||
MerchantMenberComsume menberComsume = new MerchantMenberComsume();
|
||||
menberComsume.setOrderNumber(o.getOrderNumber());
|
||||
menberComsume = merchantMenberComsumeService.queryMerchantMenberComsume(menberComsume);
|
||||
if (null != menberComsume) {
|
||||
o.setGiveMoney(StringUtil.bigDecimal(menberComsume.getGiveMoney() == null ? new Double(0) : menberComsume.getGiveMoney()) + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
o.setAlias(merchantBaseInfo.getAlias());
|
||||
MemberOrder.updateStaffName(o, userApp);
|
||||
MemberOrder.updateOrderTypeDesc(o);
|
||||
orderList.add(o);
|
||||
}
|
||||
}
|
||||
|
||||
queryMap.put("isPay", "isPay");
|
||||
// Integer count = memberOrderService.queryMemberOrderPageCountByTime(queryMap);
|
||||
Map<String, Map<String, Object>> countMap = memberOrderService.queryMemberOrderCountByTimeGroupData(queryMap);
|
||||
Map<String, Object> countMap1 = countMap.get("1");
|
||||
Map<String, Object> countMap0 = countMap.get("0");
|
||||
int chargeCount;
|
||||
if (countMap1 != null) {
|
||||
chargeCount = countMap1.get("count") == null? 0: Integer.parseInt(countMap1.get("count") + "");
|
||||
} else {
|
||||
chargeCount = 0;
|
||||
}
|
||||
|
||||
int consumeCount;
|
||||
if (countMap0 != null) {
|
||||
consumeCount = countMap0.get("count") == null? 0: Integer.parseInt(countMap0.get("count") + "");
|
||||
} else {
|
||||
consumeCount = 0;
|
||||
}
|
||||
|
||||
val count = chargeCount + consumeCount;
|
||||
Double orderCount = 0d;
|
||||
if ("0".equals(memberOrder.getOrderType())) {
|
||||
queryMap.put("orderType", "0");
|
||||
//消费总金额
|
||||
orderCount = memberOrderService.sumMemberOrderMoney(queryMap);
|
||||
} else if (StringUtil.isEmpty(memberOrder.getOrderType())) {
|
||||
queryMap.put("orderType", "0");
|
||||
//消费总金额
|
||||
orderCount = memberOrderService.sumMemberOrderMoney(queryMap);
|
||||
}
|
||||
Double totalOrderFee = 0d;
|
||||
if ("1".equals(memberOrder.getOrderType())) {
|
||||
queryMap.put("orderType", "1");
|
||||
//充值总金额
|
||||
totalOrderFee = memberOrderService.sumMemberOrderMoney(queryMap);
|
||||
} else if (StringUtil.isEmpty(memberOrder.getOrderType())) {
|
||||
queryMap.put("orderType", "1");
|
||||
//充值总金额
|
||||
totalOrderFee = memberOrderService.sumMemberOrderMoney(queryMap);
|
||||
}
|
||||
MemberOrderNumberVO vo = new MemberOrderNumberVO();
|
||||
vo.setOrderCount(StringUtil.bigDecimal(orderCount == null ? new Double(0) : orderCount) + "");
|
||||
vo.setTotalOrderFee(StringUtil.bigDecimal(totalOrderFee == null ? new Double(0) : totalOrderFee) + "");
|
||||
vo.setMemberOrderList(orderList);
|
||||
vo.setChargeCount(chargeCount + "");
|
||||
vo.setConsumeCount(consumeCount + "");
|
||||
//返回参数
|
||||
PageVO<MemberOrderNumberVO> pageVO = new PageVO<>(count, StringUtil.getPageCount(count, memberOrder.getSize()), memberOrder.getPage(), memberOrder.getSize(), vo);
|
||||
return ResultGenerator.genSuccessResult(pageVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.MemberSetting;
|
||||
import cn.pluss.platform.memberSetting.MemberSettingService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/memberSetting")
|
||||
@Transactional
|
||||
@Api(value = "MemberSetting控制类", tags = {"MemberSetting接口"})
|
||||
public class MemberSettingController {
|
||||
|
||||
@Resource
|
||||
private MemberSettingService memberSettingService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<MemberSetting>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<MemberSetting> memberSettingList = memberSettingService.queryMemberSettingPage(map);
|
||||
Integer count = memberSettingService.queryMemberSettingPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<MemberSetting>(count.longValue(), (long) StringUtil.getPageCount(count,size), page.longValue(), size.longValue(), memberSettingList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(tags = {"页面-设置会员卡"}, value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MemberSetting", value = "待添加的MemberSetting实例", paramType = "body", dataType = "MemberSetting", required = true)
|
||||
})
|
||||
public Result add(@RequestBody MemberSetting memberSetting) {
|
||||
memberSettingService.saveMemberSetting(memberSetting);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
MemberSetting memberSetting = new MemberSetting();
|
||||
memberSetting.setId(id);
|
||||
memberSettingService.deleteMemberSetting(memberSetting);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MemberSetting", value = "更新的MemberSetting实例", paramType = "body", dataType = "MemberSetting", required = true)
|
||||
})
|
||||
public Result update(@RequestBody MemberSetting memberSetting) {
|
||||
memberSettingService.updateMemberSetting(memberSetting);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
MemberSetting memberSetting = new MemberSetting();
|
||||
memberSetting.setId(id.intValue());
|
||||
memberSetting = memberSettingService.queryMemberSetting(memberSetting);
|
||||
return ResultGenerator.genSuccessResult(memberSetting);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.MerchantAddress;
|
||||
import cn.pluss.platform.merchantAddress.MerchantAddressService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/merchantAddress")
|
||||
@Api(value = "MerchantAddress控制类", tags = {"MerchantAddress接口"})
|
||||
public class MerchantAddressController {
|
||||
|
||||
@Resource
|
||||
private MerchantAddressService merchantAddressService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<MerchantAddress>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<MerchantAddress> merchantAddressList = merchantAddressService.queryMerchantAddressPage(map);
|
||||
Integer count = merchantAddressService.queryMerchantAddressPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<MerchantAddress>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), merchantAddressList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantAddress", value = "待添加的MerchantAddress实例", paramType = "body", dataType = "MerchantAddress", required = true)
|
||||
})
|
||||
public Result add(@RequestBody MerchantAddress merchantAddress) {
|
||||
merchantAddress.setIsDefault("1");
|
||||
merchantAddressService.saveMerchantAddress(merchantAddress);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
MerchantAddress merchantAddress = new MerchantAddress();
|
||||
merchantAddress.setId(id);
|
||||
merchantAddressService.deleteMerchantAddress(merchantAddress);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantAddress", value = "更新的MerchantAddress实例", paramType = "body", dataType = "MerchantAddress", required = true)
|
||||
})
|
||||
public Result update(@RequestBody MerchantAddress merchantAddress) {
|
||||
merchantAddressService.updateMerchantAddress(merchantAddress);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
MerchantAddress merchantAddress = new MerchantAddress();
|
||||
merchantAddress.setId(id.intValue());
|
||||
merchantAddress = merchantAddressService.queryMerchantAddress(merchantAddress);
|
||||
return ResultGenerator.genSuccessResult(merchantAddress);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merchantBankCard")
|
||||
@Api(value = "MerchantBankCard控制类", tags = {"MerchantBankCard接口"})
|
||||
public class MerchantBankCardController {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,417 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.pluss.platform.activityActivate.ActivityActivateService;
|
||||
import cn.pluss.platform.activityConsumReturn.ActivityConsumReturnService;
|
||||
import cn.pluss.platform.activityRecharge.ActivityRechargeService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.dto.BusinessLicenseDTO;
|
||||
import cn.pluss.platform.dto.ImgDTO;
|
||||
import cn.pluss.platform.dto.MerchantBaseInfoDTO;
|
||||
import cn.pluss.platform.entity.*;
|
||||
import cn.pluss.platform.mapper.MerchantImageMapper;
|
||||
import cn.pluss.platform.mapper.MerchantRateMapper;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.userInfo.UserInfoService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import cn.pluss.platform.vo.BusinessLicenseVO;
|
||||
import cn.pluss.platform.vo.MerchantBaseInfoVO;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author djh
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/merchantBaseInfo")
|
||||
@Transactional
|
||||
@Api(value = "商家接口", tags = {"商家接口"})
|
||||
public class MerchantBaseInfoController {
|
||||
private final MerchantBaseInfoService merchantBaseInfoService;
|
||||
private final UserAppService userAppService;
|
||||
private final MerchantImageMapper merchantImageMapper;
|
||||
private final ActivityActivateService activityActivateService;
|
||||
private final ActivityConsumReturnService activityConsumReturnService;
|
||||
private final ActivityRechargeService activityRechargeService;
|
||||
private final UserInfoService userInfoService;
|
||||
private final MerchantRateMapper merchantRateMapper;
|
||||
|
||||
private final MerchantChannelStatusService mcsService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")})
|
||||
public Result<PageInfo<MerchantBaseInfo>> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<MerchantBaseInfo> merchantBaseInfoList = merchantBaseInfoService.queryMerchantBaseInfoPage(map);
|
||||
Integer count = merchantBaseInfoService.queryMerchantBaseInfoPageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<MerchantBaseInfo> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(),
|
||||
merchantBaseInfoList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantBaseInfo", value = "待添加的MerchantBaseInfo实例", paramType = "body", dataType = "MerchantBaseInfo", required = true)})
|
||||
public Result<?> add(@RequestBody MerchantBaseInfo merchantBaseInfo) {
|
||||
merchantBaseInfoService.saveMerchantBaseInfo(merchantBaseInfo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)})
|
||||
public Result<?> delete(@PathVariable Long id) {
|
||||
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();
|
||||
merchantBaseInfo.setId(id);
|
||||
merchantBaseInfoService.deleteMerchantBaseInfo(merchantBaseInfo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantBaseInfo", value = "更新的MerchantBaseInfo实例", paramType = "body", dataType = "MerchantBaseInfo", required = true)})
|
||||
public Result<?> update(@RequestBody MerchantBaseInfo merchantBaseInfo) {
|
||||
merchantBaseInfoService.updateMerchantBaseInfo(merchantBaseInfo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{merchantCode}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantCode", value = "查询的MerchantCode", paramType = "path", required = true, dataType = "String", defaultValue = "0")})
|
||||
public Result<?> detail(@PathVariable String merchantCode) {
|
||||
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();
|
||||
merchantBaseInfo.setMerchantCode(merchantCode);
|
||||
merchantBaseInfo = merchantBaseInfoService.queryMerchantBaseInfo(merchantBaseInfo);
|
||||
return ResultGenerator.genSuccessResult(merchantBaseInfo);
|
||||
}
|
||||
|
||||
@GetMapping("/saveMerchantImg")
|
||||
@ApiOperation(value = "保存照片接口", notes = "保存照片接口", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ImgDTO", value = "图片imgdto", paramType = "ImgDTO", dataType = "ImgDTO", required = true),})
|
||||
public Result<?> saveMerchantImg(@RequestBody ImgDTO imgDTO) {
|
||||
try {
|
||||
String userId = imgDTO.getUserId();
|
||||
if (StringUtil.isEmpty(userId)) {
|
||||
return ResultGenerator.genFailResult("请先登录账号");
|
||||
}
|
||||
UserApp userApp = new UserApp();
|
||||
userApp.setUserId(Long.valueOf(userId));
|
||||
List<UserApp> queryUserAppList = userAppService.queryUserAppList(userApp);
|
||||
if (queryUserAppList == null || queryUserAppList.size() == 0) {
|
||||
return ResultGenerator.genFailResult("无当前账号");
|
||||
} else {
|
||||
userApp = queryUserAppList.get(0);
|
||||
}
|
||||
Result<MerchantImage> convertImgDTO = imgDTO.convertImgDTO();
|
||||
if (400 == convertImgDTO.getCode()) {
|
||||
return convertImgDTO;
|
||||
}
|
||||
MerchantImage merchantImage = convertImgDTO.getData();
|
||||
if (StringUtil.isEmpty(userApp.getMerchantCode())) {
|
||||
String merchantCode = "M800" + DateUtil.format(new Date(), "yyyyMMdd") + StringUtil.random6V2();
|
||||
merchantImage.setMerchantCode(merchantCode);
|
||||
merchantImageMapper.insert(merchantImage);
|
||||
} else {
|
||||
String merchantCode = userApp.getMerchantCode();
|
||||
merchantImage.setMerchantCode(merchantCode);
|
||||
MerchantImage mImage = new MerchantImage();
|
||||
mImage.setMerchantCode(merchantCode);
|
||||
mImage.setPhotoType(imgDTO.getPhoneType());
|
||||
List<MerchantImage> queryMerchantImageList = merchantImageMapper.queryMerchantImageList(mImage);
|
||||
if (queryMerchantImageList != null && queryMerchantImageList.size() > 0) {
|
||||
merchantImage.setId(queryMerchantImageList.get(0).getId());
|
||||
merchantImageMapper.updateById(merchantImage);
|
||||
} else {
|
||||
merchantImageMapper.insert(merchantImage);
|
||||
}
|
||||
}
|
||||
return ResultGenerator.genSuccessResult();
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResultGenerator.genFailResult("图片保存失败,请稍后再试");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/saveMerchantBaseInfoV2")
|
||||
@ApiOperation(value = "添加/修改 商户基本资料", notes = "添加/修改 商户基本资料", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantBaseInfoDTO", value = "MerchantBaseInfoDTO实例", paramType = "body", dataType = "MerchantBaseInfoDTO", required = true)})
|
||||
public Result<?> saveMerchantBaseInfoV2(@RequestBody MerchantBaseInfoDTO merchantBaseInfoDTO) {
|
||||
try {
|
||||
merchantBaseInfoService.saveMerchantBaseInfo(merchantBaseInfoDTO);
|
||||
return ResultGenerator.genSuccessResult("保存成功");
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ResultGenerator.genFailResult("系统繁忙,请稍后再试");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/saveBusinessLicense")
|
||||
@ApiOperation(value = "添加/修改 营业执照", notes = "添加/修改 营业执照", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "", value = "实例", paramType = "body", dataType = "WxCityInfo", required = true)})
|
||||
public Result<?> saveBusinessLicense(@RequestBody BusinessLicenseDTO businessLicenseDTO) {
|
||||
merchantBaseInfoService.saveBusinessLicense(businessLicenseDTO);
|
||||
return ResultGenerator.genSuccessResult("上传营业执照信息成功");
|
||||
}
|
||||
|
||||
@GetMapping("/bussAuthDetail")
|
||||
@ApiOperation(value = "营业执照信息回显", notes = "营业执照信息回显", httpMethod = "GET")
|
||||
public Result<?> aliMerchantInfo(@RequestParam(required = true) String userId) {
|
||||
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();
|
||||
merchantBaseInfo.setUserId(userId);
|
||||
List<MerchantBaseInfo> queryMerchantBaseInfoList = merchantBaseInfoService
|
||||
.queryMerchantBaseInfoList(merchantBaseInfo);
|
||||
if (queryMerchantBaseInfoList == null || queryMerchantBaseInfoList.size() == 0) {
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
merchantBaseInfo = queryMerchantBaseInfoList.get(0);
|
||||
MerchantImage merchantImage = new MerchantImage();
|
||||
merchantImage.setMerchantCode(merchantBaseInfo.getMerchantCode());
|
||||
List<MerchantImage> queryMerchantImageList = merchantImageMapper.queryMerchantImageList(merchantImage);
|
||||
BusinessLicenseVO businessLicenseVO = BusinessLicenseVO.convertMerchantBaseInfo(merchantBaseInfo, queryMerchantImageList);
|
||||
return ResultGenerator.genSuccessResult(businessLicenseVO);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/merchantInfoDetail")
|
||||
@ApiOperation(tags = {"页面-首页"}, value = "基本资料回显", notes = "基本资料回显", httpMethod = "GET")
|
||||
public Result<?> merchantInfo() {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();
|
||||
merchantBaseInfo.setUserId(userApp.getUserId() + "");
|
||||
List<MerchantBaseInfo> queryMerchantBaseInfoList = merchantBaseInfoService.queryMerchantBaseInfoList(merchantBaseInfo);
|
||||
if (queryMerchantBaseInfoList == null || queryMerchantBaseInfoList.size() == 0) {
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
merchantBaseInfo = queryMerchantBaseInfoList.get(0);
|
||||
MerchantImage merchantImage = new MerchantImage();
|
||||
merchantImage.setMerchantCode(merchantBaseInfo.getMerchantCode());
|
||||
List<MerchantImage> queryMerchantImageList = merchantImageMapper.queryMerchantImageList(merchantImage);
|
||||
MerchantBaseInfoVO merchantBaseInfoVO = MerchantBaseInfoVO.convertMerchantBaseInfo(merchantBaseInfo, null, queryMerchantImageList);
|
||||
return ResultGenerator.genSuccessResult(merchantBaseInfoVO);
|
||||
}
|
||||
|
||||
@GetMapping("/queryMerchantActivity")
|
||||
@ApiOperation(value = "查询商家活动", notes = "查询商家活动", httpMethod = "POST")
|
||||
public Result<?> merchantActivity(@RequestParam String merchantCode) {
|
||||
Map<String, Object> result = new HashMap<String, Object>(16);
|
||||
try {
|
||||
ActivityActivate activityActivate = new ActivityActivate();
|
||||
activityActivate.setMerchantCode(merchantCode);
|
||||
List<ActivityActivate> queryActivityActivateList = activityActivateService
|
||||
.queryActivityActivateList(activityActivate);
|
||||
result.put("activityActivateList", queryActivityActivateList);
|
||||
ActivityRecharge activityRecharge = new ActivityRecharge();
|
||||
activityRecharge.setMerchantCode(merchantCode);
|
||||
List<ActivityRecharge> queryActivityRechargeList = activityRechargeService
|
||||
.queryActivityRechargeList(activityRecharge);
|
||||
result.put("activityRechargeList", queryActivityRechargeList);
|
||||
ActivityConsumReturn activityConsumReturn = new ActivityConsumReturn();
|
||||
activityConsumReturn.setMerchantCode(merchantCode);
|
||||
List<ActivityConsumReturn> queryActivityConsumReturnList = activityConsumReturnService
|
||||
.queryActivityConsumReturnList(activityConsumReturn);
|
||||
result.put("activityConsumReturnList", queryActivityConsumReturnList);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultGenerator.genFailResult("系统繁忙,请稍后再试");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/manageMerchantManageList")
|
||||
@ApiOperation(value = "多商户管理列表", notes = "多商户管理列表", httpMethod = "POST")
|
||||
public Result<?> manageMerchantManageList(@RequestBody MerchantBaseInfo merchantBaseInfo) {
|
||||
Map<String, Object> result = new HashMap<>(16);
|
||||
try {
|
||||
List<MerchantBaseInfo> queryMerchantBaseInfoList;
|
||||
merchantBaseInfo = merchantBaseInfoService.queryMerchantBaseInfo(merchantBaseInfo);
|
||||
if (null != merchantBaseInfo && StringUtil.isNotEmpty(merchantBaseInfo.getBindingCode())) {
|
||||
MerchantBaseInfo merchantBaseInfo2 = new MerchantBaseInfo();
|
||||
merchantBaseInfo2.setBindingCode(merchantBaseInfo.getBindingCode());
|
||||
queryMerchantBaseInfoList = merchantBaseInfoService.queryMerchantBaseInfoList(merchantBaseInfo2);
|
||||
} else {
|
||||
queryMerchantBaseInfoList = new ArrayList<>();
|
||||
if (merchantBaseInfo != null) {
|
||||
queryMerchantBaseInfoList.add(merchantBaseInfo);
|
||||
}
|
||||
}
|
||||
|
||||
for (MerchantBaseInfo merchantBaseInfo3 : queryMerchantBaseInfoList) {
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setId(Long.valueOf(merchantBaseInfo3.getUserId()));
|
||||
List<UserInfo> queryUserInfoList = userInfoService.queryUserInfoList(userInfo);
|
||||
MerchantChannelStatus merchantChannelStatus = mcsService.getValidData(merchantBaseInfo3.getMerchantCode());
|
||||
|
||||
if (merchantChannelStatus == null) {
|
||||
merchantBaseInfo3.setMerchantAuditStatus("0");
|
||||
} else {
|
||||
merchantBaseInfo3.setMerchantAuditStatus(merchantChannelStatus.getAppStatus());
|
||||
}
|
||||
|
||||
if (queryUserInfoList != null && queryUserInfoList.size() > 0) {
|
||||
userInfo = queryUserInfoList.get(0);
|
||||
merchantBaseInfo3.setLoginName(userInfo.getLoginName());
|
||||
merchantBaseInfo3.setPassword(userInfo.getPassword());
|
||||
}
|
||||
|
||||
MerchantImage merchantImage = new MerchantImage();
|
||||
merchantImage.setMerchantCode(merchantBaseInfo3.getMerchantCode());
|
||||
merchantImage.setPhotoType("06");
|
||||
List<MerchantImage> queryMerchantImageList = merchantImageMapper.queryMerchantImageList(merchantImage);
|
||||
if (queryMerchantImageList != null && queryMerchantImageList.size() > 0) {
|
||||
merchantImage = queryMerchantImageList.get(0);
|
||||
merchantBaseInfo3.setImgUrl(merchantImage.getPicUrl());
|
||||
}
|
||||
}
|
||||
result.put("merchantBaseInfoList", queryMerchantBaseInfoList);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultGenerator.genFailResult("系统异常");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/saveMerchantUser")
|
||||
@ApiOperation(value = "添加多商户的商户", notes = "添加多商户的商户", httpMethod = "POST")
|
||||
public Result<?> saveMerchantUser(@RequestBody MerchantBaseInfoDTO merchantBaseInfoDTO) {
|
||||
merchantBaseInfoService.saveMerchantUser(merchantBaseInfoDTO);
|
||||
return ResultGenerator.genSuccessResult("子商户添加成功");
|
||||
}
|
||||
|
||||
@PostMapping("/saveMerchantUserV2")
|
||||
@ApiOperation(value = "添加多商户的商户", notes = "添加多商户的商户", httpMethod = "POST")
|
||||
public Result<?> saveMerchantUserV2(@RequestBody MerchantBaseInfoDTO merchantBaseInfoDTO) {
|
||||
merchantBaseInfoService.saveMerchantUser(merchantBaseInfoDTO);
|
||||
return ResultGenerator.genSuccessResult("子商户添加成功");
|
||||
}
|
||||
|
||||
@GetMapping("/mchDetail")
|
||||
public Result<MerchantBaseInfoVO> getMchDetail(String userId) {
|
||||
MerchantBaseInfoVO mbiVO = merchantBaseInfoService.apiGetMchDetail(userId);
|
||||
return ResultGenerator.genSuccessResult(mbiVO);
|
||||
}
|
||||
|
||||
@PostMapping("queryFeeInfoByMchId")
|
||||
public Result<?> queryFeeInfo(@RequestBody UserApp userApp) {
|
||||
UserApp tokenUserApp = userAppService.queryUserAppByToken();
|
||||
MerchantRate merchantRate = new MerchantRate().setUserId(tokenUserApp.getUserId() + "");
|
||||
merchantRate = merchantRateMapper.selectOne(new QueryWrapper<>(merchantRate));
|
||||
|
||||
Integer rate;
|
||||
if (merchantRate != null) {
|
||||
rate = merchantRate.getCurrentRate();
|
||||
} else {
|
||||
rate = 38;
|
||||
}
|
||||
|
||||
try {
|
||||
if (StringUtil.isNotEmpty(tokenUserApp.getMerchantCode())) {
|
||||
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();
|
||||
merchantBaseInfo.setMerchantCode(tokenUserApp.getMerchantCode());
|
||||
merchantBaseInfo = merchantBaseInfoService.queryMerchantBaseInfo(merchantBaseInfo);
|
||||
if (null != merchantBaseInfo) {
|
||||
JSONObject wechatRate = new JSONObject();
|
||||
wechatRate.put("rate", rate);
|
||||
JSONObject alipayRate = new JSONObject();
|
||||
alipayRate.put("rate", rate);
|
||||
JSONObject bank = new JSONObject();
|
||||
bank.put("rate", rate);
|
||||
JSONObject alipayT1 = new JSONObject();
|
||||
alipayT1.put("t1", alipayRate);
|
||||
JSONObject wechatT1 = new JSONObject();
|
||||
wechatT1.put("t1", wechatRate);
|
||||
JSONObject bankT1 = new JSONObject();
|
||||
bankT1.put("t1", bank);
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("alipay", alipayT1);
|
||||
data.put("wechat", wechatT1);
|
||||
data.put("bank", bankT1);
|
||||
return ResultGenerator.genSuccessResult(data);
|
||||
} else {
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
} else {
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultGenerator.genFailResult("系统异常");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/setVoice")
|
||||
@ApiOperation(value = "语音播报开启或关闭", notes = "语音播报开启或关闭", httpMethod = "POST")
|
||||
public Result<?> setVoice(@RequestBody MerchantBaseInfo merchantBaseInfo) {
|
||||
UserApp tokenUa = userAppService.queryUserAppByToken();
|
||||
merchantBaseInfo.setMerchantCode(tokenUa.getMerchantCode());
|
||||
|
||||
if (StringUtil.isEmpty(merchantBaseInfo.getMerchantCode())) {
|
||||
return ResultGenerator.genFailResult("无商家编码");
|
||||
}
|
||||
if (StringUtil.isEmpty(merchantBaseInfo.getIsVoice())) {
|
||||
return ResultGenerator.genFailResult("无是否开启或关闭播报");
|
||||
}
|
||||
|
||||
try {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
userApp.setIsVoice(merchantBaseInfo.getIsVoice());
|
||||
userAppService.updateById(userApp);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultGenerator.genFailResult("系统异常");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/switchBankLargePermission")
|
||||
@ResponseBody
|
||||
public Result<?> switchBankLargePermission() {
|
||||
merchantBaseInfoService.apiSwitchBankLargePermission();
|
||||
|
||||
return ResultGenerator.genSuccessResult("操作成功", null);
|
||||
}
|
||||
|
||||
@PostMapping("/wxCertPass")
|
||||
@ResponseBody
|
||||
public Result<?> wxCertPass() {
|
||||
merchantBaseInfoService.apiWxCertPass();
|
||||
return ResultGenerator.genSuccessResult("操作成功", null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.jiguang.common.utils.StringUtils;
|
||||
import cn.pluss.platform.DeviceGoodsService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.device.DeviceService;
|
||||
import cn.pluss.platform.entity.*;
|
||||
import cn.pluss.platform.merchantDevice.MerchantDeviceService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/merchantDevice")
|
||||
@Api(value = "MerchantDevice控制类", tags = {"MerchantDevice接口"})
|
||||
public class MerchantDeviceController {
|
||||
@Resource
|
||||
private MerchantDeviceService merchantDeviceService;
|
||||
|
||||
@Resource
|
||||
private DeviceService deviceService;
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private DeviceGoodsService deviceGoodsService;
|
||||
|
||||
@Resource
|
||||
private UserAppService userAppService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<MerchantDevice>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>(16);
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
map.put("userId", userApp.getUserId());
|
||||
List<MerchantDevice> merchantDeviceList = merchantDeviceService.queryMerchantDevicePage(map);
|
||||
for (MerchantDevice d : merchantDeviceList) {
|
||||
d.setStatus(2);
|
||||
DeviceSignUnbind sign = new DeviceSignUnbind();
|
||||
sign.setMerchantCode(d.getMerchantCode());
|
||||
Device device = new Device();
|
||||
if(StringUtils.isNotEmpty(d.getOrderNo() )){
|
||||
if(d.getVenderCode() != null){
|
||||
device.setVenderCode(d.getVenderCode());
|
||||
device = deviceService.queryDevice(device);
|
||||
d.setDeviceLogo(device.getDeviceLogo());
|
||||
d.setVenderModel(device.getVenderModel());
|
||||
d.setIntroDesc(device.getIntroDesc());
|
||||
d.setName(device.getName());
|
||||
sign.setVenderCode(d.getVenderCode());
|
||||
}
|
||||
} else {
|
||||
if(d.getVenderCode() != null){
|
||||
device.setVenderCode(d.getVenderCode());
|
||||
device = deviceService.queryDevice(device);
|
||||
d.setDeviceLogo(device.getDeviceLogo());
|
||||
d.setVenderModel(device.getVenderModel());
|
||||
sign.setVenderCode(d.getVenderCode());
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(d.getDeviceLogo()) && StringUtils.isNotEmpty(d.getSn())) {
|
||||
DeviceGoods deviceGoods = deviceGoodsService.getBySn(d.getSn());
|
||||
d.setDeviceLogo(deviceGoods.getDeviceLogo());
|
||||
}
|
||||
}
|
||||
Integer count = merchantDeviceService.queryMerchantDevicePageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), merchantDeviceList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantDevice", value = "待添加的MerchantDevice实例", paramType = "body", dataType = "MerchantDevice", required = true)
|
||||
})
|
||||
public Result add(@RequestBody MerchantDevice merchantDevice) {
|
||||
merchantDeviceService.save(merchantDevice);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Long id) {
|
||||
merchantDeviceService.removeById(id);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantDevice", value = "更新的MerchantDevice实例", paramType = "body", dataType = "MerchantDevice", required = true)
|
||||
})
|
||||
public Result update(@RequestBody MerchantDevice merchantDevice) {
|
||||
merchantDeviceService.updateById(merchantDevice);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
MerchantDevice merchantDevice = new MerchantDevice();
|
||||
merchantDevice.setId(id);
|
||||
merchantDevice = merchantDeviceService.getOne(new QueryWrapper<>(merchantDevice));
|
||||
return ResultGenerator.genSuccessResult(merchantDevice);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.entity.MerchantGuide;
|
||||
import cn.pluss.platform.merchantGuide.MerchantGuideService;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author djh
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merchantGuide")
|
||||
public class MerchantGuideController {
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private MerchantGuideService merchantGuideService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public Result<Object> list() {
|
||||
List<MerchantGuide> merchantGuideList = merchantGuideService.appList();
|
||||
return ResultGenerator.genSuccessResult(merchantGuideList);
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public Result<Object> save(@RequestBody MerchantGuide entity) {
|
||||
merchantGuideService.appSave(entity);
|
||||
return ResultGenerator.genSuccessResult("保存成功", null);
|
||||
}
|
||||
|
||||
@GetMapping("/del/{id}")
|
||||
public Result<Object> del(@PathVariable("id") Integer id) {
|
||||
merchantGuideService.appDel(id);
|
||||
return ResultGenerator.genSuccessResult("删除成功", null);
|
||||
}
|
||||
|
||||
@PostMapping({"/choose"})
|
||||
public Result<Object> choose(@RequestBody MerchantGuide merchantGuide) {
|
||||
merchantGuideService.appChoose(merchantGuide);
|
||||
return ResultGenerator.genSuccessResult("操作成功", null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.jiguang.common.utils.StringUtils;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.base.BaseModelController;
|
||||
import cn.pluss.platform.entity.MerchantImage;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.merchantImage.MerchantImageService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merchantImage")
|
||||
public class MerchantImageController extends BaseModelController<MerchantImageService, MerchantImage> {
|
||||
|
||||
@Setter(onMethod_ = {@Lazy, @Autowired})
|
||||
private UserAppService userAppService;
|
||||
|
||||
/**
|
||||
* 上传图片
|
||||
*/
|
||||
@PostMapping("saveBatch")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<String> saveBatch(@RequestBody List<MerchantImage> merchantImageList) {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
if (StringUtils.isEmpty(userApp.getMerchantCode())) {
|
||||
MsgException.throwException("缺少商户基本信息");
|
||||
}
|
||||
|
||||
for (MerchantImage merchantImage: merchantImageList) {
|
||||
merchantImage.setMerchantCode(userApp.getMerchantCode());
|
||||
}
|
||||
|
||||
baseService.saveMerchantImageBatch(merchantImageList);
|
||||
|
||||
return ResultGenerator.genSuccessResult("保存成功", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.jiguang.common.utils.StringUtils;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.dto.LeshuaBillsDTO;
|
||||
import cn.pluss.platform.entity.MakeMoney;
|
||||
import cn.pluss.platform.entity.MerchantIncome;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.merchantIncome.MerchantIncomeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/merchantIncome")
|
||||
@Api(value = "MerchantIncome控制类", tags = {"MerchantIncome接口"})
|
||||
public class MerchantIncomeController {
|
||||
|
||||
@Resource
|
||||
private MerchantIncomeService merchantIncomeService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(tags = {"页面-余额"}, value = "根据日期获取对应商家指定时间段内的收益", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "merchantCode", value = "商家的编码信息", paramType = "query", dataType = "String", required = true),
|
||||
@ApiImplicitParam(name = "startTime", value = "查询的开始时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "endTime", value = "查询的结束时间", paramType = "query", dataType = "String")})
|
||||
public Result<Map<String, Object>> summary(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size, String merchantCode, @RequestParam String startTime, @RequestParam String endTime) throws ParseException {
|
||||
Map<String, Object> resultMap = merchantIncomeService.queryTotalEnterFee(merchantCode, startTime, endTime);
|
||||
return ResultGenerator.genSuccessResult(resultMap);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantIncome", value = "待添加的MerchantIncome实例", paramType = "body", dataType = "MerchantIncome", required = true)})
|
||||
public Result add(@RequestBody MerchantIncome merchantIncome) {
|
||||
merchantIncomeService.saveMerchantIncome(merchantIncome);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
MerchantIncome merchantIncome = new MerchantIncome();
|
||||
merchantIncome.setId(id);
|
||||
merchantIncomeService.deleteMerchantIncome(merchantIncome);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{dealCode}")
|
||||
@ApiOperation(value = "获取单个收益的详情", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "dealCode", value = "查询的dealCode", paramType = "path", required = true, dataType = "String")})
|
||||
public Result detail(@PathVariable String dealCode) {
|
||||
MerchantIncome merchantIncome = new MerchantIncome();
|
||||
merchantIncome.setDealCode(dealCode);
|
||||
merchantIncome = merchantIncomeService.queryMerchantIncome(merchantIncome);
|
||||
return ResultGenerator.genSuccessResult(merchantIncome);
|
||||
}
|
||||
|
||||
@PostMapping("/queryLastFiveIncome")
|
||||
@ApiOperation(value = "查询商家最后的五条收入记录", notes = "查询最后的五条收入记录", httpMethod = "GET")
|
||||
public Result<List<MerchantIncome>> queryLastFiveIncome(@RequestBody UserApp userApp) {
|
||||
return ResultGenerator.genSuccessResult(merchantIncomeService.queryLastFiveMerchantIncome2(userApp));
|
||||
}
|
||||
|
||||
@PostMapping("/queryLeshuaBills")
|
||||
@ApiOperation(tags = {"页面-余额"}, value = "查询乐刷打款账单", notes = "查询乐刷打款账单", httpMethod = "POST")
|
||||
public Result<PageInfo<MakeMoney>> queryLeshuaBills(@RequestBody LeshuaBillsDTO leshuaBillsDTO) throws ParseException {
|
||||
if (StringUtils.isEmpty(leshuaBillsDTO.getMerchantId())) {
|
||||
return ResultGenerator.genSuccessResult(new PageInfo<>(0L, 0L, 0L, 20L, new ArrayList<>()));
|
||||
}
|
||||
|
||||
PageInfo<MakeMoney> result = merchantIncomeService.queryLeshuaBills(leshuaBillsDTO);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.MerchantMenberComsume;
|
||||
import cn.pluss.platform.merchantMenberComsume.MerchantMenberComsumeService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/merchantMenberComsume")
|
||||
@Transactional
|
||||
@Api(value = "MerchantMenberComsume控制类", tags = {"MerchantMenberComsume接口"})
|
||||
public class MerchantMenberComsumeController {
|
||||
|
||||
@Resource
|
||||
private MerchantMenberComsumeService merchantMenberComsumeService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<MerchantMenberComsume>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<MerchantMenberComsume> merchantMenberComsumeList = merchantMenberComsumeService.queryMerchantMenberComsumePage(map);
|
||||
Integer count = merchantMenberComsumeService.queryMerchantMenberComsumePageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<MerchantMenberComsume>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), merchantMenberComsumeList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantMenberComsume", value = "待添加的MerchantMenberComsume实例", paramType = "body", dataType = "MerchantMenberComsume", required = true)
|
||||
})
|
||||
public Result add(@RequestBody MerchantMenberComsume merchantMenberComsume) {
|
||||
merchantMenberComsumeService.saveMerchantMenberComsume(merchantMenberComsume);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
MerchantMenberComsume merchantMenberComsume = new MerchantMenberComsume();
|
||||
merchantMenberComsume.setId(id);
|
||||
merchantMenberComsumeService.deleteMerchantMenberComsume(merchantMenberComsume);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantMenberComsume", value = "更新的MerchantMenberComsume实例", paramType = "body", dataType = "MerchantMenberComsume", required = true)
|
||||
})
|
||||
public Result update(@RequestBody MerchantMenberComsume merchantMenberComsume) {
|
||||
merchantMenberComsumeService.updateMerchantMenberComsume(merchantMenberComsume);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
MerchantMenberComsume merchantMenberComsume = new MerchantMenberComsume();
|
||||
merchantMenberComsume.setId(id.intValue());
|
||||
merchantMenberComsume = merchantMenberComsumeService.queryMerchantMenberComsume(merchantMenberComsume);
|
||||
return ResultGenerator.genSuccessResult(merchantMenberComsume);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,304 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.activityActivate.ActivityActivateService;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.ActivityActivate;
|
||||
import cn.pluss.platform.entity.MerchantMenber;
|
||||
import cn.pluss.platform.entity.MerchantMenberRecharge;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.memberOrder.MemberOrderService;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantMenber.MerchantMenberService;
|
||||
import cn.pluss.platform.merchantMenberComsume.MerchantMenberComsumeService;
|
||||
import cn.pluss.platform.merchantMenberRecharge.MerchantMenberRechargeService;
|
||||
import cn.pluss.platform.phoneValidateCode.PhoneValidateCodeService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.EmojiUtil;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/merchantMenber")
|
||||
@Transactional
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Api(value = "MerchantMenber控制类", tags = {"MerchantMenber接口"})
|
||||
public class MerchantMenberController {
|
||||
private final MerchantMenberService merchantMenberService;
|
||||
private final MerchantMenberComsumeService merchantMenberComsumeService;
|
||||
private final MerchantMenberRechargeService merchantMenberRechargeService;
|
||||
private final PhoneValidateCodeService phoneValidateCodeService;
|
||||
private final MerchantBaseInfoService merchantBaseInfoService;
|
||||
private final ActivityActivateService activityActivateService;
|
||||
private final MemberOrderService memberOrderService;
|
||||
|
||||
@Autowired @Lazy
|
||||
private UserAppService userAppService;
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(tags = {"页面-会员选择", "页面-会员_管理"}, value = "获取全部", notes = "返回分页过后的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantMenber", value = "查询对象的实例信息", paramType = "body", dataType = "MerchantMenber"),})
|
||||
public Result<PageInfo<MerchantMenber>> list(@RequestBody MerchantMenber merchantMenber) {
|
||||
UserApp tokenUa = userAppService.queryUserAppByToken();
|
||||
merchantMenber.setMerchantCode(tokenUa.getMerchantCode());
|
||||
|
||||
if (StringUtil.isEmpty(merchantMenber.getMerchantCode())) {
|
||||
return ResultGenerator.genFailResult("无商家编码!");
|
||||
}
|
||||
if (merchantMenber.getSize() == null || merchantMenber.getSize() == 0) {
|
||||
merchantMenber.setSize(ProjectConstant.PAGE_SIZE);
|
||||
}
|
||||
if (merchantMenber.getPage() == null || merchantMenber.getPage() == 0) {
|
||||
merchantMenber.setPage(1);
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", merchantMenber.getSize());
|
||||
map.put("offset", (merchantMenber.getPage() - 1) * merchantMenber.getSize());
|
||||
map.put("merchantCode", merchantMenber.getMerchantCode());
|
||||
map.put("memberCode", merchantMenber.getMemberCode());
|
||||
if (StringUtil.isNotEmpty(merchantMenber.getStoreId())) {
|
||||
map.put("storeId", merchantMenber.getStoreId());
|
||||
}
|
||||
if (!StringUtil.isEmpty(merchantMenber.getPhone()) || !StringUtil.isEmpty(merchantMenber.getMemberName())) {
|
||||
map.put("keyWord", "1");
|
||||
}
|
||||
//判断是否有检索条件
|
||||
if (StringUtil.isNotEmpty(merchantMenber.getPhone())) {
|
||||
map.put("phone", merchantMenber.getPhone());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(merchantMenber.getNickName())) {
|
||||
map.put("nickName", merchantMenber.getNickName());
|
||||
}
|
||||
List<MerchantMenber> merchantMenberList = merchantMenberService.queryMerchantMenberPage(map);
|
||||
for (MerchantMenber m : merchantMenberList) {
|
||||
Map<String, Object> orderMap = new HashMap<>();
|
||||
orderMap.put("memberCode", m.getMemberCode());
|
||||
orderMap.put("orderType", "0");
|
||||
orderMap.put("orderStatus", "1");
|
||||
Integer count = memberOrderService.queryMemberOrderPageCount(orderMap);
|
||||
m.setOrderNumber(count + "");
|
||||
|
||||
if (StringUtils.isNotBlank(m.getAppOpenId())) {
|
||||
m.setOpenid(m.getAppOpenId());
|
||||
}
|
||||
}
|
||||
Integer count = merchantMenberService.queryMerchantMenberPageCount(map);
|
||||
|
||||
for (MerchantMenber menber : merchantMenberList) {
|
||||
menber.setNickName(EmojiUtil.emojiRecovery2(menber.getNickName()));
|
||||
}
|
||||
|
||||
// 返回参数
|
||||
PageInfo<MerchantMenber> pager = new PageInfo<>(count.longValue(), (long)StringUtil.getPageCount(count, merchantMenber.getSize()),
|
||||
merchantMenber.getPage().longValue(), merchantMenber.getSize().longValue(), merchantMenberList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@GetMapping("/queryMemberIsExist")
|
||||
@ApiOperation(tags = {"会员开卡"}, value = "获取关注公众号二维码", notes = "获取关注公众号二维码", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "phone", value = "手机号"),
|
||||
@ApiImplicitParam(name = "checkCode", value = "验证码"),
|
||||
@ApiImplicitParam(name = "nickName", value = "会员名"),
|
||||
@ApiImplicitParam(name = "birthday", value = "生日"),
|
||||
})
|
||||
public Result<String> queryMemberIsExist(@RequestParam String merchantCode, String storeId,
|
||||
@RequestParam String phone, @RequestParam String checkCode,
|
||||
@RequestParam String nickName, @RequestParam String birthday) {
|
||||
|
||||
String result = merchantMenberService.queryMemberIsExist(merchantCode, storeId, phone, checkCode, nickName, birthday);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
@GetMapping("/queryMemberIsExistV2")
|
||||
@ApiOperation(tags = {"会员开卡"}, value = "获取关注公众号二维码", notes = "获取关注公众号二维码", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "merchantCode", value = "商家编码"),
|
||||
@ApiImplicitParam(name = "storeId", value = "门店Id"),
|
||||
@ApiImplicitParam(name = "phone", value = "手机号"),
|
||||
@ApiImplicitParam(name = "checkCode", value = "验证码"),
|
||||
@ApiImplicitParam(name = "nickName", value = "会员名"),
|
||||
@ApiImplicitParam(name = "birthday", value = "生日"),
|
||||
})
|
||||
public Result<String> queryMemberIsExistV2(String merchantCode, String storeId,
|
||||
@RequestParam String phone, @RequestParam String checkCode,
|
||||
@RequestParam String nickName, @RequestParam String birthday) {
|
||||
|
||||
String result = merchantMenberService.queryMemberIsExistV2(merchantCode, storeId, phone, checkCode, nickName, birthday);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
@GetMapping("/queryIsOenCardSuccess")
|
||||
@ApiOperation(value = "会员是否开卡成功", notes = "会员是否开卡成功", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "merchantCode", value = "商家编码", required = true),
|
||||
@ApiImplicitParam(name = "storeId", value = "门店Id", required = true),
|
||||
@ApiImplicitParam(name = "phone", value = "手机号", required = true),
|
||||
})
|
||||
public Result queryIsOenCardSuccess(@RequestParam String phone, @RequestParam String merchantCode, @RequestParam String storeId) {
|
||||
MerchantMenber merchantMenber = new MerchantMenber();
|
||||
merchantMenber.setStoreId(storeId);
|
||||
merchantMenber.setPhone(phone);
|
||||
merchantMenber.setMerchantCode(merchantCode);
|
||||
List<MerchantMenber> queryMerchantMenberList = merchantMenberService.queryMerchantMenberList(merchantMenber);
|
||||
if (queryMerchantMenberList != null && queryMerchantMenberList.size() > 0) {
|
||||
merchantMenber = queryMerchantMenberList.get(0);
|
||||
if (StringUtil.isEmpty(merchantMenber.getOpenid())) {
|
||||
return ResultGenerator.genFailResult("请稍等,会员还未进行绑卡");
|
||||
} else {
|
||||
return ResultGenerator.genSuccessResult("开卡成功");
|
||||
}
|
||||
} else {
|
||||
return ResultGenerator.genFailResult("开卡失败");
|
||||
}
|
||||
}
|
||||
|
||||
public void dealMemberActivity(MerchantMenber merchantMenber) {
|
||||
ActivityActivate querActivityActivate = new ActivityActivate();
|
||||
querActivityActivate.setStoreId(merchantMenber.getStoreId());
|
||||
List<ActivityActivate> activityActivateList = activityActivateService.queryActivityActivateList(querActivityActivate);
|
||||
if (activityActivateList != null && activityActivateList.size() > 0) {
|
||||
querActivityActivate = activityActivateList.get(0);
|
||||
MerchantMenberRecharge merchantMenberRecharge = new MerchantMenberRecharge();//增加会员的储值记录
|
||||
merchantMenberRecharge.setMerchantCode(merchantMenber.getMerchantCode());
|
||||
merchantMenberRecharge.setMerchantName(merchantMenber.getMerchantName());
|
||||
merchantMenberRecharge.setStoreId(merchantMenber.getStoreId());
|
||||
merchantMenberRecharge.setStoreName(merchantMenber.getStoreName());
|
||||
merchantMenberRecharge.setCreateDt(new Date());
|
||||
merchantMenberRecharge.setMemberCode(merchantMenber.getMemberCode());
|
||||
merchantMenberRecharge.setNickName(merchantMenber.getNickName());
|
||||
merchantMenberRecharge.setPhone(merchantMenber.getPhone());
|
||||
merchantMenberRecharge.setRechargeMoney(0d);
|
||||
merchantMenberRecharge.setGiveMoney(querActivityActivate.getGiveMoney());
|
||||
merchantMenberRecharge.setPayType(2);
|
||||
merchantMenberRechargeService.saveMerchantMenberRecharge(merchantMenberRecharge);
|
||||
//更新会员的赠送金额
|
||||
MerchantMenber updateMerchantMenber = new MerchantMenber();
|
||||
updateMerchantMenber.setId(merchantMenber.getId());
|
||||
if (merchantMenber.getTotalGiveFee() == null) {
|
||||
merchantMenber.setTotalGiveFee(0.0);
|
||||
}
|
||||
updateMerchantMenber.setTotalGiveFee(merchantMenber.getTotalGiveFee() + querActivityActivate.getGiveMoney());
|
||||
if (merchantMenber.getUsableGiveFee() == null) {
|
||||
merchantMenber.setUsableGiveFee(0.0);
|
||||
}
|
||||
|
||||
updateMerchantMenber.setUsableGiveFee(merchantMenber.getUsableGiveFee() + querActivityActivate.getGiveMoney());
|
||||
merchantMenberService.updateMerchantMenber(updateMerchantMenber);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
MerchantMenber merchantMenber = new MerchantMenber();
|
||||
merchantMenber.setId(id);
|
||||
merchantMenberService.deleteMerchantMenber(merchantMenber);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantMenber", value = "更新的MerchantMenber实例", paramType = "body", dataType = "MerchantMenber", required = true)})
|
||||
public Result update(@RequestBody MerchantMenber merchantMenber) {
|
||||
merchantMenberService.updateMerchantMenber(merchantMenber);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PostMapping("/queryDetailByMemberCode")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantMenber", value = "查询的实例信息", paramType = "body", required = true, dataType = "MerchantMenber")})
|
||||
public Result detail(@RequestBody MerchantMenber merchantMenber) {
|
||||
MerchantMenber queryerchantMenber = new MerchantMenber();
|
||||
queryerchantMenber.setMemberCode(merchantMenber.getMemberCode());
|
||||
queryerchantMenber = merchantMenberService.queryMerchantMenber(merchantMenber);
|
||||
return ResultGenerator.genSuccessResult(queryerchantMenber);
|
||||
}
|
||||
|
||||
@PostMapping("/queryMerchantMemberData")
|
||||
@ApiOperation(tags = {"页面-会员_数据"}, value = "查询当前商家的会员信息", notes = "查看单个项目的内容", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantMenber", value = "查询的实例信息", paramType = "body", required = true, dataType = "MerchantMenber")})
|
||||
public Result queryMerchantMemberData(@RequestBody MerchantMenber merchantMenber) {
|
||||
UserApp tokenUa = userAppService.queryUserAppByToken();
|
||||
merchantMenber.setMerchantCode(tokenUa.getMerchantCode());
|
||||
|
||||
if (StringUtil.isEmpty(merchantMenber.getMerchantCode())) {
|
||||
return ResultGenerator.genFailResult("无商家编码!");
|
||||
}
|
||||
// 当前时间毫秒数
|
||||
long current = System.currentTimeMillis();
|
||||
// 今天零点零分零秒的毫秒数
|
||||
long zeroT = current / (1000 * 3600 * 24) * (1000 * 3600 * 24) - TimeZone.getDefault().getRawOffset();
|
||||
String zero = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(zeroT);
|
||||
// 今天23点59分59秒的毫秒数
|
||||
long endT = zeroT + 24 * 60 * 60 * 1000 - 1;
|
||||
String end = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endT);
|
||||
Map<String, String> memberMap = new HashMap<>();
|
||||
memberMap.put("startTime", zero);
|
||||
memberMap.put("endTime", end);
|
||||
memberMap.put("merchantCode", merchantMenber.getMerchantCode());
|
||||
Map<String, String> totalMemberMap = new HashMap<>();
|
||||
totalMemberMap.put("endTime", end);
|
||||
totalMemberMap.put("merchantCode", merchantMenber.getMerchantCode());
|
||||
// 查询今日会员充值金额
|
||||
double todayRecharg = merchantMenberService.queryMerchantMemberBill(null, "1", merchantMenber.getMerchantCode(), zero, end);
|
||||
// 查询今日会员消费金额
|
||||
double todayConsume = merchantMenberService.queryMerchantMemberBill(null, "0", merchantMenber.getMerchantCode(), zero, end);
|
||||
// 查询今日会员线上充值金额 + app扫码充值
|
||||
double onlineRecharg = merchantMenberService.queryMerchantMemberBill("0", "1", merchantMenber.getMerchantCode(), zero, end);
|
||||
// 查询今日会员扫码充值
|
||||
double scanRecharge = merchantMenberService.queryMerchantMemberBill("2", "1", merchantMenber.getMerchantCode(), zero, end);
|
||||
// 查询今日会员现金充值金额
|
||||
double cashRecharg = merchantMenberService.queryMerchantMemberBill("1", "1", merchantMenber.getMerchantCode(), zero, end);
|
||||
// 查询会员可用充值金额
|
||||
double totalRemainRecharg = merchantMenberService.queryMerchantMenberUsableRechargeFee(totalMemberMap);
|
||||
// 查询会员充值总额
|
||||
double totalRecharg = merchantMenberService.queryMerchantMemberBill(null, "1", merchantMenber.getMerchantCode(), null, null);
|
||||
// 查询会员消费总额
|
||||
double totalConsume = merchantMenberService.queryMerchantMemberBill(null, "0", merchantMenber.getMerchantCode(), null, null);
|
||||
// 查询今日新增会员人数
|
||||
double todayRegistNum = merchantMenberService.queryMerchantMenberNumByTime(memberMap);
|
||||
// 查询所有会员数
|
||||
double totalMemberNum = merchantMenberService.queryMerchantMenberNumByTime(totalMemberMap);
|
||||
double giveReturn = merchantMenberService.queryMerchantGiveMoney(merchantMenber.getMerchantCode());
|
||||
MerchantMenber queryerchantMenber = new MerchantMenber();
|
||||
queryerchantMenber.setMerchantCode(merchantMenber.getMerchantCode());
|
||||
queryerchantMenber.setTodayRecharg(todayRecharg);
|
||||
queryerchantMenber.setTodayConsume(todayConsume);
|
||||
queryerchantMenber.setTodayRegistNum(todayRegistNum);
|
||||
queryerchantMenber.setOnlineRecharg(onlineRecharg);
|
||||
queryerchantMenber.setGiveReturn(giveReturn);
|
||||
queryerchantMenber.setCashRecharg(cashRecharg);
|
||||
queryerchantMenber.setTotalRecharg(totalRecharg);
|
||||
queryerchantMenber.setTotalRemainRecharg(totalRemainRecharg);
|
||||
queryerchantMenber.setTotalConsume(totalConsume);
|
||||
queryerchantMenber.setTotalMemberNum(totalMemberNum);
|
||||
queryerchantMenber.setScanRecharge(scanRecharge);
|
||||
return ResultGenerator.genSuccessResult(queryerchantMenber);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.MerchantMenberRecharge;
|
||||
import cn.pluss.platform.merchantMenberRecharge.MerchantMenberRechargeService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/merchantMenberRecharge")
|
||||
@Transactional
|
||||
@Api(value = "MerchantMenberRecharge控制类", tags = {"MerchantMenberRecharge接口"})
|
||||
public class MerchantMenberRechargeController {
|
||||
|
||||
@Resource
|
||||
private MerchantMenberRechargeService merchantMenberRechargeService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<MerchantMenberRecharge>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<MerchantMenberRecharge> merchantMenberRechargeList = merchantMenberRechargeService.queryMerchantMenberRechargePage(map);
|
||||
Integer count = merchantMenberRechargeService.queryMerchantMenberRechargePageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<MerchantMenberRecharge>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), merchantMenberRechargeList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantMenberRecharge", value = "待添加的MerchantMenberRecharge实例", paramType = "body", dataType = "MerchantMenberRecharge", required = true)
|
||||
})
|
||||
public Result add(@RequestBody MerchantMenberRecharge merchantMenberRecharge) {
|
||||
merchantMenberRechargeService.saveMerchantMenberRecharge(merchantMenberRecharge);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
MerchantMenberRecharge merchantMenberRecharge = new MerchantMenberRecharge();
|
||||
merchantMenberRecharge.setId(id);
|
||||
merchantMenberRechargeService.deleteMerchantMenberRecharge(merchantMenberRecharge);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantMenberRecharge", value = "更新的MerchantMenberRecharge实例", paramType = "body", dataType = "MerchantMenberRecharge", required = true)
|
||||
})
|
||||
public Result update(@RequestBody MerchantMenberRecharge merchantMenberRecharge) {
|
||||
merchantMenberRechargeService.updateMerchantMenberRecharge(merchantMenberRecharge);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
MerchantMenberRecharge merchantMenberRecharge = new MerchantMenberRecharge();
|
||||
merchantMenberRecharge.setId(id.intValue());
|
||||
merchantMenberRecharge = merchantMenberRechargeService.queryMerchantMenberRecharge(merchantMenberRecharge);
|
||||
return ResultGenerator.genSuccessResult(merchantMenberRecharge);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
|
||||
import cn.pluss.platform.annotation.OpLog;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.base.BaseModelController;
|
||||
import cn.pluss.platform.entity.MerchantMoveRecords;
|
||||
import cn.pluss.platform.merchant.move.MerchantMoveRecordsService;
|
||||
import lombok.val;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商户动态码生成记录 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author bzg
|
||||
* @since 2021-07-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merchantMoveRecords")
|
||||
public class MerchantMoveRecordsController extends BaseModelController<MerchantMoveRecordsService, MerchantMoveRecords> {
|
||||
|
||||
@OpLog(opName = "APP生成动态码", opDetail = "APP生成动态码", opCode = "APP_DYNAMIC")
|
||||
@GetMapping("/getDynamicCode")
|
||||
public Result<Object> getToken() {
|
||||
val record = baseService.createToken();
|
||||
return ResultGenerator.genSuccessResult(record);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,257 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.MerchantBaseInfo;
|
||||
import cn.pluss.platform.entity.MerchantOrder;
|
||||
import cn.pluss.platform.entity.MerchantProfit;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.mapper.MerchantProfitMapper;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantOrder.MerchantOrderService;
|
||||
import cn.pluss.platform.merchantProfit.MerchantProfitService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/merchantProfit")
|
||||
@Api(value = "MerchantProfit控制类", tags = {"MerchantProfit接口"})
|
||||
public class MerchantProfitController {
|
||||
|
||||
@Resource
|
||||
private MerchantProfitService merchantProfitService;
|
||||
@Resource
|
||||
private MerchantBaseInfoService merchantBaseInfoService;
|
||||
@Resource
|
||||
private MerchantOrderService merchantOrderService;
|
||||
@Resource
|
||||
private MerchantProfitMapper merchantProfitMapper;
|
||||
@Resource
|
||||
private UserAppService userAppService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(tags = {"页面-商户推广_交易明细"}, value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<MerchantProfit>> list(
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size,
|
||||
@RequestParam String merchantName, // 商户名称
|
||||
@RequestParam String level, //等级 1 2 3
|
||||
@RequestParam String type,//商户所属 不传全部 1直接 2 间接 3 二级间接
|
||||
@RequestParam String startTime,
|
||||
@RequestParam String endTime,
|
||||
@RequestParam(required = false, value = "agentStaffIds[]") String[] agentStaffIds) throws ParseException {
|
||||
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
|
||||
Long userId = userApp.getUserId();
|
||||
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
|
||||
if ("agent_staff".equals(userApp.getUserType())) {
|
||||
map.put("agentStaffId", userApp.getUserId());
|
||||
} else {
|
||||
if (agentStaffIds != null && agentStaffIds.length > 0) {
|
||||
String id = agentStaffIds[0];
|
||||
map.put("userId", userId);
|
||||
if ("-1".equals(id)) {
|
||||
map.put("self", true);
|
||||
} else {
|
||||
map.put("agentStaffIds", agentStaffIds);
|
||||
}
|
||||
}
|
||||
map.put("userId", userId);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(merchantName)) {
|
||||
map.put("merchantName", merchantName);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(level)) {
|
||||
map.put("level", level);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(type)) {
|
||||
map.put("type", type);
|
||||
} else {
|
||||
map.put("retype", "1");
|
||||
}
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd ahh:mm:ss");
|
||||
|
||||
if (StringUtils.isNotEmpty(startTime) ) {
|
||||
if (((startTime.contains("上午")) || (startTime.contains("下午")))) {
|
||||
map.put("startTime", sdf2.parse(startTime));
|
||||
} else {
|
||||
map.put("startTime", sdf.parse(startTime));
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(endTime) ) {
|
||||
if (((endTime.contains("上午")) || (endTime.contains("下午")))) {
|
||||
map.put("endTime", sdf2.parse(endTime));
|
||||
} else {
|
||||
map.put("endTime", sdf.parse(endTime));
|
||||
}
|
||||
}
|
||||
|
||||
List<MerchantProfit> merchantProfitList = merchantProfitService.queryMerchantProfitPage(map);
|
||||
|
||||
if (merchantProfitList != null && merchantProfitList.size() > 0) {
|
||||
|
||||
List<Map<String, Object>> rateInfoMapList = merchantProfitMapper.queryMerchantProfitRate(merchantProfitList, userApp.getUserId().toString());
|
||||
|
||||
// 商户code列表
|
||||
List<String> merchantCodeList = new ArrayList<>();
|
||||
// 订单number列表
|
||||
List<String> orderNumberList = new ArrayList<>();
|
||||
for (MerchantProfit m : merchantProfitList) {
|
||||
merchantCodeList.add(m.getMerchantCode());
|
||||
orderNumberList.add(m.getOrderNumber());
|
||||
}
|
||||
|
||||
QueryWrapper<MerchantBaseInfo> queryMerchantBaseInfo = new QueryWrapper<MerchantBaseInfo>().in("merchantCode", merchantCodeList);
|
||||
List<MerchantBaseInfo> merchantBaseInfoList = merchantBaseInfoService.list(queryMerchantBaseInfo);
|
||||
|
||||
QueryWrapper<MerchantOrder> queryMerchantOrder = new QueryWrapper<MerchantOrder>().in("orderNumber", orderNumberList);
|
||||
List<MerchantOrder> merchantOrderList = merchantOrderService.list(queryMerchantOrder);
|
||||
|
||||
for (MerchantProfit m : merchantProfitList) {
|
||||
|
||||
m.setMerchantLogo(null);
|
||||
m.setPayTypeName(m.getPayTypeName().replaceAll("乐刷|随行|随行付", ""));
|
||||
for (MerchantBaseInfo merchantBaseInfo : merchantBaseInfoList) {
|
||||
if (merchantBaseInfo.getMerchantCode().equals(m.getMerchantCode())) {
|
||||
m.setUserName(merchantBaseInfo.getContactName());
|
||||
m.setPhone(merchantBaseInfo.getContactMobile());
|
||||
m.setMerchantName(merchantBaseInfo.getAlias());
|
||||
}
|
||||
}
|
||||
|
||||
for (MerchantOrder merchantOrder : merchantOrderList) {
|
||||
if (merchantOrder.getOrderNumber().equals(m.getOrderNumber())) {
|
||||
m.setRate(merchantOrder.getRate());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m.getRate() == null) {
|
||||
m.setRate(new BigDecimal(38));
|
||||
} else {
|
||||
// TODO 暂去掉小数点后第三位,需要等 安卓app 1.7.0更新以后才可以去掉
|
||||
m.setRate(m.getRate().round(new MathContext(2, RoundingMode.DOWN)));
|
||||
}
|
||||
|
||||
// 针对普通推广者
|
||||
if (m.getProfitRate() == null) {
|
||||
if (m.getUserType().equals("promoter")) {
|
||||
switch (m.getMerchantParentLevel()) {
|
||||
case "1":
|
||||
m.setProfitRate(6);
|
||||
break;
|
||||
case "2":
|
||||
m.setProfitRate(8);
|
||||
break;
|
||||
case "3":
|
||||
m.setProfitRate(10);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
for (Map<String, Object> rateMap : rateInfoMapList) {
|
||||
// Long和int无法equals
|
||||
if ((m.getId() + "").equals(rateMap.get("id") + "")) {
|
||||
m.setProfitRate((int) rateMap.get("rateCur"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Integer count = merchantProfitService.queryMerchantProfitPageCount(map);
|
||||
|
||||
//返回参数
|
||||
PageInfo<MerchantProfit> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), merchantProfitList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantProfit", value = "待添加的MerchantProfit实例", paramType = "body", dataType = "MerchantProfit", required = true)
|
||||
})
|
||||
public Result add(@RequestBody MerchantProfit merchantProfit) {
|
||||
merchantProfitService.saveMerchantProfit(merchantProfit);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Long id) {
|
||||
MerchantProfit merchantProfit = new MerchantProfit();
|
||||
merchantProfit.setId(id);
|
||||
merchantProfitService.deleteMerchantProfit(merchantProfit);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantProfit", value = "更新的MerchantProfit实例", paramType = "body", dataType = "MerchantProfit", required = true)
|
||||
})
|
||||
public Result update(@RequestBody MerchantProfit merchantProfit) {
|
||||
merchantProfitService.updateMerchantProfit(merchantProfit);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<MerchantProfit> detail(@PathVariable Long id) {
|
||||
MerchantProfit merchantProfit = new MerchantProfit();
|
||||
merchantProfit.setId(id);
|
||||
merchantProfit = merchantProfitService.queryMerchantProfit(merchantProfit);
|
||||
return ResultGenerator.genSuccessResult(merchantProfit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.entity.MerchantQrcode;
|
||||
import cn.pluss.platform.merchantQrcode.MerchantQrcodeService;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author djh
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merQrCode")
|
||||
public class MerchantQrCodeController {
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private MerchantQrcodeService merchantQrcodeService;
|
||||
|
||||
@PostMapping("/saveMerQrcode")
|
||||
public Result<Object> saveMerQrcode(@RequestBody MerchantQrcode merchantQrcode) {
|
||||
merchantQrcodeService.saveMerQrcode(merchantQrcode);
|
||||
return ResultGenerator.genSuccessResult("二维码保存成功", null);
|
||||
}
|
||||
|
||||
@GetMapping("/removeById/{userId}")
|
||||
public Result<Object> removeMerQrcode(@PathVariable("userId") String userId) {
|
||||
merchantQrcodeService.removeByUserId(userId);
|
||||
return ResultGenerator.genSuccessResult("二维码信息清理成功", null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.base.BaseModelController;
|
||||
import cn.pluss.platform.entity.MerchantRate;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.service.agent.MerchantRateApiService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merchantRate")
|
||||
public class MerchantRateController extends BaseModelController<MerchantRateApiService, MerchantRate> {
|
||||
|
||||
/**
|
||||
* 修改下级服务商的费率
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/changeRate")
|
||||
public Result<String> setSubAgentRate(@RequestBody MerchantRate merchantRate) {
|
||||
throw new MsgException("不支持该操作");
|
||||
// baseService.setSubAgentRate(merchantRate);
|
||||
// return ResultGenerator.genSuccessResult("操作成功", null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.MerchantRateRecordService;
|
||||
import cn.pluss.platform.base.BaseModelController;
|
||||
import cn.pluss.platform.entity.MerchantRateRecord;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 费率修改记录表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Djh
|
||||
* @since 2020-09-02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merchantRateRecord")
|
||||
public class MerchantRateRecordController extends BaseModelController<MerchantRateRecordService, MerchantRateRecord> {
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.MerchantRegistAuditRecord;
|
||||
import cn.pluss.platform.merchantRegistAuditRecord.MerchantRegistAuditRecordService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/merchantRegistAuditRecord")
|
||||
@Transactional
|
||||
@Api(value = "MerchantRegistAuditRecord控制类", tags = {"MerchantRegistAuditRecord接口"})
|
||||
public class MerchantRegistAuditRecordController {
|
||||
|
||||
@Resource
|
||||
private MerchantRegistAuditRecordService merchantRegistAuditRecordService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<MerchantRegistAuditRecord>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<MerchantRegistAuditRecord> merchantRegistAuditRecordList = merchantRegistAuditRecordService.queryMerchantRegistAuditRecordPage(map);
|
||||
Integer count = merchantRegistAuditRecordService.queryMerchantRegistAuditRecordPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<MerchantRegistAuditRecord>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), merchantRegistAuditRecordList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantRegistAuditRecord", value = "待添加的MerchantRegistAuditRecord实例", paramType = "body", dataType = "MerchantRegistAuditRecord", required = true)
|
||||
})
|
||||
public Result add(@RequestBody MerchantRegistAuditRecord merchantRegistAuditRecord) {
|
||||
merchantRegistAuditRecordService.saveMerchantRegistAuditRecord(merchantRegistAuditRecord);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
MerchantRegistAuditRecord merchantRegistAuditRecord = new MerchantRegistAuditRecord();
|
||||
merchantRegistAuditRecord.setId(id.intValue());
|
||||
merchantRegistAuditRecordService.deleteMerchantRegistAuditRecord(merchantRegistAuditRecord);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantRegistAuditRecord", value = "更新的MerchantRegistAuditRecord实例", paramType = "body", dataType = "MerchantRegistAuditRecord", required = true)
|
||||
})
|
||||
public Result update(@RequestBody MerchantRegistAuditRecord merchantRegistAuditRecord) {
|
||||
merchantRegistAuditRecordService.updateMerchantRegistAuditRecord(merchantRegistAuditRecord);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
MerchantRegistAuditRecord merchantRegistAuditRecord = new MerchantRegistAuditRecord();
|
||||
merchantRegistAuditRecord.setId(id.intValue());
|
||||
merchantRegistAuditRecord = merchantRegistAuditRecordService.queryMerchantRegistAuditRecord(merchantRegistAuditRecord);
|
||||
return ResultGenerator.genSuccessResult(merchantRegistAuditRecord);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.MerchantRegistLog;
|
||||
import cn.pluss.platform.merchantRegistLog.MerchantRegistLogService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/merchantRegistLog")
|
||||
@Transactional
|
||||
@Api(value = "MerchantRegistLog控制类", tags = {"MerchantRegistLog接口"})
|
||||
public class MerchantRegistLogController {
|
||||
|
||||
@Resource
|
||||
private MerchantRegistLogService merchantRegistLogService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<MerchantRegistLog>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<MerchantRegistLog> merchantRegistLogList = merchantRegistLogService.queryMerchantRegistLogPage(map);
|
||||
Integer count = merchantRegistLogService.queryMerchantRegistLogPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<MerchantRegistLog>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), merchantRegistLogList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantRegistLog", value = "待添加的MerchantRegistLog实例", paramType = "body", dataType = "MerchantRegistLog", required = true)
|
||||
})
|
||||
public Result add(@RequestBody MerchantRegistLog merchantRegistLog) {
|
||||
merchantRegistLogService.saveMerchantRegistLog(merchantRegistLog);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
MerchantRegistLog merchantRegistLog = new MerchantRegistLog();
|
||||
merchantRegistLog.setId(id.intValue());
|
||||
merchantRegistLogService.deleteMerchantRegistLog(merchantRegistLog);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantRegistLog", value = "更新的MerchantRegistLog实例", paramType = "body", dataType = "MerchantRegistLog", required = true)
|
||||
})
|
||||
public Result update(@RequestBody MerchantRegistLog merchantRegistLog) {
|
||||
merchantRegistLogService.updateMerchantRegistLog(merchantRegistLog);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
MerchantRegistLog merchantRegistLog = new MerchantRegistLog();
|
||||
merchantRegistLog.setId(id.intValue());
|
||||
merchantRegistLog = merchantRegistLogService.queryMerchantRegistLog(merchantRegistLog);
|
||||
return ResultGenerator.genSuccessResult(merchantRegistLog);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.deviceStock.DeviceStockService;
|
||||
import cn.pluss.platform.entity.QrCode;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* 商户扫码绑定接口类
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/merchantScanQrCode")
|
||||
@Transactional
|
||||
@Api(value = "merchantScanQrCode控制类", tags = {"MerchantScanQrCode接口"})
|
||||
public class MerchantScanQrCodeController {
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private DeviceStockService deviceStockService;
|
||||
|
||||
@PostMapping(value = "bind")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "商户扫码绑定收款二维码", notes = "商户绑定收款码", httpMethod = "POST")
|
||||
public Result bindCollectAmtQrCode(@RequestBody QrCode qrCode) {
|
||||
String snNo = qrCode.getSnNo();
|
||||
if (snNo == null) {
|
||||
snNo = qrCode.getQrNo();
|
||||
}
|
||||
|
||||
snNo = snNo.replace("ALI_", "");
|
||||
MsgException.checkBlank(snNo, "设备编号不能为空!");
|
||||
|
||||
deviceStockService.bindPayCode(snNo);
|
||||
return ResultGenerator.genSuccessResult("绑定成功!",null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.dto.MerchantStaffDTO;
|
||||
import cn.pluss.platform.merchant.MerchantStaffConnService;
|
||||
import cn.pluss.platform.vo.MerchantStaffVO;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merchantStaff")
|
||||
public class MerchantStaffController {
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private MerchantStaffConnService connService;
|
||||
|
||||
@PostMapping
|
||||
public Result<Object> save(@RequestBody MerchantStaffDTO merchantStaffDTO) {
|
||||
connService.createOrEditStaff(merchantStaffDTO);
|
||||
return ResultGenerator.genSuccessResult("保存成功", null);
|
||||
}
|
||||
|
||||
@GetMapping("/del")
|
||||
public Result<Object> remove(Long userId, String merchantCodes) {
|
||||
String[] split = merchantCodes.split(",");
|
||||
connService.delStaff(userId, Arrays.asList(split.clone()));
|
||||
return ResultGenerator.genSuccessResult("删除成功", null);
|
||||
}
|
||||
|
||||
@GetMapping("/{userId}")
|
||||
public Result<Object> one(@PathVariable("userId") String userId) {
|
||||
MerchantStaffVO result = connService.getOneForApp(userId);
|
||||
return ResultGenerator.genSuccessResult( result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.MerchantBaseInfo;
|
||||
import cn.pluss.platform.entity.MerchantImage;
|
||||
import cn.pluss.platform.entity.MerchantStore;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantImage.MerchantImageService;
|
||||
import cn.pluss.platform.merchantStore.MerchantStoreService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merchantStore")
|
||||
@Api(value = "MerchantStore控制类", tags = {"MerchantStore接口"})
|
||||
public class MerchantStoreController {
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private MerchantStoreService merchantStoreService;
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private MerchantBaseInfoService merchantBaseInfoService;
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private MerchantImageService merchantImageService;
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private UserAppService userAppService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(tags = {"页面-首页", "页面-商户详情"}, value = "获取门店信息", notes = "返回分页过后的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "MerchantStore", value = "查询需要的信息实例", paramType = "body", dataType = "MerchantStore")})
|
||||
public Result<PageInfo<MerchantStore>> list(@RequestBody MerchantStore merchantStore) {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
merchantStore.setMerchantCode(userApp.getMerchantCode());
|
||||
|
||||
//判断有无商家信息
|
||||
if (merchantStore.getMerchantCode() == null || StringUtil.isEmpty(merchantStore.getMerchantCode())) {
|
||||
return ResultGenerator.genFailResult("无商家编码");
|
||||
}
|
||||
|
||||
if (merchantStore.getSize() == null || merchantStore.getSize() == 0) {
|
||||
merchantStore.setSize(ProjectConstant.PAGE_SIZE);
|
||||
}
|
||||
if (merchantStore.getPage() == null || merchantStore.getPage() == 0) {
|
||||
merchantStore.setPage(1);
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", merchantStore.getSize());
|
||||
map.put("offset", (merchantStore.getPage() - 1) * merchantStore.getSize());
|
||||
map.put("merchantCode", merchantStore.getMerchantCode());
|
||||
if (!StringUtil.isEmpty(merchantStore.getStatus())) {
|
||||
map.put("status", merchantStore.getStatus());
|
||||
}
|
||||
if (!StringUtil.isEmpty(merchantStore.getStoreName())) {
|
||||
map.put("storeName", merchantStore.getStoreName());
|
||||
}
|
||||
|
||||
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();
|
||||
merchantBaseInfo.setMerchantCode(merchantStore.getMerchantCode());
|
||||
merchantBaseInfo = merchantBaseInfoService.queryMerchantBaseInfo(merchantBaseInfo);
|
||||
if (merchantBaseInfo == null) {
|
||||
return ResultGenerator.genSuccessResult(null);
|
||||
}
|
||||
|
||||
List<MerchantStore> merchantStoreList = merchantStoreService.queryMerchantStorePage(map);
|
||||
|
||||
for (MerchantStore m : merchantStoreList) {
|
||||
if (!StringUtil.isEmpty(merchantBaseInfo.getAlias())) {
|
||||
m.setAlias(merchantBaseInfo.getAlias());
|
||||
}
|
||||
if (!StringUtil.isEmpty(merchantBaseInfo.getProductDesc())) {
|
||||
m.setProductDesc(merchantBaseInfo.getProductDesc());
|
||||
}
|
||||
|
||||
String merchantCode = merchantBaseInfo.getMerchantCode();
|
||||
if (!StringUtil.isEmpty(merchantCode)) {
|
||||
MerchantImage merchantImage = new MerchantImage();
|
||||
merchantImage.setMerchantCode(merchantCode);
|
||||
merchantImage.setPhotoType("06");
|
||||
List<MerchantImage> queryMerchantImageList = merchantImageService.queryMerchantImageList(merchantImage);
|
||||
if (null != queryMerchantImageList && !queryMerchantImageList.isEmpty()) {
|
||||
merchantImage = queryMerchantImageList.get(0);
|
||||
m.setStoreHeadPic(merchantImage.getPicUrl());
|
||||
}
|
||||
MerchantImage merchantImage1 = new MerchantImage();
|
||||
merchantImage1.setMerchantCode(merchantCode);
|
||||
merchantImage1.setPhotoType("08");
|
||||
List<MerchantImage> queryMerchantImageList1 = merchantImageService.queryMerchantImageList(merchantImage1);
|
||||
if (null != queryMerchantImageList1 && !queryMerchantImageList1.isEmpty()) {
|
||||
merchantImage1 = queryMerchantImageList1.get(0);
|
||||
m.setCashPic(merchantImage1.getPicUrl());
|
||||
}
|
||||
MerchantImage merchantImage2 = new MerchantImage();
|
||||
merchantImage2.setMerchantCode(merchantCode);
|
||||
merchantImage2.setPhotoType("09");
|
||||
List<MerchantImage> queryMerchantImageList2 = merchantImageService.queryMerchantImageList(merchantImage2);
|
||||
if (null != queryMerchantImageList2 && !queryMerchantImageList2.isEmpty()) {
|
||||
merchantImage2 = queryMerchantImageList2.get(0);
|
||||
m.setStoreInsidePic(merchantImage2.getPicUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Integer count = merchantStoreService.queryMerchantStorePageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<MerchantStore> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, merchantStore.getSize()),
|
||||
merchantStore.getPage().longValue(), merchantStore.getSize().longValue(), merchantStoreList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@GetMapping("/{storeId}")
|
||||
@ApiOperation(value = "获取门店详情信息", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "storeId", value = "查询的storeId", paramType = "path", required = true, dataType = "String", defaultValue = "0")})
|
||||
public Result<MerchantStore> detail(@PathVariable String storeId) {
|
||||
MerchantStore merchantStore = new MerchantStore();
|
||||
merchantStore.setStoreId(storeId);
|
||||
merchantStore = merchantStoreService.queryMerchantStore(merchantStore);
|
||||
return ResultGenerator.genSuccessResult(merchantStore);
|
||||
}
|
||||
|
||||
@GetMapping("/certInfo")
|
||||
public Result<Map<String, Object>> getCertInfo() {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
Map<String, Object> certInfo = merchantStoreService.getCertInfo(userApp.getUserId() + "");
|
||||
return ResultGenerator.genSuccessResult(certInfo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.NewArea;
|
||||
import cn.pluss.platform.leshua.LeshuaArea;
|
||||
import cn.pluss.platform.leshua.LeshuaCity;
|
||||
import cn.pluss.platform.leshua.LeshuaProvince;
|
||||
import cn.pluss.platform.newArea.NewAreaService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/newArea")
|
||||
@Api(value = "NewArea控制类", tags = {"NewArea接口"})
|
||||
public class NewAreaController {
|
||||
|
||||
@Resource
|
||||
private NewAreaService newAreaService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<NewArea>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<NewArea> newAreaList = newAreaService.queryNewAreaPage(map);
|
||||
Integer count = newAreaService.queryNewAreaPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<NewArea>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), newAreaList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "NewArea", value = "待添加的NewArea实例", paramType = "body", dataType = "NewArea", required = true)
|
||||
})
|
||||
public Result add(@RequestBody NewArea newArea) {
|
||||
newAreaService.saveNewArea(newArea);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
NewArea newArea = new NewArea();
|
||||
newArea.setId(id.intValue());
|
||||
newAreaService.deleteNewArea(newArea);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "NewArea", value = "更新的NewArea实例", paramType = "body", dataType = "NewArea", required = true)
|
||||
})
|
||||
public Result update(@RequestBody NewArea newArea) {
|
||||
newAreaService.updateNewArea(newArea);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
NewArea newArea = new NewArea();
|
||||
newArea.setId(id.intValue());
|
||||
newArea = newAreaService.queryNewArea(newArea);
|
||||
return ResultGenerator.genSuccessResult(newArea);
|
||||
}
|
||||
|
||||
|
||||
public Result queryProvice() {
|
||||
NewArea newArea = new NewArea();
|
||||
newArea.setParentId(0);
|
||||
List<NewArea> queryNewAreaList = newAreaService.queryNewAreaList(newArea);//省
|
||||
|
||||
for (NewArea newArea2 : queryNewAreaList) {
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/queryProvinceandCityandArea")
|
||||
@ApiOperation(value = "查询省市区", notes = "查询省市区", httpMethod = "POST")
|
||||
public Result queryProvinceandCityandArea() {
|
||||
NewArea newArea = new NewArea();
|
||||
newArea.setParentId(0);
|
||||
List<NewArea> queryNewAreaList = newAreaService.queryNewAreaList(newArea);//省
|
||||
List<LeshuaProvince> list = new ArrayList<LeshuaProvince>();
|
||||
for (NewArea leshuaProvince : queryNewAreaList) {
|
||||
LeshuaProvince l = new LeshuaProvince();
|
||||
l.setCode(leshuaProvince.getId() + "");
|
||||
l.setName(leshuaProvince.getName());
|
||||
list.add(l);
|
||||
|
||||
}
|
||||
for (LeshuaProvince leshuaProvince : list) {
|
||||
NewArea newArea1 = new NewArea();
|
||||
newArea1.setParentId(Integer.valueOf(leshuaProvince.getCode()));
|
||||
List<NewArea> queryNewAreaList2 = newAreaService.queryNewAreaList(newArea1);
|
||||
List<LeshuaCity> leshuaCities = new ArrayList<LeshuaCity>();
|
||||
for (NewArea leshuaProvince2 : queryNewAreaList2) {
|
||||
LeshuaCity leshuaCity = new LeshuaCity();
|
||||
leshuaCity.setCode(leshuaProvince2.getId() + "");
|
||||
leshuaCity.setName(leshuaProvince2.getName());
|
||||
List<LeshuaArea> areaList = new ArrayList<LeshuaArea>();
|
||||
NewArea newArea2 = new NewArea();
|
||||
newArea2.setId(leshuaProvince2.getId());
|
||||
List<NewArea> queryNewAreaList3 = newAreaService.queryNewAreaList(newArea2);
|
||||
for (NewArea leshuaProvince3 : queryNewAreaList3) {
|
||||
LeshuaArea leshuaArea = new LeshuaArea();
|
||||
leshuaArea.setCode(leshuaProvince3.getId() + "");
|
||||
leshuaArea.setName(leshuaProvince3.getName());
|
||||
areaList.add(leshuaArea);
|
||||
}
|
||||
leshuaCity.setAreaList(areaList);
|
||||
leshuaCities.add(leshuaCity);
|
||||
}
|
||||
leshuaProvince.setCitylist(leshuaCities);
|
||||
|
||||
}
|
||||
return ResultGenerator.genSuccessResult(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.Notice;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.notice.NoticeService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/notice")
|
||||
@Transactional
|
||||
@Api(value = "Notice控制类", tags = {"Notice接口"})
|
||||
public class NoticeController {
|
||||
|
||||
@Resource
|
||||
private NoticeService noticeService;
|
||||
@Resource
|
||||
private UserAppService userAppService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(tags = {"页面-收益通知", "页面-审核通知"}, value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "typeFirst", value = "通知类型", paramType = "query", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "userId", value = "指定人员的Id", paramType = "query", dataType = "String", required = true)})
|
||||
public Result<PageInfo<Notice>> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size, Integer typeFirst, String userId) {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
userId = userApp.getUserId() + "";
|
||||
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
map.put("typeFirst", typeFirst);
|
||||
map.put("userId", userId);
|
||||
List<Notice> noticeList = noticeService.queryNoticePage(map);
|
||||
for (Notice notice : noticeList) {
|
||||
notice.setIsDeal(1);
|
||||
noticeService.updateNotice(notice);
|
||||
|
||||
if (notice.getTypeSecond().equals(Notice.TYPE_MER_OUT_LINE) || notice.getTypeSecond().equals(Notice.TYPE_MER_EXCEPTION) || notice.getTypeSecond().equals(Notice.TYPE_MER_FREEZE)) {
|
||||
notice.setTypeSecond(-1);
|
||||
}
|
||||
}
|
||||
|
||||
Integer count = noticeService.queryNoticePageCount(map);
|
||||
// 返回参数
|
||||
PageInfo pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), noticeList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
/**
|
||||
* queryIsDeal:(查询当前用户的审核消息未读数量). <br/>
|
||||
*
|
||||
* @return
|
||||
* @author Administrator
|
||||
* @since JDK 1.8
|
||||
*/
|
||||
@PostMapping("/queryIsDeal")
|
||||
@ApiOperation(value = "查询当前用户的审核消息未读数量", notes = "查询当前用户的审核消息未读数量", httpMethod = "POST")
|
||||
public Result queryIsDeal(@RequestBody Notice notice) {
|
||||
Map<String, Object> result = new HashMap<>(16);
|
||||
try {
|
||||
notice.setIsDeal(0);
|
||||
notice.setTypeFirst(notice.getTypeFirst() == null ? 1 : notice.getTypeFirst());
|
||||
notice.setUserId(notice.getUserId());
|
||||
List<Notice> queryNoticeList = noticeService.queryNoticeList(notice);
|
||||
result.put("count", queryNoticeList.size());
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultGenerator.genFailResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class NoticePageController {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.entity.NoticeReadRecord;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.notice.NoticeReadRecordService;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author djh
|
||||
* 通知已读相关接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/noticeReadRecord")
|
||||
public class NoticeReadRecordController {
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private NoticeReadRecordService noticeReadRecordService;
|
||||
|
||||
@GetMapping("/notice")
|
||||
public Result<Object> getNoReadNoticeCount() {
|
||||
Map<String, Object> resultMap = noticeReadRecordService.getAppNoReadNoticeCount();
|
||||
return ResultGenerator.genSuccessResult(resultMap);
|
||||
}
|
||||
|
||||
@GetMapping("/article")
|
||||
public Result<Object> getNoReadArticleCount() {
|
||||
Map<String, Object> resultMap = noticeReadRecordService.getAppNoReadArticleCount();
|
||||
return ResultGenerator.genSuccessResult(resultMap);
|
||||
}
|
||||
|
||||
@PostMapping("/article")
|
||||
public Result<Object> save(@RequestBody NoticeReadRecord noticeReadRecord) {
|
||||
try {
|
||||
noticeReadRecordService.save(noticeReadRecord);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PostMapping("/clearReadFlag")
|
||||
public Result<Object> clearReadFlag(@RequestBody Map<String, Object> params) {
|
||||
if (params.get("typeFirst") == null) {
|
||||
throw new MsgException("缺少类别一");
|
||||
}
|
||||
|
||||
if (params.get("typeSecond") == null) {
|
||||
throw new MsgException("缺少类别二");
|
||||
}
|
||||
|
||||
noticeReadRecordService.clearReadFlag(params.get("typeFirst").toString(), params.get("typeSecond").toString());
|
||||
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.PhoneValidateCode;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.entity.UserInfo;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.phoneValidateCode.PhoneValidateCodeService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.userInfo.UserInfoService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import cn.pluss.platform.util.ValidateCodeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/phoneValidateCode")
|
||||
@Transactional
|
||||
@Api(value = "PhoneValidateCode控制类", tags = {"PhoneValidateCode接口"})
|
||||
public class PhoneValidateCodeController {
|
||||
|
||||
@Autowired
|
||||
private ValidateCodeUtil validateCodeUtil;
|
||||
|
||||
@Resource
|
||||
private PhoneValidateCodeService phoneValidateCodeService;
|
||||
@Resource
|
||||
private UserInfoService uiService;
|
||||
|
||||
@Autowired
|
||||
private UserAppService uaService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<PhoneValidateCode>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<PhoneValidateCode> phoneValidateCodeList = phoneValidateCodeService.queryPhoneValidateCodePage(map);
|
||||
Integer count = phoneValidateCodeService.queryPhoneValidateCodePageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count,size), page.longValue(), size.longValue(), phoneValidateCodeList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(tags = {"页面-忘记密码"}, value = "发送验证码", notes = "必须要已经注册的手机号可调用该验证码接口", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "PhoneValidateCode", value = "待添加的PhoneValidateCode实例", paramType = "body", dataType = "PhoneValidateCode", required = true)
|
||||
})
|
||||
public Result<Object> add(HttpServletRequest request, @RequestBody PhoneValidateCode phoneValidateCode) {
|
||||
|
||||
String phone = phoneValidateCode.getPhone();
|
||||
if (StringUtil.isEmpty(phone)) {
|
||||
return ResultGenerator.genFailResult("没有手机号!");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<UserInfo> qWui = Wrappers.lambdaQuery();
|
||||
qWui.eq(UserInfo::getLoginName, phone);
|
||||
UserInfo ui = uiService.getOne(qWui);
|
||||
if (ui == null) {
|
||||
throw new MsgException("帐号不存在");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<UserApp> qWua = Wrappers.lambdaQuery();
|
||||
qWua.eq(UserApp::getUserId, ui.getId());
|
||||
UserApp ua = uaService.getOne(qWua);
|
||||
if ("promoter".equals(ua.getUserType()) && phone.length() > 11) {
|
||||
throw new MsgException("子商户不允许执行该操作");
|
||||
}
|
||||
|
||||
phoneValidateCode.setPhone(ui.getPhone());
|
||||
|
||||
String checkCode = StringUtil.random(4);
|
||||
phoneValidateCode.setCode(checkCode);
|
||||
try {
|
||||
Result<Object> result = validateCodeUtil.requestValidateCode(phoneValidateCode.getPhone(), checkCode);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResultGenerator.genFailResult(e.getMessage());
|
||||
}
|
||||
|
||||
//根据当前手机号查询当前手机号是否有验证码信息
|
||||
phoneValidateCodeService.saveOrReplaceIfExist(phoneValidateCode);
|
||||
return ResultGenerator.genSuccessResult(phoneValidateCode);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<Object> detail(@PathVariable Long id) {
|
||||
PhoneValidateCode phoneValidateCode = new PhoneValidateCode();
|
||||
phoneValidateCode.setId(id.intValue());
|
||||
phoneValidateCode = phoneValidateCodeService.queryPhoneValidateCode(phoneValidateCode);
|
||||
return ResultGenerator.genSuccessResult(phoneValidateCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.PushService;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 发送下单,催单通知等接口
|
||||
*
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/push/")
|
||||
public class PushController {
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private PushService pushService;
|
||||
|
||||
@PostMapping("/pushMsg")
|
||||
public Result<Object> pushMsg(@RequestBody Map<String, Object> param) {
|
||||
String userId = (String) param.get("userId");
|
||||
String msgType = (String) param.get("type");
|
||||
|
||||
Integer storeId = (Integer) param.get("storeId");
|
||||
|
||||
if (StringUtils.isNotBlank(userId)) {
|
||||
pushService.pushMsg(userId, msgType);
|
||||
} else {
|
||||
pushService.pushMsg(storeId, msgType);
|
||||
}
|
||||
|
||||
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.QuestionsAnswers;
|
||||
import cn.pluss.platform.questionsAnswers.QuestionsAnswersService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/questionsAnswers")
|
||||
@Transactional
|
||||
@Api(value = "QuestionsAnswers控制类", tags = { "QuestionsAnswers接口" })
|
||||
public class QuestionsAnswersController {
|
||||
|
||||
@Resource
|
||||
private QuestionsAnswersService questionsAnswersService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0") })
|
||||
public Result<PageInfo<QuestionsAnswers>> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<QuestionsAnswers> questionsAnswersList = questionsAnswersService.queryQuestionsAnswersPage(map);
|
||||
Integer count = questionsAnswersService.queryQuestionsAnswersPageCount(map);
|
||||
// 返回参数
|
||||
PageInfo pager = new PageInfo<QuestionsAnswers>(count.longValue(), (long) StringUtil.getPageCount(count,size), page.longValue(), size.longValue(),
|
||||
questionsAnswersList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "QuestionsAnswers", value = "待添加的QuestionsAnswers实例", paramType = "body", dataType = "QuestionsAnswers", required = true) })
|
||||
public Result add(@RequestBody QuestionsAnswers questionsAnswers) {
|
||||
questionsAnswersService.saveQuestionsAnswers(questionsAnswers);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true) })
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
QuestionsAnswers questionsAnswers = new QuestionsAnswers();
|
||||
questionsAnswers.setId(id.intValue());
|
||||
questionsAnswersService.deleteQuestionsAnswers(questionsAnswers);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "QuestionsAnswers", value = "更新的QuestionsAnswers实例", paramType = "body", dataType = "QuestionsAnswers", required = true) })
|
||||
public Result update(@RequestBody QuestionsAnswers questionsAnswers) {
|
||||
questionsAnswersService.updateQuestionsAnswers(questionsAnswers);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0") })
|
||||
public Result detail(@PathVariable Long id) {
|
||||
QuestionsAnswers questionsAnswers = new QuestionsAnswers();
|
||||
questionsAnswers.setId(id.intValue());
|
||||
questionsAnswers = questionsAnswersService.queryQuestionsAnswers(questionsAnswers);
|
||||
return ResultGenerator.genSuccessResult(questionsAnswers);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.entity.RealFans;
|
||||
import cn.pluss.platform.realFans.RealFansService;
|
||||
import cn.pluss.platform.util.PageUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/realFans")
|
||||
@Api(value = "RealFans控制类", tags = {"RealFans接口"})
|
||||
public class RealFansController {
|
||||
@Resource
|
||||
private RealFansService realFansService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<RealFans>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
IPage<RealFans> page1 = realFansService.page(new Page<>(page, size));
|
||||
//返回参数
|
||||
PageInfo<RealFans> pager = PageUtils.page(page1);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "RealFans", value = "待添加的RealFans实例", paramType = "body", dataType = "RealFans", required = true)
|
||||
})
|
||||
public Result add(@RequestBody RealFans realFans) {
|
||||
realFansService.save(realFans);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Long id) {
|
||||
realFansService.removeById(id);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "RealFans", value = "更新的RealFans实例", paramType = "body", dataType = "RealFans", required = true)
|
||||
})
|
||||
public Result update(@RequestBody RealFans realFans) {
|
||||
realFansService.updateById(realFans);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
RealFans realFans = realFansService.getById(id);
|
||||
return ResultGenerator.genSuccessResult(realFans);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.leshua.ExpandDto;
|
||||
import cn.pluss.platform.service.common.SpreadService;
|
||||
import cn.pluss.platform.vo.SpreadData;
|
||||
import cn.pluss.platform.vo.UserNumVO;
|
||||
import cn.pluss.platform.vo.UserTeamAchieVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author DJH
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("spread")
|
||||
public class SpreadController {
|
||||
|
||||
@Setter(onMethod_ = @Autowired)
|
||||
private SpreadService spreadService;
|
||||
|
||||
@GetMapping("/expandPageData")
|
||||
public Result<Page<UserApp>> expandPageData(ExpandDto dto) {
|
||||
Page<UserApp> userAppPage = spreadService.expandPageData(dto);
|
||||
return ResultGenerator.genSuccessResult(userAppPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取升级图片
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/upgradeImg")
|
||||
public Result<String> getUpgradeImage() {
|
||||
String imgUrl = spreadService.getUpgradeImage();
|
||||
return ResultGenerator.genSuccessResult(imgUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付成功后页面的数据配置数据
|
||||
*/
|
||||
@GetMapping("/paySuccessPageData")
|
||||
public Result<Map<String, Object>> paySuccessPageData() {
|
||||
Map<String, Object> result = spreadService.appPaySuccessPageData();
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/todaySpreadData")
|
||||
public Result<SpreadData> todaySpreadData() {
|
||||
SpreadData spreadData = spreadService.apiTodaySpreadData();
|
||||
return ResultGenerator.genSuccessResult(spreadData);
|
||||
}
|
||||
|
||||
@GetMapping("/historySpreadPageData")
|
||||
public Result<Page<SpreadData>> historySpreadPageData(Page<SpreadData> page, String type, String target) {
|
||||
page.getOrders().clear();
|
||||
page.getOrders().add(OrderItem.desc("startDate"));
|
||||
Page<SpreadData> pageData = spreadService.apiHistorySpreadPageData(page, type, target);
|
||||
return ResultGenerator.genSuccessResult(pageData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询团队业绩
|
||||
* @date: 2022/1/24 14:23
|
||||
* @param vo:
|
||||
* @return cn.pluss.platform.api.Result<com.baomidou.mybatisplus.extension.plugins.pagination.Page<cn.pluss.platform.vo.UserTeamAchieVO>>
|
||||
*/
|
||||
@GetMapping("/getUserTeamAchie")
|
||||
public Result<Page<UserTeamAchieVO>> getUserTeamAchie(Page<UserTeamAchieVO> page,UserTeamAchieVO vo) {
|
||||
page = spreadService.userTeamAchiePage(page,vo);
|
||||
return ResultGenerator.genSuccessResult(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户团队交易流水
|
||||
* @date: 2022/1/24 22:50
|
||||
* @param vo:
|
||||
*/
|
||||
@GetMapping("/getUserFlow")
|
||||
public Result<UserTeamAchieVO> getUserFlow(UserTeamAchieVO vo) {
|
||||
UserTeamAchieVO result = spreadService.getAppUserTeanFlow(vo);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直推商户数量信息
|
||||
* @date: 2022/1/24 22:50
|
||||
* @param vo:
|
||||
*/
|
||||
@GetMapping("/getUserDirectMercInfo")
|
||||
public Result<UserNumVO> getUserDirectMercInfo(UserNumVO vo) {
|
||||
UserNumVO result = spreadService.getUserDirectNumInfo(vo,UserNumVO.DATA_TYPE_MERCHANT);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取直推成员数量信息
|
||||
* @date: 2022/1/24 22:50
|
||||
* @param vo:
|
||||
*/
|
||||
@GetMapping("/getUserDirectMemberInfo")
|
||||
public Result<UserNumVO> getUserDirectMemberInfo(UserNumVO vo) {
|
||||
UserNumVO result = spreadService.getUserDirectNumInfo(vo,UserNumVO.DATE_TYPE_MEMBER);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.Suggest;
|
||||
import cn.pluss.platform.suggest.SuggestService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/suggest")
|
||||
@Transactional
|
||||
@Api(value = "Suggest控制类", tags = {"Suggest接口"})
|
||||
public class SuggestController {
|
||||
|
||||
@Resource
|
||||
private SuggestService suggestService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<Suggest>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<Suggest> suggestList = suggestService.querySuggestPage(map);
|
||||
Integer count = suggestService.querySuggestPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<Suggest>(count.longValue(), (long) StringUtil.getPageCount(count,size), page.longValue(), size.longValue(), suggestList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Suggest", value = "待添加的Suggest实例", paramType = "body", dataType = "Suggest", required = true)
|
||||
})
|
||||
public Result add(@RequestBody Suggest suggest) {
|
||||
// if (suggest.getPhone() == null) {
|
||||
// throw new MsgException("请输入手机号");
|
||||
// }
|
||||
//
|
||||
// if (suggest.getPhone().length() > 11) {
|
||||
// throw new MsgException("手机号过长");
|
||||
// }
|
||||
suggestService.saveSuggest(suggest);
|
||||
suggest.setCreateDt(new Date());
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
Suggest suggest = new Suggest();
|
||||
suggest.setId(id.intValue());
|
||||
suggestService.deleteSuggest(suggest);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Suggest", value = "更新的Suggest实例", paramType = "body", dataType = "Suggest", required = true)
|
||||
})
|
||||
public Result update(@RequestBody Suggest suggest) {
|
||||
suggestService.updateSuggest(suggest);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
Suggest suggest = new Suggest();
|
||||
suggest.setId(id.intValue());
|
||||
suggest = suggestService.querySuggest(suggest);
|
||||
return ResultGenerator.genSuccessResult(suggest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
|
||||
import cn.pluss.platform.SxfMccInfoService;
|
||||
import cn.pluss.platform.base.BaseModelController;
|
||||
import cn.pluss.platform.entity.SxfMccInfo;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Djh
|
||||
* @since 2020-09-22
|
||||
*/
|
||||
@Deprecated
|
||||
@RestController
|
||||
@RequestMapping("/sxfMccInfo")
|
||||
public class SxfMccInfoController extends BaseModelController<SxfMccInfoService, SxfMccInfo> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.annotation.OpLog;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.baidu.BaiduFaceDetectService;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.*;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchantBankCard.MerchantBankCardService;
|
||||
import cn.pluss.platform.systemConfig.SystemConfigService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/systemConfig")
|
||||
@Transactional
|
||||
@Slf4j
|
||||
@Api(value = "SystemConfig控制类", tags = {"系统参数接口"})
|
||||
public class SystemConfigController {
|
||||
|
||||
private final SystemConfigService systemConfigService;
|
||||
private final UserAppService userAppService;
|
||||
private final MerchantBaseInfoService merchantBaseInfoService;
|
||||
private final MerchantBankCardService merchantBankCardService;
|
||||
|
||||
@Autowired
|
||||
private BaiduFaceDetectService baiduFaceDetectService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<SystemConfig>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "1") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<SystemConfig> systemconfigList = systemConfigService.querySystemConfigPage(map);
|
||||
Integer count = systemConfigService.querySystemConfigPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), systemconfigList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
/**
|
||||
* 版本跟新接口
|
||||
*
|
||||
* @param platformCode 0: android; 1 : iOS
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateSystemVersion")
|
||||
@ApiOperation(value = "版本更新", notes = "传来版本返回下载地址和系统版本", httpMethod = "POST")
|
||||
public Result<Object> updateSystemVersion(@RequestParam(defaultValue = "-1") int platformCode) {
|
||||
Object result = systemConfigService.updateSystemVersion(platformCode);
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
@PostMapping("/queryMerchantFeeImgUrl")
|
||||
public Result queryMerchantFeeImgUrl() {
|
||||
Map<String, Object> result = new HashMap<String, Object>(16);
|
||||
boolean flag = false;
|
||||
try {
|
||||
String merchantType = "1";
|
||||
String accountType = "1";
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
String myLimit = "";
|
||||
String brushBank = "";
|
||||
String merchantCode = userApp.getMerchantCode();
|
||||
if (StringUtil.isNotEmpty(merchantCode)) {
|
||||
MerchantBaseInfo merchantBaseInfo = new MerchantBaseInfo();
|
||||
merchantBaseInfo.setMerchantCode(merchantCode);
|
||||
merchantBaseInfo = merchantBaseInfoService.queryMerchantBaseInfo(merchantBaseInfo);
|
||||
if (null != merchantBaseInfo) {
|
||||
merchantType = merchantBaseInfo.getMerchantType() == null ? "1" : merchantBaseInfo.getMerchantType();
|
||||
}
|
||||
MerchantBankCard merchantBankCard;
|
||||
merchantBankCard = merchantBankCardService.queryMerchantBankCard(userApp.getUserId() + "");
|
||||
if (null != merchantBankCard) {
|
||||
accountType = merchantBankCard.getAccountType() == null ? "1" : merchantBankCard.getAccountType();
|
||||
}
|
||||
}
|
||||
|
||||
String levelImg = systemConfigService.querySystemConfigValue("levelImg");
|
||||
|
||||
flag = true;
|
||||
result.put("flag", flag);
|
||||
result.put("myLimit", levelImg);
|
||||
result.put("brushBank", levelImg);
|
||||
result.put("levelImg", levelImg);
|
||||
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.put("flag", flag);
|
||||
return ResultGenerator.genFailResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/isLogin")
|
||||
@ApiOperation(value = "当前版本是否已经上架到appStore", notes = "1, 没有;2,已经上架", httpMethod = "POST", consumes = "application/json", produces = "application/json")
|
||||
@ApiOperationSupport(params = @DynamicParameters(properties = {
|
||||
@DynamicParameter(name = "version", value = "当前app版本号", example = "1.0.9.beta", required = true, dataTypeClass = String.class)
|
||||
}))
|
||||
public Result isLogin(HttpServletRequest request) throws IOException {
|
||||
InputStream is = request.getInputStream();
|
||||
StringBuilder responseStrBuilder = new StringBuilder();
|
||||
BufferedReader streamReader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
|
||||
String inputStr;
|
||||
while ((inputStr = streamReader.readLine()) != null) {
|
||||
responseStrBuilder.append(inputStr);
|
||||
}
|
||||
|
||||
if (responseStrBuilder.length() == 0) {
|
||||
return ResultGenerator.genSuccessResult("1");
|
||||
}
|
||||
|
||||
Object o = systemConfigService.updateSystemVersion(1);
|
||||
|
||||
if(o instanceof AppVersionInfo) {
|
||||
JSONObject json = JSON.parseObject(responseStrBuilder.toString());
|
||||
String version = json.getString("version");
|
||||
|
||||
String versionName = ((AppVersionInfo) o).getVersionName();
|
||||
|
||||
if (StringUtil.isEmpty(version) || StringUtil.isEmpty(versionName) || versionName.compareTo(version) < 0) {
|
||||
return ResultGenerator.genSuccessResult("1");
|
||||
} else {
|
||||
return ResultGenerator.genSuccessResult("2");
|
||||
}
|
||||
} else {
|
||||
return ResultGenerator.genSuccessResult("1");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/getLeshuaUploadParam")
|
||||
public Result<Map<String, Object>> getLeshuaUploadUrl(String fileMD5) {
|
||||
// Map<String, Object> result = new HashMap<>();
|
||||
// result.put("url", ParametersUtil.LESHUA_API + "/picture/upload");
|
||||
// result.put("agentId", "7389852");
|
||||
// result.put("version", "2.0");
|
||||
//
|
||||
// JSONObject object = new JSONObject();
|
||||
// object.put("data")
|
||||
//
|
||||
// getSign()
|
||||
//
|
||||
// return ResultGenerator.genSuccessResult(ParametersUtil.LESHUA_API + "/picture/upload");
|
||||
|
||||
return ResultGenerator.genFailResult("非法接口");
|
||||
}
|
||||
|
||||
/**
|
||||
* 进件获取签名值
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
private String getSign(JSONObject data) {
|
||||
String sign = "";
|
||||
String jsonData = data.toJSONString();
|
||||
StringBuffer sb = new StringBuffer("lepos");
|
||||
sb.append("60E3F31EDEC8061C33721737B36FA86D").append(jsonData);// key每个渠道商不一样
|
||||
String md5 = DigestUtils.md5Hex(sb.toString().getBytes(StandardCharsets.UTF_8));
|
||||
sign = Base64.encodeBase64String(md5.getBytes(StandardCharsets.UTF_8));
|
||||
log.info("待签参数:{}" + sb);
|
||||
log.info("签名值:{}" + sign);
|
||||
return sign;
|
||||
}
|
||||
|
||||
|
||||
@OpLog(opCode = "BAIDU_ACCESS_TOKEN", opDetail = "获取百度访问token", opName = "获取百度访问token")
|
||||
@GetMapping("/baiduAccessToken")
|
||||
public Result<?> getBaiduAccessToken() {
|
||||
final String auth = baiduFaceDetectService.apiGetAuth();
|
||||
return ResultGenerator.genSuccessResult(auth);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.entity.SystemInfo;
|
||||
import cn.pluss.platform.systemInfo.SystemInfoService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/systemInfo")
|
||||
@Transactional
|
||||
@Api(value = "SystemInfo控制类", tags = {"SystemInfo接口"})
|
||||
public class SystemInfoController {
|
||||
|
||||
@Resource
|
||||
private SystemInfoService systemInfoService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(tags = {"页面-关于我们"}, value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result<PageInfo<SystemInfo>> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<SystemInfo> systemInfoList = systemInfoService.querySystemInfoPage(map);
|
||||
Integer count = systemInfoService.querySystemInfoPageCount(map);
|
||||
//返回参数
|
||||
PageInfo pager = new PageInfo<SystemInfo>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), systemInfoList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加数据", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "SystemInfo", value = "待添加的SystemInfo实例", paramType = "body", dataType = "SystemInfo", required = true)
|
||||
})
|
||||
public Result add(@RequestBody SystemInfo systemInfo) {
|
||||
systemInfoService.saveSystemInfo(systemInfo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)
|
||||
})
|
||||
public Result delete(@PathVariable Integer id) {
|
||||
SystemInfo systemInfo = new SystemInfo();
|
||||
systemInfo.setId(id.intValue());
|
||||
systemInfoService.deleteSystemInfo(systemInfo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "更新数据", notes = "根据内容更新数据", httpMethod = "PUT")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "SystemInfo", value = "更新的SystemInfo实例", paramType = "body", dataType = "SystemInfo", required = true)
|
||||
})
|
||||
public Result update(@RequestBody SystemInfo systemInfo) {
|
||||
systemInfoService.updateSystemInfo(systemInfo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation(value = "获取单个值", notes = "查看单个项目的内容", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id", paramType = "path", required = true, dataType = "Integer", defaultValue = "0")
|
||||
})
|
||||
public Result detail(@PathVariable Long id) {
|
||||
SystemInfo systemInfo = new SystemInfo();
|
||||
systemInfo.setId(id.intValue());
|
||||
systemInfo = systemInfoService.querySystemInfo(systemInfo);
|
||||
return ResultGenerator.genSuccessResult(systemInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.channel.MerchantAuditService;
|
||||
import cn.pluss.platform.export.BillStatisticsService;
|
||||
import cn.pluss.platform.mapper.MerchantRateMapper;
|
||||
import cn.pluss.platform.user.impl.GeneralPushUtil;
|
||||
import cn.pluss.platform.util.excel.ComplexExcelUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.ResponseBody;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Djh
|
||||
*/
|
||||
@Slf4j
|
||||
//@RestController
|
||||
@RequestMapping("test")
|
||||
public class TestController {
|
||||
|
||||
@Autowired
|
||||
private BillStatisticsService billStatisticsService;
|
||||
|
||||
@Autowired
|
||||
private GeneralPushUtil generalPushUtil;
|
||||
|
||||
@Autowired
|
||||
private MerchantRateMapper rateMapper;
|
||||
|
||||
@Autowired
|
||||
private MerchantAuditService ysAuditService;
|
||||
|
||||
@Autowired
|
||||
private MerchantAuditService ryxMerchantAuditService;
|
||||
|
||||
@GetMapping("/export1/{merchantCode}")
|
||||
public void test1(@PathVariable("merchantCode") String merchantCode, HttpServletResponse response) throws Exception {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date startDate = sdf.parse("2021-04-01 00:00:00");
|
||||
Date endDate = sdf.parse("2021-04-30 23:59:59");
|
||||
|
||||
XSSFWorkbook workBook = billStatisticsService.createBillStatisticsSheet(null, merchantCode, startDate, endDate);
|
||||
workBook = billStatisticsService.createBillListSheet(workBook, merchantCode, startDate, endDate);
|
||||
workBook = billStatisticsService.createMemberBillStatisticsSheet(workBook, merchantCode, startDate, endDate);
|
||||
workBook = billStatisticsService.createMemberBillListSheet(workBook, merchantCode, startDate, endDate);
|
||||
workBook = billStatisticsService.createStaffBillStatisticsSheet(workBook, merchantCode, startDate, endDate);
|
||||
|
||||
ComplexExcelUtil.setResponseHeader(response, "测试");
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
workBook.write(out);
|
||||
}
|
||||
|
||||
@GetMapping("/ysAudit/{userId}")
|
||||
public Result<Object> test1(@PathVariable("userId") String userId) {
|
||||
ysAuditService.merchantAudit(userId, false);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/ryxResult/{orderId}")
|
||||
@ResponseBody
|
||||
public Object test3(@PathVariable("orderId") String orderId) throws Exception {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("orderId", orderId);
|
||||
// param.put("accessMerchId", "b6048439-504d-4be7-88f1-beae06391588");
|
||||
JSONObject jsonObject = ryxMerchantAuditService.merchantAuditResult(param);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@GetMapping("/bb/czs")
|
||||
public Result<Object> test4() {
|
||||
List<String> alias = new ArrayList<>();
|
||||
alias.add("7714");
|
||||
generalPushUtil.sendAllPlatByUserIdChargeWithCoupon(alias, new BigDecimal("20"), new BigDecimal("50"));
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/bb/cz")
|
||||
public Result<Object> test5() {
|
||||
List<String> alias = new ArrayList<>();
|
||||
alias.add("7714");
|
||||
generalPushUtil.sendAllPlatByUserIdChargeWithCoupon(alias, new BigDecimal("20"), new BigDecimal("50"));
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/bb/xff")
|
||||
public Result<Object> test6() {
|
||||
List<String> alias = new ArrayList<>();
|
||||
alias.add("7714");
|
||||
generalPushUtil.sendAllPlatByUserIdConsumeWithCoupon(alias, new BigDecimal("20.12"), new BigDecimal(5));
|
||||
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/bb/xf")
|
||||
public Result<Object> test7() {
|
||||
List<String> alias = new ArrayList<>();
|
||||
alias.add("7714");
|
||||
generalPushUtil.sendAllPlatByUserIdConsumeWithCoupon(alias, new BigDecimal("20"), new BigDecimal("50"));
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/bb/zfqx")
|
||||
public Result<Object> test8() {
|
||||
List<String> alias = new ArrayList<>();
|
||||
alias.add("7714");
|
||||
generalPushUtil.sendAllPlatByAlias(alias, "订单取消支付", "订单取消支付", "3");
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.util.Base64Util;
|
||||
import cn.pluss.platform.util.FileUtil;
|
||||
import cn.pluss.platform.util.ParametersUtil;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import cn.pluss.platform.vo.Images;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/upLoadImage")
|
||||
@Transactional
|
||||
@Api(value = "UpLoadImage控制类", tags = { "UpLoadImage接口" })
|
||||
public class UploadImageController {
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(tags = {"页面-设置"}, value = "图片上传, 只用于乐刷进件", notes = "图片的base64字符串", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Image", value = "上传的图片实例", paramType = "body", dataType = "Image", required = true) })
|
||||
public Result<Images> add(@RequestBody Images image) {
|
||||
Integer size = FileUtil.imageSize(image.getBase64());
|
||||
boolean bytesToKB =FileUtil.bytesToKB(size, 1);
|
||||
if (bytesToKB) {
|
||||
return ResultGenerator.genFailResult("请上传小于1M的图片(可以添加图片的时候点击编辑,裁剪多余的部分就可以小于1M)");
|
||||
}
|
||||
String visit=ParametersUtil.upload_visit_path;
|
||||
String fileName = null;
|
||||
String name = null;
|
||||
String picUrl = "";
|
||||
try {
|
||||
String path=ParametersUtil.upload_save_path;
|
||||
Properties prop = System.getProperties();
|
||||
String os = prop.getProperty("os.name");
|
||||
if (os.startsWith("win") || os.startsWith("Win")) {
|
||||
// windows目录
|
||||
path = "D:\\xm\\media\\java\\Media\\resources\\manage\\upload";
|
||||
visit = "http://127.0.0.1/resources/manage/upload";
|
||||
}
|
||||
name = StringUtil.getBillno();
|
||||
fileName = path + "/" + name + ".jpg";
|
||||
Base64Util.decoderBase64File(image.getBase64(), fileName);
|
||||
picUrl = visit + "/" + name + ".jpg";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultGenerator.genFailResult(e.getMessage());
|
||||
}
|
||||
image = new Images();
|
||||
image.setVisitUrl(picUrl);
|
||||
|
||||
return ResultGenerator.genSuccessResult(image);
|
||||
}
|
||||
|
||||
@PostMapping("/other")
|
||||
@ApiOperation(tags = {"页面-设置"}, value = "图片上传, 意见反馈等", notes = "图片的base64字符串", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "Image", value = "上传的图片实例", paramType = "body", dataType = "Image", required = true) })
|
||||
public Result<Images> addOther(@RequestBody Images image) {
|
||||
Integer size = FileUtil.imageSize(image.getBase64());
|
||||
boolean bytesToKB =FileUtil.bytesToKB(size, 5);
|
||||
if (bytesToKB) {
|
||||
return ResultGenerator.genFailResult("请上传小于5M的图片(可以添加图片的时候点击编辑,裁剪多余的部分就可以小于1M)");
|
||||
}
|
||||
String visit=ParametersUtil.upload_visit_path;
|
||||
String fileName = null;
|
||||
String name = null;
|
||||
String picUrl = "";
|
||||
try {
|
||||
String path=ParametersUtil.upload_save_path;
|
||||
Properties prop = System.getProperties();
|
||||
String os = prop.getProperty("os.name");
|
||||
if (os.startsWith("win") || os.startsWith("Win")) {
|
||||
// windows目录
|
||||
path = "D:\\xm\\media\\java\\Media\\resources\\manage\\upload";
|
||||
visit = "http://127.0.0.1/resources/manage/upload";
|
||||
}
|
||||
name = StringUtil.getBillno();
|
||||
fileName = path + "/" + name + ".jpg";
|
||||
Base64Util.decoderBase64File(image.getBase64(), fileName);
|
||||
picUrl = visit + "/" + name + ".jpg";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultGenerator.genFailResult(e.getMessage());
|
||||
}
|
||||
image = new Images();
|
||||
image.setVisitUrl(picUrl);
|
||||
return ResultGenerator.genSuccessResult(image);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,280 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.annotation.OpLog;
|
||||
import cn.pluss.platform.api.PageInfo;
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.api.ResultGenerator;
|
||||
import cn.pluss.platform.constants.CommonError;
|
||||
import cn.pluss.platform.constants.ProjectConstant;
|
||||
import cn.pluss.platform.dto.ChangePwdDTO;
|
||||
import cn.pluss.platform.entity.PhoneValidateCode;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.entity.UserInfo;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.phoneValidateCode.PhoneValidateCodeService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.userInfo.UserInfoService;
|
||||
import cn.pluss.platform.util.MD5Util;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import cn.pluss.platform.util.ValidateCodeUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author djh
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/userInfo")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Api(value = "UserInfo控制类", tags = {"用户相关接口"})
|
||||
public class UserInfoController {
|
||||
|
||||
private final UserInfoService userInfoNewService;
|
||||
private final UserAppService userAppService;
|
||||
private final PhoneValidateCodeService phoneValidateCodeService;
|
||||
private final ValidateCodeUtil validateCodeUtil;
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@GetMapping({"/bind/{inviteCode}", "/bind/"})
|
||||
public Result<Object> bindInviteCode(@PathVariable(value = "inviteCode", required = false) String inviteCode) {
|
||||
if (inviteCode == null) {
|
||||
throw new MsgException("缺少邀请码");
|
||||
}
|
||||
|
||||
userInfoNewService.bindInviteCode(inviteCode);
|
||||
return ResultGenerator.genSuccessResult("操作成功", "操作成功");
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation(value = "获取全部", notes = "返回分页过后的数据", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "查询页码", paramType = "query", dataType = "Integer", defaultValue = "0"),
|
||||
@ApiImplicitParam(name = "size", value = "每页数据量", paramType = "query", dataType = "Integer", defaultValue = "0")})
|
||||
public Result<PageInfo<UserInfo>> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size) {
|
||||
if (size == null || size == 0) {
|
||||
size = ProjectConstant.PAGE_SIZE;
|
||||
}
|
||||
if (page == null || page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
List<UserInfo> userInfoList = userInfoNewService.queryUserInfoPage(map);
|
||||
Integer count = userInfoNewService.queryUserInfoPageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<UserInfo> pager = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size), page.longValue(), size.longValue(), userInfoList);
|
||||
return ResultGenerator.genSuccessResult(pager);
|
||||
}
|
||||
|
||||
|
||||
// @NoRepeatSubmit
|
||||
@PostMapping
|
||||
@ApiOperation(tags = {"页面-注册", "页面-H5注册", "页面-分享_直接开户"}, value = "用户注册", notes = "添加新的数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "UserInfo", value = "待添加的UserInfo实例", paramType = "body", dataType = "UserInfo", required = true)})
|
||||
public Result<Object> add(@RequestBody UserInfo userInfo) {
|
||||
userInfoNewService.register(userInfo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/verifyPhoneIsExist")
|
||||
@ApiOperation(tags = {"页面-注册", "页面-H5注册", "页面-分享注册", "页面-会员开卡", "页面-分享_直接开户"}, value = "未注册手机号并获取验证码", notes = "验证该手机号是否注册,未注册即发送验证码", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "storeId", value = "门店", paramType = "String", dataType = "String", required = true),
|
||||
@ApiImplicitParam(name = "phone", value = "手机号", paramType = "String", dataType = "String", required = true),
|
||||
})
|
||||
public Result<Object> verifyPhoneIsExist(String phone) {
|
||||
if (StringUtils.isBlank(phone)) {
|
||||
return ResultGenerator.genFailResult("手机号不能为空!");
|
||||
}
|
||||
|
||||
PhoneValidateCode phoneValidateCode = new PhoneValidateCode();
|
||||
phoneValidateCode.setPhone(phone);
|
||||
String checkCode = StringUtil.random(4);
|
||||
phoneValidateCode.setCode(checkCode);
|
||||
Result<Object> result = validateCodeUtil.requestValidateCode(phoneValidateCode.getPhone(), checkCode);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
//根据当前手机号查询当前手机号是否有验证码信息
|
||||
phoneValidateCodeService.saveOrReplaceIfExist(phoneValidateCode);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除数据", notes = "根据id删除数据", httpMethod = "DELETE")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "查询的id实例", paramType = "path", dataType = "Integer", required = true)})
|
||||
public Result delete(@PathVariable Long id) {
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setId(id);
|
||||
userInfoNewService.deleteUserInfo(userInfo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@PostMapping("/forgetPassword")
|
||||
@ApiOperation(tags = {"页面-忘记密码"}, value = "忘记密码", notes = "忘记密码", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "UserInfo", value = "更新的UserInfo实例", paramType = "body", dataType = "UserInfo", required = true),})
|
||||
public Result<Object> forgetPassword(@RequestBody UserInfo userInfo) {
|
||||
userInfoNewService.forgetPwd(userInfo);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
// 修改密码
|
||||
@PostMapping("/updatePassword")
|
||||
@ApiOperation(value = "修改密码", notes = "修改密码", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "UserInfo", value = "更新的UserInfo实例", paramType = "body", dataType = "UserInfo", required = true),})
|
||||
public Result updatePassword(@RequestBody UserInfo userInfo) {
|
||||
UserApp tokenUa = userAppService.queryUserAppByToken();
|
||||
if (!Objects.equals(tokenUa.getUserId(), userInfo.getId())) {
|
||||
throw new MsgException(CommonError.NO_AUTHORIZATION);
|
||||
}
|
||||
|
||||
MsgException.checkNull(userInfo.getId(), "无用户id!");
|
||||
MsgException.checkBlank(userInfo.getCheckCode(), "无验证码!");
|
||||
|
||||
UserInfo queryUserInfo = new UserInfo();
|
||||
queryUserInfo.setId(userInfo.getId());
|
||||
|
||||
// 查询当前用户信息
|
||||
queryUserInfo = userInfoNewService.queryUserInfo(queryUserInfo);
|
||||
|
||||
MsgException.checkNull(queryUserInfo, CommonError.NO_EXIST_ACCOUNT);
|
||||
|
||||
// 验证原始密码
|
||||
if (!MD5Util.MD5Encode(userInfo.getOldPassword(), "utf-8").equalsIgnoreCase(queryUserInfo.getPassword())) {
|
||||
return ResultGenerator.genFailResult("原始密码错误!");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<PhoneValidateCode> qWrapper = Wrappers.lambdaQuery();
|
||||
qWrapper.eq(PhoneValidateCode::getPhone, queryUserInfo.getPhone())
|
||||
.orderByDesc(PhoneValidateCode::getSendDt)
|
||||
.last("limit 1");
|
||||
PhoneValidateCode existValidCode = phoneValidateCodeService.getOne(qWrapper);
|
||||
MsgException.checkNull(existValidCode, "验证码不存在或验证码已失效");
|
||||
|
||||
if (!Objects.equals(existValidCode.getCode(), userInfo.getCheckCode())) {
|
||||
if (existValidCode.getAttempt() == null) {
|
||||
existValidCode.setAttempt(1);
|
||||
phoneValidateCodeService.updateById(existValidCode);
|
||||
throw new MsgException("验证码错误");
|
||||
}
|
||||
|
||||
int newAttemptCount = existValidCode.getAttempt() + 1;
|
||||
if (newAttemptCount == 5) {
|
||||
// 删除验证码
|
||||
phoneValidateCodeService.removeById(existValidCode.getId());
|
||||
throw new MsgException("验证码错误,请重新获取验证码");
|
||||
}
|
||||
} else {
|
||||
// 删除验证码
|
||||
phoneValidateCodeService.removeById(existValidCode.getId());
|
||||
}
|
||||
|
||||
// 修改密码
|
||||
UserInfo updateUserInfo = new UserInfo();
|
||||
updateUserInfo.setId(queryUserInfo.getId());
|
||||
updateUserInfo.setPassword(MD5Util.MD5Encode(userInfo.getPassword(), "utf-8"));
|
||||
updateUserInfo.setUpdateTime(new Date());
|
||||
userInfoNewService.updateById(updateUserInfo);
|
||||
|
||||
// 修改小程序密码
|
||||
UserApp userApp = new UserApp().setUserId(updateUserInfo.getId());
|
||||
userApp = userAppService.queryUserApp(userApp);
|
||||
if (userApp != null && "promoter".equals(userApp.getUserType())) {
|
||||
String url = "https://shop.shouyinbei.net/web/wmerchant.php?c=site&a=entry&ctrl=store&ac=oauth&op=set_password&do=web&m=we7_wmall&i=1";
|
||||
url += "&password=" + updateUserInfo.getPassword();
|
||||
url += "&mobile=" + queryUserInfo.getLoginName();
|
||||
log.info("==================>修改小程序请求链接为: {}<=================", url);
|
||||
try {
|
||||
String result = restTemplate.getForObject(url, String.class);
|
||||
log.info("==================>修改小程序密码结果: {}<=================", result);
|
||||
} catch (Exception e) {
|
||||
log.info("==================>修改小程序密码异常: {}<=================", e.getMessage());
|
||||
}
|
||||
}
|
||||
// ============
|
||||
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("/{loginName}/{password}")
|
||||
@ApiOperation(tags = {"页面-登录", "页面-切换商户"}, value = "登录", notes = "登录接口", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "loginName", value = "查询的loginName", paramType = "path", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "password", value = "查询的password", paramType = "path", required = true, dataType = "String")})
|
||||
public Result<Map<String, Object>> detail(@PathVariable("loginName") String loginName, @PathVariable("password") String password) {
|
||||
Map<String, Object> login = userInfoNewService.login(loginName, password);
|
||||
return ResultGenerator.genSuccessResult(login);
|
||||
}
|
||||
|
||||
// 修改手机号
|
||||
@PostMapping("/changePhone")
|
||||
@ApiOperation(value = "修改手机号", notes = "修改手机号", httpMethod = "POST")
|
||||
public Result<Object> changePhone(@Valid @RequestBody ChangePwdDTO changePwdDTO) {
|
||||
userInfoNewService.changePhone(changePwdDTO);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
// @PostMapping("/changeRate")
|
||||
// public Result<Object> changeRate(@RequestBody Map<String, Object>param) {
|
||||
// userInfoNewService.apiChangeRate(param.get("userId").toString(), Integer.parseInt(param.get("rate").toString()));
|
||||
// return ResultGenerator.genSuccessResult("修改成功,费率次日生效", null);
|
||||
// }
|
||||
|
||||
@GetMapping("/userMerchantBaseInfo")
|
||||
public Result<JSONObject> getUserMerchantBaseInfo() {
|
||||
JSONObject result = userInfoNewService.getUserMerchantBaseInfo();
|
||||
return ResultGenerator.genSuccessResult(result);
|
||||
}
|
||||
|
||||
@PostMapping("/savePayPassword")
|
||||
public Result<Object> savePayPassword(@RequestBody UserInfo userInfo) {
|
||||
userInfoNewService.savePayPassword(userInfo);
|
||||
return ResultGenerator.genSuccessResult("保存安全密码成功", null);
|
||||
}
|
||||
|
||||
@PostMapping("/verifyPayPassword")
|
||||
public Result<Object> verifyPayPassword(@RequestBody Map<String, Object> param) {
|
||||
String payPassword = param.get("payPassword").toString();
|
||||
userInfoNewService.apiVerifyPayPassword(payPassword);
|
||||
return ResultGenerator.genSuccessResult("支付密码校验通过", null);
|
||||
}
|
||||
|
||||
@OpLog(opCode = "APP_FACE_CERT", opDetail = "APP人脸识别通过", opName = "APP人脸识别结果")
|
||||
@PostMapping("/verifyFaceCert")
|
||||
public Result<Object> verifyFaceCert() {
|
||||
userInfoNewService.appVerifyFaceCert();
|
||||
return ResultGenerator.genSuccessResult("修改成功", null);
|
||||
}
|
||||
|
||||
@OpLog(opCode = "APP_FACE_CERT", opDetail = "APP人脸识别失败", opName = "APP人脸识别结果")
|
||||
@PostMapping("/verifyFaceCertFail")
|
||||
public Result<Object> faceCertFail() {
|
||||
userInfoNewService.appVerifyFaceCert();
|
||||
return ResultGenerator.genSuccessResult("修改成功", null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.pluss.platform.controller;
|
||||
|
||||
import cn.pluss.platform.api.Result;
|
||||
import cn.pluss.platform.user.UserLevelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
*
|
||||
*用户等级APP接口
|
||||
*@author: bzg
|
||||
*@time: 2022/1/25 14:49
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/user")
|
||||
@Api(value = "UserLevel控制类", tags = {"UserLevel接口"})
|
||||
public class UserLevelController {
|
||||
|
||||
|
||||
@Resource
|
||||
private UserLevelService userLevelService;
|
||||
|
||||
/**
|
||||
* 获取用户等级配置
|
||||
* @date: 2022/1/25 14:51
|
||||
* @return cn.pluss.platform.api.Result<java.lang.Object>
|
||||
*/
|
||||
@GetMapping("/level/get")
|
||||
@ApiOperation(value = "用户等级配置", notes = "用户等级配置", httpMethod = "GET")
|
||||
public Result<Object> levelGet() {
|
||||
return userLevelService.getAppLevelInfo();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user