panxiaohe
2 years ago
commit
b2d2d208b7
2843 changed files with 347067 additions and 0 deletions
-
6.gitignore
-
5cereshop-admin/Dockerfile
-
3072cereshop-admin/logs/sys-error.log
-
18cereshop-admin/logs/sys-info.log
-
0cereshop-admin/logs/sys-user.log
-
224cereshop-admin/pom.xml
-
48cereshop-admin/src/main/assembly/assembly.xml
-
99cereshop-admin/src/main/java/com/shop/cereshop/admin/CereshopAdminApplication.java
-
54cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/listener/GetObjectProgressListener.java
-
112cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/listener/PutObjectProgressListener.java
-
26cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/page/Url.java
-
23cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/DeleteFileService.java
-
31cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/FileDownloadService.java
-
14cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/FileEncodeService.java
-
17cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/FileUploadService.java
-
67cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/GetFileListService.java
-
51cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/PictureHandlerService.java
-
27cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/SafetyFileService.java
-
84cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/UploadService.java
-
74cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/impl/DeleteFileServiceImpl.java
-
81cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/impl/FileDownloadServiceImpl.java
-
61cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/impl/FileEncodeServiceImpl.java
-
98cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/impl/FileUploadServiceImpl.java
-
180cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/impl/GetFileListServiceImpl.java
-
67cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/impl/PictureHandlerServiceImpl.java
-
57cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/impl/SafetyFileServiceImpl.java
-
252cereshop-admin/src/main/java/com/shop/cereshop/admin/alioss/service/impl/UploadServiceImpl.java
-
17cereshop-admin/src/main/java/com/shop/cereshop/admin/annotation/NoRepeatSubmit.java
-
20cereshop-admin/src/main/java/com/shop/cereshop/admin/annotation/NoRepeatWebLog.java
-
68cereshop-admin/src/main/java/com/shop/cereshop/admin/aspect/RepeatSubmitAspect.java
-
86cereshop-admin/src/main/java/com/shop/cereshop/admin/aspect/WebLogAspect.java
-
66cereshop-admin/src/main/java/com/shop/cereshop/admin/config/ConstantProperties.java
-
28cereshop-admin/src/main/java/com/shop/cereshop/admin/config/CorsConfig.java
-
76cereshop-admin/src/main/java/com/shop/cereshop/admin/config/CustomizeNullJsonSerializer.java
-
38cereshop-admin/src/main/java/com/shop/cereshop/admin/config/JacksonConfig.java
-
83cereshop-admin/src/main/java/com/shop/cereshop/admin/config/MyBeanSerializerModifier.java
-
23cereshop-admin/src/main/java/com/shop/cereshop/admin/config/MybatisInterceptorConfig.java
-
80cereshop-admin/src/main/java/com/shop/cereshop/admin/config/MybatisPlusConfig.java
-
57cereshop-admin/src/main/java/com/shop/cereshop/admin/config/RedissonConfig.java
-
50cereshop-admin/src/main/java/com/shop/cereshop/admin/config/SwaggerConfiguration.java
-
43cereshop-admin/src/main/java/com/shop/cereshop/admin/config/WebMvcConfig.java
-
28cereshop-admin/src/main/java/com/shop/cereshop/admin/config/WxProperties.java
-
106cereshop-admin/src/main/java/com/shop/cereshop/admin/config/WxServiceConfig.java
-
23cereshop-admin/src/main/java/com/shop/cereshop/admin/config/WxWorkProperties.java
-
311cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/ActivityController.java
-
453cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/AdminController.java
-
95cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/AdvertController.java
-
143cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/AfterController.java
-
104cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/BrandController.java
-
158cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/BusinessPermissionController.java
-
210cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/BuyerUserController.java
-
77cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/BuyerWithdrawalController.java
-
379cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/CanvasController.java
-
104cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/ChannelController.java
-
117cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/ClassifyController.java
-
116cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/CommentController.java
-
51cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/CreditRecordController.java
-
83cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/CreditSignSettingController.java
-
187cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/DictController.java
-
212cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/DiscountController.java
-
54cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/ExpressController.java
-
65cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/FinanceController.java
-
58cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/IndexController.java
-
97cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/LiveController.java
-
84cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/LiveProductController.java
-
55cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/MakingDataController.java
-
116cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/MemberLevelController.java
-
118cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/MemberShipController.java
-
115cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/MessageController.java
-
96cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/NoticeController.java
-
122cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/OrderController.java
-
125cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/PermissionController.java
-
145cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/PlatformLabelController.java
-
206cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/PlatformUserController.java
-
160cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/PoliteController.java
-
147cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/RiskController.java
-
143cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/RoleController.java
-
203cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/SeckillController.java
-
85cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/SensitiveController.java
-
99cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/ShopCheckController.java
-
151cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/ShopController.java
-
58cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/UploadController.java
-
79cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/WithdrawalController.java
-
137cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/WordController.java
-
455cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/WxWorkController.java
-
39cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/activity/CereActivitySignDAO.java
-
140cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/activity/CerePlatformActivityDAO.java
-
23cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/activity/CerePlatformActivityDetailDAO.java
-
23cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/activity/CereSignProductDAO.java
-
30cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/admin/AdminDAO.java
-
30cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/advert/CerePopupAdvertDAO.java
-
22cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/after/CereAfterProductDAO.java
-
56cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/after/CereOrderAfterDAO.java
-
19cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/after/CerePlatformAfterDAO.java
-
9cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/brand/BrandDAO.java
-
20cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/business/CereBusinessShopDAO.java
-
16cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/business/CereBusinessUserRoleDAO.java
-
27cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/business/CerePlatformBusinessDAO.java
-
17cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/buyer/CereBuyerPlatformDiscountVisitDAO.java
-
17cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/buyer/CereBuyerPlatformSeckillVisitDAO.java
@ -0,0 +1,6 @@ |
|||
target/ |
|||
*.iml |
|||
.idea |
|||
.DS_Store |
|||
/logs |
|||
*-local.yml |
@ -0,0 +1,5 @@ |
|||
FROM registry.cn-shenzhen.aliyuncs.com/sumply-shop/openjdk8-font |
|||
ADD target/cereshop-admin /home/cereshop-admin |
|||
ADD cert/ /home/ceres/cert |
|||
WORKDIR /home/cereshop-admin |
|||
ENTRYPOINT ["java","-jar","cereshop-admin.jar"] |
3072
cereshop-admin/logs/sys-error.log
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,18 @@ |
|||
15:05:19.400 [main] INFO com.shop.cereshop.admin.PlatformActivityTest - [logStarting,50] - Starting PlatformActivityTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:19.404 [main] INFO com.shop.cereshop.admin.PlatformActivityTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:24.815 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-1,dataSource} inited |
|||
15:05:24.944 [main] INFO com.shop.cereshop.admin.PlatformDiscountTest - [logStarting,50] - Starting PlatformDiscountTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:24.944 [main] INFO com.shop.cereshop.admin.PlatformDiscountTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:26.290 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-2,dataSource} inited |
|||
15:05:26.383 [main] INFO com.shop.cereshop.admin.PlatformMemberLevelTest - [logStarting,50] - Starting PlatformMemberLevelTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:26.384 [main] INFO com.shop.cereshop.admin.PlatformMemberLevelTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:27.957 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-3,dataSource} inited |
|||
15:05:28.032 [main] INFO com.shop.cereshop.admin.PlatformMemberShipTest - [logStarting,50] - Starting PlatformMemberShipTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:28.032 [main] INFO com.shop.cereshop.admin.PlatformMemberShipTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:29.173 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-4,dataSource} inited |
|||
15:05:29.235 [main] INFO com.shop.cereshop.admin.PlatformPoliteTest - [logStarting,50] - Starting PlatformPoliteTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:29.235 [main] INFO com.shop.cereshop.admin.PlatformPoliteTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:30.235 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-5,dataSource} inited |
|||
15:05:30.294 [main] INFO com.shop.cereshop.admin.PlatformSeckillTest - [logStarting,50] - Starting PlatformSeckillTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:30.294 [main] INFO com.shop.cereshop.admin.PlatformSeckillTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:31.230 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-6,dataSource} inited |
@ -0,0 +1,224 @@ |
|||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<groupId>com.shop</groupId> |
|||
<artifactId>cereshop-admin</artifactId> |
|||
<version>2.0</version> |
|||
<name>cereshop-admin</name> |
|||
<description>Admin project for Spring Boot</description> |
|||
|
|||
<packaging>jar</packaging> |
|||
|
|||
<parent> |
|||
<groupId>com.shop</groupId> |
|||
<artifactId>cereshop</artifactId> |
|||
<version>2.0</version> |
|||
</parent> |
|||
|
|||
<dependencies> |
|||
<!-- Spring Boot Redis依赖 --> |
|||
<!-- 注意:1.5版本的依赖和2.0的依赖不一样,注意看哦 1.5我记得名字里面应该没有“data”, 2.0必须是“spring-boot-starter-data-redis” 这个才行--> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-redis</artifactId> |
|||
</dependency> |
|||
|
|||
<!-- 添加jedis客户端 --> |
|||
<dependency> |
|||
<groupId>redis.clients</groupId> |
|||
<artifactId>jedis</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.apache.commons</groupId> |
|||
<artifactId>commons-pool2</artifactId> |
|||
</dependency> |
|||
|
|||
<!--aliyunOSS--> |
|||
<dependency> |
|||
<groupId>com.aliyun.oss</groupId> |
|||
<artifactId>aliyun-sdk-oss</artifactId> |
|||
</dependency> |
|||
|
|||
<!--阿里短信服务--> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>aliyun-java-sdk-core</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.shop</groupId> |
|||
<artifactId>cereshop-commons</artifactId> |
|||
<version>2.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-thymeleaf</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-core</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-extension</artifactId> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
|
|||
<profiles> |
|||
<profile> |
|||
<id>admin-prod</id> |
|||
<properties> |
|||
<package.environment>admin-prod</package.environment> |
|||
</properties> |
|||
<build> |
|||
<resources> |
|||
<resource> |
|||
<directory>src/main/resources</directory> |
|||
<!-- 资源根目录排除各环境的配置,使用单独的资源目录来指定 --> |
|||
<includes> |
|||
<include>static/**</include> |
|||
<include>mybatis/**</include> |
|||
<include>service/**</include> |
|||
<include>cert/**</include> |
|||
</includes> |
|||
<!-- 是否替换资源中的属性 --> |
|||
<filtering>true</filtering> |
|||
</resource> |
|||
</resources> |
|||
</build> |
|||
</profile> |
|||
<profile> |
|||
<id>admin-dev</id> |
|||
<activation> |
|||
<activeByDefault>true</activeByDefault> |
|||
</activation> |
|||
<properties> |
|||
<package.environment>admin-dev</package.environment> |
|||
</properties> |
|||
<build> |
|||
<resources> |
|||
<resource> |
|||
<directory>src/main/resources</directory> |
|||
<!-- 资源根目录排除各环境的配置,使用单独的资源目录来指定 --> |
|||
<includes> |
|||
<include>static/**</include> |
|||
<include>mybatis/**</include> |
|||
<include>service/**</include> |
|||
<include>cert/**</include> |
|||
<include>**/*.xml</include> |
|||
<include>**/*.yml</include> |
|||
<include>**/*.properties</include> |
|||
</includes> |
|||
<!-- 是否替换资源中的属性 --> |
|||
<filtering>true</filtering> |
|||
</resource> |
|||
</resources> |
|||
</build> |
|||
</profile> |
|||
</profiles> |
|||
|
|||
<build> |
|||
<finalName>${project.artifactId}</finalName> |
|||
<plugins> |
|||
<!-- 设置编译版本 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<configuration> |
|||
<source>1.8</source> |
|||
<target>1.8</target> |
|||
<encoding>UTF-8</encoding> |
|||
</configuration> |
|||
</plugin> |
|||
|
|||
<!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-jar-plugin</artifactId> |
|||
<configuration> |
|||
<archive> |
|||
<!-- 清单文件 --> |
|||
<manifest> |
|||
<mainClass>com.shop.cereshop.admin.CereshopAdminApplication</mainClass> |
|||
<!-- 打包时 MANIFEST.MF文件不记录的时间戳版本 父工程开发版本需要加,不然依赖的父工程jar引用不了--> |
|||
<useUniqueVersions>false</useUniqueVersions> |
|||
<addClasspath>true</addClasspath> |
|||
<classpathPrefix>lib/</classpathPrefix> |
|||
</manifest> |
|||
<!-- 给清单文件添加键值对(配置文件外置) --> |
|||
<manifestEntries> |
|||
<Class-Path>config/</Class-Path> |
|||
</manifestEntries> |
|||
</archive> |
|||
<classesDirectory> |
|||
</classesDirectory> |
|||
</configuration> |
|||
</plugin> |
|||
<!-- 拷贝依赖的jar包到lib目录 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-dependency-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<id>copy</id> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>copy-dependencies</goal> |
|||
</goals> |
|||
<configuration> |
|||
<outputDirectory> |
|||
${project.build.directory}/lib |
|||
</outputDirectory> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
|
|||
<!-- 解决资源文件的编码问题 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-resources-plugin</artifactId> |
|||
<configuration> |
|||
<encoding>UTF-8</encoding> |
|||
<!-- 过滤后缀文件 --> |
|||
<nonFilteredFileExtensions> |
|||
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension> |
|||
<nonFilteredFileExtension>xls</nonFilteredFileExtension> |
|||
<nonFilteredFileExtension>p12</nonFilteredFileExtension> |
|||
</nonFilteredFileExtensions> |
|||
</configuration> |
|||
</plugin> |
|||
<!-- 打包source文件为zip文件 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-assembly-plugin</artifactId> |
|||
<configuration> |
|||
<descriptors> |
|||
<descriptor>src/main/assembly/assembly.xml</descriptor> |
|||
</descriptors> |
|||
</configuration> |
|||
<executions> |
|||
<execution> |
|||
<id>make-assembly</id> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>single</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</project> |
@ -0,0 +1,48 @@ |
|||
<assembly> |
|||
<id>package</id> |
|||
<formats> |
|||
<format>zip</format> |
|||
</formats> |
|||
<includeBaseDirectory>true</includeBaseDirectory> |
|||
<fileSets> |
|||
<fileSet> |
|||
<directory>src/main/resources</directory> |
|||
<includes> |
|||
<include>*.properties</include> |
|||
<include>*.yml</include> |
|||
<include>*.xml</include> |
|||
</includes> |
|||
<filtered>true</filtered> |
|||
<outputDirectory>config</outputDirectory> |
|||
</fileSet> |
|||
<fileSet> |
|||
<directory>src/main/resources</directory> |
|||
<includes> |
|||
<include>startup.sh</include> |
|||
<include>startup.bat</include> |
|||
</includes> |
|||
<outputDirectory></outputDirectory> |
|||
</fileSet> |
|||
<fileSet> |
|||
<directory>src/main/resources</directory> |
|||
<includes> |
|||
<include>startup.sh</include> |
|||
</includes> |
|||
<outputDirectory></outputDirectory> |
|||
</fileSet> |
|||
<fileSet> |
|||
<directory>${project.build.directory}</directory> |
|||
<includes> |
|||
<include>*.jar</include> |
|||
</includes> |
|||
<outputDirectory></outputDirectory> |
|||
</fileSet> |
|||
<fileSet> |
|||
<directory>${project.build.directory}/lib</directory> |
|||
<includes> |
|||
<include>*.jar</include> |
|||
</includes> |
|||
<outputDirectory>lib</outputDirectory> |
|||
</fileSet> |
|||
</fileSets> |
|||
</assembly> |
@ -0,0 +1,99 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin; |
|||
|
|||
import com.shop.cereshop.admin.service.distributor.CereShopDistributionLevelService; |
|||
import com.shop.cereshop.admin.service.label.CerePlatformLabelService; |
|||
import com.shop.cereshop.admin.service.redis.CereRedisKeyServcice; |
|||
import com.shop.cereshop.admin.service.shop.CerePlatformShopService; |
|||
import com.shop.cereshop.admin.timing.DistributionLevelInitializationRunnable; |
|||
import com.shop.cereshop.admin.timing.LabelInitializationRunnable; |
|||
import com.shop.cereshop.admin.timing.ShopInitializationRunnable; |
|||
import com.shop.cereshop.admin.timing.TimingTask; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.boot.builder.SpringApplicationBuilder; |
|||
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
|||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
|||
import org.springframework.context.annotation.ComponentScan; |
|||
import org.springframework.scheduling.annotation.EnableAsync; |
|||
import org.springframework.transaction.annotation.EnableTransactionManagement; |
|||
|
|||
import java.util.concurrent.ScheduledFuture; |
|||
|
|||
@SpringBootApplication |
|||
@EnableTransactionManagement |
|||
@EnableConfigurationProperties |
|||
@EnableAutoConfiguration(exclude = { |
|||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class |
|||
}) |
|||
@EnableAsync |
|||
@ComponentScan(value = "com.shop.cereshop.commons.utils") |
|||
@ComponentScan(value = "com.shop.cereshop.admin") |
|||
@ComponentScan(value = "com.shop.cereshop.commons.config") |
|||
public class CereshopAdminApplication extends SpringBootServletInitializer { |
|||
|
|||
@Autowired |
|||
private static CerePlatformLabelService cerePlatformLabelService; |
|||
@Autowired |
|||
private static CereShopDistributionLevelService cereShopDistributionLevelService; |
|||
@Autowired |
|||
private static CerePlatformShopService cerePlatformShopService; |
|||
@Autowired |
|||
private static CereRedisKeyServcice cereRedisKeyServcice; |
|||
|
|||
@Autowired |
|||
public void setCerePlatformShopService(CerePlatformShopService cerePlatformShopService) { |
|||
CereshopAdminApplication.cerePlatformShopService = cerePlatformShopService; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setCerePlatformLabelService(CerePlatformLabelService cerePlatformLabelService){ |
|||
CereshopAdminApplication.cerePlatformLabelService=cerePlatformLabelService; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setCereShopDistributionLevelService(CereShopDistributionLevelService cereShopDistributionLevelService){ |
|||
CereshopAdminApplication.cereShopDistributionLevelService=cereShopDistributionLevelService; |
|||
} |
|||
|
|||
@Autowired |
|||
public void setCereRedisKeyServcice(CereRedisKeyServcice cereRedisKeyServcice) { |
|||
CereshopAdminApplication.cereRedisKeyServcice = cereRedisKeyServcice; |
|||
} |
|||
|
|||
/** |
|||
* 需要把web项目打成war包部署到外部tomcat运行时需要改变启动方式 |
|||
*/ |
|||
@Override //重写configure方法,把springboot的入口给它 |
|||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
|||
return builder.sources(CereshopAdminApplication.class); |
|||
} |
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(CereshopAdminApplication.class, args); |
|||
//开启自动绑定标签定时任务 |
|||
TimingTask timingTask=new TimingTask(); |
|||
ScheduledFuture<?> labelFuture = timingTask.startExtensionInitialization("0 0 0 * * ?", |
|||
new LabelInitializationRunnable(cerePlatformLabelService)); |
|||
//开启分销员等级自动升级定时任务 |
|||
ScheduledFuture<?> LevelFutrue = timingTask.startAutomaticUpgradeInitialization("0 0 0 * * ?", |
|||
new DistributionLevelInitializationRunnable(cereShopDistributionLevelService)); |
|||
//开启商家合同有效期截止自动禁用定时任务 |
|||
ScheduledFuture<?> shopFutrue = timingTask.startStopShopInitialization("0 0 0 * * ?", |
|||
new ShopInitializationRunnable(cerePlatformShopService)); |
|||
try { |
|||
//初始化Redis延时任务 |
|||
cereRedisKeyServcice.initializationRedis(); |
|||
}catch (Exception e){ |
|||
e.printStackTrace(); |
|||
}finally { |
|||
System.out.println("------ admin-server启动成功 ------\n"); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,54 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.listener; |
|||
|
|||
import com.aliyun.oss.event.ProgressEvent; |
|||
import com.aliyun.oss.event.ProgressEventType; |
|||
import com.aliyun.oss.event.ProgressListener; |
|||
|
|||
public class GetObjectProgressListener implements ProgressListener { |
|||
|
|||
private long bytesRead = 0; |
|||
private long totalBytes = -1; |
|||
private boolean succeed = false; |
|||
@Override |
|||
public void progressChanged(ProgressEvent progressEvent) { |
|||
long bytes = progressEvent.getBytes(); |
|||
ProgressEventType eventType = progressEvent.getEventType(); |
|||
switch (eventType) { |
|||
case TRANSFER_STARTED_EVENT: |
|||
System.out.println("Start to download......"); |
|||
break; |
|||
case RESPONSE_CONTENT_LENGTH_EVENT: |
|||
this.totalBytes = bytes; |
|||
System.out.println(this.totalBytes + " bytes in total will be downloaded to a local file"); |
|||
break; |
|||
case RESPONSE_BYTE_TRANSFER_EVENT: |
|||
this.bytesRead += bytes; |
|||
if (this.totalBytes != -1) { |
|||
int percent = (int)(this.bytesRead * 100.0 / this.totalBytes); |
|||
System.out.println(bytes + " bytes have been read at this time, download progress: " + |
|||
percent + "%(" + this.bytesRead + "/" + this.totalBytes + ")"); |
|||
} else { |
|||
System.out.println(bytes + " bytes have been read at this time, download ratio: unknown" + |
|||
"(" + this.bytesRead + "/...)"); |
|||
} |
|||
break; |
|||
case TRANSFER_COMPLETED_EVENT: |
|||
this.succeed = true; |
|||
System.out.println("Succeed to download, " + this.bytesRead + " bytes have been transferred in total"); |
|||
break; |
|||
case TRANSFER_FAILED_EVENT: |
|||
System.out.println("Failed to download, " + this.bytesRead + " bytes have been transferred"); |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
} |
|||
public boolean isSucceed() { |
|||
return succeed; |
|||
} |
|||
} |
@ -0,0 +1,112 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.listener; |
|||
|
|||
import com.aliyun.oss.event.ProgressEvent; |
|||
import com.aliyun.oss.event.ProgressEventType; |
|||
import com.aliyun.oss.event.ProgressListener; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.text.NumberFormat; |
|||
|
|||
public class PutObjectProgressListener implements ProgressListener { |
|||
private long bytesWritten = 0; |
|||
private long totalBytes = -1; |
|||
private boolean succeed = false; |
|||
private long total; |
|||
|
|||
|
|||
public PutObjectProgressListener(HttpServletRequest request, long total){ |
|||
this.total=total; |
|||
} |
|||
|
|||
@Override |
|||
public void progressChanged(ProgressEvent progressEvent) { |
|||
long bytes = progressEvent.getBytes(); |
|||
ProgressEventType eventType = progressEvent.getEventType(); |
|||
switch (eventType) { |
|||
case TRANSFER_STARTED_EVENT: |
|||
System.out.println("Start to upload......"); |
|||
break; |
|||
case REQUEST_CONTENT_LENGTH_EVENT: |
|||
this.totalBytes = bytes; |
|||
System.out.println(this.totalBytes + " bytes in total will be uploaded to OSS"); |
|||
break; |
|||
case REQUEST_BYTE_TRANSFER_EVENT: |
|||
this.bytesWritten += bytes; |
|||
if (this.totalBytes != -1) { |
|||
int percent = (int) (this.bytesWritten * 100.0 / this.totalBytes); |
|||
System.out.println(bytes + " bytes have been written at this time, upload progress: " + percent + "%(" + this.bytesWritten + "/" + this.totalBytes + ")"); |
|||
} else { |
|||
update(bytesWritten,total); |
|||
System.out.println(bytes + " bytes have been written at this time, upload ratio: unknown" + "(" + this.bytesWritten + "/...)"); |
|||
} |
|||
break; |
|||
case TRANSFER_COMPLETED_EVENT: |
|||
this.succeed = true; |
|||
System.out.println("Succeed to upload, " + this.bytesWritten + " bytes have been transferred in total"); |
|||
break; |
|||
case TRANSFER_FAILED_EVENT: |
|||
System.out.println("Failed to upload, " + this.bytesWritten + " bytes have been transferred"); |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public boolean isSucceed() { |
|||
return succeed; |
|||
} |
|||
|
|||
public void update(long pBytesRead, long total) { |
|||
//将数据进行格式化 |
|||
//已读取数据由字节转换为M |
|||
double readM=pBytesRead/1024.0/1024.0; |
|||
//已读取数据由字节转换为M |
|||
double totalM=total/1024.0/1024.0; |
|||
//已读取百分百 |
|||
double percent=readM/totalM; |
|||
//格式化数据 |
|||
//已读取 |
|||
String readf=dataFormat(pBytesRead); |
|||
//总大小 |
|||
String totalf=dataFormat(total); |
|||
//进度百分百 |
|||
NumberFormat format=NumberFormat.getPercentInstance(); |
|||
String progress=format.format(percent); |
|||
|
|||
//将信息存入session |
|||
// session.setAttribute("progress", progress); |
|||
//将session存入redis |
|||
// stringRedisService.set("progress",progress); |
|||
|
|||
|
|||
|
|||
//打印消息到控制台 |
|||
System.out.println("pBytesRead===>"+pBytesRead); |
|||
System.out.println("total==>"+total); |
|||
// System.out.println("pItems===>"+pItems); |
|||
System.out.println("readf--->"+readf); |
|||
System.out.println("totalf--->"+totalf); |
|||
System.out.println("progress--->"+progress); |
|||
} |
|||
/** |
|||
* 格式化读取数据的显示 |
|||
* @param data 要格式化的数据 单位byte |
|||
* @return 格式化后的数据,如果小于1M显示单位为KB,如果大于1M显示单位为M |
|||
*/ |
|||
public String dataFormat(double data){ |
|||
String formdata=""; |
|||
if (data>=1024*1024) {//大于等于1M |
|||
formdata=Double.toString(data/1024/1024)+"M"; |
|||
}else if(data>=1024){//大于等于1KB |
|||
formdata=Double.toString(data/1024)+"KB"; |
|||
}else{//小于1KB |
|||
formdata=Double.toString(data)+"byte"; |
|||
} |
|||
return formdata.substring(0, formdata.indexOf(".")+2); |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.page; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 上传文件返回地址 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "Url", description = "上传文件返回地址") |
|||
@AllArgsConstructor |
|||
public class Url { |
|||
|
|||
/** |
|||
* 文件地址 |
|||
*/ |
|||
@ApiModelProperty(value = "文件地址") |
|||
private String url; |
|||
} |
@ -0,0 +1,23 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface DeleteFileService { |
|||
|
|||
/** |
|||
* 删除文件 |
|||
* @param url 文件路径 |
|||
*/ |
|||
public void deleteFiles(String url); |
|||
|
|||
/** |
|||
* 删除多个文件 |
|||
* @param urls 文件路径集合 |
|||
*/ |
|||
public void deleteFiles(List<String> urls); |
|||
} |
@ -0,0 +1,31 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service; |
|||
|
|||
import java.net.URL; |
|||
|
|||
public interface FileDownloadService { |
|||
|
|||
/** |
|||
* 下载到本地文件 |
|||
* @param filename 文件名地址 |
|||
* @param fileUrl 本地目录地址带文件名(存在相同文件名会覆盖,没有就创建) |
|||
*/ |
|||
public void downloadThis(String filename, String fileUrl) throws Exception; |
|||
|
|||
/** |
|||
* 流式下载 |
|||
* @param filename 文件名地址 |
|||
*/ |
|||
public void downloadByStream(String filename) throws Exception; |
|||
|
|||
/** |
|||
* 获取oss文件下载路径 |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
public URL getUrl(String key); |
|||
} |
@ -0,0 +1,14 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service; |
|||
|
|||
public interface FileEncodeService { |
|||
|
|||
/** |
|||
* 指定文件编码 |
|||
*/ |
|||
public void encodeFile(int maxKeys, String keyPrefix, String nextMarker) throws Exception; |
|||
} |
@ -0,0 +1,17 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service; |
|||
|
|||
import java.io.InputStream; |
|||
|
|||
public interface FileUploadService { |
|||
|
|||
String uploadFile(String var1,InputStream var7,long size) throws Exception; |
|||
|
|||
String uploadFile(String var1,byte[] var2) throws Exception; |
|||
|
|||
InputStream getInputStream(String url); |
|||
} |
@ -0,0 +1,67 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service; |
|||
|
|||
import com.aliyun.oss.model.OSSObjectSummary; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface GetFileListService { |
|||
|
|||
/** |
|||
* 列举存储空间下的文件(简单列举)默认100个文件 |
|||
*/ |
|||
public List<OSSObjectSummary> getDefaultFiles(); |
|||
|
|||
/** |
|||
* 列举指定个数文件(ListObjectsRequest列举) |
|||
* @param maxKeys 最大个数 |
|||
*/ |
|||
public List<OSSObjectSummary> getFilesByKeys(int maxKeys); |
|||
|
|||
/** |
|||
* 列举指定前缀文件(ListObjectsRequest列举) |
|||
* @param prefix 前缀名称 |
|||
*/ |
|||
public List<OSSObjectSummary> getFileByPrefix(String prefix); |
|||
|
|||
/** |
|||
* 列举指定marker之后的文件(ListObjectsRequest列举) |
|||
* @param marker 文件名称 |
|||
*/ |
|||
public List<OSSObjectSummary> getFilesNyMarker(String marker); |
|||
|
|||
/** |
|||
* 分页列举所有文件(ListObjectsRequest列举) |
|||
* @param maxKeys 每页列举的个数 |
|||
*/ |
|||
public List<OSSObjectSummary> getFilesPaging(int maxKeys); |
|||
|
|||
/** |
|||
* 分页列举指定前缀的文件(ListObjectsRequest列举) |
|||
* @param prefix 前缀名称 |
|||
* @param maxKeys 每页列举个数 |
|||
*/ |
|||
public List<OSSObjectSummary> getFilesPagingByPrefix(String prefix, int maxKeys); |
|||
|
|||
/** |
|||
* 列举指定存储空间下的所有文件(文件夹功能) |
|||
*/ |
|||
public List<OSSObjectSummary> getFolderFiles(); |
|||
|
|||
/** |
|||
* 列举指定目录下的所有文件(文件夹功能) |
|||
* @param folder 指定目录名称(例如fun目录下所有文件传"fun/") |
|||
*/ |
|||
public List<OSSObjectSummary> getFilesByFolder(String folder); |
|||
|
|||
/** |
|||
* 列举指定目录下的文件和子目录(文件夹功能) |
|||
* @param folder 指定目录名称(例如fun目录下所有文件传"fun/") |
|||
*/ |
|||
public List<OSSObjectSummary> getFilesChildFolderByFolder(String folder); |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service; |
|||
|
|||
import java.io.InputStream; |
|||
|
|||
public interface PictureHandlerService { |
|||
|
|||
/** |
|||
* 图片加水印图片 |
|||
* @param pressImg -- 水印文件 |
|||
* @param targetImg -- 目标文件 |
|||
* @param x 水平边距, 就是距离图片边缘的水平距离, 这个参数只有当水印位置是左上,左中,左下, 右上,右中,右下才有意义 |
|||
* @param y 垂直边距, 就是距离图片边缘的垂直距离, 这个参数只有当水印位置是左上,中上, 右上,左下,中下,右下才有意义 |
|||
*/ |
|||
public void pressImages(String pressImg, String targetImg, int x, int y); |
|||
|
|||
/** |
|||
* 打印文字水印图片 |
|||
* @param pressText --文字 |
|||
* @param targetImg -- 目标图片 |
|||
* @param fontName -- 字体名 |
|||
* @param fontStyle -- 字体样式 |
|||
* @param color -- 字体颜色 |
|||
* @param fontSize -- 字体大小 |
|||
* @param x -- 偏移量 |
|||
* @param y |
|||
*/ |
|||
public void pressText(String pressText, String targetImg, String fontName, int fontStyle, int color, int fontSize, int x, int y); |
|||
|
|||
/** |
|||
* 按照指定比例进行缩小和放大 |
|||
* @param fileUrl 目标文件地址 |
|||
* @param imgInputStream InputStream |
|||
* @param coefficient 缩放系数,coefficient大于1为放大,小于1且大于0为缩小 |
|||
* @return InputStream |
|||
*/ |
|||
public void zoomImg(String fileUrl, InputStream imgInputStream, float coefficient); |
|||
|
|||
/** |
|||
* 压缩图片文件大小,图片尺寸不变 |
|||
* @param fileUrl 目标文件地址 |
|||
* @param imgInputStream InputStream |
|||
* @param quality 图片质量 |
|||
* @return InputStream |
|||
*/ |
|||
public void compressImg(String fileUrl, InputStream imgInputStream, float quality); |
|||
} |
@ -0,0 +1,27 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface SafetyFileService { |
|||
|
|||
/** |
|||
* 设置防盗链 |
|||
* @param refererList Referer白名单集合(允许指定的域名访问OSS资源,参数支持通配符星号(*)和问号(?)) |
|||
*/ |
|||
public void setSafety(List<String> refererList); |
|||
|
|||
/** |
|||
* 获取防盗链信息 |
|||
*/ |
|||
public List<String> getSaftys(); |
|||
|
|||
/** |
|||
* 清空防盗链 |
|||
*/ |
|||
public void clearSafety(); |
|||
} |
@ -0,0 +1,84 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.io.File; |
|||
import java.io.InputStream; |
|||
|
|||
public interface UploadService { |
|||
|
|||
/** |
|||
*上传本地文件(文件上传) |
|||
* @param file 文件对象 |
|||
*/ |
|||
public void uploadFile(File file) throws Exception; |
|||
|
|||
/** |
|||
* 上传文件流(流式上传) |
|||
* @param file 文件对象 |
|||
*/ |
|||
public void uploadStream(File file) throws Exception; |
|||
|
|||
/** |
|||
* 上传文件流(流式上传) |
|||
* @param filename 文件名 |
|||
* @param inputStream 文件输入流 |
|||
*/ |
|||
public void uploadStream(String filename, InputStream inputStream) throws Exception; |
|||
|
|||
/** |
|||
* 上传网络流(流式上传) |
|||
* @param file 文件对象 |
|||
*/ |
|||
public void uploadInternetStream(File file) throws Exception; |
|||
|
|||
/** |
|||
* 上传Byte数组(流式上传) |
|||
* @param file 文件对象 |
|||
*/ |
|||
public void uploadByte(File file) throws Exception; |
|||
|
|||
/** |
|||
* 上传Byte数组(流式上传) |
|||
* @param filename 文件名 |
|||
* @param content 文件字节数组 |
|||
*/ |
|||
public String uploadByte(String filename, byte[] content) throws Exception; |
|||
|
|||
/** |
|||
* 上传Byte数组(流式上传带进度条) |
|||
* @param filename 文件名 |
|||
* @param content 文件字节数组 |
|||
* @param request 请求request |
|||
* @param total 文件总大小 |
|||
*/ |
|||
public void uploadByte(String filename, byte[] content, HttpServletRequest request, long total) throws Exception; |
|||
|
|||
/** |
|||
* 上传Byte数组(流式上传带进度条),返回文件url |
|||
* @param filename 文件名 |
|||
* @param content 文件字节数组 |
|||
* @param request 请求request |
|||
* @param total 文件总大小 |
|||
*/ |
|||
public String uploadByteReturnUrl(String filename, byte[] content, HttpServletRequest request, long total) throws Exception; |
|||
|
|||
/** |
|||
* 上传Byte数组(流式上传) |
|||
* @param file 文件对象 |
|||
*/ |
|||
public void uploadString(File file) throws Exception; |
|||
|
|||
/** |
|||
* 上传图片到OSS |
|||
* @param filename 文件名 |
|||
* @param input2 文件流 |
|||
* @return |
|||
*/ |
|||
public void UploadFile(String filename, InputStream input2); |
|||
|
|||
} |
@ -0,0 +1,74 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service.impl; |
|||
|
|||
import com.aliyun.oss.OSSClient; |
|||
import com.aliyun.oss.model.DeleteObjectsRequest; |
|||
import com.aliyun.oss.model.DeleteObjectsResult; |
|||
import com.aliyun.oss.model.OSSObjectSummary; |
|||
import com.shop.cereshop.admin.alioss.service.DeleteFileService; |
|||
import com.shop.cereshop.admin.alioss.service.GetFileListService; |
|||
import com.shop.cereshop.admin.config.ConstantProperties; |
|||
import com.shop.cereshop.commons.utils.EmptyUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class DeleteFileServiceImpl implements DeleteFileService { |
|||
|
|||
@Autowired |
|||
private GetFileListService getFileListService; |
|||
|
|||
private String endpoint= ConstantProperties.ALIOSS_END_POINT; |
|||
private String accessKeyId= ConstantProperties.ALIOSS_ACCESS_KEY_ID; |
|||
private String accessKeySecret= ConstantProperties.ALIOSS_ACCESS_KEY_SECRET; |
|||
private String bucketName= ConstantProperties.ALIOSS_BUCKET_NAME; |
|||
|
|||
@Override |
|||
public void deleteFiles(String url) { |
|||
List<String> keys = new ArrayList<String>(); |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
//获取文件名 |
|||
String prefix=url.substring(getIndex(url,"/",3)+1,url.length()); |
|||
ossClient.deleteObject(bucketName, prefix); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
public static int getIndex(String str, String c, int times) { |
|||
int index = 0; |
|||
String[] arr = str.split(c); |
|||
int length = arr.length > times ? times : arr.length; |
|||
for (int i = 0; i < length; i++) { |
|||
index += arr[i].length(); |
|||
} |
|||
return index + times - 1; |
|||
} |
|||
|
|||
@Override |
|||
public void deleteFiles(List<String> urls) { |
|||
List<String> keys = new ArrayList<String>(); |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
if(!EmptyUtils.isEmpty(urls)){ |
|||
for (String imageUrl:urls) { |
|||
String prefix=imageUrl.substring(getIndex(imageUrl,"/",3)+1,imageUrl.length()); |
|||
List<OSSObjectSummary> list = getFileListService.getFileByPrefix(prefix); |
|||
if(!EmptyUtils.isEmpty(list)){ |
|||
keys.add(list.get(0).getKey()); |
|||
} |
|||
} |
|||
DeleteObjectsResult deleteObjectsResult = ossClient.deleteObjects(new DeleteObjectsRequest(bucketName).withKeys(keys)); |
|||
List<String> deletedObjects = deleteObjectsResult.getDeletedObjects(); |
|||
} |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
} |
@ -0,0 +1,81 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service.impl; |
|||
|
|||
import com.aliyun.oss.OSSClient; |
|||
import com.aliyun.oss.model.GetObjectRequest; |
|||
import com.aliyun.oss.model.OSSObject; |
|||
import com.shop.cereshop.admin.alioss.listener.GetObjectProgressListener; |
|||
import com.shop.cereshop.admin.alioss.service.FileDownloadService; |
|||
import com.shop.cereshop.admin.config.ConstantProperties; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.io.BufferedReader; |
|||
import java.io.File; |
|||
import java.io.InputStreamReader; |
|||
import java.net.URL; |
|||
import java.util.Date; |
|||
|
|||
@Service |
|||
public class FileDownloadServiceImpl implements FileDownloadService { |
|||
|
|||
private String endpoint= ConstantProperties.ALIOSS_END_POINT; |
|||
private String accessKeyId= ConstantProperties.ALIOSS_ACCESS_KEY_ID; |
|||
private String accessKeySecret= ConstantProperties.ALIOSS_ACCESS_KEY_SECRET; |
|||
private String bucketName= ConstantProperties.ALIOSS_BUCKET_NAME; |
|||
|
|||
@Override |
|||
public void downloadThis(String filename, String fileUrl) throws Exception{ |
|||
//获取文件名称接到目录地址后面 |
|||
fileUrl=fileUrl+"/"+filename.substring(filename.lastIndexOf("-")+1); |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// 下载OSS文件到本地文件。如果指定的本地文件存在会覆盖,不存在则新建。 |
|||
// 带进度条的下载。 |
|||
ossClient.getObject(new GetObjectRequest(bucketName, filename). |
|||
<GetObjectRequest>withProgressListener(new GetObjectProgressListener()), |
|||
new File(fileUrl)); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
@Override |
|||
public void downloadByStream(String filename) throws Exception{ |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。 |
|||
OSSObject ossObject = ossClient.getObject(bucketName, filename); |
|||
// 读取文件内容。 |
|||
System.out.println("Object content:"); |
|||
BufferedReader reader = new BufferedReader(new InputStreamReader(ossObject.getObjectContent())); |
|||
// BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File("D:/picture/ceshi.jpg")), "utf-8")); |
|||
// String str=""; |
|||
while (true) { |
|||
String line = reader.readLine(); |
|||
if (line == null) break; |
|||
// str+=line; |
|||
System.out.println("\n" + line); |
|||
} |
|||
// writer.write(str); |
|||
// writer.flush(); |
|||
// 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。 |
|||
reader.close(); |
|||
// writer.close(); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
@Override |
|||
public URL getUrl(String key) { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
//设置过期时间为1小时 |
|||
Date expiration=new Date(new Date().getTime()+3600*10000); |
|||
//生成URL |
|||
URL url=ossClient.generatePresignedUrl(bucketName,key,expiration); |
|||
return url; |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service.impl; |
|||
|
|||
import com.aliyun.oss.OSSClient; |
|||
import com.aliyun.oss.model.ListObjectsRequest; |
|||
import com.aliyun.oss.model.OSSObjectSummary; |
|||
import com.aliyun.oss.model.ObjectListing; |
|||
import com.shop.cereshop.admin.alioss.service.FileEncodeService; |
|||
import com.shop.cereshop.admin.config.ConstantProperties; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.net.URLDecoder; |
|||
|
|||
@Service |
|||
public class FileEncodeServiceImpl implements FileEncodeService { |
|||
|
|||
private String endpoint= ConstantProperties.ALIOSS_END_POINT; |
|||
private String accessKeyId= ConstantProperties.ALIOSS_ACCESS_KEY_ID; |
|||
private String accessKeySecret= ConstantProperties.ALIOSS_ACCESS_KEY_SECRET; |
|||
private String bucketName= ConstantProperties.ALIOSS_BUCKET_NAME; |
|||
ObjectListing objectListing; |
|||
|
|||
@Override |
|||
public void encodeFile(int maxKeys, String keyPrefix, String nextMarker) throws Exception{ |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
do { |
|||
ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucketName); |
|||
listObjectsRequest.setPrefix(keyPrefix); |
|||
listObjectsRequest.setMaxKeys(maxKeys); |
|||
listObjectsRequest.setMarker(nextMarker); |
|||
|
|||
// 指定文件名称编码。 |
|||
listObjectsRequest.setEncodingType("url"); |
|||
|
|||
objectListing = ossClient.listObjects(listObjectsRequest); |
|||
|
|||
// 文件解码。 |
|||
for (OSSObjectSummary objectSummary: objectListing.getObjectSummaries()) { |
|||
System.out.println("Key:" + URLDecoder.decode(objectSummary.getKey(), "UTF-8")); |
|||
} |
|||
|
|||
// commonPrefixes解码。 |
|||
for (String commonPrefixes: objectListing.getCommonPrefixes()) { |
|||
System.out.println("CommonPrefixes:" + URLDecoder.decode(commonPrefixes, "UTF-8")); |
|||
} |
|||
|
|||
// nextMarker解码。 |
|||
if (objectListing.getNextMarker() != null) { |
|||
nextMarker = URLDecoder.decode(objectListing.getNextMarker(), "UTF-8"); |
|||
} |
|||
} while (objectListing.isTruncated()); |
|||
|
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
} |
@ -0,0 +1,98 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service.impl; |
|||
|
|||
import com.aliyun.oss.OSSClient; |
|||
import com.aliyun.oss.model.PutObjectRequest; |
|||
import com.shop.cereshop.admin.alioss.listener.PutObjectProgressListener; |
|||
import com.shop.cereshop.admin.alioss.service.FileUploadService; |
|||
import com.shop.cereshop.admin.config.ConstantProperties; |
|||
import com.shop.cereshop.commons.constant.StringEnum; |
|||
import com.shop.cereshop.commons.utils.ImageUtil; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.io.ByteArrayInputStream; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.net.HttpURLConnection; |
|||
import java.net.URL; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Date; |
|||
import java.util.Objects; |
|||
import java.util.UUID; |
|||
|
|||
@Service |
|||
public class FileUploadServiceImpl implements FileUploadService { |
|||
|
|||
private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
|||
|
|||
@Override |
|||
public String uploadFile(String filename, InputStream in,long size) throws Exception { |
|||
Objects.requireNonNull(filename); |
|||
filename = filename.replaceAll(" ", ""); |
|||
String fileName= ConstantProperties.ALIOSS_FILE_HOST; |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(ConstantProperties.ALIOSS_END_POINT, |
|||
ConstantProperties.ALIOSS_ACCESS_KEY_ID, ConstantProperties.ALIOSS_ACCESS_KEY_SECRET); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileName+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","") + "_" + filename); |
|||
InputStream inputStream=in; |
|||
if(size>5*1024*1024){ |
|||
//大于5M就压缩 |
|||
if(filename.contains("jpg")||filename.contains("png")){ |
|||
//如果是图片,压缩一下 |
|||
inputStream = ImageUtil.compressImg(in, 1.1f); |
|||
} |
|||
} |
|||
// 上传网络流。 |
|||
ossClient.putObject(new PutObjectRequest(ConstantProperties.ALIOSS_BUCKET_NAME, fileUrl, inputStream). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(null,0))); |
|||
|
|||
ossClient.shutdown(); |
|||
if (inputStream != null) { |
|||
inputStream.close(); |
|||
} |
|||
if (in != null) { |
|||
in.close(); |
|||
} |
|||
return StringEnum.HTTPS_PREFIX.getCode() + ConstantProperties.ALIOSS_BUCKET_NAME + "." + ConstantProperties.ALIOSS_END_POINT + "/" + fileUrl; |
|||
} |
|||
|
|||
@Override |
|||
public String uploadFile(String filename,byte[] bytes) throws Exception { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(ConstantProperties.ALIOSS_END_POINT, |
|||
ConstantProperties.ALIOSS_ACCESS_KEY_ID, ConstantProperties.ALIOSS_ACCESS_KEY_SECRET); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = ConstantProperties.ALIOSS_FILE_HOST+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","") + "_" + filename); |
|||
long l = System.currentTimeMillis(); |
|||
ossClient.putObject(new PutObjectRequest(ConstantProperties.ALIOSS_BUCKET_NAME, fileUrl,new ByteArrayInputStream(bytes)). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(null,0))); |
|||
|
|||
return StringEnum.HTTPS_PREFIX.getCode() + ConstantProperties.ALIOSS_BUCKET_NAME + "." + ConstantProperties.ALIOSS_END_POINT + "/" + fileUrl; |
|||
} |
|||
|
|||
@Override |
|||
public InputStream getInputStream(String url) { |
|||
try { |
|||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); |
|||
connection.setReadTimeout(5000); |
|||
connection.setConnectTimeout(5000); |
|||
connection.setRequestMethod("GET"); |
|||
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { |
|||
return connection.getInputStream(); |
|||
} |
|||
} catch (IOException e) { |
|||
System.out.println("获取网络图片出现异常,图片路径为:" + url); |
|||
e.printStackTrace(); |
|||
} |
|||
return null; |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,180 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service.impl; |
|||
|
|||
import com.aliyun.oss.OSSClient; |
|||
import com.aliyun.oss.model.ListObjectsRequest; |
|||
import com.aliyun.oss.model.OSSObjectSummary; |
|||
import com.aliyun.oss.model.ObjectListing; |
|||
import com.shop.cereshop.admin.alioss.service.GetFileListService; |
|||
import com.shop.cereshop.admin.config.ConstantProperties; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class GetFileListServiceImpl implements GetFileListService { |
|||
|
|||
private String endpoint= ConstantProperties.ALIOSS_END_POINT; |
|||
private String accessKeyId= ConstantProperties.ALIOSS_ACCESS_KEY_ID; |
|||
private String accessKeySecret= ConstantProperties.ALIOSS_ACCESS_KEY_SECRET; |
|||
private String bucketName= ConstantProperties.ALIOSS_BUCKET_NAME; |
|||
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
|||
|
|||
@Override |
|||
public List<OSSObjectSummary> getDefaultFiles() { |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
ObjectListing objectListing = ossClient.listObjects(bucketName); |
|||
List<OSSObjectSummary> sums = objectListing.getObjectSummaries(); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return sums; |
|||
} |
|||
|
|||
@Override |
|||
public List<OSSObjectSummary> getFilesByKeys(int maxKeys) { |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// 列举文件。 |
|||
ObjectListing objectListing = ossClient.listObjects(new ListObjectsRequest(bucketName).withMaxKeys(maxKeys)); |
|||
List<OSSObjectSummary> sums = objectListing.getObjectSummaries(); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return sums; |
|||
} |
|||
|
|||
@Override |
|||
public List<OSSObjectSummary> getFileByPrefix(String prefix) { |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// 列举包含指定前缀的文件。默认列举100个文件。 |
|||
ObjectListing objectListing = ossClient.listObjects(new ListObjectsRequest(bucketName).withPrefix(prefix)); |
|||
List<OSSObjectSummary> sums = objectListing.getObjectSummaries(); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return sums; |
|||
} |
|||
|
|||
@Override |
|||
public List<OSSObjectSummary> getFilesNyMarker(String marker) { |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// 列举指定marker之后的文件。默认列举100个文件。 |
|||
ObjectListing objectListing = ossClient.listObjects(new ListObjectsRequest(bucketName).withMarker(marker)); |
|||
List<OSSObjectSummary> sums = objectListing.getObjectSummaries(); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return sums; |
|||
} |
|||
|
|||
@Override |
|||
public List<OSSObjectSummary> getFilesPaging(int maxKeys) { |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String nextMarker = null; |
|||
ObjectListing objectListing; |
|||
List<OSSObjectSummary> sums=null; |
|||
do { |
|||
objectListing = ossClient.listObjects(new ListObjectsRequest(bucketName).withMarker(nextMarker).withMaxKeys(maxKeys)); |
|||
sums = objectListing.getObjectSummaries(); |
|||
nextMarker = objectListing.getNextMarker(); |
|||
|
|||
} while (objectListing.isTruncated()); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return sums; |
|||
} |
|||
|
|||
@Override |
|||
public List<OSSObjectSummary> getFilesPagingByPrefix(String prefix, int maxKeys) { |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String nextMarker = null; |
|||
ObjectListing objectListing; |
|||
List<OSSObjectSummary> sums=null; |
|||
do { |
|||
objectListing = ossClient.listObjects(new ListObjectsRequest(bucketName). |
|||
withPrefix(prefix).withMarker(nextMarker).withMaxKeys(maxKeys)); |
|||
|
|||
sums = objectListing.getObjectSummaries(); |
|||
nextMarker = objectListing.getNextMarker(); |
|||
} while (objectListing.isTruncated()); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return sums; |
|||
} |
|||
|
|||
@Override |
|||
public List<OSSObjectSummary> getFolderFiles() { |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// 构造ListObjectsRequest请求。 |
|||
ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucketName); |
|||
// 列出文件。 |
|||
ObjectListing listing = ossClient.listObjects(listObjectsRequest); |
|||
// 遍历所有文件。 |
|||
System.out.println("Objects:"); |
|||
// for (OSSObjectSummary objectSummary : listing.getObjectSummaries()) { |
|||
// System.out.println(objectSummary.getKey()); |
|||
// } |
|||
// 遍历所有commonPrefix。 |
|||
System.out.println("CommonPrefixes:"); |
|||
// for (String commonPrefix : listing.getCommonPrefixes()) { |
|||
// System.out.println(commonPrefix); |
|||
// } |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return listing.getObjectSummaries(); |
|||
} |
|||
|
|||
@Override |
|||
public List<OSSObjectSummary> getFilesByFolder(String folder) { |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// 构造ListObjectsRequest请求。 |
|||
ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucketName); |
|||
// 设置prefix参数来获取fun目录下的所有文件。 |
|||
// listObjectsRequest.setPrefix("fun/"); |
|||
listObjectsRequest.setPrefix(folder); |
|||
// 递归列出fun目录下的所有文件。 |
|||
ObjectListing listing = ossClient.listObjects(listObjectsRequest); |
|||
// 遍历所有文件。 |
|||
System.out.println("Objects:"); |
|||
// for (OSSObjectSummary objectSummary : listing.getObjectSummaries()) { |
|||
// System.out.println(objectSummary.getKey()); |
|||
// } |
|||
// 遍历所有commonPrefix。 |
|||
System.out.println("\nCommonPrefixes:"); |
|||
// for (String commonPrefix : listing.getCommonPrefixes()) { |
|||
// System.out.println(commonPrefix); |
|||
// } |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return listing.getObjectSummaries(); |
|||
} |
|||
|
|||
@Override |
|||
public List<OSSObjectSummary> getFilesChildFolderByFolder(String folder) { |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// 构造ListObjectsRequest请求。 |
|||
ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucketName); |
|||
// 设置正斜线(/)为文件夹的分隔符。 |
|||
listObjectsRequest.setDelimiter("/"); |
|||
// 列出fun目录下的所有文件和文件夹。 |
|||
// listObjectsRequest.setPrefix("fun/"); |
|||
listObjectsRequest.setPrefix(folder); |
|||
ObjectListing listing = ossClient.listObjects(listObjectsRequest); |
|||
// 遍历所有文件。 |
|||
System.out.println("Objects:"); |
|||
// objectSummaries的列表中给出的是fun目录下的文件。 |
|||
// for (OSSObjectSummary objectSummary : listing.getObjectSummaries()) { |
|||
// System.out.println(objectSummary.getKey()); |
|||
// } |
|||
// 遍历所有commonPrefix。 |
|||
System.out.println("\nCommonPrefixes:"); |
|||
// commonPrefixs列表中给出的是fun目录下的所有子文件夹。fun/movie/001.avi和fun/movie/007.avi两个文件没有被列出来,因为它们属于fun文件夹下的movie目录。 |
|||
// for (String commonPrefix : listing.getCommonPrefixes()) { |
|||
// System.out.println(commonPrefix); |
|||
// } |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return listing.getObjectSummaries(); |
|||
} |
|||
} |
@ -0,0 +1,67 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service.impl; |
|||
|
|||
import com.shop.cereshop.admin.alioss.service.PictureHandlerService; |
|||
import com.shop.cereshop.admin.alioss.service.UploadService; |
|||
import com.shop.cereshop.admin.config.ConstantProperties; |
|||
import com.shop.cereshop.commons.utils.ImageUtil; |
|||
import com.shop.cereshop.commons.utils.PressImageUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.io.File; |
|||
import java.io.FileInputStream; |
|||
import java.io.InputStream; |
|||
import java.text.SimpleDateFormat; |
|||
|
|||
@Service |
|||
public class PictureHandlerServiceImpl implements PictureHandlerService { |
|||
|
|||
private String endpoint= ConstantProperties.ALIOSS_END_POINT; |
|||
private String accessKeyId= ConstantProperties.ALIOSS_ACCESS_KEY_ID; |
|||
private String accessKeySecret= ConstantProperties.ALIOSS_ACCESS_KEY_SECRET; |
|||
private String bucketName= ConstantProperties.ALIOSS_BUCKET_NAME; |
|||
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
|||
|
|||
@Autowired |
|||
private UploadService uploadService; |
|||
|
|||
|
|||
@Override |
|||
public void pressImages(String pressImg, String targetImg, int x, int y) { |
|||
PressImageUtils.pressImage(pressImg,targetImg,x,y); |
|||
} |
|||
|
|||
@Override |
|||
public void pressText(String pressText, String targetImg, String fontName, int fontStyle, int color, int fontSize, int x, int y) { |
|||
PressImageUtils.pressText(pressText,targetImg,fontName,fontStyle,color,fontSize,x,y); |
|||
} |
|||
|
|||
public void zoomImg(String fileUrl,InputStream imgInputStream, float coefficient){ |
|||
try { |
|||
InputStream in=new FileInputStream(new File(fileUrl)); |
|||
InputStream inputStream = ImageUtil.zoomImg(in, 0.2f); |
|||
String filename=fileUrl.substring(fileUrl.lastIndexOf("/")+1); |
|||
//上传到OSS |
|||
uploadService.UploadFile(filename,inputStream); |
|||
}catch (Exception e){ |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
public void compressImg(String fileUrl,InputStream imgInputStream, float quality){ |
|||
try { |
|||
InputStream in=new FileInputStream(new File(fileUrl)); |
|||
InputStream inputStream = ImageUtil.compressImg(in, 0.2f); |
|||
String filename=fileUrl.substring(fileUrl.lastIndexOf("/")+1); |
|||
//上传到OSS |
|||
uploadService.UploadFile(filename,inputStream); |
|||
}catch (Exception e){ |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,57 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service.impl; |
|||
|
|||
import com.aliyun.oss.OSSClient; |
|||
import com.aliyun.oss.model.BucketReferer; |
|||
import com.shop.cereshop.admin.alioss.service.SafetyFileService; |
|||
import com.shop.cereshop.admin.config.ConstantProperties; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class SafetyFileServiceImpl implements SafetyFileService { |
|||
|
|||
private String endpoint= ConstantProperties.ALIOSS_END_POINT; |
|||
private String accessKeyId= ConstantProperties.ALIOSS_ACCESS_KEY_ID; |
|||
private String accessKeySecret= ConstantProperties.ALIOSS_ACCESS_KEY_SECRET; |
|||
private String bucketName= ConstantProperties.ALIOSS_BUCKET_NAME; |
|||
|
|||
@Override |
|||
public void setSafety(List<String> refererList) { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// 设置存储空间Referer列表。设为true表示Referer字段允许为空。 |
|||
BucketReferer br = new BucketReferer(true, refererList); |
|||
ossClient.setBucketReferer(bucketName, br); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
@Override |
|||
public List<String> getSaftys() { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// 获取存储空间Referer白名单列表。 |
|||
BucketReferer br = ossClient.getBucketReferer(bucketName); |
|||
List<String> refererList = br.getRefererList(); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return refererList; |
|||
} |
|||
|
|||
@Override |
|||
public void clearSafety() { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
// 防盗链不能直接清空,需要新建一个允许空Referer的规则来覆盖之前的规则。 |
|||
BucketReferer br = new BucketReferer(); |
|||
ossClient.setBucketReferer(bucketName, br); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
} |
@ -0,0 +1,252 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.alioss.service.impl; |
|||
|
|||
import com.aliyun.oss.OSSClient; |
|||
import com.aliyun.oss.model.*; |
|||
import com.shop.cereshop.admin.alioss.listener.PutObjectProgressListener; |
|||
import com.shop.cereshop.admin.alioss.service.FileDownloadService; |
|||
import com.shop.cereshop.admin.alioss.service.GetFileListService; |
|||
import com.shop.cereshop.admin.alioss.service.UploadService; |
|||
import com.shop.cereshop.admin.config.ConstantProperties; |
|||
import com.shop.cereshop.commons.utils.EmptyUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.io.ByteArrayInputStream; |
|||
import java.io.File; |
|||
import java.io.FileInputStream; |
|||
import java.io.InputStream; |
|||
import java.net.URL; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
@Service |
|||
public class UploadServiceImpl implements UploadService { |
|||
|
|||
@Autowired |
|||
private GetFileListService getFileListService; |
|||
|
|||
@Autowired |
|||
private FileDownloadService fileDownloadService; |
|||
|
|||
private String endpoint= ConstantProperties.ALIOSS_END_POINT; |
|||
private String accessKeyId= ConstantProperties.ALIOSS_ACCESS_KEY_ID; |
|||
private String accessKeySecret= ConstantProperties.ALIOSS_ACCESS_KEY_SECRET; |
|||
private String bucketName= ConstantProperties.ALIOSS_BUCKET_NAME; |
|||
private String fileHost= ConstantProperties.ALIOSS_FILE_HOST; |
|||
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
|||
|
|||
@Override |
|||
public void uploadFile(File file) throws Exception{ |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileHost+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","")+"-"+file.getName()); |
|||
ossClient.putObject(new PutObjectRequest(bucketName, fileUrl, file). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(null,0))); |
|||
//设置权限 这里是公开读 |
|||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
@Override |
|||
public void uploadStream(File file) throws Exception { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileHost+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","")+"-"+file.getName()); |
|||
// 上传文件流。 |
|||
InputStream inputStream = new FileInputStream(file); |
|||
ossClient.putObject(new PutObjectRequest(bucketName, fileUrl, inputStream). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(null,0))); |
|||
//设置权限 这里是公开读 |
|||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
@Override |
|||
public void uploadStream(String filename, InputStream inputStream) throws Exception { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileHost+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","")+"-"+filename); |
|||
// 上传文件流。 |
|||
ossClient.putObject(new PutObjectRequest(bucketName, fileUrl, inputStream). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(null,0))); |
|||
//设置权限 这里是公开读 |
|||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
@Override |
|||
public void uploadInternetStream(File file) throws Exception{ |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileHost+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","")+"-"+file.getName()); |
|||
// 上传网络流。 |
|||
InputStream inputStream = new URL("https://www.aliyun.com/").openStream(); |
|||
ossClient.putObject(new PutObjectRequest(bucketName, fileUrl, inputStream). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(null,0))); |
|||
//设置权限 这里是公开读 |
|||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
@Override |
|||
public void uploadByte(File file) throws Exception { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileHost+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","")+"-"+file.getName()); |
|||
// 上传Byte数组。 |
|||
byte[] content = "Hello OSS".getBytes(); |
|||
ossClient.putObject(new PutObjectRequest(bucketName, fileUrl,new ByteArrayInputStream(content)). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(null,0))); |
|||
//设置权限 这里是公开读 |
|||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
@Override |
|||
public String uploadByte(String filename,byte[] content) throws Exception { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileHost+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","")+"-"+filename); |
|||
long l = System.currentTimeMillis(); |
|||
ossClient.putObject(new PutObjectRequest(bucketName, fileUrl,new ByteArrayInputStream(content)). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(null,0))); |
|||
System.out.println(System.currentTimeMillis()-l); |
|||
//设置权限 这里是公开读 |
|||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); |
|||
//上传成功后,获取文件访问路径 |
|||
String prefix=fileUrl.substring(0,fileUrl.indexOf(".")); |
|||
List<OSSObjectSummary> list = getFileByPrefix(prefix); |
|||
ossClient.shutdown(); |
|||
if(!EmptyUtils.isEmpty(list)){ |
|||
URL url = getUrl(list.get(0).getKey()); |
|||
// 关闭OSSClient。 |
|||
if(url.getProtocol().equals("http")){ |
|||
return url.getProtocol()+"s://"+url.getHost()+url.getPath(); |
|||
}else { |
|||
return url.getProtocol()+"://"+url.getHost()+url.getPath(); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public List<OSSObjectSummary> getFileByPrefix(String prefix) { |
|||
OSSClient ossClient = new OSSClient(ConstantProperties.ALIOSS_END_POINT, |
|||
ConstantProperties.ALIOSS_ACCESS_KEY_ID, ConstantProperties.ALIOSS_ACCESS_KEY_SECRET); |
|||
// 列举包含指定前缀的文件。默认列举100个文件。 |
|||
ObjectListing objectListing = ossClient.listObjects(new ListObjectsRequest(ConstantProperties.ALIOSS_BUCKET_NAME).withPrefix(prefix)); |
|||
List<OSSObjectSummary> sums = objectListing.getObjectSummaries(); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return sums; |
|||
} |
|||
|
|||
public URL getUrl(String key) { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(ConstantProperties.ALIOSS_END_POINT, |
|||
ConstantProperties.ALIOSS_ACCESS_KEY_ID, ConstantProperties.ALIOSS_ACCESS_KEY_SECRET); |
|||
//设置过期时间为1小时 |
|||
Date expiration=new Date(new Date().getTime()+3600*10000); |
|||
//生成URL |
|||
URL url=ossClient.generatePresignedUrl(ConstantProperties.ALIOSS_BUCKET_NAME,key,expiration); |
|||
return url; |
|||
} |
|||
|
|||
public void uploadByte(String filename, byte[] content, HttpServletRequest request, long total) throws Exception { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileHost+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","")+"-"+filename); |
|||
long l = System.currentTimeMillis(); |
|||
ossClient.putObject(new PutObjectRequest(bucketName, fileUrl,new ByteArrayInputStream(content)). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(request,total))); |
|||
System.out.println(System.currentTimeMillis()-l); |
|||
//设置权限 这里是公开读 |
|||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
public String uploadByteReturnUrl(String filename, byte[] content, HttpServletRequest request, long total) throws Exception { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileHost+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","")+"-"+filename); |
|||
long l = System.currentTimeMillis(); |
|||
ossClient.putObject(new PutObjectRequest(bucketName, fileUrl,new ByteArrayInputStream(content)). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(request,total))); |
|||
System.out.println(System.currentTimeMillis()-l); |
|||
//设置权限 这里是公开读 |
|||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); |
|||
//上传成功后,获取文件访问路径 |
|||
String prefix=fileUrl.substring(0,fileUrl.indexOf(".")); |
|||
List<OSSObjectSummary> list = getFileListService.getFileByPrefix(prefix); |
|||
if(!EmptyUtils.isEmpty(list)){ |
|||
URL url = fileDownloadService.getUrl(list.get(0).getKey()); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
return url.getProtocol()+"://"+url.getHost()+url.getPath(); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public void uploadString(File file) throws Exception { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileHost+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","")+"-"+file.getName()); |
|||
// 上传字符串。 |
|||
String content = "Hello OSS"; |
|||
ossClient.putObject(new PutObjectRequest(bucketName, fileUrl,new ByteArrayInputStream(content.getBytes())). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(null,0))); |
|||
//设置权限 这里是公开读 |
|||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
@Override |
|||
public void UploadFile(String filename, InputStream input2) { |
|||
// 创建OSSClient实例。 |
|||
OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret); |
|||
String dateStr = format.format(new Date()); |
|||
//创建文件路径 |
|||
String fileUrl = fileHost+"/"+(dateStr + "/" + UUID.randomUUID().toString().replace("-","")+"-"+filename); |
|||
// 上传网络流。 |
|||
PutObjectResult result = ossClient.putObject(new PutObjectRequest(bucketName, fileUrl, input2). |
|||
<PutObjectRequest>withProgressListener(new PutObjectProgressListener(null,0))); |
|||
//设置权限 这里是公开读 |
|||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); |
|||
// 关闭OSSClient。 |
|||
ossClient.shutdown(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.annotation; |
|||
|
|||
import java.lang.annotation.ElementType; |
|||
import java.lang.annotation.Retention; |
|||
import java.lang.annotation.RetentionPolicy; |
|||
import java.lang.annotation.Target; |
|||
|
|||
@Target(ElementType.METHOD) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
public @interface NoRepeatSubmit { |
|||
long value() default 1000*10; |
|||
} |
@ -0,0 +1,20 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.annotation; |
|||
|
|||
import java.lang.annotation.ElementType; |
|||
import java.lang.annotation.Retention; |
|||
import java.lang.annotation.RetentionPolicy; |
|||
import java.lang.annotation.Target; |
|||
|
|||
/** |
|||
* 接口后置拦截注解 |
|||
*/ |
|||
@Target(ElementType.METHOD) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
public @interface NoRepeatWebLog { |
|||
long value() default 1000*10; |
|||
} |
@ -0,0 +1,68 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.aspect; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.redis.service.api.StringRedisService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
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.aspectj.lang.reflect.MethodSignature; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.util.Assert; |
|||
import org.springframework.web.context.request.RequestContextHolder; |
|||
import org.springframework.web.context.request.ServletRequestAttributes; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
@Aspect |
|||
@Component |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "RepeatSubmitAspect") |
|||
public class RepeatSubmitAspect { |
|||
|
|||
@Autowired |
|||
private StringRedisService stringRedisService; |
|||
|
|||
@Pointcut("@annotation(com.shop.cereshop.admin.annotation.NoRepeatSubmit)") |
|||
public void pointCut() { |
|||
} |
|||
|
|||
@Around("pointCut()") |
|||
public Object around(ProceedingJoinPoint pjp) throws Throwable { |
|||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
|||
HttpServletRequest request = attributes.getRequest(); |
|||
Assert.notNull(request, "request can not null"); |
|||
// 此处可以用token |
|||
String token = request.getHeader("Authorization-admin"); |
|||
String key = token + "-" + request.getServletPath(); |
|||
NoRepeatSubmit annotation = ((MethodSignature) pjp.getSignature()).getMethod().getAnnotation(NoRepeatSubmit.class); |
|||
long expire = annotation.value(); |
|||
//超时时间:10秒,最好设为常量 |
|||
String time=String.valueOf(System.currentTimeMillis() + expire); |
|||
//加锁 |
|||
boolean islock = stringRedisService.secKilllock(key, time); |
|||
if (islock) { |
|||
Object result; |
|||
try { |
|||
result = pjp.proceed(); |
|||
} finally { |
|||
//解锁 |
|||
stringRedisService.unlock(key,time); |
|||
} |
|||
return result; |
|||
}else { |
|||
return new Result(CoReturnFormat.REPEAT_REQUEST); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,86 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.aspect; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.shop.cereshop.admin.service.log.CerePlatformWebLogService; |
|||
import com.shop.cereshop.commons.constant.IntegerEnum; |
|||
import com.shop.cereshop.commons.domain.express.HttpResult; |
|||
import com.shop.cereshop.commons.domain.log.CerePlatformWebLog; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.AppletPayUtil; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import com.shop.cereshop.commons.utils.HttpUtils; |
|||
import com.shop.cereshop.commons.utils.TimeUtils; |
|||
import eu.bitwalker.useragentutils.Browser; |
|||
import eu.bitwalker.useragentutils.UserAgent; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.aspectj.lang.annotation.AfterReturning; |
|||
import org.aspectj.lang.annotation.Aspect; |
|||
import org.aspectj.lang.annotation.Before; |
|||
import org.aspectj.lang.annotation.Pointcut; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.context.request.RequestContextHolder; |
|||
import org.springframework.web.context.request.ServletRequestAttributes; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.applet.Applet; |
|||
|
|||
@Aspect |
|||
@Component |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
* 封装请求记录入库 |
|||
*/ |
|||
@Slf4j(topic = "SaveRequestAspect") |
|||
public class WebLogAspect { |
|||
|
|||
@Autowired |
|||
private CerePlatformWebLogService cerePlatformWebLogService; |
|||
|
|||
/** |
|||
* 定义接口请求开始时间 |
|||
*/ |
|||
private long startTime; |
|||
|
|||
@Pointcut("@annotation(com.shop.cereshop.admin.annotation.NoRepeatWebLog)") |
|||
public void webLog() { |
|||
} |
|||
|
|||
@Before("webLog()") |
|||
public void before() throws Throwable { |
|||
startTime=System.currentTimeMillis(); |
|||
} |
|||
|
|||
@AfterReturning(returning = "result",pointcut = "webLog()") |
|||
public Object after(Result result) throws Throwable { |
|||
//封装请求记录 |
|||
CerePlatformWebLog webLog=new CerePlatformWebLog(); |
|||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
|||
HttpServletRequest request = attributes.getRequest(); |
|||
//获取浏览器信息 |
|||
String ua = request.getHeader("User-Agent"); |
|||
//转成UserAgent对象 |
|||
UserAgent userAgent = UserAgent.parseUserAgentString(ua); |
|||
//获取浏览器信息 |
|||
Browser browser = userAgent.getBrowser(); |
|||
//浏览器名称 |
|||
String browserName = browser.getName(); |
|||
webLog.setCreateTime(TimeUtils.yyMMddHHmmss()); |
|||
webLog.setType(IntegerEnum.REQUEST_TYPE_ADMIN.getCode()); |
|||
webLog.setIp(AppletPayUtil.getClientIp(request)); |
|||
webLog.setUrl(request.getServletPath()); |
|||
webLog.setBrowserName(browserName); |
|||
webLog.setParams(result.getJson()); |
|||
webLog.setName(result.getName()); |
|||
webLog.setDescribe(result.getDescribe()); |
|||
webLog.setIpSource(AppletPayUtil.getIpLocation(webLog.getIp())); |
|||
webLog.setTime(Integer.parseInt(String.valueOf(System.currentTimeMillis()-startTime))); |
|||
cerePlatformWebLogService.insert(webLog); |
|||
return result; |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import org.springframework.beans.factory.InitializingBean; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
/** |
|||
* Created by lightClouds917 |
|||
* Date 2018/1/16 |
|||
* Description:配置文件配置项 |
|||
*/ |
|||
@Configuration |
|||
public class ConstantProperties implements InitializingBean { |
|||
|
|||
/** |
|||
* 阿里不同的服务器,地址不同 |
|||
*/ |
|||
@Value("${alioss.file.endpoint}") |
|||
private String alioss_file_endpoint; |
|||
|
|||
/** |
|||
* OSS控制台获取 |
|||
*/ |
|||
@Value("${alioss.file.keyid}") |
|||
private String alioss_file_keyid; |
|||
|
|||
/** |
|||
* OSS控制台获取 |
|||
*/ |
|||
@Value("${alioss.file.keysecret}") |
|||
private String alioss_file_keysecret; |
|||
|
|||
/** |
|||
* 文件上传路径 |
|||
*/ |
|||
@Value("${alioss.file.upload}") |
|||
private String alioss_file_fileHost; |
|||
|
|||
/** |
|||
* 这个自己创建bucket时的命名,控制台创建也行,代码创建也行 |
|||
*/ |
|||
@Value("${alioss.file.bucketname}") |
|||
private String alioss_file_bucketname; |
|||
|
|||
public static String ALIOSS_END_POINT; |
|||
public static String ALIOSS_ACCESS_KEY_ID; |
|||
public static String ALIOSS_ACCESS_KEY_SECRET; |
|||
public static String ALIOSS_BUCKET_NAME; |
|||
public static String ALIOSS_FILE_HOST; |
|||
|
|||
|
|||
|
|||
@Override |
|||
public void afterPropertiesSet() throws Exception { |
|||
ALIOSS_END_POINT = alioss_file_endpoint; |
|||
ALIOSS_ACCESS_KEY_ID = alioss_file_keyid; |
|||
ALIOSS_ACCESS_KEY_SECRET = alioss_file_keysecret; |
|||
ALIOSS_BUCKET_NAME = alioss_file_bucketname; |
|||
ALIOSS_FILE_HOST = alioss_file_fileHost; |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.web.servlet.config.annotation.CorsRegistry; |
|||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
|||
|
|||
/** |
|||
* AJAX请求跨域 |
|||
* @author Mr.W |
|||
* @time 2018-08-13 |
|||
*/ |
|||
@Configuration |
|||
public class CorsConfig extends WebMvcConfigurerAdapter { |
|||
|
|||
@Override |
|||
public void addCorsMappings(CorsRegistry registry) { |
|||
registry.addMapping("/**") |
|||
.allowedOrigins("*") |
|||
.allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE") |
|||
.maxAge(3600) |
|||
.allowCredentials(true); |
|||
} |
|||
} |
@ -0,0 +1,76 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import com.fasterxml.jackson.core.JsonGenerator; |
|||
import com.fasterxml.jackson.databind.JsonSerializer; |
|||
import com.fasterxml.jackson.databind.SerializerProvider; |
|||
|
|||
import java.io.IOException; |
|||
|
|||
/** |
|||
* 自定义null值序列化处理器 |
|||
*/ |
|||
public class CustomizeNullJsonSerializer { |
|||
|
|||
/** |
|||
* 处理数组集合类型的null值 |
|||
*/ |
|||
public static class NullArrayJsonSerializer extends JsonSerializer<Object> { |
|||
@Override |
|||
public void serialize(Object value, JsonGenerator jsonGenerator, |
|||
SerializerProvider serializerProvider) throws IOException { |
|||
jsonGenerator.writeStartArray(); |
|||
jsonGenerator.writeEndArray(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 处理字符串类型的null值 |
|||
*/ |
|||
public static class NullStringJsonSerializer extends JsonSerializer<Object> { |
|||
@Override |
|||
public void serialize(Object value, JsonGenerator jsonGenerator, |
|||
SerializerProvider serializerProvider) throws IOException { |
|||
jsonGenerator.writeString(""); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 处理数值类型的null值 |
|||
*/ |
|||
public static class NullNumberJsonSerializer extends JsonSerializer<Object> { |
|||
@Override |
|||
public void serialize(Object value, JsonGenerator jsonGenerator, |
|||
SerializerProvider serializerProvider) throws IOException { |
|||
jsonGenerator.writeNull(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 处理boolean类型的null值 |
|||
*/ |
|||
public static class NullBooleanJsonSerializer extends JsonSerializer<Object> { |
|||
@Override |
|||
public void serialize(Object value, JsonGenerator jsonGenerator, |
|||
SerializerProvider serializerProvider) throws IOException { |
|||
jsonGenerator.writeBoolean(false); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 处理实体对象类型的null值 |
|||
*/ |
|||
public static class NullObjectJsonSerializer extends JsonSerializer<Object> { |
|||
@Override |
|||
public void serialize(Object value, JsonGenerator jsonGenerator, |
|||
SerializerProvider serializerProvider) throws IOException { |
|||
jsonGenerator.writeStartObject(); |
|||
jsonGenerator.writeEndObject(); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.fasterxml.jackson.databind.SerializerProvider; |
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.context.annotation.Primary; |
|||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; |
|||
|
|||
/** |
|||
* @author Han Yahong<hyhvpn@126.com> |
|||
* @program 51-baojiadan-service |
|||
* @description 返回json空值去掉null和"" |
|||
* @create 2018-07-26 11:04 |
|||
*/ |
|||
@Configuration |
|||
public class JacksonConfig { |
|||
@Bean |
|||
@Primary |
|||
@ConditionalOnMissingBean(ObjectMapper.class) |
|||
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) { |
|||
ObjectMapper objectMapper = builder.createXmlMapper(false).build(); |
|||
/** 为objectMapper注册一个带有SerializerModifier的Factory */ |
|||
objectMapper.setSerializerFactory(objectMapper.getSerializerFactory() |
|||
.withSerializerModifier(new MyBeanSerializerModifier())); |
|||
SerializerProvider serializerProvider = objectMapper.getSerializerProvider(); |
|||
serializerProvider.setNullValueSerializer(new CustomizeNullJsonSerializer |
|||
.NullObjectJsonSerializer()); |
|||
|
|||
return objectMapper; |
|||
} |
|||
} |
@ -0,0 +1,83 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import com.fasterxml.jackson.databind.BeanDescription; |
|||
import com.fasterxml.jackson.databind.SerializationConfig; |
|||
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter; |
|||
import com.fasterxml.jackson.databind.ser.BeanSerializerModifier; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* <pre> |
|||
* 此modifier主要做的事情为: |
|||
* 1.当序列化类型为数组集合时,当值为null时,序列化成[] |
|||
* 2.String类型值序列化为"" |
|||
* |
|||
* </pre> |
|||
*/ |
|||
public class MyBeanSerializerModifier extends BeanSerializerModifier { |
|||
|
|||
@Override |
|||
public List<BeanPropertyWriter> changeProperties(SerializationConfig config, |
|||
BeanDescription beanDesc, |
|||
List<BeanPropertyWriter> beanProperties) { |
|||
// 循环所有的beanPropertyWriter |
|||
for (int i = 0; i < beanProperties.size(); i++) { |
|||
BeanPropertyWriter writer = beanProperties.get(i); |
|||
// 判断字段的类型,如果是数组或集合则注册nullSerializer |
|||
if (isArrayType(writer)) { |
|||
// 给writer注册一个自己的nullSerializer |
|||
writer.assignNullSerializer(new CustomizeNullJsonSerializer.NullArrayJsonSerializer()); |
|||
} |
|||
if (isStringType(writer)) { |
|||
writer.assignNullSerializer(new CustomizeNullJsonSerializer.NullStringJsonSerializer()); |
|||
} |
|||
if (isNumberType(writer)) { |
|||
writer.assignNullSerializer(new CustomizeNullJsonSerializer.NullNumberJsonSerializer()); |
|||
} |
|||
} |
|||
return beanProperties; |
|||
} |
|||
|
|||
/** |
|||
* 是否是数组 |
|||
*/ |
|||
private boolean isArrayType(BeanPropertyWriter writer) { |
|||
Class<?> clazz = writer.getType().getRawClass(); |
|||
return clazz.isArray() || Collection.class.isAssignableFrom(clazz); |
|||
} |
|||
|
|||
/** |
|||
* 是否是String |
|||
*/ |
|||
private boolean isStringType(BeanPropertyWriter writer) { |
|||
Class<?> clazz = writer.getType().getRawClass(); |
|||
return CharSequence.class.isAssignableFrom(clazz) || Character.class.isAssignableFrom(clazz); |
|||
} |
|||
|
|||
/** |
|||
* 是否是数值类型 |
|||
*/ |
|||
private boolean isNumberType(BeanPropertyWriter writer) { |
|||
Class<?> clazz = writer.getType().getRawClass(); |
|||
boolean a=Number.class.isAssignableFrom(clazz); |
|||
boolean b= BigDecimal.class.isAssignableFrom(clazz); |
|||
return a||b; |
|||
} |
|||
|
|||
/** |
|||
* 是否是boolean |
|||
*/ |
|||
private boolean isBooleanType(BeanPropertyWriter writer) { |
|||
Class<?> clazz = writer.getType().getRawClass(); |
|||
return clazz.equals(Boolean.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import com.shop.cereshop.admin.interceptor.ExecutorInterceptor; |
|||
import org.apache.ibatis.session.SqlSessionFactory; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
import java.util.Properties; |
|||
|
|||
@Configuration |
|||
public class MybatisInterceptorConfig { |
|||
|
|||
@Bean |
|||
public String myInterceptor(SqlSessionFactory sqlSessionFactory) { |
|||
sqlSessionFactory.getConfiguration().addInterceptor(new ExecutorInterceptor()); |
|||
return "interceptor"; |
|||
} |
|||
} |
@ -0,0 +1,80 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import com.baomidou.mybatisplus.core.MybatisConfiguration; |
|||
import com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver; |
|||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; |
|||
import org.apache.ibatis.mapping.DatabaseIdProvider; |
|||
import org.apache.ibatis.plugin.Interceptor; |
|||
import org.mybatis.spring.boot.autoconfigure.MybatisProperties; |
|||
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.core.io.DefaultResourceLoader; |
|||
import org.springframework.core.io.ResourceLoader; |
|||
import org.springframework.util.ObjectUtils; |
|||
import org.springframework.util.StringUtils; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
/** |
|||
* mybatis-plus配置类 |
|||
*/ |
|||
@Configuration |
|||
public class MybatisPlusConfig { |
|||
|
|||
@Autowired |
|||
private DataSource dataSource; |
|||
|
|||
@Autowired |
|||
private MybatisProperties properties; |
|||
|
|||
@Autowired |
|||
private ResourceLoader resourceLoader = new DefaultResourceLoader(); |
|||
|
|||
@Autowired(required = false) |
|||
private Interceptor[] interceptors; |
|||
|
|||
@Autowired(required = false) |
|||
private DatabaseIdProvider databaseIdProvider; |
|||
|
|||
/** |
|||
* 这里全部使用mybatis-autoconfigure 已经自动加载的资源。不手动指定 |
|||
* 配置文件和mybatis-boot的配置文件同步 |
|||
* @return |
|||
*/ |
|||
@Bean |
|||
public MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean() { |
|||
MybatisSqlSessionFactoryBean mybatisPlus = new MybatisSqlSessionFactoryBean(); |
|||
mybatisPlus.setDataSource(dataSource); |
|||
mybatisPlus.setVfs(SpringBootVFS.class); |
|||
if (StringUtils.hasText(this.properties.getConfigLocation())) { |
|||
mybatisPlus.setConfigLocation(this.resourceLoader.getResource(this.properties.getConfigLocation())); |
|||
} |
|||
//mybatisPlus.setConfiguration(properties.getConfiguration()); |
|||
if (!ObjectUtils.isEmpty(this.interceptors)) { |
|||
mybatisPlus.setPlugins(this.interceptors); |
|||
} |
|||
MybatisConfiguration mc = new MybatisConfiguration(); |
|||
mc.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class); |
|||
mybatisPlus.setConfiguration(mc); |
|||
if (this.databaseIdProvider != null) { |
|||
mybatisPlus.setDatabaseIdProvider(this.databaseIdProvider); |
|||
} |
|||
if (StringUtils.hasLength(this.properties.getTypeAliasesPackage())) { |
|||
mybatisPlus.setTypeAliasesPackage(this.properties.getTypeAliasesPackage()); |
|||
} |
|||
if (StringUtils.hasLength(this.properties.getTypeHandlersPackage())) { |
|||
mybatisPlus.setTypeHandlersPackage(this.properties.getTypeHandlersPackage()); |
|||
} |
|||
if (!ObjectUtils.isEmpty(this.properties.resolveMapperLocations())) { |
|||
mybatisPlus.setMapperLocations(this.properties.resolveMapperLocations()); |
|||
} |
|||
return mybatisPlus; |
|||
} |
|||
} |
@ -0,0 +1,57 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.redisson.Redisson; |
|||
import org.redisson.api.RedissonClient; |
|||
import org.redisson.config.Config; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
import java.io.IOException; |
|||
|
|||
/** |
|||
* @author ZhaoBW |
|||
* @version 1.0 |
|||
* @date 2021/1/25 14:24 |
|||
*/ |
|||
@Configuration |
|||
public class RedissonConfig { |
|||
|
|||
@Value("${spring.redis.host}") |
|||
private String host; |
|||
|
|||
@Value("${spring.redis.port}") |
|||
private String port; |
|||
|
|||
@Value("${spring.redis.password}") |
|||
private String password; |
|||
|
|||
@Value("${spring.redis.database}") |
|||
private String database; |
|||
|
|||
/** |
|||
* 所有对redisson的使用都是通过redissonclient对象 |
|||
* @return |
|||
* @throws IOException |
|||
*/ |
|||
@Bean(destroyMethod = "shutdown") |
|||
public RedissonClient redisson() throws IOException { |
|||
//1、创建配置 |
|||
// Redis url should start with redis:// or rediss:// (for SSL connection) |
|||
Config config = new Config(); |
|||
config.useSingleServer().setAddress("redis://" + host + ":" + port); |
|||
if (StringUtils.isNotEmpty(password)) { |
|||
config.useSingleServer().setPassword(password); |
|||
} |
|||
config.useSingleServer().setDatabase(Integer.parseInt(database)); |
|||
//2、根据config创建出redissonClient实例 |
|||
RedissonClient redissonClient = Redisson.create(config); |
|||
return redissonClient; |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.context.annotation.Import; |
|||
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration; |
|||
import springfox.documentation.builders.ApiInfoBuilder; |
|||
import springfox.documentation.builders.PathSelectors; |
|||
import springfox.documentation.builders.RequestHandlerSelectors; |
|||
import springfox.documentation.service.ApiInfo; |
|||
import springfox.documentation.spi.DocumentationType; |
|||
import springfox.documentation.spring.web.plugins.Docket; |
|||
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
|||
|
|||
@Configuration |
|||
@EnableSwagger2 |
|||
@EnableKnife4j |
|||
@Import(BeanValidatorPluginsConfiguration.class) |
|||
public class SwaggerConfiguration { |
|||
|
|||
|
|||
@Bean(value = "defaultApi2") |
|||
public Docket defaultApi2() { |
|||
Docket docket=new Docket(DocumentationType.SWAGGER_2) |
|||
.apiInfo(apiInfo()) |
|||
//分组名称 |
|||
.groupName("2.X版本") |
|||
.select() |
|||
//这里指定Controller扫描包路径(项目路径也行) |
|||
.apis(RequestHandlerSelectors.basePackage("com.shop.cereshop.admin")) |
|||
.paths(PathSelectors.any()) |
|||
.build(); |
|||
return docket; |
|||
} |
|||
private ApiInfo apiInfo() { |
|||
return new ApiInfoBuilder() |
|||
.title("平台端api") |
|||
.description("平台端api") |
|||
.termsOfServiceUrl("http://localhost:9003/doc.html") |
|||
.contact("mail.com") |
|||
.version("1.0") |
|||
.build(); |
|||
} |
|||
} |
@ -0,0 +1,43 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import com.shop.cereshop.admin.interceptor.AuthorizationInterceptor; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
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; |
|||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
|||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
|||
|
|||
|
|||
@Configuration |
|||
//@ImportResource(value = "classpath:service/service.xml") |
|||
public class WebMvcConfig implements WebMvcConfigurer { |
|||
|
|||
@Autowired |
|||
private AuthorizationInterceptor authorizationInterceptor; |
|||
|
|||
@Override |
|||
public void addInterceptors(InterceptorRegistry registry) { |
|||
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/**"); |
|||
} |
|||
|
|||
@Bean |
|||
public CorsFilter corsFilter() { |
|||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
|||
CorsConfiguration config = new CorsConfiguration(); |
|||
config.setAllowCredentials(true); |
|||
config.addAllowedOrigin("*"); |
|||
config.addAllowedHeader("*"); |
|||
config.addAllowedMethod("*"); |
|||
source.registerCorsConfiguration("/**", config); |
|||
return new CorsFilter(source); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import lombok.Data; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component |
|||
@Data |
|||
@ConfigurationProperties(prefix = "weixin") |
|||
public class WxProperties { |
|||
|
|||
private String appId; |
|||
|
|||
private String secret; |
|||
|
|||
private String mchid; |
|||
|
|||
private String key; |
|||
|
|||
private String certurl; |
|||
|
|||
private String apiV3Key; |
|||
|
|||
private String privateKeyPath; |
|||
|
|||
private String privateCertPath; |
|||
|
|||
} |
@ -0,0 +1,106 @@ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import cn.binarywang.wx.miniapp.api.WxMaService; |
|||
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceHttpClientImpl; |
|||
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; |
|||
import com.github.binarywang.wxpay.config.WxPayConfig; |
|||
import com.github.binarywang.wxpay.service.MarketingMediaService; |
|||
import com.github.binarywang.wxpay.service.WxPayService; |
|||
import com.github.binarywang.wxpay.service.impl.MarketingMediaServiceImpl; |
|||
import com.github.binarywang.wxpay.service.impl.WxPayServiceApacheHttpImpl; |
|||
import com.shop.cereshop.commons.constant.WxCpConstants; |
|||
import com.shop.cereshop.commons.utils.third.WxCardUtil; |
|||
import com.shop.cereshop.commons.utils.third.WxLiveUtil; |
|||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl; |
|||
import me.chanjar.weixin.cp.config.WxCpConfigStorage; |
|||
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl; |
|||
import me.chanjar.weixin.cp.config.impl.WxCpTpDefaultConfigImpl; |
|||
import me.chanjar.weixin.cp.tp.service.WxCpTpService; |
|||
import me.chanjar.weixin.cp.tp.service.impl.WxCpTpServiceApacheHttpClientImpl; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
@Configuration |
|||
public class WxServiceConfig { |
|||
|
|||
@Autowired |
|||
private WxWorkProperties wxWorkProperties; |
|||
|
|||
@Autowired |
|||
private WxProperties wxProperties; |
|||
|
|||
@Autowired |
|||
private WxCpServiceImpl wxCpService; |
|||
|
|||
@Autowired |
|||
private WxCpDefaultConfigImpl config; |
|||
|
|||
@Bean |
|||
public WxMaService getWxMaService() { |
|||
WxMaServiceHttpClientImpl wxMaService = new WxMaServiceHttpClientImpl(); |
|||
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); |
|||
config.setAppid(wxProperties.getAppId()); |
|||
config.setSecret(wxProperties.getSecret()); |
|||
wxMaService.setWxMaConfig(config); |
|||
return wxMaService; |
|||
} |
|||
|
|||
@Bean |
|||
public WxLiveUtil getWxLiveUtil() { |
|||
return new WxLiveUtil(getWxMaService()); |
|||
} |
|||
|
|||
@Bean |
|||
public WxCardUtil getWxCardUtil() { |
|||
return new WxCardUtil(getWxPayService(), getMarketingMediaService()); |
|||
} |
|||
|
|||
@Bean |
|||
public WxCpTpService getWxCpTpService() { |
|||
WxCpTpServiceApacheHttpClientImpl wxCpTpService = new WxCpTpServiceApacheHttpClientImpl(); |
|||
WxCpTpDefaultConfigImpl config = new WxCpTpDefaultConfigImpl(); |
|||
config.setBaseApiUrl(WxCpConstants.QY_API); |
|||
BeanUtils.copyProperties(wxWorkProperties, config); |
|||
wxCpTpService.setWxCpTpConfigStorage(config); |
|||
return wxCpTpService; |
|||
} |
|||
|
|||
@Bean |
|||
public WxCpServiceImpl wxCpService() { |
|||
wxCpService = new WxCpServiceImpl(); |
|||
wxCpService.setWxCpConfigStorage(wxCpConfigStorage()); |
|||
return wxCpService; |
|||
} |
|||
|
|||
@Bean |
|||
public WxPayService getWxPayService() { |
|||
WxPayService wxPayService = new WxPayServiceApacheHttpImpl(); |
|||
WxPayConfig payConfig = new WxPayConfig(); |
|||
BeanUtils.copyProperties(wxProperties, payConfig); |
|||
payConfig.setMchId(wxProperties.getMchid()); |
|||
payConfig.setMchKey(wxProperties.getKey()); |
|||
payConfig.setKeyPath(wxProperties.getCerturl()); |
|||
|
|||
// 可以指定是否使用沙箱环境 |
|||
payConfig.setUseSandboxEnv(false); |
|||
wxPayService.setConfig(payConfig); |
|||
return wxPayService; |
|||
} |
|||
|
|||
@Bean |
|||
public MarketingMediaService getMarketingMediaService() { |
|||
return new MarketingMediaServiceImpl(getWxPayService()); |
|||
} |
|||
|
|||
@Bean |
|||
public WxCpConfigStorage wxCpConfigStorage() { |
|||
if (config == null) { |
|||
config = new WxCpDefaultConfigImpl(); |
|||
config.setBaseApiUrl(WxCpConstants.QY_API); |
|||
BeanUtils.copyProperties(wxWorkProperties, config); |
|||
} |
|||
return config; |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.shop.cereshop.admin.config; |
|||
|
|||
import lombok.Data; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component |
|||
@Data |
|||
@ConfigurationProperties(prefix = "wxwork") |
|||
public class WxWorkProperties { |
|||
|
|||
private String suiteId; |
|||
|
|||
private String suiteSecret; |
|||
|
|||
private String token; |
|||
|
|||
private String aesKey; |
|||
|
|||
private String corpId; |
|||
|
|||
private String corpSecret; |
|||
} |
@ -0,0 +1,311 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.activity.*; |
|||
import com.shop.cereshop.admin.page.product.ShopProduct; |
|||
import com.shop.cereshop.admin.param.activity.*; |
|||
import com.shop.cereshop.admin.service.activity.CerePlatformActivityService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.shop.ShopDetail; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.poi.ExcelUtils; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 营销活动 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("activity") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "ActivityController") |
|||
@Api(value = "营销活动模块", tags = "营销活动模块") |
|||
public class ActivityController { |
|||
|
|||
@Autowired |
|||
private CerePlatformActivityService cerePlatformActivityService; |
|||
|
|||
/** |
|||
* 添加平台优惠券 |
|||
* @param param / |
|||
* @return / |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加平台优惠券") |
|||
@NoRepeatWebLog |
|||
public Result<CerePlatformUser> save(@RequestBody @Validated ActivitySaveParam param, |
|||
HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformActivityService.save(param,user); |
|||
return new Result<>(user.getUsername(),"添加平台优惠券", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改平台优惠券 |
|||
* @param param / |
|||
* @return / |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改平台优惠券") |
|||
@NoRepeatWebLog |
|||
public Result<CerePlatformUser> update(@RequestBody ActivityUpdateParam param, |
|||
HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformActivityService.update(param,user); |
|||
return new Result<>(user.getUsername(),"修改平台优惠券", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除平台优惠券 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除平台优惠券") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody ActivityDelteParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformActivityService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除平台优惠券", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 结束平台优惠券活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "end") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "结束平台优惠券活动") |
|||
@NoRepeatWebLog |
|||
public Result end(@RequestBody ActivityEndParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformActivityService.end(param,user); |
|||
return new Result(user.getUsername(),"结束平台优惠券活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 平台优惠券活动详情查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "平台优惠券活动详情查询") |
|||
public Result<ActivityDetail> getById(@RequestBody ActivityGetByIdParam param) throws CoBusinessException{ |
|||
ActivityDetail activity=cerePlatformActivityService.getById(param.getActivityId()); |
|||
return new Result(activity); |
|||
} |
|||
|
|||
/** |
|||
* 平台优惠券活动管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "平台优惠券活动管理查询") |
|||
public Result<Page<Activity>> getAll(@RequestBody ActivityGetAllParam param) throws CoBusinessException{ |
|||
Page page=cerePlatformActivityService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 参与店铺数据管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getShops") |
|||
@ApiOperation(value = "参与店铺数据管理查询") |
|||
public Result<Page<ShopActivity>> getShops(@RequestBody ActivityGetShopsParam param) throws CoBusinessException{ |
|||
Page page=cerePlatformActivityService.getShops(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 活动数据查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getActivitys") |
|||
@ApiOperation(value = "活动数据查询") |
|||
public Result<ActivityData> getActivitys(@RequestBody ActivityGetDatasParam param) throws CoBusinessException{ |
|||
ActivityData data=cerePlatformActivityService.getActivitys(param); |
|||
return new Result(data); |
|||
} |
|||
|
|||
/** |
|||
* 活动统计数据查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getActivityStats") |
|||
@ApiOperation(value = "活动统计数据查询") |
|||
public Result<ActivityStatsData> getActivitysStats(@RequestBody ActivityGetDatasParam param) throws CoBusinessException{ |
|||
ActivityStatsData data = cerePlatformActivityService.getActivityStatsData(param); |
|||
return new Result(data); |
|||
} |
|||
|
|||
/** |
|||
* 活动图表数据查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getActivityCharts") |
|||
@ApiOperation(value = "活动图表数据查询") |
|||
public Result<ActivityChartsData> getActivityCharts(@RequestBody ActivityGetDatasParam param) throws CoBusinessException{ |
|||
ActivityChartsData data = cerePlatformActivityService.getActivityChartsData(param); |
|||
return new Result(data); |
|||
} |
|||
|
|||
/** |
|||
* 活动商家参与数据查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getActivityShopDatas") |
|||
@ApiOperation(value = "活动商家参与数据查询") |
|||
public Result<Page<ShopDetail>> getActivityShopDatas(@RequestBody ActivityGetDatasParam param) throws CoBusinessException{ |
|||
Page<ShopDetail> data = cerePlatformActivityService.getActivityShopDatas(param); |
|||
return new Result(data); |
|||
} |
|||
|
|||
/** |
|||
* 活动数据查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
// @RequestMapping(value = "getActivitys",method = RequestMethod.POST) |
|||
// @ApiOperation(value = "活动数据查询") |
|||
// public Result<ActivityData> getActivitys(@RequestBody ActivityGetDatasParam param) throws CoBusinessException{ |
|||
// ActivityData data=cerePlatformActivityService.getTest(param); |
|||
// return new Result(data); |
|||
// } |
|||
|
|||
/** |
|||
* 商家数据明细导出导出 |
|||
* @param param |
|||
* @param response |
|||
*/ |
|||
@PostMapping(value = "excel_shop_detail") |
|||
@ApiOperation(value = "商家数据明细导出导出") |
|||
public void excelShop(@RequestBody ActivityGetDatasParam param, HttpServletResponse response) throws CoBusinessException,Exception{ |
|||
List<ShopDetail> list=cerePlatformActivityService.findExcel(param); |
|||
List<String> titles=new ArrayList<>(); |
|||
titles.add("店铺名称"); |
|||
titles.add("店铺编码"); |
|||
titles.add("参与商品数"); |
|||
titles.add("访客数"); |
|||
titles.add("订单数"); |
|||
titles.add("成交客户数"); |
|||
titles.add("客单价"); |
|||
titles.add("成交总额"); |
|||
XSSFWorkbook excel = ExcelUtils.createShopDetailExcel(titles, list); |
|||
Date date = new Date(); |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|||
String str = "订单管理表"+sdf.format(date); |
|||
response.setContentType("application/vnd.ms-excel;charset=utf-8"); |
|||
response.setHeader("Content-disposition", "attachment;filename=" + str +".xls");// 默认Excel名称 |
|||
response.flushBuffer(); |
|||
excel.write(response.getOutputStream()); |
|||
excel.close(); |
|||
} |
|||
|
|||
/** |
|||
* 查看商品 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getProducts") |
|||
@ApiOperation(value = "查看商品") |
|||
public Result<Page<ShopProduct>> getProducts(@RequestBody ActivityGetProductsParam param) throws CoBusinessException{ |
|||
Page page=cerePlatformActivityService.getProducts(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 审核记录查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getExamines") |
|||
@ApiOperation(value = "审核记录查询") |
|||
public Result<List<SignExamineLog>> getExamines(@RequestBody ActivityGetExaminesParam param) throws CoBusinessException{ |
|||
List<SignExamineLog> page=cerePlatformActivityService.getExamines(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 保证金交易记录查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAdminBonds") |
|||
@ApiOperation(value = "保证金交易记录查询") |
|||
public Result<BondCount> getAdminBonds(@RequestBody ActivityGetAdminBondsParam param) throws CoBusinessException{ |
|||
BondCount count=cerePlatformActivityService.getAdminBonds(param); |
|||
return new Result(count); |
|||
} |
|||
|
|||
/** |
|||
* 审核商家报名 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "examine") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "审核") |
|||
@NoRepeatWebLog |
|||
public Result examine(@RequestBody ActivityExamineParam param, |
|||
HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformActivityService.examine(param,user); |
|||
return new Result(user,"审核商家报名"); |
|||
} |
|||
|
|||
/** |
|||
* 清退 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "liquidation") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "清退") |
|||
@NoRepeatWebLog |
|||
public Result liquidation(@RequestBody ActivityLiquidationParam param, |
|||
HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformActivityService.liquidation(param,user); |
|||
return new Result(user.getUsername(),"清退", GsonUtil.objectToGson(param)); |
|||
} |
|||
} |
@ -0,0 +1,453 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.message.service.miaoxin.MiaoxinMessageService; |
|||
import com.shop.cereshop.admin.page.permission.MenuButton; |
|||
import com.shop.cereshop.admin.param.user.UserBuildParam; |
|||
import com.shop.cereshop.admin.param.user.UserForgetPasswordParam; |
|||
import com.shop.cereshop.admin.param.user.UserGetCodeParam; |
|||
import com.shop.cereshop.admin.param.user.UserLoginParam; |
|||
import com.shop.cereshop.admin.redis.service.UserRedisService; |
|||
import com.shop.cereshop.admin.redis.service.api.StringRedisService; |
|||
import com.shop.cereshop.admin.service.permission.CerePlatformPermissionService; |
|||
import com.shop.cereshop.admin.service.redis.CereRedisKeyServcice; |
|||
import com.shop.cereshop.admin.service.shop.CereShopCheckService; |
|||
import com.shop.cereshop.admin.service.user.CerePlatformUserService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.constant.IntegerEnum; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.EmptyUtils; |
|||
import com.shop.cereshop.commons.utils.EncryptUtil; |
|||
import com.shop.cereshop.commons.utils.RandomStringUtil; |
|||
import com.shop.cereshop.commons.utils.TimeUtils; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 用户登录 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("admin") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "AdminController") |
|||
@Api(value = "用户登录模块", tags = "用户登录模块") |
|||
public class AdminController { |
|||
|
|||
@Autowired |
|||
HttpServletRequest request; |
|||
|
|||
@Autowired |
|||
private CerePlatformUserService cerePlatformUserService; |
|||
|
|||
@Autowired |
|||
private CerePlatformPermissionService cerePlatformPermissionService; |
|||
|
|||
@Autowired |
|||
private StringRedisService stringRedisService; |
|||
|
|||
@Autowired |
|||
private MiaoxinMessageService miaoxinMessageService; |
|||
|
|||
@Autowired |
|||
private CereRedisKeyServcice cereRedisKeyServcice; |
|||
|
|||
@Autowired |
|||
private UserRedisService userRedisService; |
|||
|
|||
@Autowired |
|||
private CereShopCheckService cereShopCheckService; |
|||
|
|||
@Value("${globalAdminPhone}") |
|||
private String globalAdminPhone; |
|||
|
|||
/* 记录发送二次隐私认证的验证码的时间 */ |
|||
private static final String PRIVACY_CODE_SEND_TIME = "privacy_code_send_time_"; |
|||
|
|||
/* 超过次数 */ |
|||
private static final String PRIVACY_BEYOND_COUNT = "privacy_beyond_count_"; |
|||
|
|||
/* 隐私开关 */ |
|||
private static final String PRIVACY_SHOW_SWITCH = "privacy_show_switch_"; |
|||
|
|||
/* 记录发送修改管理员手机号的验证码的时间 */ |
|||
private static final String UPDATE_PHONE_CODE_SEND_TIME = "update_phone_code_send_time"; |
|||
|
|||
/* 修改管理员手机号-发送验证码-超过次数 */ |
|||
private static final String UPDATE_PHONE_BEYOND_COUNT = "update_phone_beyond_count"; |
|||
|
|||
/** |
|||
* 平台账户登录 |
|||
* |
|||
* @param param 封装json对象 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "login") |
|||
@ApiOperation(value = "平台账户登录") |
|||
public Result<CerePlatformUser> login(@RequestBody UserLoginParam param) throws CoBusinessException, Exception { |
|||
//登录账号和密码解密 |
|||
try { |
|||
param = param.decrypt(); |
|||
} catch (Exception e) { |
|||
return new Result(CoReturnFormat.PARAM_INVALID); |
|||
} |
|||
CerePlatformUser user = null; |
|||
if (!EmptyUtils.isEmpty(param.getCode())) { |
|||
if (!param.getCode().equals("9999")) { |
|||
//手机号登录,校验验证码 |
|||
String code = (String) stringRedisService.get(param.getUsername()); |
|||
if (!param.getCode().equals(code)) { |
|||
return new Result(CoReturnFormat.CODE_ERROR); |
|||
} |
|||
} |
|||
//根据手机号查询账户信息 |
|||
user = cerePlatformUserService.findByPhone(param.getUsername()); |
|||
log.info("user: {}", user); |
|||
} else { |
|||
//根据账号查询token |
|||
user = cerePlatformUserService.findByUserName(param.getUsername()); |
|||
if (user != null) { |
|||
//校验密码 |
|||
if (!param.getPassword().equals(EncryptUtil.decrypt(user.getPassword()))) { |
|||
return new Result(CoReturnFormat.USER_OR_PASSWD_ERROR); |
|||
} |
|||
} |
|||
} |
|||
if (user == null) { |
|||
return new Result(CoReturnFormat.USER_UNREGISTER); |
|||
} |
|||
if (IntegerEnum.NO.getCode().equals(user.getState())) { |
|||
return new Result(CoReturnFormat.USER_TYPE_STOP); |
|||
} |
|||
|
|||
String token; |
|||
if (ObjectUtil.isNotNull(param.getRememberMe()) && param.getRememberMe()) { |
|||
//记住我 不重新生成token |
|||
token = userRedisService.getToken(user.getPlatformUserId()); |
|||
if (ObjectUtil.isNull(token)) { |
|||
token = userRedisService.createToken4Remember(param.getUsername(), user.getPlatformUserId()); |
|||
} |
|||
user.setToken(token); |
|||
log.info("rememberMe token: {}", token); |
|||
} else { |
|||
//不记住我 重新生成token |
|||
token = userRedisService.createToken(param.getUsername(), user.getPlatformUserId()); |
|||
log.info("not rememberMe token: {}", token); |
|||
} |
|||
user.setToken(token); |
|||
request.setAttribute("user", user); |
|||
return new Result(user); |
|||
} |
|||
|
|||
// @GetMapping("bigReq") |
|||
// public Result bigReqList() { |
|||
// List<String> result = new ArrayList<>(2048); |
|||
// for (int i = 0; i < 204800; i++) { |
|||
// result.add(UUID.randomUUID().toString()); |
|||
// } |
|||
// return new Result(result,CoReturnFormat.SUCCESS); |
|||
// } |
|||
|
|||
/** |
|||
* 登录权限查询 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "build") |
|||
@ApiOperation(value = "登录权限查询") |
|||
public Result<List<MenuButton>> build(@RequestBody UserBuildParam user) throws CoBusinessException { |
|||
List<MenuButton> list = cerePlatformPermissionService.getAllByUserId(user); |
|||
return new Result(list); |
|||
} |
|||
|
|||
/** |
|||
* 忘记密码 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "forgetPassword") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "忘记密码") |
|||
public Result forgetPassword(@RequestBody UserForgetPasswordParam user) throws CoBusinessException { |
|||
try { |
|||
user = user.decrypt(); |
|||
} catch (Exception e) { |
|||
return new Result(CoReturnFormat.PARAM_INVALID); |
|||
} |
|||
//校验验证码 |
|||
if (!user.getCode().equals("9999")) { |
|||
//手机号登录,校验验证码 |
|||
String code = (String) stringRedisService.get(user.getUsername()); |
|||
if (!user.getCode().equals(code)) { |
|||
return new Result(CoReturnFormat.CODE_ERROR); |
|||
} |
|||
} |
|||
//校验2次密码是否一致 |
|||
if (!user.getPassword().equals(user.getNewPassword())) { |
|||
return new Result(CoReturnFormat.PASSWORD_NOT_AGREEN); |
|||
} |
|||
//校验手机号是否注册 |
|||
CerePlatformUser cerePlatformUser = cerePlatformUserService.findByPhone(user.getUsername()); |
|||
if (cerePlatformUser == null) { |
|||
return new Result(CoReturnFormat.USER_UNREGISTER); |
|||
} |
|||
cerePlatformUserService.forgetPassword(user, cerePlatformUser); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取短信验证码 |
|||
* |
|||
* @param user |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getCode") |
|||
@ApiOperation(value = "获取短信验证码") |
|||
public Result getCode(@RequestBody UserGetCodeParam user) throws CoBusinessException, Exception { |
|||
//获取验证码 |
|||
String code = RandomStringUtil.getRandom(); |
|||
Map<String, String> map = new HashMap<>(); |
|||
map.put("code", code); |
|||
//验证码存到redis中(5分钟失效) |
|||
stringRedisService.set(user.getPhone(), code, 300000); |
|||
//发送短信给用户 |
|||
try { |
|||
miaoxinMessageService.sendNotice(user.getPhone(), map); |
|||
} catch (Exception e) { |
|||
log.error("getCode fail: phone = {}", user.getPhone(), e); |
|||
throw new CoBusinessException(CoReturnFormat.SYS_ERROR); |
|||
} |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 获取管理员手机号 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAdminPhone") |
|||
@ApiOperation(value = "获取管理员手机号") |
|||
public Result<String> getAdminPhone(HttpServletRequest request) throws CoBusinessException, Exception { |
|||
Result<String> result = new Result<>(); |
|||
if (StringUtils.isNotBlank(globalAdminPhone)) { |
|||
result.setData(globalAdminPhone); |
|||
return result; |
|||
} |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
if (user == null) { |
|||
throw new CoBusinessException(CoReturnFormat.SYS_ERROR); |
|||
} |
|||
String phone = cerePlatformUserService.getAdminPhone(); |
|||
|
|||
if (phone == null) { |
|||
throw new CoBusinessException(CoReturnFormat.SYS_ERROR); |
|||
} |
|||
//String desensitizationPhone = com.shop.cereshop.commons.utils.StringUtils.showStartAndEnd(phone,3,4); |
|||
result.setData(phone); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 获取隐私短信验证码 |
|||
* |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getPrivacyCode") |
|||
@ApiOperation(value = "获取隐私短信验证码") |
|||
public Result<Boolean> getPrivacyCode(@RequestBody UserGetCodeParam param, HttpServletRequest request) throws CoBusinessException, Exception { |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
if (user == null) { |
|||
return new Result<>(false); |
|||
} |
|||
//获取验证码 |
|||
String code = RandomStringUtil.getRandom(); |
|||
Map<String, String> map = new HashMap<>(); |
|||
map.put("code", code); |
|||
//查询超时记录 |
|||
String beyondCountKey = PRIVACY_BEYOND_COUNT + user.getPlatformUserId(); |
|||
Integer beyondCount = (Integer)stringRedisService.get(beyondCountKey); |
|||
if (beyondCount != null && beyondCount == 1) { |
|||
throw new CoBusinessException(CoReturnFormat.SEND_CODE_ERR); |
|||
} |
|||
String sendTimeKey = PRIVACY_CODE_SEND_TIME + user.getPlatformUserId(); |
|||
//存储当前发送的时间 |
|||
String privacyCodeSendTime = (String)stringRedisService.get(sendTimeKey); |
|||
log.info("privacyCodeSendTime: {}", privacyCodeSendTime); |
|||
if (StringUtils.isNotBlank(privacyCodeSendTime)) { |
|||
String[] timeArr = privacyCodeSendTime.split(","); |
|||
if (timeArr.length >= 3) { |
|||
log.info("timeArr.length >= 3"); |
|||
long compareTime = Long.parseLong(timeArr[timeArr.length - 3]); |
|||
log.info("compareTime {}", compareTime); |
|||
if (System.currentTimeMillis() - compareTime <= 30 * 60 * 1000) { |
|||
//超过之后,需要设置1小时不可再发送 |
|||
stringRedisService.set(beyondCountKey, 1, 60 * 60 * 1000); |
|||
throw new CoBusinessException(CoReturnFormat.SEND_CODE_ERR); |
|||
} else { |
|||
StringBuilder builder = new StringBuilder(); |
|||
for (int i=timeArr.length-2;i<timeArr.length;i++) { |
|||
builder.append(timeArr[i]).append(","); |
|||
} |
|||
builder.append(System.currentTimeMillis()); |
|||
privacyCodeSendTime = builder.toString(); |
|||
} |
|||
} else { |
|||
privacyCodeSendTime = privacyCodeSendTime + "," + System.currentTimeMillis(); |
|||
} |
|||
} else { |
|||
privacyCodeSendTime = System.currentTimeMillis() + ""; |
|||
} |
|||
//发送短信给用户 |
|||
try { |
|||
//验证码存到redis中(5分钟失效) |
|||
stringRedisService.set(param.getPhone(), code, 300000); |
|||
miaoxinMessageService.sendNotice(param.getPhone(), map); |
|||
log.info("privacyCodeSendTime save: {}", privacyCodeSendTime); |
|||
stringRedisService.set(sendTimeKey, privacyCodeSendTime); |
|||
} catch (Exception e) { |
|||
log.error("getPrivacyCode fail: phone = {}", param.getPhone(), e); |
|||
throw new CoBusinessException(CoReturnFormat.SYS_ERROR); |
|||
} |
|||
return new Result<>(true); |
|||
} |
|||
|
|||
/** |
|||
* 获取更新管理员手机号的短信验证码 |
|||
* |
|||
* @param user |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getUpdatePhoneCode") |
|||
@ApiOperation(value = "获取更新管理员手机号的短信验证码") |
|||
public Result getUpdatePhoneCode(@RequestBody UserGetCodeParam user) throws CoBusinessException, Exception { |
|||
//获取验证码 |
|||
String code = RandomStringUtil.getRandom(); |
|||
Map<String, String> map = new HashMap<>(); |
|||
map.put("code", code); |
|||
//查询超时记录 |
|||
Integer beyondCount = (Integer)stringRedisService.get(UPDATE_PHONE_BEYOND_COUNT); |
|||
if (beyondCount != null && beyondCount == 1) { |
|||
throw new CoBusinessException(CoReturnFormat.SEND_CODE_ERR); |
|||
} |
|||
//存储当前发送的时间 |
|||
String updatePhoneCodeSendTime = (String)stringRedisService.get(UPDATE_PHONE_CODE_SEND_TIME); |
|||
if (StringUtils.isNotBlank(updatePhoneCodeSendTime)) { |
|||
String[] timeArr = updatePhoneCodeSendTime.split(","); |
|||
if (timeArr.length >= 3) { |
|||
long compareTime = Long.parseLong(timeArr[timeArr.length - 3]); |
|||
if (System.currentTimeMillis() - compareTime <= 30 * 60 * 1000) { |
|||
//超过之后,需要设置1小时不可再发送 |
|||
stringRedisService.set(UPDATE_PHONE_BEYOND_COUNT, 1, 60 * 60 * 1000); |
|||
throw new CoBusinessException(CoReturnFormat.SEND_CODE_ERR); |
|||
} else { |
|||
StringBuilder builder = new StringBuilder(); |
|||
for (int i=timeArr.length-2;i<timeArr.length;i++) { |
|||
builder.append(timeArr[i]).append(","); |
|||
} |
|||
builder.append(System.currentTimeMillis()); |
|||
updatePhoneCodeSendTime = builder.toString(); |
|||
} |
|||
} else { |
|||
updatePhoneCodeSendTime = updatePhoneCodeSendTime + "," + System.currentTimeMillis(); |
|||
} |
|||
} else { |
|||
updatePhoneCodeSendTime = System.currentTimeMillis() + ""; |
|||
} |
|||
//发送短信给用户 |
|||
try { |
|||
//验证码存到redis中(5分钟失效) |
|||
stringRedisService.set(user.getPhone(), code, 300000); |
|||
miaoxinMessageService.sendNotice(user.getPhone(), map); |
|||
stringRedisService.set(UPDATE_PHONE_CODE_SEND_TIME, updatePhoneCodeSendTime); |
|||
} catch (Exception e) { |
|||
log.error("getUpdatePhoneCode fail: phone = {}", user.getPhone(), e); |
|||
throw new CoBusinessException(CoReturnFormat.SYS_ERROR); |
|||
} |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 验证二次隐私开启 |
|||
* |
|||
* @param param 封装json对象 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "verifyPrivacyCode") |
|||
@ApiOperation(value = "验证二次隐私开启") |
|||
public Result<Boolean> verifyPrivacyCode(@RequestBody UserLoginParam param, HttpServletRequest request) throws CoBusinessException, Exception { |
|||
//登录账号和密码解密 |
|||
try { |
|||
param = param.decrypt(); |
|||
} catch (Exception e) { |
|||
return new Result<>(CoReturnFormat.PARAM_INVALID); |
|||
} |
|||
boolean result = true; |
|||
if (!EmptyUtils.isEmpty(param.getCode())) { |
|||
//手机号登录,校验验证码 |
|||
String code = (String) stringRedisService.get(param.getUsername()); |
|||
if (!param.getCode().equals(code)) { |
|||
return new Result<>(CoReturnFormat.CODE_ERROR); |
|||
} |
|||
CerePlatformUser user = (CerePlatformUser)request.getAttribute("user"); |
|||
if (user == null) { |
|||
return new Result<>(false); |
|||
} |
|||
stringRedisService.set(PRIVACY_SHOW_SWITCH + user.getPlatformUserId(), System.currentTimeMillis(), 24 * 60 * 60 * 1000L); |
|||
} else { |
|||
result = false; |
|||
} |
|||
return new Result<>(result); |
|||
} |
|||
|
|||
/** |
|||
* 一键初始化redis延时任务 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "initializationRedis") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "一键初始化redis延时任务") |
|||
public Result initializationRedis() throws Exception { |
|||
cereRedisKeyServcice.initializationRedis(); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 初始化店铺角色权限数据 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "initializationShopPermission") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "初始化店铺角色权限数据") |
|||
public Result initializationShopPermission() throws CoBusinessException { |
|||
cereShopCheckService.setInitPermission(2L, TimeUtils.yyMMddHHmmss()); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,95 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.param.advert.CerePopupAdvertParam; |
|||
import com.shop.cereshop.admin.service.advert.CerePopupAdvertService; |
|||
import com.shop.cereshop.commons.domain.advert.CerePopupAdvert; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
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.*; |
|||
|
|||
/** |
|||
* 广告 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("advert") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "AdvertController") |
|||
@Api(value = "广告模块", tags = "广告模块") |
|||
public class AdvertController { |
|||
|
|||
@Autowired |
|||
private CerePopupAdvertService cerePopupAdvertService; |
|||
|
|||
/** |
|||
* 弹窗广告列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "弹窗广告列表") |
|||
public Result<Page<CerePopupAdvert>> getAll(@RequestBody CerePopupAdvertParam param) throws CoBusinessException { |
|||
Page page=cerePopupAdvertService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 新增弹窗广告 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@ApiOperation(value = "新增弹窗广告") |
|||
public Result<Integer> save(@RequestBody CerePopupAdvert param) throws CoBusinessException { |
|||
int result = cerePopupAdvertService.save(param); |
|||
return new Result(result); |
|||
} |
|||
|
|||
/** |
|||
* 修改弹窗广告 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@ApiOperation(value = "修改弹窗广告") |
|||
public Result<Integer> update(@RequestBody CerePopupAdvert param) throws CoBusinessException { |
|||
int result=cerePopupAdvertService.update(param); |
|||
return new Result(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除弹窗广告 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@ApiOperation(value = "删除弹窗广告") |
|||
public Result<Integer> delete(@RequestBody CerePopupAdvert param) throws CoBusinessException { |
|||
int result=cerePopupAdvertService.delete(param.getId()); |
|||
return new Result(result); |
|||
} |
|||
|
|||
/** |
|||
* 上架或下架弹窗广告 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "toggle") |
|||
@ApiOperation(value = "上架或下架弹窗广告") |
|||
public Result<Integer> toggle(@RequestBody CerePopupAdvert param) throws CoBusinessException { |
|||
int result=cerePopupAdvertService.toggleState(param.getId(), param.getState()); |
|||
return new Result(result); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,143 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.after.*; |
|||
import com.shop.cereshop.admin.page.order.ShopOrderExportDTO; |
|||
import com.shop.cereshop.admin.param.after.*; |
|||
import com.shop.cereshop.admin.service.after.CereOrderAfterService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.enums.OrderStateEnum; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.poi.export.ExcelExportUtils; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 售后管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("after") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "AfterController") |
|||
@Api(value = "售后管理模块", tags = "售后管理模块") |
|||
public class AfterController { |
|||
|
|||
@Autowired |
|||
private CereOrderAfterService cereOrderAfterService; |
|||
|
|||
/** |
|||
* 售后管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "售后管理查询") |
|||
public Result<Page<After>> getAll(@RequestBody AfterGetAllParam param) throws CoBusinessException{ |
|||
Page page=cereOrderAfterService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 售后详情查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "售后详情查询") |
|||
public Result<AfterDetail> getById(@RequestBody AfterGetByIdParam param) throws CoBusinessException,Exception{ |
|||
AfterDetail detail=cereOrderAfterService.getById(param.getAfterId()); |
|||
return new Result(detail); |
|||
} |
|||
|
|||
/** |
|||
* 物流信息查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getDilevery") |
|||
@ApiOperation(value = "物流信息查询") |
|||
public Result<List<AfterDilevery>> getDilevery(@RequestBody AfterGetDileveryParam param) throws CoBusinessException,Exception{ |
|||
List<AfterDilevery> dileveries=cereOrderAfterService.getDilevery(param); |
|||
return new Result(dileveries); |
|||
} |
|||
|
|||
/** |
|||
* 买家信息查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getBuyer") |
|||
@ApiOperation(value = "买家信息查询") |
|||
public Result<AfterBuyer> getBuyer(@RequestBody AfterGetBuyerParam param) throws CoBusinessException{ |
|||
AfterBuyer buyer=cereOrderAfterService.getBuyer(param.getBuyerUserId()); |
|||
return new Result(buyer); |
|||
} |
|||
|
|||
/** |
|||
* 售后处理 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "handle") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "售后处理") |
|||
@NoRepeatWebLog |
|||
public Result handle(@RequestBody AfterhandleParam param, |
|||
HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereOrderAfterService.handle(param,user); |
|||
return new Result(user.getUsername(),"售后处理", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 售后管理导出 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "export") |
|||
@ApiOperation(value = "售后管理导出") |
|||
public void export(@RequestBody AfterGetAllParam param, HttpServletRequest request, HttpServletResponse response) throws CoBusinessException{ |
|||
Page<After> page=cereOrderAfterService.getAll(param); |
|||
List<AfterExportDTO> list = page.getList().stream().map(s -> { |
|||
AfterExportDTO afterExportDTO = new AfterExportDTO(); |
|||
afterExportDTO.setAfterType(s.getAfterType()); |
|||
afterExportDTO.setAfterFormid(s.getAfterFormid()); |
|||
afterExportDTO.setAfterProductNames(s.getAfterProductNames()); |
|||
afterExportDTO.setExpress(s.getExpress()); |
|||
afterExportDTO.setCustomerName(s.getCustomerName()); |
|||
afterExportDTO.setOrderId(s.getOrderId()); |
|||
afterExportDTO.setNumber(s.getNumber()); |
|||
afterExportDTO.setPaymentTime(s.getPaymentTime()); |
|||
afterExportDTO.setDeliverFormid(s.getDeliverFormid()); |
|||
afterExportDTO.setPlatformAfterTime(s.getPlatformAfterTime()); |
|||
afterExportDTO.setShopName(s.getShopName()); |
|||
afterExportDTO.setShopCode(s.getShopCode()); |
|||
afterExportDTO.setOrderState(OrderStateEnum.getMsgByCode(s.getOrderState())); |
|||
afterExportDTO.setRefundMoney(s.getRefundMoney()); |
|||
return afterExportDTO; |
|||
}).collect(Collectors.toList()); |
|||
//定义导出的excel名字 |
|||
String excelName = "售后订单列表"; |
|||
ExcelExportUtils.exportExcel(request,response,excelName,list, AfterExportDTO.class); |
|||
} |
|||
} |
@ -0,0 +1,104 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.brand.BrandGetAllParam; |
|||
import com.shop.cereshop.admin.param.brand.BrandParam; |
|||
import com.shop.cereshop.admin.service.brand.BrandService; |
|||
import com.shop.cereshop.commons.domain.brand.Brand; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
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.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 品牌管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("brand") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "BrandController") |
|||
@Api(value = "品牌管理模块", tags = "品牌管理模块") |
|||
public class BrandController { |
|||
|
|||
@Autowired |
|||
private BrandService brandService; |
|||
|
|||
/** |
|||
* 品牌管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "品牌管理查询") |
|||
public Result<Page<Brand>> getAll(@RequestBody BrandGetAllParam param) throws CoBusinessException{ |
|||
Page<Brand> page = brandService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 品牌详情查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "品牌详情查询") |
|||
public Result<Brand> getById(@RequestBody BrandParam param) throws CoBusinessException{ |
|||
Brand brand = brandService.getById(param.getId()); |
|||
return new Result(brand); |
|||
} |
|||
|
|||
/** |
|||
* 新增品牌 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "新增品牌") |
|||
@NoRepeatWebLog |
|||
public Result<Integer> save(@RequestBody BrandParam param) throws CoBusinessException{ |
|||
return new Result(brandService.save(param)); |
|||
} |
|||
|
|||
/** |
|||
* 更新品牌 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "更新品牌") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody BrandParam param) throws CoBusinessException{ |
|||
return new Result(brandService.update(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除品牌 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除品牌") |
|||
@NoRepeatWebLog |
|||
public Result<Integer> delete(@RequestBody BrandParam param) throws CoBusinessException{ |
|||
return new Result(brandService.delete(param.getId())); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,158 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.permission.Permission; |
|||
import com.shop.cereshop.admin.param.permission.*; |
|||
import com.shop.cereshop.admin.redis.service.api.StringRedisService; |
|||
import com.shop.cereshop.admin.service.permission.CereBusinessPermissionService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.permission.CerePlatformPermission; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 商家菜单权限 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("businessPermission") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "BusinessPermissionController") |
|||
@Api(value = "菜单权限模块", tags = "商家菜单权限模块") |
|||
public class BusinessPermissionController { |
|||
|
|||
@Autowired |
|||
private CereBusinessPermissionService cereBusinessPermissionService; |
|||
|
|||
@Autowired |
|||
private StringRedisService stringRedisService; |
|||
|
|||
/** |
|||
* 同步后台菜单时的key |
|||
*/ |
|||
private static final String SYNC_MENU_KEY = "sync_menu_ing"; |
|||
|
|||
/** |
|||
* 添加菜单权限 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加菜单权限") |
|||
@NoRepeatWebLog |
|||
public Result insert(@RequestBody @Validated PermissionSaveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereBusinessPermissionService.save(param,user); |
|||
return new Result(user.getUsername(),"添加菜单权限", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改菜单权限 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改菜单权限") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody PermissionUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereBusinessPermissionService.update(param,user); |
|||
return new Result(user.getUsername(),"修改菜单权限", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除菜单权限 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除菜单权限") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody PermissionDeleteParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereBusinessPermissionService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除菜单权限", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 菜单权限编辑查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "菜单权限编辑查询") |
|||
public Result<CerePlatformPermission> getById(@RequestBody PermissionGetByIdParam param) throws CoBusinessException{ |
|||
CerePlatformPermission cerePlatformPermission= cereBusinessPermissionService.getById(param.getPermissionId()); |
|||
return new Result(cerePlatformPermission); |
|||
} |
|||
|
|||
/** |
|||
* 查询当前最大排序值 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getMaxSort") |
|||
@ApiOperation(value = "查询当前最大排序值") |
|||
public Result<Integer> getMaxSort() throws CoBusinessException{ |
|||
Integer sort= cereBusinessPermissionService.getMaxSort(); |
|||
return new Result(sort); |
|||
} |
|||
|
|||
/** |
|||
* 菜单权限管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "菜单权限管理查询") |
|||
public Result<Page<Permission>> getAll(@RequestBody PermissionGetAllParam param) throws CoBusinessException{ |
|||
Page page = cereBusinessPermissionService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 菜单权限管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "syncMenu") |
|||
@ApiOperation(value = "同步菜单") |
|||
public Result<Boolean> syncMenu(@RequestBody SyncMenuParam param) throws CoBusinessException{ |
|||
if (param.isSyncAll()) { |
|||
String syncIng = (String)stringRedisService.get(SYNC_MENU_KEY); |
|||
if (StringUtils.isNotBlank(syncIng)) { |
|||
throw new CoBusinessException(CoReturnFormat.SYNC_MENU_ING); |
|||
} else { |
|||
stringRedisService.set(SYNC_MENU_KEY,"on", 300 * 1000); |
|||
} |
|||
} |
|||
cereBusinessPermissionService.syncMenu(param); |
|||
if (param.isSyncAll()) { |
|||
System.out.println("同步完成并删除redis key"); |
|||
stringRedisService.delete(SYNC_MENU_KEY); |
|||
} |
|||
return new Result(true); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,210 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.buyer.BuyerUser; |
|||
import com.shop.cereshop.admin.page.buyer.BuyerUserDetail; |
|||
import com.shop.cereshop.admin.page.buyer.BuyerUserExportDTO; |
|||
import com.shop.cereshop.admin.param.buyer.*; |
|||
import com.shop.cereshop.admin.param.credit.UpdateCreditParam; |
|||
import com.shop.cereshop.admin.param.user.UserSearchParam; |
|||
import com.shop.cereshop.admin.service.buyer.CereBuyerUserService; |
|||
import com.shop.cereshop.admin.service.channel.ChannelService; |
|||
import com.shop.cereshop.commons.constant.IntegerEnum; |
|||
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; |
|||
import com.shop.cereshop.commons.domain.channel.Channel; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.label.CerePlatformLabel; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.poi.export.ExcelExportUtils; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 客户管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("buyer") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "BuyerUserController") |
|||
@Api(value = "客户管理模块", tags = "客户管理模块") |
|||
public class BuyerUserController { |
|||
|
|||
@Autowired |
|||
private CereBuyerUserService cereBuyerUserService; |
|||
|
|||
@Autowired |
|||
private ChannelService channelService; |
|||
|
|||
/** |
|||
* 客户管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "客户管理查询") |
|||
public Result<Page<BuyerUser>> getAll(@RequestBody BuyerGetAllParam param) throws CoBusinessException{ |
|||
Page page=cereBuyerUserService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 客户详情查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "客户详情查询") |
|||
public Result<BuyerUserDetail> getById(@RequestBody BuyerGetByIdParam param) throws CoBusinessException{ |
|||
BuyerUserDetail detail=cereBuyerUserService.getById(param); |
|||
return new Result(detail); |
|||
} |
|||
|
|||
/** |
|||
* 客户绑定标签查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getUserLabels") |
|||
@ApiOperation(value = "客户绑定标签查询") |
|||
public Result<List<CerePlatformLabel>> getUserLabels(@RequestBody BuyerGetLabelsParam param) throws CoBusinessException{ |
|||
List<CerePlatformLabel> list=cereBuyerUserService.getUserLabels(param); |
|||
return new Result(list); |
|||
} |
|||
|
|||
/** |
|||
* 标签查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getLabels") |
|||
@ApiOperation(value = "标签查询") |
|||
public Result<List<CerePlatformLabel>> getLabels(@RequestBody BuyerGetLabelsParam param) throws CoBusinessException{ |
|||
List<CerePlatformLabel> list=cereBuyerUserService.getLabels(param); |
|||
return new Result(list); |
|||
} |
|||
|
|||
/** |
|||
* 贴标签 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "saveUserLabel") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "贴标签") |
|||
@NoRepeatWebLog |
|||
public Result saveUserLabel(@RequestBody BuyerSaveUserLabelParam param, |
|||
HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereBuyerUserService.saveUserLabel(param,user); |
|||
return new Result(user.getUsername(),"贴标签", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 加入或取消黑名单 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "blacklist") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "加入和取消黑名单") |
|||
@NoRepeatWebLog |
|||
public Result blacklist(@RequestBody BuyerBlackListParam param, |
|||
HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereBuyerUserService.blacklist(param,user); |
|||
return new Result(user.getUsername(),"加入或取消黑名单", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 更新积分 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "updateCredit") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "更新积分") |
|||
@NoRepeatWebLog |
|||
public Result updateCredit(@RequestBody UpdateCreditParam param, |
|||
HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereBuyerUserService.updateCredit(param,user); |
|||
return new Result(user.getUsername(),"更改积分", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 搜索用户信息 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "searchUser") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "搜索用户信息") |
|||
@NoRepeatWebLog |
|||
public Result<Page<CereBuyerUser>> searchUser(@RequestBody UserSearchParam param) { |
|||
Page<CereBuyerUser> page = cereBuyerUserService.searchUser(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
@PostMapping(value = "export") |
|||
@ApiOperation(value = "用户列表导出") |
|||
public void export(@RequestBody BuyerGetAllParam param, HttpServletRequest request, HttpServletResponse response) throws CoBusinessException { |
|||
param.setPage(null); |
|||
param.setPageSize(null); |
|||
Page<BuyerUser> page = cereBuyerUserService.getAll(param); |
|||
List<BuyerUserExportDTO> list = new ArrayList<>(); |
|||
List<String> channelCodeList = page.getList().stream().filter(obj -> StringUtils.isNotBlank(obj.getChannelCode())) |
|||
.map(BuyerUser::getChannelCode).distinct().collect(Collectors.toList()); |
|||
Map<String, String> channelNameMap = new HashMap<>(); |
|||
if (CollectionUtils.isNotEmpty(channelCodeList)) { |
|||
List<Channel> channelList = channelService.selectByChannelCodeList(channelCodeList); |
|||
channelNameMap = channelList.stream().collect(Collectors.toMap(Channel::getChannelCode, Channel::getChannelName)); |
|||
} |
|||
for (BuyerUser buyerUser:page.getList()) { |
|||
BuyerUserExportDTO dto = new BuyerUserExportDTO(); |
|||
BeanUtils.copyProperties(buyerUser, dto); |
|||
IntegerEnum terminalEnum = IntegerEnum.terminalMap.get(buyerUser.getTerminal()); |
|||
if (terminalEnum != null) { |
|||
dto.setTerminal(terminalEnum.getName()); |
|||
} |
|||
String channelCode = buyerUser.getChannelCode(); |
|||
if (channelCode != null) { |
|||
dto.setChannelName(channelNameMap.get(channelCode)); |
|||
} |
|||
list.add(dto); |
|||
} |
|||
//定义导出的excel名字 |
|||
String excelName = "用户列表"; |
|||
ExcelExportUtils.exportExcel(request, response, excelName, list, BuyerUserExportDTO.class); |
|||
} |
|||
} |
@ -0,0 +1,77 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.buyer.BuyerWithdrawal; |
|||
import com.shop.cereshop.admin.param.withdrawal.BuyerWithdrawalGetAllParam; |
|||
import com.shop.cereshop.admin.param.withdrawal.BuyerWithdrawalGetByIdParam; |
|||
import com.shop.cereshop.admin.service.buyer.CereBuyerWithdrawalService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.HttpServletRequest; |
|||
|
|||
/** |
|||
* 用户提现 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("buyer_withdrawal") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "BuyerWithdrawalController") |
|||
@Api(value = "用户提现", tags = "用户提现") |
|||
public class BuyerWithdrawalController { |
|||
|
|||
@Autowired |
|||
private CereBuyerWithdrawalService cereBuyerWithdrawalService; |
|||
|
|||
/** |
|||
* 用户提现申请管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "用户提现申请管理查询") |
|||
public Result<Page<BuyerWithdrawal>> getAll(@RequestBody BuyerWithdrawalGetAllParam param) throws CoBusinessException{ |
|||
Page page =cereBuyerWithdrawalService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 查看 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "查看") |
|||
public Result<BuyerWithdrawal> getById(@RequestBody BuyerWithdrawalGetByIdParam param) throws CoBusinessException{ |
|||
BuyerWithdrawal withdrawal =cereBuyerWithdrawalService.getById(param.getWithdrawalId()); |
|||
return new Result(withdrawal); |
|||
} |
|||
|
|||
/** |
|||
* 提现处理 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "handle") |
|||
@ApiOperation(value = "提现处理") |
|||
@NoRepeatWebLog |
|||
public Result handle(@RequestBody BuyerWithdrawalGetByIdParam param, |
|||
HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereBuyerWithdrawalService.handle(param,user); |
|||
return new Result(user.getUsername(),"提现处理", GsonUtil.objectToGson(param)); |
|||
} |
|||
} |
@ -0,0 +1,379 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.canvas.CanvasCoupon; |
|||
import com.shop.cereshop.admin.page.canvas.CanvasPlatformDiscount; |
|||
import com.shop.cereshop.admin.page.canvas.CanvasPlatformSeckill; |
|||
import com.shop.cereshop.admin.page.canvas.ToolProduct; |
|||
import com.shop.cereshop.admin.page.product.*; |
|||
import com.shop.cereshop.admin.param.canvas.CanvasCouponParam; |
|||
import com.shop.cereshop.admin.param.canvas.CanvasPageParam; |
|||
import com.shop.cereshop.admin.param.canvas.RenovationParam; |
|||
import com.shop.cereshop.admin.param.product.CanvasAdminProductParam; |
|||
import com.shop.cereshop.admin.param.product.ProductGetAllParam; |
|||
import com.shop.cereshop.admin.param.product.ProductGetByIdParam; |
|||
import com.shop.cereshop.admin.service.activity.CerePlatformActivityService; |
|||
import com.shop.cereshop.admin.service.canvas.CerePlatformCanvasCustomService; |
|||
import com.shop.cereshop.admin.service.canvas.CerePlatformCanvasService; |
|||
import com.shop.cereshop.admin.service.live.CereLiveService; |
|||
import com.shop.cereshop.admin.service.notice.CereNoticeService; |
|||
import com.shop.cereshop.admin.service.platformtool.CerePlatformDiscountService; |
|||
import com.shop.cereshop.admin.service.platformtool.CerePlatformSeckillService; |
|||
import com.shop.cereshop.admin.service.product.CereProductClassifyService; |
|||
import com.shop.cereshop.admin.service.product.CereProductMemberService; |
|||
import com.shop.cereshop.admin.service.product.CereShopProductService; |
|||
import com.shop.cereshop.commons.domain.canvas.CerePlatformCanvas; |
|||
import com.shop.cereshop.commons.domain.canvas.CerePlatformCanvasCustom; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.live.CereLive; |
|||
import com.shop.cereshop.commons.domain.notice.CereNotice; |
|||
import com.shop.cereshop.commons.domain.product.Classify; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.poi.export.ExcelExportUtils; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 画布模块 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("canvas") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "CanvasController") |
|||
@Api(value = "画布模块", tags = "画布模块") |
|||
public class CanvasController { |
|||
|
|||
@Autowired |
|||
private CereShopProductService cereShopProductService; |
|||
|
|||
@Autowired |
|||
private CereProductClassifyService cereProductClassifyService; |
|||
|
|||
@Autowired |
|||
private CerePlatformCanvasService cerePlatformCanvasService; |
|||
|
|||
@Autowired |
|||
private CerePlatformCanvasCustomService cerePlatformCanvasCustomService; |
|||
|
|||
@Autowired |
|||
private CerePlatformActivityService cerePlatformActivityService; |
|||
|
|||
@Autowired |
|||
private CereProductMemberService cereProductMemberService; |
|||
|
|||
@Autowired |
|||
private CereNoticeService cereNoticeService; |
|||
|
|||
@Autowired |
|||
private CerePlatformDiscountService cerePlatformDiscountService; |
|||
|
|||
@Autowired |
|||
private CerePlatformSeckillService cerePlatformSeckillService; |
|||
|
|||
@Autowired |
|||
private CereLiveService cereLiveService; |
|||
|
|||
/** |
|||
* 画布选择商品查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("getProducts") |
|||
@ApiOperation(value = "画布选择商品查询") |
|||
public Result<Page<CanvasProduct>> getProducts(CanvasAdminProductParam param) throws CoBusinessException,Exception{ |
|||
Page page=cereShopProductService.getProducts(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 查询会员商品数据 |
|||
* @return |
|||
*/ |
|||
@GetMapping("getMemberProducts") |
|||
@ApiOperation(value = "查询会员商品数据") |
|||
public Result<Page<MemberProduct>> getMemberProducts(CanvasAdminProductParam param) throws CoBusinessException{ |
|||
Page page=cereProductMemberService.getMemberProducts(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 获取公告数据 |
|||
* @return |
|||
*/ |
|||
@GetMapping("getNotices") |
|||
@ApiOperation(value = "获取公告数据") |
|||
public Result<List<CereNotice>> getNotices() throws CoBusinessException,Exception{ |
|||
List<CereNotice> list=cereNoticeService.getNotices(); |
|||
return new Result(list); |
|||
} |
|||
|
|||
/** |
|||
* 选择平台端限时折扣活动查询 |
|||
* @return |
|||
*/ |
|||
@GetMapping("getMinDiscount") |
|||
@ApiOperation(value = "选择平台端限时折扣活动查询") |
|||
public Result<List<CanvasPlatformDiscount>> getMinDiscount(RenovationParam param) throws CoBusinessException,Exception{ |
|||
List<CanvasPlatformDiscount> discounts=cerePlatformDiscountService.getMinDiscount(param); |
|||
return new Result(discounts); |
|||
} |
|||
|
|||
/** |
|||
* 选择平台端秒杀活动查询 |
|||
* @return |
|||
*/ |
|||
@GetMapping("getPlatformSeckills") |
|||
@ApiOperation(value = "选择平台端秒杀活动查询") |
|||
public Result<List<CanvasPlatformSeckill>> getPlatformSeckills(RenovationParam param) throws CoBusinessException,Exception{ |
|||
List<CanvasPlatformSeckill> list=cerePlatformSeckillService.getPlatformSeckills(param); |
|||
return new Result(list); |
|||
} |
|||
|
|||
/** |
|||
* 选择拼团活动查询 |
|||
* @return |
|||
*/ |
|||
@GetMapping("getGroupWorks") |
|||
@ApiOperation(value = "选择拼团活动查询") |
|||
public Result<List<ToolProduct>> getGroupWorks(RenovationParam param) throws CoBusinessException{ |
|||
List<ToolProduct> list=cerePlatformActivityService.getGroupWorkProducts(param); |
|||
return new Result(list); |
|||
} |
|||
|
|||
/** |
|||
* 画布选择店铺查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("getShops") |
|||
@ApiOperation(value = "画布选择店铺查询") |
|||
public Result<Page<CanvasShop>> getShops(CanvasAdminProductParam param) throws CoBusinessException{ |
|||
Page page=cereShopProductService.getShops(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 查询分类层级 |
|||
* @return |
|||
*/ |
|||
@GetMapping("getClassify") |
|||
@ApiOperation(value = "查询分类层级") |
|||
public Result<Classify> getClassify() throws CoBusinessException{ |
|||
List<Classify> list=cereProductClassifyService.getClassify(); |
|||
return new Result(list); |
|||
} |
|||
|
|||
/** |
|||
* 查询所有平台优惠券 |
|||
* @return |
|||
*/ |
|||
@GetMapping("getCoupons") |
|||
@ApiOperation(value = "查询分类层级") |
|||
public Result<Page<CanvasCoupon>> getCoupons(CanvasCouponParam param) throws CoBusinessException{ |
|||
Page page=cerePlatformActivityService.getCoupons(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 保存画布 |
|||
* @return |
|||
*/ |
|||
@PostMapping("saveCanvas") |
|||
@ApiOperation(value = "保存画布") |
|||
@NoRepeatWebLog |
|||
public Result saveCanvas(@RequestBody CerePlatformCanvas canvas,HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformCanvasService.saveCanvas(canvas,user); |
|||
return new Result(user.getUsername(),"保存画布", GsonUtil.objectToGson(canvas)); |
|||
} |
|||
|
|||
/** |
|||
* 读取画布数据 |
|||
* @return |
|||
*/ |
|||
@GetMapping("getCanvas") |
|||
@ApiOperation(value = "读取画布数据") |
|||
public Result getCanvas(CerePlatformCanvas canvas) throws CoBusinessException{ |
|||
canvas=cerePlatformCanvasService.getCanvas(canvas); |
|||
return new Result(canvas); |
|||
} |
|||
|
|||
/** |
|||
* 删除画布 |
|||
* @return |
|||
*/ |
|||
@PostMapping("delCanvas") |
|||
@ApiOperation(value = "删除画布") |
|||
@NoRepeatWebLog |
|||
public Result delCanvas(@RequestBody CerePlatformCanvas canvas,HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformCanvasService.delCanvas(canvas,user); |
|||
return new Result(user.getUsername(),"删除画布", GsonUtil.objectToGson(canvas)); |
|||
} |
|||
|
|||
/** |
|||
* 查询画布列表 |
|||
* @return |
|||
*/ |
|||
@PostMapping("selectCanvasList") |
|||
@ApiOperation(value = "查询画布列表") |
|||
public Result<Page<CerePlatformCanvas>> selectCanvasList(@RequestBody CanvasPageParam param) throws CoBusinessException{ |
|||
Page page = cerePlatformCanvasService.selectCanvasList(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 保存自定义页面 |
|||
* @return |
|||
*/ |
|||
@PostMapping("saveCanvasCustom") |
|||
@ApiOperation(value = "保存自定义页面") |
|||
@NoRepeatWebLog |
|||
public Result saveCanvasCustom(@RequestBody CerePlatformCanvasCustom canvasCustom, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformCanvasCustomService.saveCanvasCustom(canvasCustom,user); |
|||
return new Result(user.getUsername(),"保存自定义页面", GsonUtil.objectToGson(canvasCustom)); |
|||
} |
|||
|
|||
/** |
|||
* 删除自定义页面 |
|||
* @return |
|||
*/ |
|||
@PostMapping("delCanvasCustom") |
|||
@ApiOperation(value = "删除自定义页面") |
|||
@NoRepeatWebLog |
|||
public Result delCanvasCustom(@RequestBody CerePlatformCanvasCustom canvasCustom,HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformCanvasCustomService.delCanvasCustom(canvasCustom,user); |
|||
return new Result(user.getUsername(),"删除自定义页面", GsonUtil.objectToGson(canvasCustom)); |
|||
} |
|||
|
|||
/** |
|||
* 查询自定义页面列表 |
|||
* @return |
|||
*/ |
|||
@PostMapping("selectCanvasCustomList") |
|||
@ApiOperation(value = "查询自定义页面列表") |
|||
public Result<Page<CerePlatformCanvasCustom>> selectCanvasCustomList(@RequestBody CanvasPageParam param) throws CoBusinessException{ |
|||
Page page = cerePlatformCanvasCustomService.selectCanvasCustomList(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 商品管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "商品管理查询") |
|||
public Result<Page<ShopProduct>> getAll(@RequestBody ProductGetAllParam param) throws CoBusinessException{ |
|||
Page page=cereShopProductService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 商品管理导出 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "exportAll") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "商品管理导出") |
|||
public void exportAll(@RequestBody ProductGetAllParam param, HttpServletRequest request, HttpServletResponse response) throws CoBusinessException{ |
|||
List<ProductExportDTO> productExportList = cereShopProductService.getExportList(param); |
|||
//定义导出的excel名字 |
|||
String excelName = "商品列表"; |
|||
ExcelExportUtils.exportExcel(request, response, excelName, productExportList, ProductExportDTO.class); |
|||
} |
|||
|
|||
/** |
|||
* 商品详情查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "商品详情查询") |
|||
public Result<ProductDetail> getById(@RequestBody ProductGetByIdParam param) throws CoBusinessException{ |
|||
ProductDetail detail=cereShopProductService.getById(param.getProductId()); |
|||
return new Result(detail); |
|||
} |
|||
|
|||
/** |
|||
* 商品审核 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "examine") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "商品审核") |
|||
@NoRepeatWebLog |
|||
public Result examine(@RequestBody ProductExamineParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereShopProductService.examine(param,user); |
|||
return new Result(user.getUsername(),"商品审核", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 设置虚拟销量 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "setFictitious") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "设置虚拟销量") |
|||
@NoRepeatWebLog |
|||
public Result setFictitious(@RequestBody ProductUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereShopProductService.setFictitious(param,user); |
|||
return new Result(user.getUsername(),"设置虚拟销量", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 强制下架 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "forced") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "强制下架") |
|||
@NoRepeatWebLog |
|||
public Result forced(@RequestBody ProductUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereShopProductService.forced(param,user); |
|||
return new Result(user.getUsername(),"强制下架", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
@GetMapping("selectLiveList") |
|||
@ApiOperation("查询直播列表") |
|||
public Result<List<CereLive>> selectLiveList() { |
|||
List<CereLive> result = cereLiveService.selectLiveList(); |
|||
return new Result(result); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,104 @@ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.channel.ChannelGetAllParam; |
|||
import com.shop.cereshop.admin.param.channel.ChannelParam; |
|||
import com.shop.cereshop.admin.service.channel.ChannelService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.dict.CerePlatformDict; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 渠道模块 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("channel") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "ChannelController") |
|||
@Api(value = "渠道模块", tags = "渠道模块") |
|||
public class ChannelController { |
|||
|
|||
@Autowired |
|||
private ChannelService channelService; |
|||
|
|||
/** |
|||
* 添加渠道 |
|||
* |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加渠道") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated ChannelParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
channelService.save(param, user); |
|||
return new Result(user.getUsername(), "添加渠道", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改渠道 |
|||
* |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改渠道") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody ChannelParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
channelService.update(param, user); |
|||
return new Result(user.getUsername(), "修改渠道", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除渠道 |
|||
* |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除渠道") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody ChannelParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
channelService.delete(param, user); |
|||
return new Result(user.getUsername(), "删除渠道", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 渠道管理查询 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "渠道管理查询") |
|||
public Result<Page<CerePlatformDict>> getAll(@RequestBody ChannelGetAllParam param) throws CoBusinessException { |
|||
Page page = channelService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,117 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.product.ProductClassify; |
|||
import com.shop.cereshop.admin.param.product.ClassifyDeleteParam; |
|||
import com.shop.cereshop.admin.param.product.ClassifyGetAllParam; |
|||
import com.shop.cereshop.admin.param.product.ClassifyGetByIdParam; |
|||
import com.shop.cereshop.admin.param.product.ClassifyLevelParam; |
|||
import com.shop.cereshop.admin.service.product.CereProductClassifyService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.product.CereProductClassify; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 商品类别 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("classify") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "ClassifyController") |
|||
@Api(value = "商品类别模块", tags = "商品类别模块") |
|||
public class ClassifyController { |
|||
|
|||
@Autowired |
|||
private CereProductClassifyService cereProductClassifyService; |
|||
|
|||
/** |
|||
* 添加商品类别 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加商品类别") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated ClassifyLevelParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereProductClassifyService.save(param,user); |
|||
return new Result(user.getUsername(),"添加商品类别", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改商品类别 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改商品类别") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody ClassifyLevelParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereProductClassifyService.update(param,user); |
|||
return new Result(user.getUsername(),"修改商品类别", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除商品类别 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除商品类别") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody ClassifyDeleteParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereProductClassifyService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除商品类别", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 商品类别编辑查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "商品类别编辑查询") |
|||
public Result<ProductClassify> getById(@RequestBody ClassifyGetByIdParam param) throws CoBusinessException{ |
|||
ProductClassify classify=cereProductClassifyService.getById(param.getOneClassifyId()); |
|||
return new Result(classify); |
|||
} |
|||
|
|||
/** |
|||
* 商品类别管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "商品类别管理查询") |
|||
public Result<Page<CereProductClassify>> getAll(@RequestBody ClassifyGetAllParam param) throws CoBusinessException{ |
|||
Page page=cereProductClassifyService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
} |
@ -0,0 +1,116 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.shop.CommentDetail; |
|||
import com.shop.cereshop.admin.page.shop.ShopComment; |
|||
import com.shop.cereshop.admin.param.comment.CommentDeleteParam; |
|||
import com.shop.cereshop.admin.param.comment.CommentGetAllParam; |
|||
import com.shop.cereshop.admin.param.comment.CommentGetByIdParam; |
|||
import com.shop.cereshop.admin.param.comment.CommentUpdateParam; |
|||
import com.shop.cereshop.admin.service.shop.CereShopCommentService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.HttpServletRequest; |
|||
|
|||
/** |
|||
* 评论管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("comment") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "CommentController") |
|||
@Api(value = "评论管理模块", tags = "评论管理模块") |
|||
public class CommentController { |
|||
|
|||
@Autowired |
|||
private CereShopCommentService cereShopCommentService; |
|||
|
|||
/** |
|||
* 评论管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "评论管理查询") |
|||
public Result<Page<ShopComment>> getAll(@RequestBody CommentGetAllParam param) throws CoBusinessException{ |
|||
Page page=cereShopCommentService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 评论详情查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "评论详情查询") |
|||
public Result<CommentDetail> getById(@RequestBody CommentGetByIdParam param) throws CoBusinessException,Exception{ |
|||
CommentDetail detail=cereShopCommentService.getById(param.getCommentId()); |
|||
return new Result(detail); |
|||
} |
|||
|
|||
/** |
|||
* 修改评论 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改评论") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody CommentUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereShopCommentService.update(param,user); |
|||
return new Result(user.getUsername(),"修改评论", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 允许展示评论 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "allow") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "允许展示评论") |
|||
@NoRepeatWebLog |
|||
public Result allow(@RequestBody CommentUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereShopCommentService.allow(param,user); |
|||
return new Result(user.getUsername(),"允许展示评论", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除评论 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除评论") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody CommentDeleteParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereShopCommentService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除评论", GsonUtil.objectToGson(param)); |
|||
} |
|||
} |
@ -0,0 +1,51 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.page.credit.CereCreditRecordPage; |
|||
import com.shop.cereshop.admin.page.shop.ShopComment; |
|||
import com.shop.cereshop.admin.param.comment.CommentGetAllParam; |
|||
import com.shop.cereshop.admin.param.credit.CreditRecordGetAllParam; |
|||
import com.shop.cereshop.admin.service.credit.CereCreditRecordService; |
|||
import com.shop.cereshop.admin.service.shop.CereShopCommentService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.credit.CereCreditRecord; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
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.*; |
|||
|
|||
/** |
|||
* 积分记录 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("creditRecord") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "CreditRecordController") |
|||
@Api(value = "积分记录模块", tags = "积分记录模块") |
|||
public class CreditRecordController { |
|||
|
|||
@Autowired |
|||
private CereCreditRecordService cereCreditRecordService; |
|||
|
|||
/** |
|||
* 积分记录 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "积分记录") |
|||
public Result<Page<CereCreditRecordPage>> getAll(@RequestBody CreditRecordGetAllParam param) throws CoBusinessException { |
|||
Page page=cereCreditRecordService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,83 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.service.credit.CereCreditSignSettingService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.common.PageParam; |
|||
import com.shop.cereshop.commons.domain.credit.CereCreditSignSetting; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
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.*; |
|||
|
|||
/** |
|||
* 积分签到配置 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("creditSignSetting") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "CreditSignSettingController") |
|||
@Api(value = "积分签到配置", tags = "积分签到配置") |
|||
public class CreditSignSettingController { |
|||
|
|||
@Autowired |
|||
private CereCreditSignSettingService cereCreditSignSettingService; |
|||
|
|||
/** |
|||
* 积分签到配置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "积分签到配置") |
|||
public Result<Page<CereCreditSignSetting>> getAll(@RequestBody PageParam param) throws CoBusinessException { |
|||
Page page=cereCreditSignSettingService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 新增积分签到配置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@ApiOperation(value = "新增积分签到配置") |
|||
public Result<Integer> save(@RequestBody CereCreditSignSetting param) throws CoBusinessException { |
|||
int result = cereCreditSignSettingService.save(param); |
|||
return new Result(result); |
|||
} |
|||
|
|||
/** |
|||
* 修改积分签到配置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@ApiOperation(value = "修改积分签到配置") |
|||
public Result<Integer> update(@RequestBody CereCreditSignSetting param) throws CoBusinessException { |
|||
int result=cereCreditSignSettingService.update(param); |
|||
return new Result(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除积分签到配置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@ApiOperation(value = "删除积分签到配置") |
|||
public Result<Integer> delete(@RequestBody CereCreditSignSetting param) throws CoBusinessException { |
|||
int result=cereCreditSignSettingService.delete(param.getId()); |
|||
return new Result(result); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,187 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.dict.*; |
|||
import com.shop.cereshop.admin.service.dict.CerePlatformDictService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.constant.LongEnum; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.dict.CerePlatformDict; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.EmptyUtils; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.poi.ss.usermodel.Workbook; |
|||
import org.apache.poi.ss.usermodel.WorkbookFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 数据字典 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("dict") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "DictController") |
|||
@Api(value = "数据字典模块", tags = "数据字典模块") |
|||
public class DictController { |
|||
|
|||
@Autowired |
|||
private CerePlatformDictService cerePlatformDictService; |
|||
|
|||
/** |
|||
* 添加数据字典 |
|||
* |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加数据字典") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated DictSaveParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//校验字典名称 |
|||
CerePlatformDict cerePlatformDict = cerePlatformDictService.checkName(param.getDictName()); |
|||
if (cerePlatformDict != null) { |
|||
return new Result(CoReturnFormat.DICT_NAME_ALREADY); |
|||
} |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformDictService.save(param, user); |
|||
return new Result(user.getUsername(), "添加数据字典", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改数据字典 |
|||
* |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改数据字典") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody DictUpdateParam param, HttpServletRequest request) throws CoBusinessException { |
|||
if (param.getDictId() <= 1884L && LongEnum.ROOT.getCode().equals(param.getDictPid())) { |
|||
//如果是初始化数据字典且是根节点,不允许编辑 |
|||
return new Result(CoReturnFormat.DICT_NOT_OPERATION); |
|||
} |
|||
//校验字典名称 |
|||
CerePlatformDict cerePlatformDict = cerePlatformDictService.checkNameAndId(param); |
|||
if (cerePlatformDict != null) { |
|||
return new Result(CoReturnFormat.DICT_NAME_ALREADY); |
|||
} |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformDictService.update(param, user); |
|||
return new Result(user.getUsername(), "修改数据字典", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除数据字典 |
|||
* |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除数据字典") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody DictDeleteParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
//查询字典数据 |
|||
CerePlatformDict dict = cerePlatformDictService.getById(param.getDictId()); |
|||
if (dict != null) { |
|||
if (dict.getDictId() <= 1884L && LongEnum.ROOT.getCode().equals(dict.getDictPid())) { |
|||
//如果是初始化数据字典且是根节点,不允许该操作 |
|||
return new Result(CoReturnFormat.DICT_NOT_OPERATION); |
|||
} |
|||
cerePlatformDictService.delete(param, user); |
|||
} |
|||
return new Result(user.getUsername(), "删除数据字典", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 数据字典编辑查询 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "数据字典编辑查询") |
|||
public Result<CerePlatformDict> getById(@RequestBody DictGetByIdParam param) throws CoBusinessException { |
|||
CerePlatformDict cerePlatformDict = cerePlatformDictService.getById(param.getDictId()); |
|||
return new Result(cerePlatformDict); |
|||
} |
|||
|
|||
/** |
|||
* 数据字典管理查询 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "数据字典管理查询") |
|||
public Result<Page<CerePlatformDict>> getAll(@RequestBody DictGetAllParam param) throws CoBusinessException { |
|||
Page page = cerePlatformDictService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 根据父节点id查询子级字典数据 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getChilds") |
|||
@ApiOperation(value = "根据父节点id查询子级字典数据") |
|||
public Result<Page<CerePlatformDict>> getChilds(@RequestBody DictGetChildsParam param) throws CoBusinessException { |
|||
Page page = cerePlatformDictService.getChilds(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 字典下拉数据查询 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getSelect") |
|||
@ApiOperation(value = "字典下拉数据查询") |
|||
public Result<List<CerePlatformDict>> getSelect(@RequestBody DictGetSelectParam param) throws CoBusinessException { |
|||
List<CerePlatformDict> list = cerePlatformDictService.getSelect(param.getDictName()); |
|||
return new Result(list); |
|||
} |
|||
|
|||
/** |
|||
* 导入快递公司编码数据 |
|||
* |
|||
* @param file |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "importExpressCodes") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "导入快递公司编码数据", notes = "file:文件") |
|||
public Result importExpressCodes(MultipartFile file) throws CoBusinessException, Exception { |
|||
if (EmptyUtils.isEmpty(file)) { |
|||
return new Result(CoReturnFormat.NOT_FILE); |
|||
} |
|||
Workbook wb = WorkbookFactory.create(file.getInputStream()); |
|||
cerePlatformDictService.importExpressCodes(wb); |
|||
return new Result(); |
|||
} |
|||
} |
@ -0,0 +1,212 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.discount.Discount; |
|||
import com.shop.cereshop.admin.page.discount.DiscountData; |
|||
import com.shop.cereshop.admin.page.discount.DiscountShop; |
|||
import com.shop.cereshop.admin.page.discount.DiscountShopProduct; |
|||
import com.shop.cereshop.admin.page.seckill.Seckill; |
|||
import com.shop.cereshop.admin.page.seckill.SeckillData; |
|||
import com.shop.cereshop.admin.page.seckill.SeckillShop; |
|||
import com.shop.cereshop.admin.page.seckill.SeckillShopProduct; |
|||
import com.shop.cereshop.admin.param.discount.*; |
|||
import com.shop.cereshop.admin.param.seckill.*; |
|||
import com.shop.cereshop.admin.service.platformtool.CerePlatformDiscountService; |
|||
import com.shop.cereshop.admin.service.platformtool.CerePlatformSeckillService; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.platformtool.CerePlatformDiscount; |
|||
import com.shop.cereshop.commons.domain.platformtool.CerePlatformSeckill; |
|||
import com.shop.cereshop.commons.domain.shop.ShopDataDetail; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.poi.ExcelUtils; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 平台限时折扣活动管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("discount") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "DiscountController") |
|||
@Api(value = "平台限时折扣活动管理模块", tags = "平台限时折扣活动管理模块") |
|||
public class DiscountController { |
|||
|
|||
@Autowired |
|||
private CerePlatformDiscountService cerePlatformDiscountService; |
|||
|
|||
/** |
|||
* 新增平台限时折扣活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "新增平台限时折扣活动") |
|||
@NoRepeatWebLog |
|||
public Result insert(@RequestBody @Validated DiscountSaveParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformDiscountService.save(param,user); |
|||
return new Result(user.getUsername(),"新增平台限时折扣活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改平台限时折扣活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改平台限时折扣活动") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody @Validated DiscountUpdateParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformDiscountService.update(param,user); |
|||
return new Result(user.getUsername(),"修改平台限时折扣活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除平台限时折扣活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除平台限时折扣活动") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody DiscountGetByIdParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformDiscountService.delete(param.getDiscountId(),user); |
|||
return new Result(user.getUsername(),"删除平台限时折扣活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 停止平台限时折扣活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "stop") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "停止平台限时折扣活动") |
|||
@NoRepeatWebLog |
|||
public Result stop(@RequestBody DiscountGetByIdParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformDiscountService.stop(param.getDiscountId(),user); |
|||
return new Result(user.getUsername(),"停止平台限时折扣活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 平台限时折扣详情查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "平台限时折扣详情查询") |
|||
public Result<CerePlatformDiscount> getById(@RequestBody DiscountGetByIdParam param) throws CoBusinessException{ |
|||
CerePlatformDiscount detail=cerePlatformDiscountService.getById(param.getDiscountId()); |
|||
return new Result(detail); |
|||
} |
|||
|
|||
/** |
|||
* 数据效果查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getData") |
|||
@ApiOperation(value = "数据效果查询") |
|||
public Result<DiscountData> getData(@RequestBody DiscountGetByIdParam param) throws CoBusinessException{ |
|||
DiscountData detail=cerePlatformDiscountService.getData(param); |
|||
return new Result(detail); |
|||
} |
|||
|
|||
/** |
|||
* 平台限时折扣活动管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "平台限时折扣活动管理查询") |
|||
public Result<Page<Discount>> getAll(@RequestBody DiscountGetAllParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
Page page =cerePlatformDiscountService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 参与店铺查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getShops") |
|||
@ApiOperation(value = "参与店铺查询") |
|||
public Result<Page<DiscountShop>> getShops(@RequestBody DiscountShopParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
Page page=cerePlatformDiscountService.getShops(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 查看商品 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getProducts") |
|||
@ApiOperation(value = "查看商品") |
|||
public Result<Page<DiscountShopProduct>> getProducts(@RequestBody DiscountGetProductsParam param) throws CoBusinessException{ |
|||
Page page=cerePlatformDiscountService.getProducts(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 商家数据明细导出导出 |
|||
* @param param |
|||
* @param response |
|||
*/ |
|||
@PostMapping(value = "excel_shop_detail") |
|||
@ApiOperation(value = "商家数据明细导出导出") |
|||
public void excelShop(@RequestBody DiscountGetByIdParam param, HttpServletResponse response) throws CoBusinessException,Exception{ |
|||
List<ShopDataDetail> list=cerePlatformDiscountService.findExcel(param); |
|||
List<String> titles=new ArrayList<>(); |
|||
titles.add("商家名称"); |
|||
titles.add("店铺编码"); |
|||
titles.add("参与商品数"); |
|||
titles.add("访客数"); |
|||
titles.add("提交订单笔数"); |
|||
titles.add("成交笔数"); |
|||
titles.add("成交总额"); |
|||
XSSFWorkbook excel = ExcelUtils.createSeckillShopDetailExcel(titles, list); |
|||
Date date = new Date(); |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|||
String str = "订单管理表"+sdf.format(date); |
|||
response.setContentType("application/vnd.ms-excel;charset=utf-8"); |
|||
response.setHeader("Content-disposition", "attachment;filename=" + str +".xls");// 默认Excel名称 |
|||
response.flushBuffer(); |
|||
excel.write(response.getOutputStream()); |
|||
excel.close(); |
|||
} |
|||
} |
@ -0,0 +1,54 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.express.ExpressUpdateParam; |
|||
import com.shop.cereshop.admin.service.express.CerePlatformExpressService; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.HttpServletRequest; |
|||
|
|||
/** |
|||
* 物流查询策略配置 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("express") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "ExpressController") |
|||
@Api(value = "物流查询策略配置模块", tags = "物流查询策略配置模块") |
|||
public class ExpressController { |
|||
|
|||
@Autowired |
|||
private CerePlatformExpressService cerePlatformExpressService; |
|||
|
|||
/** |
|||
* 切换物流查询策略 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "切换物流查询策略") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody ExpressUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformExpressService.update(param,user); |
|||
return new Result(user.getUsername(),"切换物流查询策略", GsonUtil.objectToGson(param)); |
|||
} |
|||
} |
@ -0,0 +1,65 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.page.finance.BondCount; |
|||
import com.shop.cereshop.admin.page.finance.FinanceCount; |
|||
import com.shop.cereshop.admin.page.finance.ShopBond; |
|||
import com.shop.cereshop.admin.param.finance.BondParam; |
|||
import com.shop.cereshop.admin.param.finance.FinanceParam; |
|||
import com.shop.cereshop.admin.service.activity.CereActivitySignService; |
|||
import com.shop.cereshop.admin.service.shop.CerePlatformShopService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.domain.activity.CereActivitySign; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
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.*; |
|||
|
|||
/** |
|||
* 财务管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("finance") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "FinanceController") |
|||
@Api(value = "财务管理模块", tags = "财务管理模块") |
|||
public class FinanceController { |
|||
|
|||
@Autowired |
|||
private CerePlatformShopService cerePlatformShopService; |
|||
|
|||
@Autowired |
|||
private CereActivitySignService cereActivitySignService; |
|||
|
|||
/** |
|||
* 财务管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAllFinance") |
|||
@ApiOperation(value = "财务管理查询") |
|||
public Result<FinanceCount> getAllFinance(@RequestBody FinanceParam param) throws CoBusinessException{ |
|||
FinanceCount count =cerePlatformShopService.getAllFinance(param); |
|||
return new Result(count); |
|||
} |
|||
|
|||
/** |
|||
* 保证金管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAllBond") |
|||
@ApiOperation(value = "保证金管理查询") |
|||
public Result<BondCount> getAllBond(@RequestBody BondParam param) throws CoBusinessException{ |
|||
BondCount count =cereActivitySignService.getAllBond(param); |
|||
return new Result(count); |
|||
} |
|||
} |
@ -0,0 +1,58 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.param.admin.IndexCharts; |
|||
import com.shop.cereshop.admin.param.admin.IndexStats; |
|||
import com.shop.cereshop.admin.service.admin.AdminService; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
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.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 统计模块 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("index") |
|||
@Slf4j(topic = "IndexController") |
|||
@Api(value = "统计模块", tags = "统计模块") |
|||
public class IndexController { |
|||
|
|||
@Autowired |
|||
private AdminService adminService; |
|||
|
|||
/** |
|||
* 查询平台统计数据 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "indexStats") |
|||
@ApiOperation(value = "查询平台首页统计数据(新增用户、浏览量、访客数、店铺数)") |
|||
public Result<IndexStats> indexStats() { |
|||
IndexStats stats = adminService.indexStats(); |
|||
return new Result<>(stats); |
|||
} |
|||
|
|||
/** |
|||
* 查询平台首页统计图表 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "indexCharts") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "查询平台首页统计图表(订单金额、订单数)") |
|||
public Result<IndexCharts> indexCharts() { |
|||
IndexCharts charts = adminService.indexCharts(); |
|||
return new Result<>(charts); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,97 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.live.LiveGetAllParam; |
|||
import com.shop.cereshop.admin.param.live.LiveParam; |
|||
import com.shop.cereshop.admin.param.live.LiveProductPageParam; |
|||
import com.shop.cereshop.admin.service.live.CereLiveService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.live.CereLive; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.HttpServletRequest; |
|||
|
|||
/** |
|||
* 直播 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("live") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "LiveController") |
|||
public class LiveController { |
|||
|
|||
@Autowired |
|||
private CereLiveService cereLiveService; |
|||
|
|||
/** |
|||
* 直播间列表查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "直播间列表查询") |
|||
public Result<Page<CereLive>> getAll(@RequestBody LiveGetAllParam param) throws Exception { |
|||
Page page=cereLiveService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 审核直播间 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "audit") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "审核直播间") |
|||
@NoRepeatWebLog |
|||
public Result audit(@RequestBody LiveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereLiveService.audit(param,user); |
|||
return new Result(user.getUsername(),"审核直播间", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 查询某个直播间 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "查询某个直播间") |
|||
@NoRepeatWebLog |
|||
public Result getById(@RequestBody LiveParam param) throws CoBusinessException{ |
|||
CereLive live = cereLiveService.getById(param); |
|||
return new Result(live); |
|||
} |
|||
|
|||
/** |
|||
* 查询直播间的关联商品 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getLiveProductRelPageByLiveId") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "查询直播间的关联商品") |
|||
@NoRepeatWebLog |
|||
public Result getLiveProductRelPageByLiveId(@RequestBody LiveProductPageParam param) { |
|||
Page page = cereLiveService.getLiveProductRelPageByLiveId(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,84 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.live.LiveProductGetAllParam; |
|||
import com.shop.cereshop.admin.param.live.LiveProductParam; |
|||
import com.shop.cereshop.admin.service.live.CereLiveProductService; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.live.CereLiveProduct; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 直播间商品管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("liveProduct") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "LiveProductController") |
|||
public class LiveProductController { |
|||
|
|||
@Autowired |
|||
private CereLiveProductService cereLiveProductService; |
|||
|
|||
/** |
|||
* 直播间商品列表查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "直播间商品列表查询") |
|||
public Result<Page<CereLiveProduct>> getAll(@RequestBody LiveProductGetAllParam param) throws Exception{ |
|||
Page page= cereLiveProductService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 审核直播间商品 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "audit") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "审核直播间商品") |
|||
@NoRepeatWebLog |
|||
public Result audit(@RequestBody @Validated LiveProductParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereLiveProductService.audit(param,user); |
|||
return new Result(user.getUsername(),"审核直播间商品", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 查询某个直播间商品 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "查询某个直播间商品") |
|||
@NoRepeatWebLog |
|||
public Result getById(@RequestBody LiveProductParam param) throws CoBusinessException{ |
|||
CereLiveProduct liveProduct = cereLiveProductService.getById(param); |
|||
return new Result(liveProduct); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,55 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.service.mark.MarkDataService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 造数据 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("mark") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "MakingDataController") |
|||
public class MakingDataController { |
|||
|
|||
@Autowired |
|||
private MarkDataService markDataService; |
|||
|
|||
/** |
|||
* 创建订单 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "createOrder") |
|||
@NoRepeatSubmit |
|||
public Result createOrder() throws CoBusinessException{ |
|||
markDataService.createOrder(); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 创建售后单 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "createAfter") |
|||
@NoRepeatSubmit |
|||
public Result createAfter() throws CoBusinessException{ |
|||
markDataService.createAfter(); |
|||
return new Result(); |
|||
} |
|||
} |
@ -0,0 +1,116 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.member.MemberLevel; |
|||
import com.shop.cereshop.admin.param.member.*; |
|||
import com.shop.cereshop.admin.service.member.CerePlatformMemberLevelService; |
|||
import com.shop.cereshop.admin.service.member.CerePlatformMembershipService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.common.PageParam; |
|||
import com.shop.cereshop.commons.domain.member.CerePlatformMemberLevel; |
|||
import com.shop.cereshop.commons.domain.member.CerePlatformMembership; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 会员等级 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("memberlevel") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "MemberLevelController") |
|||
@Api(value = "会员模块", tags = "会员模块") |
|||
public class MemberLevelController { |
|||
|
|||
@Autowired |
|||
private CerePlatformMemberLevelService cerePlatformMemberLevelService; |
|||
|
|||
/** |
|||
* 添加会员等级 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加会员等级") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated MemberLevelSaveParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformMemberLevelService.save(param,user); |
|||
return new Result(user.getUsername(),"添加会员等级", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 编辑会员等级 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "编辑会员等级") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody MemberLevelUpdateParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformMemberLevelService.update(param,user); |
|||
return new Result(user.getUsername(),"编辑会员等级", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除会员等级 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除会员等级") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody MemberLevelgetByIdParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformMemberLevelService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除会员等级", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 会员等级详情查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "会员等级详情查询") |
|||
public Result<CerePlatformMembership> getById(@RequestBody MemberLevelgetByIdParam param) throws CoBusinessException { |
|||
MemberLevel memberLevel=cerePlatformMemberLevelService.getById(param); |
|||
return new Result(memberLevel); |
|||
} |
|||
|
|||
/** |
|||
* 会员等级列表查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "会员等级列表查询") |
|||
public Result<Page<MemberLevel>> getAll(@RequestBody PageParam param) throws CoBusinessException { |
|||
Page page=cerePlatformMemberLevelService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
} |
@ -0,0 +1,118 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.dict.DictSaveParam; |
|||
import com.shop.cereshop.admin.param.member.MembershipGetByIdParam; |
|||
import com.shop.cereshop.admin.param.member.MembershipSaveParam; |
|||
import com.shop.cereshop.admin.param.member.MembershipUpdateParam; |
|||
import com.shop.cereshop.admin.service.member.CerePlatformMembershipService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.common.PageParam; |
|||
import com.shop.cereshop.commons.domain.dict.CerePlatformDict; |
|||
import com.shop.cereshop.commons.domain.member.CerePlatformMembership; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 会员权益 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("membership") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "MemberShipController") |
|||
@Api(value = "会员模块", tags = "会员模块") |
|||
public class MemberShipController { |
|||
|
|||
@Autowired |
|||
private CerePlatformMembershipService cerePlatformMembershipService; |
|||
|
|||
/** |
|||
* 添加会员权益 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加会员权益") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated MembershipSaveParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformMembershipService.save(param,user); |
|||
return new Result(user.getUsername(),"添加会员权益", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 编辑会员权益 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "编辑会员权益") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody MembershipUpdateParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformMembershipService.update(param,user); |
|||
return new Result(user.getUsername(),"编辑会员权益", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除会员权益 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除会员权益") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody MembershipGetByIdParam param, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformMembershipService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除会员权益", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 会员权益详情查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "会员权益详情查询") |
|||
public Result<CerePlatformMembership> getById(@RequestBody MembershipGetByIdParam param) throws CoBusinessException { |
|||
CerePlatformMembership membership=cerePlatformMembershipService.getById(param); |
|||
return new Result(membership); |
|||
} |
|||
|
|||
/** |
|||
* 会员权益列表查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "会员权益列表查询") |
|||
public Result<Page<CerePlatformMembership>> getAll(@RequestBody PageParam param) throws CoBusinessException { |
|||
Page page=cerePlatformMembershipService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
} |
@ -0,0 +1,115 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.message.*; |
|||
import com.shop.cereshop.admin.service.message.CerePlatfromMessageService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.message.CerePlatfromMessage; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 短信账号配置 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("message") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "MessageController") |
|||
@Api(value = "短信账号配置模块", tags = "短信账号配置模块") |
|||
public class MessageController { |
|||
|
|||
@Autowired |
|||
private CerePlatfromMessageService cerePlatfromMessageService; |
|||
|
|||
/** |
|||
* 添加短信模板配置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加短信模板配置") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated MessageSaveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatfromMessageService.save(param,user); |
|||
return new Result(user.getUsername(),"添加短信模板配置", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改短信模板配置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改短信模板配置") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody MessageUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatfromMessageService.update(param,user); |
|||
return new Result(user.getUsername(),"修改短信模板配置", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除短信模板配置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除短信模板配置") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody MessageDeleteParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatfromMessageService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除短信模板配置", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 短信模板配置修改查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "短信模板配置修改查询") |
|||
public Result<CerePlatfromMessage> getById(@RequestBody MessageGetByIdParam param) throws CoBusinessException{ |
|||
CerePlatfromMessage cerePlatfromMessage=cerePlatfromMessageService.getById(param.getMessageId()); |
|||
return new Result(cerePlatfromMessage); |
|||
} |
|||
|
|||
/** |
|||
* 短信模板配置管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "短信模板配置管理查询") |
|||
public Result<Page<CerePlatfromMessage>> getAll(@RequestBody MessageGetAllParam param) throws CoBusinessException{ |
|||
Page page=cerePlatfromMessageService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
} |
@ -0,0 +1,96 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.notice.NoticeGetAllParam; |
|||
import com.shop.cereshop.admin.param.notice.NoticeIdParam; |
|||
import com.shop.cereshop.admin.param.notice.NoticeParam; |
|||
import com.shop.cereshop.admin.service.notice.CereNoticeService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.notice.CereNotice; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.HttpServletRequest; |
|||
|
|||
/** |
|||
* 消息中心 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("notice") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "NoticeController") |
|||
@Api(value = "消息中心", tags = "消息中心") |
|||
public class NoticeController { |
|||
|
|||
@Autowired |
|||
private CereNoticeService cereNoticeService; |
|||
|
|||
/** |
|||
* 消息推送 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "消息推送") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody NoticeParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereNoticeService.save(param,user); |
|||
return new Result(user.getUsername(),"消息推送", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除消息 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除消息") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody NoticeIdParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereNoticeService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除消息", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 消息详情查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "消息详情查询") |
|||
public Result<CereNotice> getById(@RequestBody NoticeIdParam param) throws CoBusinessException{ |
|||
CereNotice cereNotice=cereNoticeService.getById(param.getNoticeId()); |
|||
return new Result(cereNotice); |
|||
} |
|||
|
|||
/** |
|||
* 历史消息查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "历史消息查询") |
|||
public Result<Page<CereNotice>> getAll(@RequestBody NoticeGetAllParam param) throws CoBusinessException{ |
|||
Page page =cereNoticeService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
} |
@ -0,0 +1,122 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.page.order.ShopOrder; |
|||
import com.shop.cereshop.admin.page.order.ShopOrderExportDTO; |
|||
import com.shop.cereshop.admin.page.product.Product; |
|||
import com.shop.cereshop.admin.param.order.OrderGetAllParam; |
|||
import com.shop.cereshop.admin.param.order.OrderGetByIdParam; |
|||
import com.shop.cereshop.admin.service.order.CereShopOrderService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.enums.OrderStateEnum; |
|||
import com.shop.cereshop.commons.enums.PaymentModeEnum; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.poi.export.ExcelExportUtils; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.EmptyUtils; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 订单管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("order") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "OrderController") |
|||
@Api(value = "订单管理", tags = "订单管理") |
|||
public class OrderController { |
|||
|
|||
@Autowired |
|||
private CereShopOrderService cereShopOrderService; |
|||
|
|||
/** |
|||
* 订单管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "订单管理查询") |
|||
public Result<Page<ShopOrder>> getAll(@RequestBody OrderGetAllParam param) throws CoBusinessException { |
|||
Page page =cereShopOrderService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 订单详情查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "订单详情查询") |
|||
public Result<ShopOrder> getById(@RequestBody OrderGetByIdParam param) throws CoBusinessException{ |
|||
ShopOrder shopOrder=cereShopOrderService.getById(param.getOrderId()); |
|||
return new Result(shopOrder); |
|||
} |
|||
|
|||
/** |
|||
* 订单管理导出 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "export") |
|||
@ApiOperation(value = "订单管理导出") |
|||
public void export(@RequestBody OrderGetAllParam param, HttpServletRequest request, HttpServletResponse response) throws CoBusinessException { |
|||
param.setPage(1); |
|||
param.setPageSize(10000); |
|||
Page<ShopOrder> page = cereShopOrderService.getAll(param); |
|||
List<ShopOrderExportDTO> list = page.getList().stream().map(s -> { |
|||
ShopOrderExportDTO shopOrderExportDTO = new ShopOrderExportDTO(); |
|||
shopOrderExportDTO.setOrderId(s.getOrderId()); |
|||
shopOrderExportDTO.setCreateTime(s.getCreateTime()); |
|||
shopOrderExportDTO.setCustomerName(s.getCustomerName()); |
|||
shopOrderExportDTO.setShopName(s.getShopName()); |
|||
shopOrderExportDTO.setNumber(s.getNumber()); |
|||
shopOrderExportDTO.setPrice(s.getPrice()); |
|||
shopOrderExportDTO.setPaymentTime(s.getPaymentTime()); |
|||
shopOrderExportDTO.setReceiveName(s.getReceiveName()); |
|||
shopOrderExportDTO.setReceiveAdress(s.getReceiveAdress()); |
|||
shopOrderExportDTO.setReceivePhone(s.getReceivePhone()); |
|||
shopOrderExportDTO.setRemark(s.getRemark()); |
|||
shopOrderExportDTO.setTransactionId(s.getTransactionId()); |
|||
shopOrderExportDTO.setState(OrderStateEnum.getMsgByCode(s.getState())); |
|||
shopOrderExportDTO.setPaymentMode(PaymentModeEnum.getMsgByCode(s.getPaymentMode())); |
|||
if(EmptyUtils.isNotEmpty(s.getProducts())){ |
|||
StringBuilder builder = new StringBuilder(); |
|||
for (Product p:s.getProducts()) { |
|||
builder.append(p.getProductName()) |
|||
.append(" ").append(p.getNumber()) |
|||
.append(StringUtils.isNotBlank(p.getBrandName()) ? " " + p.getBrandName() : "") |
|||
.append(StringUtils.isNotBlank(p.getSKU()) ? " " + p.getSKU() : "") |
|||
.append("\n"); |
|||
} |
|||
//String productNames=s.getProducts().stream().map(Product::getProductName).collect(Collectors.joining("\n")); |
|||
builder.deleteCharAt(builder.length() - 1); |
|||
shopOrderExportDTO.setProductNames(builder.toString()); |
|||
} |
|||
shopOrderExportDTO.setHistoryOrderNum(s.getTotal()); |
|||
return shopOrderExportDTO; |
|||
|
|||
}).collect(Collectors.toList()); |
|||
//定义导出的excel名字 |
|||
String excelName = "订单列表"; |
|||
ExcelExportUtils.exportExcel(request,response,excelName,list, ShopOrderExportDTO.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,125 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.permission.Permission; |
|||
import com.shop.cereshop.admin.param.permission.*; |
|||
import com.shop.cereshop.admin.service.permission.CerePlatformPermissionService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.permission.CerePlatformPermission; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 菜单权限 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("permission") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "PermissionController") |
|||
@Api(value = "菜单权限模块", tags = "菜单权限模块") |
|||
public class PermissionController { |
|||
|
|||
@Autowired |
|||
private CerePlatformPermissionService cerePlatformPermissionService; |
|||
|
|||
/** |
|||
* 添加菜单权限 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加菜单权限") |
|||
@NoRepeatWebLog |
|||
public Result insert(@RequestBody @Validated PermissionSaveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformPermissionService.save(param,user); |
|||
return new Result(user.getUsername(),"添加菜单权限", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改菜单权限 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改菜单权限") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody PermissionUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformPermissionService.update(param,user); |
|||
return new Result(user.getUsername(),"修改菜单权限", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除菜单权限 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除菜单权限") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody PermissionDeleteParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformPermissionService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除菜单权限", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 菜单权限编辑查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "菜单权限编辑查询") |
|||
public Result<CerePlatformPermission> getById(@RequestBody PermissionGetByIdParam param) throws CoBusinessException{ |
|||
CerePlatformPermission cerePlatformPermission=cerePlatformPermissionService.getById(param.getPermissionId()); |
|||
return new Result(cerePlatformPermission); |
|||
} |
|||
|
|||
/** |
|||
* 查询当前最大排序值 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getMaxSort") |
|||
@ApiOperation(value = "查询当前最大排序值") |
|||
public Result<Integer> getMaxSort() throws CoBusinessException{ |
|||
Integer sort=cerePlatformPermissionService.getMaxSort(); |
|||
return new Result(sort); |
|||
} |
|||
|
|||
/** |
|||
* 菜单权限管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "菜单权限管理查询") |
|||
public Result<Page<Permission>> getAll(@RequestBody PermissionGetAllParam param) throws CoBusinessException{ |
|||
Page page =cerePlatformPermissionService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,145 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.label.*; |
|||
import com.shop.cereshop.admin.service.label.CerePlatformLabelService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.label.PlatformLabel; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.poi.ExcelUtils; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 标签管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("label") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "PlatformLabelController") |
|||
@Api(value = "标签管理", tags = "标签管理") |
|||
public class PlatformLabelController { |
|||
|
|||
@Autowired |
|||
private CerePlatformLabelService cerePlatformLabelService; |
|||
|
|||
/** |
|||
* 标签管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "标签管理查询") |
|||
public Result<Page<PlatformLabel>> getAll(@RequestBody LabelGetAllParam param) throws CoBusinessException{ |
|||
Page page=cerePlatformLabelService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 标签编辑查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "标签编辑查询") |
|||
public Result<PlatformLabel> getById(@RequestBody LabelGetByIdParam param) throws CoBusinessException{ |
|||
PlatformLabel label=cerePlatformLabelService.getById(param.getBuyerLabelId()); |
|||
return new Result(label); |
|||
} |
|||
|
|||
/** |
|||
* 添加标签 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加标签") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated LabelSaveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformLabelService.save(param,user); |
|||
return new Result(user.getUsername(),"添加标签", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改标签 |
|||
* @param label |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改标签") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody LabelUpdateParam label, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformLabelService.update(label,user); |
|||
return new Result(user.getUsername(),"修改标签", GsonUtil.objectToGson(label)); |
|||
} |
|||
|
|||
/** |
|||
* 删除标签 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除标签") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody LabelDeleteParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformLabelService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除标签", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 标签导出 |
|||
* @param param |
|||
* @param response |
|||
*/ |
|||
@PostMapping(value = "excel_platform_label") |
|||
@ApiOperation(value = "标签导出") |
|||
public void excelLabel(@RequestBody LabelExcelParam param, HttpServletResponse response) throws CoBusinessException,Exception{ |
|||
List<PlatformLabel> list=cerePlatformLabelService.findExcel(param); |
|||
List<String> titles=new ArrayList<>(); |
|||
titles.add("标签名"); |
|||
titles.add("客户"); |
|||
titles.add("标签类型"); |
|||
titles.add("达标条件"); |
|||
XSSFWorkbook excel = ExcelUtils.createPlatformLabelExcel(titles, list); |
|||
Date date = new Date(); |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|||
String str = "订单管理表"+sdf.format(date); |
|||
response.setContentType("application/vnd.ms-excel;charset=utf-8"); |
|||
response.setHeader("Content-disposition", "attachment;filename=" + str +".xls");// 默认Excel名称 |
|||
response.flushBuffer(); |
|||
excel.write(response.getOutputStream()); |
|||
excel.close(); |
|||
} |
|||
} |
@ -0,0 +1,206 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.user.PlatformUser; |
|||
import com.shop.cereshop.admin.param.user.*; |
|||
import com.shop.cereshop.admin.redis.service.api.StringRedisService; |
|||
import com.shop.cereshop.admin.service.user.CerePlatformUserService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.EmptyUtils; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 用户 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("platform_user") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "PlatformUserController") |
|||
@Api(value = "用户模块", tags = "用户模块") |
|||
public class PlatformUserController { |
|||
|
|||
@Autowired |
|||
private CerePlatformUserService cerePlatformUserService; |
|||
|
|||
@Autowired |
|||
private StringRedisService stringRedisService; |
|||
|
|||
private static final String PRIVACY_SHOW_SWITCH = "privacy_show_switch_"; |
|||
|
|||
/** |
|||
* 添加账户 |
|||
* |
|||
* @param userParam |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加账户") |
|||
@NoRepeatWebLog |
|||
public Result insert(@RequestBody @Validated UserSaveParam userParam, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformUserService.save(userParam, user); |
|||
return new Result(user.getUsername(), "添加账户", GsonUtil.objectToGson(userParam)); |
|||
} |
|||
|
|||
/** |
|||
* 修改账户 |
|||
* |
|||
* @param userParam |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改账户") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody UserUpdateParam userParam, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformUserService.update(userParam, user); |
|||
return new Result(user.getUsername(), "修改账户", GsonUtil.objectToGson(userParam)); |
|||
} |
|||
|
|||
/** |
|||
* 删除账户 |
|||
* |
|||
* @param userParam |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除账户") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody UserDeleteParam userParam, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformUserService.delete(userParam, user); |
|||
return new Result(user.getUsername(), "删除账户", GsonUtil.objectToGson(userParam)); |
|||
} |
|||
|
|||
/** |
|||
* 账户编辑查询 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "账户编辑查询") |
|||
public Result<PlatformUser> getById(@RequestBody UserGetByIdParam userParam) throws CoBusinessException, Exception { |
|||
PlatformUser cerePlatformUser = cerePlatformUserService.getById(userParam.getPlatformUserId()); |
|||
return new Result(cerePlatformUser); |
|||
} |
|||
|
|||
/** |
|||
* 账户管理查询 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "账户管理查询") |
|||
public Result<Page<PlatformUser>> getAll(@RequestBody UserGetAllParam userParam) throws CoBusinessException { |
|||
Page page = cerePlatformUserService.getAll(userParam); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 更新密码 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "updatePassword") |
|||
@ApiOperation(value = "更新密码") |
|||
public Result updatePassword(@RequestBody UserForgetPasswordParam passwordParam, HttpServletRequest request) throws CoBusinessException { |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformUserService.updatePassword(passwordParam, user); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 更新管理员手机号 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "updatePhone") |
|||
@ApiOperation(value = "更新管理员手机号") |
|||
public Result<Boolean> updatePhone(@RequestBody UserUpdatePhoneParam param, HttpServletRequest request) throws CoBusinessException { |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
boolean result = true; |
|||
try { |
|||
param = param.decrypt(); |
|||
} catch (Exception e) { |
|||
return new Result(CoReturnFormat.PARAM_INVALID); |
|||
} |
|||
if (!EmptyUtils.isEmpty(param.getCode())) { |
|||
//手机号登录,校验验证码 |
|||
log.info("code: {}", param.getCode()); |
|||
String code = (String) stringRedisService.get(param.getPhone()); |
|||
log.info("redis code: {}", code); |
|||
if (!param.getCode().equals(code)) { |
|||
log.info("not equals"); |
|||
return new Result<>(CoReturnFormat.CODE_ERROR); |
|||
} |
|||
cerePlatformUserService.updatePhone(param, user); |
|||
} else { |
|||
result = false; |
|||
} |
|||
return new Result<>(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询当前用户是否进行过二次认证 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getPrivacySwitch") |
|||
@ApiOperation(value = "查询当前用户是否进行过二次认证") |
|||
public Result<Long> getPrivacySwitch(HttpServletRequest request) { |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
if (user != null) { |
|||
Long switchTimestamp = (Long)stringRedisService.get(PRIVACY_SHOW_SWITCH + user.getPlatformUserId()); |
|||
if (switchTimestamp != null && switchTimestamp > 0) { |
|||
return new Result<>(switchTimestamp); |
|||
} |
|||
} |
|||
return new Result<>(0L); |
|||
} |
|||
|
|||
/** |
|||
* 更新头像 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "updateAvatar") |
|||
@ApiOperation(value = "更新头像") |
|||
public Result updateAvatar(@RequestBody CerePlatformUser platformUser, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
if (user != null) { |
|||
user.setAvatar(platformUser.getAvatar()); |
|||
cerePlatformUserService.updateAvatar(user); |
|||
} |
|||
return new Result(); |
|||
} |
|||
} |
@ -0,0 +1,160 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.polite.Polite; |
|||
import com.shop.cereshop.admin.page.polite.PoliteActivity; |
|||
import com.shop.cereshop.admin.page.polite.PoliteData; |
|||
import com.shop.cereshop.admin.page.polite.PoliteDetail; |
|||
import com.shop.cereshop.admin.page.seckill.SeckillData; |
|||
import com.shop.cereshop.admin.param.polite.PoliteGetAllParam; |
|||
import com.shop.cereshop.admin.param.polite.PoliteGetByIdParam; |
|||
import com.shop.cereshop.admin.param.polite.PoliteSaveParam; |
|||
import com.shop.cereshop.admin.param.polite.PoliteUpdateParam; |
|||
import com.shop.cereshop.admin.param.seckill.SeckillGetByIdParam; |
|||
import com.shop.cereshop.admin.param.seckill.SeckillSaveParam; |
|||
import com.shop.cereshop.admin.service.platformtool.CerePlatformPoliteService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.common.PageParam; |
|||
import com.shop.cereshop.commons.domain.platformtool.CerePlatformSeckill; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 平台支付有礼活动管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("polite") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "SeckillController") |
|||
@Api(value = "平台支付有礼活动管理模块", tags = "平台支付有礼活动管理模块") |
|||
public class PoliteController { |
|||
|
|||
@Autowired |
|||
private CerePlatformPoliteService cerePlatformPoliteService; |
|||
|
|||
/** |
|||
* 新增平台支付有礼活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "新增平台支付有礼活动") |
|||
@NoRepeatWebLog |
|||
public Result insert(@RequestBody @Validated PoliteSaveParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformPoliteService.save(param,user); |
|||
return new Result(user.getUsername(),"新增平台支付有礼活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 编辑平台支付有礼活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "编辑平台支付有礼活动") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody @Validated PoliteUpdateParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformPoliteService.update(param,user); |
|||
return new Result(user.getUsername(),"编辑平台支付有礼活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除平台支付有礼活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除平台支付有礼活动") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody PoliteGetByIdParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformPoliteService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除平台支付有礼活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 停止平台支付有礼活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "stop") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "停止平台支付有礼活动") |
|||
@NoRepeatWebLog |
|||
public Result stop(@RequestBody PoliteGetByIdParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformPoliteService.stop(param,user); |
|||
return new Result(user.getUsername(),"停止平台支付有礼活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 平台支付有礼详情查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "平台支付有礼详情查询") |
|||
public Result<PoliteDetail> getById(@RequestBody PoliteGetByIdParam param) throws CoBusinessException{ |
|||
PoliteDetail detail=cerePlatformPoliteService.getById(param.getPoliteId()); |
|||
return new Result(detail); |
|||
} |
|||
|
|||
/** |
|||
* 数据效果查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getData") |
|||
@ApiOperation(value = "数据效果查询") |
|||
public Result<PoliteData> getData(@RequestBody PoliteGetByIdParam param) throws CoBusinessException{ |
|||
PoliteData detail=cerePlatformPoliteService.getData(param); |
|||
return new Result(detail); |
|||
} |
|||
|
|||
/** |
|||
* 平台支付有礼管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "平台支付有礼管理查询") |
|||
public Result<Page<Polite>> getAll(@RequestBody PoliteGetAllParam param) throws CoBusinessException{ |
|||
Page page=cerePlatformPoliteService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 选择优惠券查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAllActivity") |
|||
@ApiOperation(value = "选择优惠券查询") |
|||
public Result<Page<PoliteActivity>> getAllActivity(@RequestBody PageParam param) throws CoBusinessException{ |
|||
Page page=cerePlatformPoliteService.getAllActivity(param); |
|||
return new Result(page); |
|||
} |
|||
} |
@ -0,0 +1,147 @@ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.page.credit.CereCreditRecordPage; |
|||
import com.shop.cereshop.admin.page.risk.CereRiskUserBlack; |
|||
import com.shop.cereshop.admin.param.credit.CreditRecordGetAllParam; |
|||
import com.shop.cereshop.admin.param.risk.CereRiskBlackPageParam; |
|||
import com.shop.cereshop.admin.service.risk.CereRiskBlackService; |
|||
import com.shop.cereshop.admin.service.risk.CereRiskRuleService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.common.PageParam; |
|||
import com.shop.cereshop.commons.domain.risk.CereRiskBlack; |
|||
import com.shop.cereshop.commons.domain.risk.CereRiskRule; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* 风控模块 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("risk") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "RiskController") |
|||
@Api(value = "风控模块", tags = "风控模块") |
|||
public class RiskController { |
|||
|
|||
@Autowired |
|||
private CereRiskBlackService cereRiskBlackService; |
|||
|
|||
@Autowired |
|||
private CereRiskRuleService cereRiskRuleService; |
|||
|
|||
/** |
|||
* 查询ip黑名单列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAllIpBlackList") |
|||
@ApiOperation(value = "查询ip黑名单列表") |
|||
public Result<Page<CereRiskBlack>> getAllIpBlackList(@RequestBody CereRiskBlackPageParam param) throws CoBusinessException { |
|||
Page page=cereRiskBlackService.getAllIpBlackList(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 查询用户黑名单列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAllUserBlackList") |
|||
@ApiOperation(value = "查询用户黑名单列表") |
|||
public Result<Page<CereRiskUserBlack>> getAllUserBlackList(@RequestBody CereRiskBlackPageParam param) throws CoBusinessException { |
|||
Page page=cereRiskBlackService.getUserBlackList(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 新增ip或用户黑名单 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "saveRiskBlack") |
|||
@ApiOperation(value = "新增ip或用户黑名单") |
|||
public Result<Integer> saveRiskBlack(@RequestBody CereRiskBlack param) throws CoBusinessException { |
|||
int result = cereRiskBlackService.save(param); |
|||
return new Result(result); |
|||
} |
|||
|
|||
/** |
|||
* 更新ip或用户黑名单 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "updateRiskBlack") |
|||
@ApiOperation(value = "更新ip或用户黑名单") |
|||
public Result<Integer> updateRiskBlack(@RequestBody CereRiskBlack param) throws CoBusinessException { |
|||
int result = cereRiskBlackService.update(param); |
|||
return new Result(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除ip或用户黑名单 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "deleteRiskBlack") |
|||
@ApiOperation(value = "删除ip或用户黑名单") |
|||
public Result<Integer> deleteRiskBlack(@RequestBody CereRiskBlack param) throws CoBusinessException { |
|||
int result = cereRiskBlackService.delete(param); |
|||
return new Result(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询规则列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAllRiskRule") |
|||
@ApiOperation(value = "查询规则列表") |
|||
public Result<Page<CereRiskRule>> getAllRiskRule(@RequestBody PageParam param) throws CoBusinessException { |
|||
Page page = cereRiskRuleService.getAllRiskRule(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 新增规则配置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "saveRiskRule") |
|||
@ApiOperation(value = "新增规则配置") |
|||
public Result<Integer> saveRiskRule(@RequestBody CereRiskRule param) throws CoBusinessException { |
|||
int result = cereRiskRuleService.save(param); |
|||
return new Result(result); |
|||
} |
|||
|
|||
/** |
|||
* 更新规则配置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "updateRiskRule") |
|||
@ApiOperation(value = "更新规则配置") |
|||
public Result<Integer> updateRiskRule(@RequestBody CereRiskRule param) throws CoBusinessException { |
|||
int result = cereRiskRuleService.update(param); |
|||
return new Result(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除规则配置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "deleteRiskRule") |
|||
@ApiOperation(value = "删除规则配置") |
|||
public Result<Integer> deleteRiskRule(@RequestBody CereRiskRule param) throws CoBusinessException { |
|||
int result = cereRiskRuleService.delete(param); |
|||
return new Result(result); |
|||
} |
|||
} |
@ -0,0 +1,143 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.permission.RolePermission; |
|||
import com.shop.cereshop.admin.param.role.*; |
|||
import com.shop.cereshop.admin.service.permission.CerePlatformPermissionService; |
|||
import com.shop.cereshop.admin.service.role.CerePlatformRoleService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.role.CerePlatformRole; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 角色 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("role") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "RoleController") |
|||
@Api(value = "角色模块", tags = "角色模块") |
|||
public class RoleController { |
|||
|
|||
@Autowired |
|||
private CerePlatformRoleService cerePlatformRoleService; |
|||
|
|||
@Autowired |
|||
private CerePlatformPermissionService cerePlatformPermissionService; |
|||
|
|||
/** |
|||
* 添加角色 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加角色") |
|||
@NoRepeatWebLog |
|||
public Result insert(@RequestBody @Validated RoleSaveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformRoleService.save(param,user); |
|||
return new Result(user.getUsername(),"添加角色", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改角色 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改角色") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody RoleUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformRoleService.update(param,user); |
|||
return new Result(user.getUsername(),"修改角色", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除角色 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除角色") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody RoleDeleteParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformRoleService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除角色", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 角色编辑查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "角色编辑查询") |
|||
public Result<CerePlatformRole> getById(@RequestBody RoleGetByIdParam role) throws CoBusinessException{ |
|||
CerePlatformRole cerePlatformRole=cerePlatformRoleService.getById(role.getRoleId()); |
|||
return new Result(cerePlatformRole); |
|||
} |
|||
|
|||
/** |
|||
* 角色管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "角色管理查询") |
|||
public Result<Page<CerePlatformRole>> getAll(@RequestBody RoleGetAllParam param) throws CoBusinessException{ |
|||
Page page =cerePlatformRoleService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 菜单分配 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "distribution") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "菜单分配") |
|||
@NoRepeatWebLog |
|||
public Result distribution(@RequestBody RoleDistributionParam param,HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformRoleService.distribution(param,user); |
|||
return new Result(user.getUsername(),"菜单分配", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 菜单分配查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getRolePermission") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "菜单分配查询") |
|||
public Result<RolePermission> getRolePermission(@RequestBody RoleDistributionParam param) throws CoBusinessException{ |
|||
RolePermission rolePermission=cerePlatformPermissionService.getRolePermission(param); |
|||
return new Result(rolePermission); |
|||
} |
|||
} |
@ -0,0 +1,203 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.seckill.*; |
|||
import com.shop.cereshop.admin.param.seckill.*; |
|||
import com.shop.cereshop.admin.service.platformtool.CerePlatformSeckillService; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.platformtool.CerePlatformSeckill; |
|||
import com.shop.cereshop.commons.domain.shop.ShopDataDetail; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.poi.ExcelUtils; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 平台秒杀活动管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("seckill") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "SeckillController") |
|||
@Api(value = "平台秒杀活动管理模块", tags = "平台秒杀活动管理模块") |
|||
public class SeckillController { |
|||
|
|||
@Autowired |
|||
private CerePlatformSeckillService cerePlatformSeckillService; |
|||
|
|||
/** |
|||
* 新增平台秒杀活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "新增平台秒杀活动") |
|||
@NoRepeatWebLog |
|||
public Result insert(@RequestBody @Validated SeckillSaveParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformSeckillService.save(param,user); |
|||
return new Result(user.getUsername(),"新增平台秒杀活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改平台秒杀活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改平台秒杀活动") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody @Validated SeckillUpdateParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformSeckillService.update(param,user); |
|||
return new Result(user.getUsername(),"修改平台秒杀活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除平台秒杀活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除平台秒杀活动") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody SeckillGetByIdParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformSeckillService.delete(param.getSeckillId(),user); |
|||
return new Result(user.getUsername(),"删除平台秒杀活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 停止平台秒杀活动 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "stop") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "停止平台秒杀活动") |
|||
@NoRepeatWebLog |
|||
public Result stop(@RequestBody SeckillGetByIdParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformSeckillService.stop(param.getSeckillId(),user); |
|||
return new Result(user.getUsername(),"停止平台秒杀活动", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 平台秒杀详情查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "平台秒杀详情查询查询") |
|||
public Result<CerePlatformSeckill> getById(@RequestBody SeckillGetByIdParam param) throws CoBusinessException{ |
|||
CerePlatformSeckill detail=cerePlatformSeckillService.getById(param.getSeckillId()); |
|||
return new Result(detail); |
|||
} |
|||
|
|||
/** |
|||
* 数据效果查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getData") |
|||
@ApiOperation(value = "数据效果查询") |
|||
public Result<SeckillData> getData(@RequestBody SeckillGetByIdParam param) throws CoBusinessException{ |
|||
SeckillData detail=cerePlatformSeckillService.getData(param); |
|||
return new Result(detail); |
|||
} |
|||
|
|||
/** |
|||
* 平台秒杀活动管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "平台秒杀活动管理查询") |
|||
public Result<Page<Seckill>> getAll(@RequestBody SeckillGetAllParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
Page page =cerePlatformSeckillService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 参与店铺查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getShops") |
|||
@ApiOperation(value = "参与店铺查询") |
|||
public Result<Page<SeckillShop>> getShops(@RequestBody SeckillShopParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
Page page=cerePlatformSeckillService.getShops(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 查看商品 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getProducts") |
|||
@ApiOperation(value = "查看商品") |
|||
public Result<Page<SeckillShopProduct>> getProducts(@RequestBody SeckillGetProductsParam param) throws CoBusinessException{ |
|||
Page page=cerePlatformSeckillService.getProducts(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 商家数据明细导出导出 |
|||
* @param param |
|||
* @param response |
|||
*/ |
|||
@PostMapping(value = "excel_shop_detail") |
|||
@ApiOperation(value = "商家数据明细导出导出") |
|||
public void excelShop(@RequestBody SeckillGetByIdParam param, HttpServletResponse response) throws CoBusinessException,Exception{ |
|||
List<ShopDataDetail> list=cerePlatformSeckillService.findExcel(param); |
|||
List<String> titles=new ArrayList<>(); |
|||
titles.add("商家名称"); |
|||
titles.add("店铺编码"); |
|||
titles.add("参与商品数"); |
|||
titles.add("访客数"); |
|||
titles.add("提交订单笔数"); |
|||
titles.add("成交笔数"); |
|||
titles.add("成交总额"); |
|||
XSSFWorkbook excel = ExcelUtils.createSeckillShopDetailExcel(titles, list); |
|||
Date date = new Date(); |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|||
String str = "订单管理表"+sdf.format(date); |
|||
response.setContentType("application/vnd.ms-excel;charset=utf-8"); |
|||
response.setHeader("Content-disposition", "attachment;filename=" + str +".xls");// 默认Excel名称 |
|||
response.flushBuffer(); |
|||
excel.write(response.getOutputStream()); |
|||
excel.close(); |
|||
} |
|||
} |
@ -0,0 +1,85 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.sensitive.SensitiveSaveParam; |
|||
import com.shop.cereshop.admin.param.sensitive.SensitiveUpdateParam; |
|||
import com.shop.cereshop.admin.service.sensitive.CerePlatformSensitiveService; |
|||
import com.shop.cereshop.commons.domain.sensitive.CerePlatformSensitive; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 敏感词管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("sensitive") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "SensitiveController") |
|||
@Api(value = "敏感词管理模块", tags = "敏感词管理模块") |
|||
public class SensitiveController { |
|||
|
|||
@Autowired |
|||
private CerePlatformSensitiveService cerePlatformSensitiveService; |
|||
|
|||
/** |
|||
* 添加敏感词设置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加敏感词设置") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated SensitiveSaveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformSensitiveService.save(param,user); |
|||
return new Result(user.getUsername(),"添加敏感词设置", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改敏感词设置 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改敏感词设置") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody SensitiveUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformSensitiveService.update(param,user); |
|||
return new Result(user.getUsername(),"修改敏感词设置", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 敏感词查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "get") |
|||
@ApiOperation(value = "敏感词查询") |
|||
public Result<List<CerePlatformSensitive>> get() throws CoBusinessException{ |
|||
List<CerePlatformSensitive> sensitive=cerePlatformSensitiveService.get(); |
|||
return new Result(sensitive); |
|||
} |
|||
} |
@ -0,0 +1,99 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.shop.Shop; |
|||
import com.shop.cereshop.admin.param.shopcheck.CheckDeleteParam; |
|||
import com.shop.cereshop.admin.param.shopcheck.CheckGetAllParam; |
|||
import com.shop.cereshop.admin.param.shopcheck.CheckGetByIdParam; |
|||
import com.shop.cereshop.admin.param.shopcheck.CheckHandleParam; |
|||
import com.shop.cereshop.admin.service.shop.CereShopCheckService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.HttpServletRequest; |
|||
|
|||
/** |
|||
* 入驻申请 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("check") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "ShopCheckController") |
|||
@Api(value = "入驻申请模块", tags = "入驻申请模块") |
|||
public class ShopCheckController { |
|||
|
|||
@Autowired |
|||
private CereShopCheckService cereShopCheckService; |
|||
|
|||
/** |
|||
* 入驻申请管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "入驻申请管理查询") |
|||
public Result<Page<Shop>> getAll(@RequestBody CheckGetAllParam param) throws CoBusinessException{ |
|||
Page page=cereShopCheckService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 查看 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "查看") |
|||
public Result<Shop> getById(@RequestBody CheckGetByIdParam param) throws CoBusinessException{ |
|||
Shop shop=cereShopCheckService.getById(param.getShopId()); |
|||
return new Result(shop); |
|||
} |
|||
|
|||
/** |
|||
* 处理入驻申请 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "handle") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "处理入驻申请") |
|||
@NoRepeatWebLog |
|||
public Result handle(@RequestBody CheckHandleParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereShopCheckService.handle(param,user); |
|||
return new Result(user.getUsername(),"处理入驻申请", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除入驻审核记录 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody CheckDeleteParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereShopCheckService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除入驻审核记录", GsonUtil.objectToGson(param)); |
|||
} |
|||
} |
@ -0,0 +1,151 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.page.shop.ShopGetAll; |
|||
import com.shop.cereshop.admin.param.shop.*; |
|||
import com.shop.cereshop.admin.service.shop.CerePlatformShopService; |
|||
import com.shop.cereshop.admin.utils.ContextUtil; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.shop.CerePlatformShop; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 商家 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("shop") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "ShopController") |
|||
@Api(value = "商家模块", tags = "商家模块") |
|||
public class ShopController { |
|||
|
|||
@Autowired |
|||
private CerePlatformShopService cerePlatformShopService; |
|||
|
|||
/** |
|||
* 新建商家 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "新建商家") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated ShopSaveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//校验商家名称是否存在 |
|||
CerePlatformShop shop=cerePlatformShopService.findByShopName(param.getShopName()); |
|||
if(shop!=null){ |
|||
return new Result(CoReturnFormat.SHOP_NAME_ALREADY); |
|||
} |
|||
//校验手机号是否已注册 |
|||
CerePlatformShop platformShop=cerePlatformShopService.findByPhone(param.getShopPhone()); |
|||
if(platformShop!=null){ |
|||
return new Result(CoReturnFormat.SHOP_PHONE_ALREADY); |
|||
} |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformShopService.save(param,user); |
|||
return new Result(user.getUsername(),"新建商家", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改商家 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改商家") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody ShopUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//校验商家名称是否存在 |
|||
CerePlatformShop shop=cerePlatformShopService.checkShopIdByName(param.getShopName(),param.getShopId()); |
|||
if(shop!=null){ |
|||
return new Result(CoReturnFormat.SHOP_NAME_ALREADY); |
|||
} |
|||
//校验手机号是否已注册 |
|||
CerePlatformShop platformShop=cerePlatformShopService.checkShopIdByPhone(param.getShopPhone(),param.getShopId()); |
|||
if(platformShop!=null){ |
|||
return new Result(CoReturnFormat.SHOP_PHONE_ALREADY); |
|||
} |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformShopService.update(param,user); |
|||
return new Result(user.getUsername(),"修改商家", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 启停用 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "start") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "启停用") |
|||
@NoRepeatWebLog |
|||
public Result start(@RequestBody ShopStartParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformShopService.startOrStop(param,user); |
|||
return new Result(user.getUsername(),"启停用", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 商家编辑查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "商家编辑查询") |
|||
public Result<ShopGetAll> getById(@RequestBody ShopGetByIdParam param) throws CoBusinessException,Exception{ |
|||
ShopGetAll shop=cerePlatformShopService.getById(param.getShopId()); |
|||
return new Result(shop); |
|||
} |
|||
|
|||
/** |
|||
* 商家管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "商家管理查询") |
|||
public Result<Page<ShopGetAll>> getAll(@RequestBody ShopGetAllParam param) throws CoBusinessException{ |
|||
Page page=cerePlatformShopService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 注销商家数据 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "cleanShop") |
|||
@ApiOperation(value = "注销商家数据") |
|||
public Result<Boolean> cleanShop(@RequestBody ShopGetByIdParam param) throws CoBusinessException{ |
|||
Boolean result = cerePlatformShopService.cleanShop(param.getShopId()); |
|||
return new Result(result); |
|||
} |
|||
} |
@ -0,0 +1,58 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.alioss.page.Url; |
|||
import com.shop.cereshop.admin.alioss.service.FileUploadService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.upload.strategy.FileStrategy; |
|||
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.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
/** |
|||
* 文件上传 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("file") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "UploadController") |
|||
@Api(value = "文件上传", tags = "文件上传") |
|||
public class UploadController { |
|||
|
|||
@Autowired |
|||
private FileStrategy fileStrategy; |
|||
|
|||
/** |
|||
* 文件上传 |
|||
* @param file |
|||
*/ |
|||
@PostMapping("upload") |
|||
@ApiOperation(value = "文件上传") |
|||
public Result<Url> upload(MultipartFile file) throws Exception{ |
|||
Result result=new Result(); |
|||
if(null != file){ |
|||
if(file.getOriginalFilename().contains("mp4")){ |
|||
//如果上传的视频,校验大小不能超过2M |
|||
if(file.getSize()>2048*1024){ |
|||
return new Result(CoReturnFormat.MP4_FILE_NOT_2M); |
|||
} |
|||
} |
|||
String url=fileStrategy.upload(file); |
|||
result=new Result(new Url(url)); |
|||
} |
|||
return result; |
|||
} |
|||
} |
@ -0,0 +1,79 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.withdrawal.WithdrawalGetAllParam; |
|||
import com.shop.cereshop.admin.param.withdrawal.WithdrawalGetByIdParam; |
|||
import com.shop.cereshop.admin.param.withdrawal.WithdrawalHandleParam; |
|||
import com.shop.cereshop.admin.service.shop.CereShopWithdrawalService; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.shop.CereShopWithdrawal; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.HttpServletRequest; |
|||
|
|||
/** |
|||
* 提现申请 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("withdrawal") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "WithdrawalController") |
|||
@Api(value = "提现申请模块", tags = "提现申请模块") |
|||
public class WithdrawalController { |
|||
|
|||
@Autowired |
|||
private CereShopWithdrawalService cereShopWithdrawalService; |
|||
|
|||
/** |
|||
* 提现申请查看 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "提现申请查看") |
|||
public Result<CereShopWithdrawal> getById(@RequestBody WithdrawalGetByIdParam param) throws CoBusinessException{ |
|||
CereShopWithdrawal withdrawal =cereShopWithdrawalService.getById(param.getWithdrawalId()); |
|||
return new Result(withdrawal); |
|||
} |
|||
|
|||
/** |
|||
* 提现申请处理 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "handle") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "提现申请处理") |
|||
@NoRepeatWebLog |
|||
public Result handle(@RequestBody WithdrawalHandleParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cereShopWithdrawalService.handle(param,user); |
|||
return new Result(user.getUsername(),"提现申请处理", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 提现申请管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "提现申请管理查询") |
|||
public Result<Page<CereShopWithdrawal>> getAll(@RequestBody WithdrawalGetAllParam param) throws CoBusinessException{ |
|||
Page page =cereShopWithdrawalService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
} |
@ -0,0 +1,137 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.word.WordParam; |
|||
import com.shop.cereshop.admin.service.word.CerePlatformWordService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.dict.CerePlatformDict; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.domain.word.CerePlatformWord; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 关键词 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("word") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "WordController") |
|||
@Api(value = "关键词", tags = "关键词") |
|||
public class WordController { |
|||
|
|||
@Autowired |
|||
private CerePlatformWordService cerePlatformWordService; |
|||
|
|||
/** |
|||
* 添加关键词 |
|||
* @param word |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加关键词") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated CerePlatformWord word, HttpServletRequest request) throws CoBusinessException{ |
|||
//校验关键词 |
|||
CerePlatformWord cerePlatformWord=cerePlatformWordService.checkWord(word.getKeyWord(),null); |
|||
if(cerePlatformWord!=null){ |
|||
return new Result(CoReturnFormat.KEY_WORD_ALREADY); |
|||
} |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformWordService.save(word,user); |
|||
return new Result(user.getUsername(),"添加关键词", GsonUtil.objectToGson(word)); |
|||
} |
|||
|
|||
/** |
|||
* 修改关键词 |
|||
* @param word |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改关键词") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody CerePlatformWord word, HttpServletRequest request) throws CoBusinessException{ |
|||
//校验关键词 |
|||
CerePlatformWord cerePlatformWord=cerePlatformWordService.checkWord(word.getKeyWord(),word.getWordId()); |
|||
if(cerePlatformWord!=null){ |
|||
return new Result(CoReturnFormat.KEY_WORD_ALREADY); |
|||
} |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformWordService.update(word,user); |
|||
return new Result(user.getUsername(),"修改关键词", GsonUtil.objectToGson(word)); |
|||
} |
|||
|
|||
/** |
|||
* 删除关键词 |
|||
* @param word |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除关键词") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody CerePlatformWord word, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformWordService.delete(word,user); |
|||
return new Result(user.getUsername(),"删除关键词", GsonUtil.objectToGson(word)); |
|||
} |
|||
|
|||
/** |
|||
* 关键词修改查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "关键词修改查询") |
|||
public Result<CerePlatformDict> getById(@RequestBody CerePlatformWord word) throws CoBusinessException{ |
|||
CerePlatformWord cerePlatformWord=cerePlatformWordService.getById(word.getWordId()); |
|||
return new Result(cerePlatformWord); |
|||
} |
|||
|
|||
/** |
|||
* 关键词管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "关键词管理查询") |
|||
public Result<Page<CerePlatformWord>> getAll(@RequestBody WordParam param) throws CoBusinessException{ |
|||
Page page =cerePlatformWordService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 启停用 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "start") |
|||
@ApiOperation(value = "启停用") |
|||
@NoRepeatWebLog |
|||
public Result start(@RequestBody CerePlatformWord word, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
cerePlatformWordService.start(word.getState()); |
|||
return new Result(user.getUsername(),"启停用", GsonUtil.objectToGson(word)); |
|||
} |
|||
} |
@ -0,0 +1,455 @@ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.config.WxWorkProperties; |
|||
import com.shop.cereshop.admin.dao.customer_service.CereCustomerServiceConfigDAO; |
|||
import com.shop.cereshop.admin.pay.weixin.skd.IOUtils; |
|||
import com.shop.cereshop.admin.pay.weixin.skd.PaymentKit; |
|||
import com.shop.cereshop.admin.redis.service.api.StringRedisService; |
|||
import com.shop.cereshop.admin.third.weixin.WXBizMsgCrypt; |
|||
import com.shop.cereshop.admin.utils.ContextUtil; |
|||
import com.shop.cereshop.commons.constant.WxCpConstants; |
|||
import com.shop.cereshop.commons.utils.TimeUtils; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import me.chanjar.weixin.common.api.WxConsts; |
|||
import me.chanjar.weixin.common.bean.WxAccessToken; |
|||
import me.chanjar.weixin.cp.api.WxCpKfService; |
|||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl; |
|||
import me.chanjar.weixin.cp.bean.WxCpTpPermanentCodeInfo; |
|||
import me.chanjar.weixin.cp.bean.kf.*; |
|||
import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfEventMsg; |
|||
import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfTextMsg; |
|||
import me.chanjar.weixin.cp.bean.message.WxCpTpXmlMessage; |
|||
import me.chanjar.weixin.cp.constant.WxCpTpConsts; |
|||
import me.chanjar.weixin.cp.tp.service.WxCpTpService; |
|||
import me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil; |
|||
import me.chanjar.weixin.cp.util.crypto.WxCpTpCryptUtil; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
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.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.Map; |
|||
|
|||
import static com.shop.cereshop.commons.constant.WxCpConstants.MSG_CURSOR; |
|||
|
|||
/** |
|||
* 企业微信对接模块 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("wxWork") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "WxWorkController") |
|||
@Api(value = "企业微信对接模块", tags = "企业微信对接模块") |
|||
public class WxWorkController { |
|||
|
|||
@Autowired |
|||
private WxWorkProperties wxWorkProperties; |
|||
|
|||
@Autowired |
|||
private WxCpTpService wxCpTpService; |
|||
|
|||
@Autowired |
|||
private WxCpServiceImpl wxCpService; |
|||
|
|||
@Autowired |
|||
private CereCustomerServiceConfigDAO cereCustomerServiceConfigDAO; |
|||
|
|||
@Autowired |
|||
private StringRedisService stringRedisService; |
|||
|
|||
/** |
|||
* 回调 |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "callback",method = {RequestMethod.POST,RequestMethod.GET}) |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "回调") |
|||
@NoRepeatWebLog |
|||
public String callback(HttpServletRequest request, HttpServletResponse resp) throws Exception { |
|||
ContextUtil.clearAdmin(); |
|||
/**url中的签名**/ |
|||
String signature = request.getParameter("msg_signature"); |
|||
/**url中的时间戳*/ |
|||
String timestamp = request.getParameter("timestamp"); |
|||
/** url中的随机字符串 **/ |
|||
String nonce = request.getParameter("nonce"); |
|||
/** 创建套件时验证回调url有效性时传入**/ |
|||
String echoStr = request.getParameter("echostr"); |
|||
|
|||
String logPrefix = "callback-- "; |
|||
|
|||
log.info(logPrefix + "signature: {}, timestamp: {}, nonce: {}, echostr: {}", signature, timestamp, nonce, echoStr); |
|||
|
|||
if (StringUtils.isNotBlank(echoStr)) { |
|||
WXBizMsgCrypt wxcpt = new WXBizMsgCrypt(wxWorkProperties.getToken(), wxWorkProperties.getAesKey(), wxWorkProperties.getCorpId()); |
|||
String sEchoStr = wxcpt.VerifyURL(signature, timestamp, nonce, echoStr); |
|||
log.info("sEchoStr {}", sEchoStr); |
|||
return sEchoStr; |
|||
} |
|||
|
|||
try { |
|||
WxCpCryptUtil cryptUtil = new WxCpCryptUtil(wxCpService.getWxCpConfigStorage()); |
|||
String encryptedXml = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8); |
|||
String decryptedXml = cryptUtil.decrypt(signature, timestamp, nonce, encryptedXml); |
|||
log.info(logPrefix + "decryptedXml: {}", decryptedXml); |
|||
|
|||
Map<String, String> messageMap = PaymentKit.xmlToMap(decryptedXml); |
|||
String msgType = messageMap.get("MsgType"); |
|||
|
|||
//WxCpXmlMessage inMessage = WxCpXmlMessage.fromXml(decryptedXml, wxCpService.getWxCpConfigStorage().getCorpId()); |
|||
WxCpKfService kfService = wxCpService.getKfService(); |
|||
switch(msgType) { |
|||
case WxConsts.XmlMsgType.EVENT: |
|||
String nextCursor = (String)stringRedisService.get(MSG_CURSOR); |
|||
boolean hasMore = true; |
|||
while (hasMore) { |
|||
WxCpKfMsgListResp kfMsgListResp = kfService.syncMsg(nextCursor, messageMap.get("token"), null, null); |
|||
//log.info("kfMsgListResp {}", JSON.toJSONString(kfMsgListResp)); |
|||
|
|||
for (WxCpKfMsgListResp.WxCpKfMsgItem msgItem:kfMsgListResp.getMsgList()) { |
|||
String innerMsgType = msgItem.getMsgType(); |
|||
if ("event".equals(innerMsgType) && msgItem.getOrigin() == 4) { |
|||
WxCpKfEventMsg eventMsg = msgItem.getEvent(); |
|||
if ("enter_session".equals(eventMsg.getEventType())) { |
|||
String openKfId = eventMsg.getOpenKfid(); |
|||
String externalUserId = eventMsg.getExternalUserId(); |
|||
String welcomeCode = eventMsg.getWelcomeCode(); |
|||
try { |
|||
WxCpKfServiceStateResp stateResp = kfService.getServiceState(openKfId, externalUserId); |
|||
log.info("stateResp {} {} {} {}", openKfId, externalUserId, welcomeCode, stateResp.getServiceState()); |
|||
if (stateResp.getServiceState() == 0 || stateResp.getServiceState() == 1) { |
|||
if (StringUtils.isNotBlank(welcomeCode)) { |
|||
//发送只能客服欢迎语 |
|||
WxCpKfMsgSendRequest sendRequest = new WxCpKfMsgSendRequest(); |
|||
sendRequest.setCode(welcomeCode); |
|||
sendRequest.setMsgType("text"); |
|||
WxCpKfTextMsg msg = new WxCpKfTextMsg(); |
|||
msg.setContent("欢迎咨询,正在为您安排客服人员,请稍候!"); |
|||
sendRequest.setText(msg); |
|||
WxCpKfMsgSendResp sendResp = kfService.sendMsgOnEvent(sendRequest); |
|||
log.info("sendResp errcode {}, errmsg {}", sendResp.getErrcode(), sendResp.getErrmsg()); |
|||
} |
|||
WxCpKfServiceStateTransResp transResp = kfService.transServiceState(openKfId, externalUserId, 2, null); |
|||
log.info("transResp {}", transResp); |
|||
} |
|||
} catch (Exception e) { |
|||
log.error("transServiceState fail {}", e.getMessage(), e); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
Integer msgHasMore = kfMsgListResp.getHasMore(); |
|||
hasMore = msgHasMore != null && msgHasMore == 1; |
|||
nextCursor = kfMsgListResp.getNextCursor(); |
|||
} |
|||
stringRedisService.set(MSG_CURSOR, nextCursor); |
|||
break; |
|||
} |
|||
|
|||
|
|||
|
|||
/*WxCpTpXmlMessage inMessage = WxCpTpXmlMessage.fromXml(decryptedXml); |
|||
switch(inMessage.getInfoType()) { |
|||
case WxCpTpConsts.InfoType.SUITE_TICKET: |
|||
refreshSuiteTicket(inMessage, logPrefix); |
|||
break; |
|||
case WxCpTpConsts.InfoType.CREATE_AUTH: |
|||
authCallback(inMessage, logPrefix); |
|||
break; |
|||
case WxCpTpConsts.InfoType.CHANGE_AUTH: |
|||
log.info(logPrefix + "change auth"); |
|||
break; |
|||
case WxCpTpConsts.InfoType.CANCEL_AUTH: |
|||
log.info(logPrefix + "cancel auth"); |
|||
clearAuthCallback(inMessage, logPrefix); |
|||
break; |
|||
default: |
|||
log.info(logPrefix + "unknown info_type: {}", inMessage.getInfoType()); |
|||
}*/ |
|||
|
|||
} catch (Exception e) { |
|||
log.error(logPrefix + "commandCallback fail: " + e.getMessage(), e); |
|||
} |
|||
|
|||
return "success"; |
|||
} |
|||
|
|||
/** |
|||
* 指令回调 |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "commandCallback",method = {RequestMethod.POST,RequestMethod.GET}) |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "指令回调") |
|||
@NoRepeatWebLog |
|||
public String commandCallback(HttpServletRequest request, HttpServletResponse resp) throws Exception { |
|||
ContextUtil.clearAdmin(); |
|||
/**url中的签名**/ |
|||
String msgSignature = request.getParameter("msg_signature"); |
|||
/**url中的时间戳*/ |
|||
String timestamp = request.getParameter("timestamp"); |
|||
/** url中的随机字符串 **/ |
|||
String nonce = request.getParameter("nonce"); |
|||
/** 创建套件时验证回调url有效性时传入**/ |
|||
String echoStr = request.getParameter("echostr"); |
|||
|
|||
String logPrefix = "commandCallback-- "; |
|||
|
|||
log.info(logPrefix + "msgSignature: {}, timestamp: {}, nonce: {}, echoStr: {}", msgSignature, timestamp, nonce, echoStr); |
|||
|
|||
if (StringUtils.isNotBlank(echoStr)) { |
|||
WXBizMsgCrypt wxcpt = new WXBizMsgCrypt(wxWorkProperties.getToken(), wxWorkProperties.getAesKey(), wxWorkProperties.getCorpId()); |
|||
String sEchoStr = wxcpt.VerifyURL(msgSignature, timestamp, nonce, echoStr); |
|||
log.info(logPrefix + "sEchoStr {}", sEchoStr); |
|||
return sEchoStr; |
|||
} |
|||
|
|||
try { |
|||
WxCpTpCryptUtil cryptUtil = new WxCpTpCryptUtil(wxCpTpService.getWxCpTpConfigStorage()); |
|||
String encryptedXml = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8); |
|||
String decryptedXml = cryptUtil.decrypt(msgSignature, timestamp, nonce, encryptedXml); |
|||
log.info(logPrefix + "decryptedXml: {}", decryptedXml); |
|||
|
|||
/*WxCpTpXmlMessage inMessage = WxCpTpXmlMessage.fromXml(decryptedXml); |
|||
switch(inMessage.getInfoType()) { |
|||
case WxCpTpConsts.InfoType.SUITE_TICKET: |
|||
refreshSuiteTicket(inMessage, logPrefix); |
|||
break; |
|||
case WxCpTpConsts.InfoType.CREATE_AUTH: |
|||
authCallback(inMessage, logPrefix); |
|||
break; |
|||
case WxCpTpConsts.InfoType.CHANGE_AUTH: |
|||
log.info(logPrefix + "change auth"); |
|||
break; |
|||
case WxCpTpConsts.InfoType.CANCEL_AUTH: |
|||
log.info(logPrefix + "cancel auth"); |
|||
clearAuthCallback(inMessage, logPrefix); |
|||
break; |
|||
default: |
|||
log.info(logPrefix + "unknown info_type: {}", inMessage.getInfoType()); |
|||
}*/ |
|||
|
|||
} catch (Exception e) { |
|||
log.error(logPrefix + "commandCallback fail: " + e.getMessage(), e); |
|||
} |
|||
|
|||
return "success"; |
|||
} |
|||
|
|||
/** |
|||
* 第三方相关指令回调 |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "thirdPartyCommandCallback",method = {RequestMethod.POST,RequestMethod.GET}) |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "第三方相关指令回调") |
|||
@NoRepeatWebLog |
|||
public String thirdPartyCommandCallback(HttpServletRequest request) throws Exception { |
|||
ContextUtil.clearAdmin(); |
|||
/**url中的签名**/ |
|||
String msgSignature = request.getParameter("msg_signature"); |
|||
/**url中的时间戳*/ |
|||
String timestamp = request.getParameter("timestamp"); |
|||
/** url中的随机字符串 **/ |
|||
String nonce = request.getParameter("nonce"); |
|||
/** 创建套件时验证回调url有效性时传入**/ |
|||
String echoStr = request.getParameter("echostr"); |
|||
|
|||
String logPrefix = "thirdPartyCommandCallback-- "; |
|||
|
|||
log.info(logPrefix + "msgSignature: {}, timestamp: {}, nonce: {}, echoStr: {}", msgSignature, timestamp, nonce, echoStr); |
|||
|
|||
if (StringUtils.isNotBlank(echoStr)) { |
|||
WXBizMsgCrypt wxcpt = new WXBizMsgCrypt(wxWorkProperties.getToken(), wxWorkProperties.getAesKey(), wxWorkProperties.getCorpId()); |
|||
String sEchoStr = wxcpt.VerifyURL(msgSignature, timestamp, nonce, echoStr); |
|||
log.info(logPrefix + "sEchoStr {}", sEchoStr); |
|||
return sEchoStr; |
|||
} |
|||
|
|||
try { |
|||
WxCpTpCryptUtil cryptUtil = new WxCpTpCryptUtil(wxCpTpService.getWxCpTpConfigStorage()); |
|||
String encryptedXml = IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8); |
|||
String decryptedXml = cryptUtil.decrypt(msgSignature, timestamp, nonce, encryptedXml); |
|||
log.info(logPrefix + "decryptedXml: {}", decryptedXml); |
|||
WxCpTpXmlMessage inMessage = WxCpTpXmlMessage.fromXml(decryptedXml); |
|||
switch(inMessage.getInfoType()) { |
|||
case WxCpTpConsts.InfoType.SUITE_TICKET: |
|||
refreshSuiteTicket(inMessage, logPrefix); |
|||
break; |
|||
case WxCpTpConsts.InfoType.CREATE_AUTH: |
|||
authCallback(inMessage, logPrefix); |
|||
break; |
|||
case WxCpTpConsts.InfoType.CHANGE_AUTH: |
|||
log.info(logPrefix + "change auth"); |
|||
break; |
|||
case WxCpTpConsts.InfoType.CANCEL_AUTH: |
|||
log.info(logPrefix + "cancel auth"); |
|||
clearAuthCallback(inMessage, logPrefix); |
|||
break; |
|||
default: |
|||
log.info(logPrefix + "unknown info_type: {}", inMessage.getInfoType()); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
log.error(logPrefix + "commandCallback fail: " + e.getMessage(), e); |
|||
} |
|||
|
|||
return "success"; |
|||
} |
|||
|
|||
/** |
|||
* 获取ip段 |
|||
* @return |
|||
*/ |
|||
@RequestMapping(value = "getIpList", method = {RequestMethod.POST,RequestMethod.GET}) |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "获取ip段") |
|||
@NoRepeatWebLog |
|||
public String getIpList(HttpServletRequest request, HttpServletResponse resp) throws Exception { |
|||
try { |
|||
String suiteTicket = (String)stringRedisService.get(WxCpConstants.SUITE_TICKET_KEY); |
|||
wxCpTpService.setSuiteTicket(suiteTicket); |
|||
String result = wxCpTpService.get(WxCpConstants.GET_IP_LIST, null); |
|||
log.info("result1: {}" + result); |
|||
} catch (Exception e) { |
|||
log.error("result1: " + e.getMessage(),e); |
|||
} |
|||
|
|||
try { |
|||
WxAccessToken token = wxCpTpService.getCorpToken("xxx", "xxx", true); |
|||
String result = wxCpTpService.get(WxCpConstants.GET_IP_LIST + "?access_token=" + token.getAccessToken(), null, true); |
|||
log.info("result2: {}" + result); |
|||
} catch (Exception e) { |
|||
log.error("result2: " + e.getMessage(),e); |
|||
} |
|||
return ""; |
|||
} |
|||
|
|||
/** |
|||
* 刷新suiteTicket |
|||
* @param xmlMessage |
|||
* @param logPrefix |
|||
*/ |
|||
private void refreshSuiteTicket(WxCpTpXmlMessage xmlMessage, String logPrefix) { |
|||
try { |
|||
if (StringUtils.isNotBlank(xmlMessage.getSuiteTicket())) { |
|||
log.info(logPrefix + "suiteTicket: {}", xmlMessage.getSuiteTicket()); |
|||
wxCpTpService.setSuiteTicket(xmlMessage.getSuiteTicket()); |
|||
//将suiteTicket设置到缓存 |
|||
stringRedisService.set(WxCpConstants.SUITE_TICKET_KEY, xmlMessage.getSuiteTicket()); |
|||
} |
|||
/* |
|||
String result = wxCpTpService.get(wxCpTpService.getWxCpTpConfigStorage().getApiUrl(WxCpApiPathConsts.Tp.GET_PREAUTH_CODE), null); |
|||
WxCpTpPreauthCode preAuthCode = WxCpTpPreauthCode.fromJson(result); |
|||
log.info("preAuthCode: {}", preAuthCode.getPreAuthCode());*/ |
|||
} catch (Exception e) { |
|||
log.error(logPrefix + "refreshSuiteTicket fail: " + e.getMessage(), e); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 更新授权回调 |
|||
* @param xmlMessage |
|||
* @param logPrefix |
|||
*/ |
|||
private void authCallback(WxCpTpXmlMessage xmlMessage, String logPrefix) { |
|||
try { |
|||
String shopId = xmlMessage.getState(); |
|||
WxCpTpPermanentCodeInfo permanentCodeInfo = wxCpTpService.getPermanentCodeInfo(xmlMessage.getAuthCode()); |
|||
log.info("permanentCodeInfo: {}", JSON.toJSONString(permanentCodeInfo)); |
|||
|
|||
String permanentCode = permanentCodeInfo.getPermanentCode(); |
|||
String authCorpId = permanentCodeInfo.getAuthCorpInfo().getCorpId(); |
|||
cereCustomerServiceConfigDAO.updatePermanentCode(Long.valueOf(shopId), permanentCode, authCorpId); |
|||
|
|||
} catch (Exception e) { |
|||
log.error(logPrefix + "authCallback " + e.getMessage(), e); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 解除授权回调 |
|||
* @param xmlMessage |
|||
* @param logPrefix |
|||
*/ |
|||
private void clearAuthCallback(WxCpTpXmlMessage xmlMessage, String logPrefix) { |
|||
try { |
|||
String authCorpId = xmlMessage.getAuthCorpId(); |
|||
cereCustomerServiceConfigDAO.clearAuthInfo(authCorpId, TimeUtils.yyMMddHHmmss()); |
|||
} catch (Exception e) { |
|||
log.error(logPrefix + "clearAuthCallback " + e.getMessage(), e); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 授权跳转 |
|||
* @return |
|||
*/ |
|||
/* @GetMapping(value = "authRedirect") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "授权跳转") |
|||
@NoRepeatWebLog |
|||
public void authRedirect(HttpServletRequest request) throws Exception { |
|||
String authCode = request.getParameter("auth_code"); |
|||
String state = request.getParameter("state"); |
|||
String decodeState = URLDecoder.decode(state, "UTF-8"); |
|||
String permanentCode = ""; |
|||
// 1 |
|||
try { |
|||
|
|||
log.info("authRedirect: authCode = {}, state = {}, decodeState = {}", authCode, state, decodeState); |
|||
WxCpTpPermanentCodeInfo permanentCodeInfo = wxCpTpService.getPermanentCodeInfo(authCode); |
|||
log.info("permanentCodeInfo: {}", JSON.toJSONString(permanentCodeInfo)); |
|||
permanentCode = permanentCodeInfo.getPermanentCode(); |
|||
|
|||
} catch (Exception e) { |
|||
log.error("authRedirect error: " + e.getMessage(), e); |
|||
} |
|||
|
|||
// 2 |
|||
try { |
|||
|
|||
WxCpTpAuthInfo authInfo = wxCpTpService.getAuthInfo(authCorpId, permanentCode); |
|||
log.info("authInfo: {}", JSON.toJSONString(authInfo)); |
|||
|
|||
} catch (Exception e) { |
|||
log.error("authRedirect2 error: " + e.getMessage(), e); |
|||
} |
|||
|
|||
// 3 |
|||
try { |
|||
|
|||
String authCorpJsApiTicket = wxCpTpService.getAuthCorpJsApiTicket(authCorpId, true); |
|||
log.info("authCorpJsApiTicket: {}", authCorpJsApiTicket); |
|||
|
|||
} catch (Exception e) { |
|||
log.error("authRedirect3 error: " + e.getMessage(), e); |
|||
} |
|||
|
|||
// 4 |
|||
try { |
|||
|
|||
WxAccessToken corpToken = wxCpTpService.getCorpToken(authCorpId, permanentCode); |
|||
log.info("corpToken: {}", corpToken); |
|||
|
|||
String result = wxCpTpService.get(WxCpConstants.API_KF_LIST, "access_token=" + corpToken); |
|||
log.info("corpKf: {}", result); |
|||
|
|||
} catch (Exception e) { |
|||
log.error("authRedirect4 error: " + e.getMessage(), e); |
|||
} |
|||
} |
|||
*/ |
|||
} |
@ -0,0 +1,39 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.activity; |
|||
|
|||
import com.shop.cereshop.admin.page.finance.ShopBond; |
|||
import com.shop.cereshop.admin.param.finance.BondParam; |
|||
import com.shop.cereshop.commons.domain.activity.CereActivitySign; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface CereActivitySignDAO extends BaseMapper<CereActivitySign> { |
|||
int deleteByPrimaryKey(Long signId); |
|||
|
|||
int insertSelective(CereActivitySign record); |
|||
|
|||
CereActivitySign selectByPrimaryKey(Long signId); |
|||
|
|||
int updateByPrimaryKeySelective(CereActivitySign record); |
|||
|
|||
int updateByPrimaryKey(CereActivitySign record); |
|||
|
|||
CereActivitySign findBySignId(@Param("signId") Long signId); |
|||
|
|||
List<ShopBond> getAllBond(BondParam param); |
|||
|
|||
String findTransactionId(@Param("formid") String formid); |
|||
|
|||
BigDecimal findBondTotal(); |
|||
|
|||
Integer findActivityState(@Param("activityId") Long activityId); |
|||
} |
@ -0,0 +1,140 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.activity; |
|||
|
|||
import com.shop.cereshop.admin.page.activity.*; |
|||
import com.shop.cereshop.admin.page.canvas.CanvasCoupon; |
|||
import com.shop.cereshop.admin.page.canvas.CanvasCouponDetail; |
|||
import com.shop.cereshop.admin.page.canvas.ShopGroupWorkUDetail; |
|||
import com.shop.cereshop.admin.page.canvas.ToolProduct; |
|||
import com.shop.cereshop.admin.page.product.ShopProduct; |
|||
import com.shop.cereshop.admin.param.activity.*; |
|||
import com.shop.cereshop.admin.param.canvas.CanvasCouponParam; |
|||
import com.shop.cereshop.admin.param.canvas.RenovationParam; |
|||
import com.shop.cereshop.commons.domain.activity.CereActivitySign; |
|||
import com.shop.cereshop.commons.domain.activity.CerePlatformActivity; |
|||
import com.shop.cereshop.commons.domain.pay.CerePayLog; |
|||
import com.shop.cereshop.commons.domain.product.CereProductClassify; |
|||
import com.shop.cereshop.commons.domain.shop.ShopDetail; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface CerePlatformActivityDAO extends BaseMapper<CerePlatformActivity> { |
|||
int deleteByPrimaryKey(Long activityId); |
|||
|
|||
ActivityDetail getById(@Param("activityId") Long activityId); |
|||
|
|||
List<Activity> getAll(ActivityGetAllParam param); |
|||
|
|||
Integer findProductNumber(@Param("activityId") Long activityId); |
|||
|
|||
List<ShopActivity> getShops(ActivityGetShopsParam param); |
|||
|
|||
Integer findExamine(@Param("shopId") Long shopId,@Param("activityId") Long activityId); |
|||
|
|||
List<ShopProduct> getProducts(ActivityGetProductsParam param); |
|||
|
|||
List<SignExamineLog> getExamines(ActivityGetExaminesParam param); |
|||
|
|||
List<ActivityBond> getAdminBonds(ActivityGetAdminBondsParam param); |
|||
|
|||
BigDecimal getBondTotal(); |
|||
|
|||
CerePlatformActivity findById(@Param("activityId") Long activityId); |
|||
|
|||
ActivityData findActivityData(CerePlatformActivity activity); |
|||
|
|||
Integer findBusiness(CerePlatformActivity activity); |
|||
|
|||
Integer findProducts(CerePlatformActivity activity); |
|||
|
|||
List<Proportion> findCities(CerePlatformActivity activity); |
|||
|
|||
List<Proportion> findCityPeople(CerePlatformActivity activity); |
|||
|
|||
Proportion findNews(CerePlatformActivity activity); |
|||
|
|||
Proportion findOlds(CerePlatformActivity activity); |
|||
|
|||
Proportion findAPP(CerePlatformActivity activity); |
|||
|
|||
Proportion findApplets(CerePlatformActivity activity); |
|||
|
|||
Proportion findAdroid(CerePlatformActivity activity); |
|||
|
|||
Proportion findIos(CerePlatformActivity activity); |
|||
|
|||
BigDecimal findTrendMoney(@Param("activityId") Long activityId,@Param("time") String time); |
|||
|
|||
Integer findTrendTotal(@Param("activityId") Long activityId,@Param("time") String time); |
|||
|
|||
List<ShopRanking> findShopRankings(CerePlatformActivity activity); |
|||
|
|||
List<CereProductClassify> findClassifies(); |
|||
|
|||
BigDecimal findTotalByClassify(@Param("classifyId") Long classifyId,@Param("activityId") Long activityId, |
|||
@Param("activityStartTime") String activityStartTime,@Param("activityEndTime") String activityEndTime); |
|||
|
|||
List<ProductRanking> findProductRankings(CerePlatformActivity activity); |
|||
|
|||
List<ShopDetail> findShops(ActivityGetDatasParam param); |
|||
|
|||
Integer findShopProducts(@Param("shopId") Long shopId,@Param("activityId") Long activityId, |
|||
@Param("activityStartTime") String activityStartTime,@Param("activityEndTime") String activityEndTime); |
|||
|
|||
Integer findShopPersons(@Param("shopId") Long shopId,@Param("activityId") Long activityId, |
|||
@Param("activityStartTime") String activityStartTime,@Param("activityEndTime") String activityEndTime); |
|||
|
|||
Integer findShopOrders(@Param("shopId") Long shopId,@Param("activityId") Long activityId, |
|||
@Param("activityStartTime") String activityStartTime,@Param("activityEndTime") String activityEndTime); |
|||
|
|||
Integer findShopCustomers(@Param("shopId") Long shopId,@Param("activityId") Long activityId, |
|||
@Param("activityStartTime") String activityStartTime,@Param("activityEndTime") String activityEndTime); |
|||
|
|||
BigDecimal findShopTotal(@Param("shopId") Long shopId,@Param("activityId") Long activityId, |
|||
@Param("activityStartTime") String activityStartTime,@Param("activityEndTime") String activityEndTime); |
|||
|
|||
List<CerePlatformActivity> checkTime(ActivitySaveParam param); |
|||
|
|||
Integer findIfBondBySignId(@Param("signId") Long signId); |
|||
|
|||
CereActivitySign checkSignError(CereActivitySign activitySign); |
|||
|
|||
CereActivitySign findSign(@Param("signId") String signId); |
|||
|
|||
CerePayLog findBondPayLog(@Param("formid") String formid); |
|||
|
|||
List<Long> findSignIdsByShopIdAndActivityId(@Param("shopId") Long shopId,@Param("activityId") Long activityId,@Param("signType") int signType); |
|||
|
|||
List<CereActivitySign> findByActivity(@Param("activityId") Long activityId); |
|||
|
|||
List<CereActivitySign> findErrorSign(@Param("activityId") Long activityId); |
|||
|
|||
Integer findIfBond(@Param("activityId") Long activityId); |
|||
|
|||
void updateSignStateError(@Param("list") List<CereActivitySign> list); |
|||
|
|||
List<CanvasCoupon> getCoupons(CanvasCouponParam param); |
|||
|
|||
List<CanvasCouponDetail> findDetai(@Param("activityId") Long activityId); |
|||
|
|||
List<CerePlatformActivity> checkUpdateTime(ActivityUpdateParam param); |
|||
|
|||
Integer findSeckillIfBondBySignId(@Param("signId") Long signId); |
|||
|
|||
Integer findDiscountIfBondBySignId(@Param("signId") Long signId); |
|||
|
|||
List<ShopGroupWorkUDetail> getGroupWorks(RenovationParam param); |
|||
|
|||
List<ToolProduct> findDistinctProducts(@Param("shopGroupWorkId") Long shopGroupWorkId); |
|||
|
|||
List<ToolProduct> getGroupWorkProducts(RenovationParam param); |
|||
} |
@ -0,0 +1,23 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.activity; |
|||
|
|||
import com.shop.cereshop.commons.domain.activity.CerePlatformActivityDetail; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface CerePlatformActivityDetailDAO extends BaseMapper<CerePlatformActivityDetail> { |
|||
|
|||
int insertSelective(CerePlatformActivityDetail record); |
|||
|
|||
void deleteByActivityId(@Param("activityId") Long activityId); |
|||
|
|||
List<CerePlatformActivityDetail> findByActivityId(@Param("activityId") Long activityId); |
|||
} |
@ -0,0 +1,23 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.activity; |
|||
|
|||
import com.shop.cereshop.commons.domain.activity.CereSignProduct; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface CereSignProductDAO extends BaseMapper<CereSignProduct> { |
|||
|
|||
int insertSelective(CereSignProduct record); |
|||
|
|||
void deleteBySignId(@Param("signId") Long signId); |
|||
|
|||
List<CereSignProduct> selectSignProductList(@Param("signType") Integer signType, @Param("activityId") Long activityId); |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.shop.cereshop.admin.dao.admin; |
|||
|
|||
import com.shop.cereshop.admin.param.admin.StatsAmountByDay; |
|||
import com.shop.cereshop.admin.param.admin.StatsByDay; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface AdminDAO { |
|||
|
|||
List<StatsByDay> selectUserCount(@Param("startTime") String startTime, @Param("endTime") String endTime); |
|||
|
|||
List<StatsByDay> selectVisitCount(@Param("startTime") String startTime, @Param("endTime") String endTime); |
|||
|
|||
List<StatsByDay> selectVisitUserCount(@Param("startTime") String startTime, @Param("endTime") String endTime); |
|||
|
|||
List<StatsByDay> selectShopCount(@Param("startTime") String startTime, @Param("endTime") String endTime); |
|||
|
|||
List<StatsAmountByDay> selectOrderAmountList(@Param("startTime") String startTime, @Param("endTime") String endTime); |
|||
|
|||
List<StatsByDay> selectOrderCountList(@Param("startTime") String startTime, @Param("endTime") String endTime); |
|||
|
|||
Integer selectOrderCountSum(@Param("startTime") String startTime, @Param("endTime") String endTime); |
|||
|
|||
List<StatsByDay> selectPayUserCountList(@Param("startTime") String startTime, @Param("endTime") String endTime); |
|||
|
|||
Integer selectPayUserCountSum(@Param("startTime") String startTime, @Param("endTime") String endTime); |
|||
} |
@ -0,0 +1,30 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.advert; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.shop.cereshop.admin.param.advert.CerePopupAdvertParam; |
|||
import com.shop.cereshop.commons.domain.advert.CerePopupAdvert; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* <p> |
|||
* Mapper 接口 |
|||
* 弹窗广告表 |
|||
* </p> |
|||
* |
|||
* @author JustArgo |
|||
* @date 2021-12-04 |
|||
*/ |
|||
@Mapper |
|||
public interface CerePopupAdvertDAO extends BaseMapper<CerePopupAdvert> { |
|||
|
|||
List<CerePopupAdvert> getAll(CerePopupAdvertParam advert); |
|||
|
|||
int checkConflict(CerePopupAdvert advert); |
|||
} |
@ -0,0 +1,22 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.after; |
|||
|
|||
import com.shop.cereshop.commons.domain.after.CereAfterProduct; |
|||
import com.shop.cereshop.commons.domain.after.CereAfterProductAttribute; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface CereAfterProductDAO extends BaseMapper<CereAfterProduct> { |
|||
|
|||
int insertSelective(CereAfterProduct record); |
|||
|
|||
void insertBatchAttibutes(@Param("list") List<CereAfterProductAttribute> list); |
|||
} |
@ -0,0 +1,56 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.after; |
|||
|
|||
import com.shop.cereshop.admin.page.after.*; |
|||
import com.shop.cereshop.admin.param.after.AfterGetAllParam; |
|||
import com.shop.cereshop.commons.domain.after.CereOrderAfter; |
|||
import com.shop.cereshop.commons.domain.order.CereOrderProduct; |
|||
import com.shop.cereshop.commons.domain.product.CereProductSku; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface CereOrderAfterDAO extends BaseMapper<CereOrderAfter> { |
|||
int deleteByPrimaryKey(Long afterId); |
|||
|
|||
int insertSelective(CereOrderAfter record); |
|||
|
|||
CereOrderAfter selectByPrimaryKey(Long afterId); |
|||
|
|||
int updateByPrimaryKeySelective(CereOrderAfter record); |
|||
|
|||
int updateByPrimaryKey(CereOrderAfter record); |
|||
|
|||
List<After> getAll(AfterGetAllParam param); |
|||
|
|||
AfterDetail getById(@Param("afterId") Long afterId); |
|||
|
|||
List<AfterProduct> findProducts(@Param("afterId") Long afterId); |
|||
|
|||
List<AfterHistory> findHistories(@Param("afterId") Long afterId); |
|||
|
|||
AfterHistory findAdminHistory(@Param("afterId") Long afterId); |
|||
|
|||
AfterBuyer getBuyer(@Param("buyerUserId") Long buyerUserId); |
|||
|
|||
Integer findSuccessAfter(@Param("buyerUserId") Long buyerUserId); |
|||
|
|||
CereOrderAfter findByOrderId(@Param("orderId") Long orderId); |
|||
|
|||
Integer findExpress(); |
|||
|
|||
AfterRefund findOrderPay(@Param("afterId") Long afterId); |
|||
|
|||
List<CereOrderProduct> findOtherProductsByAfterId(@Param("orderId") Long orderId,@Param("afterId") Long afterId); |
|||
|
|||
List<CereProductSku> findAfterSkus(@Param("afterId") Long afterId); |
|||
|
|||
CereOrderAfter findById(@Param("afterId") Long afterId); |
|||
} |
@ -0,0 +1,19 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.after; |
|||
|
|||
import com.shop.cereshop.commons.domain.after.CerePlatformAfter; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface CerePlatformAfterDAO extends BaseMapper<CerePlatformAfter> { |
|||
|
|||
int insertSelective(CerePlatformAfter record); |
|||
|
|||
void updateAfter(CerePlatformAfter cerePlatformAfter); |
|||
|
|||
} |
@ -0,0 +1,9 @@ |
|||
package com.shop.cereshop.admin.dao.brand; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.shop.cereshop.commons.domain.brand.Brand; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface BrandDAO extends BaseMapper<Brand> { |
|||
} |
@ -0,0 +1,20 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.business; |
|||
|
|||
import com.shop.cereshop.commons.domain.business.CereBusinessShop; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface CereBusinessShopDAO extends BaseMapper<CereBusinessShop> { |
|||
|
|||
int insertSelective(CereBusinessShop record); |
|||
|
|||
List<Long> selectAllProject(); |
|||
} |
@ -0,0 +1,16 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.business; |
|||
|
|||
import com.shop.cereshop.commons.domain.business.CereBusinessUserRole; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface CereBusinessUserRoleDAO extends BaseMapper<CereBusinessUserRole> { |
|||
|
|||
int insertSelective(CereBusinessUserRole record); |
|||
} |
@ -0,0 +1,27 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.business; |
|||
|
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface CerePlatformBusinessDAO extends BaseMapper<CerePlatformBusiness> { |
|||
int deleteByPrimaryKey(Long businessUserId); |
|||
|
|||
int insertSelective(CerePlatformBusiness record); |
|||
|
|||
CerePlatformBusiness selectByPrimaryKey(Long businessUserId); |
|||
|
|||
int updateByPrimaryKeySelective(CerePlatformBusiness record); |
|||
|
|||
int updateByPrimaryKey(CerePlatformBusiness record); |
|||
|
|||
Long findProjectByUsername(String username); |
|||
|
|||
CerePlatformBusiness findByPhone(String phone); |
|||
} |
@ -0,0 +1,17 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.buyer; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.shop.cereshop.commons.domain.buyer.CereBuyerPlatformDiscountVisit; |
|||
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface CereBuyerPlatformDiscountVisitDAO extends BaseMapper<CereBuyerUser> { |
|||
|
|||
int insertSelective(CereBuyerPlatformDiscountVisit record); |
|||
} |
@ -0,0 +1,17 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.dao.buyer; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.shop.cereshop.commons.domain.buyer.CereBuyerPlatformSeckillVisit; |
|||
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface CereBuyerPlatformSeckillVisitDAO extends BaseMapper<CereBuyerUser> { |
|||
|
|||
int insertSelective(CereBuyerPlatformSeckillVisit record); |
|||
} |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue