Import complete SCRM project
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
# ---> Java
|
||||
*.class
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
# ---> Maven
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn
|
||||
mvnw
|
||||
mvnw.cmd
|
||||
|
||||
# ---> Eclipse
|
||||
*.pydevproject
|
||||
.metadata
|
||||
.gradle
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# Eclipse Core
|
||||
.project
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
# ---> JetBrains
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
|
||||
|
||||
*.iml
|
||||
|
||||
## Directory-based project format:
|
||||
.idea/
|
||||
# if you remove the above rule, at least ignore the following:
|
||||
|
||||
# User-specific stuff:
|
||||
# .idea/workspace.xml
|
||||
# .idea/tasks.xml
|
||||
# .idea/dictionaries
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
# .idea/dataSources.ids
|
||||
# .idea/dataSources.xml
|
||||
# .idea/sqlDataSources.xml
|
||||
# .idea/dynamic.xml
|
||||
# .idea/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
# .idea/gradle.xml
|
||||
# .idea/libraries
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
# .idea/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,3 @@
|
||||
# contractbotbackend
|
||||
|
||||
contractbot backend
|
||||
@@ -0,0 +1,204 @@
|
||||
<?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>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.4.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>io.icchain</groupId>
|
||||
<artifactId>wxcontractbot</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>wxcontractbot</name>
|
||||
<description>wxcontractbot</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<poi.version>4.1.0</poi.version>
|
||||
<elasticsearch.version>7.8.0</elasticsearch.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.coobird</groupId>
|
||||
<artifactId>thumbnailator</artifactId>
|
||||
<version>0.4.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>19.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>4.1.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<version>2.2.3</version>
|
||||
<classifier>jdk15</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.3.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.47</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bladejava</groupId>
|
||||
<artifactId>blade-patchca</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>[7.2.0, 7.2.99]</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.14.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>happy-dns-java</artifactId>
|
||||
<version>0.1.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>26.0-jre</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.yy/android-util -->
|
||||
<dependency>
|
||||
<groupId>com.yy</groupId>
|
||||
<artifactId>android-util</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>2.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.15</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>backend</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright 2019-2108 ICC (Intelligence Commerce Chain, https://icchain.io).
|
||||
* *
|
||||
* * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* * you may not use this file except in compliance with the License.
|
||||
* * You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing, software
|
||||
* * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* * See the License for the specific language governing permissions and
|
||||
* * limitations under the License.
|
||||
*
|
||||
*/
|
||||
package io.icchain.wxcontractbot;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.im.agent.api.MsgCache;
|
||||
import io.icchain.wxcontractbot.job.*;
|
||||
import io.icchain.wxcontractbot.utils.MysqlUtil;
|
||||
import io.icchain.wxcontractbot.utils.RedisUtils;
|
||||
import io.icchain.wxcontractbot.utils.jedis.RedisUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
/**
|
||||
* @ClassName: AppRunner
|
||||
* @Description: TODO
|
||||
* @date: 2019年5月11日 下午4:20:01
|
||||
*/
|
||||
@Component
|
||||
public class AppRunner implements ApplicationRunner {
|
||||
private static final Logger log = LoggerFactory.getLogger(AppRunner.class.getName());
|
||||
|
||||
@Autowired
|
||||
public MysqlUtil mysql;
|
||||
|
||||
|
||||
@Autowired
|
||||
public RedisUtil redisUtils;
|
||||
|
||||
@Autowired(required = false)
|
||||
public RedisUtils redisUtilsTemplate;
|
||||
/*
|
||||
* @Title: run
|
||||
* @Description: TODO
|
||||
* @param args
|
||||
* @throws Exception
|
||||
* @see org.springframework.boot.ApplicationRunner#run(org.springframework.boot.ApplicationArguments)
|
||||
*/
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
|
||||
MysqlUtil.util = mysql;
|
||||
MysqlUtil.util.cSrv.redisUtil=redisUtils;
|
||||
if (redisUtilsTemplate != null) {
|
||||
MsgCache.setRedisUtils(redisUtilsTemplate);
|
||||
}
|
||||
MessageSendJob.start();
|
||||
JoinFriendsJob.start();
|
||||
JoinFriendsJob.startCheckStatus();
|
||||
JoinFriendsJob.deleteInvalidData();
|
||||
JoinFriendsJob.updateJoinFriendsStatus();
|
||||
MysqlUtil.util.cSrv.initSpamMessageCache();
|
||||
BotFriendsJob.start();
|
||||
WxIdMappingUpdateJob.start();
|
||||
BotOnlineStatusCheckJob.start();
|
||||
|
||||
// 注册关闭钩子,确保应用关闭时正确释放资源
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
log.info("Application is shutting down, cleaning up resources...");
|
||||
shutdownAllJobs();
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用关闭时清理所有资源
|
||||
*/
|
||||
@PreDestroy
|
||||
public void cleanup() {
|
||||
shutdownAllJobs();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭所有定时任务的线程池
|
||||
*/
|
||||
private void shutdownAllJobs() {
|
||||
try {
|
||||
MessageSendJob.shutdown();
|
||||
} catch (Exception e) {
|
||||
log.error("Error shutting down MessageSendJob", e);
|
||||
}
|
||||
try {
|
||||
JoinFriendsJob.shutdown();
|
||||
} catch (Exception e) {
|
||||
log.error("Error shutting down JoinFriendsJob", e);
|
||||
}
|
||||
try {
|
||||
BotFriendsJob.shutdown();
|
||||
} catch (Exception e) {
|
||||
log.error("Error shutting down BotFriendsJob", e);
|
||||
}
|
||||
try {
|
||||
WxIdMappingUpdateJob.shutdown();
|
||||
} catch (Exception e) {
|
||||
log.error("Error shutting down WxIdMappingUpdateJob", e);
|
||||
}
|
||||
try {
|
||||
BotOnlineStatusCheckJob.shutdown();
|
||||
} catch (Exception e) {
|
||||
log.error("Error shutting down BotOnlineStatusCheckJob", e);
|
||||
}
|
||||
log.info("All jobs shutdown completed");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.icchain.wxcontractbot;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
@EnableSwagger2
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package io.icchain.wxcontractbot.config;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Des : 获取spring上下文配置
|
||||
*
|
||||
* @Date : 2019/9/10 11:02
|
||||
* @Author : Lgo
|
||||
* @return :
|
||||
* @param : null
|
||||
*/
|
||||
@Component
|
||||
public class ApplicationContextProvider implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext ctx = null;
|
||||
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return ctx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(final ApplicationContext ctx) throws BeansException {
|
||||
ApplicationContextProvider.ctx = ctx;
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package io.icchain.wxcontractbot.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@Component
|
||||
public class CorsInterceptor implements Filter {
|
||||
|
||||
@Value("${allow.domain}")
|
||||
private String allowDomain;
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletResponse response = (HttpServletResponse) res;
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
|
||||
String[] allowDomainArray = allowDomain.split(",");
|
||||
Set<String> allowedOrigins = new HashSet<String>(Arrays.asList(allowDomainArray));
|
||||
String originHeader = request.getHeader("Origin");
|
||||
if (allowedOrigins.contains(originHeader)) {
|
||||
response.setHeader("Access-Control-Allow-Origin", originHeader);
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
|
||||
response.setHeader("Access-Control-Max-Age", "3600");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Content-type");
|
||||
}
|
||||
|
||||
chain.doFilter(req, res);
|
||||
}
|
||||
public void init(FilterConfig filterConfig) {}
|
||||
public void destroy() {}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package io.icchain.wxcontractbot.config;
|
||||
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icchain.wxcontractbot.config GlobalExceptionHandler
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2020/5/19 14:44
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
private Logger logger= LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public BaseResponse defaultErrorHandler(HttpServletRequest request, Exception exception) throws Exception {
|
||||
BaseResponse baseResponse=new BaseResponse();
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("服务出现了异常,请联系开发人员!");
|
||||
logger.error("全局拦截出现了异常:{},{}",request,exception);
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package io.icchain.wxcontractbot.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
|
||||
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@Configuration
|
||||
public class LocaleConfig implements WebMvcConfigurer {
|
||||
|
||||
@Bean
|
||||
public LocaleResolver localeResolver() {
|
||||
SessionLocaleResolver slr = new SessionLocaleResolver();
|
||||
slr.setDefaultLocale(Locale.CHINA);
|
||||
return slr;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LocaleChangeInterceptor localeChangeInterceptor() {
|
||||
LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
|
||||
lci.setParamName("lang");
|
||||
return lci;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(localeChangeInterceptor());
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package io.icchain.wxcontractbot.config;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.icchain.wxcontractbot.utils.Const;
|
||||
import io.icchain.wxcontractbot.utils.MsgUtil;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
public class LoginInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
HttpSession session = request.getSession();
|
||||
if (StringUtils.isEmpty(session.getAttribute(Const.currentLoginUserId))) {
|
||||
buildResponse(response, 401, MsgUtil.getMessage("notLogin"));
|
||||
return false;
|
||||
}
|
||||
if (request.getRequestURI().toLowerCase().startsWith("/admin/")) {
|
||||
Object userType = session.getAttribute(Const.currentLoginUserType);
|
||||
if (userType == null || !userType.toString().equals("admin")) {
|
||||
buildResponse(response, 402, MsgUtil.getMessage("insufficientPermission"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void buildResponse(HttpServletResponse response, Integer code, String message) throws Exception {
|
||||
|
||||
String res = JSONUtil.toJsonStr(new BaseResponse(){{
|
||||
setSuccess(false);
|
||||
setError_code(code);
|
||||
setError_message(message);
|
||||
}});
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
response.getWriter().write(res);
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package io.icchain.wxcontractbot.config;
|
||||
/*
|
||||
* 描述信息
|
||||
* 模块编号: RestTemplateConfig
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2023/10/14
|
||||
* 修改编号:1
|
||||
* 描 述:描述信息
|
||||
*/
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icchain.wxcontractbot.config RestTemplateConfig
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2023/10/14 22:31
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Configuration
|
||||
public class RestTemplateConfig {
|
||||
|
||||
/** 连接超时(毫秒),避免连不上时一直阻塞 */
|
||||
private static final int CONNECT_TIMEOUT_MS = 10_000;
|
||||
/** 读取超时(毫秒),避免 gewe 等外部接口慢时拖死 /cmd 请求 */
|
||||
private static final int READ_TIMEOUT_MS = 30_000;
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setConnectTimeout(CONNECT_TIMEOUT_MS);
|
||||
factory.setReadTimeout(READ_TIMEOUT_MS);
|
||||
factory.setChunkSize(Integer.MAX_VALUE);
|
||||
RestTemplate restTemplate = new RestTemplate(factory);
|
||||
restTemplate.getMessageConverters().add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8));
|
||||
return restTemplate;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package io.icchain.wxcontractbot.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.session.data.redis.config.ConfigureRedisAction;
|
||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||
import org.springframework.session.web.http.CookieSerializer;
|
||||
import org.springframework.session.web.http.DefaultCookieSerializer;
|
||||
|
||||
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 86400)
|
||||
public class SpringSessionConfig {
|
||||
|
||||
public SpringSessionConfig() {}
|
||||
|
||||
@Bean
|
||||
public CookieSerializer httpSessionIdResolver() {
|
||||
DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer();
|
||||
cookieSerializer.setSameSite(null);
|
||||
return cookieSerializer;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public static ConfigureRedisAction configureRedisAction() {
|
||||
return ConfigureRedisAction.NO_OP;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.icchain.wxcontractbot.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
@Configuration
|
||||
public class Swagger2 {
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("io.icchain"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.version("1.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.icchain.wxcontractbot.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new LoginInterceptor())
|
||||
.excludePathPatterns("/service/webjars/**")
|
||||
.excludePathPatterns("/service/swagger/**")
|
||||
.excludePathPatterns("/service/swagger-ui.html")
|
||||
.excludePathPatterns("/service/v2/api-docs/**")
|
||||
.excludePathPatterns("/service/swagger-resources/**")
|
||||
.excludePathPatterns("/service/user/captcha")
|
||||
.excludePathPatterns("/service/user/smscode")
|
||||
.excludePathPatterns("/service/user/emailcode")
|
||||
.excludePathPatterns("/service/user/register/**")
|
||||
.excludePathPatterns("/service/user/resetPassword/**")
|
||||
.excludePathPatterns("/service/user/login/**")
|
||||
.excludePathPatterns("/service/user/logout")
|
||||
.excludePathPatterns("/service/iqa/answer")
|
||||
.excludePathPatterns("/service/welcome/queryByChatId")
|
||||
.excludePathPatterns("/service/pullGroup/queryByContent")
|
||||
.addPathPatterns("/service/**");
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
|
||||
*/
|
||||
package io.icchain.wxcontractbot.controller;
|
||||
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class BaseController {
|
||||
|
||||
/**
|
||||
* 日志对象
|
||||
*/
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
|
||||
/**
|
||||
* 添加Model消息
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
protected void addMessage(Model model, String... messages) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String message : messages) {
|
||||
sb.append(message).append(messages.length > 1 ? "<br/>" : "");
|
||||
}
|
||||
model.addAttribute("message", sb.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加Flash消息
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
protected void addMessage(RedirectAttributes redirectAttributes, String... messages) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String message : messages) {
|
||||
sb.append(message).append(messages.length > 1 ? "<br/>" : "");
|
||||
}
|
||||
redirectAttributes.addFlashAttribute("message", sb.toString());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 客户端返回字符串
|
||||
*
|
||||
* @param response
|
||||
* @param string
|
||||
* @return
|
||||
*/
|
||||
protected String sendMsg(HttpServletResponse response, String string) {
|
||||
try {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.getWriter().print(string);
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getParameter(HttpServletRequest request, String key, String defaultVal) {
|
||||
String val = request.getParameter(key);
|
||||
return StringUtils.isEmpty(val) ? defaultVal : val;
|
||||
}
|
||||
|
||||
protected Integer getInt(HttpServletRequest request, String key, Integer defaultVal) {
|
||||
String val = request.getParameter(key);
|
||||
if (StringUtils.isEmpty(val)) {
|
||||
return defaultVal;
|
||||
}
|
||||
return Integer.parseInt(val);
|
||||
}
|
||||
|
||||
protected Integer getInt(HttpServletRequest request, String key) {
|
||||
return getInt(request, key, null);
|
||||
}
|
||||
|
||||
protected Double getDouble(HttpServletRequest request, String key, Double defaultVal) {
|
||||
String val = request.getParameter(key);
|
||||
if (StringUtils.isEmpty(val)) {
|
||||
return defaultVal;
|
||||
}
|
||||
return Double.parseDouble(val);
|
||||
}
|
||||
|
||||
protected Double getDouble(HttpServletRequest request, String key) {
|
||||
return getDouble(request, key, null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package io.icchain.wxcontractbot.controller;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class HealthController {
|
||||
@GetMapping("/health")
|
||||
public ResponseEntity<String> health() {
|
||||
return ResponseEntity.ok("OK");
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package io.icchain.wxcontractbot.controller.accurate.add.friends;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriendsBot;
|
||||
import io.icchain.wxcontractbot.service.accurate.add.friends.AccurateAddFriendsBotService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 精确加粉机器人表(io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriendsBot)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-04 12:02:01
|
||||
*/
|
||||
@Api(tags = "精确加粉-机器人表")
|
||||
@RestController
|
||||
@RequestMapping("accurateAddFriendsBot")
|
||||
public class AccurateAddFriendsBotController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private AccurateAddFriendsBotService accurateAddFriendsBotService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param accurateAddFriendsBot
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:01
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(AccurateAddFriendsBot accurateAddFriendsBot) {
|
||||
BaseResponse baseResponse = accurateAddFriendsBotService.add(accurateAddFriendsBot);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param accurateAddFriendsBotList
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:01
|
||||
*/
|
||||
@ApiOperation("批量新增")
|
||||
@RequestMapping(value = "addList", method = {RequestMethod.POST})
|
||||
public BaseResponse addList(@RequestBody List<AccurateAddFriendsBot> accurateAddFriendsBotList) {
|
||||
BaseResponse baseResponse = accurateAddFriendsBotService.addList(accurateAddFriendsBotList);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:01
|
||||
*/
|
||||
@ApiOperation("根据ID删除")
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse = accurateAddFriendsBotService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param accurateAddFriendsBot
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:01
|
||||
*/
|
||||
@ApiOperation("更新")
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(AccurateAddFriendsBot accurateAddFriendsBot) {
|
||||
BaseResponse baseResponse = accurateAddFriendsBotService.update(accurateAddFriendsBot);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:01
|
||||
*/
|
||||
@ApiOperation("分页获取信息")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(String addFriendsId,@PageableDefault(value = 20, page = 0) Pageable pageable) {
|
||||
return accurateAddFriendsBotService.list(addFriendsId,pageable);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package io.icchain.wxcontractbot.controller.accurate.add.friends;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriendsComment;
|
||||
import io.icchain.wxcontractbot.service.accurate.add.friends.AccurateAddFriendsCommentService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 精准加粉文案表(AccurateAddFriendsComment)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-04 13:24:44
|
||||
*/
|
||||
@Api(tags = "精准加粉-文案表")
|
||||
@RestController
|
||||
@RequestMapping("accurateAddFriendsComment")
|
||||
public class AccurateAddFriendsCommentController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private AccurateAddFriendsCommentService accurateAddFriendsCommentService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param accurateAddFriendsComment
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 13:24:44
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(AccurateAddFriendsComment accurateAddFriendsComment) {
|
||||
BaseResponse baseResponse = accurateAddFriendsCommentService.add(accurateAddFriendsComment);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param commentList
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 13:24:44
|
||||
*/
|
||||
@ApiOperation("批量新增")
|
||||
@RequestMapping(value = "addList", method = {RequestMethod.POST})
|
||||
public BaseResponse addList(@RequestBody List<AccurateAddFriendsComment> commentList) {
|
||||
BaseResponse baseResponse = accurateAddFriendsCommentService.addList(commentList);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 13:24:44
|
||||
*/
|
||||
@ApiOperation("根据ID删除")
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse = accurateAddFriendsCommentService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param accurateAddFriendsComment
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 13:24:44
|
||||
*/
|
||||
@ApiOperation("更新")
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(AccurateAddFriendsComment accurateAddFriendsComment) {
|
||||
BaseResponse baseResponse = accurateAddFriendsCommentService.update(accurateAddFriendsComment);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 13:24:44
|
||||
*/
|
||||
@ApiOperation("分页获取信息")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(String addFriendsId,@PageableDefault(value = 20, page = 0,sort = {"sortNum"},direction = Sort.Direction.ASC) Pageable pageable) {
|
||||
return accurateAddFriendsCommentService.list(addFriendsId,pageable);
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package io.icchain.wxcontractbot.controller.accurate.add.friends;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriends;
|
||||
import io.icchain.wxcontractbot.service.accurate.add.friends.AccurateAddFriendsService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 精准加粉配置表(AccurateAddFriends)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-04 12:02:24
|
||||
*/
|
||||
@Api(tags = "精准加粉主表")
|
||||
@RestController
|
||||
@RequestMapping("accurateAddFriends")
|
||||
public class AccurateAddFriendsController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private AccurateAddFriendsService accurateAddFriendsService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param accurateAddFriends
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:24
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(AccurateAddFriends accurateAddFriends) {
|
||||
BaseResponse baseResponse = accurateAddFriendsService.add(accurateAddFriends);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param accurateAddFriends
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:24
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@RequestMapping(value = "addAll", method = {RequestMethod.POST})
|
||||
public BaseResponse addAll(@RequestBody AccurateAddFriends accurateAddFriends) {
|
||||
BaseResponse baseResponse = accurateAddFriendsService.addAll(accurateAddFriends);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:24
|
||||
*/
|
||||
@ApiOperation("根据ID删除")
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse = accurateAddFriendsService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param accurateAddFriends
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:24
|
||||
*/
|
||||
@ApiOperation("更新")
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(AccurateAddFriends accurateAddFriends) {
|
||||
BaseResponse baseResponse = accurateAddFriendsService.update(accurateAddFriends);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:24
|
||||
*/
|
||||
@ApiOperation("分页获取信息")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 20, page = 0,sort = {"createDate"},direction = Sort.Direction.DESC) Pageable pageable) {
|
||||
return accurateAddFriendsService.list(pageable);
|
||||
}
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package io.icchain.wxcontractbot.controller.accurate.add.friends;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriendsUser;
|
||||
import io.icchain.wxcontractbot.service.accurate.add.friends.AccurateAddFriendsUserService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 精准加粉用户列表(AccurateAddFriendsUser)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-04 12:02:12
|
||||
*/
|
||||
@Api(tags = "精准加粉-用户列表")
|
||||
@RestController
|
||||
@RequestMapping("accurateAddFriendsUser")
|
||||
public class AccurateAddFriendsUserController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private AccurateAddFriendsUserService accurateAddFriendsUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param accurateAddFriendsUser
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:12
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(AccurateAddFriendsUser accurateAddFriendsUser) {
|
||||
BaseResponse baseResponse = accurateAddFriendsUserService.add(accurateAddFriendsUser);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:12
|
||||
*/
|
||||
@ApiOperation("根据ID删除")
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse = accurateAddFriendsUserService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param accurateAddFriendsUser
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:12
|
||||
*/
|
||||
@ApiOperation("更新")
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(AccurateAddFriendsUser accurateAddFriendsUser) {
|
||||
BaseResponse baseResponse = accurateAddFriendsUserService.update(accurateAddFriendsUser);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:12
|
||||
*/
|
||||
@ApiOperation("分页获取信息")
|
||||
@RequestMapping(value = "list", method = { RequestMethod.POST})
|
||||
public BaseResponse list(AccurateAddFriendsUser user,@PageableDefault(value = 20, page = 0) Pageable pageable) {
|
||||
return accurateAddFriendsUserService.list(user,pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统计信息
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:12
|
||||
*/
|
||||
@ApiOperation("获取统计信息")
|
||||
@RequestMapping(value = "getCount", method = { RequestMethod.POST})
|
||||
public BaseResponse getCount(@RequestBody AccurateAddFriendsUser user) {
|
||||
return accurateAddFriendsUserService.getCount(user);
|
||||
}
|
||||
/**
|
||||
* 导入用户信息
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-04 12:02:12
|
||||
*/
|
||||
@ApiOperation("导入用户,支持xls,xlsx两种格式")
|
||||
@RequestMapping(value = "importUser", method = {RequestMethod.POST})
|
||||
@ResponseBody
|
||||
public BaseResponse importUser(@RequestParam MultipartFile file) {
|
||||
return accurateAddFriendsUserService.importUser(file);
|
||||
}
|
||||
}
|
||||
+283
@@ -0,0 +1,283 @@
|
||||
package io.icchain.wxcontractbot.controller.agent;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.service.agent.BotService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.icchain.wxcontractbot.utils.HttpUtil;
|
||||
import io.icchain.wxcontractbot.utils.jedis.RedisUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "bot", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class BotController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BotService botService;
|
||||
@Value("${bot.agent.api.url}")
|
||||
private String botAgentApiUrl;
|
||||
|
||||
@Value("${BOT_KEY}")
|
||||
private String botKey;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(BotController.class);
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(Pageable pageable) {
|
||||
return botService.list(pageable);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "all", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse all() {
|
||||
return botService.all();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "search", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse search(@RequestParam(value = "keyword", defaultValue = "") String keyword,
|
||||
@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "pagesize", defaultValue = "10") int pagesize) {
|
||||
return botService.search(keyword, page, pagesize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改机器人头像头像
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "setBotAvatar", method = RequestMethod.POST)
|
||||
public String setBotAvatar(String botId, String img) {
|
||||
List<NameValuePair> nvp = new ArrayList<>();
|
||||
nvp.add(new BasicNameValuePair("botId", botId));
|
||||
nvp.add(new BasicNameValuePair("img", img));
|
||||
try {
|
||||
return HttpUtil.postRequest(botAgentApiUrl + "setBotAvatar", nvp);
|
||||
} catch (Exception ex) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(false);
|
||||
log.info("setBotAvatar error:{}", ex);
|
||||
return JSON.toJSONString(baseResponse);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置机器人昵称
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "setBotNickname", method = RequestMethod.POST)
|
||||
public String setBotNickname(String botId, String nickname) {
|
||||
List<NameValuePair> nvp = new ArrayList<>();
|
||||
nvp.add(new BasicNameValuePair("botId", botId));
|
||||
nvp.add(new BasicNameValuePair("nickname", nickname));
|
||||
try {
|
||||
return HttpUtil.postRequest(botAgentApiUrl + "setBotNickname", nvp);
|
||||
} catch (Exception ex) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(false);
|
||||
log.info("setBotNickname error:{}", ex);
|
||||
return JSON.toJSONString(baseResponse);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自己的二维码
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "getQrcode", method = RequestMethod.POST)
|
||||
public BaseResponse getQrcode(String botId) {
|
||||
return botService.getQrcode(botId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新二维码
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "updateQrcode", method = RequestMethod.POST)
|
||||
public BaseResponse updateQrcode(String botId) {
|
||||
return botService.updateQrcode(botId);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/uploadQrcode",method = {RequestMethod.POST,RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public BaseResponse uploadImage(@RequestParam(value = "file") MultipartFile file,String wxId) throws Exception {
|
||||
if(StringUtils.isEmpty(wxId)){
|
||||
return new BaseResponse("wxId不能为空!");
|
||||
}
|
||||
if (file == null || "".equals(file)) {
|
||||
return new BaseResponse("文件不能为空!");
|
||||
}
|
||||
if (file.getSize() > 0.2 * 1024 * 1024) {
|
||||
return new BaseResponse("文件大小不能超过200KB!");
|
||||
}
|
||||
byte[] imgBytes = file.getBytes();
|
||||
String encodingStr = org.apache.commons.codec.binary.Base64.encodeBase64String(imgBytes);
|
||||
botService.uploadQrCode(encodingStr,wxId);
|
||||
return new BaseResponse(true,"",encodingStr);
|
||||
}
|
||||
/**
|
||||
* 退群
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "quitChat", method = RequestMethod.POST)
|
||||
public String quitChat(String botId, String chatId) {
|
||||
List<NameValuePair> nvp = new ArrayList<>();
|
||||
nvp.add(new BasicNameValuePair("botId", botId));
|
||||
nvp.add(new BasicNameValuePair("chatId", chatId));
|
||||
try {
|
||||
BaseResponse baseResponse = commonService.quitChat(botId, chatId);
|
||||
if (baseResponse.getSuccess() == false) {
|
||||
return JSON.toJSONString(baseResponse);
|
||||
}
|
||||
return HttpUtil.postRequest(botAgentApiUrl + "quitChat", nvp);
|
||||
} catch (Exception ex) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message(ex.getMessage());
|
||||
log.info("quitChat error:{}", ex.getMessage());
|
||||
return JSON.toJSONString(baseResponse);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请机器人进群
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "joinChat", method = RequestMethod.POST)
|
||||
public BaseResponse joinChat(String botId, String chatId) {
|
||||
BaseResponse baseResponse = commonService.joinChat(botId, chatId);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* 邀请机器人进群
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "getAllBotInfo", method = RequestMethod.POST)
|
||||
public BaseResponse getAllBotInfo() {
|
||||
BaseResponse baseResponse = commonService.getAllBotInfo();
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
@RequestMapping("setBotRemind")
|
||||
public BaseResponse setBotRemind(String botWxId, Integer chatCount, String maxChatResp) {
|
||||
chatCount = (chatCount == null ? 50 : chatCount);
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
if (StringUtils.isEmpty(botWxId)) {
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("机器人ID不能为空!");
|
||||
return baseResponse;
|
||||
}
|
||||
String botUrl = getBotUrl(botWxId);
|
||||
if (StringUtils.isEmpty(botUrl)) {
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("更新机器人配置失败!");
|
||||
return baseResponse;
|
||||
}
|
||||
if (!botService.updateBotConfig(botWxId, chatCount, maxChatResp)) {
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("更新机器人配置失败!");
|
||||
return baseResponse;
|
||||
}
|
||||
String server = botUrl.split("_")[0];
|
||||
botNotice(server, botWxId, "{\"max_chat\":" + chatCount + ",\"max_chat_exceed_msg\":\"" + maxChatResp + "\"}");
|
||||
baseResponse.setData("修改成功");
|
||||
baseResponse.setSuccess(true);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
@RequestMapping("getEditStatus")
|
||||
public BaseResponse getEditStatus() {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
if ("wxim_wxids".equals(botKey)) {
|
||||
baseResponse.setData(true);
|
||||
} else {
|
||||
baseResponse.setData(false);
|
||||
}
|
||||
baseResponse.setSuccess(true);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
|
||||
public String getBotUrl(String wxId) {
|
||||
try {
|
||||
Map<String, String> botMap = redisUtil.hgetAll(botKey);
|
||||
String botInfo = botMap.get(wxId);
|
||||
return JSON.parseObject(botInfo).getString("status");
|
||||
} catch (Exception ex) {
|
||||
log.info("getBotUrl error:{},{}", wxId, ex.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String botNotice(String server, String wxid, String copywriting) {
|
||||
if (server == null || server.isEmpty()) {
|
||||
log.warn("server is null, {}", wxid);
|
||||
return null;
|
||||
}
|
||||
|
||||
String url = "http://" + server + "/api/v1/cmd";
|
||||
|
||||
HashMap<String, String> bodyInfo = new HashMap<>();
|
||||
bodyInfo.put("wxid", wxid);
|
||||
bodyInfo.put("cmdType", "updateConfig");
|
||||
bodyInfo.put("config", copywriting);
|
||||
String body = JSON.toJSONString(bodyInfo);
|
||||
|
||||
log.info("群主请求参数" + body);
|
||||
String rsp = HttpUtil.post(url, body);
|
||||
log.info("群主请求结果" + rsp);
|
||||
return rsp;
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package io.icchain.wxcontractbot.controller.agent;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.icchain.wxcontractbot.entity.common.RequestParamEntity;
|
||||
import io.icchain.wxcontractbot.service.agent.ChatAnalysisService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(tags = "社群分析")
|
||||
@RequestMapping(value = "chat/analysis", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class ChatAnalysisController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ChatAnalysisService chatAnalysisService;
|
||||
|
||||
@ApiOperation("概述查询" +
|
||||
"@param chatIds 群ID" +
|
||||
"")
|
||||
@RequestMapping(value = "getSummaryInfo", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSummaryInfo(String chatIds) {
|
||||
return chatAnalysisService.getSummaryInfo(chatIds);
|
||||
}
|
||||
@ApiOperation("总体分析图表查询+" +
|
||||
"@param chatIds 群ID" +
|
||||
"@param startDate 开始时间" +
|
||||
"@param endDate 结束时间" +
|
||||
"@param queryType 查询类型:month(月),week(周)" +
|
||||
"")
|
||||
@RequestMapping(value = "getChartData", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public String getChartData(RequestParamEntity entity) {
|
||||
return chatAnalysisService.getChartData(entity);
|
||||
}
|
||||
|
||||
@ApiOperation("私域社群分页查询 * " +
|
||||
" @param orderStr 排序\n" +
|
||||
" 1: 昨日消息数 desc\n" +
|
||||
" 2: 昨日消息数 asc\n" +
|
||||
" 3: 月消息数 desc\n" +
|
||||
" 4: 月消息数 asc\n" +
|
||||
" <p>\n" +
|
||||
" 5: 昨日活跃用户数 desc\n" +
|
||||
" 6: 昨日活跃用户数 asc\n" +
|
||||
" 7: 月消活跃用户数 desc\n" +
|
||||
" 8: 月消活跃用户数 asc\n" +
|
||||
" 9: 群内用户数 desc\n" +
|
||||
" 10:群内用户数 asc"
|
||||
)
|
||||
@RequestMapping(value = "listPrivate", method = {RequestMethod.POST})
|
||||
public String listPrivate(@RequestBody JSONObject req) {
|
||||
return chatAnalysisService.listPrivate(req);
|
||||
}
|
||||
@ApiOperation("活跃用户分页查询 * @param orderStr 排序" +
|
||||
" 1:发言总量DESC\n" +
|
||||
" 2:发言总量ASC\n" +
|
||||
" 3:邀请进群数DESC\n" +
|
||||
" 4:邀请进群数ASC"+
|
||||
" @param:chatIds 群ID"
|
||||
)
|
||||
@RequestMapping(value = "listActiveUsr", method = {RequestMethod.POST})
|
||||
public String listActiveUsr(@RequestBody JSONObject req) {
|
||||
return chatAnalysisService.listActiveUsr(req);
|
||||
}
|
||||
|
||||
@ApiOperation("导出活跃用户Excel" +
|
||||
" @param:chatId 群ID")
|
||||
@RequestMapping( value = "exportExcel", method = {RequestMethod.POST})
|
||||
@ResponseBody
|
||||
public void exportExcel(String chatId, HttpServletRequest request, HttpServletResponse response)throws Exception{
|
||||
chatAnalysisService.exportExcel(chatId,request,response);
|
||||
}
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package io.icchain.wxcontractbot.controller.agent;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.faq.FaqEntity;
|
||||
import io.icchain.wxcontractbot.service.agent.ChatService;
|
||||
import io.icchain.wxcontractbot.service.faq.FaqService;
|
||||
import io.icchain.wxcontractbot.service.marketingrecord.MarketingMessageService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.icchain.wxcontractbot.utils.MsgUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "chat", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class ChatController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ChatService chatService;
|
||||
|
||||
@Autowired
|
||||
private MarketingMessageService messageService;
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(String userCount, String botCount,String strategyCount, Pageable pageable) {
|
||||
return chatService.list(userCount,botCount,strategyCount,pageable);
|
||||
}
|
||||
@RequestMapping(value = "getSummaryInfo", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSummaryInfo() {
|
||||
return chatService.getSummaryInfo();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "messagelist", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public Object messagelist(String chatId) {
|
||||
String res = messageService.searchMessage(chatId, new Date());
|
||||
return StringUtils.isEmpty(res) ? new BaseResponse(MsgUtil.getMessage("user.programException")) : res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "listPrivateChat", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse listPrivateChat(Pageable pageable) {
|
||||
return chatService.listPrivateChat(pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或更新群的ai_key配置
|
||||
* @param chatId 群ID
|
||||
* @param aiKey ai_key
|
||||
* @param aiKeyName ai_key名称
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "saveChatAiKey", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse saveChatAiKey(String chatId, String aiKey, String aiKeyName) {
|
||||
return chatService.saveChatAiKey(chatId, aiKey, aiKeyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取群的ai_key配置
|
||||
* @param chatId 群ID
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "getChatAiKey", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getChatAiKey(String chatId) {
|
||||
return chatService.getChatAiKey(chatId);
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package io.icchain.wxcontractbot.controller.agent;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.agent.ChatOwnerConfigComment;
|
||||
import io.icchain.wxcontractbot.service.agent.ChatOwnerConfigCommentService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 占领群配置-文案配置表(ChatOwnerConfigComment)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-05 11:21:02
|
||||
*/
|
||||
@Api(tags="占领群配置-文案配置表")
|
||||
@RestController
|
||||
@RequestMapping("chatOwnerConfigComment")
|
||||
public class ChatOwnerConfigCommentController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private ChatOwnerConfigCommentService chatOwnerConfigCommentService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param chatOwnerConfigComment
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-05 11:21:02
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(ChatOwnerConfigComment chatOwnerConfigComment) {
|
||||
BaseResponse baseResponse= chatOwnerConfigCommentService.add(chatOwnerConfigComment);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param commentList
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-05 11:21:02
|
||||
*/
|
||||
@ApiOperation("批量新增")
|
||||
@RequestMapping(value = "addList", method = {RequestMethod.POST})
|
||||
public BaseResponse addList(@RequestBody List<ChatOwnerConfigComment> commentList) {
|
||||
BaseResponse baseResponse= chatOwnerConfigCommentService.addList(commentList);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-05 11:21:02
|
||||
*/
|
||||
@ApiOperation("根据ID删除")
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= chatOwnerConfigCommentService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param chatOwnerConfigComment
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-05 11:21:02
|
||||
*/
|
||||
@ApiOperation("更新")
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(ChatOwnerConfigComment chatOwnerConfigComment) {
|
||||
BaseResponse baseResponse= chatOwnerConfigCommentService.update(chatOwnerConfigComment);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-05 11:21:02
|
||||
*/
|
||||
@ApiOperation("获取所有")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list() {
|
||||
return chatOwnerConfigCommentService.list();
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package io.icchain.wxcontractbot.controller.agent;
|
||||
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 占领群配置(ChatOwnerConfig)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-05 11:21:01
|
||||
*/
|
||||
@Api(tags="占领群配置")
|
||||
@RestController
|
||||
@RequestMapping("chatOwnerConfig")
|
||||
public class ChatOwnerConfigController {
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-05 11:21:01
|
||||
*/
|
||||
@ApiOperation("更新占领群配置")
|
||||
@RequestMapping(value = "setChatOwnerCmd", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse setChatOwnerCmd(String cmd) {
|
||||
BaseResponse baseResponse= commonService.setChatOwnerCmd(cmd);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置,如果没有,则新增一个
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-05 11:21:01
|
||||
*/
|
||||
@ApiOperation("获取占领群配置")
|
||||
@RequestMapping(value = "getChatOwnerCmd", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getChatOwnerCmd() {
|
||||
return commonService.getChatOwnerCmd();
|
||||
}
|
||||
}
|
||||
+379
@@ -0,0 +1,379 @@
|
||||
package io.icchain.wxcontractbot.controller.agent;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.qiniu.linking.model.Device;
|
||||
import io.icchain.wxcontractbot.entity.agent.DeviceEntity;
|
||||
import io.icchain.wxcontractbot.service.agent.DeviceService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.icchain.wxcontractbot.utils.HttpUtil;
|
||||
import io.icchain.wxcontractbot.utils.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.xmlbeans.impl.jam.JSourcePosition;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "device", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class DeviceController {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(DeviceController.class);
|
||||
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Value("${gewe.api.url}")
|
||||
private String geweApiUrl;
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(Pageable pageable) {
|
||||
return deviceService.list(pageable);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "all", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse all() {
|
||||
return deviceService.all();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "createApp", method = {RequestMethod.POST})
|
||||
public BaseResponse createApp(@RequestBody DeviceEntity entity) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(true);
|
||||
if (entity.getRegionId() == null || entity.getRegionId().equals(0)) {
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("regionId不能为空!");
|
||||
return baseResponse;
|
||||
}
|
||||
try {
|
||||
entity.setAppid("");
|
||||
deviceService.add(entity);
|
||||
baseResponse.setData(entity);
|
||||
} catch (Exception ex) {
|
||||
logger.error("createapp error:{}", JSON.toJSONString(ex));
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录二维码
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "getLoginQrCode")
|
||||
public BaseResponse getLoginQrCode(DeviceEntity entity) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(true);
|
||||
JSONObject param = new JSONObject();
|
||||
if (entity.getRegionId() != null && entity.getRegionId() != 0) {
|
||||
param.put("regionId", entity.getRegionId());
|
||||
}
|
||||
param.put("appId", entity.getAppid());
|
||||
ResponseEntity<String> exchange = restTemplate.exchange(geweApiUrl + "v2/api/login/getLoginQrCode",
|
||||
HttpMethod.valueOf(HttpMethod.POST.name()),
|
||||
new HttpEntity<>(param.toJSONString(), HttpUtil.buildGeweHeaders()),
|
||||
String.class,
|
||||
new HashMap<>());
|
||||
String body = exchange.getBody();
|
||||
logger.info("getloginqrcode result:{}", body);
|
||||
if (StringUtils.isNotEmpty(body)) {
|
||||
try {
|
||||
JSONObject result = JSON.parseObject(body);
|
||||
if ("200".equals(result.getString("ret"))) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
DeviceEntity device = deviceService.findById(entity.getId());
|
||||
if (device != null&&data!=null) {
|
||||
device.setProxyIp(data.getString("proxyIp"));
|
||||
device.setAppid(data.getString("appId"));
|
||||
device.setUuid(data.getString("uuid"));
|
||||
logger.error(" deviceService.update(device);\n :{}", JSON.toJSONString(device));
|
||||
|
||||
deviceService.update(device);
|
||||
}
|
||||
baseResponse.setData(result.getJSONObject("data"));
|
||||
}else if("500".equalsIgnoreCase(result.getString("ret"))){
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_code(500);
|
||||
baseResponse.setError_message(result.getString("msg"));
|
||||
}else{
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_code(500);
|
||||
baseResponse.setError_message("出现了异常:"+body);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.error("createapp error:{}", JSON.toJSONString(ex));
|
||||
}
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行登录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "checkLoginQrCode")
|
||||
public BaseResponse checkLoginQrCode(DeviceEntity entity) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(true);
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("appId", entity.getAppid());
|
||||
param.put("uuid", entity.getUuid());
|
||||
if(StringUtils.isNotEmpty(entity.getCaptchCode())){
|
||||
param.put("captchCode", entity.getCaptchCode());
|
||||
}
|
||||
ResponseEntity<String> exchange = restTemplate.exchange(geweApiUrl + "v2/api/login/checkLogin",
|
||||
HttpMethod.valueOf(HttpMethod.POST.name()),
|
||||
new HttpEntity<>(param.toJSONString(), HttpUtil.buildGeweHeaders()),
|
||||
String.class,
|
||||
new HashMap<>());
|
||||
String body = exchange.getBody();
|
||||
logger.info("checkloginqrcode result:{}", body);
|
||||
if (StringUtils.isNotEmpty(body)) {
|
||||
try {
|
||||
JSONObject result = JSON.parseObject(body);
|
||||
if ("200".equals(result.getString("ret"))) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
if (data != null ) {
|
||||
DeviceEntity deviceEntity = deviceService.findById(entity.getId());
|
||||
if (deviceEntity != null) {
|
||||
if (StringUtils.isNotEmpty(data.getString("nickName"))) {
|
||||
deviceEntity.setUserName(data.getString("nickName"));
|
||||
deviceEntity.setNickName(data.getString("nickName"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(data.getString("headImgUrl"))) {
|
||||
deviceEntity.setHeadImgUrl(data.getString("headImgUrl"));
|
||||
}
|
||||
|
||||
deviceEntity.setStatus(1);
|
||||
deviceEntity.setWxid(getMeWxId(deviceEntity.getAppid()));
|
||||
deviceService.update(deviceEntity);
|
||||
JSONObject device = new JSONObject();
|
||||
device.put("devId", deviceEntity.getAppid());
|
||||
device.put("gender", "");
|
||||
device.put("province", "");
|
||||
device.put("city", "");
|
||||
device.put("phone", "");
|
||||
device.put("signature", "");
|
||||
device.put("nickname", deviceEntity.getNickName());
|
||||
device.put("avatar", deviceEntity.getHeadImgUrl());
|
||||
device.put("wxid", deviceEntity.getAppid());
|
||||
device.put("account", deviceEntity.getAppid());
|
||||
|
||||
logger.error("addWxidStatus :{}", JSON.toJSONString(device));
|
||||
|
||||
deviceService.addWxidStatus(deviceEntity.getAppid(), device);
|
||||
deviceService.addTotalWxids(deviceEntity.getAppid(), device);
|
||||
}
|
||||
baseResponse.setData(deviceEntity);
|
||||
}
|
||||
} else {
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_code(-1);
|
||||
baseResponse.setError_message("手机已经登录,请勿重复登录!");
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.error("createapp error:{}", JSON.toJSONString(ex));
|
||||
}
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取个人信息
|
||||
*
|
||||
* @param appid
|
||||
* @return
|
||||
*/
|
||||
public String getMeWxId(String appid) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("appid", appid);
|
||||
ResponseEntity<String> exchange = restTemplate.exchange(geweApiUrl + "api/personal/getprofile",
|
||||
HttpMethod.valueOf(HttpMethod.POST.name()),
|
||||
new HttpEntity<>(param.toJSONString(), HttpUtil.buildGeweHeaders()),
|
||||
String.class,
|
||||
new HashMap<>());
|
||||
String body = exchange.getBody();
|
||||
logger.info("getMe result:{}", body);
|
||||
if (StringUtils.isNotEmpty(body)) {
|
||||
try {
|
||||
JSONObject result = JSON.parseObject(body);
|
||||
if ("0".equals(result.getString("ret"))) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
if (data.containsKey("userInfo")) {
|
||||
JSONObject userInfo = data.getJSONObject("userInfo");
|
||||
if (userInfo != null) {
|
||||
String userName = "";
|
||||
if (userInfo.containsKey("UserName")) {
|
||||
userName = userInfo.getJSONObject("UserName").getString("string");
|
||||
}
|
||||
return userName;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.info("getMe error:{}", JSON.toJSONString(ex));
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理验证码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "killLoginQrCodeAuth")
|
||||
public BaseResponse killLoginQrCodeAuth(DeviceEntity entity) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(true);
|
||||
if (StringUtils.isEmpty(entity.getAppid()) || StringUtils.isEmpty(entity.getCode())) {
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("必填参数不能为空!");
|
||||
return baseResponse;
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("appid", entity.getAppid());
|
||||
param.put("code", entity.getCode());
|
||||
param.put("ticket", "ticket");
|
||||
ResponseEntity<String> exchange = restTemplate.exchange(geweApiUrl + "api/login/checkloginqrcode",
|
||||
HttpMethod.valueOf(HttpMethod.POST.name()),
|
||||
new HttpEntity<>(param.toJSONString(), HttpUtil.buildGeweHeaders()),
|
||||
String.class,
|
||||
new HashMap<>());
|
||||
String body = exchange.getBody();
|
||||
logger.info("checkloginqrcode result:{}", body);
|
||||
if (StringUtils.isNotEmpty(body)) {
|
||||
try {
|
||||
JSONObject result = JSON.parseObject(body);
|
||||
if ("0".equals(result.getString("ret"))) {
|
||||
return baseResponse;
|
||||
} else {
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("微信已登陆,请勿重复调用。");
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.error("createapp error:{}", JSON.toJSONString(ex));
|
||||
}
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "logout")
|
||||
public BaseResponse logout(DeviceEntity entity) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(true);
|
||||
if (StringUtils.isEmpty(entity.getAppid())) {
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("必填参数不能为空!");
|
||||
return baseResponse;
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("appId", entity.getAppid());
|
||||
ResponseEntity<String> exchange = restTemplate.exchange(geweApiUrl + "v2/api/login/logout",
|
||||
HttpMethod.valueOf(HttpMethod.POST.name()),
|
||||
new HttpEntity<>(param.toJSONString(), HttpUtil.buildGeweHeaders()),
|
||||
String.class,
|
||||
new HashMap<>());
|
||||
String body = exchange.getBody();
|
||||
logger.info("logout result:{}", body);
|
||||
if (StringUtils.isNotEmpty(body)) {
|
||||
try {
|
||||
JSONObject result = JSON.parseObject(body);
|
||||
if ("200".equals(result.getString("ret"))) {
|
||||
baseResponse.setData("手机已退出!");
|
||||
DeviceEntity deviceEntity = deviceService.findByAppId(entity.getAppid());
|
||||
if (deviceEntity != null) {
|
||||
deviceEntity.setStatus(0);
|
||||
deviceService.update(deviceEntity);
|
||||
deviceService.delWxidStatus(deviceEntity.getAppid());
|
||||
}
|
||||
return baseResponse;
|
||||
} else {
|
||||
baseResponse.setData("手机已退出!");
|
||||
DeviceEntity deviceEntity = deviceService.findByAppId(entity.getAppid());
|
||||
if (deviceEntity != null) {
|
||||
deviceEntity.setStatus(0);
|
||||
deviceService.update(deviceEntity);
|
||||
deviceService.delWxidStatus(deviceEntity.getAppid());
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.error("createapp error:{}", JSON.toJSONString(ex));
|
||||
}
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse = deviceService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(DeviceEntity entity) {
|
||||
BaseResponse baseResponse = deviceService.update(entity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
}
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
package io.icchain.wxcontractbot.controller.agent;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.icchain.wxcontractbot.entity.agent.PcDeviceEntity;
|
||||
import io.icchain.wxcontractbot.service.agent.PcDeviceService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.icchain.wxcontractbot.utils.HttpUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "pcDevice", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class PcDeviceController {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(PcDeviceController.class);
|
||||
|
||||
@Autowired
|
||||
private PcDeviceService deviceService;
|
||||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Value("${pc.hook.api.url}")
|
||||
private String pcHookApiUrl;
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(Pageable pageable) {
|
||||
return deviceService.list(pageable);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "all", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse all() {
|
||||
return deviceService.all();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "createApp", method = {RequestMethod.POST})
|
||||
public BaseResponse createApp(@RequestBody PcDeviceEntity entity) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(true);
|
||||
if (entity.getRegionId() == null || entity.getRegionId().equals(0)) {
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("regionId不能为空!");
|
||||
return baseResponse;
|
||||
}
|
||||
if(StringUtils.isEmpty(entity.getAppid())){
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("appId不能为空!");
|
||||
return baseResponse;
|
||||
}
|
||||
if(StringUtils.isEmpty(entity.getKey())){
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("key不能为空!");
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
deviceService.add(entity);
|
||||
baseResponse.setData(entity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录二维码
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "getLoginQrCode")
|
||||
public BaseResponse getLoginQrCode(PcDeviceEntity entity) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(true);
|
||||
JSONObject param = new JSONObject();
|
||||
PcDeviceEntity deviceEntity = deviceService.findById(entity.getId());
|
||||
|
||||
param.put("appId", entity.getAppid());
|
||||
param.put("regionId", deviceEntity.getRegionId());
|
||||
param.put("apiKey", deviceEntity.getKey());
|
||||
ResponseEntity<String> exchange = restTemplate.exchange(pcHookApiUrl + "v2/api/login/getLoginQrCode",
|
||||
HttpMethod.valueOf(HttpMethod.POST.name()),
|
||||
new HttpEntity<>(param.toJSONString(), HttpUtil.buildGeweHeaders()),
|
||||
String.class,
|
||||
new HashMap<>());
|
||||
String body = exchange.getBody();
|
||||
logger.info("get pc loginqrcode result:{}", body);
|
||||
if (StringUtils.isNotEmpty(body)) {
|
||||
try {
|
||||
JSONObject result = JSON.parseObject(body);
|
||||
if ("200".equals(result.getString("ret"))) {
|
||||
PcDeviceEntity device = deviceService.findByAppId(entity.getAppid());
|
||||
if (device != null) {
|
||||
device.setUuid(result.getString("uuid"));
|
||||
device.setNkey(result.getString("nkey"));
|
||||
device.setAppid(result.getString("nkey"));
|
||||
deviceService.update(device);
|
||||
}
|
||||
baseResponse.setData(result.getJSONObject("appId"));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.error("createapp error:{}", JSON.toJSONString(ex));
|
||||
}
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "logout")
|
||||
public BaseResponse logout(PcDeviceEntity entity) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
baseResponse.setSuccess(true);
|
||||
if (StringUtils.isEmpty(entity.getAppid())) {
|
||||
baseResponse.setSuccess(false);
|
||||
baseResponse.setError_message("必填参数不能为空!");
|
||||
return baseResponse;
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("appId", entity.getAppid());
|
||||
ResponseEntity<String> exchange = restTemplate.exchange(pcHookApiUrl + "api/login/logout",
|
||||
HttpMethod.valueOf(HttpMethod.POST.name()),
|
||||
new HttpEntity<>(param.toJSONString(), HttpUtil.buildGeweHeaders()),
|
||||
String.class,
|
||||
new HashMap<>());
|
||||
String body = exchange.getBody();
|
||||
logger.info("logout result:{}", body);
|
||||
if (StringUtils.isNotEmpty(body)) {
|
||||
try {
|
||||
JSONObject result = JSON.parseObject(body);
|
||||
if ("200".equals(result.getString("ret"))) {
|
||||
baseResponse.setData("手机已退出!");
|
||||
PcDeviceEntity deviceEntity = deviceService.findByAppId(entity.getAppid());
|
||||
if (deviceEntity != null) {
|
||||
deviceEntity.setStatus(0);
|
||||
deviceService.update(deviceEntity);
|
||||
deviceService.delWxidStatus(deviceEntity.getAppid());
|
||||
}
|
||||
return baseResponse;
|
||||
} else {
|
||||
baseResponse.setData("手机已退出!");
|
||||
PcDeviceEntity deviceEntity = deviceService.findByAppId(entity.getAppid());
|
||||
if (deviceEntity != null) {
|
||||
deviceEntity.setStatus(0);
|
||||
deviceService.update(deviceEntity);
|
||||
deviceService.delWxidStatus(deviceEntity.getAppid());
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.error("createapp error:{}", JSON.toJSONString(ex));
|
||||
}
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse = deviceService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(PcDeviceEntity entity) {
|
||||
BaseResponse baseResponse = deviceService.update(entity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package io.icchain.wxcontractbot.controller.agent;
|
||||
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.service.agent.ChatService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
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.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "user/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class UserStatisticsController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(String startDate,String endDate,String queryType,@PageableDefault(value = 10,page=0) Pageable page) {
|
||||
return commonService.getUserStatisticsList(startDate,endDate,queryType,page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据导出
|
||||
*
|
||||
* @param response
|
||||
* @return 导出数据结果
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="exportNodeUser", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public String exportNodeUser(HttpServletResponse response)
|
||||
throws Exception {
|
||||
String fileName = "节点用户导出";
|
||||
try {
|
||||
response.setHeader("content-Type", "application/vnd.ms-excel");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xlsx", "utf-8") + ";filename*=utf-8''" + URLEncoder.encode(fileName + ".xlsx", "utf-8"));
|
||||
SXSSFWorkbook workbook = commonService.getNodeUserList();
|
||||
workbook.write(response.getOutputStream());
|
||||
response.flushBuffer();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "导出成功";
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package io.icchain.wxcontractbot.controller.alivecode;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.entity.alivecode.AliveCode;
|
||||
import io.icchain.wxcontractbot.service.alivecode.AliveCodeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("aliveCode")
|
||||
public class AliveCodeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AliveCodeService aliveCodeService;
|
||||
|
||||
@RequestMapping("saveAliveCode")
|
||||
@ResponseBody
|
||||
public Object saveAliveCode(AliveCode aliveCode) {
|
||||
return aliveCodeService.saveAliveCode(aliveCode);
|
||||
}
|
||||
|
||||
@RequestMapping("aliveCodeList")
|
||||
@ResponseBody
|
||||
public Object aliveCodeList() {
|
||||
return aliveCodeService.aliveCodeList();
|
||||
}
|
||||
|
||||
@RequestMapping("viewAliveCode")
|
||||
@ResponseBody
|
||||
public Object viewAliveCode(String id) {
|
||||
return aliveCodeService.viewAliveCode(id);
|
||||
}
|
||||
|
||||
@RequestMapping("modifyAliveCode")
|
||||
@ResponseBody
|
||||
public Object modifyAliveCode(AliveCode aliveCode) {
|
||||
return aliveCodeService.modifyAliveCode(aliveCode);
|
||||
}
|
||||
|
||||
@RequestMapping("deleteAliveCode")
|
||||
@ResponseBody
|
||||
public Object deleteAliveCode(String id) {
|
||||
return aliveCodeService.deleteAliveCode(id);
|
||||
}
|
||||
|
||||
@RequestMapping("deleteChatQrcode")
|
||||
@ResponseBody
|
||||
public Object deleteChatQrcode(String id) {
|
||||
return aliveCodeService.deleteChatQrcode(id);
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package io.icchain.wxcontractbot.controller.analysis;
|
||||
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "/analysis/marketing", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingAnalysisController {
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getAdDataInfo", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getAdDataInfo(String startDate,String endDate,String queryType) {
|
||||
return commonService.getAdDataInfo(startDate,endDate,queryType);
|
||||
}
|
||||
@RequestMapping(value = "getAdClickDetail", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public String getAdClickDetail(Pageable page) {
|
||||
return commonService.getAdClickDetail(page);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getSummaryInfo", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSummaryInfo() {
|
||||
return commonService.getAdOverviewSummaryInfo();
|
||||
}
|
||||
}
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package io.icchain.wxcontractbot.controller.analysis;
|
||||
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "/analysis/overview", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class OverviewController {
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getDataInfo", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getDataInfo(String startDate,String endDate,String queryType) {
|
||||
return commonService.getOverviewDataInfo(startDate,endDate,queryType);
|
||||
}
|
||||
@RequestMapping(value = "getSummaryInfo", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSummaryInfo() {
|
||||
return commonService.getOverviewSummaryInfo();
|
||||
}
|
||||
}
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package io.icchain.wxcontractbot.controller.analysis;
|
||||
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "/analysis/user", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class UserAnalysisController {
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getDataInfo", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getDataInfo(String startDate,String endDate,String queryType) {
|
||||
return commonService.getUserOverviewDataInfo(startDate,endDate,queryType);
|
||||
}
|
||||
@RequestMapping(value = "getSummaryInfo", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSummaryInfo() {
|
||||
return commonService.getUserOverviewSummaryInfo();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "getYesterdayPrivateActive", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getYesterdayPrivateActive() {
|
||||
return commonService.getYesterdayActiveUserCount("1");
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getYesterdayPublicActive", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getYesterdayPublicActive() {
|
||||
return commonService.getYesterdayActiveUserCount("0");
|
||||
}
|
||||
}
|
||||
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
package io.icchain.wxcontractbot.controller.callback;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.qiniu.util.Md5;
|
||||
import io.icchain.wxcontractbot.controller.im.agent.api.MsgCache;
|
||||
import io.icchain.wxcontractbot.dao.marketing.MarketingDao;
|
||||
import io.icchain.wxcontractbot.utils.MD5Util;
|
||||
import io.icchain.wxcontractbot.utils.RedisUtils;
|
||||
import io.icchain.wxcontractbot.utils.jedis.RedisUtil;
|
||||
import org.apache.commons.codec.digest.Md5Crypt;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icchain.wxcontractbot.controller.callback GeWeCallbackController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2023/10/14 22:02
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "/gewe", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class GeWeCallbackController {
|
||||
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(GeWeCallbackController.class);
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
/*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "callback")
|
||||
public synchronized void callback(@RequestBody String body) {
|
||||
if (StringUtils.isNotEmpty(body)) {
|
||||
log.info("接收到=====\r\ngewe body:{}\r\n", body);
|
||||
// {
|
||||
// "Appid": "wx_MoRx8U6XmG_XIhnZAud49",
|
||||
// "TypeName": "AddMsg",
|
||||
// "Data": {
|
||||
// "MsgId": 1776006948,
|
||||
// "FromUserName": {
|
||||
// "string": "wxid_xl52ulfg3px722"
|
||||
// },
|
||||
// "ToUserName": {
|
||||
// "string": "wxid_6735k4cyucqp22"
|
||||
// },
|
||||
// "MsgType": 1,
|
||||
// "Content": {
|
||||
// "string": "你好啊"
|
||||
// },
|
||||
// "Status": 3,
|
||||
// "ImgStatus": 1,
|
||||
// "ImgBuf": {
|
||||
// "iLen": 0
|
||||
// },
|
||||
// "CreateTime": 1722833487,
|
||||
// "MsgSource": "<msgsource>\n\t<alnode>\n\t\t<fr>1</fr>\n\t</alnode>\n\t<pua>1</pua>\n\t<signature>V1_FFdKlfkv|v1_FFdKlfkv</signature>\n\t<tmp_node>\n\t\t<publisher-id></publisher-id>\n\t</tmp_node>\n</msgsource>\n",
|
||||
// "PushContent": "ZERO : 你好啊",
|
||||
// "NewMsgId": 1182483844997577401,
|
||||
// "MsgSeq": 776006948
|
||||
// },
|
||||
// "Wxid": "wxid_6735k4cyucqp22"
|
||||
// }
|
||||
try {
|
||||
JSONObject result = JSON.parseObject(body);
|
||||
if (result != null) {
|
||||
JSONObject data = result.getJSONObject("Data");
|
||||
String appid = result.getString("Appid");
|
||||
if (data != null) {
|
||||
String onlineStatus = data.getString("Status");
|
||||
if (StringUtils.isNoneBlank(appid)) {
|
||||
JSONObject msg = new JSONObject();
|
||||
msg.put("emojiId", 0);
|
||||
msg.put("fd", 0);
|
||||
msg.put("serverId", 0);
|
||||
msg.put("is_at", "false");
|
||||
msg.put("isSend", 0);
|
||||
msg.put("nickname", "");
|
||||
msg.put("talkerName", "");
|
||||
|
||||
msg.put("create_time", data.getLongValue("CreateTime") * 1000);
|
||||
msg.put("msgID", data.getLong("MsgId"));
|
||||
msg.put("type", 1);
|
||||
|
||||
if (data.getJSONObject("Content") != null && data.getJSONObject("Content").containsKey("string")) {
|
||||
String content = data.getJSONObject("Content").getString("string");
|
||||
if (StringUtils.isNotEmpty(content)) {
|
||||
if (StringUtils.contains(content, ":")) {
|
||||
String[] contentArr = StringUtils.split(content, ":");
|
||||
if (contentArr.length == 2) {
|
||||
msg.put("content", contentArr[1]);
|
||||
} else {
|
||||
msg.put("content", contentArr[0]);
|
||||
}
|
||||
} else {
|
||||
msg.put("content", content);
|
||||
}
|
||||
}
|
||||
//新人进群通知
|
||||
if (content.contains("邀请") && content.contains("加入了群聊")) {
|
||||
String wxidValue = "";
|
||||
String nicknameValue = "";
|
||||
String inviteWxidValue = "";
|
||||
String inviteNicknameValue = "";
|
||||
msg.put("type", 15);
|
||||
int index = StringUtils.indexOf(content, ":");
|
||||
if (index > 0) {
|
||||
String xmlString = StringUtils.substring(content, index + 1);
|
||||
if (StringUtils.isNotEmpty(xmlString)) {
|
||||
try {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
ByteArrayInputStream input = new ByteArrayInputStream(xmlString.getBytes());
|
||||
Document document = builder.parse(input);
|
||||
|
||||
NodeList wxidList = document.getElementsByTagName("username");
|
||||
NodeList nicknameList = document.getElementsByTagName("nickname");
|
||||
|
||||
if (wxidList != null && wxidList.getLength() == 2) {
|
||||
inviteWxidValue = wxidList.item(0).getTextContent().trim();
|
||||
wxidValue = wxidList.item(1).getTextContent().trim();
|
||||
}
|
||||
if (nicknameList != null && nicknameList.getLength() == 2) {
|
||||
inviteNicknameValue = nicknameList.item(0).getTextContent().trim();
|
||||
nicknameValue = nicknameList.item(1).getTextContent().trim();
|
||||
}
|
||||
if (StringUtils.isNotEmpty(wxidValue) && StringUtils.isNotEmpty(nicknameValue)) {
|
||||
log.info("解析出进群消息:{}", wxidValue + ",nicknameValue" + nicknameValue);
|
||||
JSONObject contentMsg = new JSONObject();
|
||||
contentMsg.put("type", "invite");
|
||||
contentMsg.put("username", inviteWxidValue + "," + wxidValue);
|
||||
contentMsg.put("invite_id", wxidValue);
|
||||
contentMsg.put("template", inviteNicknameValue + "\"邀请\"" + nicknameValue + "\"加入了群聊");
|
||||
msg.put("content", contentMsg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (content.contains("以上是打招呼的消息")) {
|
||||
msg.put("type", 99);
|
||||
}
|
||||
}
|
||||
|
||||
String fromUserName = "";
|
||||
String toUserName = "";
|
||||
if (data.getJSONObject("FromUserName") != null && data.getJSONObject("FromUserName").containsKey("string")) {
|
||||
fromUserName = data.getJSONObject("FromUserName").getString("string");
|
||||
}
|
||||
if (data.getJSONObject("ToUserName") != null && data.getJSONObject("ToUserName").containsKey("string")) {
|
||||
toUserName = data.getJSONObject("ToUserName").getString("string");
|
||||
}
|
||||
|
||||
//如果是群聊
|
||||
if (StringUtils.endsWith(fromUserName, "@chatroom")) {
|
||||
msg.put("toID", fromUserName);
|
||||
msg.put("fromID", toUserName);
|
||||
} else {
|
||||
if (StringUtils.endsWith(toUserName, "@chatroom")) {
|
||||
msg.put("toID", toUserName);
|
||||
msg.put("fromID", fromUserName);
|
||||
} else {
|
||||
msg.put("toID", fromUserName);
|
||||
msg.put("fromID", toUserName);
|
||||
}
|
||||
}
|
||||
msg.put("uid", appid);
|
||||
msg.put("xml", data.getString("MsgSource"));
|
||||
|
||||
if (redisUtils.hasKey(msg.getString("msgID"))) {
|
||||
log.info("MsgCache 已存在:" + msg.toString());
|
||||
return;
|
||||
}
|
||||
redisUtils.set(msg.getString("msgID"),"",30);
|
||||
MsgCache.addMsg(appid, msg.toJSONString());
|
||||
log.info("MsgCache add Msg:" + msg.toString());
|
||||
|
||||
}
|
||||
if (!"3".equals(onlineStatus)) {
|
||||
log.error("callback 机器人已经掉线:{}", appid);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("callback error:{}", JSON.toJSONString(ex));
|
||||
}
|
||||
}
|
||||
}
|
||||
public static String setMD5(String userInfo) {
|
||||
try {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
md5.update(userInfo.getBytes());
|
||||
return new BigInteger(1, md5.digest()).toString(16);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package io.icchain.wxcontractbot.controller.common;
|
||||
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icchain.wxcontractbot.controller.common CommonController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2020/5/19 11:09
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "api/common", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class CommonController {
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@RequestMapping(value="/uploadImage")
|
||||
@ResponseBody
|
||||
public BaseResponse uploadImage(@RequestParam(value = "file") MultipartFile file) throws Exception {
|
||||
return commonService.uploadImage(file);
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package io.icchain.wxcontractbot.controller.faq;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.faq.AiSetting;
|
||||
import io.icchain.wxcontractbot.entity.faq.FaqEntity;
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.icchain.wxcontractbot.utils.RedisUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "ai", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class AiSettingController {
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(AiSetting aiSetting) {
|
||||
BaseResponse baseResponse= commonService.aiSetting(aiSetting);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* 获取统计信息
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "getInfo", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getInfo() {
|
||||
BaseResponse baseResponse=commonService.getAiSetting();
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package io.icchain.wxcontractbot.controller.faq;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.faq.FaqAnswerEntity;
|
||||
import io.icchain.wxcontractbot.service.faq.FaqAnswerService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47:00
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "智能问答-FAQ组-回答")
|
||||
@RequestMapping(value = "faq/answer", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class FaqAnswerController {
|
||||
|
||||
@Autowired
|
||||
private FaqAnswerService faqAnswerService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param faqAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(FaqAnswerEntity faqAnswerEntity) {
|
||||
BaseResponse baseResponse= faqAnswerService.add(faqAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= faqAnswerService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据FaqID删除
|
||||
*
|
||||
* @param faqId 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "delByFaqId/{faqId}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse delByFaqId(@PathVariable("faqId") String faqId) {
|
||||
BaseResponse baseResponse= faqAnswerService.delByFaqId(faqId);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param faqAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(FaqAnswerEntity faqAnswerEntity) {
|
||||
BaseResponse baseResponse= faqAnswerService.update(faqAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return faqAnswerService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0)Pageable pageable, String faqId) {
|
||||
return faqAnswerService.list(pageable,faqId);
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package io.icchain.wxcontractbot.controller.faq;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.faq.FaqAskEntity;
|
||||
import io.icchain.wxcontractbot.service.faq.FaqAskService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "智能问答-FAQ组-问题")
|
||||
@RequestMapping(value = "faq/ask", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class FaqAskController {
|
||||
|
||||
@Autowired
|
||||
private FaqAskService faqAskService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param faqAskEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(FaqAskEntity faqAskEntity) {
|
||||
BaseResponse baseResponse= faqAskService.add(faqAskEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= faqAskService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据FaqID删除
|
||||
*
|
||||
* @param faqId 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "delByFaqId/{faqId}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse delByFaqId(@PathVariable("faqId") String faqId) {
|
||||
BaseResponse baseResponse= faqAskService.delByFaqId(faqId);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param faqAskEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(FaqAskEntity faqAskEntity) {
|
||||
BaseResponse baseResponse= faqAskService.update(faqAskEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return faqAskService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0)Pageable pageable, String faqId) {
|
||||
return faqAskService.list(pageable,faqId);
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package io.icchain.wxcontractbot.controller.faq;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.faq.FaqEntity;
|
||||
import io.icchain.wxcontractbot.service.faq.FaqService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "智能问答-FAQ组")
|
||||
@RequestMapping(value = "faq", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class FaqController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private FaqService faqService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param faqEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(FaqEntity faqEntity) {
|
||||
BaseResponse baseResponse= faqService.add(faqEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= faqService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param faqEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(FaqEntity faqEntity) {
|
||||
BaseResponse baseResponse= faqService.update(faqEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0)Pageable pageable) {
|
||||
return faqService.list(pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统计信息
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "summaryInfo", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse summaryInfo() {
|
||||
BaseResponse baseResponse= faqService.summaryInfo();
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package io.icchain.wxcontractbot.controller.friendreply;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.friendreply.AddedFriendReplyService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/friendReply")
|
||||
@Controller
|
||||
public class AddedFriendReplyController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AddedFriendReplyService addedFriendReplyService;
|
||||
|
||||
@RequestMapping(value="")
|
||||
@ResponseBody
|
||||
public BaseResponse info() {
|
||||
|
||||
return addedFriendReplyService.info();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/switch")
|
||||
@ResponseBody
|
||||
public BaseResponse switchTo(String enable) {
|
||||
|
||||
return addedFriendReplyService.switchTo(enable);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save")
|
||||
@ResponseBody
|
||||
public BaseResponse add(@RequestParam(value = "messages", defaultValue = "") String messages) {
|
||||
|
||||
return addedFriendReplyService.save(messages);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/list/all")
|
||||
@ResponseBody
|
||||
public BaseResponse list() {
|
||||
|
||||
return addedFriendReplyService.list();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
@ResponseBody
|
||||
public BaseResponse delete(String id) {
|
||||
|
||||
return addedFriendReplyService.delete(id);
|
||||
}
|
||||
}
|
||||
+1061
File diff suppressed because it is too large
Load Diff
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright 2019-2108 ICC (Intelligence Commerce Chain, https://icchain.io).
|
||||
* *
|
||||
* * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* * you may not use this file except in compliance with the License.
|
||||
* * You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing, software
|
||||
* * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* * See the License for the specific language governing permissions and
|
||||
* * limitations under the License.
|
||||
*
|
||||
*/
|
||||
package io.icchain.wxcontractbot.controller.im.agent.api;
|
||||
|
||||
import io.icchain.wxcontractbot.utils.RedisUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 消息缓存,使用 Redis List 存储每个 wxid 的消息队列
|
||||
* @date 2019年4月26日 下午2:59:57
|
||||
*/
|
||||
public class MsgCache {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MsgCache.class.getName());
|
||||
|
||||
private static final String KEY_PREFIX = "MSG_CACHE:";
|
||||
private static final int MAX_BATCH_SIZE = 1000;
|
||||
private static final int MAX_QUEUE_SIZE = 1000;
|
||||
|
||||
private static RedisUtils redisUtils;
|
||||
|
||||
public static void setRedisUtils(RedisUtils redisUtils) {
|
||||
MsgCache.redisUtils = redisUtils;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取并移除该 wxid 队列中的消息(最多返回 MAX_BATCH_SIZE 条)
|
||||
*/
|
||||
public static List<String> getMsgs(String wxid) {
|
||||
if (redisUtils == null) {
|
||||
logger.warn("MsgCache redisUtils not set, return null");
|
||||
return null;
|
||||
}
|
||||
String key = KEY_PREFIX + wxid;
|
||||
if (!redisUtils.hasKey(key)) {
|
||||
logger.info("wxid:{},null", wxid);
|
||||
return null;
|
||||
}
|
||||
long size = redisUtils.lGetListSize(key);
|
||||
if (size == 0) {
|
||||
logger.info("wxid:{},null", wxid);
|
||||
return null;
|
||||
}
|
||||
|
||||
long end = Math.min(size - 1, MAX_BATCH_SIZE - 1);
|
||||
List<Object> raw = redisUtils.lGet(key, 0, end);
|
||||
if (raw == null || raw.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> ret = new ArrayList<>(raw.size());
|
||||
for (Object o : raw) {
|
||||
if (o != null) {
|
||||
ret.add(o.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// 移除已取出的元素:保留 [end+1, -1],即删除 [0, end]
|
||||
if (size > MAX_BATCH_SIZE) {
|
||||
redisUtils.lTrim(key, MAX_BATCH_SIZE, -1);
|
||||
} else {
|
||||
redisUtils.del(key);
|
||||
}
|
||||
|
||||
if (size > MAX_BATCH_SIZE) {
|
||||
logger.warn("wxid:{} has {} remaining messages, only returned first {} messages", wxid, size - MAX_BATCH_SIZE, MAX_BATCH_SIZE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 向该 wxid 的消息队列尾部追加一条消息;队列长度超过 MAX_QUEUE_SIZE 时丢弃最旧的消息
|
||||
*/
|
||||
public static void addMsg(String wxid, String msg) {
|
||||
if (redisUtils == null) {
|
||||
logger.warn("MsgCache redisUtils not set, skip addMsg");
|
||||
return;
|
||||
}
|
||||
logger.info("put msg:{}", msg);
|
||||
|
||||
String key = KEY_PREFIX + wxid;
|
||||
redisUtils.lSet(key, msg);
|
||||
|
||||
long size = redisUtils.lGetListSize(key);
|
||||
if (size > MAX_QUEUE_SIZE) {
|
||||
// 只保留最后 MAX_QUEUE_SIZE 条
|
||||
redisUtils.lTrim(key, size - MAX_QUEUE_SIZE, -1);
|
||||
logger.warn("MsgCache queue size exceeded {}, trimmed. wxid={}", MAX_QUEUE_SIZE, wxid);
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package io.icchain.wxcontractbot.controller.iqa;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.iqa.IqaAnswerService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/iqa/answer")
|
||||
@Controller
|
||||
public class IqaAnswerController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IqaAnswerService iqaAnswerService;
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
@ResponseBody
|
||||
public BaseResponse add(@RequestParam(value = "title", defaultValue = "") String title,
|
||||
@RequestParam(value = "content", defaultValue = "") String content,
|
||||
@RequestParam(value = "advice", defaultValue = "") String advice) {
|
||||
|
||||
return iqaAnswerService.add(title, content, advice);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/update")
|
||||
@ResponseBody
|
||||
public BaseResponse update(@RequestParam(value = "id", defaultValue = "") String id,
|
||||
@RequestParam(value = "title", defaultValue = "") String title,
|
||||
@RequestParam(value = "content", defaultValue = "") String content,
|
||||
@RequestParam(value = "advice", defaultValue = "") String advice) {
|
||||
|
||||
return iqaAnswerService.update(id, title, content, advice);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
@ResponseBody
|
||||
public BaseResponse delete(@RequestParam(value = "id", defaultValue = "") String id) {
|
||||
|
||||
return iqaAnswerService.delete(id);
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package io.icchain.wxcontractbot.controller.iqa;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.iqa.IqaQuestionAnswerService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/iqa")
|
||||
@Controller
|
||||
public class IqaQuestionAnswerController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IqaQuestionAnswerService iqaQuestionAnswerService;
|
||||
|
||||
@RequestMapping(value="")
|
||||
@ResponseBody
|
||||
public BaseResponse info() {
|
||||
|
||||
return iqaQuestionAnswerService.get();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/switch")
|
||||
@ResponseBody
|
||||
public BaseResponse switchTo(@RequestParam(value = "enable", defaultValue = "") String enable) {
|
||||
|
||||
return iqaQuestionAnswerService.switchTo(enable);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save")
|
||||
@ResponseBody
|
||||
public BaseResponse save(@RequestParam(value = "questionIds", defaultValue = "") String questionIds,
|
||||
@RequestParam(value = "answerIds", defaultValue = "") String answerIds) {
|
||||
|
||||
return iqaQuestionAnswerService.save(questionIds, answerIds);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/answer")
|
||||
@ResponseBody
|
||||
public BaseResponse answer(@RequestParam(value = "question", defaultValue = "") String question) {
|
||||
|
||||
return iqaQuestionAnswerService.answer(question);
|
||||
}
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package io.icchain.wxcontractbot.controller.iqa;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.iqa.IqaQuestionService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/iqa/question")
|
||||
@Controller
|
||||
public class IqaQuestionController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IqaQuestionService iqaQuestionService;
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
@ResponseBody
|
||||
public BaseResponse add(@RequestParam(value = "content", defaultValue = "") String content) {
|
||||
|
||||
return iqaQuestionService.add(content);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
@ResponseBody
|
||||
public BaseResponse delete(@RequestParam(value = "id", defaultValue = "") String id) {
|
||||
|
||||
return iqaQuestionService.delete(id);
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package io.icchain.wxcontractbot.controller.kfgzt.level;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.kfgzt.level.LevelService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RequestMapping(value = "/kfgzt/level")
|
||||
@RestController
|
||||
public class LevelController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private LevelService levelService;
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
public BaseResponse add(String name, String description) {
|
||||
|
||||
return levelService.add(name, description);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/list/all")
|
||||
public BaseResponse listall() {
|
||||
|
||||
return levelService.listall();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/update")
|
||||
public BaseResponse update(String id, String name, String description) {
|
||||
|
||||
return levelService.update(id, name, description);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/updateSortNum")
|
||||
public BaseResponse updateSortNum(String id, int num) {
|
||||
|
||||
return levelService.updateSortNum(id, num);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
public BaseResponse delete(String id) {
|
||||
|
||||
return levelService.delete(id);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package io.icchain.wxcontractbot.controller.kfgzt.level;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.kfgzt.level.UserLevelService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RequestMapping(value = "/kfgzt/userLevel")
|
||||
@RestController
|
||||
public class UserLevelController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private UserLevelService userLevelService;
|
||||
|
||||
@RequestMapping(value="/save")
|
||||
public BaseResponse save(String wxid, String levelId) {
|
||||
|
||||
return userLevelService.save(wxid, levelId);
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package io.icchain.wxcontractbot.controller.kfgzt.message;
|
||||
|
||||
import io.icchain.wxcontractbot.service.kfgzt.message.MessageService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/kfgzt/message")
|
||||
public class MessageController {
|
||||
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
@RequestMapping("/save")
|
||||
public BaseResponse save(String chatType, String fromId, String fromUserName, String fromAvatar, String toId, String msgType, String content, String create_time) {
|
||||
return messageService.save(chatType, fromId, fromUserName, fromAvatar, toId, msgType, content, create_time);
|
||||
}
|
||||
|
||||
@RequestMapping("/search")
|
||||
public BaseResponse search(int chatType, String toId,
|
||||
@RequestParam(value = "wxid", defaultValue = "") String wxid,
|
||||
@RequestParam(value = "content", defaultValue = "") String content,
|
||||
@RequestParam(value = "date", defaultValue = "") String date,
|
||||
@RequestParam(value = "page", defaultValue = "0") int page,
|
||||
@RequestParam(value = "size", defaultValue = "20") int size) {
|
||||
return messageService.search(chatType, toId, wxid, content, date, page, size);
|
||||
}
|
||||
|
||||
@RequestMapping("/context")
|
||||
public BaseResponse context(int chatType, String toId,
|
||||
@RequestParam(value = "wxid", defaultValue = "") String wxid,
|
||||
@RequestParam(value = "time", defaultValue = "") String time,
|
||||
@RequestParam(value = "size", defaultValue = "20") int size) {
|
||||
return messageService.context(chatType, toId, wxid, time, size);
|
||||
}
|
||||
|
||||
@RequestMapping("/history")
|
||||
public BaseResponse history(int chatType, String toId,
|
||||
@RequestParam(value = "wxid", defaultValue = "") String wxid,
|
||||
@RequestParam(value = "time", defaultValue = "") String time,
|
||||
@RequestParam(value = "page", defaultValue = "0") int page,
|
||||
@RequestParam(value = "size", defaultValue = "20") int size) {
|
||||
return messageService.history(chatType, toId, wxid, time, page, size);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package io.icchain.wxcontractbot.controller.kfgzt.quick.reply;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.kfgzt.quick.reply.QuickReplyService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RequestMapping(value = "/kfgzt/quickReply")
|
||||
@RestController
|
||||
public class QuickReplyController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private QuickReplyService quickReplyService;
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
public BaseResponse add(String groupId, String messages) {
|
||||
|
||||
return quickReplyService.add(groupId, messages);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/search")
|
||||
public BaseResponse search(@RequestParam(value = "keyword", defaultValue = "") String keyword) {
|
||||
|
||||
return quickReplyService.search(keyword);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/update")
|
||||
public BaseResponse update(String id, String type, String content,
|
||||
@RequestParam(value = "remark", defaultValue = "") String remark) {
|
||||
|
||||
return quickReplyService.update(id, type, content, remark);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
public BaseResponse delete(String id) {
|
||||
|
||||
return quickReplyService.delete(id);
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package io.icchain.wxcontractbot.controller.kfgzt.quick.reply;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.kfgzt.quick.reply.QuickReplyGroupService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RequestMapping(value = "/kfgzt/quickReplyGroup")
|
||||
@RestController
|
||||
public class QuickReplyGroupController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private QuickReplyGroupService quickReplyGroupService;
|
||||
|
||||
@RequestMapping(value="/save")
|
||||
public BaseResponse save(@RequestParam(value = "id", defaultValue = "") String id, String name) {
|
||||
|
||||
return quickReplyGroupService.save(id, name);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/list/all")
|
||||
public BaseResponse listall() {
|
||||
|
||||
return quickReplyGroupService.listall();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
public BaseResponse delete(String id) {
|
||||
|
||||
return quickReplyGroupService.delete(id);
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package io.icchain.wxcontractbot.controller.kfgzt.tag;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.kfgzt.tag.TagService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RequestMapping(value = "/kfgzt/tag")
|
||||
@RestController
|
||||
public class TagController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private TagService tagService;
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
public BaseResponse add(String name) {
|
||||
|
||||
return tagService.add(name);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/list")
|
||||
public BaseResponse list(@RequestParam(value = "page", defaultValue = "0") int page,
|
||||
@RequestParam(value = "size", defaultValue = "20") int size) {
|
||||
|
||||
return tagService.list(page, size);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/list/all")
|
||||
public BaseResponse listall() {
|
||||
|
||||
return tagService.listall();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/update")
|
||||
public BaseResponse update(String id, String name) {
|
||||
|
||||
return tagService.update(id, name);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
public BaseResponse delete(String id) {
|
||||
|
||||
return tagService.delete(id);
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package io.icchain.wxcontractbot.controller.kfgzt.tag;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.kfgzt.tag.UserTagService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RequestMapping(value = "/kfgzt/userTag")
|
||||
@RestController
|
||||
public class UserTagController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private UserTagService userTagService;
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
public BaseResponse add(String wxid, String tagId) {
|
||||
|
||||
return userTagService.add(wxid, tagId);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
public BaseResponse delete(String id) {
|
||||
|
||||
return userTagService.delete(id);
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package io.icchain.wxcontractbot.controller.kfgzt.user;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.entity.kfgzt.user.KFUser;
|
||||
import io.icchain.wxcontractbot.service.kfgzt.user.KFUserService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RequestMapping(value = "/kfgzt/user")
|
||||
@RestController
|
||||
public class KFUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private KFUserService userService;
|
||||
|
||||
@RequestMapping(value="/save")
|
||||
public BaseResponse save(KFUser user) {
|
||||
|
||||
return userService.save(user);
|
||||
}
|
||||
|
||||
@RequestMapping(value="")
|
||||
public BaseResponse info(String wxid) {
|
||||
|
||||
return userService.info(wxid);
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package io.icchain.wxcontractbot.controller.marketing;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingAnswerEntity;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingAnswerService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "会话式营销-答")
|
||||
@RequestMapping(value = "marketing/answer", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingAnswerController {
|
||||
|
||||
@Autowired
|
||||
private MarketingAnswerService marketingAnswerService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param marketingAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingAnswerEntity marketingAnswerEntity) {
|
||||
BaseResponse baseResponse= marketingAnswerService.add(marketingAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= marketingAnswerService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "delByGroupId/{answerGroupId}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse delByGroupId(@PathVariable("answerGroupId") String answerGroupId) {
|
||||
BaseResponse baseResponse= marketingAnswerService.delByGroupId(answerGroupId);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param marketingAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingAnswerEntity marketingAnswerEntity) {
|
||||
BaseResponse baseResponse= marketingAnswerService.update(marketingAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return marketingAnswerService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable, String groupId) {
|
||||
return marketingAnswerService.list(pageable,groupId);
|
||||
}
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package io.icchain.wxcontractbot.controller.marketing;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingAnswerGroupEntity;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingAnswerGroupService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "会话式营销-组-答")
|
||||
@RequestMapping(value = "marketing/answer/group", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingAnswerGroupController {
|
||||
|
||||
@Autowired
|
||||
private MarketingAnswerGroupService marketingAnswerGroupService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param marketingAnswerGroupEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingAnswerGroupEntity marketingAnswerGroupEntity) {
|
||||
BaseResponse baseResponse= marketingAnswerGroupService.add(marketingAnswerGroupEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= marketingAnswerGroupService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param marketingAnswerGroupEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingAnswerGroupEntity marketingAnswerGroupEntity) {
|
||||
BaseResponse baseResponse= marketingAnswerGroupService.update(marketingAnswerGroupEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return marketingAnswerGroupService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable, String marketingId) {
|
||||
return marketingAnswerGroupService.list(marketingId,pageable);
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package io.icchain.wxcontractbot.controller.marketing;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingAskEntity;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingAskService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "会话式营销-问")
|
||||
@RequestMapping(value = "marketing/ask", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingAskController {
|
||||
|
||||
@Autowired
|
||||
private MarketingAskService marketingAskService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param marketingAskEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingAskEntity marketingAskEntity) {
|
||||
BaseResponse baseResponse= marketingAskService.add(marketingAskEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= marketingAskService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "delByGroupId/{askGroupId}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse delByGroupId(@PathVariable("askGroupId") String askGroupId) {
|
||||
BaseResponse baseResponse= marketingAskService.delByGroupId(askGroupId);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param marketingAskEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingAskEntity marketingAskEntity) {
|
||||
BaseResponse baseResponse= marketingAskService.update(marketingAskEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return marketingAskService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable, String groupId) {
|
||||
return marketingAskService.list(pageable,groupId);
|
||||
}
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package io.icchain.wxcontractbot.controller.marketing;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingAskGroupEntity;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingAskGroupService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "会话式营销-问-组")
|
||||
@RequestMapping(value = "marketing/ask/group", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingAskGroupController {
|
||||
|
||||
@Autowired
|
||||
private MarketingAskGroupService marketingAskGroupService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param marketingAskGroupEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingAskGroupEntity marketingAskGroupEntity) {
|
||||
BaseResponse baseResponse= marketingAskGroupService.add(marketingAskGroupEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= marketingAskGroupService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param marketingAskGroupEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingAskGroupEntity marketingAskGroupEntity) {
|
||||
BaseResponse baseResponse= marketingAskGroupService.update(marketingAskGroupEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return marketingAskGroupService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable, String marketingId) {
|
||||
return marketingAskGroupService.list(marketingId,pageable);
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package io.icchain.wxcontractbot.controller.marketing;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingEntity;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "会话式营销")
|
||||
@RequestMapping(value = "marketing", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingController {
|
||||
|
||||
@Autowired
|
||||
private MarketingService marketingService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param marketingEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingEntity marketingEntity) {
|
||||
BaseResponse baseResponse= marketingService.add(marketingEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= marketingService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param marketingEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingEntity marketingEntity) {
|
||||
BaseResponse baseResponse= marketingService.update(marketingEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable) {
|
||||
return marketingService.list(pageable);
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package io.icchain.wxcontractbot.controller.marketing;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingEchoEntity;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingEchoService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "会话式营销-附和")
|
||||
@RequestMapping(value = "marketing/echo", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingEchoController {
|
||||
|
||||
@Autowired
|
||||
private MarketingEchoService marketingEchoService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param marketingEchoEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingEchoEntity marketingEchoEntity) {
|
||||
BaseResponse baseResponse= marketingEchoService.add(marketingEchoEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= marketingEchoService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "delByGroupId/{echoGroupId}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse delByGroupId(@PathVariable("echoGroupId") String echoGroupId) {
|
||||
BaseResponse baseResponse= marketingEchoService.delByGroupId(echoGroupId);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param marketingEchoEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingEchoEntity marketingEchoEntity) {
|
||||
BaseResponse baseResponse= marketingEchoService.update(marketingEchoEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return marketingEchoService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable, String groupId) {
|
||||
return marketingEchoService.list(pageable,groupId);
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package io.icchain.wxcontractbot.controller.marketing;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingEchoGroupEntity;
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingEchoGroupService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "会话式营销-附和-组")
|
||||
@RequestMapping(value = "marketing/echo/group", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingEchoGroupController {
|
||||
|
||||
@Autowired
|
||||
private MarketingEchoGroupService marketingEchoGroupService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param marketingEchoGroupEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingEchoGroupEntity marketingEchoGroupEntity) {
|
||||
BaseResponse baseResponse= marketingEchoGroupService.add(marketingEchoGroupEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= marketingEchoGroupService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param marketingEchoGroupEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingEchoGroupEntity marketingEchoGroupEntity) {
|
||||
BaseResponse baseResponse= marketingEchoGroupService.update(marketingEchoGroupEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return marketingEchoGroupService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable, String marketingId) {
|
||||
return marketingEchoGroupService.list(marketingId,pageable);
|
||||
}
|
||||
/**
|
||||
* 设置数量
|
||||
*
|
||||
* @param count
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "setGroupCount", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse setGroupCount(int count) {
|
||||
return commonService.setGroupCount(count);
|
||||
}
|
||||
/**
|
||||
* 设置数量
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "getGroupCount", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getGroupCount() {
|
||||
return commonService.getGroupCount();
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package io.icchain.wxcontractbot.controller.marketing;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingKeywordsEntity;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingKeywordsService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "会话式营销-触发关键词")
|
||||
@RequestMapping(value = "marketing/keywords", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingKeywordsController {
|
||||
|
||||
@Autowired
|
||||
private MarketingKeywordsService marketingKeywordsService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param marketingEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingKeywordsEntity marketingEntity) {
|
||||
BaseResponse baseResponse= marketingKeywordsService.add(marketingEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= marketingKeywordsService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param marketingEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingKeywordsEntity marketingEntity) {
|
||||
BaseResponse baseResponse= marketingKeywordsService.update(marketingEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable) {
|
||||
return marketingKeywordsService.list(pageable);
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package io.icchain.wxcontractbot.controller.marketing;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingEntity;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingOrderService;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "会话式营销")
|
||||
@RequestMapping(value = "marketing/order", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingOrderController {
|
||||
|
||||
@Autowired
|
||||
private MarketingOrderService marketingOrderService;
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param taskId 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "findByTaskId", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse findByTaskId(String taskId) {
|
||||
return marketingOrderService.findByTaskId(taskId);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package io.icchain.wxcontractbot.controller.marketing;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingKeywordsEntity;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingKeywordsService;
|
||||
import io.icchain.wxcontractbot.service.marketing.MarketingRecordService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@Api(value = "会话式营销-营销记录")
|
||||
@RequestMapping(value = "marketing/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingRecordController {
|
||||
|
||||
@Autowired
|
||||
private MarketingRecordService marketingRecordService;
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle() {
|
||||
BaseResponse baseResponse = marketingRecordService.getSingle();
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package io.icchain.wxcontractbot.controller.marketingrecord;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.marketingrecord.MarketingChatService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/marketing/chat")
|
||||
@Controller
|
||||
public class MarketingChatController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private MarketingChatService marketingChatService;
|
||||
|
||||
@RequestMapping(value = "/count")
|
||||
@ResponseBody
|
||||
public BaseResponse count() {
|
||||
|
||||
return marketingChatService.count();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/list")
|
||||
@ResponseBody
|
||||
public BaseResponse list(@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "pagesize", defaultValue = "10") int pagesize) {
|
||||
|
||||
return marketingChatService.list(page, pagesize);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/stop")
|
||||
@ResponseBody
|
||||
public Object stop(String id) {
|
||||
|
||||
return marketingChatService.stop(id);
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package io.icchain.wxcontractbot.controller.marketingrecord;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.marketingrecord.MarketingMessageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/marketing/message")
|
||||
@Controller
|
||||
public class MarketingMessageController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private MarketingMessageService marketingMessageService;
|
||||
|
||||
@RequestMapping(value = "/list")
|
||||
@ResponseBody
|
||||
public Object messagelist(String marketingChatId) {
|
||||
|
||||
return marketingMessageService.messagelist(marketingChatId);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package io.icchain.wxcontractbot.controller.marketingrecord;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.entity.marketingrecord.MarketingTask;
|
||||
import io.icchain.wxcontractbot.service.marketingrecord.MarketingTaskService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.icchain.wxcontractbot.utils.Const;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/marketing/task")
|
||||
@Controller
|
||||
public class MarketingTaskController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private MarketingTaskService marketingTaskService;
|
||||
|
||||
@RequestMapping(value = "/chat/count")
|
||||
@ResponseBody
|
||||
public BaseResponse chatCount(@RequestParam(value = "botNum", defaultValue = Const.BOT_NUM_DEFAULT) int botNum) {
|
||||
|
||||
return marketingTaskService.chatCount(botNum);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/chat/search")
|
||||
@ResponseBody
|
||||
public BaseResponse chatSearch(@RequestParam(value = "chatType") String chatType,
|
||||
@RequestParam(value = "keyword", defaultValue = "") String keyword,
|
||||
@RequestParam(value = "botNum", defaultValue = Const.BOT_NUM_DEFAULT) int botNum,
|
||||
@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "pagesize", defaultValue = "10") int pagesize) {
|
||||
|
||||
return marketingTaskService.chatSearch(chatType, keyword, botNum, page, pagesize);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/chatIds/search/all")
|
||||
@ResponseBody
|
||||
public BaseResponse chatIdsSearch(@RequestParam(value = "chatType") String chatType,
|
||||
@RequestParam(value = "keyword", defaultValue = "") String keyword,
|
||||
@RequestParam(value = "botNum", defaultValue = Const.BOT_NUM_DEFAULT) int botNum) {
|
||||
|
||||
return marketingTaskService.chatIdsSearch(chatType, keyword, botNum);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/create")
|
||||
@ResponseBody
|
||||
public BaseResponse create(MarketingTask task) {
|
||||
|
||||
return marketingTaskService.create(task);
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package io.icchain.wxcontractbot.controller.moments;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.moments.MomentsService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
|
||||
@RequestMapping(value = "/moments")
|
||||
@Controller
|
||||
public class MomentsController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private MomentsService momentsService;
|
||||
|
||||
@RequestMapping(value="/uploadImage")
|
||||
@ResponseBody
|
||||
public BaseResponse uploadImage(@RequestParam(value = "file") MultipartFile file) throws Exception {
|
||||
|
||||
return momentsService.uploadImage(file);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
@ResponseBody
|
||||
public BaseResponse add(@RequestParam(value = "content", defaultValue = "") String content,
|
||||
@RequestParam(value = "imageUrl", defaultValue = "") String imageUrl) {
|
||||
|
||||
return momentsService.add(content, imageUrl);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/list")
|
||||
@ResponseBody
|
||||
public BaseResponse list(@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "pagesize", defaultValue = "10") int pagesize) {
|
||||
|
||||
return momentsService.list(page, pagesize);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/update")
|
||||
@ResponseBody
|
||||
public BaseResponse update(@RequestParam(value = "id", defaultValue = "") String id,
|
||||
@RequestParam(value = "content", defaultValue = "") String content,
|
||||
@RequestParam(value = "imageUrl", defaultValue = "") String imageUrl) {
|
||||
|
||||
return momentsService.update(id, content, imageUrl);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
@ResponseBody
|
||||
public BaseResponse delete(@RequestParam(value = "id", defaultValue = "") String id) {
|
||||
|
||||
return momentsService.delete(id);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package io.icchain.wxcontractbot.controller.pullgroup;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.pullgroup.PullGroupService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/pullGroup")
|
||||
@Controller
|
||||
public class PullGroupController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private PullGroupService pullGroupService;
|
||||
|
||||
@RequestMapping(value="/queryByContent")
|
||||
@ResponseBody
|
||||
public BaseResponse queryByContent(String botWxid, String content) {
|
||||
|
||||
return pullGroupService.queryByContent(botWxid, content);
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package io.icchain.wxcontractbot.controller.pullgroup;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.pullgroup.PullGroupKeywordChatService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/pullGroup/keywordChat")
|
||||
@Controller
|
||||
public class PullGroupKeywordChatController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private PullGroupKeywordChatService pullGroupKeywordChatService;
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
@ResponseBody
|
||||
public BaseResponse add(String keywordIds, String chatIds) {
|
||||
|
||||
return pullGroupKeywordChatService.add(keywordIds, chatIds);
|
||||
}
|
||||
|
||||
@RequestMapping(value="")
|
||||
@ResponseBody
|
||||
public BaseResponse info(String id) {
|
||||
|
||||
return pullGroupKeywordChatService.info(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/update")
|
||||
@ResponseBody
|
||||
public BaseResponse update(String id, String keywordIds, String chatIds) {
|
||||
|
||||
return pullGroupKeywordChatService.update(id, keywordIds, chatIds);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/list")
|
||||
@ResponseBody
|
||||
public BaseResponse list(@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "pagesize", defaultValue = "10") int pagesize) {
|
||||
|
||||
return pullGroupKeywordChatService.list(page, pagesize);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/keyword/list/all")
|
||||
@ResponseBody
|
||||
public BaseResponse keywordListAll(String id) {
|
||||
|
||||
return pullGroupKeywordChatService.keywordListAll(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/chat/list/all")
|
||||
@ResponseBody
|
||||
public BaseResponse chatListAll(String id) {
|
||||
|
||||
return pullGroupKeywordChatService.chatListAll(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
@ResponseBody
|
||||
public BaseResponse delete(String id) {
|
||||
|
||||
return pullGroupKeywordChatService.delete(id);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package io.icchain.wxcontractbot.controller.pullgroup;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.pullgroup.PullGroupKeywordService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/pullGroup/keyword")
|
||||
@Controller
|
||||
public class PullGroupKeywordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private PullGroupKeywordService pullGroupKeywordService;
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
@ResponseBody
|
||||
public BaseResponse add(String content) {
|
||||
|
||||
return pullGroupKeywordService.add(content);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
@ResponseBody
|
||||
public BaseResponse delete(String id) {
|
||||
|
||||
return pullGroupKeywordService.delete(id);
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package io.icchain.wxcontractbot.controller.pullgroup;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.entity.pullgroup.PullGroupTask;
|
||||
import io.icchain.wxcontractbot.service.pullgroup.PullGroupTaskService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/pullGroup/task")
|
||||
@Controller
|
||||
public class PullGroupTaskController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private PullGroupTaskService pullGroupTaskService;
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
@ResponseBody
|
||||
public BaseResponse add(PullGroupTask task) {
|
||||
|
||||
return pullGroupTaskService.add(task);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/list")
|
||||
@ResponseBody
|
||||
public BaseResponse list(@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "pagesize", defaultValue = "10") int pagesize) {
|
||||
|
||||
return pullGroupTaskService.list(page, pagesize);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/keyword/list/all")
|
||||
@ResponseBody
|
||||
public BaseResponse keywordListAll(String id) {
|
||||
|
||||
return pullGroupTaskService.keywordListAll(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/chat/list/all")
|
||||
@ResponseBody
|
||||
public BaseResponse chatListAll(String id) {
|
||||
|
||||
return pullGroupTaskService.chatListAll(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/status/update")
|
||||
@ResponseBody
|
||||
public BaseResponse updateStatus(String id, String status) {
|
||||
|
||||
return pullGroupTaskService.updateStatus(id, status);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
@ResponseBody
|
||||
public BaseResponse delete(String id) {
|
||||
|
||||
return pullGroupTaskService.delete(id);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package io.icchain.wxcontractbot.controller.push;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icchain.wxcontractbot.controller.common CommonController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2020/5/19 11:09
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "push/content", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MessagePushContentController {
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package io.icchain.wxcontractbot.controller.push;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.MarketingEntity;
|
||||
import io.icchain.wxcontractbot.entity.push.MessagePush;
|
||||
import io.icchain.wxcontractbot.entity.push.MessagePushContent;
|
||||
import io.icchain.wxcontractbot.entity.push.MessagePushContext;
|
||||
import io.icchain.wxcontractbot.entity.push.MessagePushDetail;
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.service.push.MessagePushService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icchain.wxcontractbot.controller.common CommonController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2020/5/19 11:09
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "push", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MessagePushController {
|
||||
@Autowired
|
||||
private MessagePushService messagePushService;
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param messagePushContext
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(@RequestBody MessagePushContext messagePushContext) {
|
||||
BaseResponse baseResponse= messagePushService.add(messagePushContext);
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package io.icchain.wxcontractbot.controller.push;
|
||||
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.service.push.MessagePushDetailService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icchain.wxcontractbot.controller.common CommonController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2020/5/19 11:09
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "push/detail", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MessagePushDetailController {
|
||||
@Autowired
|
||||
private MessagePushDetailService messagePushDetailService;
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(String id,String status) {
|
||||
BaseResponse baseResponse= messagePushDetailService.update(id,status);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(sort ={"createDate"},direction = Sort.Direction.DESC) Pageable pageable) {
|
||||
return messagePushDetailService.list(pageable);
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package io.icchain.wxcontractbot.controller.spam.message.filter;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.icchain.wxcontractbot.entity.spam.message.filter.SpamMessageFilterConfigBlackList;
|
||||
import io.icchain.wxcontractbot.service.spam.message.filter.SpamMessageFilterConfigBlackListService;
|
||||
|
||||
/**
|
||||
* 垃圾检测-黑名单表(SpamMessageFilterConfigBlackList)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-19 15:19:49
|
||||
*/
|
||||
@Api(tags = "垃圾检测-黑名单表")
|
||||
@RestController
|
||||
@RequestMapping("spam/message/filter/blackList")
|
||||
public class SpamMessageFilterConfigBlackListController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private SpamMessageFilterConfigBlackListService spamMessageFilterConfigBlackListService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param spamMessageFilterConfigBlackList
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(SpamMessageFilterConfigBlackList spamMessageFilterConfigBlackList) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigBlackListService.add(spamMessageFilterConfigBlackList);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("根据ID删除")
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigBlackListService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param spamMessageFilterConfigBlackList
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("更新")
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(SpamMessageFilterConfigBlackList spamMessageFilterConfigBlackList) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigBlackListService.update(spamMessageFilterConfigBlackList);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("分页获取信息")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 20, page = 0) Pageable pageable) {
|
||||
return spamMessageFilterConfigBlackListService.list(pageable);
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package io.icchain.wxcontractbot.controller.spam.message.filter;
|
||||
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.icchain.wxcontractbot.entity.spam.message.filter.SpamMessageFilterConfigChat;
|
||||
import io.icchain.wxcontractbot.service.spam.message.filter.SpamMessageFilterConfigChatService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 垃圾检测-群(SpamMessageFilterConfigChat)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-19 15:19:49
|
||||
*/
|
||||
@Api(tags = "垃圾检测-群")
|
||||
@RestController
|
||||
@RequestMapping("spam/message/filter/chat")
|
||||
public class SpamMessageFilterConfigChatController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private SpamMessageFilterConfigChatService spamMessageFilterConfigChatService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param spamMessageFilterConfigChat
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(SpamMessageFilterConfigChat spamMessageFilterConfigChat) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigChatService.add(spamMessageFilterConfigChat);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("批量新增")
|
||||
@RequestMapping(value = "addAll", method = { RequestMethod.POST})
|
||||
public BaseResponse addAll(@RequestBody List<SpamMessageFilterConfigChat> list) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigChatService.addAll(list);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("根据ID删除")
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigChatService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param spamMessageFilterConfigChat
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("更新")
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(SpamMessageFilterConfigChat spamMessageFilterConfigChat) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigChatService.update(spamMessageFilterConfigChat);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("分页获取信息")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 20, page = 0) Pageable pageable) {
|
||||
return spamMessageFilterConfigChatService.list(pageable);
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package io.icchain.wxcontractbot.controller.spam.message.filter;
|
||||
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.icchain.wxcontractbot.entity.spam.message.filter.SpamMessageFilterConfig;
|
||||
import io.icchain.wxcontractbot.service.spam.message.filter.SpamMessageFilterConfigService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
/**
|
||||
* 垃圾检测配置表(SpamMessageFilterConfig)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-19 15:19:48
|
||||
*/
|
||||
@Api(tags = "垃圾检测配置表")
|
||||
@RestController
|
||||
@RequestMapping("spam/message/filter")
|
||||
public class SpamMessageFilterConfigController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private SpamMessageFilterConfigService spamMessageFilterConfigService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:48
|
||||
*/
|
||||
@ApiOperation("获取配置")
|
||||
@RequestMapping(value = "getOne", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getOne() {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigService.getOne();
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param spamMessageFilterConfig
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:48
|
||||
*/
|
||||
@ApiOperation("更新")
|
||||
@RequestMapping(value = "update", method = {RequestMethod.POST})
|
||||
public BaseResponse update(@RequestBody SpamMessageFilterConfig spamMessageFilterConfig) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigService.update(spamMessageFilterConfig);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:48
|
||||
*/
|
||||
@ApiOperation("批量导入关键词")
|
||||
@RequestMapping(value = "importKeywords", method = {RequestMethod.POST})
|
||||
public BaseResponse importKeywords(@RequestParam("file") MultipartFile file) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigService.importKeywords(file);
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package io.icchain.wxcontractbot.controller.spam.message.filter;
|
||||
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.icchain.wxcontractbot.entity.spam.message.filter.SpamMessageFilterConfigLinkWhiteList;
|
||||
import io.icchain.wxcontractbot.service.spam.message.filter.SpamMessageFilterConfigLinkWhiteListService;
|
||||
|
||||
/**
|
||||
* 垃圾检测-链接白名单(SpamMessageFilterConfigLinkWhiteList)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-19 15:19:49
|
||||
*/
|
||||
@Api(tags = "垃圾检测-链接白名单")
|
||||
@RestController
|
||||
@RequestMapping("spam/message/filter/linkWhiteList")
|
||||
public class SpamMessageFilterConfigLinkWhiteListController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private SpamMessageFilterConfigLinkWhiteListService spamMessageFilterConfigLinkWhiteListService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param spamMessageFilterConfigLinkWhiteList
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(SpamMessageFilterConfigLinkWhiteList spamMessageFilterConfigLinkWhiteList) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigLinkWhiteListService.add(spamMessageFilterConfigLinkWhiteList);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("根据ID删除")
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigLinkWhiteListService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param spamMessageFilterConfigLinkWhiteList
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("更新")
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(SpamMessageFilterConfigLinkWhiteList spamMessageFilterConfigLinkWhiteList) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigLinkWhiteListService.update(spamMessageFilterConfigLinkWhiteList);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("分页获取信息")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 20, page = 0) Pageable pageable) {
|
||||
return spamMessageFilterConfigLinkWhiteListService.list(pageable);
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package io.icchain.wxcontractbot.controller.spam.message.filter;
|
||||
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.icchain.wxcontractbot.entity.spam.message.filter.SpamMessageFilterConfigWhiteList;
|
||||
import io.icchain.wxcontractbot.service.spam.message.filter.SpamMessageFilterConfigWhiteListService;
|
||||
|
||||
|
||||
/**
|
||||
* 垃圾检测-白名单表(SpamMessageFilterConfigWhiteList)表控制层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-19 15:19:49
|
||||
*/
|
||||
@Api(tags = "垃圾检测-白名单表")
|
||||
@RestController
|
||||
@RequestMapping("spam/message/filter/whiteList")
|
||||
public class SpamMessageFilterConfigWhiteListController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private SpamMessageFilterConfigWhiteListService spamMessageFilterConfigWhiteListService;
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param spamMessageFilterConfigWhiteList
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("新增")
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(SpamMessageFilterConfigWhiteList spamMessageFilterConfigWhiteList) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigWhiteListService.add(spamMessageFilterConfigWhiteList);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("根据ID删除")
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigWhiteListService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param spamMessageFilterConfigWhiteList
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("更新")
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(SpamMessageFilterConfigWhiteList spamMessageFilterConfigWhiteList) {
|
||||
BaseResponse baseResponse = spamMessageFilterConfigWhiteListService.update(spamMessageFilterConfigWhiteList);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2020-06-19 15:19:49
|
||||
*/
|
||||
@ApiOperation("分页获取信息")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 20, page = 0) Pageable pageable) {
|
||||
return spamMessageFilterConfigWhiteListService.list(pageable);
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package io.icchain.wxcontractbot.controller.template;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.template.MarketingAnswerTemplate;
|
||||
import io.icchain.wxcontractbot.service.template.AnswerTemplateService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "template/answer", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class AnswerTemplateController {
|
||||
|
||||
@Autowired
|
||||
private AnswerTemplateService questionAnswerService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param questionAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingAnswerTemplate questionAnswerEntity) {
|
||||
BaseResponse baseResponse= questionAnswerService.add(questionAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= questionAnswerService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param questionAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingAnswerTemplate questionAnswerEntity) {
|
||||
BaseResponse baseResponse= questionAnswerService.update(questionAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return questionAnswerService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable, String marketingId) {
|
||||
return questionAnswerService.list(pageable,marketingId);
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package io.icchain.wxcontractbot.controller.template;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.template.MarketingAskTemplate;
|
||||
import io.icchain.wxcontractbot.service.template.AskTemplateService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "template/ask", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class AskTemplateController {
|
||||
|
||||
@Autowired
|
||||
private AskTemplateService questionAnswerService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param questionAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingAskTemplate questionAnswerEntity) {
|
||||
BaseResponse baseResponse= questionAnswerService.add(questionAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= questionAnswerService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param questionAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingAskTemplate questionAnswerEntity) {
|
||||
BaseResponse baseResponse= questionAnswerService.update(questionAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return questionAnswerService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable, String marketingId) {
|
||||
return questionAnswerService.list(pageable,marketingId);
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package io.icchain.wxcontractbot.controller.template;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.template.MarketingEchoGroupTemplate;
|
||||
import io.icchain.wxcontractbot.service.template.EchoGroupTemplateService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "template/group", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class EchoGroupTemplateController {
|
||||
|
||||
@Autowired
|
||||
private EchoGroupTemplateService questionAnswerService;
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= questionAnswerService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param questionAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingEchoGroupTemplate questionAnswerEntity) {
|
||||
BaseResponse baseResponse= questionAnswerService.update(questionAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return questionAnswerService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable, String marketingId) {
|
||||
return questionAnswerService.list(marketingId,pageable);
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package io.icchain.wxcontractbot.controller.template;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.template.MarketingEchoTemplate;
|
||||
import io.icchain.wxcontractbot.service.template.EchoTemplateService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "template/echo", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class EchoTemplateController {
|
||||
|
||||
@Autowired
|
||||
private EchoTemplateService questionAnswerService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param questionAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "add", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse add(MarketingEchoTemplate questionAnswerEntity) {
|
||||
BaseResponse baseResponse= questionAnswerService.add(questionAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= questionAnswerService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param questionAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingEchoTemplate questionAnswerEntity) {
|
||||
BaseResponse baseResponse= questionAnswerService.update(questionAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取单个信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "getSingle/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getSingle(@PathVariable("id") String id) {
|
||||
return questionAnswerService.getSingle(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(@PageableDefault(value = 500, page = 0) Pageable pageable, String groupId) {
|
||||
return questionAnswerService.list(pageable,groupId);
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package io.icchain.wxcontractbot.controller.template;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.marketing.template.MarketingTemplate;
|
||||
import io.icchain.wxcontractbot.service.CommonService;
|
||||
import io.icchain.wxcontractbot.service.template.MarketingTemplateService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 模块编号:io.icc.controller QuestionAnswerController
|
||||
* 作 者:xuelei.wang
|
||||
* 创建时间:2019/11/19 15:47
|
||||
* 修改编号:1
|
||||
* 描 述:DES
|
||||
*/
|
||||
@RequestMapping(value = "template", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
@RestController
|
||||
public class MarketingTemplateController {
|
||||
|
||||
@Autowired
|
||||
private MarketingTemplateService questionAnswerService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id 表ID
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse del(@PathVariable("id") String id) {
|
||||
BaseResponse baseResponse= questionAnswerService.del(id);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param questionAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "update", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse update(MarketingTemplate questionAnswerEntity) {
|
||||
BaseResponse baseResponse= questionAnswerService.update(questionAnswerEntity);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param questionAnswerEntity
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "setTemplateStatus", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse setEnable(String name,@RequestParam(name = "inUse",defaultValue = "1",required = true) int inUse) {
|
||||
BaseResponse baseResponse= questionAnswerService.setTemplateStatus(name,inUse);
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取信息
|
||||
*
|
||||
* @param pageable 分页信息
|
||||
* @return
|
||||
* @author xuelei.wang 2019-11-19
|
||||
*/
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse list(String name,@RequestParam(name = "inUse",defaultValue = "-1",required = false) int inUse,@PageableDefault(value = 500, page = 0) Pageable pageable) {
|
||||
return questionAnswerService.list(name,inUse,pageable);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "copyTemplate", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse copyTemplate(String name) {
|
||||
BaseResponse baseResponse= commonService.copyTemplate(name);
|
||||
return baseResponse;
|
||||
}
|
||||
/**
|
||||
* getTemplateNameList
|
||||
*
|
||||
* @return
|
||||
* @author xuelei.wang 2019-9-19
|
||||
*/
|
||||
@RequestMapping(value = "getTemplateNameList", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public BaseResponse getTemplateNameList(@RequestParam(name = "inUse",defaultValue = "-1",required = false) int inUse) {
|
||||
BaseResponse baseResponse= questionAnswerService.getTemplateNameList(inUse);
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package io.icchain.wxcontractbot.controller.tokenprice;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.utils.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RequestMapping(value = "/tokenPrice")
|
||||
@Controller
|
||||
public class TokenPriceController extends BaseController {
|
||||
|
||||
@Value("${company.name}")
|
||||
private String companyName;
|
||||
|
||||
@Value("${token.price.ad.short.link.count}")
|
||||
private String shortLinkCount;
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
@Autowired
|
||||
private ShortUrlUtil shortUrlUtil;
|
||||
|
||||
@RequestMapping(value="")
|
||||
@ResponseBody
|
||||
public BaseResponse info() {
|
||||
|
||||
try {
|
||||
Object enable = redisUtils.get(companyName + Const.TOKEN_PRICE_ENABLE);
|
||||
Object adWords = redisUtils.get(companyName + Const.TOKEN_PRICE_AD_WORDS);
|
||||
Object adLink = redisUtils.get(companyName + Const.TOKEN_PRICE_AD_LINK);
|
||||
Map<String, Object> res = new HashMap<>();
|
||||
res.put("enable", enable != null ? enable.toString() : "0");
|
||||
res.put("adWords", adWords != null ? adWords.toString() : "");
|
||||
res.put("adLink", adLink != null ? adLink.toString() : "");
|
||||
return new BaseResponse(res);
|
||||
} catch (Exception e) {
|
||||
logger.error("tokenPrice error:{}", e.getMessage());
|
||||
return new BaseResponse(MsgUtil.getMessage("user.programException"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/switch")
|
||||
@ResponseBody
|
||||
public BaseResponse switchTo(@RequestParam(value = "enable", defaultValue = "") String enable) {
|
||||
|
||||
if (StringUtils.isEmpty(enable)) {
|
||||
return new BaseResponse(MsgUtil.getMessage("missingParameterValue"));
|
||||
}
|
||||
try {
|
||||
redisUtils.set(companyName + Const.TOKEN_PRICE_ENABLE, enable);
|
||||
return new BaseResponse(new HashMap<>());
|
||||
} catch (Exception e) {
|
||||
logger.error("tokenPrice switch error:{}", e.getMessage());
|
||||
return new BaseResponse(MsgUtil.getMessage("user.programException"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/adWords/save")
|
||||
@ResponseBody
|
||||
public BaseResponse adWordsSave(@RequestParam(value = "adWords", defaultValue = "") String adWords) {
|
||||
|
||||
try {
|
||||
redisUtils.set(companyName + Const.TOKEN_PRICE_AD_WORDS, adWords);
|
||||
return new BaseResponse(new HashMap<>());
|
||||
} catch (Exception e) {
|
||||
logger.error("adWords save error:{}", e.getMessage());
|
||||
return new BaseResponse(MsgUtil.getMessage("user.programException"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/adLink/save")
|
||||
@ResponseBody
|
||||
public BaseResponse adLinkSave(@RequestParam(value = "adLink", defaultValue = "") String adLink) {
|
||||
|
||||
try {
|
||||
adLink = adLink.trim();
|
||||
String linkKey = companyName + Const.TOKEN_PRICE_AD_LINK;
|
||||
String shortLinkKey = companyName + Const.TOKEN_PRICE_AD_SHORT_LINK;
|
||||
Object obj = redisUtils.get(linkKey);
|
||||
if (StringUtils.isEmpty(adLink)) {
|
||||
redisUtils.del(linkKey, shortLinkKey);
|
||||
} else {
|
||||
if (!adLink.equals(obj)) {
|
||||
String[] shortLinks = shortUrlUtil.compress(adLink, Integer.parseInt(shortLinkCount), Const.SHORT_LINK_TOKEN_PRICE_AD);
|
||||
redisUtils.del(shortLinkKey);
|
||||
if (shortLinks.length > 0) {
|
||||
redisUtils.sSet(shortLinkKey, shortLinks);
|
||||
} else {
|
||||
redisUtils.sSet(shortLinkKey, adLink);
|
||||
}
|
||||
redisUtils.set(linkKey, adLink);
|
||||
}
|
||||
}
|
||||
return new BaseResponse(new HashMap<>());
|
||||
} catch (Exception e) {
|
||||
logger.error("adLink save error:{}", e.getMessage());
|
||||
return new BaseResponse(MsgUtil.getMessage("user.programException"));
|
||||
}
|
||||
}
|
||||
}
|
||||
+337
@@ -0,0 +1,337 @@
|
||||
package io.icchain.wxcontractbot.controller.user;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.entity.user.User;
|
||||
import io.icchain.wxcontractbot.service.user.UserService;
|
||||
import io.icchain.wxcontractbot.utils.*;
|
||||
import io.icchain.wxcontractbot.utils.submail.MailSendHelper;
|
||||
import io.icchain.wxcontractbot.utils.submail.SubmailSendMessage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RequestMapping(value = "/user")
|
||||
@Controller
|
||||
public class UserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@RequestMapping(value = "/captcha")
|
||||
public void crimg(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
|
||||
HttpSession session = request.getSession(true);
|
||||
long time = System.currentTimeMillis();
|
||||
response.setContentType("image/png");
|
||||
response.setHeader("Cache-Control", "no-cache, no-store");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setDateHeader("Last-Modified", time);
|
||||
response.setDateHeader("Date", time);
|
||||
response.setDateHeader("Expires", time);
|
||||
String captStr = CaptchaUtils.generateCaptcha(response.getOutputStream());
|
||||
session.setAttribute("captchaStr", captStr);
|
||||
logger.info("【captcha】 当前的SessionID:{} 验证码:{}", session.getId(), captStr);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/smscode")
|
||||
@ResponseBody
|
||||
public BaseResponse smscode(String countryCode, String phone, String captcha, String source, HttpSession session) {
|
||||
|
||||
if (StringUtils.isEmpty(countryCode) || StringUtils.isEmpty(phone) || StringUtils.isEmpty(captcha) || StringUtils.isEmpty(source)) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.smscode.phoneCaptchaSourceEmpty"));
|
||||
}
|
||||
BaseResponse baseResponse = checkCaptcha(captcha, session);
|
||||
if (baseResponse != null) {
|
||||
return baseResponse;
|
||||
}
|
||||
if (source.equals(Const.SOURCE_REGISTER)) {
|
||||
boolean exist = userService.existByPhone(countryCode, phone);
|
||||
if (exist) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.smscode.phoneRegistered"));
|
||||
}
|
||||
} else if (source.equals(Const.SOURCE_RESET_PASSWORD)) {
|
||||
boolean exist = userService.existByPhone(countryCode, phone);
|
||||
if (!exist) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.smscode.phoneUnregistered"));
|
||||
}
|
||||
} else {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.smscode.sourceInvalid"));
|
||||
}
|
||||
|
||||
try {
|
||||
String code = SysUtil.getSixRandom();
|
||||
String phoneNum = countryCode.equals("86") ? phone : "+" + countryCode + phone;
|
||||
SubmailSendMessage.sendSubMailMessage(phoneNum, MsgUtil.getMessage("user.smscode.captcha") + code);
|
||||
session.setAttribute("countryCode", countryCode);
|
||||
session.setAttribute("phone", phone);
|
||||
session.setAttribute("smscode", code);
|
||||
session.removeAttribute("captchaStr");
|
||||
return new BaseResponse(new HashMap<>());
|
||||
} catch (Exception e) {
|
||||
logger.error("发送手机验证码异常: {} ", e.getMessage(), e);
|
||||
return new BaseResponse(MsgUtil.getMessage("user.programException"));
|
||||
}
|
||||
}
|
||||
|
||||
private BaseResponse checkCaptcha(String captcha, HttpSession session) {
|
||||
String captchaStr = (String) session.getAttribute("captchaStr");
|
||||
if (captchaStr == null) {
|
||||
logger.error("session中图片验证码为空");
|
||||
return new BaseResponse(MsgUtil.getMessage("user.code.captcha.refresh"));
|
||||
}
|
||||
if (!captchaStr.equalsIgnoreCase(captcha)) {
|
||||
logger.error("图片验证码错误: 原验证码{}, 现验证码{}", captchaStr, captcha);
|
||||
return new BaseResponse(MsgUtil.getMessage("user.code.captcha.error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/register/phone")
|
||||
@ResponseBody
|
||||
public synchronized BaseResponse registerByPhone(String countryCode, String phone, String password, String code, HttpSession session) {
|
||||
|
||||
BaseResponse baseResponse = checkByPhone(countryCode, phone, password, code, session);
|
||||
if (baseResponse != null) {
|
||||
return baseResponse;
|
||||
}
|
||||
boolean exist = userService.existByPhone(countryCode, phone);
|
||||
if (exist) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.register.phone.phoneRegistered"));
|
||||
}
|
||||
String md5Password = MD5Util.MD(password, phone);
|
||||
User user = new User(countryCode, phone, null, md5Password);
|
||||
user.setType(Const.USER_TYPE_USER);
|
||||
user.preInsert();
|
||||
userService.save(user);
|
||||
session.removeAttribute("countryCode");
|
||||
session.removeAttribute("phone");
|
||||
session.removeAttribute("smscode");
|
||||
return new BaseResponse(new HashMap<>());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/resetPassword/phone")
|
||||
@ResponseBody
|
||||
public BaseResponse resetPasswordByPhone(String countryCode, String phone, String password, String code, HttpSession session) {
|
||||
|
||||
BaseResponse baseResponse = checkByPhone(countryCode, phone, password, code, session);
|
||||
if (baseResponse != null) {
|
||||
return baseResponse;
|
||||
}
|
||||
User user = userService.getUserByPhone(countryCode, phone);
|
||||
if (user == null) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.resetPassword.phone.phoneUnregistered"));
|
||||
}
|
||||
String md5Password = MD5Util.MD(password, phone);
|
||||
user.setPassword(md5Password);
|
||||
user.preUpdate();
|
||||
userService.save(user);
|
||||
session.removeAttribute("countryCode");
|
||||
session.removeAttribute("phone");
|
||||
session.removeAttribute("smscode");
|
||||
return new BaseResponse(new HashMap<>());
|
||||
}
|
||||
|
||||
private BaseResponse checkByPhone(String countryCode, String phone, String password, String code, HttpSession session) {
|
||||
|
||||
if (StringUtils.isEmpty(countryCode) || StringUtils.isEmpty(phone) || StringUtils.isEmpty(password) || StringUtils.isEmpty(code)) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.phone.phonePasswordCodeEmpty"));
|
||||
}
|
||||
String oldCountryCode = (String) session.getAttribute("countryCode");
|
||||
String oldPhone = (String) session.getAttribute("phone");
|
||||
String oldSmscode = (String) session.getAttribute("smscode");
|
||||
if (oldCountryCode == null || oldPhone == null || oldSmscode == null) {
|
||||
logger.error("手机号或手机验证码为空: 手机号{}, 验证码{}", oldPhone, oldSmscode);
|
||||
return new BaseResponse(MsgUtil.getMessage("user.phone.code.empty"));
|
||||
}
|
||||
if (!oldCountryCode.equals(countryCode) || !oldPhone.equals(phone) || !oldSmscode.equals(code)) {
|
||||
logger.error("手机验证码错误: 原手机号{}, 现手机号{}, 原验证码{}, 现验证码{}", oldPhone, phone, oldSmscode, code);
|
||||
return new BaseResponse(MsgUtil.getMessage("user.phone.code.error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/emailcode")
|
||||
@ResponseBody
|
||||
public BaseResponse emailcode(String email, String captcha, String source, HttpSession session) {
|
||||
|
||||
if (StringUtils.isEmpty(email) || StringUtils.isEmpty(captcha) || StringUtils.isEmpty(source)) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.emailcode.emailCaptchaSourceEmpty"));
|
||||
}
|
||||
BaseResponse baseResponse = checkCaptcha(captcha, session);
|
||||
if (baseResponse != null) {
|
||||
return baseResponse;
|
||||
}
|
||||
if (source.equals(Const.SOURCE_REGISTER)) {
|
||||
boolean exist = userService.existByEmail(email);
|
||||
if (exist) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.emailcode.emailRegistered"));
|
||||
}
|
||||
} else if (source.equals(Const.SOURCE_RESET_PASSWORD)) {
|
||||
boolean exist = userService.existByEmail(email);
|
||||
if (!exist) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.emailcode.emailUnregistered"));
|
||||
}
|
||||
} else {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.emailcode.sourceInvalid"));
|
||||
}
|
||||
|
||||
try {
|
||||
String code = SysUtil.getSixRandom();
|
||||
MailSendHelper.sendMail(email, code);
|
||||
session.setAttribute("email", email);
|
||||
session.setAttribute("emailcode", code);
|
||||
session.removeAttribute("captchaStr");
|
||||
return new BaseResponse(new HashMap<>());
|
||||
} catch (Exception e) {
|
||||
logger.error("发送邮箱验证码异常: {} ", e.getMessage(), e);
|
||||
return new BaseResponse(MsgUtil.getMessage("user.programException"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/register/email")
|
||||
@ResponseBody
|
||||
public synchronized BaseResponse registerByEmail(String email, String password, String code, HttpSession session) {
|
||||
|
||||
BaseResponse baseResponse = checkByEmail(email, password, code, session);
|
||||
if (baseResponse != null) {
|
||||
return baseResponse;
|
||||
}
|
||||
boolean exist = userService.existByEmail(email);
|
||||
if (exist) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.register.email.emailRegistered"));
|
||||
}
|
||||
String md5Password = MD5Util.MD(password, email);
|
||||
User user = new User(null, null, email, md5Password);
|
||||
user.setType(Const.USER_TYPE_USER);
|
||||
user.preInsert();
|
||||
userService.save(user);
|
||||
session.removeAttribute("email");
|
||||
session.removeAttribute("emailcode");
|
||||
return new BaseResponse(new HashMap<>());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/resetPassword/email")
|
||||
@ResponseBody
|
||||
public BaseResponse resetPasswordByEmail(String email, String password, String code, HttpSession session) {
|
||||
|
||||
BaseResponse baseResponse = checkByEmail(email, password, code, session);
|
||||
if (baseResponse != null) {
|
||||
return baseResponse;
|
||||
}
|
||||
User user = userService.getUserByEmail(email);
|
||||
if (user == null) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.register.email.emailUnregistered"));
|
||||
}
|
||||
String md5Password = MD5Util.MD(password, email);
|
||||
user.setPassword(md5Password);
|
||||
user.preUpdate();
|
||||
userService.save(user);
|
||||
session.removeAttribute("email");
|
||||
session.removeAttribute("emailcode");
|
||||
return new BaseResponse(new HashMap<>());
|
||||
}
|
||||
|
||||
private BaseResponse checkByEmail(String email, String password, String code, HttpSession session) {
|
||||
|
||||
if (StringUtils.isEmpty(email) || StringUtils.isEmpty(password) || StringUtils.isEmpty(code)) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.email.phonePasswordCodeEmpty"));
|
||||
}
|
||||
String oldEmail = (String) session.getAttribute("email");
|
||||
String oldEmailcode = (String) session.getAttribute("emailcode");
|
||||
if (oldEmail == null || oldEmailcode == null) {
|
||||
logger.error("邮箱或邮箱验证码为空: 邮箱{}, 验证码{}", oldEmail, oldEmailcode);
|
||||
return new BaseResponse(MsgUtil.getMessage("user.email.code.empty"));
|
||||
}
|
||||
if (!oldEmail.equals(email) || !oldEmailcode.equals(code)) {
|
||||
logger.error("邮箱验证码错误: 原邮箱{}, 现邮箱{}, 原验证码{}, 现验证码{}", oldEmail, email, oldEmailcode, code);
|
||||
return new BaseResponse(MsgUtil.getMessage("user.email.code.error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/login/phone")
|
||||
@ResponseBody
|
||||
public BaseResponse loginByPhone(String countryCode, String phone, String password, HttpSession session) {
|
||||
|
||||
if (StringUtils.isEmpty(countryCode) || StringUtils.isEmpty(phone) || StringUtils.isEmpty(password)) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.login.phonePasswordEmpty"));
|
||||
}
|
||||
|
||||
try {
|
||||
User user = userService.getUserByPhone(countryCode, phone);
|
||||
if (user == null) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.login.phoneUnregistered"));
|
||||
}
|
||||
String md5Password = MD5Util.MD(password, phone);
|
||||
if (!user.getPassword().equals(md5Password)) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.login.phonePasswordError"));
|
||||
}
|
||||
return login(session, user);
|
||||
} catch (Exception e) {
|
||||
logger.error("用户登录失败: {} ", e.getMessage(), e);
|
||||
return new BaseResponse(MsgUtil.getMessage("user.programException"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String md5Password = MD5Util.MD("liqun.123", "13522070301");
|
||||
System.out.println(md5Password);
|
||||
}
|
||||
@RequestMapping(value = "/login/email")
|
||||
@ResponseBody
|
||||
public BaseResponse loginByEmail(String email, String password, HttpSession session) {
|
||||
|
||||
if (StringUtils.isEmpty(email) || StringUtils.isEmpty(password)) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.login.emailPasswordEmpty"));
|
||||
}
|
||||
|
||||
try {
|
||||
User user = userService.getUserByEmail(email);
|
||||
if (user == null) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.login.emailUnregistered"));
|
||||
}
|
||||
String md5Password = MD5Util.MD(password, email);
|
||||
if (!user.getPassword().equals(md5Password)) {
|
||||
return new BaseResponse(MsgUtil.getMessage("user.login.emailPasswordError"));
|
||||
}
|
||||
return login(session, user);
|
||||
} catch (Exception e) {
|
||||
logger.error("用户登录失败: {} ", e.getMessage(), e);
|
||||
return new BaseResponse(MsgUtil.getMessage("user.programException"));
|
||||
}
|
||||
}
|
||||
|
||||
private BaseResponse login(HttpSession session, User user) {
|
||||
session.setAttribute(Const.currentLoginUserId, user.getId());
|
||||
session.setAttribute(Const.currentLoginUserType, user.getType());
|
||||
Map<String, Object> res = new HashMap<>();
|
||||
res.put("type", user.getType());
|
||||
return new BaseResponse(res);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/logout")
|
||||
@ResponseBody
|
||||
public BaseResponse logout(HttpSession session) {
|
||||
|
||||
session.removeAttribute(Const.currentLoginUserId);
|
||||
session.removeAttribute(Const.currentLoginUserType);
|
||||
logger.info("【logout】 退出成功!当前SessionID:{}", session.getId() );
|
||||
return new BaseResponse(new HashMap<>());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/tryLogin")
|
||||
@ResponseBody
|
||||
public BaseResponse tryLogin() {
|
||||
|
||||
return new BaseResponse(new HashMap<>());
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package io.icchain.wxcontractbot.controller.welcome;
|
||||
|
||||
import io.icchain.wxcontractbot.controller.BaseController;
|
||||
import io.icchain.wxcontractbot.service.welcome.WelcomeService;
|
||||
import io.icchain.wxcontractbot.utils.BaseResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@RequestMapping(value = "/welcome")
|
||||
@Controller
|
||||
public class WelcomeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WelcomeService welcomeService;
|
||||
|
||||
@RequestMapping(value="queryByChatId")
|
||||
@ResponseBody
|
||||
public BaseResponse queryByChatId(String chatId) {
|
||||
|
||||
return welcomeService.queryByChatId(chatId);
|
||||
}
|
||||
|
||||
@RequestMapping(value="")
|
||||
@ResponseBody
|
||||
public BaseResponse info() {
|
||||
|
||||
return welcomeService.info();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/list")
|
||||
@ResponseBody
|
||||
public BaseResponse list(@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "pagesize", defaultValue = "10") int pagesize) {
|
||||
|
||||
return welcomeService.list(page, pagesize);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/intervalSeconds/save")
|
||||
@ResponseBody
|
||||
public BaseResponse saveIntervalSeconds(String intervalSeconds) {
|
||||
|
||||
return welcomeService.saveIntervalSeconds(intervalSeconds);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/sleepPeriod/save")
|
||||
@ResponseBody
|
||||
public BaseResponse saveSleepPeriod(String sleepPeriod) {
|
||||
|
||||
return welcomeService.saveSleepPeriod(sleepPeriod);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/chat/list")
|
||||
@ResponseBody
|
||||
public BaseResponse chatList(@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "pagesize", defaultValue = "10") int pagesize) {
|
||||
|
||||
return welcomeService.chatList(page, pagesize);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/chat/all")
|
||||
@ResponseBody
|
||||
public BaseResponse chatAll() {
|
||||
|
||||
return welcomeService.chatAll();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/appliedChat/list")
|
||||
@ResponseBody
|
||||
public BaseResponse appliedChatList(@RequestParam(value = "id", defaultValue = "") String id,
|
||||
@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "pagesize", defaultValue = "10") int pagesize) {
|
||||
|
||||
return welcomeService.appliedChatList(id, page, pagesize);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/appliedChatIds/all")
|
||||
@ResponseBody
|
||||
public BaseResponse appliedChatIds(@RequestParam(value = "id", defaultValue = "") String id) {
|
||||
|
||||
return welcomeService.appliedChatIds(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/add")
|
||||
@ResponseBody
|
||||
public BaseResponse add(@RequestParam(value = "title", defaultValue = "") String title,
|
||||
@RequestParam(value = "atUser", defaultValue = "") String atUser,
|
||||
@RequestParam(value = "content", defaultValue = "") String content,
|
||||
@RequestParam(value = "chatIds", defaultValue = "") String chatIds) {
|
||||
|
||||
return welcomeService.add(title, atUser, content, chatIds);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/update")
|
||||
@ResponseBody
|
||||
public BaseResponse update(@RequestParam(value = "id", defaultValue = "") String id,
|
||||
@RequestParam(value = "title", defaultValue = "") String title,
|
||||
@RequestParam(value = "atUser", defaultValue = "") String atUser,
|
||||
@RequestParam(value = "content", defaultValue = "") String content,
|
||||
@RequestParam(value = "chatIds", defaultValue = "") String chatIds) {
|
||||
|
||||
return welcomeService.update(id, title, atUser, content, chatIds);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/status/update")
|
||||
@ResponseBody
|
||||
public BaseResponse updateStatus(String id, String status) {
|
||||
|
||||
return welcomeService.updateStatus(id, status);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete")
|
||||
@ResponseBody
|
||||
public BaseResponse delete(String id) {
|
||||
|
||||
return welcomeService.delete(id);
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package io.icchain.wxcontractbot.dao.accurate.add.friends;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriendsBot;
|
||||
import io.icchain.wxcontractbot.entity.common.BotJoinFriendsDataInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 精确加粉机器人表(io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriendsBot)表数据库访问层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-04 12:02:00
|
||||
*/
|
||||
@Repository
|
||||
public interface AccurateAddFriendsBotDao extends JpaRepository<AccurateAddFriendsBot, String>, JpaSpecificationExecutor<AccurateAddFriendsBot> {
|
||||
/**
|
||||
* 获取七日内发送加好友机器人信息
|
||||
* @param wxIds
|
||||
* @param queryDate
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select u.bot_wx_id as 'wxid',count(1) as 'sendCount' from t_accurate_add_friends_user u\n" +
|
||||
"where u.status!='0' and u.bot_wx_id in (?1) and u.create_date>=?2\n" +
|
||||
"group by u.bot_wx_id ",nativeQuery = true)
|
||||
List<BotJoinFriendsDataInfo> getSevenDaySendMsgData(List<String> wxIds, Date queryDate);
|
||||
|
||||
/**
|
||||
* 获取七日内加好友成功信息
|
||||
* @param wxIds
|
||||
* @param queryDate
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select u.bot_wx_id as 'wxid',count(1) as 'addCount' from t_accurate_add_friends_user u\n" +
|
||||
"where u.status='3' and u.bot_wx_id in (?1) and u.create_date>=?2\n" +
|
||||
"group by u.bot_wx_id ",nativeQuery = true)
|
||||
List<BotJoinFriendsDataInfo> getSevenDayJoinFriendsData(List<String> wxIds, Date queryDate);
|
||||
|
||||
/**
|
||||
* 获取最近7天加好友信息的机器人信息
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select t.* from t_accurate_add_friends_bot t where t.create_date>=SUBDATE(NOW(),INTERVAL 7 DAY)",nativeQuery = true)
|
||||
List<AccurateAddFriendsBot> getSevenDayJoinFriendBotList();
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package io.icchain.wxcontractbot.dao.accurate.add.friends;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriendsComment;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 精准加粉文案表(AccurateAddFriendsComment)表数据库访问层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-04 13:24:43
|
||||
*/
|
||||
@Repository
|
||||
public interface AccurateAddFriendsCommentDao extends JpaRepository<AccurateAddFriendsComment, String>, JpaSpecificationExecutor<AccurateAddFriendsComment> {
|
||||
|
||||
@Query(value = "select max(t.sortNum) from AccurateAddFriendsComment t ")
|
||||
Integer getMaxSortNum();
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package io.icchain.wxcontractbot.dao.accurate.add.friends;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriends;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 精准加粉配置表(AccurateAddFriends)表数据库访问层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-04 12:02:22
|
||||
*/
|
||||
@Repository
|
||||
public interface AccurateAddFriendsDao extends JpaRepository<AccurateAddFriends, String>, JpaSpecificationExecutor<AccurateAddFriends> {
|
||||
|
||||
@Query("select u from AccurateAddFriends u where u.status in(?1) ")
|
||||
List<AccurateAddFriends> findListByStatus(List<String> status);
|
||||
|
||||
@Query("select u from AccurateAddFriends u where u.createDate>=?1")
|
||||
List<AccurateAddFriends> findLastTenDayData(Date queryDate);
|
||||
|
||||
/**
|
||||
* 更新执行中的任务状态
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = "update t_accurate_add_friends t2 set t2.`status`='2' where not EXISTS(select *from (select f.* from t_accurate_add_friends f \n" +
|
||||
"inner join t_accurate_add_friends_user u on u.add_friends_id=f.id\n" +
|
||||
"where u.`status`='0') as t1 where t1.id=t2.id)", nativeQuery = true)
|
||||
Integer updateExecutingTaskStatus();
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package io.icchain.wxcontractbot.dao.accurate.add.friends;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriendsRecords;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
/**
|
||||
* 精确加粉 记录表(AccurateAddFriendsRecords)表数据库访问层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-08 16:29:14
|
||||
*/
|
||||
@Repository
|
||||
public interface AccurateAddFriendsRecordsDao extends JpaRepository<AccurateAddFriendsRecords,String>, JpaSpecificationExecutor<AccurateAddFriendsRecords> {
|
||||
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package io.icchain.wxcontractbot.dao.accurate.add.friends;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.accurate.add.friends.AccurateAddFriendsUser;
|
||||
import io.icchain.wxcontractbot.entity.common.StatisticDataInfo;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 精准加粉用户列表(AccurateAddFriendsUser)表数据库访问层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-04 12:02:12
|
||||
*/
|
||||
@Repository
|
||||
public interface AccurateAddFriendsUserDao extends JpaRepository<AccurateAddFriendsUser, String>, JpaSpecificationExecutor<AccurateAddFriendsUser> {
|
||||
|
||||
@Query("select count(t) from AccurateAddFriendsUser t where t.userWxId=?1 and t.createDate>=?2")
|
||||
Integer findByUserWxId(String userWxId, Date queryDate);
|
||||
|
||||
@Query("select t from AccurateAddFriendsUser t where t.addFriendsId=?1")
|
||||
Page<AccurateAddFriendsUser> findAll(String addFriendsId, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 获取一天内机器人进群数量大于10个
|
||||
*/
|
||||
@Query(value = " select b.bot_wx_id as wxId,max(b.bot_nick_name) as nickName,count(t.bot_wx_id) as count from t_accurate_add_friends_bot b \n" +
|
||||
" inner join t_accurate_add_friends_records t on t.bot_wx_id=b.bot_wx_id " +
|
||||
" and Date(t.create_date)=Date(NOW()) " +
|
||||
" where b.add_friends_id=?2 and b.bot_wx_id in(?3)" +
|
||||
" group by b.bot_wx_id " +
|
||||
" having count>?1", nativeQuery = true)
|
||||
List<StatisticDataInfo> findNotAvailableToSendMsgBotList(Integer count,String addFriendsId,List<String> botWxIds);
|
||||
|
||||
/**
|
||||
* 获取一组任务内机器人的信息
|
||||
*/
|
||||
@Query(value = " select b1.bot_wx_id as wxId,max(t2.create_date) as maxDate,max(b1.bot_nick_name) as nickName from t_accurate_add_friends_bot b1 " +
|
||||
"left join t_accurate_add_friends_records t2 " +
|
||||
"on t2.bot_wx_id=b1.bot_wx_id " +
|
||||
"where b1.add_friends_id=?1 " +
|
||||
"group by t2.bot_wx_id ", nativeQuery = true)
|
||||
List<StatisticDataInfo> findBotList(String addFriendsId);
|
||||
|
||||
@Query(value = "select * from t_accurate_add_friends_user t where t.user_wx_id in (?1) " +
|
||||
"and t.create_date>SUBDATE(NOW(),INTERVAL 7 Day)", nativeQuery = true)
|
||||
List<AccurateAddFriendsUser> findSevenDaySendMsgWxIdList(List<String> userWxIds);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = "update t_accurate_add_friends_user u set u.`status`='3',u.update_date=now()\n" +
|
||||
"where u.user_wx_id in(select distinct t.user_wx_id from t_accurate_add_friends_records t\n" +
|
||||
"inner join t_wxcb_user_add_bot_as_friend f on t.bot_wx_id=f.bot_wxid and f.wxid=t.user_wx_id \n" +
|
||||
"where t.create_date>=SUBDATE(now(),INTERVAL 7 DAY))", nativeQuery = true)
|
||||
Integer updateJoinFriendsStatus();
|
||||
|
||||
@Query(value = "select u.add_friends_id as wxId,count(*) as count from t_accurate_add_friends_user u\n" +
|
||||
"where u.`status`=?1 and u.add_friends_id in(?2) \n" +
|
||||
"group by u.add_friends_id", nativeQuery = true)
|
||||
List<StatisticDataInfo> findDataByStatus(String status, List<String> idList);
|
||||
|
||||
@Query(value = "select u.add_friends_id as wxId,count(u.user_wx_id) as count from t_accurate_add_friends_user u \n" +
|
||||
" where u.`status`='3' and u.add_friends_id in(?1) \n" +
|
||||
" group by u.add_friends_id", nativeQuery = true)
|
||||
List<StatisticDataInfo> findAddSuccessData(List<String> idList);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = "delete from t_accurate_add_friends_user \n" +
|
||||
"where create_date<=SUBDATE(NOW(),INTERVAL 15 MINUTE) and\n" +
|
||||
"not exists(select * from t_accurate_add_friends f where f.id=add_friends_id)", nativeQuery = true)
|
||||
Integer deleteInvalidUserData();
|
||||
|
||||
/**
|
||||
* 获取近7日被机器人添加好友的人数
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select t.* from t_accurate_add_friends_user t where t.status='1' and t.create_date>=SUBDATE(NOW(),INTERVAL 7 DAY)",nativeQuery = true)
|
||||
List<AccurateAddFriendsUser> getSevenDayJoinFriendUserList();
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright 2019-2108 ICC (Intelligence Commerce Chain, https://icchain.io).
|
||||
* *
|
||||
* * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* * you may not use this file except in compliance with the License.
|
||||
* * You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing, software
|
||||
* * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* * See the License for the specific language governing permissions and
|
||||
* * limitations under the License.
|
||||
*
|
||||
*/
|
||||
package io.icchain.wxcontractbot.dao.agent;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.agent.AnswerDetailEntity;
|
||||
import io.icchain.wxcontractbot.entity.agent.ManageUserEntity;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName: HookTokenPriceAnswerDetailDao
|
||||
* @Description: TODO
|
||||
* @date: 2019年5月13日 下午4:10:37
|
||||
*/
|
||||
public interface AnswerDetailDao extends JpaRepository<AnswerDetailEntity,String>, JpaSpecificationExecutor<AnswerDetailEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.icchain.wxcontractbot.dao.agent;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.agent.BotChat;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Repository
|
||||
public interface BotChatDao extends JpaRepository<BotChat,String>, JpaSpecificationExecutor<BotChat> {
|
||||
|
||||
@Query(value = "from BotChat t where t.wxId=?1 and t.chatId=?2")
|
||||
List<BotChat> findByChatIdAndWxId(String lineid, String chatId);
|
||||
|
||||
|
||||
@Query(value = "from BotChat t where t.chatId=?1")
|
||||
List<BotChat> findByChatId(String chatId);
|
||||
|
||||
|
||||
@Query(value = "select t.wxId from BotChat t where t.chatId=?1")
|
||||
List<String> getBotListByChatId(String chatId);
|
||||
|
||||
|
||||
@Query(value = "select t from BotChat t where t.chatId in (?1)")
|
||||
List<BotChat> findByChatIds(List<String> chatIdList);
|
||||
|
||||
@Query(value = "delete from BotChat where wxId=?1 and chatId=?2")
|
||||
@Modifying
|
||||
int delByBotIdAndChatId(String botId, String chatId);
|
||||
|
||||
@Query(value = "select t from BotChat t where t.chatId in (?1)")
|
||||
List<BotChat> findByChatIdsAndWxIds(List<String> chatIdList);
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright 2019-2108 ICC (Intelligence Commerce Chain, https://icchain.io).
|
||||
* *
|
||||
* * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* * you may not use this file except in compliance with the License.
|
||||
* * You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing, software
|
||||
* * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* * See the License for the specific language governing permissions and
|
||||
* * limitations under the License.
|
||||
*
|
||||
*/
|
||||
package io.icchain.wxcontractbot.dao.agent;
|
||||
|
||||
|
||||
import io.icchain.wxcontractbot.entity.agent.ChatOwnerEntity;
|
||||
import io.icchain.wxcontractbot.entity.common.StatisticDataInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface BotChatOwnerDao extends JpaRepository<ChatOwnerEntity,String>, JpaSpecificationExecutor<ChatOwnerEntity> {
|
||||
|
||||
@Query(value = "select IFNULL(sum(chat.chat_member_cnt),0) from t_wxcb_chat_owner o\n" +
|
||||
"inner join t_wxcb_chat_message chat on o.chat_id=chat.chat_id",nativeQuery = true)
|
||||
Long getOwnerChatTotalUserCount();
|
||||
|
||||
|
||||
@Query(value = "select count(DISTINCT t.wxid) from t_wxcb_chat_owner t",nativeQuery = true)
|
||||
Long getOwnerChatUserCount();
|
||||
|
||||
|
||||
@Query(value = "select count(*) as count,DATE_FORMAT(t.create_date,?3) as dateStr from t_wxcb_chat_owner t\n" +
|
||||
"where t.create_date>=?1 and t.create_date<=?2 " +
|
||||
"group by DATE_FORMAT(t.create_date,?3)",nativeQuery = true)
|
||||
List<StatisticDataInfo> findByDate(Date startDate, Date endDate, String pattern);
|
||||
|
||||
|
||||
@Query(value = "select IFNULL(sum(chat.chat_member_cnt),0) as count,DATE_FORMAT(t.create_date,?3) as dateStr from t_wxcb_chat_owner t" +
|
||||
" inner join t_wxcb_chat_message chat on chat.chat_id=t.chat_id" +
|
||||
" where t.create_date>=?1 and t.create_date<=?2 "+
|
||||
" group by DATE_FORMAT(t.create_date,?3)",nativeQuery = true)
|
||||
List<StatisticDataInfo> findUserCountByDate(Date startDate, Date endDate, String groupPattern);
|
||||
|
||||
|
||||
@Query(value = "select IFNULL(sum(chat.chat_member_cnt),0) from t_wxcb_chat_owner o\n" +
|
||||
"inner join t_wxcb_chat_message chat on o.chat_id=chat.chat_id where o.create_date>=?1 and o.create_date<=?2",nativeQuery = true)
|
||||
Long getOwnerChatUserCountByTime(Date startDate, Date endDate);
|
||||
|
||||
@Query(value = "select count(1) from t_wxcb_chat_owner o\n" +
|
||||
"inner join t_wxcb_chat_message chat on o.chat_id=chat.chat_id",nativeQuery = true)
|
||||
Long totalChatOwnerCount();
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright 2019-2108 ICC (Intelligence Commerce Chain, https://icchain.io).
|
||||
* *
|
||||
* * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* * you may not use this file except in compliance with the License.
|
||||
* * You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing, software
|
||||
* * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* * See the License for the specific language governing permissions and
|
||||
* * limitations under the License.
|
||||
*
|
||||
*/
|
||||
package io.icchain.wxcontractbot.dao.agent;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.agent.BotFriends;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName: TokenPriceManageUserDao
|
||||
* @Description: TODO
|
||||
* @date: 2019年5月13日 下午4:09:40
|
||||
*/
|
||||
@Repository
|
||||
public interface BotFriendsDao extends JpaRepository<BotFriends,String>, JpaSpecificationExecutor<BotFriends> {
|
||||
|
||||
@Query(value ="select t.wxid from BotFriends t where t.wxid in (?1)")
|
||||
List<String> findByUserIds(List<String> userIds);
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright 2019-2108 ICC (Intelligence Commerce Chain, https://icchain.io).
|
||||
* *
|
||||
* * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* * you may not use this file except in compliance with the License.
|
||||
* * You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing, software
|
||||
* * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* * See the License for the specific language governing permissions and
|
||||
* * limitations under the License.
|
||||
*
|
||||
*/
|
||||
package io.icchain.wxcontractbot.dao.agent;
|
||||
|
||||
|
||||
import io.icchain.wxcontractbot.entity.agent.BotMessageEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public interface BotMessageDao extends JpaRepository<BotMessageEntity,String>, JpaSpecificationExecutor<BotMessageEntity> {
|
||||
|
||||
@Query("select t from BotMessageEntity t where t.wxId=?1")
|
||||
List<BotMessageEntity> findByWxId(String wxId);
|
||||
|
||||
@Query(value = "select wx_id wxId,bot_nickname botNickname from t_wxcb_bot_message", nativeQuery = true)
|
||||
List<Map> getAll();
|
||||
|
||||
@Query(value = "select m.wx_id wxId,m.bot_nickname botNickname,m.friend_cnt friendCnt,count(c.id) botChatCount from t_wxcb_bot_message m " +
|
||||
"left join t_wxcb_bot_chat c on m.wx_id = c.wx_id group by m.wx_id order by m.id asc limit ?1, ?2", nativeQuery = true)
|
||||
List<Map> getPage(int start, int number);
|
||||
|
||||
@Query(value = "select count(1) from t_wxcb_bot_message", nativeQuery = true)
|
||||
Long getCount();
|
||||
|
||||
@Query(value = "select m.wx_id wxId,m.bot_nickname botNickname,m.friend_cnt friendCnt,count(c.id) botChatCount from t_wxcb_bot_message m " +
|
||||
"left join t_wxcb_bot_chat c on m.wx_id = c.wx_id where m.bot_nickname like %?1% group by m.wx_id order by m.id asc limit ?2, ?3", nativeQuery = true)
|
||||
List<Map> getPageByNickname(String nickname, int start, int number);
|
||||
|
||||
@Query(value = "select count(1) from t_wxcb_bot_message where bot_nickname like %?1%", nativeQuery = true)
|
||||
Long getCountByNickname(String nickname);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package io.icchain.wxcontractbot.dao.agent;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.agent.BotQuitChatRecords;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
/**
|
||||
* @author wangx
|
||||
*/
|
||||
@Repository
|
||||
public interface BotQuitChatRecordsDao extends JpaRepository<BotQuitChatRecords,String>, JpaSpecificationExecutor<BotQuitChatRecords> {
|
||||
|
||||
@Query(value="select count(*) from (select * from t_wxcb_bot_quit_chat_records t group by t.chat_id ) as t",nativeQuery = true)
|
||||
Long getQuitCount();
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package io.icchain.wxcontractbot.dao.agent;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.agent.ChatAiConfig;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ChatAiConfigDao extends JpaRepository<ChatAiConfig, String>, JpaSpecificationExecutor<ChatAiConfig> {
|
||||
|
||||
@Query("select t from ChatAiConfig t where t.chatId=?1 and t.delFlag='0'")
|
||||
ChatAiConfig findByChatId(String chatId);
|
||||
|
||||
@Query("select t from ChatAiConfig t where t.delFlag='0'")
|
||||
List<ChatAiConfig> findAllActive();
|
||||
|
||||
@Query("select t from ChatAiConfig t where t.chatId in ?1 and t.delFlag='0'")
|
||||
List<ChatAiConfig> findByChatIdIn(List<String> chatIds);
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package io.icchain.wxcontractbot.dao.agent;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.agent.ChatAnalysisRecords;
|
||||
|
||||
import io.icchain.wxcontractbot.entity.common.StatisticDataInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 社群分析记录表(ChatAnalysisRecords)表数据库访问层
|
||||
*
|
||||
* @author xuelei.wang
|
||||
* @create time 2020-06-29 17:51:12
|
||||
*/
|
||||
@Repository
|
||||
public interface ChatAnalysisRecordsDao extends JpaRepository<ChatAnalysisRecords, String>, JpaSpecificationExecutor<ChatAnalysisRecords> {
|
||||
|
||||
@Query(value = "select t.* from t_chat_analysis_records t where DATE(t.create_date)=DATE(ADDDATE(NOW(),INTERVAL -1 DAY)) ",nativeQuery = true)
|
||||
List<ChatAnalysisRecords> findYesterdayData();
|
||||
|
||||
@Query("select sum(t.privateChatIncrementCnt) from ChatAnalysisRecords t where t.privateChatIncrementCnt>0 and t.createDate>=?1 and t.createDate<=?2")
|
||||
Long findChatCountByTime(Date startDate, Date endDate);
|
||||
|
||||
@Query("select sum(t.privateChatCnt) from ChatAnalysisRecords t where t.createDate>=?1 and t.createDate<=?2")
|
||||
Long findYesterdayChatCountByTime(Date startDate, Date endDate);
|
||||
|
||||
@Query("select sum(t.privateChatUsrIncrementCnt) from ChatAnalysisRecords t where t.privateChatUsrIncrementCnt>0 and t.createDate>=?1 and t.createDate<=?2")
|
||||
Long findChatUserCountByTime(Date startDate, Date endDate);
|
||||
|
||||
@Query("select sum(t.privateChatUsrCnt) from ChatAnalysisRecords t where t.createDate>=?1 and t.createDate<=?2")
|
||||
Long findYesterdayChatUserCountByTime(Date startDate, Date endDate);
|
||||
|
||||
@Query(value = "select sum(t.private_chat_usr_increment_cnt) as count,sum(t.private_chat_increment_cnt) as chatCount,DATE_FORMAT(t.create_date,?3) as dateStr" +
|
||||
" from t_chat_analysis_records t " +
|
||||
" where t.create_date>=?1 and t.create_date<=?2 "+
|
||||
" group by DATE_FORMAT(t.create_date,?3)",nativeQuery = true)
|
||||
List<StatisticDataInfo> findAnalysisData(Date startDate, Date endDate, String groupPattern);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user