init commit crmeb
This commit is contained in:
parent
5b6484c131
commit
63391a5195
47
crmeb/.gitignore
vendored
Normal file
47
crmeb/.gitignore
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**
|
||||
!**/src/test/**
|
||||
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/crmeb_log/log_debug.log
|
||||
/crmeb_log/log_error.log
|
||||
/crmeb_log/log_info.log
|
||||
/crmeb_log/log_warn.log
|
||||
/crmeb_log/
|
||||
/.idea/
|
||||
src/main/java/com/zbkj/.DS_Store
|
||||
src/main/java/com/.DS_Store
|
||||
src/main/java/.DS_Store
|
||||
src/main/.DS_Store
|
||||
.DS_Store
|
||||
|
||||
|
||||
|
||||
xx
|
||||
118
crmeb/.mvn/wrapper/MavenWrapperDownloader.java
vendored
Normal file
118
crmeb/.mvn/wrapper/MavenWrapperDownloader.java
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2007-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenWrapperDownloader {
|
||||
|
||||
private static final String WRAPPER_VERSION = "0.5.6";
|
||||
/**
|
||||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
||||
*/
|
||||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
||||
|
||||
/**
|
||||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
||||
* use instead of the default one.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
||||
".mvn/wrapper/maven-wrapper.properties";
|
||||
|
||||
/**
|
||||
* Path where the maven-wrapper.jar will be saved to.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_JAR_PATH =
|
||||
".mvn/wrapper/maven-wrapper.jar";
|
||||
|
||||
/**
|
||||
* Name of the property which should be used to override the default download url for the wrapper.
|
||||
*/
|
||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("- Downloader started");
|
||||
File baseDirectory = new File(args[0]);
|
||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
||||
|
||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
||||
// wrapperUrl parameter.
|
||||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
||||
String url = DEFAULT_DOWNLOAD_URL;
|
||||
if (mavenWrapperPropertyFile.exists()) {
|
||||
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
||||
try {
|
||||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
||||
Properties mavenWrapperProperties = new Properties();
|
||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
||||
} catch (IOException e) {
|
||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
||||
} finally {
|
||||
try {
|
||||
if (mavenWrapperPropertyFileInputStream != null) {
|
||||
mavenWrapperPropertyFileInputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Ignore ...
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading from: " + url);
|
||||
|
||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
||||
if (!outputFile.getParentFile().exists()) {
|
||||
if (!outputFile.getParentFile().mkdirs()) {
|
||||
System.out.println(
|
||||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
||||
try {
|
||||
downloadFileFromURL(url, outputFile);
|
||||
System.out.println("Done");
|
||||
System.exit(0);
|
||||
} catch (Throwable e) {
|
||||
System.out.println("- Error downloading");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
||||
String username = System.getenv("MVNW_USERNAME");
|
||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
}
|
||||
URL website = new URL(urlString);
|
||||
ReadableByteChannel rbc;
|
||||
rbc = Channels.newChannel(website.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(destination);
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
fos.close();
|
||||
rbc.close();
|
||||
}
|
||||
|
||||
}
|
||||
BIN
crmeb/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
crmeb/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
2
crmeb/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
2
crmeb/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
||||
52
crmeb/README.md
Normal file
52
crmeb/README.md
Normal file
@ -0,0 +1,52 @@
|
||||
# 环境
|
||||
1. Java Jdk1.8
|
||||
2. Redis 5+
|
||||
3. Mysql 5.7+
|
||||
|
||||
# Java项目框架
|
||||
1. SpringBoot 2.2.6.RELEASE
|
||||
2. Maven 3.6.1
|
||||
3. Swagger 2.9.2
|
||||
4. Mybatis Plus 3.3.1
|
||||
|
||||
# 部署
|
||||
1. 拿到jar包,上传到web目录下,(宝塔配置的域名指向的web目录下即可)
|
||||
2. 在 jar包同级目录下运行 `start.sh (运行命令为 ./start.sh )` 脚本即可启动项目
|
||||
3. shell脚本会自动运行 `tail -f crmeb_out.file` 命令输出当前启动日志
|
||||
4. 看到 `Completed 200 OK` 表示启动成功
|
||||
5. 默认启动 `20000` 端口号
|
||||
|
||||
|
||||
#
|
||||
# 注意事项
|
||||
1. web端口号不可以设置为`20000`
|
||||
2. 反向代理地址: `http://127.0.0.1:20000` 【外网域名指向这个地址】
|
||||
|
||||
# 二次开发帮助文档
|
||||
##注解参考:
|
||||
1. `@NotNull` 注解 作用类型 解释 任何类型 属性不能为 `null`
|
||||
2. `@NotEmpty` 集合 集合不能为 `null`,且 `size` 大于 `0`
|
||||
3. `@NotBlank` 只能作用在 `String` 上,不能为 `null`,而且调用 `trim()` 后,长度必须大于 `0`
|
||||
4. `@AssertTrue` `Boolean、boolean` 布尔属性必须是 `true`
|
||||
5. `@Min` 数字类型(原子和包装) 限定数字的最小值(整型)
|
||||
6. `@Max` 同 `@Min` 限定数字的最大值(整型)
|
||||
7. `@DecimalMin` 同 `@Min` 限定数字的最小值(字符串,可以是小数)
|
||||
8. `@DecimalMax` 同 `@Min` 限定数字的最大值(字符串,可以是小数)
|
||||
9. `@Range` 数字类型(原子和包装) 限定数字范围(长整型)
|
||||
10. `@Length` 字符串 限定字符串长度
|
||||
11. `@Size` 集合 限定集合大小
|
||||
12. `@Past` 时间、日期 必须是一个过去的时间或日期
|
||||
13. `@Future` 时期、时间 必须是一个未来的时间或日期
|
||||
14. `@Email` 字符串 必须是一个邮箱格式
|
||||
15. `@Pattern` 字符串、字符 正则匹配字符串
|
||||
|
||||
# 产品复制
|
||||
1. 设置 [99api](https://www.99api.com "99api") 对应的api到配置表eb_system_config
|
||||
2. 配置baseUrl和key 实际的key可以根据自己的定义修改
|
||||
3. 目前支持天猫,京东,淘宝,苏宁,拼多多
|
||||
|
||||
# 打印机
|
||||
1. [易联云文档](http://doc2.10ss.net/337744 "易联云文档")
|
||||
2. [易联云JAVA SDK](http://doc2.10ss.net/337744 "易联云JAVA SDK gitee文档")
|
||||
3. [如何导入第三方JAVA SDK包](https://blog.csdn.net/weixin_46028577/article/details/106342938?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase "如何导入第三方JAVA SDK包")
|
||||
|
||||
77
crmeb/crmeb-admin/pom.xml
Normal file
77
crmeb/crmeb-admin/pom.xml
Normal file
@ -0,0 +1,77 @@
|
||||
<?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>crmeb</artifactId>
|
||||
<groupId>com.zbkj</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>crmeb-admin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<crmeb-service>0.0.1-SNAPSHOT</crmeb-service>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zbkj</groupId>
|
||||
<artifactId>crmeb-service</artifactId>
|
||||
<version>${crmeb-service}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!--打包配置-->
|
||||
<finalName>Crmeb-admin</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.3.0.RELEASE</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<resources>
|
||||
<!-- <resource>-->
|
||||
<!-- <directory>src/main/resources</directory>-->
|
||||
<!-- <!– 处理文件时替换文件中的变量 –>-->
|
||||
<!-- <filtering>true</filtering>-->
|
||||
<!-- <excludes>-->
|
||||
<!-- <!– 打包时排除文件 –>-->
|
||||
<!--<!– <exclude>application.yml</exclude>–>-->
|
||||
<!-- <exclude>application-{profile}.yml</exclude>-->
|
||||
<!--<!– <exclude>application-beta.yml</exclude>–>-->
|
||||
<!--<!– <exclude>application-prod.yml</exclude>–>-->
|
||||
<!-- </excludes>-->
|
||||
<!-- </resource>-->
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<!-- <resource>-->
|
||||
<!-- <directory>src/main/resources.${spring.profiles.active}</directory>-->
|
||||
<!-- <filtering>false</filtering>-->
|
||||
<!-- </resource>-->
|
||||
<!--这个元素描述了项目相关的所有资源路径列表,例如和项目相关的属性文件,这些资源被包含在最终的打包文件里。-->
|
||||
<resource>
|
||||
<!-- 描述存放资源的目录,该路径相对POM路径-->
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,38 @@
|
||||
package com.zbkj.admin;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* 程序主入口
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@EnableAsync //开启异步调用
|
||||
@EnableSwagger2
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) //去掉数据源
|
||||
@ComponentScan(basePackages = {"com.zbkj"})
|
||||
@MapperScan(basePackages = {"com.zbkj.**.dao"})
|
||||
public class CrmebAdminApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CrmebAdminApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.zbkj.admin.acpect;
|
||||
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
/**
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
* 所有的前端controller层的拦截业务,方法的执行时间长度,
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class ControllerAspect {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(ControllerAspect.class);
|
||||
|
||||
@Pointcut("execution(* com.zbkj.admin.controller.*.*(..))")
|
||||
private void pointCutMethodController() {
|
||||
|
||||
}
|
||||
|
||||
@Around("pointCutMethodController()")
|
||||
public Object doAroundService(ProceedingJoinPoint pjp) throws Throwable {
|
||||
|
||||
long begin = System.nanoTime();
|
||||
|
||||
Object obj = pjp.proceed();
|
||||
|
||||
long end = System.nanoTime();
|
||||
|
||||
logger.info("Controller method:{},prams:{},cost time:{} ns,cost:{} ms",
|
||||
|
||||
pjp.getSignature().toString(), Arrays.toString(pjp.getArgs()), (end - begin), (end - begin) / 1000000);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.zbkj.admin.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
/** 跨域配置
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig{
|
||||
private CorsConfiguration buildConfig() {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
//允许任何域名
|
||||
corsConfiguration.addAllowedOrigin("*");
|
||||
//允许任何头
|
||||
corsConfiguration.addAllowedHeader("*");
|
||||
//允许任何方法
|
||||
corsConfiguration.addAllowedMethod("*");
|
||||
return corsConfiguration;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
//注册
|
||||
source.registerCorsConfiguration("/**", buildConfig());
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.zbkj.admin.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.support.http.StatViewServlet;
|
||||
import com.alibaba.druid.support.http.WebStatFilter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* Druid配置组件
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Configuration
|
||||
public class DruidConfig {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean druidServlet() { // 主要实现WEB监控的配置处理
|
||||
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*"); // 进行druid监控的配置处理操作
|
||||
// servletRegistrationBean.addInitParameter("allow",
|
||||
// "127.0.0.1,192.168.1.159"); // 白名单
|
||||
// servletRegistrationBean.addInitParameter("deny", "192.168.1.200"); // 黑名单
|
||||
servletRegistrationBean.addInitParameter("loginUsername", "kf"); // 用户名
|
||||
servletRegistrationBean.addInitParameter("loginPassword", "654321"); // 密码
|
||||
servletRegistrationBean.addInitParameter("resetEnable", "true"); // 是否可以重置数据源
|
||||
return servletRegistrationBean ;
|
||||
}
|
||||
@Bean
|
||||
public FilterRegistrationBean filterRegistrationBean() {
|
||||
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean() ;
|
||||
filterRegistrationBean.setFilter(new WebStatFilter());
|
||||
|
||||
filterRegistrationBean.addUrlPatterns("/*"); // 所有请求进行监控处理
|
||||
//不必监控的请求
|
||||
filterRegistrationBean.addInitParameter("exclusions", "*.html,*.png,*.ico,*.js,*.gif,*.jpg,*.css,/druid/*");
|
||||
return filterRegistrationBean ;
|
||||
}
|
||||
@Bean("dataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource")
|
||||
public DataSource druidDataSource() {
|
||||
return new DruidDataSource();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
package com.zbkj.admin.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Jackjson配置组件
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Configuration
|
||||
public class JacksonConfig {
|
||||
|
||||
/**
|
||||
* Jackson全局转化BigDecimal类型为String,解决jackson序列化时BigDecimal类型缺失精度问题
|
||||
*
|
||||
* @return Jackson2ObjectMapperBuilderCustomizer 注入的对象
|
||||
*/
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
|
||||
|
||||
return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.serializerByType(BigDecimal.class, ToStringSerializer.instance);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.zbkj.admin.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* RestTemplate配置组件
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Configuration
|
||||
public class RestTemplateConfig {
|
||||
@Bean
|
||||
public RestTemplate restTemplate(ClientHttpRequestFactory factory) {
|
||||
RestTemplate restTemplate = new RestTemplate(factory);
|
||||
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
|
||||
restTemplate.getMessageConverters().add(new WxMappingJackson2HttpMessageConverter());
|
||||
return restTemplate;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHttpRequestFactory httpRequestFactory() {
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setReadTimeout(10000);//ms
|
||||
factory.setConnectTimeout(15000);//ms
|
||||
return factory;
|
||||
}
|
||||
|
||||
//解决微信返回json Content-Type 值却是 text/plain 的问题
|
||||
public class WxMappingJackson2HttpMessageConverter extends MappingJackson2HttpMessageConverter {
|
||||
public WxMappingJackson2HttpMessageConverter(){
|
||||
List<MediaType> mediaTypes = new ArrayList<>();
|
||||
mediaTypes.add(MediaType.TEXT_PLAIN);
|
||||
mediaTypes.add(MediaType.TEXT_HTML);
|
||||
setSupportedMediaTypes(mediaTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.zbkj.admin.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
|
||||
/**
|
||||
* Spring 定时任务配置
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
public class SchedulerConfig implements SchedulingConfigurer {
|
||||
private final int poolSize = 30;
|
||||
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
|
||||
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
|
||||
|
||||
threadPoolTaskScheduler.setPoolSize(getPoolSize());
|
||||
threadPoolTaskScheduler.setThreadNamePrefix("crmeb-scheduled-task-pool-");
|
||||
threadPoolTaskScheduler.initialize();
|
||||
|
||||
scheduledTaskRegistrar.setTaskScheduler(threadPoolTaskScheduler);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
package com.zbkj.admin.config;
|
||||
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.google.common.base.Predicate;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.*;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.collect.Lists.newArrayList;
|
||||
|
||||
/**
|
||||
* Swagger配置组件
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
@ConfigurationProperties(prefix = "api.doc")
|
||||
public class SwaggerConfig{
|
||||
|
||||
//是否开启swagger,正式环境一般是需要关闭的,可根据springboot的多环境配置进行设置
|
||||
Boolean swaggerEnabled = true;
|
||||
|
||||
@Value("${server.port}")
|
||||
private String port;
|
||||
|
||||
@Value("${crmeb.domain}")
|
||||
private String domain;
|
||||
|
||||
@Bean("admin")
|
||||
public Docket createRestApis() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("admin")
|
||||
.host(domain)
|
||||
.apiInfo(apiInfo())
|
||||
// 是否开启
|
||||
.enable(swaggerEnabled)
|
||||
.select()
|
||||
// 扫描的路径包
|
||||
.apis(RequestHandlerSelectors.basePackage("com.zbkj.admin"))
|
||||
// 指定路径处理PathSelectors.any()代表所有的路径
|
||||
.paths(adminPathsAnt())
|
||||
.build()
|
||||
.securitySchemes(security())
|
||||
.securityContexts(securityContexts())
|
||||
// .globalOperationParameters(pars) // 针对单个url的验证 如果需要的话
|
||||
.pathMapping("/");
|
||||
}
|
||||
|
||||
@Bean("public")
|
||||
public Docket create2RestApis() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("public")
|
||||
.host(domain)
|
||||
.apiInfo(apiInfo())
|
||||
// 是否开启
|
||||
.enable(swaggerEnabled)
|
||||
.select()
|
||||
// 扫描的路径包
|
||||
.apis(RequestHandlerSelectors.basePackage("com.zbkj.admin"))
|
||||
// 指定路径处理PathSelectors.any()代表所有的路径
|
||||
.paths(publicPathsAnt()) //只监听
|
||||
.build()
|
||||
.securitySchemes(security())
|
||||
.securityContexts(securityContexts())
|
||||
// .globalOperationParameters(pars) // 针对单个url的验证 如果需要的话
|
||||
.pathMapping("/");
|
||||
}
|
||||
|
||||
private Predicate<String> adminPathsAnt() {
|
||||
return PathSelectors.ant("/api/admin/**");
|
||||
}
|
||||
|
||||
private Predicate<String> publicPathsAnt() {
|
||||
return PathSelectors.ant("/api/public/**");
|
||||
}
|
||||
|
||||
private List<ApiKey> security() {
|
||||
return newArrayList(
|
||||
new ApiKey(Constants.HEADER_AUTHORIZATION_KEY, Constants.HEADER_AUTHORIZATION_KEY, "header")
|
||||
);
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("Crmeb Java")
|
||||
.description("Crmeb")
|
||||
.termsOfServiceUrl("http://host:port")
|
||||
.version("1.0.0").build();
|
||||
}
|
||||
|
||||
|
||||
private List<SecurityContext> securityContexts() {
|
||||
List<SecurityContext> res = new ArrayList<>();
|
||||
res.add(SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.forPaths(PathSelectors.regex("/.*"))
|
||||
.build());
|
||||
return res;
|
||||
}
|
||||
|
||||
private List<SecurityReference> defaultAuth() {
|
||||
List<SecurityReference> res = new ArrayList<>();
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", Constants.HEADER_AUTHORIZATION_KEY);
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
res.add(new SecurityReference(Constants.HEADER_AUTHORIZATION_KEY, authorizationScopes));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
package com.zbkj.admin.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* Task类的线程配置
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
public class TaskExecutorConfig {
|
||||
|
||||
//普通模式
|
||||
private final int taskCorePoolSize = 20; //核心线程池数量
|
||||
private final int taskMaxPoolSize = 100; //最大线程
|
||||
private final int taskQueueCapacity = 200; //缓存队列条数
|
||||
private final int taskKeepAliveSecond = 10; //允许的空闲时间
|
||||
private final String taskNamePrefix = "task-executor-"; //线程名称前缀
|
||||
|
||||
//发布订阅模式
|
||||
// private final int listenerCorePoolSize = 3;
|
||||
// private final int listenerMaxPoolSize = 20;
|
||||
// private final int listenerQueueCapacity = 200;
|
||||
// private final int listenerKeepAliveSecond = 10;
|
||||
// private final String listenerNamePrefix = "listener-executor-";
|
||||
|
||||
//普通模式
|
||||
@Bean("taskExecutor")
|
||||
public ThreadPoolTaskExecutor taskExecutor(){
|
||||
return initTaskExecutor(
|
||||
getTaskCorePoolSize(),
|
||||
getTaskMaxPoolSize(),
|
||||
getTaskQueueCapacity(),
|
||||
getTaskKeepAliveSecond(),
|
||||
getTaskNamePrefix()
|
||||
);
|
||||
}
|
||||
|
||||
// //针对发布订阅(pub listener) 的线程池
|
||||
// @Bean("listenerTaskExecutor")
|
||||
// public ThreadPoolTaskExecutor listenerTaskExecutor(){
|
||||
// return initTaskExecutor(getListenerCorePoolSize(), getListenerMaxPoolSize(),
|
||||
// getListenerQueueCapacity(), getListenerKeepAliveSecond(), getListenerNamePrefix());
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
* 初始化TaskExecutor
|
||||
* @param corePoolSize int 默认线程数
|
||||
* @param maxPoolSize int 最大线程数
|
||||
* @param queueCapacity int 缓冲队列长度
|
||||
* @param keepAliveSecond int 允许空闲时间
|
||||
* @param namePrefix String 名称的前缀
|
||||
*
|
||||
* @return ThreadPoolTaskExecutor
|
||||
*/
|
||||
private ThreadPoolTaskExecutor initTaskExecutor(int corePoolSize, int maxPoolSize,
|
||||
int queueCapacity, int keepAliveSecond, String namePrefix){
|
||||
//callrunspolicy:由调度线程(提交任务的线程)处理该任务CallerRunsPolicy
|
||||
return initTaskExecutor(corePoolSize, maxPoolSize, queueCapacity, keepAliveSecond, namePrefix,
|
||||
new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化TaskExecutor
|
||||
* @param corePoolSize int 默认线程数
|
||||
* @param maxPoolSize int 最大线程数
|
||||
* @param queueCapacity int 缓冲队列长度
|
||||
* @param keepAliveSecond int 允许空闲时间
|
||||
* @param namePrefix String 名称的前缀
|
||||
* @param rejectedExecutionHandler 线程池满的时候如何处理
|
||||
* @return ThreadPoolTaskExecutor
|
||||
*/
|
||||
private ThreadPoolTaskExecutor initTaskExecutor(int corePoolSize, int maxPoolSize,
|
||||
int queueCapacity, int keepAliveSecond, String namePrefix,
|
||||
RejectedExecutionHandler rejectedExecutionHandler){
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(corePoolSize);//核心线程数(默认线程数)
|
||||
executor.setMaxPoolSize(maxPoolSize);//最大线程数
|
||||
executor.setQueueCapacity(queueCapacity);//缓冲队列数
|
||||
executor.setKeepAliveSeconds(keepAliveSecond);//允许线程空闲时间(单位默认为秒)
|
||||
executor.setThreadNamePrefix(namePrefix);//线程名前缀
|
||||
|
||||
//线程池对拒绝任务的处理策略,
|
||||
executor.setRejectedExecutionHandler(rejectedExecutionHandler);
|
||||
|
||||
//初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.zbkj.admin.config;
|
||||
|
||||
import com.zbkj.admin.filter.ResponseFilter;
|
||||
import com.zbkj.common.config.CrmebConfig;
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.interceptor.SwaggerInterceptor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
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 org.springframework.web.servlet.handler.MappedInterceptor;
|
||||
|
||||
/**
|
||||
* token验证拦截器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
// 这里使用一个Bean为的是可以在拦截器中自由注入,也可以在拦截器中使用SpringUtil.getBean 获取
|
||||
// 但是觉得这样更优雅
|
||||
|
||||
@Autowired
|
||||
CrmebConfig crmebConfig;
|
||||
|
||||
@Bean
|
||||
public ResponseFilter responseFilter(){ return new ResponseFilter(); }
|
||||
|
||||
@Value("${swagger.basic.username}")
|
||||
private String username;
|
||||
@Value("${swagger.basic.password}")
|
||||
private String password;
|
||||
@Value("${swagger.basic.check}")
|
||||
private Boolean check;
|
||||
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
//添加token拦截器
|
||||
//addPathPatterns添加需要拦截的命名空间;
|
||||
//excludePathPatterns添加排除拦截命名空间
|
||||
|
||||
|
||||
// //后台token拦截
|
||||
// registry.addInterceptor(adminTokenInterceptor()).
|
||||
// addPathPatterns("/api/admin/**").
|
||||
// excludePathPatterns("/api/admin/validate/**").
|
||||
// excludePathPatterns("/api/admin/login").
|
||||
// excludePathPatterns("/api/admin/logout").
|
||||
// excludePathPatterns("/api/admin/getLoginPic").
|
||||
// excludePathPatterns("/api/admin/wechat/config").
|
||||
// excludePathPatterns("/api/admin/authorize/login").
|
||||
// excludePathPatterns("/api/admin/payment/callback/**").
|
||||
//// excludePathPatterns("/api/admin/system/role/menu").
|
||||
// excludePathPatterns("/api/admin/system/role/info").
|
||||
// excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
|
||||
//
|
||||
// //后台权限规则
|
||||
// registry.addInterceptor(adminAuthInterceptor()).
|
||||
// addPathPatterns("/api/admin/**").
|
||||
// excludePathPatterns("/api/admin/validate/**").
|
||||
// excludePathPatterns("/api/admin/login").
|
||||
// excludePathPatterns("/api/admin/logout").
|
||||
// excludePathPatterns("/api/admin/getLoginPic").
|
||||
// excludePathPatterns("/api/admin/payment/callback/**").
|
||||
// excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/**")
|
||||
.addResourceLocations("classpath:/static/");
|
||||
registry.addResourceHandler("doc.html")
|
||||
.addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**")
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
|
||||
/** 本地文件上传路径 */
|
||||
registry.addResourceHandler(Constants.UPLOAD_TYPE_IMAGE + "/**")
|
||||
.addResourceLocations("file:" + crmebConfig.getImagePath() + "/" + Constants.UPLOAD_TYPE_IMAGE + "/");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean filterRegister() {
|
||||
//注册过滤器
|
||||
FilterRegistrationBean registration = new FilterRegistrationBean(responseFilter());
|
||||
// 仅仅api前缀的请求才会拦截
|
||||
registration.addUrlPatterns("/api/admin/*");
|
||||
registration.addUrlPatterns("/api/front/*");
|
||||
return registration;
|
||||
}
|
||||
|
||||
/* 必须在此处配置拦截器,要不然拦不到swagger的静态资源 */
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "swagger.basic.enable", havingValue = "true")
|
||||
public MappedInterceptor getMappedInterceptor() {
|
||||
return new MappedInterceptor(new String[]{"/doc.html", "/webjars/**"}, new SwaggerInterceptor(username, password, check));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,157 @@
|
||||
package com.zbkj.admin.config;
|
||||
|
||||
import com.zbkj.admin.filter.JwtAuthenticationTokenFilter;
|
||||
import com.zbkj.admin.manager.AuthenticationEntryPointImpl;
|
||||
import com.zbkj.admin.manager.CustomAccessDeniedHandler;
|
||||
import com.zbkj.admin.manager.CustomAuthenticationProvider;
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.service.service.impl.UserDetailServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.security.web.authentication.logout.LogoutFilter;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
/**
|
||||
* Security配置
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
/**
|
||||
* 跨域过滤器
|
||||
*/
|
||||
@Autowired
|
||||
private CorsFilter corsFilter;
|
||||
|
||||
/**
|
||||
* token认证过滤器
|
||||
*/
|
||||
@Bean
|
||||
public JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter() {
|
||||
return new JwtAuthenticationTokenFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* 认证失败处理类
|
||||
*/
|
||||
@Bean
|
||||
public AuthenticationEntryPointImpl unauthorizedHandler() {
|
||||
return new AuthenticationEntryPointImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* 鉴权失败处理类
|
||||
*/
|
||||
@Bean
|
||||
public CustomAccessDeniedHandler accessDeniedHandler() {
|
||||
return new CustomAccessDeniedHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* 这里将Spring Security自带的authenticationManager声明成Bean,声明它的作用是用它帮我们进行认证操作,
|
||||
* 调用这个Bean的authenticate方法会由Spring Security自动帮我们做认证。
|
||||
*/
|
||||
// @Bean
|
||||
// public AuthenticationManager authenticationManager() throws Exception {
|
||||
// return new CusAuthenticationManager(customAuthenticationProvider);
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) {
|
||||
auth.authenticationProvider(new CustomAuthenticationProvider(new UserDetailServiceImpl()));
|
||||
}
|
||||
|
||||
/**
|
||||
* anyRequest | 匹配所有请求路径
|
||||
* access | SpringEl表达式结果为true时可以访问
|
||||
* anonymous | 匿名可以访问
|
||||
* denyAll | 用户不能访问
|
||||
* fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录)
|
||||
* hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问
|
||||
* hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问
|
||||
* hasAuthority | 如果有参数,参数表示权限,则其权限可以访问
|
||||
* hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问
|
||||
* hasRole | 如果有参数,参数表示角色,则其角色可以访问
|
||||
* permitAll | 用户可以任意访问
|
||||
* rememberMe | 允许通过remember-me登录的用户访问
|
||||
* authenticated | 用户登录后可访问
|
||||
*/
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
|
||||
// CRSF禁用,因为不使用session
|
||||
http.cors().and().csrf().disable()
|
||||
// 认证失败处理类
|
||||
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler())
|
||||
.accessDeniedHandler(accessDeniedHandler()).and()
|
||||
// 基于token,所以不需要session
|
||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
|
||||
// 过滤请求
|
||||
.authorizeRequests()
|
||||
// 跨域预检请求
|
||||
// .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||
// 对于登录login 验证码captchaImage 和其他放行的目录 允许匿名访问"/citylife/front/**"
|
||||
.antMatchers("/api/admin/login", "/api/admin/validate/code/get").permitAll()
|
||||
.antMatchers("/api/admin/getLoginPic").permitAll()
|
||||
// 放行资源路径
|
||||
.antMatchers("/"+ Constants.UPLOAD_TYPE_IMAGE +"/**").anonymous()
|
||||
// 放行图片、文件上传
|
||||
.antMatchers("/api/admin/upload/image").permitAll()
|
||||
.antMatchers("/api/admin/upload/file").permitAll()
|
||||
// 代码生成器
|
||||
.antMatchers("/api/codegen/code").permitAll()
|
||||
// .antMatchers("/wx/user/*/login","/citylife/nocheck/**").anonymous()
|
||||
.antMatchers(
|
||||
HttpMethod.GET,
|
||||
"/*.html",
|
||||
"/**/*.html",
|
||||
"/**/*.css",
|
||||
"/**/*.js"
|
||||
).permitAll()
|
||||
.antMatchers("/profile/**").anonymous()
|
||||
.antMatchers("/common/download**").anonymous()
|
||||
.antMatchers("/common/download/resource**").anonymous()
|
||||
.antMatchers("/doc.html").permitAll()
|
||||
.antMatchers("/swagger-resources/**").permitAll()
|
||||
.antMatchers("/webjars/**").permitAll()
|
||||
.antMatchers("/v2/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html/**").permitAll()
|
||||
.antMatchers("/*/api-docs").anonymous()
|
||||
.antMatchers("/druid/**").anonymous()
|
||||
.antMatchers("/captcha/get", "/captcha/check").anonymous()
|
||||
.antMatchers("/api/admin/payment/callback/**").anonymous()
|
||||
.antMatchers("/api/public/**").anonymous()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.headers().frameOptions().disable();// 防止iframe 造成跨域
|
||||
// http.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
|
||||
// 添加JWT filter
|
||||
// 开启登录认证流程过滤器
|
||||
http.addFilterBefore(jwtAuthenticationTokenFilter(), UsernamePasswordAuthenticationFilter.class);
|
||||
// 添加CORS filter
|
||||
http.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
|
||||
http.addFilterBefore(corsFilter, LogoutFilter.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.request.SystemAdminLoginRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.MenusResponse;
|
||||
import com.zbkj.common.response.SystemAdminResponse;
|
||||
import com.zbkj.common.response.SystemLoginResponse;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.admin.service.AdminLoginService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 管理端登录服务
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin")
|
||||
@Api(tags = "管理端登录服务")
|
||||
public class AdminLoginController {
|
||||
|
||||
@Autowired
|
||||
private AdminLoginService adminLoginService;
|
||||
|
||||
@ApiOperation(value="PC登录")
|
||||
@PostMapping(value = "/login", produces = "application/json")
|
||||
public CommonResult<SystemLoginResponse> SystemAdminLogin(@RequestBody @Validated SystemAdminLoginRequest systemAdminLoginRequest, HttpServletRequest request) {
|
||||
String ip = CrmebUtil.getClientIp(request);
|
||||
SystemLoginResponse systemAdminResponse = adminLoginService.login(systemAdminLoginRequest, ip);
|
||||
return CommonResult.success(systemAdminResponse, "login success");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:logout')")
|
||||
@ApiOperation(value="PC登出")
|
||||
@GetMapping(value = "/logout")
|
||||
public CommonResult<SystemAdminResponse> SystemAdminLogout() {
|
||||
adminLoginService.logout();
|
||||
return CommonResult.success("logout success");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:info')")
|
||||
@ApiOperation(value="获取用户详情")
|
||||
@GetMapping(value = "/getAdminInfoByToken")
|
||||
public CommonResult<SystemAdminResponse> getAdminInfo() {
|
||||
return CommonResult.success(adminLoginService.getInfoByToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录页图片
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@ApiOperation(value = "获取登录页图片")
|
||||
@RequestMapping(value = "/getLoginPic", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> getLoginPic() {
|
||||
return CommonResult.success(adminLoginService.getLoginPic());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取管理员可访问目录
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:login:menus')")
|
||||
@ApiOperation(value = "获取管理员可访问目录")
|
||||
@RequestMapping(value = "/getMenus", method = RequestMethod.GET)
|
||||
public CommonResult<List<MenusResponse>> getMenus() {
|
||||
return CommonResult.success(adminLoginService.getMenus());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.model.article.Article;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.ArticleRequest;
|
||||
import com.zbkj.common.request.ArticleSearchRequest;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.vo.ArticleVo;
|
||||
import com.zbkj.service.service.ArticleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 文章管理表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/article")
|
||||
@Api(tags = "文章管理")
|
||||
public class ArticleController {
|
||||
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
|
||||
/**
|
||||
* 分页显示文章管理表
|
||||
* @param request ArticleSearchRequest 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:article:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="keywords", value="搜索关键字")
|
||||
public CommonResult<CommonPage<ArticleVo>> getList(@Validated ArticleSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getAdminList(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文章管理表
|
||||
* @param articleRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:article:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated ArticleRequest articleRequest) {
|
||||
if (articleService.create(articleRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文章管理表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:article:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="文章ID")
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (articleService.deleteById(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文章管理表
|
||||
* @param id integer id
|
||||
* @param articleRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:article:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@ApiImplicitParam(name="id", value="文章ID")
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated ArticleRequest articleRequest) {
|
||||
if (articleService.updateArticle(id, articleRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文章管理表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:article:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="文章ID")
|
||||
public CommonResult<Article> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(articleService.getDetail(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.service.service.CallbackService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 支付回调
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/payment/callback")
|
||||
@Api(tags = "支付回调")
|
||||
public class CallbackController {
|
||||
|
||||
@Autowired
|
||||
private CallbackService callbackService;
|
||||
|
||||
/**
|
||||
* 微信支付回调
|
||||
*/
|
||||
@ApiOperation(value = "微信支付回调")
|
||||
@RequestMapping(value = "/wechat", method = RequestMethod.POST)
|
||||
public String weChat(@RequestBody String request) {
|
||||
System.out.println("微信支付回调 request ===> " + request);
|
||||
String response = callbackService.weChat(request);
|
||||
System.out.println("微信支付回调 response ===> " + response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信退款回调
|
||||
*/
|
||||
@ApiOperation(value = "微信退款回调")
|
||||
@RequestMapping(value = "/wechat/refund", method = RequestMethod.POST)
|
||||
public String weChatRefund(@RequestBody String request) {
|
||||
System.out.println("微信退款回调 request ===> " + request);
|
||||
String response = callbackService.weChatRefund(request);
|
||||
System.out.println("微信退款回调 response ===> " + response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,189 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.exception.CrmebException;
|
||||
import com.zbkj.common.model.category.Category;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.CategoryRequest;
|
||||
import com.zbkj.common.request.CategorySearchRequest;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.common.vo.CategoryTreeVo;
|
||||
import com.zbkj.service.service.CategoryService;
|
||||
import com.zbkj.service.service.SystemAttachmentService;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 分类表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/category")
|
||||
@Api(tags = "分类服务")
|
||||
public class CategoryController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
@Autowired
|
||||
private SystemAttachmentService systemAttachmentService;
|
||||
|
||||
/**
|
||||
* 分页显示分类表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-16
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:list')")
|
||||
@ApiOperation(value = "分页分类列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<Category>> getList(@ModelAttribute CategorySearchRequest request, @ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<Category> categoryCommonPage = CommonPage.restPage(categoryService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(categoryCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增分类表
|
||||
* @param categoryRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@Validated CategoryRequest categoryRequest) {
|
||||
if (categoryService.create(categoryRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分类表
|
||||
* @param id Integer
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-16
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="分类ID")
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (categoryService.delete(id) > 0) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分类表
|
||||
* @param id integer id
|
||||
* @param categoryRequest 修改参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-16
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@ApiImplicitParam(name="id", value="分类ID")
|
||||
public CommonResult<String> update(@RequestParam Integer id, @ModelAttribute CategoryRequest categoryRequest) {
|
||||
if (null == id || id <= 0) throw new CrmebException("id 参数不合法");
|
||||
categoryRequest.setExtra(systemAttachmentService.clearPrefix(categoryRequest.getExtra()));
|
||||
if (categoryService.update(categoryRequest, id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分类表信息
|
||||
* @param id Integer
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-16
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:info')")
|
||||
@ApiOperation(value = "分类详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="分类ID")
|
||||
public CommonResult<Category> info(@RequestParam(value = "id") Integer id) {
|
||||
Category category = categoryService.getById(id);
|
||||
return CommonResult.success(category);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询分类表信息
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-16
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:list:tree')")
|
||||
@ApiOperation(value = "获取tree结构的列表")
|
||||
@RequestMapping(value = "/list/tree", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="type", value="类型ID | 类型,1 产品分类,2 附件分类,3 文章分类, 4 设置分类, 5 菜单分类, 6 配置分类, 7 秒杀配置", example = "1"),
|
||||
@ApiImplicitParam(name="status", value="-1=全部,0=未生效,1=已生效", example = "1"),
|
||||
@ApiImplicitParam(name="name", value="模糊搜索", example = "电视")
|
||||
})
|
||||
public CommonResult<List<CategoryTreeVo>> getListTree(@RequestParam(name = "type") Integer type,
|
||||
@RequestParam(name = "status") Integer status,
|
||||
@RequestParam(name = "name", required = false) String name) {
|
||||
List<CategoryTreeVo> listTree = categoryService.getListTree(type,status,name);
|
||||
return CommonResult.success(listTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分类id集合获取分类数据
|
||||
* @param ids String id集合字符串
|
||||
* @since 2020-04-16
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:list:ids')")
|
||||
@ApiOperation(value = "根据id集合获取分类列表")
|
||||
@RequestMapping(value = "/list/ids", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "ids", value="分类id集合")
|
||||
public CommonResult<List<Category>> getByIds(@Validated @RequestParam(name = "ids") String ids) {
|
||||
return CommonResult.success(categoryService.getByIds(CrmebUtil.stringToArray(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改分类状态
|
||||
* @param id Integer 分类id
|
||||
* @since 2020-04-16
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:update:status')")
|
||||
@ApiOperation(value = "更改分类状态")
|
||||
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "id", value="分类id")
|
||||
public CommonResult<Object> getByIds(@Validated @PathVariable(name = "id") Integer id) {
|
||||
if (categoryService.updateStatus(id)) {
|
||||
return CommonResult.success("修改成功");
|
||||
} else {
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.common.utils.genutils.GenCodePageListUtils;
|
||||
import com.zbkj.common.utils.genutils.GenCodePageQueryUtils;
|
||||
import com.zbkj.service.service.impl.CrmebGeneratorCodeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 前后端代码生成器 controller
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("api/codegen")
|
||||
@Api(tags = "代码生成")
|
||||
public class CodeGenerator {
|
||||
|
||||
@Autowired
|
||||
private CrmebGeneratorCodeService crmebGeneratorCodeService;
|
||||
|
||||
@ResponseBody
|
||||
@ApiOperation(value="代码生成-新列表")
|
||||
@GetMapping("/list")
|
||||
public CommonResult<Object> listNew(@RequestParam Map<String, Object> params){
|
||||
GenCodePageListUtils pageUtil = crmebGeneratorCodeService.queryList(new GenCodePageQueryUtils(params));
|
||||
return CommonResult.success(pageUtil);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成代码 API
|
||||
*/
|
||||
@GetMapping("/code")
|
||||
public void code(@RequestParam String tables, HttpServletResponse response) throws IOException {
|
||||
byte[] data = crmebGeneratorCodeService.generatorCode(tables.split(","));
|
||||
|
||||
String contentLength = "Content-Length";
|
||||
String contentType = "application/octet-stream; charset=UTF-8;";
|
||||
String contentDisposition = "Content-Disposition";
|
||||
String attachment = "attachment; filename=\"CRMEB-Java-Code-"+ DateUtil.dateToStr(new Date(), Constants.DATE_FORMAT_HHMM) +".zip\"";
|
||||
|
||||
response.reset();
|
||||
response.addHeader(contentLength, data.length +"");
|
||||
response.setContentType(contentType);
|
||||
response.setHeader(contentDisposition, attachment);
|
||||
|
||||
IOUtils.write(data, response.getOutputStream());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zbkj.common.request.StoreBargainSearchRequest;
|
||||
import com.zbkj.common.request.StoreCombinationSearchRequest;
|
||||
import com.zbkj.common.request.StoreOrderSearchRequest;
|
||||
import com.zbkj.common.request.StoreProductSearchRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.service.service.ExcelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* Excel导出 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/export/excel")
|
||||
@Api(tags = "导出 -- Excel")
|
||||
public class ExcelController {
|
||||
|
||||
@Autowired
|
||||
private ExcelService excelService;
|
||||
|
||||
/**
|
||||
* 商品导出
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:export:excel:product')")
|
||||
@ApiOperation(value = "产品")
|
||||
@RequestMapping(value = "/product", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> export(@Validated StoreProductSearchRequest request) {
|
||||
String fileName = excelService.exportProduct(request);
|
||||
HashMap<String, String> map = CollUtil.newHashMap();
|
||||
map.put("fileName", fileName);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品导出
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:export:excel:bargain')")
|
||||
@ApiOperation(value = "砍价商品导出")
|
||||
@RequestMapping(value = "/bargain/product", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> exportBargainProduct(@Validated StoreBargainSearchRequest request) {
|
||||
String fileName = excelService.exportBargainProduct(request);
|
||||
HashMap<String, String> map = CollUtil.newHashMap();
|
||||
map.put("fileName", fileName);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团商品导出
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:export:excel:combiantion')")
|
||||
@ApiOperation(value = "拼团商品导出")
|
||||
@RequestMapping(value = "/combiantion/product", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> exportCombinationProduct(@Validated StoreCombinationSearchRequest request) {
|
||||
String fileName = excelService.exportCombinationProduct(request);
|
||||
HashMap<String, String> map = CollUtil.newHashMap();
|
||||
map.put("fileName", fileName);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单导出
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:export:excel:order')")
|
||||
@ApiOperation(value = "订单导出")
|
||||
@RequestMapping(value = "/order", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> exportOrder(@Validated StoreOrderSearchRequest request){
|
||||
String fileName = excelService.exportOrder(request);
|
||||
HashMap<String, String> map = CollUtil.newHashMap();
|
||||
map.put("fileName", fileName);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,136 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.ExpressUpdateRequest;
|
||||
import com.zbkj.common.request.ExpressSearchRequest;
|
||||
import com.zbkj.common.request.ExpressUpdateShowRequest;
|
||||
import com.zbkj.service.service.ExpressService;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.zbkj.common.model.express.Express;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 快递公司表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/express")
|
||||
@Api(tags = "设置 -- 物流 -- 公司")
|
||||
public class ExpressController {
|
||||
|
||||
@Autowired
|
||||
private ExpressService expressService;
|
||||
|
||||
/**
|
||||
* 分页显示快递公司表
|
||||
* @param request ExpressSearchRequest 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="keywords", value="搜索关键字")
|
||||
public CommonResult<CommonPage<Express>> getList(@Validated ExpressSearchRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<Express> expressCommonPage = CommonPage.restPage(expressService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(expressCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑快递公司
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:update')")
|
||||
@ApiOperation(value = "编辑")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated ExpressUpdateRequest expressRequest) {
|
||||
if (expressService.updateExpress(expressRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
*修改显示状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:update:show')")
|
||||
@ApiOperation(value = "修改显示状态")
|
||||
@RequestMapping(value = "/update/show", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated ExpressUpdateShowRequest expressRequest) {
|
||||
if (expressService.updateExpressShow(expressRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步物流公司
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:sync')")
|
||||
@ApiOperation(value = "同步物流公司")
|
||||
@RequestMapping(value = "/sync/express", method = RequestMethod.POST)
|
||||
public CommonResult<String> syncExpress() {
|
||||
if (expressService.syncExpress()) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询快递公司表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="快递公司ID", required = true)
|
||||
public CommonResult<Express> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(expressService.getInfo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部物流公司
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:all')")
|
||||
@ApiOperation(value = "查询全部物流公司")
|
||||
@RequestMapping(value = "/all", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="type", value="类型:normal-普通,elec-电子面单")
|
||||
public CommonResult<List<Express>> all(@RequestParam(value = "type") String type) {
|
||||
return CommonResult.success(expressService.findAll(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物流公司面单模板
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:template')")
|
||||
@ApiOperation(value = "查询物流公司面单模板")
|
||||
@RequestMapping(value = "/template", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="com", value="快递公司编号", required = true)
|
||||
public CommonResult<JSONObject> template(@RequestParam(value = "com") String com) {
|
||||
return CommonResult.success(expressService.template(com));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.BrokerageRecordRequest;
|
||||
import com.zbkj.common.request.FundsMonitorRequest;
|
||||
import com.zbkj.common.response.MonitorResponse;
|
||||
import com.zbkj.common.model.user.UserBrokerageRecord;
|
||||
import com.zbkj.service.service.UserBillService;
|
||||
import com.zbkj.service.service.UserFundsMonitorService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 用户提现表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/finance/founds/monitor")
|
||||
@Api(tags = "财务 -- 资金监控")
|
||||
public class FundsMonitorController {
|
||||
|
||||
@Autowired
|
||||
private UserBillService userBillService;
|
||||
|
||||
@Autowired
|
||||
private UserFundsMonitorService userFundsMonitorService;
|
||||
|
||||
/**
|
||||
* 分页显示资金监控
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:monitor:list')")
|
||||
@ApiOperation(value = "资金监控")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<MonitorResponse>> getList(@Validated FundsMonitorRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<MonitorResponse> userExtractCommonPage = CommonPage.restPage(userBillService.fundMonitoring(request, pageParamRequest));
|
||||
return CommonResult.success(userExtractCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 佣金记录
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:monitor:brokerage:record')")
|
||||
@ApiOperation(value = "佣金记录")
|
||||
@RequestMapping(value = "/brokerage/record", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserBrokerageRecord>> brokerageRecord(@Validated BrokerageRecordRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(CommonPage.restPage(userFundsMonitorService.getBrokerageRecord(request, pageParamRequest)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.HomeRateResponse;
|
||||
import com.zbkj.service.service.HomeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 统计 -- 主页 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/statistics/home")
|
||||
@Api(tags = "统计 -- 主页")
|
||||
public class HomeController {
|
||||
|
||||
@Autowired
|
||||
private HomeService homeService;
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:index')")
|
||||
@ApiOperation(value = "首页数据")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<HomeRateResponse> indexDate() {
|
||||
return CommonResult.success(homeService.indexDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户曲线图
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:user')")
|
||||
@ApiOperation(value = "用户曲线图")
|
||||
@RequestMapping(value = "/chart/user", method = RequestMethod.GET)
|
||||
public CommonResult<Map<Object, Object>> chartUser() {
|
||||
return CommonResult.success(homeService.chartUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户购买统计
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:user:buy')")
|
||||
@ApiOperation(value = "用户购买统计")
|
||||
@RequestMapping(value = "/chart/user/buy", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Integer>> chartUserBuy() {
|
||||
return CommonResult.success(homeService.chartUserBuy());
|
||||
}
|
||||
|
||||
/**
|
||||
* 30天订单量趋势
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:order')")
|
||||
@ApiOperation(value = "30天订单量趋势")
|
||||
@RequestMapping(value = "/chart/order", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> chartOrder() {
|
||||
return CommonResult.success(homeService.chartOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
* 周订单量趋势
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:order:week')")
|
||||
@ApiOperation(value = "周订单量趋势")
|
||||
@RequestMapping(value = "/chart/order/week", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> chartOrderInWeek() {
|
||||
return CommonResult.success(homeService.chartOrderInWeek());
|
||||
}
|
||||
|
||||
/**
|
||||
* 月订单量趋势
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:order:month')")
|
||||
@ApiOperation(value = "月订单量趋势")
|
||||
@RequestMapping(value = "/chart/order/month", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> chartOrderInMonth() {
|
||||
return CommonResult.success(homeService.chartOrderInMonth());
|
||||
}
|
||||
|
||||
/**
|
||||
* 年订单量趋势
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:order:year')")
|
||||
@ApiOperation(value = "年订单量趋势")
|
||||
@RequestMapping(value = "/chart/order/year", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> chartOrderInYear() {
|
||||
return CommonResult.success(homeService.chartOrderInYear());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,196 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.request.*;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.service.service.OnePassService;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 一号通控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/pass")
|
||||
@Api(tags = "一号通服务")
|
||||
public class OnePassController {
|
||||
|
||||
@Autowired
|
||||
private OnePassService onePassService;
|
||||
|
||||
/**
|
||||
* 获取用户验证码
|
||||
* @param phone 手机号码
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:send:code')")
|
||||
@ApiOperation(value = "获取用户验证码")
|
||||
@RequestMapping(value = "/sendUserCode", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="phone", value="手机号"),
|
||||
@ApiImplicitParam(name="types", value="验证码类型1:修改,0:注册")
|
||||
})
|
||||
public CommonResult<Object> sendUserCode(@RequestParam(name = "phone") String phone,@RequestParam(name = "types", required = false) Integer types) {
|
||||
return CommonResult.success(onePassService.sendUserCode(phone, types));
|
||||
}
|
||||
|
||||
/**
|
||||
* 账号注册
|
||||
* @param registerRequest 注册参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:register')")
|
||||
@ApiOperation(value = "账号注册")
|
||||
@RequestMapping(value = "/register", method = RequestMethod.POST)
|
||||
public CommonResult<String> register(@Validated @RequestBody OnePassRegisterRequest registerRequest) {
|
||||
return CommonResult.success(onePassService.register(registerRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 一号通用户登录
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:login')")
|
||||
@ApiOperation(value = "一号通用户登录")
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> account(@Validated @RequestBody OnePassLoginRequest request) {
|
||||
return CommonResult.success(onePassService.login(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否已经登录
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:is:login')")
|
||||
@ApiOperation(value = "是否已经登录")
|
||||
@RequestMapping(value = "/isLogin", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> isLogin() {
|
||||
return CommonResult.success(onePassService.isLogin());
|
||||
}
|
||||
|
||||
/**
|
||||
* 一号通用户信息
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:info')")
|
||||
@ApiOperation(value = "一号通用户信息")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<JSONObject> getInfo() {
|
||||
return CommonResult.success(onePassService.info());
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销当前登录
|
||||
* @return result
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:logout')")
|
||||
@ApiOperation(value = "注销")
|
||||
@RequestMapping(value = "/logout", method = RequestMethod.GET)
|
||||
public CommonResult<JSONObject> logOut() {
|
||||
if (onePassService.logOut()) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* 手机号+验证码方式修改
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:update:password')")
|
||||
@ApiOperation(value = "修改密码")
|
||||
@RequestMapping(value = "/update/password", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> updatePassword(@Validated @RequestBody OnePassUpdateRequest request) {
|
||||
if (onePassService.updatePassword(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改手机号——验证账号密码
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:update:phone:validator')")
|
||||
@ApiOperation(value = "修改手机号——验证账号密码")
|
||||
@RequestMapping(value = "/update/phone/validator", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> updatePhone(@Validated @RequestBody OnePassLoginRequest request) {
|
||||
if (onePassService.beforeUpdatePhoneValidator(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改手机号
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:update:phone')")
|
||||
@ApiOperation(value = "修改手机号")
|
||||
@RequestMapping(value = "/update/phone", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> updatePhone(@Validated @RequestBody OnePassUpdateRequest request) {
|
||||
if (onePassService.updatePhone(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 套餐列表
|
||||
* @param type 套餐类型:sms,短信;expr_query,物流查询;expr_dump,电子面单;copy,产品复制
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:meal:list')")
|
||||
@ApiOperation(value = "套餐列表")
|
||||
@RequestMapping(value = "/meal/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="type", value="套餐类型:sms,短信;expr_query,物流查询;expr_dump,电子面单;copy,产品复制")
|
||||
public CommonResult<JSONObject> mealList(@Validated @RequestParam String type) {
|
||||
return CommonResult.success(onePassService.mealList(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 套餐购买
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:meal:code')")
|
||||
@ApiOperation(value = "套餐购买")
|
||||
@RequestMapping(value = "/meal/code", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> mealCode(@RequestBody @Validated MealCodeRequest request) {
|
||||
return CommonResult.success(onePassService.mealCode(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务开通
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:service:open')")
|
||||
@ApiOperation(value = "服务开通")
|
||||
@RequestMapping(value = "/service/open", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> serviceOpen(@RequestBody @Validated ServiceOpenRequest request) {
|
||||
if (onePassService.serviceOpen(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 用量记录
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pass:user:record')")
|
||||
@ApiOperation(value = "用量记录")
|
||||
@RequestMapping(value = "/user/record", method = RequestMethod.GET)
|
||||
public CommonResult<JSONObject> record(@Validated OnePassUserRecordRequest request) {
|
||||
return CommonResult.success(onePassService.userRecord(request));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.model.user.User;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.RetailShopRequest;
|
||||
import com.zbkj.common.request.RetailShopStairUserRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.SpreadOrderResponse;
|
||||
import com.zbkj.common.response.SpreadUserResponse;
|
||||
import com.zbkj.service.service.RetailShopService;
|
||||
import com.zbkj.service.service.UserService;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 分销模块
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/retail")
|
||||
@Api(tags = "分销")
|
||||
public class RetailShopController {
|
||||
|
||||
@Autowired
|
||||
private RetailShopService retailShopService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 分销员列表
|
||||
* @param keywords 搜索参数
|
||||
* @param dateLimit 时间参数
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:list')")
|
||||
@ApiOperation(value = "分销员列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "keywords", value = "搜索关键字[姓名、电话、uid]"),
|
||||
@ApiImplicitParam(name = "dateLimit", value = "today,yesterday,lately7,lately30,month,year,/yyyy-MM-dd hh:mm:ss,yyyy-MM-dd hh:mm:ss/")
|
||||
})
|
||||
public CommonResult<CommonPage<SpreadUserResponse>> getList(@RequestParam(required = false) String keywords,
|
||||
@RequestParam(required = false) String dateLimit,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(retailShopService.getSpreadPeopleList(keywords, dateLimit, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户参数获取推广人列表
|
||||
* @param request 查询参数
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return 查询结果推广人列表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:spread:list')")
|
||||
@ApiOperation(value = "根据条件获取推广人列表")
|
||||
@RequestMapping(value = "/spread/userlist", method = RequestMethod.POST)
|
||||
public CommonResult<CommonPage<User>> getUserListBySpreadLevel(@RequestBody @Validated RetailShopStairUserRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(userService.getUserListBySpreadLevel(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据参数获取推广订单列表
|
||||
* @param request 查询参数
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return 查询结果推广人订单列表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:spread:order:list')")
|
||||
@ApiOperation(value = "根据条件获取推广人订单")
|
||||
@RequestMapping(value = "/spread/orderlist", method = RequestMethod.POST)
|
||||
public CommonResult<CommonPage<SpreadOrderResponse>> getOrdersBySpreadLevel(@RequestBody @Validated RetailShopStairUserRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(userService.getOrderListBySpreadLevel(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除上级推广人
|
||||
* @param id 当前被清理的用户id
|
||||
* @return 推广关系清理后的结果
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:spread:clean')")
|
||||
@ApiOperation(value = "清除上级推广人")
|
||||
@RequestMapping(value = "/spread/clean/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<Object> clearSpread(@PathVariable Integer id) {
|
||||
return CommonResult.success(userService.clearSpread(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销设置获取
|
||||
* @return 保存分销设置
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:spread:manage:get')")
|
||||
@ApiOperation(value = "分销配置信息获取")
|
||||
@RequestMapping(value = "/spread/manage/get", method = RequestMethod.GET)
|
||||
public CommonResult<Object> getSpreadInfo() {
|
||||
return CommonResult.success(retailShopService.getManageInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销管理信息保存
|
||||
* @param retailShopRequest 分销管理对象
|
||||
* @return 保存结果
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:spread:manage:set')")
|
||||
@ApiOperation(value = "分销管理信息保存")
|
||||
@RequestMapping(value = "/spread/manage/set", method = RequestMethod.POST)
|
||||
public CommonResult<Object> setSpreadInfo(@RequestBody @Validated RetailShopRequest retailShopRequest) {
|
||||
return CommonResult.success(retailShopService.setManageInfo(retailShopRequest));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.ShippingTemplatesRequest;
|
||||
import com.zbkj.common.request.ShippingTemplatesSearchRequest;
|
||||
import com.zbkj.service.service.ShippingTemplatesService;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.zbkj.common.model.express.ShippingTemplates;
|
||||
|
||||
/**
|
||||
* 物流-模板控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/express/shipping/templates")
|
||||
@Api(tags = "设置 -- 物流 -- 模板")
|
||||
public class ShippingTemplatesController {
|
||||
|
||||
@Autowired
|
||||
private ShippingTemplatesService shippingTemplatesService;
|
||||
|
||||
/**
|
||||
* 分页显示
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ShippingTemplates>> getList(@Validated ShippingTemplatesSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<ShippingTemplates> shippingTemplatesCommonPage = CommonPage.restPage(shippingTemplatesService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(shippingTemplatesCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param request 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated ShippingTemplatesRequest request){
|
||||
if (shippingTemplatesService.create(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed("新增运费模板失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="模板ID", required = true)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id){
|
||||
if(shippingTemplatesService.remove(id)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param id integer id
|
||||
* @param request ShippingTemplatesRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated ShippingTemplatesRequest request){
|
||||
if (shippingTemplatesService.update(id, request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="模板ID", required = true)
|
||||
public CommonResult<ShippingTemplates> info(@RequestParam(value = "id") Integer id){
|
||||
return CommonResult.success(shippingTemplatesService.getInfo(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.request.ShippingTemplatesFreeRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.service.service.ShippingTemplatesFreeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物流控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/express/shipping/free")
|
||||
@Api(tags = "设置 -- 物流 -- 免费")
|
||||
public class ShippingTemplatesFreeController {
|
||||
|
||||
@Autowired
|
||||
private ShippingTemplatesFreeService shippingTemplatesFreeService;
|
||||
|
||||
/**
|
||||
* 根据模板id查询数据
|
||||
* @param tempId Integer 模板id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:free:list')")
|
||||
@ApiOperation(value = "根据模板id查询数据")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<ShippingTemplatesFreeRequest>> getList(@RequestParam Integer tempId){
|
||||
return CommonResult.success(shippingTemplatesFreeService.getListGroup(tempId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.request.ShippingTemplatesRegionRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.service.service.ShippingTemplatesRegionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物流付费前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/express/shipping/region")
|
||||
@Api(tags = "设置 -- 物流 -- 付费")
|
||||
public class ShippingTemplatesRegionController {
|
||||
|
||||
@Autowired
|
||||
private ShippingTemplatesRegionService shippingTemplatesRegionService;
|
||||
|
||||
/**
|
||||
* 根据模板id查询数据
|
||||
* @param tempId Integer 模板id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:region:list')")
|
||||
@ApiOperation(value = "根据模板id查询数据")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<ShippingTemplatesRegionRequest>> getList(@RequestParam Integer tempId){
|
||||
return CommonResult.success(shippingTemplatesRegionService.getListGroup(tempId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.vo.MyRecord;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.SmsApplyTempRequest;
|
||||
import com.zbkj.common.request.SmsModifySignRequest;
|
||||
import com.zbkj.service.service.SmsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 短信发送记录表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/sms")
|
||||
@Api(tags = "短信服务")
|
||||
public class SmsRecordController {
|
||||
|
||||
@Autowired
|
||||
private SmsService smsService;
|
||||
|
||||
/**
|
||||
* 修改签名
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:sms:modify:sign')")
|
||||
@ApiOperation(value = "修改签名")
|
||||
@RequestMapping(value = "/modify/sign", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> modifySign(@RequestBody @Validated SmsModifySignRequest request) {
|
||||
if (smsService.modifySign(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 短信模板
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:sms:temps')")
|
||||
@ApiOperation(value = "短信模板")
|
||||
@RequestMapping(value = "/temps", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> temps(@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
MyRecord myRecord = smsService.temps(pageParamRequest);
|
||||
return CommonResult.success(myRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请短信模板
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:sms:temp:apply')")
|
||||
@ApiOperation(value = "申请短信模板")
|
||||
@RequestMapping(value = "/temp/apply", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> applyTempMessage(@RequestBody @Validated SmsApplyTempRequest request) {
|
||||
if (smsService.applyTempMessage(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板申请记录
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:sms:applys')")
|
||||
@ApiOperation(value = "模板申请记录")
|
||||
@RequestMapping(value = "/applys", method = RequestMethod.POST)
|
||||
@ApiImplicitParam(name="type", value="type (1=验证码 2=通知 3=推广)")
|
||||
public CommonResult<Map<String, Object>> applys(@RequestParam(name = "type", required = false) Integer type, @ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(smsService.applys(type, pageParamRequest));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,169 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.StoreBargainRequest;
|
||||
import com.zbkj.common.request.StoreBargainSearchRequest;
|
||||
import com.zbkj.common.request.StoreBargainUserSearchRequest;
|
||||
import com.zbkj.common.response.StoreBargainResponse;
|
||||
import com.zbkj.common.response.StoreBargainUserHelpResponse;
|
||||
import com.zbkj.common.response.StoreBargainUserResponse;
|
||||
import com.zbkj.common.response.StoreProductInfoResponse;
|
||||
import com.zbkj.service.service.StoreBargainService;
|
||||
import com.zbkj.service.service.StoreBargainUserHelpService;
|
||||
import com.zbkj.service.service.StoreBargainUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 砍价表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/bargain")
|
||||
@Api(tags = "商品 -- 砍价 -- 商品") //配合swagger使用
|
||||
public class StoreBargainController {
|
||||
|
||||
@Autowired
|
||||
private StoreBargainService storeBargainService;
|
||||
|
||||
@Autowired
|
||||
private StoreBargainUserService storeBargainUserService;
|
||||
|
||||
@Autowired
|
||||
private StoreBargainUserHelpService storeBargainUserHelpService;
|
||||
|
||||
/**
|
||||
* 分页显示砍价商品列表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:list')")
|
||||
@ApiOperation(value = "分页显示砍价商品列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreBargainResponse>> getList(@Validated StoreBargainSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<StoreBargainResponse> storeBargainCommonPage = CommonPage.restPage(storeBargainService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeBargainCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增砍价商品
|
||||
* @param storeBargainRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:save')")
|
||||
@ApiOperation(value = "新增砍价商品")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreBargainRequest storeBargainRequest){
|
||||
if(storeBargainService.saveBargain(storeBargainRequest)){
|
||||
return CommonResult.success("添加砍价商品成功");
|
||||
}else{
|
||||
return CommonResult.failed("添加砍价商品失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除砍价商品
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:delete')")
|
||||
@ApiOperation(value = "删除砍价商品")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id){
|
||||
if(storeBargainService.deleteById(id)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改砍价商品
|
||||
* @param storeBargainRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:update')")
|
||||
@ApiOperation(value = "修改砍价商品")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated StoreBargainRequest storeBargainRequest){
|
||||
if (storeBargainService.updateBargain(storeBargainRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询砍价商品详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:info')")
|
||||
@ApiOperation(value = "查询砍价商品详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductInfoResponse> info(@RequestParam(value = "id") Integer id){
|
||||
StoreProductInfoResponse storeBargainResponse = storeBargainService.getAdminDetail(id);
|
||||
return CommonResult.success(storeBargainResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 修改砍价商品状态
|
||||
* @param id 商品id
|
||||
* @param status 商品状态
|
||||
* @return {@link CommonResult<String>}
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:update:status')")
|
||||
@ApiOperation(value = "修改砍价商品状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestParam @Validated Integer id, @RequestParam @Validated boolean status){
|
||||
if(storeBargainService.updateBargainStatus(id,status)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页显示砍价列表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:user:list')")
|
||||
@ApiOperation(value = "分页显示砍价列表") //配合swagger使用
|
||||
@RequestMapping(value = "/bargain_list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreBargainUserResponse>> getBargainUserList(@Validated StoreBargainUserSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<StoreBargainUserResponse> bargainUserCommonPage = CommonPage.restPage(storeBargainUserService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(bargainUserCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取砍价参与详情列表
|
||||
* @param id StoreBargainUser 砍价参与用户编号
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:user:help:list')")
|
||||
@ApiOperation(value = "获取砍价参与详情列表") //配合swagger使用
|
||||
@RequestMapping(value = "/bargain_list/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreBargainUserHelpResponse>> getBargainUserHelpDetail(@PathVariable(value = "id") Integer id){
|
||||
List<StoreBargainUserHelpResponse> list = storeBargainUserHelpService.getList(id);
|
||||
return CommonResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,169 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.StoreCombinationRequest;
|
||||
import com.zbkj.common.request.StoreCombinationSearchRequest;
|
||||
import com.zbkj.common.request.StorePinkSearchRequest;
|
||||
import com.zbkj.common.response.StoreCombinationResponse;
|
||||
import com.zbkj.common.response.StorePinkAdminListResponse;
|
||||
import com.zbkj.common.response.StorePinkDetailResponse;
|
||||
import com.zbkj.common.response.StoreProductInfoResponse;
|
||||
import com.zbkj.service.service.StoreCombinationService;
|
||||
import com.zbkj.service.service.StorePinkService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 拼团商品表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/combination")
|
||||
@Api(tags = "商品——拼团——商品") //配合swagger使用
|
||||
public class StoreCombinationController {
|
||||
|
||||
@Autowired
|
||||
private StoreCombinationService storeCombinationService;
|
||||
|
||||
@Autowired
|
||||
private StorePinkService storePinkService;
|
||||
|
||||
/**
|
||||
* 分页显示拼团商品表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:list')")
|
||||
@ApiOperation(value = "分页显示拼团商品表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreCombinationResponse>> getList(@Validated StoreCombinationSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<StoreCombinationResponse> commonPage = CommonPage.restPage(storeCombinationService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(commonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增拼团商品表
|
||||
* @param request 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:save')")
|
||||
@ApiOperation(value = "新增拼团商品")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreCombinationRequest request){
|
||||
if(storeCombinationService.saveCombination(request)){
|
||||
return CommonResult.success("新增拼团商品成功");
|
||||
}else{
|
||||
return CommonResult.failed("新增拼团商品失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除拼团商品表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:delete')")
|
||||
@ApiOperation(value = "删除拼团商品")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id){
|
||||
if(storeCombinationService.deleteById(id)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改拼团商品表
|
||||
* @param storeCombinationRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:update')")
|
||||
@ApiOperation(value = "修改拼团商品")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated StoreCombinationRequest storeCombinationRequest){
|
||||
if(storeCombinationService.updateCombination(storeCombinationRequest)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询拼团商品信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:info')")
|
||||
@ApiOperation(value = "拼团商品详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductInfoResponse> info(@RequestParam(value = "id") Integer id){
|
||||
StoreProductInfoResponse detail = storeCombinationService.getAdminDetail(id);
|
||||
return CommonResult.success(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改拼团商品状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:update:status')")
|
||||
@ApiOperation(value = "修改拼团商品状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
public CommonResult<Object> updateStatus(@RequestParam(value = "id") Integer id, @RequestParam @Validated boolean isShow){
|
||||
if(storeCombinationService.updateCombinationShow(id, isShow)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团统计
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:statistics')")
|
||||
@ApiOperation(value = "拼团统计")
|
||||
@RequestMapping(value = "/statistics", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> statistics() {
|
||||
Map<String, Object> map = storeCombinationService.getAdminStatistics();
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团列表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:combine:list')")
|
||||
@ApiOperation(value = "拼团列表")
|
||||
@RequestMapping(value = "/combine/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StorePinkAdminListResponse>> getCombineList(@Validated StorePinkSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<StorePinkAdminListResponse> responseCommonPage = CommonPage.restPage(storePinkService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(responseCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团订单列表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:order:pink')")
|
||||
@ApiOperation(value = "拼团订单列表")
|
||||
@RequestMapping(value = "/order_pink/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<List<StorePinkDetailResponse>> getPinkList(@PathVariable(value = "id") Integer id) {
|
||||
return CommonResult.success(storePinkService.getAdminList(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,127 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.SearchAndPageRequest;
|
||||
import com.zbkj.common.model.coupon.StoreCoupon;
|
||||
import com.zbkj.common.request.StoreCouponRequest;
|
||||
import com.zbkj.common.request.StoreCouponSearchRequest;
|
||||
import com.zbkj.common.response.StoreCouponInfoResponse;
|
||||
import com.zbkj.service.service.StoreCouponService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/marketing/coupon")
|
||||
@Api(tags = "营销 -- 优惠券")
|
||||
public class StoreCouponController {
|
||||
|
||||
@Autowired
|
||||
private StoreCouponService storeCouponService;
|
||||
|
||||
/**
|
||||
* 分页显示优惠券表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreCoupon>> getList(@Validated StoreCouponSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreCoupon> storeCouponCommonPage = CommonPage.restPage(storeCouponService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeCouponCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存优惠券表
|
||||
* @param request StoreCouponRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreCouponRequest request) {
|
||||
if (storeCouponService.create(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
* @param id integer id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:update:status')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestParam Integer id, @RequestParam Boolean status) {
|
||||
if (storeCouponService.updateStatus(id, status)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @param id integer id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.POST)
|
||||
@ApiImplicitParam(name="id", value="优惠券ID", required = true)
|
||||
public CommonResult<StoreCouponInfoResponse> info(@RequestParam Integer id) {
|
||||
return CommonResult.success(storeCouponService.info(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送优惠券列表
|
||||
* @param searchAndPageRequest 搜索分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:send:list')")
|
||||
@ApiOperation(value = "发送优惠券列表")
|
||||
@RequestMapping(value = "/send/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreCoupon>> getSendList(@Validated SearchAndPageRequest searchAndPageRequest) {
|
||||
CommonPage<StoreCoupon> storeCouponCommonPage = CommonPage.restPage(storeCouponService.getSendList(searchAndPageRequest));
|
||||
return CommonResult.success(storeCouponCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除优惠券
|
||||
* @param id 优惠券id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:delete')")
|
||||
@ApiOperation(value = "删除优惠券")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
public CommonResult<StoreCouponInfoResponse> delete(@RequestParam Integer id) {
|
||||
if (storeCouponService.delete(id)) {
|
||||
return CommonResult.success("删除成功");
|
||||
} else {
|
||||
return CommonResult.failed("删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.StoreCouponUserRequest;
|
||||
import com.zbkj.common.request.StoreCouponUserSearchRequest;
|
||||
import com.zbkj.common.response.StoreCouponUserResponse;
|
||||
import com.zbkj.service.service.StoreCouponUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券发放记录表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/marketing/coupon/user")
|
||||
@Api(tags = "营销 -- 优惠券 -- 领取记录")
|
||||
public class StoreCouponUserController {
|
||||
|
||||
@Autowired
|
||||
private StoreCouponUserService storeCouponUserService;
|
||||
|
||||
/**
|
||||
* 分页显示优惠券发放记录表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:user:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreCouponUserResponse>> getList(@Validated StoreCouponUserSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreCouponUserResponse> storeCouponUserCommonPage = CommonPage.restPage(storeCouponUserService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeCouponUserCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 领券
|
||||
* @param storeCouponUserRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:user:receive')")
|
||||
@ApiOperation(value = "领券")
|
||||
@RequestMapping(value = "/receive", method = RequestMethod.POST)
|
||||
public CommonResult<String> receive(@Validated StoreCouponUserRequest storeCouponUserRequest) {
|
||||
if(storeCouponUserService.receive(storeCouponUserRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,266 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.*;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.common.vo.ExpressSheetVo;
|
||||
import com.zbkj.common.vo.LogisticsResultVo;
|
||||
import com.zbkj.service.service.StoreOrderService;
|
||||
import com.zbkj.service.service.StoreOrderVerification;
|
||||
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.hibernate.validator.constraints.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/order")
|
||||
@Api(tags = "订单") //配合swagger使用
|
||||
public class StoreOrderController {
|
||||
|
||||
@Autowired
|
||||
private StoreOrderService storeOrderService;
|
||||
|
||||
@Autowired
|
||||
private StoreOrderVerification storeOrderVerification;
|
||||
|
||||
/**
|
||||
* 分页显示订单表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreOrderDetailResponse>> getList(@Validated StoreOrderSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(storeOrderService.getAdminList(request, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单各状态数量
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:status:num')")
|
||||
@ApiOperation(value = "获取订单各状态数量")
|
||||
@RequestMapping(value = "/status/num", method = RequestMethod.GET)
|
||||
public CommonResult<StoreOrderCountItemResponse> getOrderStatusNum(
|
||||
@RequestParam(value = "dateLimit", defaultValue = "") String dateLimit,
|
||||
@RequestParam(value = "type", defaultValue = "2") @Range(min = 0, max = 2, message = "未知的订单类型") Integer type) {
|
||||
return CommonResult.success(storeOrderService.getOrderStatusNum(dateLimit, type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单统计数据
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:list:data')")
|
||||
@ApiOperation(value = "获取订单统计数据")
|
||||
@RequestMapping(value = "/list/data", method = RequestMethod.GET)
|
||||
public CommonResult<StoreOrderTopItemResponse> getOrderData(@RequestParam(value = "dateLimit", defaultValue = "")String dateLimit) {
|
||||
return CommonResult.success(storeOrderService.getOrderData(dateLimit));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 订单删除
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:delete')")
|
||||
@ApiOperation(value = "订单删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "orderNo") String orderNo) {
|
||||
if (storeOrderService.delete(orderNo)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注订单
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:mark')")
|
||||
@ApiOperation(value = "备注")
|
||||
@RequestMapping(value = "/mark", method = RequestMethod.POST)
|
||||
public CommonResult<String> mark(@RequestParam String orderNo, @RequestParam String mark) {
|
||||
if (storeOrderService.mark(orderNo, mark)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单(改价)
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:update:price')")
|
||||
@ApiOperation(value = "修改订单(改价)")
|
||||
@RequestMapping(value = "/update/price", method = RequestMethod.POST)
|
||||
public CommonResult<String> updatePrice(@RequestBody @Validated StoreOrderUpdatePriceRequest request) {
|
||||
if (storeOrderService.updatePrice(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<StoreOrderInfoResponse> info(@RequestParam(value = "orderNo") String orderNo) {
|
||||
return CommonResult.success(storeOrderService.info(orderNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送货
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:send')")
|
||||
@ApiOperation(value = "发送货")
|
||||
@RequestMapping(value = "/send", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> send(@RequestBody @Validated StoreOrderSendRequest request) {
|
||||
if (storeOrderService.send(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:refund')")
|
||||
@ApiOperation(value = "退款")
|
||||
@RequestMapping(value = "/refund", method = RequestMethod.GET)
|
||||
public CommonResult<Boolean> send(@Validated StoreOrderRefundRequest request) {
|
||||
return CommonResult.success(storeOrderService.refund(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝退款
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:refund:refuse')")
|
||||
@ApiOperation(value = "拒绝退款")
|
||||
@RequestMapping(value = "/refund/refuse", method = RequestMethod.GET)
|
||||
public CommonResult<Object> refundRefuse(@RequestParam String orderNo, @RequestParam String reason) {
|
||||
if (storeOrderService.refundRefuse(orderNo, reason)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 快递查询
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:logistics:info')")
|
||||
@ApiOperation(value = "快递查询")
|
||||
@RequestMapping(value = "/getLogisticsInfo", method = RequestMethod.GET)
|
||||
public CommonResult<LogisticsResultVo> getLogisticsInfo(@RequestParam(value = "orderNo") String orderNo) {
|
||||
return CommonResult.success(storeOrderService.getLogisticsInfo(orderNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销订单头部数据
|
||||
*
|
||||
* @author stivepeim
|
||||
* @since 2020-08-29
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:statistics')")
|
||||
@ApiOperation(value = "核销订单头部数据")
|
||||
@RequestMapping(value = "/statistics", method = RequestMethod.GET)
|
||||
public CommonResult<StoreStaffTopDetail> getStatistics() {
|
||||
return CommonResult.success(storeOrderVerification.getOrderVerificationData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销订单 月列表数据
|
||||
*
|
||||
* @author stivepeim
|
||||
* @since 2020-08-29
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:statistics:data')")
|
||||
@ApiOperation(value = "核销订单 月列表数据")
|
||||
@RequestMapping(value = "/statisticsData", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreStaffDetail>> getStaffDetail(StoreOrderStaticsticsRequest request) {
|
||||
return CommonResult.success(storeOrderVerification.getOrderVerificationDetail(request));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 核销码核销订单
|
||||
*
|
||||
* @author stivepeim
|
||||
* @since 2020-09-01
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:write:update')")
|
||||
@ApiOperation(value = "核销码核销订单")
|
||||
@RequestMapping(value = "/writeUpdate/{vCode}", method = RequestMethod.GET)
|
||||
public CommonResult<Object> verificationOrder(@PathVariable String vCode) {
|
||||
return CommonResult.success(storeOrderVerification.verificationOrderByCode(vCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销码查询待核销订单
|
||||
*
|
||||
* @author stivepeim
|
||||
* @since 2020-09-01
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:write:confirm')")
|
||||
@ApiOperation(value = "核销码查询待核销订单")
|
||||
@RequestMapping(value = "/writeConfirm/{vCode}", method = RequestMethod.GET)
|
||||
public CommonResult<Object> verificationConfirmOrder(
|
||||
@PathVariable String vCode) {
|
||||
return CommonResult.success(storeOrderVerification.getVerificationOrderByCode(vCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单统计详情
|
||||
*
|
||||
* @author stivepeim
|
||||
* @since 2020-09-01
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:time')")
|
||||
@ApiOperation(value = "订单统计详情")
|
||||
@RequestMapping(value = "/time", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "dateLimit", value = "today,yesterday,lately7,lately30,month,year,/yyyy-MM-dd hh:mm:ss,yyyy-MM-dd hh:mm:ss/",
|
||||
dataType = "String", required = true),
|
||||
@ApiImplicitParam(name = "type", value = "1=price 2=order", required = true)
|
||||
})
|
||||
public CommonResult<Object> statisticsOrderTime(@RequestParam String dateLimit,
|
||||
@RequestParam Integer type) {
|
||||
return CommonResult.success(storeOrderService.orderStatisticsByTime(dateLimit, type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取面单默认配置信息
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:sheet:info')")
|
||||
@ApiOperation(value = "获取面单默认配置信息")
|
||||
@RequestMapping(value = "/sheet/info", method = RequestMethod.GET)
|
||||
public CommonResult<ExpressSheetVo> getDeliveryInfo() {
|
||||
return CommonResult.success(storeOrderService.getDeliveryInfo());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.order.StoreOrderStatus;
|
||||
import com.zbkj.common.request.StoreOrderStatusSearchRequest;
|
||||
import com.zbkj.service.service.StoreOrderStatusService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 订单操作记录表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/order/status")
|
||||
@Api(tags = "订单 -- 操作记录") //配合swagger使用
|
||||
|
||||
public class StoreOrderStatusController {
|
||||
|
||||
@Autowired
|
||||
private StoreOrderStatusService storeOrderStatusService;
|
||||
|
||||
/**
|
||||
* 分页显示订单操作记录表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:status:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreOrderStatus>> getList(@Validated StoreOrderStatusSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<StoreOrderStatus> storeOrderStatusCommonPage = CommonPage.restPage(storeOrderStatusService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeOrderStatusCommonPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,217 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.StoreCopyProductRequest;
|
||||
import com.zbkj.common.request.StoreProductAddRequest;
|
||||
import com.zbkj.common.request.StoreProductRequest;
|
||||
import com.zbkj.common.request.StoreProductSearchRequest;
|
||||
import com.zbkj.common.response.StoreProductInfoResponse;
|
||||
import com.zbkj.common.response.StoreProductResponse;
|
||||
import com.zbkj.common.response.StoreProductTabsHeader;
|
||||
import com.zbkj.service.service.StoreCartService;
|
||||
import com.zbkj.service.service.StoreProductService;
|
||||
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.json.JSONException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 商品表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/product")
|
||||
@Api(tags = "商品") //配合swagger使用
|
||||
public class StoreProductController {
|
||||
|
||||
@Autowired
|
||||
private StoreProductService storeProductService;
|
||||
|
||||
@Autowired
|
||||
private StoreCartService storeCartService;
|
||||
|
||||
/**
|
||||
* 分页显示商品表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreProductResponse>> getList(@Validated StoreProductSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(storeProductService.getAdminList(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品
|
||||
* @param request 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:save')")
|
||||
@ApiOperation(value = "新增商品")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreProductAddRequest request) {
|
||||
if (storeProductService.save(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestBody @PathVariable Integer id, @RequestParam(value = "type", required = false, defaultValue = "recycle")String type) {
|
||||
if (storeProductService.deleteProduct(id, type)) {
|
||||
if ("recycle".equals(type)) {
|
||||
storeCartService.productStatusNotEnable(id);
|
||||
} else {
|
||||
storeCartService.productDelete(id);
|
||||
}
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复已删除商品表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:restore')")
|
||||
@ApiOperation(value = "恢复商品")
|
||||
@RequestMapping(value = "/restore/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> restore(@RequestBody @PathVariable Integer id) {
|
||||
if (storeProductService.reStoreProduct(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品修改
|
||||
* @param storeProductRequest 商品参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:update')")
|
||||
@ApiOperation(value = "商品修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated StoreProductAddRequest storeProductRequest) {
|
||||
if (storeProductService.update(storeProductRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情
|
||||
* @param id 商品id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:info')")
|
||||
@ApiOperation(value = "商品详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductInfoResponse> info(@PathVariable Integer id) {
|
||||
return CommonResult.success(storeProductService.getInfo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品tabs表头数据
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:tabs:headers')")
|
||||
@ApiOperation(value = "商品表头数量")
|
||||
@RequestMapping(value = "/tabs/headers", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreProductTabsHeader>> getTabsHeader() {
|
||||
return CommonResult.success(storeProductService.getTabsHeader());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上架
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:up')")
|
||||
@ApiOperation(value = "上架")
|
||||
@RequestMapping(value = "/putOnShell/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> putOn(@PathVariable Integer id) {
|
||||
if (storeProductService.putOnShelf(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下架
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:down')")
|
||||
@ApiOperation(value = "下架")
|
||||
@RequestMapping(value = "/offShell/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> offShell(@PathVariable Integer id) {
|
||||
if (storeProductService.offShelf(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:product:import:product')")
|
||||
@ApiOperation(value = "导入99Api商品")
|
||||
@RequestMapping(value = "/importProduct", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "form", value = "导入平台1=淘宝,2=京东,3=苏宁,4=拼多多, 5=天猫", dataType = "int", required = true),
|
||||
@ApiImplicitParam(name = "url", value = "URL", dataType = "String", required = true),
|
||||
})
|
||||
public CommonResult<StoreProductRequest> importProduct(
|
||||
@RequestParam @Valid int form,
|
||||
@RequestParam @Valid String url) throws IOException, JSONException {
|
||||
StoreProductRequest productRequest = storeProductService.importProductFromUrl(url, form);
|
||||
return CommonResult.success(productRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取复制商品配置
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:copy:config')")
|
||||
@ApiOperation(value = "获取复制商品配置")
|
||||
@RequestMapping(value = "/copy/config", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> copyConfig() {
|
||||
return CommonResult.success(storeProductService.copyConfig());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:product:copy:product')")
|
||||
@ApiOperation(value = "复制平台商品")
|
||||
@RequestMapping(value = "/copy/product", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> copyProduct(@RequestBody @Valid StoreCopyProductRequest request) {
|
||||
return CommonResult.success(storeProductService.copyProduct(request.getUrl()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,115 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.product.StoreProductReply;
|
||||
import com.zbkj.common.request.StoreProductReplyAddRequest;
|
||||
import com.zbkj.common.request.StoreProductReplyCommentRequest;
|
||||
import com.zbkj.common.request.StoreProductReplySearchRequest;
|
||||
import com.zbkj.common.response.StoreProductReplyResponse;
|
||||
import com.zbkj.service.service.StoreProductReplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 评论表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/product/reply")
|
||||
@Api(tags = "商品 -- 评论") //配合swagger使用
|
||||
public class StoreProductReplyController {
|
||||
|
||||
@Autowired
|
||||
private StoreProductReplyService storeProductReplyService;
|
||||
|
||||
/**
|
||||
* 分页显示评论表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:reply:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreProductReplyResponse>> getList(@Validated StoreProductReplySearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreProductReplyResponse> storeProductReplyCommonPage =
|
||||
CommonPage.restPage(storeProductReplyService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeProductReplyCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增评论表
|
||||
* @param request 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:reply:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreProductReplyAddRequest request) {
|
||||
if (storeProductReplyService.virtualCreate(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除评论表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:reply:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@PathVariable Integer id) {
|
||||
if (storeProductReplyService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询评论表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:reply:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductReply> info(@PathVariable Integer id) {
|
||||
StoreProductReply storeProductReply = storeProductReplyService.getById(id);
|
||||
return CommonResult.success(storeProductReply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复商品评论
|
||||
* @param request StoreProductReplyCommentRequest 回复参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:reply:comment')")
|
||||
@ApiOperation(value = "回复")
|
||||
@RequestMapping(value = "/comment", method = RequestMethod.POST)
|
||||
public CommonResult<String> comment(@RequestBody StoreProductReplyCommentRequest request) {
|
||||
if (storeProductReplyService.comment(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,115 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.common.model.product.StoreProductRule;
|
||||
import com.zbkj.common.request.StoreProductRuleRequest;
|
||||
import com.zbkj.common.request.StoreProductRuleSearchRequest;
|
||||
import com.zbkj.service.service.StoreProductRuleService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 商品规则值(规格)表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/product/rule")
|
||||
@Api(tags = "商品 -- 规则值(规格)") //配合swagger使用
|
||||
public class StoreProductRuleController {
|
||||
|
||||
@Autowired
|
||||
private StoreProductRuleService storeProductRuleService;
|
||||
|
||||
/**
|
||||
* 分页显示商品规则值(规格)表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:rule:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreProductRule>> getList(
|
||||
@Validated StoreProductRuleSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreProductRule> storeProductRuleCommonPage =
|
||||
CommonPage.restPage(storeProductRuleService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeProductRuleCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品规则值(规格)表
|
||||
* @param storeProductRuleRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:rule:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreProductRuleRequest storeProductRuleRequest) {
|
||||
if (storeProductRuleService.save(storeProductRuleRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规则值(规格)表
|
||||
* @param ids Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:rule:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete/{ids}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@PathVariable String ids) {
|
||||
if (storeProductRuleService.removeByIds(CrmebUtil.stringToArray(ids))) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规则值(规格)表
|
||||
* @param storeProductRuleRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:rule:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated StoreProductRuleRequest storeProductRuleRequest) {
|
||||
if (storeProductRuleService.updateRule(storeProductRuleRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品规则值(规格)表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:rule:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductRule> info(@PathVariable Integer id) {
|
||||
StoreProductRule storeProductRule = storeProductRuleService.getById(id);
|
||||
return CommonResult.success(storeProductRule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,125 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.StoreSeckillAddRequest;
|
||||
import com.zbkj.common.request.StoreSeckillSearchRequest;
|
||||
import com.zbkj.common.response.StoreSeckillResponse;
|
||||
import com.zbkj.common.response.StoreProductInfoResponse;
|
||||
import com.zbkj.service.service.StoreSeckillService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 商品秒杀产品表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/seckill")
|
||||
@Api(tags = "商品 -- 秒杀 -- 商品") //配合swagger使用
|
||||
public class StoreSeckillController {
|
||||
|
||||
@Autowired
|
||||
private StoreSeckillService storeSeckillService;
|
||||
|
||||
/**
|
||||
* 分页显示商品秒杀产品表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreSeckillResponse>> getList(@Validated StoreSeckillSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreSeckillResponse> storeSeckillCommonPage =
|
||||
CommonPage.restPage(storeSeckillService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeSeckillCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品秒杀产品表
|
||||
* @param storeSeckillRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreSeckillAddRequest storeSeckillRequest) {
|
||||
if (storeSeckillService.saveSeckill(storeSeckillRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品秒杀产品表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (storeSeckillService.deleteById(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品秒杀产品表
|
||||
* @param storeSeckillRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated StoreSeckillAddRequest storeSeckillRequest) {
|
||||
if (storeSeckillService.updateSeckill(storeSeckillRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:seckill:update:status')")
|
||||
@ApiOperation(value = "修改秒杀商品状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestParam @Validated Integer id, @RequestParam @Validated boolean status) {
|
||||
if (storeSeckillService.updateSecKillStatus(id,status)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品秒杀产品表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductInfoResponse> info(@RequestParam(value = "id") Integer id) {
|
||||
StoreProductInfoResponse storeSeckill = storeSeckillService.getDetailAdmin(id);
|
||||
return CommonResult.success(storeSeckill);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,130 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.StoreSeckillMangerRequest;
|
||||
import com.zbkj.common.request.StoreSeckillMangerSearchRequest;
|
||||
import com.zbkj.common.response.StoreSeckillManagerResponse;
|
||||
import com.zbkj.service.service.StoreSeckillMangerService;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 秒杀配置 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/seckill/manger")
|
||||
@Api(tags = "商品 -- 秒杀 -- 配置") //配合swagger使用
|
||||
public class StoreSeckillMangerController {
|
||||
|
||||
@Autowired
|
||||
private StoreSeckillMangerService storeSeckillMangerService;
|
||||
|
||||
/**
|
||||
* 分页显示
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreSeckillManagerResponse>> getList(
|
||||
@Validated StoreSeckillMangerSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(storeSeckillMangerService.getList(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param storeSeckillMangerRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreSeckillMangerRequest storeSeckillMangerRequest) {
|
||||
if (storeSeckillMangerService.saveManger(storeSeckillMangerRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (storeSeckillMangerService.deleteLogicById(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param id integer id
|
||||
* @param storeSeckillMangerRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated StoreSeckillMangerRequest storeSeckillMangerRequest) {
|
||||
return storeSeckillMangerService.update(id, storeSeckillMangerRequest) ? CommonResult.success() : CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<StoreSeckillManagerResponse> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(storeSeckillMangerService.detail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新秒杀配置状态
|
||||
* @param id 配置id
|
||||
* @param status 待更新配置状态
|
||||
* @return 更新结果
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:update:status')")
|
||||
@ApiOperation(value = "秒杀配置状态更新")
|
||||
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "商品id", dataType = "int", required = true),
|
||||
@ApiImplicitParam(name = "status", value = "状态", dataType = "boolean", required = true)
|
||||
})
|
||||
public CommonResult<Object> updateStatus(@PathVariable(value = "id") Integer id, Boolean status) {
|
||||
return CommonResult.success(storeSeckillMangerService.updateStatus(id,status));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,142 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.model.system.SystemAdmin;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.SystemAdminAddRequest;
|
||||
import com.zbkj.common.request.SystemAdminRequest;
|
||||
import com.zbkj.common.request.SystemAdminUpdateRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.SystemAdminResponse;
|
||||
import com.zbkj.service.service.SystemAdminService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
|
||||
/**
|
||||
* 后台管理员表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/admin")
|
||||
@Api(tags = "后台用户服务")
|
||||
public class SystemAdminController {
|
||||
|
||||
@Autowired
|
||||
private SystemAdminService systemAdminService;
|
||||
|
||||
/**
|
||||
* 分页显示后台管理员表
|
||||
* @param systemAdminRequest 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<CommonPage<SystemAdminResponse>> getList(@Validated SystemAdminRequest systemAdminRequest, PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemAdminResponse> systemAdminCommonPage = CommonPage.restPage(systemAdminService.getList(systemAdminRequest, pageParamRequest));
|
||||
return CommonResult.success(systemAdminCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增后台管理员
|
||||
* @param systemAdminAddRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:save')")
|
||||
@ApiOperation(value = "新增后台管理员")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<SystemAdminResponse> save(@RequestBody SystemAdminAddRequest systemAdminAddRequest) {
|
||||
if (systemAdminService.saveAdmin(systemAdminAddRequest)) {
|
||||
return CommonResult.success("添加管理员成功");
|
||||
}
|
||||
return CommonResult.failed("添加管理员失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除后台管理员表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemAdminService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改后台管理员表
|
||||
* @param systemAdminRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody SystemAdminUpdateRequest systemAdminRequest) {
|
||||
if (systemAdminService.updateAdmin(systemAdminRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台管理员详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:info')")
|
||||
@ApiOperation(value = "后台管理员详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemAdmin> info(@RequestParam(value = "id") @Valid Integer id) {
|
||||
return CommonResult.success(systemAdminService.getDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改后台管理员状态
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:update:status')")
|
||||
@ApiOperation(value = "修改后台管理员状态")
|
||||
@RequestMapping(value = "/updateStatus", method = RequestMethod.GET)
|
||||
public CommonResult<Object> updateStatus(@RequestParam(value = "id") @Valid Integer id, @RequestParam(value = "status") @Valid Boolean status) {
|
||||
if (systemAdminService.updateStatus(id, status)) {
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改后台管理员是否接收状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:update:sms')")
|
||||
@ApiOperation(value = "修改后台管理员是否接收状态")
|
||||
@RequestMapping(value = "/update/isSms", method = RequestMethod.GET)
|
||||
public CommonResult<Object> updateIsSms(@RequestParam(value = "id") @Valid Integer id) {
|
||||
if (systemAdminService.updateIsSms(id)) {
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,131 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.common.model.system.SystemAttachment;
|
||||
import com.zbkj.common.request.SystemAttachmentMoveRequest;
|
||||
import com.zbkj.common.request.SystemAttachmentRequest;
|
||||
import com.zbkj.service.service.SystemAttachmentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 附件管理表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/attachment")
|
||||
@Api(tags = "附件管理") //配合swagger使用
|
||||
public class SystemAttachmentController {
|
||||
|
||||
@Autowired
|
||||
private SystemAttachmentService systemAttachmentService;
|
||||
|
||||
/**
|
||||
* 分页显示附件管理表
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemAttachment>> getList(
|
||||
@RequestParam @Validated Integer pid,
|
||||
@RequestParam(
|
||||
value = "attType",
|
||||
defaultValue = "png,jpeg,jpg,audio/mpeg,text/plain,video/mp4,gif",
|
||||
required = false) String attType,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemAttachment> systemAttachmentCommonPage =
|
||||
CommonPage.restPage(systemAttachmentService.getList(pid, attType, pageParamRequest));
|
||||
return CommonResult.success(systemAttachmentCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件管理表 TODO:未使用的话删除此接口
|
||||
* @param systemAttachmentRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated SystemAttachmentRequest systemAttachmentRequest) {
|
||||
if (systemAttachmentService.add(systemAttachmentRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件管理表
|
||||
* @param ids String
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete/{ids}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@PathVariable String ids) {
|
||||
if (systemAttachmentService.removeByIds(CrmebUtil.stringToArray(ids))) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改附件管理表
|
||||
* @param id integer id
|
||||
* @param systemAttachmentRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id,
|
||||
@RequestBody @Validated SystemAttachmentRequest systemAttachmentRequest) {
|
||||
systemAttachmentRequest.setAttId(id);
|
||||
if (systemAttachmentService.edit(systemAttachmentRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询附件管理表信息
|
||||
* @param move SystemAttachmentMoveRequest
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:move')")
|
||||
@ApiOperation(value = "更改图片目录")
|
||||
@RequestMapping(value = "/move", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateAttrId(@RequestBody @Validated SystemAttachmentMoveRequest move) {
|
||||
if (systemAttachmentService.updateAttrId(move)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 附件详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:info')")
|
||||
@ApiOperation(value = "附件详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<SystemAttachment> info(@PathVariable Integer id) {
|
||||
return CommonResult.success(systemAttachmentService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.model.system.SystemCity;
|
||||
import com.zbkj.common.request.SystemCityRequest;
|
||||
import com.zbkj.common.request.SystemCitySearchRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.vo.SystemCityTreeVo;
|
||||
import com.zbkj.service.service.SystemCityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 城市表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/city")
|
||||
@Api(tags = "城市管理")
|
||||
public class SystemCityController {
|
||||
|
||||
@Autowired
|
||||
private SystemCityService systemCityService;
|
||||
|
||||
/**
|
||||
* 分页城市列表
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:city:list')")
|
||||
@ApiOperation(value = "分页城市列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<Object> getList(@Validated SystemCitySearchRequest request) {
|
||||
return CommonResult.success(systemCityService.getList(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改城市
|
||||
* @param id 城市id
|
||||
* @param request 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:city:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @Validated SystemCityRequest request) {
|
||||
if (systemCityService.update(id, request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param id 城市id
|
||||
* @param status 状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:city:update:status')")
|
||||
@ApiOperation(value = "修改状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestParam Integer id, @RequestParam Boolean status) {
|
||||
if (systemCityService.updateStatus(id, status)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 城市详情
|
||||
* @param id 城市id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:city:info')")
|
||||
@ApiOperation(value = "城市详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemCity> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(systemCityService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取tree结构的列表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:city:list:tree')")
|
||||
@ApiOperation(value = "获取tree结构的列表")
|
||||
@RequestMapping(value = "/list/tree", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemCityTreeVo>> getListTree() {
|
||||
return CommonResult.success(systemCityService.getListTree());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,126 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.model.system.SystemConfig;
|
||||
import com.zbkj.common.request.SystemConfigAdminRequest;
|
||||
import com.zbkj.common.request.SystemFormCheckRequest;
|
||||
import com.zbkj.service.service.SystemConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 配置表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/config")
|
||||
@Api(tags = "设置 -- Config")
|
||||
public class SystemConfigController {
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
/**
|
||||
* 查询配置表信息
|
||||
* @param formId Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:config:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> info(@RequestParam(value = "formId") Integer formId) {
|
||||
return CommonResult.success(systemConfigService.info(formId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 整体保存表单数据
|
||||
* @param systemFormCheckRequest SystemFormCheckRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:config:save:form')")
|
||||
@ApiOperation(value = "整体保存表单数据")
|
||||
@RequestMapping(value = "/save/form", method = RequestMethod.POST)
|
||||
public CommonResult<String> saveFrom(@RequestBody @Validated SystemFormCheckRequest systemFormCheckRequest) {
|
||||
if (systemConfigService.saveForm(systemFormCheckRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测表单name是否存在
|
||||
* @param name name
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:config:check')")
|
||||
@ApiOperation(value = "检测表单name是否存在")
|
||||
@RequestMapping(value = "/check", method = RequestMethod.GET)
|
||||
public CommonResult<Boolean> check(@RequestParam String name) {
|
||||
return CommonResult.success(systemConfigService.checkName(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置表中仅仅存储对应的配置
|
||||
* @param key 配置表中的配置字段
|
||||
* @param value 对应的值
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:config:saveuniq')")
|
||||
@ApiOperation(value = "表单配置中仅仅存储")
|
||||
@RequestMapping(value = "/saveuniq", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> justSaveUniq(@RequestParam String key, @RequestParam String value) {
|
||||
return CommonResult.success(systemConfigService.updateOrSaveValueByName(key, value));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key获取表单配置数据
|
||||
* @param key 配置表的的字段
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:config:getuniq')")
|
||||
@ApiOperation(value = "表单配置根据key获取")
|
||||
@RequestMapping(value = "/getuniq", method = RequestMethod.GET)
|
||||
public CommonResult<Object> justGetUniq(@RequestParam String key) {
|
||||
return CommonResult.success(systemConfigService.getValueByKey(key),"success");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key获取配置
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:config:get')")
|
||||
@ApiOperation(value = "根据key获取配置")
|
||||
@RequestMapping(value = "/get", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemConfig>> getByKey(@RequestParam String key) {
|
||||
return CommonResult.success(systemConfigService.getListByKey(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新配置信息
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:config:update')")
|
||||
@ApiOperation(value = "更新配置信息")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<List<SystemConfig>> getByKey(@RequestBody @Validated List<SystemConfigAdminRequest> requestList) {
|
||||
if (systemConfigService.updateByList(requestList)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,96 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.system.SystemFormTemp;
|
||||
import com.zbkj.common.request.SystemFormTempRequest;
|
||||
import com.zbkj.common.request.SystemFormTempSearchRequest;
|
||||
import com.zbkj.service.service.SystemFormTempService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 表单模板 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/form/temp")
|
||||
@Api(tags = "设置 -- 表单模板")
|
||||
public class SystemFormTempController {
|
||||
|
||||
@Autowired
|
||||
private SystemFormTempService systemFormTempService;
|
||||
|
||||
/**
|
||||
* 分页显示表单模板
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:form:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemFormTemp>> getList(@Validated SystemFormTempSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemFormTemp> systemFormTempCommonPage = CommonPage.restPage(systemFormTempService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(systemFormTempCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增表单模板
|
||||
* @param systemFormTempRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:form:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated SystemFormTempRequest systemFormTempRequest) {
|
||||
if (systemFormTempService.add(systemFormTempRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改表单模板
|
||||
* @param id integer id
|
||||
* @param systemFormTempRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:form:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated SystemFormTempRequest systemFormTempRequest) {
|
||||
if (systemFormTempService.edit(id, systemFormTempRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询表单模板信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:form:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemFormTemp> info(@RequestParam(value = "id") Integer id) {
|
||||
SystemFormTemp systemFormTemp = systemFormTempService.getById(id);
|
||||
return CommonResult.success(systemFormTemp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,109 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.SystemGroupRequest;
|
||||
import com.zbkj.common.request.SystemGroupSearchRequest;
|
||||
import com.zbkj.service.service.SystemGroupService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.zbkj.common.model.system.SystemGroup;
|
||||
|
||||
|
||||
/**
|
||||
* 组合数据表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/group")
|
||||
@Api(tags = "设置 -- 组合数据")
|
||||
public class SystemGroupController {
|
||||
|
||||
@Autowired
|
||||
private SystemGroupService systemGroupService;
|
||||
|
||||
/**
|
||||
* 分页显示组合数据表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemGroup>> getList(@Validated SystemGroupSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemGroup> systemGroupCommonPage = CommonPage.restPage(systemGroupService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(systemGroupCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组合数据
|
||||
* @param systemGroupRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@Validated SystemGroupRequest systemGroupRequest) {
|
||||
if (systemGroupService.add(systemGroupRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组合数据表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemGroupService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组合数据表
|
||||
* @param id integer id
|
||||
* @param systemGroupRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @Validated SystemGroupRequest systemGroupRequest) {
|
||||
if (systemGroupService.edit(id, systemGroupRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组合数据表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemGroup> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(systemGroupService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,110 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.system.SystemGroupData;
|
||||
import com.zbkj.common.request.SystemGroupDataRequest;
|
||||
import com.zbkj.common.request.SystemGroupDataSearchRequest;
|
||||
import com.zbkj.service.service.SystemGroupDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 组合数据详情表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/group/data")
|
||||
@Api(tags = "设置 -- 组合数据 -- 详情")
|
||||
public class SystemGroupDataController {
|
||||
|
||||
@Autowired
|
||||
private SystemGroupDataService systemGroupDataService;
|
||||
|
||||
/**
|
||||
* 分页组合数据详情
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:data:list')")
|
||||
@ApiOperation(value = "分页组合数据详情")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemGroupData>> getList(@Validated SystemGroupDataSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemGroupData> systemGroupDataCommonPage = CommonPage.restPage(systemGroupDataService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(systemGroupDataCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组合数据详情
|
||||
* @param systemGroupDataRequest SystemFormCheckRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:data:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated SystemGroupDataRequest systemGroupDataRequest) {
|
||||
if (systemGroupDataService.create(systemGroupDataRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组合数据详情表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:data:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemGroupDataService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组合数据详情表
|
||||
* @param id integer id
|
||||
* @param request 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:data:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated SystemGroupDataRequest request) {
|
||||
if (systemGroupDataService.update(id, request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 组合数据详情信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:data:info')")
|
||||
@ApiOperation(value = "组合数据详情信息")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemGroupData> info(@RequestParam(value = "id") Integer id) {
|
||||
SystemGroupData systemGroupData = systemGroupDataService.getById(id);
|
||||
return CommonResult.success(systemGroupData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,128 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.model.system.SystemMenu;
|
||||
import com.zbkj.common.request.SystemMenuRequest;
|
||||
import com.zbkj.common.request.SystemMenuSearchRequest;
|
||||
import com.zbkj.common.vo.MenuCheckVo;
|
||||
import com.zbkj.service.service.SystemMenuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 系统菜单管理 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/menu")
|
||||
@Api(tags = "系统菜单管理")
|
||||
public class SystemMenuController {
|
||||
|
||||
@Autowired
|
||||
private SystemMenuService systemMenuService;
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:list')")
|
||||
@ApiOperation(value = "菜单列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemMenu>> getList(@Validated SystemMenuSearchRequest request) {
|
||||
return CommonResult.success(systemMenuService.getAdminList(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
* @param systemMenuRequest 新增菜单
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:add')")
|
||||
@ApiOperation(value = "新增菜单")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult<String> add(@RequestBody @Validated SystemMenuRequest systemMenuRequest) {
|
||||
if (systemMenuService.add(systemMenuRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:delete')")
|
||||
@ApiOperation(value = "删除菜单")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<String> delete(@PathVariable(value = "id") Integer id) {
|
||||
if (systemMenuService.deleteById(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:update')")
|
||||
@ApiOperation(value = "修改菜单")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated SystemMenuRequest systemMenuRequest) {
|
||||
if (systemMenuService.edit(systemMenuRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单详情
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:info')")
|
||||
@ApiOperation(value = "菜单详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<SystemMenu> info(@PathVariable(value = "id") Integer id) {
|
||||
return CommonResult.success(systemMenuService.getInfo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单显示状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:show:status')")
|
||||
@ApiOperation(value = "修改菜单显示状态")
|
||||
@RequestMapping(value = "/updateShowStatus/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> updateShowStatus(@PathVariable(value = "id") Integer id) {
|
||||
if (systemMenuService.updateShowStatus(id)) {
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单缓存树
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:cache:tree')")
|
||||
@ApiOperation(value = "菜单缓存树")
|
||||
@RequestMapping(value = "/cache/tree", method = RequestMethod.GET)
|
||||
public CommonResult<List<MenuCheckVo>> getCacheTree() {
|
||||
return CommonResult.success(systemMenuService.getCacheTree());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,116 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.model.system.SystemNotification;
|
||||
import com.zbkj.common.request.NotificationInfoRequest;
|
||||
import com.zbkj.common.request.NotificationSearchRequest;
|
||||
import com.zbkj.common.request.NotificationUpdateRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.NotificationInfoResponse;
|
||||
import com.zbkj.service.service.SystemNotificationService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知设置 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/notification")
|
||||
@Api(tags = "通知设置-前端控制器") //配合swagger使用
|
||||
public class SystemNotificationController {
|
||||
|
||||
@Autowired
|
||||
private SystemNotificationService systemNotificationService;
|
||||
|
||||
/**
|
||||
* 系统通知列表
|
||||
* @param request ExpressSearchRequest 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:list')")
|
||||
@ApiOperation(value = "系统通知列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemNotification>> getList(@Validated NotificationSearchRequest request) {
|
||||
return CommonResult.success(systemNotificationService.getList(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 公众号模板开关
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:wechat:switch')")
|
||||
@ApiOperation(value = "公众号模板开关")
|
||||
@RequestMapping(value = "/wechat/switch/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> wechatSwitch(@PathVariable Integer id) {
|
||||
if (systemNotificationService.wechatSwitch(id)) {
|
||||
return CommonResult.success("更改成功");
|
||||
}
|
||||
return CommonResult.failed("更改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序订阅模板开关
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:routine:switch')")
|
||||
@ApiOperation(value = "小程序订阅模板开关")
|
||||
@RequestMapping(value = "/routine/switch/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> routineSwitch(@PathVariable Integer id) {
|
||||
if (systemNotificationService.routineSwitch(id)) {
|
||||
return CommonResult.success("更改成功");
|
||||
}
|
||||
return CommonResult.failed("更改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信开关
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:sms:switch')")
|
||||
@ApiOperation(value = "发送短信开关")
|
||||
@RequestMapping(value = "/sms/switch/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> smsSwitch(@PathVariable Integer id) {
|
||||
if (systemNotificationService.smsSwitch(id)) {
|
||||
return CommonResult.success("更改成功");
|
||||
}
|
||||
return CommonResult.failed("更改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知详情
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:detail')")
|
||||
@ApiOperation(value = "通知详情")
|
||||
@RequestMapping(value = "/detail", method = RequestMethod.GET)
|
||||
public CommonResult<NotificationInfoResponse> info(@Validated NotificationInfoRequest request) {
|
||||
return CommonResult.success(systemNotificationService.getDetail(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:update')")
|
||||
@ApiOperation(value = "修改通知")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<Object> update(@Validated @RequestBody NotificationUpdateRequest request) {
|
||||
if (systemNotificationService.modify(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,122 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.model.system.SystemRole;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.SystemRoleRequest;
|
||||
import com.zbkj.common.request.SystemRoleSearchRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.RoleInfoResponse;
|
||||
import com.zbkj.service.service.SystemRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 身份管理表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/role")
|
||||
@Api(tags = "设置 -- 权限管理 -- 身份管理")
|
||||
public class SystemRoleController {
|
||||
|
||||
@Autowired
|
||||
private SystemRoleService systemRoleService;
|
||||
|
||||
/**
|
||||
* 分页显示身份管理表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemRole>> getList(@Validated SystemRoleSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemRole> systemRoleCommonPage = CommonPage.restPage(systemRoleService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(systemRoleCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增身份
|
||||
* @param systemRoleRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:save')")
|
||||
@ApiOperation(value = "新增身份")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated SystemRoleRequest systemRoleRequest) {
|
||||
if (systemRoleService.add(systemRoleRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除身份管理表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemRoleService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改身份管理表
|
||||
* @param systemRoleRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated SystemRoleRequest systemRoleRequest) {
|
||||
if (systemRoleService.edit(systemRoleRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询身份详情
|
||||
* @param id String
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<RoleInfoResponse> info(@PathVariable Integer id) {
|
||||
return CommonResult.success(systemRoleService.getInfo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改身份状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:update:status')")
|
||||
@ApiOperation(value = "修改身份状态")
|
||||
@RequestMapping(value = "/updateStatus", method = RequestMethod.GET)
|
||||
public CommonResult<Object> updateStatus(@Validated @RequestParam(value = "id") Integer id, @Validated @RequestParam(value = "status") Boolean status) {
|
||||
if (systemRoleService.updateStatus(id, status)) {
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,163 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.system.SystemStore;
|
||||
import com.zbkj.common.request.SystemStoreRequest;
|
||||
import com.zbkj.common.request.SystemStoreSearchRequest;
|
||||
import com.zbkj.service.service.SystemStoreService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* 门店自提 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/store")
|
||||
@Api(tags = "设置 -- 提货点 -- 提货点")
|
||||
public class SystemStoreController {
|
||||
|
||||
@Autowired
|
||||
private SystemStoreService systemStoreService;
|
||||
|
||||
/**
|
||||
* 分页显示门店自提
|
||||
* @param request SystemStoreSearchRequest 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:list')")
|
||||
@ApiOperation(value = "门店自提分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemStore>> getList(@Validated SystemStoreSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemStore> expressCommonPage = CommonPage.restPage(systemStoreService.getList(request.getKeywords(), request.getStatus(), pageParamRequest));
|
||||
return CommonResult.success(expressCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:count')")
|
||||
@ApiOperation(value = "数量")
|
||||
@RequestMapping(value = "/getCount", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, Integer>> getCount() {
|
||||
return CommonResult.success(systemStoreService.getCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增门店自提
|
||||
* @param request SystemStoreRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated SystemStoreRequest request) {
|
||||
if (systemStoreService.create(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除门店自提
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemStoreService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门店自提
|
||||
* @param id integer id
|
||||
* @param request 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated SystemStoreRequest request) {
|
||||
if (systemStoreService.update(id, request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门店显示状态
|
||||
* @param id integer id
|
||||
* @param status 状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:update:status')")
|
||||
@ApiOperation(value = "修改门店显示状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.GET)
|
||||
public CommonResult<String> updateStatus(@RequestParam Integer id, @RequestParam Boolean status) {
|
||||
if (systemStoreService.updateStatus(id, status)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店自提详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemStore> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(systemStoreService.getInfo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 彻底删除
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:completely:delete')")
|
||||
@ApiOperation(value = "彻底删除")
|
||||
@RequestMapping(value = "/completely/delete", method = RequestMethod.GET)
|
||||
public CommonResult<Object> completeLyDelete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemStoreService.completeLyDelete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:recovery')")
|
||||
@ApiOperation(value = "提货点恢复")
|
||||
@RequestMapping(value = "/recovery", method = RequestMethod.GET)
|
||||
public CommonResult<Object> recovery(@RequestParam(value = "id") Integer id) {
|
||||
if (systemStoreService.recovery(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,125 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.system.SystemStoreStaff;
|
||||
import com.zbkj.common.request.SystemStoreStaffRequest;
|
||||
import com.zbkj.common.response.SystemStoreStaffResponse;
|
||||
import com.zbkj.service.service.SystemStoreStaffService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 门店店员表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/store/staff")
|
||||
@Api(tags = "设置 -- 提货点 -- 核销员")
|
||||
public class SystemStoreStaffController {
|
||||
|
||||
@Autowired
|
||||
private SystemStoreStaffService systemStoreStaffService;
|
||||
|
||||
/**
|
||||
* 分页显示门店核销员列表
|
||||
* @param storeId 门店id
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemStoreStaffResponse>> getList(@RequestParam(name = "storeId", required = false, defaultValue = "0") Integer storeId,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemStoreStaffResponse> systemStoreStaffCommonPage =
|
||||
CommonPage.restPage(systemStoreStaffService.getList(storeId, pageParamRequest));
|
||||
return CommonResult.success(systemStoreStaffCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增门店店员表
|
||||
* @param systemStoreStaffRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @ModelAttribute SystemStoreStaffRequest systemStoreStaffRequest) {
|
||||
if (systemStoreStaffService.saveUnique(systemStoreStaffRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除门店店员表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemStoreStaffService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门店店员表
|
||||
* @param id integer id
|
||||
* @param systemStoreStaffRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @ModelAttribute SystemStoreStaffRequest systemStoreStaffRequest) {
|
||||
if (systemStoreStaffService.edit(id, systemStoreStaffRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门店店员表
|
||||
* @param id integer id
|
||||
* @param status 状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:update:status')")
|
||||
@ApiOperation(value = "修改状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.GET)
|
||||
public CommonResult<String> updateStatus(@RequestParam Integer id, @RequestParam Integer status) {
|
||||
if (systemStoreStaffService.updateStatus(id, status)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询门店店员表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemStoreStaff> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(systemStoreStaffService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,106 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.model.system.SystemUserLevel;
|
||||
import com.zbkj.common.request.SystemUserLevelRequest;
|
||||
import com.zbkj.common.request.SystemUserLevelUpdateShowRequest;
|
||||
import com.zbkj.service.service.SystemUserLevelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 设置用户等级表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/user/level")
|
||||
@Api(tags = "设置 -- 会员等级")
|
||||
public class SystemUserLevelController {
|
||||
|
||||
@Autowired
|
||||
private SystemUserLevelService systemUserLevelService;
|
||||
|
||||
/**
|
||||
* 分页显示设置用户等级表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:user:level:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemUserLevel>> getList() {
|
||||
return CommonResult.success(systemUserLevelService.getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增等级
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:user:level:save')")
|
||||
@ApiOperation(value = "新增等级")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<Object> save(@RequestBody @Validated SystemUserLevelRequest request) {
|
||||
if (systemUserLevelService.create(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除等级
|
||||
* @param id 等级id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:user:level:delete')")
|
||||
@ApiOperation(value = "删除等级")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> delete(@PathVariable(value = "id") Integer id) {
|
||||
if (systemUserLevelService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新等级
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:user:level:update')")
|
||||
@ApiOperation(value = "更新等级")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> update(@PathVariable(value = "id") Integer id,
|
||||
@RequestBody @Validated SystemUserLevelRequest request) {
|
||||
if (systemUserLevelService.update(id, request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用/禁用
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:user:level:use')")
|
||||
@ApiOperation(value = "使用/禁用")
|
||||
@RequestMapping(value = "/use", method = RequestMethod.POST)
|
||||
public CommonResult<Object> use(@RequestBody @Validated SystemUserLevelUpdateShowRequest request) {
|
||||
if (systemUserLevelService.updateShow(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.SystemWriteOffOrderSearchRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.SystemWriteOffOrderResponse;
|
||||
import com.zbkj.service.service.StoreOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 订单表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/store/order")
|
||||
@Api(tags = "设置 -- 提货点 -- 核销订单") //配合swagger使用
|
||||
public class SystemWriteOffOrderController {
|
||||
|
||||
@Autowired
|
||||
private StoreOrderService storeOrderService;
|
||||
|
||||
/**
|
||||
* 分页显示订单表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:order:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
||||
public CommonResult<SystemWriteOffOrderResponse> getList(
|
||||
@Validated SystemWriteOffOrderSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(storeOrderService.getWriteOffList(request, pageParamRequest));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.service.service.TemplateMessageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 微信模板 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/wechat/template")
|
||||
@Api(tags = "微信 -- 消息模版") //配合swagger使用
|
||||
public class TemplateMessageController {
|
||||
|
||||
@Autowired
|
||||
private TemplateMessageService templateMessageService;
|
||||
|
||||
/**
|
||||
* 公众号模板消息同步
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:whcbqhn:sync')")
|
||||
@ApiOperation(value = "公众号模板消息同步")
|
||||
@RequestMapping(value = "/whcbqhn/sync", method = RequestMethod.POST)
|
||||
public CommonResult<String> whcbqhnSync() {
|
||||
if (templateMessageService.whcbqhnSync()) {
|
||||
return CommonResult.success("公众号模板消息同步成功");
|
||||
}
|
||||
return CommonResult.failed("公众号模板消息同步失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序订阅消息同步
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:routine:sync')")
|
||||
@ApiOperation(value = "小程序订阅消息同步")
|
||||
@RequestMapping(value = "/routine/sync", method = RequestMethod.POST)
|
||||
public CommonResult<String> routineSync() {
|
||||
if (templateMessageService.routineSync()) {
|
||||
return CommonResult.success("小程序订阅消息同步成功");
|
||||
}
|
||||
return CommonResult.failed("小程序订阅消息同步失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,78 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.vo.FileResultVo;
|
||||
import com.zbkj.service.service.UploadService;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/upload")
|
||||
@Api(tags = "上传文件")
|
||||
public class UploadController {
|
||||
|
||||
@Autowired
|
||||
private UploadService uploadService;
|
||||
|
||||
/**
|
||||
* 图片上传
|
||||
*/
|
||||
// @PreAuthorize("hasAuthority('admin:upload:image')")
|
||||
@ApiOperation(value = "图片上传")
|
||||
@RequestMapping(value = "/image", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "model", value = "模块 用户user,商品product,微信wechat,news文章"),
|
||||
@ApiImplicitParam(name = "pid", value = "分类ID 0编辑器,1商品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图,7前台用户,8微信系列 ", allowableValues = "range[0,1,2,3,4,5,6,7,8]")
|
||||
})
|
||||
public CommonResult<FileResultVo> image(MultipartFile multipart,
|
||||
@RequestParam(value = "model") String model,
|
||||
@RequestParam(value = "pid") Integer pid) throws IOException {
|
||||
return CommonResult.success(uploadService.imageUpload(multipart, model, pid));
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
// @PreAuthorize("hasAuthority('admin:upload:file')")
|
||||
@ApiOperation(value = "文件上传")
|
||||
@RequestMapping(value = "/file", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "model", value = "模块 用户user,商品product,微信wechat,news文章"),
|
||||
@ApiImplicitParam(name = "pid", value = "分类ID 0编辑器,1商品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图,7前台用户,8微信系列 ", allowableValues = "range[0,1,2,3,4,5,6,7,8]")
|
||||
})
|
||||
public CommonResult<FileResultVo> file(MultipartFile multipart,
|
||||
@RequestParam(value = "model") String model,
|
||||
@RequestParam(value = "pid") Integer pid) throws IOException {
|
||||
return CommonResult.success(uploadService.fileUpload(multipart, model, pid));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,205 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.*;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.model.user.User;
|
||||
import com.zbkj.common.response.TopDetail;
|
||||
import com.zbkj.common.response.UserResponse;
|
||||
import com.zbkj.service.service.UserService;
|
||||
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.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user")
|
||||
@Api(tags = "会员管理")
|
||||
@Validated
|
||||
public class UserController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 分页显示用户表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserResponse>> getList(@ModelAttribute @Validated UserSearchRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserResponse> userCommonPage = CommonPage.restPage(userService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(userCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户表
|
||||
* @param id integer id
|
||||
* @param userRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated UserUpdateRequest userRequest) {
|
||||
userRequest.setUid(id);
|
||||
if (userService.updateUser(userRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户手机号
|
||||
* @param id 用户uid
|
||||
* @param phone 手机号
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:update:phone')")
|
||||
@ApiOperation(value = "修改用户手机号")
|
||||
@RequestMapping(value = "/update/phone", method = RequestMethod.GET)
|
||||
public CommonResult<String> updatePhone(@RequestParam(name = "id") Integer id, @RequestParam(name = "phone") String phone) {
|
||||
if (userService.updateUserPhone(id, phone)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<User> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(userService.getInfoByUid(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数类型查询会员对应的信息
|
||||
* @param userId Integer 会员id
|
||||
* @param type int 类型 0=消费记录,1=积分明细,2=签到记录,3=持有优惠券,4=余额变动,5=好友关系
|
||||
* @param pageParamRequest PageParamRequest 分页
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:infobycondition')")
|
||||
@ApiOperation(value="会员详情")
|
||||
@RequestMapping(value = "/infobycondition", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId",example = "1", required = true),
|
||||
@ApiImplicitParam(name = "type", value="0=消费记录,1=积分明细,2=签到记录,3=持有优惠券,4=余额变动,5=好友关系", example = "0"
|
||||
, required = true)
|
||||
})
|
||||
public CommonResult<CommonPage<T>> infoByCondition(@RequestParam(name = "userId") @Valid Integer userId,
|
||||
@RequestParam(name = "type") @Valid @Max(5) @Min(0) int type,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage((List<T>) userService.getInfoByCondition(userId,type,pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员详情页Top数据
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:topdetail')")
|
||||
@ApiOperation(value = "会员详情页Top数据")
|
||||
@RequestMapping(value = "topdetail", method = RequestMethod.GET)
|
||||
public CommonResult<TopDetail> topDetail (@RequestParam @Valid Integer userId) {
|
||||
return CommonResult.success(userService.getTopDetail(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作积分
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:operate:founds')")
|
||||
@ApiOperation(value = "积分余额")
|
||||
@RequestMapping(value = "/operate/founds", method = RequestMethod.GET)
|
||||
public CommonResult<Object> founds(@Validated UserOperateIntegralMoneyRequest request) {
|
||||
if (userService.updateIntegralMoney(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员分组
|
||||
* @param id String id
|
||||
* @param groupId Integer 分组Id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group')")
|
||||
@ApiOperation(value = "分组")
|
||||
@RequestMapping(value = "/group", method = RequestMethod.POST)
|
||||
public CommonResult<String> group(@RequestParam String id, @RequestParam String groupId) {
|
||||
if (userService.group(id, groupId)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员标签
|
||||
* @param id String id
|
||||
* @param tagId Integer 标签id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag')")
|
||||
@ApiOperation(value = "标签")
|
||||
@RequestMapping(value = "/tag", method = RequestMethod.POST)
|
||||
public CommonResult<String> tag(@RequestParam String id, @RequestParam String tagId) {
|
||||
if (userService.tag(id, tagId)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改上级推广人
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:update:spread')")
|
||||
@ApiOperation(value = "修改上级推广人")
|
||||
@RequestMapping(value = "/update/spread", method = RequestMethod.POST)
|
||||
public CommonResult<String> editSpread(@Validated @RequestBody UserUpdateSpreadRequest request) {
|
||||
if (userService.editSpread(request)) {
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户会员等级
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:update:level')")
|
||||
@ApiOperation(value = "更新用户会员等级")
|
||||
@RequestMapping(value = "/update/level", method = RequestMethod.POST)
|
||||
public CommonResult<Object> updateUserLevel(@Validated @RequestBody UpdateUserLevelRequest request) {
|
||||
if (userService.updateUserLevel(request)) {
|
||||
return CommonResult.success("更新成功");
|
||||
}
|
||||
return CommonResult.failed("更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.finance.UserExtract;
|
||||
import com.zbkj.common.request.UserExtractRequest;
|
||||
import com.zbkj.common.request.UserExtractSearchRequest;
|
||||
import com.zbkj.common.response.BalanceResponse;
|
||||
import com.zbkj.service.service.UserExtractService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 用户提现表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/finance/apply")
|
||||
@Api(tags = "财务 -- 提现申请")
|
||||
public class UserExtractController {
|
||||
|
||||
@Autowired
|
||||
private UserExtractService userExtractService;
|
||||
|
||||
/**
|
||||
* 分页显示用户提现表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:apply:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserExtract>> getList(@Validated UserExtractSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<UserExtract> userExtractCommonPage = CommonPage.restPage(userExtractService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(userExtractCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户提现表
|
||||
* @param id integer id
|
||||
* @param userExtractRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:apply:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @Validated UserExtractRequest userExtractRequest){
|
||||
if (userExtractService.updateExtract(id, userExtractRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现统计
|
||||
* @Param dateLimit 时间限制 today,yesterday,lately7,lately30,month,year,/yyyy-MM-dd hh:mm:ss,yyyy-MM-dd hh:mm:ss/
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:apply:balance')")
|
||||
@ApiOperation(value = "提现统计")
|
||||
@RequestMapping(value = "/balance", method = RequestMethod.POST)
|
||||
public CommonResult<BalanceResponse> balance(@RequestParam(value = "dateLimit", required = false,defaultValue = "")
|
||||
String dateLimit){
|
||||
return CommonResult.success(userExtractService.getBalance(dateLimit));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现审核
|
||||
* @param id 提现id
|
||||
* @param status 审核状态 -1 未通过 0 审核中 1 已提现
|
||||
* @param backMessage 驳回原因
|
||||
* @return 审核结果
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:apply:apply')")
|
||||
@ApiOperation(value = "提现申请审核")
|
||||
@RequestMapping(value = "/apply", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestParam(value = "id") Integer id,
|
||||
@RequestParam(value = "status",defaultValue = "审核状态 -1 未通过 0 审核中 1 已提现") Integer status,
|
||||
@RequestParam(value = "backMessage",defaultValue = "驳回原因", required = false) String backMessage){
|
||||
if(userExtractService.updateStatus(id, status, backMessage)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.user.UserGroup;
|
||||
import com.zbkj.common.request.UserGroupRequest;
|
||||
import com.zbkj.service.service.UserGroupService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 用户分组表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/group")
|
||||
@Api(tags = "会员 -- 分组")
|
||||
public class UserGroupController {
|
||||
|
||||
@Autowired
|
||||
private UserGroupService userGroupService;
|
||||
|
||||
/**
|
||||
* 分页显示用户分组表
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserGroup>> getList(@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserGroup> userGroupCommonPage = CommonPage.restPage(userGroupService.getList(pageParamRequest));
|
||||
return CommonResult.success(userGroupCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户分组表
|
||||
* @param userGroupRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated UserGroupRequest userGroupRequest) {
|
||||
if (userGroupService.create(userGroupRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户分组表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (userGroupService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户分组表
|
||||
* @param id integer id
|
||||
* @param userGroupRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated UserGroupRequest userGroupRequest) {
|
||||
if (userGroupService.edit(id, userGroupRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户分组表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<UserGroup> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(userGroupService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.AdminIntegralSearchRequest;
|
||||
import com.zbkj.common.response.UserIntegralRecordResponse;
|
||||
import com.zbkj.service.service.UserIntegralRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 用户积分管理控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/integral")
|
||||
@Api(tags = "用户积分管理")
|
||||
public class UserIntegralController {
|
||||
|
||||
@Autowired
|
||||
private UserIntegralRecordService integralRecordService;
|
||||
|
||||
/**
|
||||
* 积分分页列表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:integral:list')")
|
||||
@ApiOperation(value = "积分分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
||||
public CommonResult<CommonPage<UserIntegralRecordResponse>> getList(@RequestBody @Validated AdminIntegralSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserIntegralRecordResponse> restPage = CommonPage.restPage(integralRecordService.findAdminList(request, pageParamRequest));
|
||||
return CommonResult.success(restPage);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.user.UserLevel;
|
||||
import com.zbkj.service.service.UserLevelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 用户等级记录表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/level")
|
||||
@Api(tags = "会员 -- 等级")
|
||||
public class UserLevelController {
|
||||
|
||||
@Autowired
|
||||
private UserLevelService userLevelService;
|
||||
|
||||
/**
|
||||
* 分页显示用户等级记录表
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:level:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserLevel>> getList(@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserLevel> userLevelCommonPage = CommonPage.restPage(userLevelService.getList(pageParamRequest));
|
||||
return CommonResult.success(userLevelCommonPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.UserRechargeSearchRequest;
|
||||
import com.zbkj.common.response.UserRechargeResponse;
|
||||
import com.zbkj.service.service.UserRechargeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* 用户充值表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/topUpLog")
|
||||
@Api(tags = "财务 -- 充值")
|
||||
public class UserRechargeController {
|
||||
|
||||
@Autowired
|
||||
private UserRechargeService userRechargeService;
|
||||
|
||||
/**
|
||||
* 分页显示用户充值表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:recharge:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserRechargeResponse>> getList(@Validated UserRechargeSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<UserRechargeResponse> userRechargeCommonPage = CommonPage.restPage(userRechargeService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(userRechargeCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值总金额
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:recharge:balance')")
|
||||
@ApiOperation(value = "提现总金额")
|
||||
@RequestMapping(value = "/balance", method = RequestMethod.POST)
|
||||
public CommonResult<HashMap<String, BigDecimal>> balance(){
|
||||
return CommonResult.success(userRechargeService.getBalanceList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.UserTagRequest;
|
||||
import com.zbkj.service.service.UserTagService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.zbkj.common.model.user.UserTag;
|
||||
|
||||
|
||||
/**
|
||||
* 用户标签 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/tag")
|
||||
@Api(tags = "会员 -- 标签") //配合swagger使用
|
||||
public class UserTagController {
|
||||
|
||||
@Autowired
|
||||
private UserTagService userTagService;
|
||||
|
||||
/**
|
||||
* 分页显示用户分标签
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserTag>> getList(@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserTag> userTagCommonPage = CommonPage.restPage(userTagService.getList(pageParamRequest));
|
||||
return CommonResult.success(userTagCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户分标签
|
||||
* @param userTagRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated UserTagRequest userTagRequest) {
|
||||
if (userTagService.create(userTagRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户分标签
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (userTagService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户标签
|
||||
* @param id integer id
|
||||
* @param userTagRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated UserTagRequest userTagRequest) {
|
||||
if (userTagService.updateTag(id, userTagRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户标签
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<UserTag> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(userTagService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.admin.service.ValidateCodeService;
|
||||
import com.zbkj.admin.vo.ValidateCode;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 验证码服务
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/validate/code")
|
||||
@Api(tags = "验证码服务")
|
||||
public class ValidateCodeController {
|
||||
|
||||
@Autowired
|
||||
private ValidateCodeService validateCodeService;
|
||||
|
||||
/**
|
||||
* 获取图片验证码
|
||||
* @return CommonResult
|
||||
*/
|
||||
// @PreAuthorize("hasAuthority('admin:validate:code:get')")
|
||||
@ApiOperation(value="获取验证码")
|
||||
@GetMapping(value = "/get")
|
||||
public CommonResult<ValidateCode> get() {
|
||||
ValidateCode validateCode = validateCodeService.get();
|
||||
return CommonResult.success(validateCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.WeChatJsSdkConfigResponse;
|
||||
import com.zbkj.service.service.WechatNewService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 微信 -- 开放平台 admin
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("WeChatAdminController")
|
||||
@RequestMapping("api/admin/wechat")
|
||||
@Api(tags = "微信 -- 开放平台 admin")
|
||||
public class WeChatAdminController {
|
||||
|
||||
@Autowired
|
||||
private WechatNewService wechatNewService;
|
||||
|
||||
/**
|
||||
* 获取微信公众号js配置
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:config')")
|
||||
@ApiOperation(value = "获取微信公众号js配置")
|
||||
@RequestMapping(value = "/config", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "url", value = "页面地址url")
|
||||
public CommonResult<WeChatJsSdkConfigResponse> configJs(@RequestParam(value = "url") String url) {
|
||||
return CommonResult.success(wechatNewService.getJsSdkConfig(url));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.service.service.WechatPublicService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 微信缓存表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/wechat/menu")
|
||||
@Api(tags = "微信开放平台 -- 菜单管理")
|
||||
public class WeChatController {
|
||||
|
||||
@Autowired
|
||||
private WechatPublicService wechatPublicService;
|
||||
|
||||
/**
|
||||
* 获取微信菜单
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:menu:public:get')")
|
||||
@ApiOperation(value = "获取自定义菜单")
|
||||
@RequestMapping(value = "/public/get", method = RequestMethod.GET)
|
||||
public CommonResult<Object> get() {
|
||||
return CommonResult.success(wechatPublicService.getCustomizeMenus());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建微信菜单
|
||||
* @param data 菜单数据,具体json格式参考微信开放平台
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:menu:public:create')")
|
||||
@ApiOperation(value = "保存自定义菜单")
|
||||
@RequestMapping(value = "/public/create", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> create(@RequestBody String data) {
|
||||
if (wechatPublicService.createMenus(data)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微信菜单
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:menu:public:delete')")
|
||||
@ApiOperation(value = "删除自定义菜单")
|
||||
@RequestMapping(value = "/public/delete", method = RequestMethod.GET)
|
||||
public CommonResult<JSONObject> delete() {
|
||||
if (wechatPublicService.deleteMenus()) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,78 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.service.service.WechatCallbackService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
|
||||
/**
|
||||
* 微信小程序回调
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/wechat/mini/callback")
|
||||
@Api(tags = "微信开放平台 -- 小程序回调")
|
||||
public class WechatCallbackController {
|
||||
|
||||
@Autowired
|
||||
private WechatCallbackService wechatCallbackService;
|
||||
|
||||
/**
|
||||
* 小程序回调-自己模拟
|
||||
*/
|
||||
@ApiOperation(value = "小程序回调-自己模拟")
|
||||
@RequestMapping(value = "/test", method = RequestMethod.POST)
|
||||
public String test(@RequestBody String request) {
|
||||
return wechatCallbackService.callback(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序回调
|
||||
* 目前只用于视频号直播
|
||||
*/
|
||||
@ApiOperation(value = "小程序回调")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.POST)
|
||||
public String webHook(@RequestBody String request) {
|
||||
return wechatCallbackService.callback(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信推送地址验证
|
||||
* @param signature 微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数、nonce参数。
|
||||
* @param timestamp 时间戳
|
||||
* @param nonce 随机数
|
||||
* @param echostr 随机字符串
|
||||
*/
|
||||
@RequestMapping(value = { "/index" }, method = RequestMethod.GET)
|
||||
private void webHook(
|
||||
@RequestParam(value = "signature", required = false) String signature,
|
||||
@RequestParam(value = "timestamp", required = false) String timestamp,
|
||||
@RequestParam(value = "nonce", required = false) String nonce,
|
||||
@RequestParam(value = "echostr") String echostr,
|
||||
HttpServletResponse response) throws IOException {
|
||||
System.out.println("微信小程序回调测试成功");
|
||||
PrintWriter writer = response.getWriter();
|
||||
writer.print(echostr);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.service.service.WechatMediaService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 微信回复表 前端控制器
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/wechat/media")
|
||||
@Api(tags = "微信开放平台 -- 素材")
|
||||
public class WechatMediaController {
|
||||
|
||||
@Autowired
|
||||
private WechatMediaService wechatMediaService;
|
||||
|
||||
/**
|
||||
* 上传
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:media:upload')")
|
||||
@ApiOperation(value = "上传")
|
||||
@RequestMapping(value = "/upload", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, String>> upload(
|
||||
@RequestParam("media") @ApiParam(name = "media", value = "待上传素材图片文件", required = true) MultipartFile file,
|
||||
@RequestParam("type") @ApiParam(name = "type", value = "媒体文件类型,分别有图片(image)、语音(voice", required = true, allowableValues = "range[image,voice]") String type
|
||||
) {
|
||||
return CommonResult.success(wechatMediaService.upload(file, type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,140 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.wechat.WechatReply;
|
||||
import com.zbkj.common.request.WechatReplyRequest;
|
||||
import com.zbkj.common.request.WechatReplySearchRequest;
|
||||
import com.zbkj.service.service.WechatReplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 微信关键字回复表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/wechat/keywords/reply")
|
||||
@Api(tags = "微信开放平台 -- 微信关键字回复")
|
||||
public class WechatReplyController {
|
||||
|
||||
@Autowired
|
||||
private WechatReplyService wechatReplyService;
|
||||
|
||||
/**
|
||||
* 分页显示微信关键字回复表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<WechatReply>> getList(@Validated WechatReplySearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<WechatReply> wechatReplyCommonPage = CommonPage.restPage(wechatReplyService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(wechatReplyCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增微信关键字回复表
|
||||
* @param wechatReplyRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated WechatReplyRequest wechatReplyRequest) {
|
||||
WechatReply wechatReply = new WechatReply();
|
||||
BeanUtils.copyProperties(wechatReplyRequest, wechatReply);
|
||||
if (wechatReplyService.create(wechatReply)) {
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微信关键字回复表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (wechatReplyService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改微信关键字回复表
|
||||
* @param wechatReplyRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated WechatReplyRequest wechatReplyRequest) {
|
||||
if (wechatReplyService.updateReply(wechatReplyRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param id integer id
|
||||
* @param status boolean 状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:status')")
|
||||
@ApiOperation(value = "状态")
|
||||
@RequestMapping(value = "/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam(value = "id") Integer id, @RequestParam(value = "status") Boolean status) {
|
||||
if (wechatReplyService.updateStatus(id, status)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询微信关键字回复表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<WechatReply> info(@RequestParam(value = "id") Integer id) {
|
||||
WechatReply wechatReply = wechatReplyService.getInfo(id);
|
||||
return CommonResult.success(wechatReply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键字查询数据
|
||||
* @param keywords String 关键字
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:info:keywords')")
|
||||
@ApiOperation(value = "根据关键字查询数据")
|
||||
@RequestMapping(value = "/info/keywords", method = RequestMethod.GET)
|
||||
public CommonResult<WechatReply> info(@RequestParam(value = "keywords") String keywords) {
|
||||
WechatReply wechatReply = wechatReplyService.getVoByKeywords(keywords);
|
||||
return CommonResult.success(wechatReply);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.service.service.YlyPrintService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 易联云打印订单
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/yly")
|
||||
@Api(tags = "易联云 打印订单小票") //配合swagger使用
|
||||
public class YlyPrintController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private YlyPrintService ylyPrintService;
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:yly:print')")
|
||||
@ApiOperation(value = "打印小票")
|
||||
@RequestMapping(value = "/print/{ordid}", method = RequestMethod.GET)
|
||||
public CommonResult<String> updateStatus(@PathVariable String ordid) {
|
||||
ylyPrintService.YlyPrint(ordid,false);
|
||||
return CommonResult.success();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.zbkj.admin.filter;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.zbkj.common.vo.LoginUserVo;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
* token过滤器 验证token有效性
|
||||
*/
|
||||
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||
|
||||
@Resource
|
||||
private TokenComponent tokenComponent;
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
LoginUserVo loginUser = tokenComponent.getLoginUser(request);
|
||||
// if (ObjectUtil.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
tokenComponent.verifyToken(loginUser);
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
|
||||
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
// 将authentication信息放入到上下文对象中
|
||||
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
||||
}
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.zbkj.admin.filter;
|
||||
|
||||
|
||||
import com.zbkj.common.utils.RequestUtil;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
/**
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
* 返回值输出过滤器
|
||||
*/
|
||||
//@Component
|
||||
public class ResponseFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
|
||||
throws IOException, ServletException {
|
||||
ResponseWrapper wrapperResponse = new ResponseWrapper((HttpServletResponse) response);//转换成代理类
|
||||
// 这里只拦截返回,直接让请求过去,如果在请求前有处理,可以在这里处理
|
||||
filterChain.doFilter(request, wrapperResponse);
|
||||
byte[] content = wrapperResponse.getContent();//获取返回值
|
||||
//判断是否有值
|
||||
if (content.length > 0) {
|
||||
String str = new String(content, StandardCharsets.UTF_8);
|
||||
|
||||
try {
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
str = new ResponseRouter().filter(str, RequestUtil.getUri(req));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//把返回值输出到客户端
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
if (str.length() > 0) {
|
||||
outputStream.write(str.getBytes());
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
//最后添加这一句,输出到客户端
|
||||
response.flushBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.zbkj.admin.filter;
|
||||
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.utils.SpringUtil;
|
||||
import com.zbkj.service.service.SystemAttachmentService;
|
||||
|
||||
/**
|
||||
* response路径处理
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class ResponseRouter {
|
||||
|
||||
public String filter(String data, String path) {
|
||||
boolean result = un().contains(path);
|
||||
if (result) {
|
||||
return data;
|
||||
}
|
||||
|
||||
// if (!path.contains("api/admin/") && !path.contains("api/front/")) {
|
||||
// return data;
|
||||
// }
|
||||
|
||||
//根据需要处理返回值
|
||||
if (data.contains(Constants.UPLOAD_TYPE_IMAGE+"/") && !data.contains("data:image/png;base64")) {
|
||||
data = SpringUtil.getBean(SystemAttachmentService.class).prefixImage(data);
|
||||
}
|
||||
|
||||
// if (data.contains("file/")) { 附件也走crmebimage 目录下
|
||||
// data = SpringUtil.getBean(SystemAttachmentService.class).prefixFile(data);
|
||||
// }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public static String un() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.zbkj.admin.filter;
|
||||
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.WriteListener;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpServletResponseWrapper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Response包装类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class ResponseWrapper extends HttpServletResponseWrapper {
|
||||
|
||||
private ByteArrayOutputStream buffer;
|
||||
|
||||
private ServletOutputStream out;
|
||||
|
||||
public ResponseWrapper(HttpServletResponse httpServletResponse) {
|
||||
super(httpServletResponse);
|
||||
buffer = new ByteArrayOutputStream();
|
||||
out = new WrapperOutputStream(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletOutputStream getOutputStream() {
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushBuffer()
|
||||
throws IOException {
|
||||
if (out != null) {
|
||||
out.flush();
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] getContent()
|
||||
throws IOException {
|
||||
flushBuffer();
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
|
||||
static class WrapperOutputStream extends ServletOutputStream {
|
||||
private ByteArrayOutputStream bos;
|
||||
|
||||
public WrapperOutputStream(ByteArrayOutputStream bos) {
|
||||
this.bos = bos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) {
|
||||
bos.write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWriteListener(WriteListener arg0) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
package com.zbkj.admin.filter;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.utils.RedisUtil;
|
||||
import com.zbkj.common.vo.LoginUserVo;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* token验证处理
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Component
|
||||
public class TokenComponent {
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L;
|
||||
|
||||
private static final Long MILLIS_MINUTE = 60 * 1000L;
|
||||
|
||||
// 令牌有效期(默认30分钟) todo 调试期改为5小时
|
||||
// private static final int expireTime = 30;
|
||||
private static final int expireTime = 5 * 60;
|
||||
|
||||
// Redis 存储的key
|
||||
private static final String TOKEN_REDIS = "TOKEN:ADMIN:";
|
||||
|
||||
/**
|
||||
* 获取用户身份信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
public LoginUserVo getLoginUser(HttpServletRequest request) {
|
||||
// 获取请求携带的令牌
|
||||
String token = getToken(request);
|
||||
if (StrUtil.isNotEmpty(token)) {
|
||||
String userKey = getTokenKey(token);
|
||||
return redisUtil.get(userKey);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户身份信息
|
||||
*/
|
||||
public void setLoginUser(LoginUserVo loginUser) {
|
||||
if (ObjectUtil.isNotNull(loginUser) && StrUtil.isNotEmpty(loginUser.getToken())) {
|
||||
refreshToken(loginUser);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户身份信息
|
||||
*/
|
||||
public void delLoginUser(String token) {
|
||||
if (StrUtil.isNotEmpty(token)) {
|
||||
String userKey = getTokenKey(token);
|
||||
redisUtil.delete(userKey);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建令牌
|
||||
*
|
||||
* @param loginUser 用户信息
|
||||
* @return 令牌
|
||||
*/
|
||||
public String createToken(LoginUserVo loginUser) {
|
||||
String token = UUID.randomUUID().toString().replace("-", "");
|
||||
loginUser.setToken(token);
|
||||
// setUserAgent(loginUser);
|
||||
refreshToken(loginUser);
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证令牌有效期,相差不足20分钟,自动刷新缓存
|
||||
*
|
||||
* @param loginUser LoginUserVo
|
||||
*/
|
||||
public void verifyToken(LoginUserVo loginUser) {
|
||||
long expireTime = loginUser.getExpireTime();
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (expireTime - currentTime <= MILLIS_MINUTE_TEN)
|
||||
{
|
||||
refreshToken(loginUser);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新令牌有效期
|
||||
*
|
||||
* @param loginUser 登录信息
|
||||
*/
|
||||
public void refreshToken(LoginUserVo loginUser) {
|
||||
loginUser.setLoginTime(System.currentTimeMillis());
|
||||
loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE);
|
||||
// 根据uuid将loginUser缓存
|
||||
String userKey = getTokenKey(loginUser.getToken());
|
||||
redisUtil.set(userKey, loginUser, (long) expireTime, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求token
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @return token
|
||||
*/
|
||||
private String getToken(HttpServletRequest request) {
|
||||
String token = request.getHeader(Constants.HEADER_AUTHORIZATION_KEY);
|
||||
if (StrUtil.isNotEmpty(token) && token.startsWith(TOKEN_REDIS)) {
|
||||
token = token.replace(TOKEN_REDIS, "");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
private String getTokenKey(String uuid) {
|
||||
return TOKEN_REDIS + uuid;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.zbkj.admin.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 认证失败处理类 返回未授权
|
||||
*/
|
||||
@Component
|
||||
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8970718410437077606L;
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) {
|
||||
// String msg = StrUtil.format("请求访问:{},认证失败,无法访问系统资源", httpServletRequest.getRequestURI());
|
||||
httpServletResponse.setStatus(200);
|
||||
httpServletResponse.setContentType("application/json");
|
||||
httpServletResponse.setCharacterEncoding("utf-8");
|
||||
try {
|
||||
httpServletResponse.getWriter().print(JSONObject.toJSONString(CommonResult.unauthorized()));
|
||||
} catch (IOException ioException) {
|
||||
ioException.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.zbkj.admin.manager;
|
||||
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.ProviderNotFoundException;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 自定义认证管理器
|
||||
* @Author 指缝de阳光
|
||||
* @Date 2021/11/17 15:23
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class CusAuthenticationManager implements AuthenticationManager {
|
||||
|
||||
// private final CustomAuthenticationProvider customAuthenticationProvider = new CustomAuthenticationProvider();
|
||||
private final CustomAuthenticationProvider customAuthenticationProvider;
|
||||
|
||||
public CusAuthenticationManager(CustomAuthenticationProvider customAuthenticationProvider) {
|
||||
this.customAuthenticationProvider = customAuthenticationProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||
Authentication result = customAuthenticationProvider.authenticate(authentication);
|
||||
if (Objects.nonNull(result)) {
|
||||
return result;
|
||||
}
|
||||
throw new ProviderNotFoundException("Authentication failed!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.zbkj.admin.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 自定义权限不足处理程序
|
||||
*
|
||||
* @Author 指缝de阳光
|
||||
* @Date 2021/11/19 14:45
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class CustomAccessDeniedHandler implements AccessDeniedHandler, Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8970718410437077606L;
|
||||
|
||||
@Override
|
||||
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException e) throws IOException, ServletException {
|
||||
httpServletResponse.setStatus(200);
|
||||
httpServletResponse.setContentType("application/json");
|
||||
httpServletResponse.setCharacterEncoding("utf-8");
|
||||
try {
|
||||
httpServletResponse.getWriter().print(JSONObject.toJSONString(CommonResult.forbidden()));
|
||||
} catch (IOException ioException) {
|
||||
ioException.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.zbkj.admin.manager;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.zbkj.common.exception.CrmebException;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.common.vo.LoginUserVo;
|
||||
import com.zbkj.service.service.impl.UserDetailServiceImpl;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 自定义验证(admin登录)
|
||||
*/
|
||||
@Component
|
||||
public class CustomAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
private UserDetailServiceImpl userDetailsService;
|
||||
|
||||
public CustomAuthenticationProvider(UserDetailServiceImpl userDetailsService) {
|
||||
this.userDetailsService = userDetailsService;
|
||||
}
|
||||
|
||||
// private final UserDetailServiceImpl userDetailsService = new UserDetailServiceImpl();
|
||||
|
||||
@Override
|
||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||
String name = authentication.getPrincipal().toString();
|
||||
String password = authentication.getCredentials().toString();
|
||||
|
||||
//以下自定义方法,判断是否登录成功
|
||||
LoginUserVo userDetails = (LoginUserVo) userDetailsService.loadUserByUsername(name);
|
||||
if (ObjectUtil.isNull(userDetails)) {
|
||||
throw new CrmebException("用户名不存在");
|
||||
}
|
||||
// base64加密获取真正密码
|
||||
String encryptPassword = CrmebUtil.encryptPassword(password, name);
|
||||
if (!userDetails.getUser().getPwd().equals(encryptPassword)) {
|
||||
throw new CrmebException("账号或者密码不正确");
|
||||
}
|
||||
return new UsernamePasswordAuthenticationToken(userDetails, password, userDetails.getAuthorities());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> authentication) {
|
||||
//确保authentication能转成该类
|
||||
return authentication.equals(UsernamePasswordAuthenticationToken.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.zbkj.admin.pub;
|
||||
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.service.service.SystemConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @program: crmeb
|
||||
* @author: 大粽子
|
||||
* @create: 2021-09-23 09:18
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/jsconfig")
|
||||
@Api(tags = "公共JS配置")
|
||||
public class GetJSConfig {
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@PreAuthorize("hasAuthority('public:jsconfig:getcrmebchatconfig')")
|
||||
@ApiOperation(value = "CRMEB-chat客服统计")
|
||||
@RequestMapping(value = "/getcrmebchatconfig", method = RequestMethod.GET)
|
||||
public String set(){
|
||||
return systemConfigService.getValueByKey(Constants.JS_CONFIG_CRMEB_CHAT_TONGJI);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.zbkj.admin.pub;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.utils.ImageMergeUtil;
|
||||
import com.zbkj.common.vo.ImageMergeUtilVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 图片操作
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/qrcode")
|
||||
@Api(tags = "图片操作")
|
||||
public class ImageMergeController {
|
||||
|
||||
@PreAuthorize("hasAuthority('public:qrcode:merge:list')")
|
||||
@ApiOperation(value = "合并图片返回文件")
|
||||
@RequestMapping(value = "/mergeList", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, String>> mergeList(@RequestBody @Validated List<ImageMergeUtilVo> list){
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("base64Code", ImageMergeUtil.drawWordFile(list)); //需要云服务域名,如果需要存入数据库参照上传图片服务
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package com.zbkj.admin.pub;
|
||||
|
||||
import com.zbkj.admin.service.WeChatMessageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
|
||||
/**
|
||||
* 微信缓存表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/wechat/message")
|
||||
@Api(tags = "微信开放平台 -- 消息")
|
||||
public class WeChatMessageController {
|
||||
|
||||
@Autowired
|
||||
private WeChatMessageService weChatMessageService;
|
||||
|
||||
/**
|
||||
* 微信关键字回复
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-22
|
||||
*/
|
||||
@ApiOperation(value = "接受微信推送过来的消息")
|
||||
@RequestMapping(value = "/webHook", method = RequestMethod.POST)
|
||||
public String webHook(HttpServletRequest request){
|
||||
return weChatMessageService.init(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信推送地址验证
|
||||
* @param signature
|
||||
* @param timestamp
|
||||
* @param nonce
|
||||
* @param echostr
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping(value = { "/webHook" }, method = RequestMethod.GET)
|
||||
private void webHook(
|
||||
@RequestParam(value = "signature", required = false) String signature,
|
||||
@RequestParam(value = "timestamp", required = false) String timestamp,
|
||||
@RequestParam(value = "nonce", required = false) String nonce,
|
||||
@RequestParam(value = "echostr") String echostr,
|
||||
HttpServletResponse response) throws IOException {
|
||||
PrintWriter writer = response.getWriter();
|
||||
writer.print(echostr);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,153 @@
|
||||
package com.zbkj.admin.pub;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.utils.RestTemplateUtil;
|
||||
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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 后台管理员表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/wechat")
|
||||
@Api(tags = "企业微信消息推送")
|
||||
public class WeChatPushController {
|
||||
|
||||
private static String url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=";
|
||||
|
||||
@Resource
|
||||
private RestTemplateUtil restTemplateUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 新增后台管理员表
|
||||
* @param message string message
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-13
|
||||
*/
|
||||
@ApiOperation(value = "gitlab钩子")
|
||||
@RequestMapping(value = "/gitlab", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="message", value="推送消息内容"),
|
||||
@ApiImplicitParam(name="token", value="企业微信群token"),
|
||||
})
|
||||
public CommonResult<Object> gitlab(@RequestBody String message,
|
||||
@RequestParam(name = "token", required = true) String token){
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("msgtype", "text");
|
||||
|
||||
Map<String, Object> text = new HashMap<>();
|
||||
|
||||
//需要@的人
|
||||
ArrayList<Object> people = new ArrayList<>();
|
||||
people.add("@all");
|
||||
text.put("mentioned_list", people);
|
||||
|
||||
//gitlab 动作标签
|
||||
JSONObject jsonObject = JSONObject.parseObject(message);
|
||||
String action = jsonObject.getString("object_kind");
|
||||
String content;
|
||||
switch(action){
|
||||
case "push":
|
||||
content = jsonObject.getJSONArray("commits").getJSONObject(0).getJSONObject("author").getString("name") + " " +
|
||||
action + " " +
|
||||
jsonObject.getString("ref").replace("refs/heads/", "") +
|
||||
"\n 备注:\n" +
|
||||
jsonObject.getJSONArray("commits").getJSONObject(0).getString("message");
|
||||
break;
|
||||
case "tag_push":
|
||||
content = jsonObject.getString("user_name") + " " +
|
||||
action + " " +
|
||||
jsonObject.getString("ref").replace("refs/heads/", "") +
|
||||
"\n 备注:\n" +
|
||||
jsonObject.getJSONArray("commits").getJSONObject(0).getString("message");
|
||||
break;
|
||||
case "note":
|
||||
String author = "未知用户";
|
||||
if(jsonObject.containsKey("commit")){
|
||||
author = jsonObject.getJSONObject("commit").getJSONObject("author").getString("name");
|
||||
}
|
||||
|
||||
if(jsonObject.containsKey("last_commit")){
|
||||
author = jsonObject.getJSONObject("last_commit").getJSONObject("author").getString("name");
|
||||
}
|
||||
|
||||
content = author +
|
||||
" 提交代码到 " +
|
||||
jsonObject.getJSONObject("project").getString("default_branch") +
|
||||
"\n 备注:\n" +
|
||||
jsonObject.getJSONObject("object_attributes").getString("note");
|
||||
break;
|
||||
case "merge_request":
|
||||
content = jsonObject.getJSONObject("object_attributes").getJSONObject("assignee").getString("name") + " " +
|
||||
"合并代码, 从 " +
|
||||
jsonObject.getJSONObject("object_attributes").getString("source_branch") + " ---> " +
|
||||
jsonObject.getJSONObject("object_attributes").getString("target_branch") +
|
||||
"\n 备注:\n" +
|
||||
jsonObject.getJSONObject("object_attributes").getJSONObject("last_commit").getString("message");
|
||||
break;
|
||||
default:
|
||||
content = "gitlab 项目有更新";
|
||||
}
|
||||
|
||||
text.put("content", content);
|
||||
map.put("text", text);
|
||||
String result = restTemplateUtil.postMapData(url + token, map);
|
||||
return CommonResult.success(JSONObject.parseObject(result));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增后台管理员表
|
||||
* @param message string message
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-13
|
||||
*/
|
||||
@ApiOperation(value = "消息推送")
|
||||
@RequestMapping(value = "/push", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="message", value="推送消息内容"),
|
||||
@ApiImplicitParam(name="token", value="企业微信群token"),
|
||||
})
|
||||
public CommonResult<Object> push(@RequestParam(name = "message") String message,
|
||||
@RequestParam(name = "token") String token){
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("msgtype", "text");
|
||||
|
||||
Map<String, Object> text = new HashMap<>();
|
||||
|
||||
//需要@的人
|
||||
ArrayList<Object> people = new ArrayList<>();
|
||||
people.add("@all");
|
||||
text.put("mentioned_list", people);
|
||||
text.put("content", message);
|
||||
map.put("text", text);
|
||||
String result = restTemplateUtil.postMapData(url + token, map);
|
||||
return CommonResult.success(JSONObject.parseObject(result));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package com.zbkj.admin.service;
|
||||
|
||||
import com.zbkj.common.request.SystemAdminLoginRequest;
|
||||
import com.zbkj.common.response.MenusResponse;
|
||||
import com.zbkj.common.response.SystemAdminResponse;
|
||||
import com.zbkj.common.response.SystemLoginResponse;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 管理端登录服务
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface AdminLoginService {
|
||||
|
||||
/**
|
||||
* PC登录
|
||||
*/
|
||||
SystemLoginResponse login(SystemAdminLoginRequest request, String ip);
|
||||
|
||||
/**
|
||||
* 用户登出
|
||||
*/
|
||||
Boolean logout();
|
||||
|
||||
/**
|
||||
* 获取登录页图片
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getLoginPic();
|
||||
|
||||
/**
|
||||
* 获取管理员可访问目录
|
||||
* @return List<MenusResponse>
|
||||
*/
|
||||
List<MenusResponse> getMenus();
|
||||
|
||||
/**
|
||||
* 根据Token获取对应用户信息
|
||||
*/
|
||||
SystemAdminResponse getInfoByToken();
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.zbkj.admin.service;
|
||||
|
||||
|
||||
import com.zbkj.admin.vo.ValidateCode;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* ValidateCodeService 接口
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface ValidateCodeService {
|
||||
|
||||
/**
|
||||
* 获取图片验证码
|
||||
* @return CommonResult
|
||||
*/
|
||||
ValidateCode get();
|
||||
|
||||
/**
|
||||
* 验证验证码
|
||||
*/
|
||||
Boolean check(String key, String code);
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.zbkj.admin.service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 用户中心 服务类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface WeChatMessageService{
|
||||
String init(HttpServletRequest request);
|
||||
}
|
||||
@ -0,0 +1,187 @@
|
||||
package com.zbkj.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.zbkj.admin.filter.TokenComponent;
|
||||
import com.zbkj.admin.service.AdminLoginService;
|
||||
import com.zbkj.admin.service.ValidateCodeService;
|
||||
import com.zbkj.common.constants.SysConfigConstants;
|
||||
import com.zbkj.common.constants.SysGroupDataConstants;
|
||||
import com.zbkj.common.exception.CrmebException;
|
||||
import com.zbkj.common.model.system.SystemAdmin;
|
||||
import com.zbkj.common.model.system.SystemMenu;
|
||||
import com.zbkj.common.model.system.SystemPermissions;
|
||||
import com.zbkj.common.request.SystemAdminLoginRequest;
|
||||
import com.zbkj.common.response.MenusResponse;
|
||||
import com.zbkj.common.response.SystemAdminResponse;
|
||||
import com.zbkj.common.response.SystemGroupDataAdminLoginBannerResponse;
|
||||
import com.zbkj.common.response.SystemLoginResponse;
|
||||
import com.zbkj.common.utils.SecurityUtil;
|
||||
import com.zbkj.common.vo.LoginUserVo;
|
||||
import com.zbkj.common.vo.MenuTree;
|
||||
import com.zbkj.service.service.SystemAdminService;
|
||||
import com.zbkj.service.service.SystemConfigService;
|
||||
import com.zbkj.service.service.SystemGroupDataService;
|
||||
import com.zbkj.service.service.SystemMenuService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 管理端登录服务实现类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Service
|
||||
public class AdminLoginServiceImpl implements AdminLoginService {
|
||||
|
||||
@Resource
|
||||
private TokenComponent tokenComponent;
|
||||
|
||||
@Resource
|
||||
private AuthenticationManager authenticationManager;
|
||||
|
||||
@Autowired
|
||||
private SystemAdminService systemAdminService;
|
||||
|
||||
@Autowired
|
||||
private ValidateCodeService validateCodeService;
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@Autowired
|
||||
private SystemGroupDataService systemGroupDataService;
|
||||
|
||||
@Autowired
|
||||
private SystemMenuService systemMenuService;
|
||||
|
||||
/**
|
||||
* PC登录
|
||||
*/
|
||||
@Override
|
||||
public SystemLoginResponse login(SystemAdminLoginRequest systemAdminLoginRequest, String ip) {
|
||||
// 判断验证码
|
||||
boolean codeCheckResult = validateCodeService.check(systemAdminLoginRequest.getKey(), systemAdminLoginRequest.getCode());
|
||||
if (!codeCheckResult) throw new CrmebException("验证码不正确");
|
||||
// 用户验证
|
||||
Authentication authentication = null;
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
try {
|
||||
authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(systemAdminLoginRequest.getAccount(), systemAdminLoginRequest.getPwd()));
|
||||
} catch (AuthenticationException e) {
|
||||
if (e instanceof BadCredentialsException) {
|
||||
throw new CrmebException("用户不存在或密码错误");
|
||||
}
|
||||
throw new CrmebException(e.getMessage());
|
||||
}
|
||||
LoginUserVo loginUser = (LoginUserVo) authentication.getPrincipal();
|
||||
SystemAdmin systemAdmin = loginUser.getUser();
|
||||
|
||||
String token = tokenComponent.createToken(loginUser);
|
||||
SystemLoginResponse systemAdminResponse = new SystemLoginResponse();
|
||||
systemAdminResponse.setToken(token);
|
||||
BeanUtils.copyProperties(systemAdmin, systemAdminResponse);
|
||||
|
||||
//更新最后登录信息
|
||||
systemAdmin.setLoginCount(systemAdmin.getLoginCount() + 1);
|
||||
systemAdmin.setLastIp(ip);
|
||||
systemAdminService.updateById(systemAdmin);
|
||||
return systemAdminResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登出
|
||||
*/
|
||||
@Override
|
||||
public Boolean logout() {
|
||||
LoginUserVo loginUserVo = SecurityUtil.getLoginUserVo();
|
||||
if (ObjectUtil.isNotNull(loginUserVo)) {
|
||||
// 删除用户缓存记录
|
||||
tokenComponent.delLoginUser(loginUserVo.getToken());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录页图片
|
||||
* @return Map
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getLoginPic() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//背景图
|
||||
map.put("backgroundImage", systemConfigService.getValueByKey(SysConfigConstants.CONFIG_KEY_ADMIN_LOGIN_BACKGROUND_IMAGE));
|
||||
//logo
|
||||
map.put("logo", systemConfigService.getValueByKey(SysConfigConstants.CONFIG_KEY_ADMIN_LOGIN_LOGO_LEFT_TOP));
|
||||
map.put("loginLogo", systemConfigService.getValueByKey(SysConfigConstants.CONFIG_KEY_ADMIN_LOGIN_LOGO_LOGIN));
|
||||
//轮播图
|
||||
List<SystemGroupDataAdminLoginBannerResponse> bannerList = systemGroupDataService.getListByGid(SysGroupDataConstants.GROUP_DATA_ID_ADMIN_LOGIN_BANNER_IMAGE_LIST, SystemGroupDataAdminLoginBannerResponse.class);
|
||||
map.put("banner", bannerList);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取管理员可访问目录
|
||||
* @return List<MenusResponse>
|
||||
*/
|
||||
@Override
|
||||
public List<MenusResponse> getMenus() {
|
||||
LoginUserVo loginUserVo = SecurityUtil.getLoginUserVo();
|
||||
List<String> roleList = Stream.of(loginUserVo.getUser().getRoles().split(",")).collect(Collectors.toList());
|
||||
List<SystemMenu> menuList;
|
||||
if (roleList.contains("1")) {// 超管
|
||||
menuList = systemMenuService.findAllCatalogue();
|
||||
} else {
|
||||
menuList = systemMenuService.getMenusByUserId(loginUserVo.getUser().getId());
|
||||
}
|
||||
// 组装前端对象
|
||||
List<MenusResponse> responseList = menuList.stream().map(e -> {
|
||||
MenusResponse response = new MenusResponse();
|
||||
BeanUtils.copyProperties(e, response);
|
||||
return response;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
MenuTree menuTree = new MenuTree(responseList);
|
||||
return menuTree.buildTree();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据Token获取对应用户信息
|
||||
*/
|
||||
@Override
|
||||
public SystemAdminResponse getInfoByToken() {
|
||||
LoginUserVo loginUserVo = SecurityUtil.getLoginUserVo();
|
||||
SystemAdmin systemAdmin = loginUserVo.getUser();
|
||||
SystemAdminResponse systemAdminResponse = new SystemAdminResponse();
|
||||
BeanUtils.copyProperties(systemAdmin, systemAdminResponse);
|
||||
List<String> roleList = Stream.of(systemAdmin.getRoles().split(",")).collect(Collectors.toList());
|
||||
List<String> permList = CollUtil.newArrayList();
|
||||
if (roleList.contains("1")) {
|
||||
permList.add("*:*:*");
|
||||
} else {
|
||||
permList = loginUserVo.getPermissions().stream().map(SystemPermissions::getPath).collect(Collectors.toList());
|
||||
}
|
||||
systemAdminResponse.setPermissionsList(permList);
|
||||
return systemAdminResponse;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package com.zbkj.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.exception.CrmebException;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.common.utils.RedisUtil;
|
||||
import com.zbkj.common.utils.ValidateCodeUtil;
|
||||
import com.zbkj.admin.service.ValidateCodeService;
|
||||
import com.zbkj.admin.vo.ValidateCode;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* ValidateCodeService 实现类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Service
|
||||
public class ValidateCodeServiceImpl implements ValidateCodeService {
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisAdminUtil;
|
||||
|
||||
/**
|
||||
* 获取验证码信息
|
||||
*/
|
||||
@Override
|
||||
public ValidateCode get() {
|
||||
ValidateCodeUtil.Validate randomCode = ValidateCodeUtil.getRandomCode();//直接调用静态方法,返回验证码对象
|
||||
if (ObjectUtil.isNull(randomCode)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String value = randomCode.getValue().toLowerCase();
|
||||
String md5Key = DigestUtils.md5Hex(value);
|
||||
String redisKey = getRedisKey(md5Key);
|
||||
redisAdminUtil.set(redisKey, value, 5L, TimeUnit.MINUTES); //5分钟过期
|
||||
String base64Str = randomCode.getBase64Str();
|
||||
return new ValidateCode(md5Key, CrmebUtil.getBase64Image(base64Str));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取redis key
|
||||
* @param md5Key value的md5加密值
|
||||
*/
|
||||
public String getRedisKey(String md5Key) {
|
||||
return Constants.VALIDATE_REDIS_KEY_PREFIX + md5Key;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证
|
||||
*/
|
||||
public Boolean check(String key, String code) {
|
||||
if (!redisAdminUtil.exists(getRedisKey(key))) {
|
||||
throw new CrmebException("验证码错误");
|
||||
}
|
||||
Object redisValue = redisAdminUtil.get(getRedisKey(key));
|
||||
if (ObjectUtil.isNull(redisValue)) {
|
||||
return false;
|
||||
}
|
||||
return redisValue.equals(code.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,223 @@
|
||||
package com.zbkj.admin.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.constants.WeChatConstants;
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.common.utils.RedisUtil;
|
||||
import com.zbkj.common.utils.XmlUtil;
|
||||
import com.zbkj.common.model.article.Article;
|
||||
import com.zbkj.admin.service.WeChatMessageService;
|
||||
import com.zbkj.admin.vo.*;
|
||||
import com.zbkj.common.model.wechat.WechatReply;
|
||||
import com.zbkj.service.service.ArticleService;
|
||||
import com.zbkj.service.service.SystemAttachmentService;
|
||||
import com.zbkj.service.service.UserTokenService;
|
||||
import com.zbkj.service.service.WechatReplyService;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 用户中心 服务实现类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@Service
|
||||
public class WeChatMessageServiceImpl implements WeChatMessageService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(WeChatMessageServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private WechatReplyService wechatReplyService;
|
||||
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
|
||||
@Autowired
|
||||
private UserTokenService userTokenService;
|
||||
|
||||
@Autowired
|
||||
private SystemAttachmentService systemAttachmentService;
|
||||
|
||||
//接收人,被动回复消息的时候为发送人
|
||||
private String toUserName;
|
||||
|
||||
//发送人,被动回复消息的时候为接收人
|
||||
private String fromUserName;
|
||||
|
||||
//接收消息类型
|
||||
private String msgType;
|
||||
|
||||
//接收消息内容
|
||||
private String content;
|
||||
|
||||
//消息事件
|
||||
private String event;
|
||||
|
||||
//事件key
|
||||
private String eventKey;
|
||||
|
||||
//关键字回复对象
|
||||
private WechatReply wechatReply;
|
||||
|
||||
|
||||
/**
|
||||
* 处理微信推送过来的消息,并且组装成需要发送的数据,二次处理
|
||||
* @param request HttpServletRequest request请求
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-03
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public String init(HttpServletRequest request) {
|
||||
Map<String, String> map = XmlUtil.xmlToMap(request);
|
||||
|
||||
setToUserName(map.get("ToUserName"));
|
||||
setFromUserName(map.get("FromUserName"));
|
||||
setMsgType(map.getOrDefault("MsgType", "text")); //如果没有类型,则按默认处理
|
||||
setContent(map.getOrDefault("Content", "default")); //如果没有内容,则按默认处理
|
||||
setEvent(map.getOrDefault("Event", ""));
|
||||
setEventKey(map.getOrDefault("EventKey", ""));
|
||||
|
||||
|
||||
|
||||
//处理内容
|
||||
getReplyByContent();
|
||||
|
||||
if(null == getWechatReply()){
|
||||
return "";
|
||||
}
|
||||
|
||||
//设置需要回复的内容
|
||||
String response = setXml();
|
||||
|
||||
logger.info("微信被动回复消息" + response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配关键字并且组装xml数据
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-03
|
||||
* @return String
|
||||
*/
|
||||
private String setXml() {
|
||||
if(StringUtils.isBlank(getWechatReply().getType())){
|
||||
return "";
|
||||
}
|
||||
String type = getWechatReply().getType().toLowerCase();
|
||||
MessageReplyDataVo messageReplyDataVo = JSONObject.toJavaObject(JSONObject.parseObject(wechatReply.getData()), MessageReplyDataVo.class);
|
||||
|
||||
switch (type){
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_RESP_MESSAGE_TYPE_TEXT:
|
||||
MessageTextVo messageTextVo = new MessageTextVo(getFromUserName(), getToUserName(), messageReplyDataVo.getContent());
|
||||
return XmlUtil.objectToXml(messageTextVo);
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_RESP_MESSAGE_TYPE_VOICE:
|
||||
return XmlUtil.objectToXml(new MessageVoiceVo(getFromUserName(), getToUserName(), new MessageVoiceItemVo(messageReplyDataVo.getMediaId())));
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_RESP_MESSAGE_TYPE_IMAGE:
|
||||
return XmlUtil.objectToXml(new MessageImageVo(getFromUserName(), getToUserName(), new MessageImageItemVo(messageReplyDataVo.getMediaId())));
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_RESP_MESSAGE_TYPE_NEWS:
|
||||
//文章
|
||||
return getNews(messageReplyDataVo.getArticleId());
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装文章消息
|
||||
* @param articleId Integer 文章id
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-03
|
||||
* @return MessageVoiceVo
|
||||
*/
|
||||
private String getNews(Integer articleId) {
|
||||
Article article = articleService.getById(articleId);
|
||||
if(null == article || article.getStatus() || article.getHide()){
|
||||
return "";
|
||||
}
|
||||
|
||||
return "<xml>\n" +
|
||||
" <ToUserName><![CDATA["+fromUserName+"]]></ToUserName>\n" +
|
||||
" <FromUserName><![CDATA["+toUserName+"]]></FromUserName>\n" +
|
||||
" <CreateTime>"+ DateUtil.getNowTime() +"</CreateTime>\n" +
|
||||
" <MsgType><![CDATA[news]]></MsgType>\n" +
|
||||
" <ArticleCount>1</ArticleCount>\n" +
|
||||
" <Articles>\n" +
|
||||
" <item>\n" +
|
||||
" <Title><![CDATA["+article.getTitle()+"]]></Title>\n" +
|
||||
" <Description><![CDATA["+article.getShareSynopsis()+"]]></Description>\n" +
|
||||
" <PicUrl><![CDATA["+article.getImageInput()+"]]></PicUrl>\n" +
|
||||
" <Url><![CDATA["+article.getUrl()+"]]></Url>\n" +
|
||||
" </item>\n" +
|
||||
" </Articles>\n" +
|
||||
"</xml>\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理不同的消息类型
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-03
|
||||
*/
|
||||
private void getReplyByContent() {
|
||||
WechatReply wp = new WechatReply();
|
||||
switch (getMsgType()){
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_EVENT:
|
||||
if(StringUtils.isBlank(getEvent())){
|
||||
break;
|
||||
}
|
||||
switch (getEvent().toLowerCase()){
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_EVENT_TYPE_UNSUBSCRIBE:
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_EVENT_TYPE_SCAN:
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_EVENT_TYPE_LOCATION:
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_EVENT_TYPE_VIEW:
|
||||
//暂时不处理
|
||||
break;
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_EVENT_TYPE_SUBSCRIBE:
|
||||
wp = wechatReplyService.getVoByKeywords(WeChatConstants.WE_CHAT_MESSAGE_EVENT_TYPE_SUBSCRIBE.toLowerCase());
|
||||
break;
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_EVENT_TYPE_CLICK:
|
||||
wp = wechatReplyService.getVoByKeywords(eventKey);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_TEXT:
|
||||
wp = wechatReplyService.getVoByKeywords(getContent());
|
||||
break;
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_IMAGE:
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_VOICE:
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_VIDEO:
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_LOCATION:
|
||||
case WeChatConstants.WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_LINK:
|
||||
//不需要处理
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(null == wp){
|
||||
//无效关键字回复
|
||||
wp = wechatReplyService.getVoByKeywords(WeChatConstants.WE_CHAT_MESSAGE_DEFAULT_CONTENT_KEY);
|
||||
}
|
||||
setWechatReply(wp);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.zbkj.admin.task.bargain;
|
||||
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.service.service.StoreBargainService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 砍价活动结束状态变化定时任务
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Component
|
||||
@Configuration //读取配置
|
||||
@EnableScheduling // 2.开启定时任务
|
||||
public class BargainStopChangeTask {
|
||||
|
||||
//日志
|
||||
private static final Logger logger = LoggerFactory.getLogger(BargainStopChangeTask.class);
|
||||
|
||||
@Autowired
|
||||
private StoreBargainService storeBargainService;
|
||||
|
||||
@Scheduled(cron = "0 0 0 */1 * ?") //5秒钟同步一次数据
|
||||
public void init(){
|
||||
logger.info("---BargainStopChangeTask------bargain stop status change task: Execution Time - {}", DateUtil.nowDateTime());
|
||||
try {
|
||||
storeBargainService.stopAfterChange();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
logger.error("BargainStopChangeTask" + " | msg : " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.zbkj.admin.task.brokerage;
|
||||
|
||||
|
||||
import com.zbkj.admin.task.order.OrderReceiptTask;
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.service.service.UserBrokerageRecordService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 佣金冻结期解冻task
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Component
|
||||
@Configuration //读取配置
|
||||
@EnableScheduling // 2.开启定时任务
|
||||
public class BrokerageFrozenTask {
|
||||
|
||||
//日志
|
||||
private static final Logger logger = LoggerFactory.getLogger(OrderReceiptTask.class);
|
||||
|
||||
@Autowired
|
||||
private UserBrokerageRecordService userBrokerageRecordService;
|
||||
|
||||
// @Scheduled(fixedDelay = 1000 * 60 * 60L) //1小时同步一次数据
|
||||
@Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
|
||||
public void init(){
|
||||
logger.info("---BrokerageFrozenTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
|
||||
try {
|
||||
userBrokerageRecordService.brokerageThaw();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("BrokerageFrozenTask.task" + " | msg : " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.zbkj.admin.task.coupon;
|
||||
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.service.service.StoreCouponUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 优惠券过期定时任务
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Component
|
||||
@Configuration //读取配置
|
||||
@EnableScheduling // 2.开启定时任务
|
||||
public class CouponOverdueTask {
|
||||
|
||||
//日志
|
||||
private static final Logger logger = LoggerFactory.getLogger(CouponOverdueTask.class);
|
||||
|
||||
@Autowired
|
||||
private StoreCouponUserService couponUserService;
|
||||
|
||||
@Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
|
||||
public void init(){
|
||||
logger.info("---CouponOverdueTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
|
||||
try {
|
||||
couponUserService.overdueTask();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("CouponOverdueTask.task" + " | msg : " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.zbkj.admin.task.integral;
|
||||
|
||||
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.service.service.UserIntegralRecordService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 积分冻结期解冻task
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Component
|
||||
@Configuration //读取配置
|
||||
@EnableScheduling // 2.开启定时任务
|
||||
public class IntegralFrozenTask {
|
||||
|
||||
//日志
|
||||
private static final Logger logger = LoggerFactory.getLogger(IntegralFrozenTask.class);
|
||||
|
||||
@Autowired
|
||||
private UserIntegralRecordService userIntegralRecordService;
|
||||
|
||||
@Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
|
||||
public void init() {
|
||||
logger.info("---IntegralFrozenTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
|
||||
try {
|
||||
userIntegralRecordService.integralThaw();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("IntegralFrozenTask.task" + " | msg : " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.zbkj.admin.task.log;
|
||||
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.service.service.WechatExceptionsService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 自动删除不需要的历史日志
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Component
|
||||
@Configuration //读取配置
|
||||
@EnableScheduling // 2.开启定时任务
|
||||
public class AutoDeleteLogTask {
|
||||
|
||||
//日志
|
||||
private static final Logger logger = LoggerFactory.getLogger(AutoDeleteLogTask.class);
|
||||
|
||||
@Autowired
|
||||
private WechatExceptionsService wechatExceptionsService;
|
||||
|
||||
/**
|
||||
* 每天0点执行
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 */1 * ?")
|
||||
public void autoDeleteLog() {
|
||||
// cron : 0 0 0 */1 * ?
|
||||
logger.info("---AutoDeleteLogTask------bargain stop status change task: Execution Time - {}", DateUtil.nowDateTime());
|
||||
try {
|
||||
wechatExceptionsService.autoDeleteLog();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("AutoDeleteLogTask" + " | msg : " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.zbkj.admin.task.order;
|
||||
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.service.service.OrderTaskService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 系统自动取消未支付订单task任务
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Component
|
||||
@Configuration //读取配置
|
||||
@EnableScheduling // 2.开启定时任务
|
||||
public class OrderAutoCancelTask {
|
||||
//日志
|
||||
private static final Logger logger = LoggerFactory.getLogger(OrderAutoCancelTask.class);
|
||||
|
||||
@Autowired
|
||||
private OrderTaskService orderTaskService;
|
||||
|
||||
@Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
|
||||
public void init() {
|
||||
logger.info("---OrderAutoCancelTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
|
||||
try {
|
||||
orderTaskService.autoCancel();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("OrderAutoCancelTask.task" + " | msg : " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.zbkj.admin.task.order;
|
||||
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.service.service.OrderTaskService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 订单自动完成Task
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Component
|
||||
@Configuration //读取配置
|
||||
@EnableScheduling // 2.开启定时任务
|
||||
public class OrderAutoCompleteTask {
|
||||
|
||||
//日志
|
||||
private static final Logger logger = LoggerFactory.getLogger(OrderCompleteTask.class);
|
||||
|
||||
@Autowired
|
||||
private OrderTaskService orderTaskService;
|
||||
|
||||
@Scheduled(fixedDelay = 1000 * 60L * 60) //每小时同步一次数据
|
||||
public void init() {
|
||||
logger.info("---OrderAutoCompleteTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
|
||||
try {
|
||||
orderTaskService.autoComplete();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("OrderAutoCompleteTask.task" + " | msg : " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.zbkj.admin.task.order;
|
||||
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.service.service.OrderTaskService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 用户取消订单task任务
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Component
|
||||
@Configuration //读取配置
|
||||
@EnableScheduling // 2.开启定时任务
|
||||
public class OrderCancelTask {
|
||||
//日志
|
||||
private static final Logger logger = LoggerFactory.getLogger(OrderCancelTask.class);
|
||||
|
||||
@Autowired
|
||||
private OrderTaskService orderTaskService;
|
||||
|
||||
@Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
|
||||
public void init() {
|
||||
logger.info("---OrderCancelTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
|
||||
try {
|
||||
orderTaskService.cancelByUser();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("OrderCancelTask.task" + " | msg : " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user