项目git迁移
This commit is contained in:
commit
db617a6b6c
|
|
@ -0,0 +1,21 @@
|
|||
target
|
||||
bak
|
||||
.pmd
|
||||
.project
|
||||
.settings
|
||||
.classpath
|
||||
.idea.xml
|
||||
.idea
|
||||
*.class
|
||||
*.bak
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
bak
|
||||
null/
|
||||
tree.log
|
||||
tmp/
|
||||
velocity.log
|
||||
.DS_Store
|
||||
logs
|
||||
.m2
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright 2007-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenWrapperDownloader {
|
||||
|
||||
private static final String WRAPPER_VERSION = "0.5.6";
|
||||
/**
|
||||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
||||
*/
|
||||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
||||
|
||||
/**
|
||||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
||||
* use instead of the default one.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
||||
".mvn/wrapper/maven-wrapper.properties";
|
||||
|
||||
/**
|
||||
* Path where the maven-wrapper.jar will be saved to.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_JAR_PATH =
|
||||
".mvn/wrapper/maven-wrapper.jar";
|
||||
|
||||
/**
|
||||
* Name of the property which should be used to override the default download url for the wrapper.
|
||||
*/
|
||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("- Downloader started");
|
||||
File baseDirectory = new File(args[0]);
|
||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
||||
|
||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
||||
// wrapperUrl parameter.
|
||||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
||||
String url = DEFAULT_DOWNLOAD_URL;
|
||||
if (mavenWrapperPropertyFile.exists()) {
|
||||
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
||||
try {
|
||||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
||||
Properties mavenWrapperProperties = new Properties();
|
||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
||||
} catch (IOException e) {
|
||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
||||
} finally {
|
||||
try {
|
||||
if (mavenWrapperPropertyFileInputStream != null) {
|
||||
mavenWrapperPropertyFileInputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Ignore ...
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading from: " + url);
|
||||
|
||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
||||
if (!outputFile.getParentFile().exists()) {
|
||||
if (!outputFile.getParentFile().mkdirs()) {
|
||||
System.out.println(
|
||||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
||||
try {
|
||||
downloadFileFromURL(url, outputFile);
|
||||
System.out.println("Done");
|
||||
System.exit(0);
|
||||
} catch (Throwable e) {
|
||||
System.out.println("- Error downloading");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
||||
String username = System.getenv("MVNW_USERNAME");
|
||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
}
|
||||
URL website = new URL(urlString);
|
||||
ReadableByteChannel rbc;
|
||||
rbc = Channels.newChannel(website.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(destination);
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
fos.close();
|
||||
rbc.close();
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
distributionUrl=http://10.252.96.249:8081/repository/maven-public//org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
|
||||
wrapperUrl=http://10.252.96.249:8081/repository/maven-public//io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
# 贡献者行为准则
|
||||
|
||||
为了营造一个开放和热情的环境,作为该项目的贡献者和维护者,我们承诺尊重所有通过issue报告问题、发布功能请求、更新文档、提交拉取请求或补丁,以及其他活动做出贡献的人。
|
||||
|
||||
|
||||
|
||||
我们致力于更多人能参与到这个项目的发展,无论经验水平、教育、年龄、外表、种族、性别特征、性别认同如何。
|
||||
|
||||
|
||||
|
||||
为了使沟通过程更加愉快,我们制定了一些要求贡献者遵守的基本准则。
|
||||
|
||||
本行为准则适用于所有项目空间,也适用于个人在公共场所代表项目或其社区时。代表项目或社区的示例包括使用官方项目电子邮件地址、通过官方社交媒体帐户发布信息,或在在线或离线活动中担任指定代表。项目的表现形式可以由项目维护者进一步定义和澄清。
|
||||
|
||||
|
||||
|
||||
如果您认为有人违反了行为准则,请通过`wjia@lly59.wecom.work`、`zhuangchangliang@lly59.wecom.work`报告给项目团队。所有投诉都将被审查和调查,并将作出被认为必要且适合具体情况的回应。项目团队有义务对事件的报告者保密。
|
||||
|
||||
|
||||
|
||||
## 我们的标准
|
||||
|
||||
有助于创造积极环境的行为,示例包括:
|
||||
|
||||
- 使用热情和包容的语言
|
||||
|
||||
- 尊重不同的观点和经历
|
||||
|
||||
- 优雅地接受建设性的批评
|
||||
|
||||
- 专注于对社区最有利的事情
|
||||
|
||||
- 对其他社区成员表示尊重、友好和耐心
|
||||
|
||||
参与者不可接受的行为,示例包括:
|
||||
|
||||
- 发布露骨色情或暴力的内容
|
||||
|
||||
- 针对他人的暴力威胁或语言
|
||||
|
||||
- 喷子、侮辱/贬损评论以及人身或政治攻击
|
||||
|
||||
- 公共或私人骚扰。一般而言,有人要你停止,你就要停止。
|
||||
|
||||
- 未经明确许可发布(或威胁发布)他人的私人信息,例如物理地址或电子地址
|
||||
|
||||
- 在专业场合可能被合理认为不合适的其他行为
|
||||
|
||||
## 我们的责任
|
||||
|
||||
项目维护人员负责阐明可接受行为的标准,并期望针对任何不可接受行为的情况采取适当和公平的纠正措施。
|
||||
|
||||
项目维护人员有权利和责任删除、编辑或拒绝不符合本行为准则的评论、提交、代码、wiki 编辑、问题和其他贡献,或暂时或永久禁止被他们认为不适当、威胁性、冒犯或有害的任何贡献者的其他行为。
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
# **贡献指南**
|
||||
|
||||
这篇指南会指导你如何为 easyWeCom 贡献一份自己的力量,请在提 issue 或者 pull request 之前仔细阅读一遍这篇指南。
|
||||
|
||||
#### **行为准则**
|
||||
|
||||
我们有一份[行为准则](https://github.com/easywecom/easyWeCom_Dashboard/blob/main/dosc/CODE_OF_CONDUCT.md),希望所有的贡献者都能遵守,请花时间阅读一遍全文以确保你能明白哪些是可以做的,哪些是不可以做的。
|
||||
|
||||
#### **开发流程**
|
||||
|
||||
我们所有的工作都会放在 [GitHub](https://github.com/easywecom/easyWeCom_Dashboard)上。不管是核心团队的成员还是外部贡献者的 pull request 都需要经过同样流程的 review,也非常欢迎各位开发者 Review 并参与讨论。
|
||||
|
||||
参考资料: [代码规范与审核流程](https://github.com/easywecom/easyWeCom_Dashboard/blob/main/dosc/%E4%BB%A3%E7%A0%81%E8%A7%84%E8%8C%83%E4%B8%8E%E5%AE%A1%E6%A0%B8%E6%B5%81%E7%A8%8B.md)
|
||||
|
||||
#### **分支管理**
|
||||
|
||||
我们的主要维护三个分支 :master fix feature 。
|
||||
|
||||
如果你要修一个 bug:请基于 fix 分支开发,发起 pull request 到 fix ;
|
||||
|
||||
如果你要增加一个新功能或者对现有的功能进行优化:那么请基于 feature 分支开发,并发起 pull request 到 feature ;
|
||||
|
||||
我们每月定期合并 fix feature 到 master ,并发布一个正式版本。
|
||||
|
||||
#### **Bugs**
|
||||
|
||||
我们使用 [GitHub Issues](https://github.com/easywecom/easyWeCom_Dashboard/issues)来做 bug 追踪。 如果你想要你发现的 bug 被快速解决,最好的办法就是使用这个 [模板](https://easywecom.github.io) 提供bug相关信息,为了bug能够快速被解决,我们希望 **信息提供得尽可能完整** 。
|
||||
|
||||
在反馈 bug 之前,需要经过以下两个流程:
|
||||
|
||||
1. 搜索已有的issue,确认该 bug 无人反馈,避免相同的 bug 多次反馈,重复处理。
|
||||
|
||||
1. 阅读我们的 [常见问题解答](https://www.yuque.com/docs/share/9217b462-a4c2-4d4a-97cb-48eebf800784#Ydt5N),确认不是由于配置问题导致功能使用异常。
|
||||
|
||||
#### **新增功能**
|
||||
|
||||
如果你有改进我们现有的功能或者新增功能的想法,我们同样推荐你使用我们提供的 [模板](https://easywecom.github.io) 来新建一个添加新功能的 issue 。
|
||||
|
||||
在新建 issue 之前,需要先搜索已有的issue,确认这是首次提出的优化建议或新增功能,避免出现两个或多个相同描述的issue 。
|
||||
|
||||
#### **Pull Request**
|
||||
|
||||
请按照下面的步骤发送 Pull Request :
|
||||
|
||||
1. 基于 **正确的分支** 创建开发分支。
|
||||
|
||||
1. 按照编码规范进行开发。
|
||||
|
||||
1. 提交之前使用 SonarLint 或其他代码检查工具对当前模块代码进行检查,并修改完所有的异常提示。
|
||||
|
||||
1. 提交代码,请求合并到对应分支。
|
||||
|
||||
#### **参与讨论**
|
||||
|
||||
可以到 easyWeCom 的 Discussions 板块参与讨论。
|
||||
|
||||
可以加入我们的企业微信群,与我们的技术人员和其他贡献者一起讨论。
|
||||
|
||||

|
||||
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
<p align="center">
|
||||
<img src="https://wecomsaas-1253559996.cos.ap-guangzhou.myqcloud.com/2022/08/12/easyink%20logo.png" />
|
||||
</p>
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/edition-V1.27.0-brightgreen" />
|
||||
<img src="https://img.shields.io/badge/license-GPL%203.0-yellow" />
|
||||
<img src="https://img.shields.io/badge/mysql-5.7.41-orange" />
|
||||
<img src="https://img.shields.io/badge/jdk-1.8.301(64bit)%2B-red" />
|
||||
<img src="https://img.shields.io/badge/es-7.16.2-orange" />
|
||||
</p>
|
||||
<h4 align="center">
|
||||
<a href="http://www.lianluoyi.cn" target="_blank">官网</a> |
|
||||
<a href="http://www.easyink.net" target="_blank">体验</a> |
|
||||
<a href="https://gitee.com/lianluoyi/easyink-install/wikis/%E7%94%A8%E6%88%B7%E6%8C%87%E5%8D%97" target="_blank">安装</a> |
|
||||
<a href="https://xsxda94vjq.feishu.cn/docx/Xj0LdWimxoeIeYxEKR9cTFJMnSg" target="_blank">帮助中心</a>
|
||||
</h4>
|
||||
|
||||
<h4 align="center">如果我们的项目对您有帮助的话,帮忙动动金手指在右上角点个🌟star,您的支持是我们开源团队的最大动力💪。</p>
|
||||
<hr />
|
||||
|
||||
## :rocket: 做最简单易用的系统
|
||||
|
||||
`easyink` 是基于企业微信生态的一站式私域流量运营平台。包含**客户引流、客户互动、托管后台、会话存档审计**这几个主要功能模块。
|
||||
|
||||
为企微用户提供更便捷的企微后台管理功能,提供更全面、更规范的运营服务能力,深化企业与私域客户的互动,提高客户转化率。
|
||||
|
||||
## :taxi: 快速体验
|
||||
|
||||
- 建议使用谷歌浏览器访问
|
||||
|
||||
- [多租户体验入口](http://www.easyink.net) (免费体验60天)
|
||||
|
||||
- 该环境采用第三方应用+代开发应用模式,可借助[第三方应用操作手册](https://www.yuque.com/docs/share/591b5dff-f705-413e-b167-e8ef72d519bf?#O35E2)辅助体验
|
||||
|
||||
- [单租户体验入口](http://119.91.63.136:8091) 账号密码:admin/easyink2021
|
||||
|
||||
- 该环境采用自建应用模式,可借助[自建应用操作手册](https://www.yuque.com/docs/share/9217b462-a4c2-4d4a-97cb-48eebf800784?#hsf4v)辅助体验
|
||||
|
||||
## :factory: 关联项目
|
||||
|
||||
| 项目名 | 项目说明 | 项目地址 |
|
||||
| ------------------- | ------------------------------------------------------- | -------- |
|
||||
| **easyink_System(当前项目)** | **EasyInk后端服务** | **https://github.com/lianluoyi/easyink_System** |
|
||||
| easyink_Dashboard | easyink前端服务,主要负责后台UI界面展示 | https://github.com/lianluoyi/easyink_Dashboard |
|
||||
| easyink_Sidebar | easyink前端服务,主要负责企微客户端中的侧边栏界面展示 | https://github.com/lianluoyi/easyink_Sidebar |
|
||||
| easyink_middleProcessing | easyink h5前端服务,主要负责雷达、智能表单等营销活动页面的展示(非必要模块) | https://github.com/lianluoyi/easyink_middleProcessing |
|
||||
| easyink_MiniProgram | easyink 活码小程序服务,主要负责员工活码、群活码页面的展示(非必要模块) | https://github.com/lianluoyi/easyink_MiniProgram |
|
||||
|
||||
|
||||
## :star2: 功能特性
|
||||
|
||||
|
||||
- [x] 账号体系打通企业微信
|
||||
- [x] 简洁美观的页面
|
||||
- [x] 自定义 UI 主题
|
||||
- [x] 支持多租户和单租户
|
||||
- [x] 快速部署和使用
|
||||
- [x] 完整的接口、组件文档
|
||||
- [x] 简单易用的框架
|
||||
|
||||
|
||||
|
||||
> 了解有关 easyink 功能的更多信息,请访问 [「自建应用操作手册」](https://www.yuque.com/docs/share/9217b462-a4c2-4d4a-97cb-48eebf800784?#hsf4v)、[「三方应用操作手册」](https://www.yuque.com/docs/share/591b5dff-f705-413e-b167-e8ef72d519bf?#O35E2)
|
||||
|
||||
## :book: 功能清单
|
||||
|
||||
[]()
|
||||
|
||||
## :page_with_curl: 项目演示图
|
||||
|
||||
[]()
|
||||
|
||||
[]()
|
||||
|
||||
[]()
|
||||
|
||||
[]()
|
||||
|
||||
[]()
|
||||
|
||||
[]()
|
||||
|
||||
[]()
|
||||
|
||||
## :factory: 业务架构
|
||||
[]()
|
||||
|
||||
## :house: 项目结构
|
||||
|
||||
- **后端**
|
||||
|
||||
```
|
||||
com.easyink
|
||||
├── easyink-common // 全局配置、工具模块
|
||||
├── easyink-framework // 系统框架模块
|
||||
├── easyink-quartz // 定时任务模块
|
||||
├── easyink-admin // 后台管理接口
|
||||
├── easyink-wecom // 企微业务模块
|
||||
│ └── client // 请求客户端
|
||||
│ └── domain // 实体类
|
||||
│ └── fatory // 工厂类
|
||||
│ └── interceptor // 请求拦截器
|
||||
│ └── listener // 事件监听
|
||||
│ └── login // 登录
|
||||
│ └── service // 业务接口
|
||||
│ └── strategy // 回调处理策略
|
||||
```
|
||||
|
||||
- **前端**
|
||||
|
||||
详细项目结构见 [**easyink-dashboard**](https://github.com/lianluoyi/easyink_Dashboard) 和 [**easyink-sidebar**](https://github.com/lianluoyi/easyink_Sidebar) 的readme文件
|
||||
|
||||
|
||||
## :bulb: 系统依赖
|
||||
|
||||
- **后端**
|
||||
|
||||
| 环境依赖 | 版本 |
|
||||
| ------------------- | --------------- |
|
||||
| JDK | `1.8.301(64bit)+` |
|
||||
| Mysql | `5.7.41` |
|
||||
| Redis | `4.0.6+` |
|
||||
| Maven | `3.5.2+` |
|
||||
| ElasticSearch(可选) | `7.10.1+` |
|
||||
|
||||
|
||||
|
||||
- **前端**
|
||||
|
||||
| 环境依赖 | 版本 |
|
||||
| -------- | ---- |
|
||||
| node | `V14.18.1+` |
|
||||
| npm | `6.14.15+` |
|
||||
|
||||
|
||||
## :airplane: 技术栈
|
||||
|
||||
**前端**
|
||||
|
||||
| 技术栈名称 | 说明 | 地址 |
|
||||
| ---------- | ------------------------------------------------------------ | --------------------------------------- |
|
||||
| es6 | 全称 ECMAScript 6.0 ,是 JavaScript 的下一个版本标准 | https://www.w3schools.com/js/js_es6.asp |
|
||||
| vue | 是一套用于构建用户界面的渐进式框架 | https://github.com/vuejs |
|
||||
| vuex | 是一个专为Vue.js 应用程序开发的状态管理模式+ 库 | https://vuex.vuejs.org |
|
||||
| vue router | 是 [Vue.js](http://v3.vuejs.org/) 的官方路由 | https://router.vuejs.org/zh/ |
|
||||
| vue cli | 是一个基于 Vue.js 进行快速开发的完整系统 | https://cli.vuejs.org/zh/ |
|
||||
| axios | 是一个基于 promise 的 HTTP 库,可以用在浏览器和 node.js 中 | https://github.com/axios/axios |
|
||||
| element-ui | 是一套为开发者、设计师和产品经理准备的基于Vue 2.0 的桌面端组件库 | https://github.com/ElemeFE/element |
|
||||
|
||||
**后端**
|
||||
|
||||
| 技术栈名称 | 说明 | 地址 |
|
||||
| ------------- | ------------------------------------------------------------ | ---------------------------------------------- |
|
||||
| SpringBoot | 主框架 | http://spring.io/projects/spring-boot |
|
||||
| MyBatis | 一款优秀的持久层框架,它支持定制化 SQL、存储过程以及高级映射 | http://www.mybatis.org/mybatis-3/zh/index.html |
|
||||
| Druid | 数据库连接池。Druid能够提供强大的监控和扩展功能 | https://github.com/alibaba/druid |
|
||||
| redis | 是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库, | https://redis.io/ |
|
||||
| elasticSearch | 分布式的使用 REST 接口的搜索引擎 | https://github.com/elastic/elasticsearch |
|
||||
| Jwt | JSON Web Token | https://jwt.io/ |
|
||||
|
||||
|
||||
|
||||
## :checkered_flag: 开始入门
|
||||
|
||||
### 1. 本地服务器
|
||||
|
||||
从 github.net 克隆:
|
||||
|
||||
```
|
||||
git clone https://github.com/lianluoyi/easyink_System.git
|
||||
```
|
||||
|
||||
> 服务器默认运行在8090端口,访问localhost:8090查看。
|
||||
|
||||
初始化和拉取 UI 模块:
|
||||
|
||||
```
|
||||
git clone https://github.com/lianluoyi/easyink_Dashboard.git
|
||||
git clone https://github.com/lianluoyi/easyink_Sidebar.git
|
||||
```
|
||||
|
||||
> 您需要使用 `Nginx` 来部署 UI 模块或使用开发软件来启动它。
|
||||
> 项目启动命令见对应项目的readme文档,
|
||||
`Nginx`部署步骤见 -> [前端部署文档](https://gitee.com/lianluoyi/easyink_Dashboard/wikis/%E5%89%8D%E7%AB%AF%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3?sort_id=5953163)
|
||||
|
||||
### 2. 在 K8s 上快速部署
|
||||
|
||||
除了本地服务器,我们还提供了快速部署的方法。
|
||||
|
||||
请查看: [How to deploy easyink on K8s cluster](https://xsxda94vjq.feishu.cn/wiki/wikcnEt21zsEptSLJhkBC67BPwc)
|
||||
|
||||
|
||||
|
||||
## :sunglasses: 鸣谢
|
||||
|
||||
- [「LinkWeChat」](https://gitee.com/LinkWeChat/link-wechat):本项目部分基于LinkWeChat项目进行开发,感谢LinkWeChat的开源帮助。
|
||||
- [「forest」](https://github.com/dromara/forest):A high-level and lightweight HTTP client framework for Java. it makes sending HTTP requests in Java easier.
|
||||
- [「mybatis-plus」](https://github.com/baomidou/mybatis-plus):An powerful enhanced toolkit of MyBatis for simplify development
|
||||
- [「Knife4j」](https://github.com/xiaoymin/swagger-bootstrap-ui):Swagger-bootstrap-ui is the Swagger front-end UI implementation, the purpose is to replace the Swagger default UI implementation Swagger-UI, make the document more friendly...
|
||||
- [「hutool」](https://github.com/dromara/hutool):A set of tools that keep Java sweet.
|
||||
- [「moment」](https://github.com/moment):Parse, validate, manipulate, and display dates in javascript.
|
||||
- [「lodash」](https://github.com/lodash/lodash):A modern JavaScript utility library delivering modularity, performance, & extras.
|
||||
- [「vue-styleguidist」](https://vue-styleguidist.github.io):Created from react styleguidist for Vue Components with a living style guide.
|
||||
|
||||
|
||||
|
||||
## :sparkling_heart: 联系我们
|
||||
|
||||
<img src=https://wecomsaas-1253559996.cos.ap-guangzhou.myqcloud.com/2022/06/01/%E6%8A%80%E6%9C%AF%E4%BA%A4%E6%B5%81%E7%BE%A4%E6%B4%BB%E7%A0%81.png width=200 height=200 />
|
||||
|
||||
## 🥤 奖励一杯奶茶
|
||||
如果您觉得EasyInk项目对您有所帮助,可以给程序媛/猿们奖励一杯奶茶🥤,注入满满活力。
|
||||
您的激励就是对我们最大的肯定✨(捐赠时注意备注开源项目打赏或者其他留言哦,该打赏也会用于支持开源服务器的相关支出,帮助我们的开源项目茁壮成长🌲)
|
||||
|
||||
<img src="https://wecomsaas-1253559996.cos.ap-guangzhou.myqcloud.com/WechatIMG3691.jpeg" width=300 />
|
||||
|
||||
|
||||
## :pencil2: 贡献指南
|
||||
|
||||
请参阅[贡献指南](https://github.com/lianluoyi/easyink_System/blob/master/.github/CONTRIBUTING.md)
|
||||
|
||||
## :triangular_ruler:行为规范
|
||||
|
||||
请参阅[行为规范](https://github.com/lianluoyi/easyink_System/blob/master/.github/CODE_OF_CONDUCT.md)。
|
||||
|
||||
## :pencil: 版权和许可
|
||||
|
||||
本项目遵循[GPL 3.0]()开源协议
|
||||
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
# **代码规范与审核流程**
|
||||
|
||||
> 编码规范:[阿里巴巴Java开发手册终极版v1.3.0.pdf](https://www.w3cschool.cn/alibaba_java/)
|
||||
|
||||
#### **为什么要制定规范**
|
||||
|
||||
古话说,没有规矩不成方圆。在团队协作开发时,每个人提交代码时都会写 commit message,但如果没有规范,每个人都会有自己的书写风格,因此在代码审核时经常看到的是五花八门,十分不利于阅读和维护。
|
||||
|
||||
#### **开发规范**
|
||||
|
||||
**Git Commit message提交信息规范**
|
||||
|
||||
模板:
|
||||
|
||||
```
|
||||
[Type]问题摘要(issues链接)
|
||||
```
|
||||
|
||||
示例:
|
||||
|
||||
```
|
||||
[feat]增加企业微信自动化配置功能(https://github.com/easywecom/easyWeCom_Dashboard/issues/2)
|
||||
[fix]修复项目重启导致需要重新登录问题(https://github.com/easywecom/easyWeCom_Dashboard/issues/2)[docs]修改初始化数据库脚本(https://github.com/easywecom/easyWeCom_Dashboard/issues/2)
|
||||
```
|
||||
|
||||
Type 类型必须是下面之一,并且为小写:
|
||||
|
||||
```yaml
|
||||
feat: 修改/增加新功能
|
||||
fix: 修改bug的变更
|
||||
docs: 文档相关变更
|
||||
style: 不影响代码含义的变更(空白、格式、缺少符号等)
|
||||
refactor: 代码重构变更
|
||||
perf: 改进性能的变更
|
||||
test: 添加/修改现有的单元测试
|
||||
chore: Build, .gitignore或辅助工具、库(如文档生成)等变更
|
||||
```
|
||||
|
||||
#### **分支创建规范**
|
||||
|
||||
模板:
|
||||
|
||||
```
|
||||
feat/author-issues序号
|
||||
```
|
||||
|
||||
示例:
|
||||
|
||||
```
|
||||
例如:开发者developer1开发增加企业微信自动化配置功能, issues序号为41852
|
||||
那么分支创建为: feat/developer1-41852
|
||||
|
||||
例如:开发developer2修复项目重启导致需要重新登录问题, issues序号为41942
|
||||
那么分支创建为: fix/developer2-41942
|
||||
```
|
||||
|
||||
如何查看issues序号
|
||||
|
||||

|
||||
|
||||
#### **update.sql 文件更新规范**
|
||||
|
||||
每个sql更新都要加上注释和时间点和issues序号
|
||||
|
||||
❌ 错误
|
||||
|
||||
```sql
|
||||
-- 添加注释
|
||||
ALTER TABLE `we_flower_customer_rel` MODIFY COLUMN `status` char(2) NOT NULL DEFAULT '0' COMMENT '状态(0正常 1删除流失 2员工删除用户)';
|
||||
```
|
||||
|
||||
✅ 正确
|
||||
|
||||
```sql
|
||||
-- author 2021.xx.xx 客户员工关系表字段status增加注释((https://github.com/easywecom/easyWeCom_Dashboard/issues/2)
|
||||
ALTER TABLE `we_flower_customer_rel` MODIFY COLUMN `status` char(2) NOT NULL DEFAULT '0' COMMENT '状态(0正常 1删除流失 2员工删除用户)';
|
||||
```
|
||||
|
||||
#### **开发评审规范**
|
||||
|
||||
##### **代码提交合并流程** :
|
||||
|
||||
如果你打算开始处理一个 issue,请先检查一下 issue 下面的留言,确认没有其他开发者正在处理这个 issue后,你可以留言告知其他人你将会处理这个 issue,以免其他开发者重复处理。
|
||||
|
||||
如果之前有人留言说会处理这个 issue 但是一两个星期都没有动静,那么你也可以接手处理这个 issue,当然还是需要留言告知其他人。
|
||||
|
||||
所有的代码提交前,开发者必须在本地使用SonarLint对当前模块代码进行检查,并修改完所有的异常提示后,方可提交代码。
|
||||
|
||||
我们会关注所有的 pull request,对其进行 review 以及合并你的代码,也有可能要求你做一些修改或者告诉你我们为什么不能接受这样的修改。
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"access_token":"OGU3YJU4ZDYTZMU0ZS0ZOTI3LTG4NMETOWU1ZMI1NZEXMZC0","expires_in":"1734415193176"}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
version: '3.3'
|
||||
|
||||
# 如需配置变量,请在environment中进行变量配置
|
||||
services:
|
||||
api:
|
||||
image: easywecom
|
||||
container_name: easywecom
|
||||
environment:
|
||||
- JAVA_OPTS=-Xms4096m -Xmx4096m -Duser.timezone=Asia/Shanghai
|
||||
- TZ=Asia/Shanghai
|
||||
- NACOS_SERVER
|
||||
# 如果使用nacos,以下变量可以不进行配置
|
||||
- ES_ADDRESS
|
||||
- DB_HOST
|
||||
- DB_PORT
|
||||
- DB_NAME
|
||||
- DB_USER
|
||||
- DB_PASS
|
||||
- REDIS_HOST
|
||||
- REDIS_PORT
|
||||
ports:
|
||||
- 8090
|
||||
volumes:
|
||||
- ./logs:/logs
|
||||
# 上传文件地址,请根据实际${ruoyi.profile}自行修改映射
|
||||
- ./pic:/app/project/pic
|
||||
- ./tmp:/tmp
|
||||
restart: always
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>easyink</artifactId>
|
||||
<groupId>com.easyink</groupId>
|
||||
<version>3.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>easyink-admin</artifactId>
|
||||
|
||||
<description>
|
||||
web服务入口
|
||||
</description>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!--普罗米修斯 begin-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
</dependency>
|
||||
<!--普罗米修斯 end-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>transmittable-thread-local</artifactId>
|
||||
</dependency>
|
||||
<!--MDC线程传递增强-->
|
||||
<dependency>
|
||||
<groupId>com.ofpay</groupId>
|
||||
<artifactId>logback-mdc-ttl</artifactId>
|
||||
</dependency>
|
||||
<!--日志json格式化工具-->
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
</dependency>
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<exclusions>
|
||||
<!-- 排除版本冲突的guava -->
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
<!-- 排除版本冲突的swagger-annotations -->
|
||||
<exclusion>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<groupId>io.swagger</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.28</version>
|
||||
</dependency>
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.easyink</groupId>
|
||||
<artifactId>easyink-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 企业微信模块-->
|
||||
<dependency>
|
||||
<groupId>com.easyink</groupId>
|
||||
<artifactId>easyink-wecom</artifactId>
|
||||
</dependency>
|
||||
<!--腾讯云-->
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
<artifactId>cos_api</artifactId>
|
||||
<version>5.6.24</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<configuration>
|
||||
<imageName>${parent.artifactId}</imageName>
|
||||
<dockerDirectory>${basedir}/src/main/docker</dockerDirectory>
|
||||
<imageTags>
|
||||
<imageTag>${parent.version}</imageTag>
|
||||
</imageTags>
|
||||
<buildArgs>
|
||||
<!--指定参数jar-->
|
||||
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
|
||||
</buildArgs>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/</targetPath>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
FROM openjdk:8-alpine
|
||||
|
||||
RUN set -xe && apk --no-cache add ttf-dejavu fontconfig
|
||||
|
||||
# 设置时区
|
||||
ADD Shanghai /usr/share/zoneinfo/Asia/
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
&& echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
VOLUME /tmp
|
||||
|
||||
#设置字符集
|
||||
ENV LANG en_US.UTF-8
|
||||
ARG JAR_FILE
|
||||
ADD $JAR_FILE app.jar
|
||||
|
||||
ENTRYPOINT ["sh","-c","java -server $JAVA_OPTS -jar /app.jar"]
|
||||
Binary file not shown.
|
|
@ -0,0 +1,50 @@
|
|||
package com.easyink;
|
||||
|
||||
import com.dtflys.forest.springboot.annotation.ForestScan;
|
||||
import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* 类名:启动程序
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-17 14:18
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class})
|
||||
@MapperScan(basePackages = {"com.easyink.*.mapper","com.easyink.wecom.openapi.dao"})
|
||||
@ForestScan(basePackages = {"com.easyink.wecom.client", "com.easyink.wecom.wxclient"})
|
||||
@EnableAsync(proxyTargetClass = true)
|
||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||
public class EasyWeComApplication {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
SpringApplication.run(EasyWeComApplication.class, args);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
// SpringApplication.run(EasyWeComApplication.class, args);
|
||||
System.out.println("\n" +
|
||||
" ,----, ,----, \n" +
|
||||
" ,/ .`| ,/ .`| \n" +
|
||||
" .--.--. ,` .' : ,---, ,-.----. ,` .' : .--.--. ,----.. ,----.. ,---,. .--.--. .--.--. \n" +
|
||||
" / / '. ; ; / ' .' \\ \\ / \\ ; ; / / / '. ,--, / / \\ / / \\ ,' .' | / / '. / / '. \n" +
|
||||
"| : /`. / .'___,/ ,' / ; '. ; : \\ .'___,/ ,' | : /`. / ,'_ /| | : : | : : ,---.' | | : /`. / | : /`. / \n" +
|
||||
"; | |--` | : | : : \\ | | .\\ : | : | ; | |--` .--. | | : . | ;. / . | ;. / | | .' ; | |--` ; | |--` \n" +
|
||||
"| : ;_ ; |.'; ; : | /\\ \\ . : |: | ; |.'; ; | : ;_ ,'_ /| : . | . ; /--` . ; /--` : : |-, | : ;_ | : ;_ \n" +
|
||||
" \\ \\ `. `----' | | | : ' ;. : | | \\ : `----' | | \\ \\ `. | ' | | . . ; | ; ; | ; : | ;/| \\ \\ `. \\ \\ `. \n" +
|
||||
" `----. \\ ' : ; | | ;/ \\ \\ | : . / ' : ; `----. \\ | | ' | | | | : | | : | | : .' `----. \\ `----. \\ \n" +
|
||||
" __ \\ \\ | | | ' ' : | \\ \\ ,' ; | | \\ | | ' __ \\ \\ | : | | : ' ; . | '___ . | '___ | | |-, __ \\ \\ | __ \\ \\ | \n" +
|
||||
" / /`--' / ' : | | | ' '--' | | ;\\ \\ ' : | / /`--' / | ; ' | | ' ' ; : .'| ' ; : .'| ' : ;/| / /`--' / / /`--' / \n" +
|
||||
"'--'. / ; |.' | : : : ' | \\.' ; |.' '--'. / : | : ; ; | ' | '/ : ' | '/ : | | \\ '--'. / '--'. / \n" +
|
||||
" `--'---' '---' | | ,' : : :-' '---' `--'---' ' : `--' \\ | : / | : / | : .' `--'---' `--'---' \n" +
|
||||
" `--'' | |.' : , .-./ \\ \\ .' \\ \\ .' | | ,' \n" +
|
||||
" `---' `--`----' `---` `---` `----' \n" +
|
||||
" \n");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.easyink;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public class EasyWeComServletInitializer extends SpringBootServletInitializer {
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(EasyWeComApplication.class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.easyink.web.controller.common;
|
||||
|
||||
import com.easyink.common.constant.Constants;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.redis.RedisCache;
|
||||
import com.easyink.common.utils.sign.Base64;
|
||||
import com.easyink.common.utils.uuid.IdUtils;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 类名: CaptchaController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-27 15:52
|
||||
*/
|
||||
@Api(value = "CaptchaController", tags = "验证码接口")
|
||||
@ApiSupport(order = 1, author = "1*+")
|
||||
@RestController
|
||||
public class CaptchaController {
|
||||
@Resource(name = "captchaProducer")
|
||||
private Producer captchaProducer;
|
||||
|
||||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
// 验证码类型
|
||||
@Value("${ruoyi.captchaType}")
|
||||
private String captchaType;
|
||||
|
||||
private static final String MATH = "math";
|
||||
|
||||
/**
|
||||
* 生成验证码
|
||||
*/
|
||||
@ApiOperation("生成验证码")
|
||||
@GetMapping("/captchaImage")
|
||||
public AjaxResult getCode(HttpServletResponse response) {
|
||||
// 保存验证码信息
|
||||
String uuid = IdUtils.simpleUUID();
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
||||
|
||||
String capStr;
|
||||
String code;
|
||||
BufferedImage image;
|
||||
|
||||
// 生成验证码
|
||||
if (MATH.equals(captchaType)) {
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf('@'));
|
||||
code = capText.substring(capText.lastIndexOf('@') + 1);
|
||||
image = captchaProducerMath.createImage(capStr);
|
||||
} else {
|
||||
capStr = code = captchaProducer.createText();
|
||||
image = captchaProducer.createImage(capStr);
|
||||
}
|
||||
|
||||
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
// 转换流信息写出
|
||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||
try {
|
||||
ImageIO.write(image, "jpg", os);
|
||||
} catch (IOException e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("uuid", uuid);
|
||||
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
package com.easyink.web.controller.common;
|
||||
|
||||
import com.easyink.common.config.RuoYiConfig;
|
||||
import com.easyink.common.config.ServerConfig;
|
||||
import com.easyink.common.constant.Constants;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.FileVo;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.exception.CustomException;
|
||||
import com.easyink.common.exception.file.FileException;
|
||||
import com.easyink.common.exception.file.NoFileException;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.common.utils.file.FileUploadUtils;
|
||||
import com.easyink.common.utils.file.FileUtils;
|
||||
import com.easyink.framework.web.domain.server.SysFile;
|
||||
import com.easyink.framework.web.service.FileService;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 类名: CommonController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-27 16:09
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ApiSupport(order = 2, author = "1*+")
|
||||
@Api(value = "CommonController", tags = "通用接口")
|
||||
public class CommonController {
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
@Autowired
|
||||
private FileService fileService;
|
||||
|
||||
@Autowired
|
||||
private RuoYiConfig ruoYiConfig;
|
||||
|
||||
@GetMapping("/getPublicKey")
|
||||
@ApiOperation(value = "获取登录公钥")
|
||||
public AjaxResult<String> getPublicKey() {
|
||||
if (ruoYiConfig.getLoginRsaPublicKey()==null||StringUtils.isEmpty(ruoYiConfig.getLoginRsaPublicKey())) return AjaxResult.error(500,"请联系技术人员配置登录密钥");
|
||||
return AjaxResult.success(null, ruoYiConfig.getLoginRsaPublicKey()) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@ApiOperation(value = "通用下载")
|
||||
@GetMapping("common/download")
|
||||
public void fileDownload(@ApiParam("文件名") String fileName, @ApiParam("是否删除本地文件") Boolean delete, @ApiParam("是否带时间戳") Boolean needTimeStamp, HttpServletResponse response, HttpServletRequest request) {
|
||||
try {
|
||||
fileName = FileUtils.replaceFileNameUnValidChar(fileName);
|
||||
// 文件名分隔符 uuid_fileName.xlsx -> fileName.xlsx
|
||||
String splitSign = "_";
|
||||
String realFileName = fileName.substring(fileName.indexOf(splitSign) + 1);
|
||||
if(!Boolean.FALSE.equals(needTimeStamp)){
|
||||
realFileName = System.currentTimeMillis() + realFileName;
|
||||
}
|
||||
String filePath = RuoYiConfig.getDownloadPath() + fileName;
|
||||
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("multipart/form-data");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
|
||||
// 检查文件是否存在
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
log.error("要下载的文件不存在: {}", filePath);
|
||||
throw new NoFileException("no file");
|
||||
}
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (Boolean.TRUE.equals(delete)) {
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("下载文件失败, e:{}", ExceptionUtils.getStackTrace(e));
|
||||
throw new NoFileException("error");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求
|
||||
*/
|
||||
@ApiOperation(value = "通用上传")
|
||||
@PostMapping(value = "/common/upload", headers = "content-type=multipart/form-data")
|
||||
public AjaxResult uploadFile(@ApiParam(value = "上传文件", required = true) MultipartFile file) {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + FileUploadUtils.getPathFileName(filePath) + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求
|
||||
*/
|
||||
@ApiOperation(value = "上传域名校验证书")
|
||||
@PostMapping("/common/uploadCert")
|
||||
public AjaxResult uploadCert(@ApiParam("上传域名文件") MultipartFile file) {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.uploadCert(filePath, file);
|
||||
String url = serverConfig.getUrl() + FileUploadUtils.getPathFileName(filePath) + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@ApiOperation(value = "本地资源下载")
|
||||
@GetMapping("/common/download/resource")
|
||||
public void resourceDownload(@ApiParam("资源名") String name, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
// 本地资源路径
|
||||
String localPath = RuoYiConfig.getProfile();
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX);
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("multipart/form-data");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 网络资源通用下载
|
||||
*/
|
||||
@ApiOperation(value = "网络资源通用下载")
|
||||
@GetMapping("/common/download/url")
|
||||
public void webResourceDownload(@ApiParam("资源链接") String url, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
FileUtils.downloadFile(url, response.getOutputStream());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通用上传请求
|
||||
*/
|
||||
@ApiOperation(value = "上传到云存储")
|
||||
@PostMapping("/common/uploadFile2Cos")
|
||||
public AjaxResult uploadFile2Cos(@ApiParam("资源文件") MultipartFile file,String fileName) {
|
||||
FileUploadUtils.fileSuffixVerify(fileName, ruoYiConfig.getFile().getAllowUploadExtensionList());
|
||||
try {
|
||||
SysFile sysFile;
|
||||
sysFile = fileService.upload2CosV2(file, fileName);
|
||||
return AjaxResult.success(
|
||||
FileVo.builder()
|
||||
.fileName(sysFile.getFileName())
|
||||
.url(sysFile.getImgUrlPrefix())
|
||||
.build()
|
||||
);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("不支持当前文件上传或文件过大建议传20MB以内的文件");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取图片
|
||||
*/
|
||||
@ApiOperation("获取图片")
|
||||
@GetMapping("/common/findImage")
|
||||
public void findImage(HttpServletResponse response, @ApiParam("文件名") String fileName) {
|
||||
fileService.findImage(fileName, response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.easyink.web.controller.common;
|
||||
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.exception.CustomException;
|
||||
import com.easyink.common.shorturl.model.SysShortUrlMapping;
|
||||
import com.easyink.common.shorturl.service.ShortUrlService;
|
||||
import com.easyink.common.utils.ServletUtils;
|
||||
import com.easyink.common.utils.ip.IpUtils;
|
||||
import com.easyink.wecom.domain.vo.shorturl.GetOriginUrlVO;
|
||||
import com.easyink.wecom.handler.shorturl.AbstractShortUrlHandler;
|
||||
import com.easyink.wecom.handler.shorturl.ShortUrlHandlerFactory;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static com.easyink.common.enums.ResultTip.TIP_CANNOT_FIND_PAGE;
|
||||
|
||||
/**
|
||||
* 类名: 短链相关接口
|
||||
*
|
||||
* @author : silver_chariot
|
||||
* @date : 2022/7/18 17:08
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/url")
|
||||
@Api(value = "ShortUrlController", tags = "短链相关")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class ShortUrlController {
|
||||
/**
|
||||
* 短链长度
|
||||
*/
|
||||
public static final int SHORT_CODE_LENGTH = 6;
|
||||
private final ShortUrlService shortUrlService;
|
||||
private final ShortUrlHandlerFactory shortUrlHandlerFactory;
|
||||
|
||||
|
||||
|
||||
@GetMapping("/{shortCode}")
|
||||
@ApiOperation("根据短链获取原链接和短链的类型")
|
||||
public AjaxResult getUrlAndHandle(@ApiParam("短链后缀的code")@PathVariable String shortCode) {
|
||||
// 校验短链code
|
||||
validateCode(shortCode);
|
||||
// 校验访问Ip
|
||||
String serverIp = "";
|
||||
try {
|
||||
serverIp = IpUtils.getOutIp();
|
||||
} catch (Exception e) {
|
||||
log.error("[短链]获取服务器ip异常.e:{}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
|
||||
log.info("[短链]有人点击了短链,shortCode:{},ip:{},serverIp:{}", shortCode, ip, serverIp);
|
||||
if (serverIp.equals(ip)) {
|
||||
log.info("[短链]ip与服务器ip一样,不处理,ip:{}", ip);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
// 获取短链接到原链接的映射
|
||||
SysShortUrlMapping urlMapping = shortUrlService.getUrlByMapping(shortCode);
|
||||
AbstractShortUrlHandler handler = shortUrlHandlerFactory.getByType(urlMapping.getType());
|
||||
if (handler == null) {
|
||||
throw new CustomException(TIP_CANNOT_FIND_PAGE);
|
||||
}
|
||||
// 进行业务处理并返回 需要重定向的链接给前端
|
||||
return AjaxResult.success(new GetOriginUrlVO(urlMapping.getType(), handler.handleAndGetRedirectUrl(urlMapping)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验短链的code
|
||||
*
|
||||
* @param shortCode 短链6位的code
|
||||
*/
|
||||
private void validateCode(String shortCode) {
|
||||
if (StringUtils.isBlank(shortCode) || shortCode.length() != SHORT_CODE_LENGTH) {
|
||||
throw new CustomException(TIP_CANNOT_FIND_PAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.easyink.web.controller.monitor;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.framework.web.domain.Server;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 类名: ServerController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-27 16:30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/server")
|
||||
@ApiSupport(order = 3, author = "1*+")
|
||||
@Api(value = "ServerController", tags = "服务器监控接口")
|
||||
public class ServerController extends BaseController {
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||
@GetMapping()
|
||||
@ApiOperation("获取服务器监控信息")
|
||||
public AjaxResult getInfo() throws Exception {
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
return AjaxResult.success(server);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.easyink.web.controller.monitor;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.system.SysLogininfor;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.service.ISysLogininforService;
|
||||
import com.easyink.common.utils.poi.ExcelUtil;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: SysLogininforController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-27 16:40
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
@ApiSupport(order = 4, author = "1*+")
|
||||
@Api(value = "SysLogininforController", tags = "系统访问记录接口")
|
||||
public class SysLogininforController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysLogininforService logininforService;
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("系统访问日志列表")
|
||||
public TableDataInfo<SysLogininfor> list(SysLogininfor logininfor) {
|
||||
startPage();
|
||||
logininfor.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出系统访问日志")
|
||||
public AjaxResult export(SysLogininfor logininfor) {
|
||||
logininfor.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<>(SysLogininfor.class);
|
||||
return util.exportExcel(list, "登录日志");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
@ApiOperation("批量移除系统访问日志")
|
||||
public AjaxResult remove(@ApiParam("记录ID数组") @PathVariable Long[] infoIds) {
|
||||
return toAjax(logininforService.deleteLogininforByIds(LoginTokenService.getLoginUser().getCorpId(), infoIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
@ApiOperation("清空系统访问日志")
|
||||
public AjaxResult clean() {
|
||||
logininforService.cleanLogininfor(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.easyink.web.controller.monitor;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.system.SysOperLog;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.service.ISysOperLogService;
|
||||
import com.easyink.common.utils.poi.ExcelUtil;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/operlog")
|
||||
@ApiSupport(order = 5, author = "1*+")
|
||||
@Api(value = "SysOperlogController", tags = "系统操作记录接口")
|
||||
public class SysOperlogController extends BaseController {
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("系统操作日志列表")
|
||||
public TableDataInfo<SysOperLog> list(SysOperLog operLog) {
|
||||
startPage();
|
||||
operLog.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出系统操作日志")
|
||||
public AjaxResult export(SysOperLog operLog) {
|
||||
operLog.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<SysOperLog> util = new ExcelUtil<>(SysOperLog.class);
|
||||
return util.exportExcel(list, "操作日志");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/{operIds}")
|
||||
@ApiOperation("批量删除系统操作日志")
|
||||
public AjaxResult remove(@ApiParam("记录ID数组") @PathVariable Long[] operIds) {
|
||||
return toAjax(operLogService.deleteOperLogByIds(LoginTokenService.getLoginUser().getCorpId(), operIds));
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/clean")
|
||||
@ApiOperation("清空系统操作日志")
|
||||
public AjaxResult clean() {
|
||||
operLogService.cleanOperLog(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.easyink.web.controller.monitor;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.Constants;
|
||||
import com.easyink.common.constant.RedisKeyConstants;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.domain.system.SysUserOnline;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.core.redis.RedisCache;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.LogoutReasonEnum;
|
||||
import com.easyink.common.service.ISysUserOnlineService;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static java.util.stream.Collectors.collectingAndThen;
|
||||
import static java.util.stream.Collectors.toCollection;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/online")
|
||||
@ApiSupport(order = 6, author = "1*+")
|
||||
@Api(value = "SysUserOnlineController", tags = "系统在线用户接口")
|
||||
public class SysUserOnlineController extends BaseController {
|
||||
@Autowired
|
||||
private ISysUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("在线用户列表")
|
||||
public TableDataInfo<SysUserOnline> list(@ApiParam("Ip地址") String ipaddr, @ApiParam("用户昵称") String userName) {
|
||||
String currentCorpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<>();
|
||||
for (String key : keys) {
|
||||
LoginUser user = redisCache.getCacheObject(key);
|
||||
SysUserOnline sysUserOnline = null;
|
||||
if (StringUtils.isNotBlank(ipaddr) && StringUtils.isNotBlank(userName)) {
|
||||
sysUserOnline = userOnlineService.selectOnlineByInfo(ipaddr, userName, user);
|
||||
} else if (StringUtils.isNotBlank(ipaddr)){
|
||||
sysUserOnline = userOnlineService.selectOnlineByIpaddr(ipaddr, user);
|
||||
} else if (StringUtils.isNotBlank(userName)) {
|
||||
sysUserOnline = userOnlineService.selectOnlineByUserName(userName, user);
|
||||
} else {
|
||||
sysUserOnline = userOnlineService.loginUserToUserOnline(user);
|
||||
}
|
||||
if (sysUserOnline != null) {
|
||||
userOnlineList.add(sysUserOnline);
|
||||
}
|
||||
}
|
||||
// 根据登录用户名+ip地址 按登录时间倒序排序后 去重,保留最新登录的信息(同一ip如果没有通过后台登出而是直接关闭浏览器,下次打开浏览器登录后redis若token还没过期,则会有该ip的两个同样登录用户)
|
||||
List<SysUserOnline> list = userOnlineList.stream().filter(user->currentCorpId.equals(user.getCorpId()))
|
||||
.sorted(Comparator.comparing(SysUserOnline::getLoginTime).reversed()).collect(
|
||||
collectingAndThen(
|
||||
toCollection(() ->
|
||||
new TreeSet<>(
|
||||
Comparator.comparing(o -> o.getUserName() + ";" + o.getIpaddr()))
|
||||
), ArrayList::new));
|
||||
list.removeAll(Collections.singleton(null));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强退用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@DeleteMapping("/{tokenId}")
|
||||
@ApiOperation("强退用户列表")
|
||||
public AjaxResult forceLogout(@ApiParam("tokenId") @PathVariable String tokenId) {
|
||||
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
|
||||
// 设置登出原因缓存
|
||||
redisCache.setCacheObject(RedisKeyConstants.ACCOUNT_LOGOUT_REASON_KEY + tokenId, LogoutReasonEnum.FORCED.getCode()
|
||||
, 30, TimeUnit.MINUTES);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package com.easyink.web.controller.openapi;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.utils.ServletUtils;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.openapi.constant.AppInfoConst;
|
||||
import com.easyink.wecom.openapi.domain.entity.AppCallbackSetting;
|
||||
import com.easyink.wecom.openapi.domain.resp.BaseOpenApiResp;
|
||||
import com.easyink.wecom.openapi.domain.vo.AppIdGenVO;
|
||||
import com.easyink.wecom.openapi.dto.AddCallbackDTO;
|
||||
import com.easyink.wecom.openapi.dto.EditCallbackDTO;
|
||||
import com.easyink.wecom.openapi.service.AppCallbackSettingService;
|
||||
import com.easyink.wecom.openapi.service.AppIdInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: 开发参数生成接口
|
||||
*
|
||||
* @author : silver_chariot
|
||||
* @date : 2022/3/14 11:39
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/openapi")
|
||||
@Api(tags = {"开发参数生成接口"})
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class AppIdInfoController {
|
||||
|
||||
private final AppIdInfoService appIdGenService;
|
||||
private final AppCallbackSettingService appCallbackSettingService;
|
||||
|
||||
|
||||
@PostMapping("/appInfo/create")
|
||||
@ApiOperation("生成开发账号")
|
||||
public AjaxResult<AppIdGenVO> create() {
|
||||
return AjaxResult.success(appIdGenService.create(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/appInfo/get")
|
||||
@ApiOperation("获取开发参数")
|
||||
public AjaxResult<AppIdGenVO> get() {
|
||||
return AjaxResult.success(appIdGenService.getVO(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PostMapping("/appInfo/refreshSecret")
|
||||
@ApiOperation("刷新appSecret")
|
||||
public AjaxResult<AppIdGenVO> refreshSecret() {
|
||||
return AjaxResult.success(appIdGenService.refreshSecret(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/callback/list")
|
||||
@ApiOperation("获取消息订阅的回调地址")
|
||||
public AjaxResult<List<AppCallbackSetting>> getCallbackList() {
|
||||
return AjaxResult.success(appCallbackSettingService.list(new LambdaQueryWrapper<AppCallbackSetting>()
|
||||
.eq(AppCallbackSetting::getCorpId, LoginTokenService.getLoginUser().getCorpId())
|
||||
));
|
||||
}
|
||||
|
||||
@PostMapping("/callback")
|
||||
@ApiOperation("新增消息订阅的回调地址")
|
||||
public AjaxResult<Void> addCallbackUrl(@RequestBody AddCallbackDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(appCallbackSettingService.addUrl(dto));
|
||||
}
|
||||
@PutMapping("/callback")
|
||||
@ApiOperation("编辑消息订阅的回调地址")
|
||||
public AjaxResult<Void> editCallbackUrl(@RequestBody EditCallbackDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
appCallbackSettingService.editUrl(dto);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/callback/{id}")
|
||||
@ApiOperation("删除消息订阅的回调地址")
|
||||
public AjaxResult<Void> delCallbackUrl( @PathVariable("id")Long id) {
|
||||
appCallbackSettingService.deleteUrl(id);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/validate")
|
||||
@ApiOperation("校验签名")
|
||||
public BaseOpenApiResp<Integer> validate() {
|
||||
log.info("[openApi]收到校验签名请求,{}", ServletUtils.getRequest());
|
||||
return BaseOpenApiResp.success(AppInfoConst.TICKET_EXPIRE_TIME);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.easyink.web.controller.openapi;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 类名: 对外开放的api接口
|
||||
*
|
||||
* @author : silver_chariot
|
||||
* @date : 2022/3/14 15:44
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/open_api")
|
||||
@Api(tags = {"对外开放的api接口"})
|
||||
public class OpenApiController {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.easyink.web.controller.openapi;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.utils.wecom.CorpSecretDecryptUtil;
|
||||
import com.easyink.wecom.domain.dto.unionid.GetUnionIdDTO;
|
||||
import com.easyink.wecom.domain.vo.unionid.GetUnionIdVO;
|
||||
import com.easyink.wecom.service.WeCustomerService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 类名: easyink获取unionId 接口
|
||||
*
|
||||
* @author : silver_chariot
|
||||
* @date : 2023/1/4 14:19
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/unionId")
|
||||
@AllArgsConstructor
|
||||
public class UnionIdController extends BaseController {
|
||||
|
||||
private final WeCustomerService weCustomerService;
|
||||
|
||||
@PostMapping("/getByExternalUserId")
|
||||
public AjaxResult<GetUnionIdVO> getByExternalUserId(@RequestBody GetUnionIdDTO getUnionIdDTO) {
|
||||
return AjaxResult.success( weCustomerService.getDetailByExternalUserId(getUnionIdDTO) );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
package com.easyink.web.controller.order;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.enums.AppIdEnum;
|
||||
import com.easyink.common.enums.ExpressNameEnum;
|
||||
import com.easyink.common.enums.LoginTypeEnum;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.wecom.domain.entity.appconfig.YiGeOrderAppConfig;
|
||||
import com.easyink.wecom.domain.order.OrderLoginVO;
|
||||
import com.easyink.wecom.domain.order.OrderNetworkVO;
|
||||
import com.easyink.wecom.domain.vo.MyApplicationIntroductionVO;
|
||||
import com.easyink.wecom.login.service.SysLoginService;
|
||||
import com.easyink.wecom.service.WeMyApplicationService;
|
||||
import com.easyink.wecom.service.WeMyApplicationUseScopeService;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: OrderLoginController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-12-14 10:55
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/order")
|
||||
@Api(tags = "壹鸽工单应用接口")
|
||||
@Slf4j
|
||||
public class OrderLoginController extends BaseController {
|
||||
|
||||
|
||||
private final SysLoginService loginService;
|
||||
private final WeMyApplicationUseScopeService weMyApplicationUseScopeService;
|
||||
private final WeMyApplicationService weMyApplicationService;
|
||||
|
||||
@Autowired
|
||||
public OrderLoginController(SysLoginService loginService, WeMyApplicationUseScopeService weMyApplicationUseScopeService, WeMyApplicationService weMyApplicationService) {
|
||||
this.loginService = loginService;
|
||||
this.weMyApplicationUseScopeService = weMyApplicationUseScopeService;
|
||||
this.weMyApplicationService = weMyApplicationService;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("AI系统企业三方扫码登录")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 1001, message = "所在企业未授权当前应用,请联系企业管理员进行授权"),
|
||||
@ApiResponse(code = 7000, message = "所在企业未开通「壹鸽快递工单助手」,请联系管理员"),
|
||||
@ApiResponse(code = 7001, message = "您没有访问权限,请联系管理员"),
|
||||
@ApiResponse(code = 7002, message = "所在企业未开通「壹鸽快递工单助手」,请联系管理员")
|
||||
})
|
||||
@GetMapping("/login")
|
||||
public AjaxResult<OrderLoginVO> qrCodeLogin3rd(@ApiParam("扫码登录返回的授权码") @RequestParam("authCode") String authCode) {
|
||||
//登录解析LoginUser
|
||||
LoginResult loginResult = loginService.loginHandler(authCode, LoginTypeEnum.BY_THIRD_SCAN.getState());
|
||||
if (StringUtils.isNotBlank(loginResult.getErrorMsg())) {
|
||||
return AjaxResult.error(loginResult.getErrorMsg());
|
||||
}
|
||||
|
||||
LoginUser loginUser = loginResult.getLoginUser();
|
||||
if (loginUser == null || loginUser.getWeUser() == null) {
|
||||
return AjaxResult.error(ResultTip.TIP_MISSING_LOGIN_INFO);
|
||||
}
|
||||
//判断当前LoginUser是否在可登陆AI系统范围内
|
||||
List<String> userIdList = weMyApplicationUseScopeService.getUseScopeUserList(loginUser.getCorpId(), AppIdEnum.YIGE_ORDER.getCode());
|
||||
if (CollectionUtils.isEmpty(userIdList) || !userIdList.contains(loginUser.getWeUser().getUserId())) {
|
||||
return AjaxResult.error(ResultTip.TIP_UN_USE_AI_SYSTEM);
|
||||
}
|
||||
OrderLoginVO orderLoginVO = new OrderLoginVO(loginUser);
|
||||
|
||||
//获取网点配置
|
||||
MyApplicationIntroductionVO myApplicationIntroductionVO = weMyApplicationService.getMyApplicationDetail(loginUser.getCorpId(), AppIdEnum.YIGE_ORDER.getCode());
|
||||
if (StringUtils.isNotBlank(myApplicationIntroductionVO.getConfig())) {
|
||||
YiGeOrderAppConfig yiGeOrderAppConfig = JSON.parseObject(myApplicationIntroductionVO.getConfig(), YiGeOrderAppConfig.class);
|
||||
//如果网点id为空,直接返回未绑定网点
|
||||
if (StringUtils.isBlank(yiGeOrderAppConfig.getNetworkId())) {
|
||||
return AjaxResult.error(ResultTip.TIP_UN_BIND_NETWORK);
|
||||
}
|
||||
orderLoginVO.setNetworkId(yiGeOrderAppConfig.getNetworkId());
|
||||
orderLoginVO.setNetworkName(yiGeOrderAppConfig.getNetworkName());
|
||||
orderLoginVO.setExpressName(ExpressNameEnum.getEnum(yiGeOrderAppConfig.getType()).getDesc());
|
||||
} else {
|
||||
//配置为空也直接返回未绑定网点
|
||||
return AjaxResult.error(ResultTip.TIP_UN_BIND_NETWORK);
|
||||
}
|
||||
return AjaxResult.success(orderLoginVO);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("AI系统拉取已绑定的网点列表")
|
||||
@ApiResponses({
|
||||
})
|
||||
@GetMapping("/getNetworkList")
|
||||
public AjaxResult<OrderNetworkVO> getNetworkList() {
|
||||
List<OrderNetworkVO> result = new ArrayList<>();
|
||||
|
||||
List<MyApplicationIntroductionVO> list = weMyApplicationService.listOfMyApplication(AppIdEnum.YIGE_ORDER.getCode());
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
for (MyApplicationIntroductionVO myApplicationIntroductionVO : list) {
|
||||
if (StringUtils.isNotBlank(myApplicationIntroductionVO.getConfig())) {
|
||||
YiGeOrderAppConfig yiGeOrderAppConfig = JSON.parseObject(myApplicationIntroductionVO.getConfig(), YiGeOrderAppConfig.class);
|
||||
if (yiGeOrderAppConfig == null) {
|
||||
continue;
|
||||
}
|
||||
OrderNetworkVO orderNetworkVO = new OrderNetworkVO();
|
||||
orderNetworkVO.setExpressName(ExpressNameEnum.getEnum(yiGeOrderAppConfig.getType()).getDesc());
|
||||
orderNetworkVO.setNetworkId(yiGeOrderAppConfig.getNetworkId());
|
||||
orderNetworkVO.setNetworkName(yiGeOrderAppConfig.getNetworkName());
|
||||
orderNetworkVO.setCompanyName(myApplicationIntroductionVO.getCompanyName());
|
||||
orderNetworkVO.setCorpId(myApplicationIntroductionVO.getCorpId());
|
||||
result.add(orderNetworkVO);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
package com.easyink.web.controller.order;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.client.OrderClient;
|
||||
import com.easyink.wecom.domain.OrderGroupToOrderCustomerEntity;
|
||||
import com.easyink.wecom.domain.OrderUserToOrderAccountEntity;
|
||||
import com.easyink.wecom.domain.dto.BindDetailDTO;
|
||||
import com.easyink.wecom.domain.dto.UnBindOrderDTO;
|
||||
import com.easyink.wecom.domain.dto.unBindCustomerDTO;
|
||||
import com.easyink.wecom.domain.order.*;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.OrderGroupToOrderCustomerService;
|
||||
import com.easyink.wecom.service.OrderUserToOrderAccountService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 类名: OrderManagerController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-12-13 17:51
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/order")
|
||||
@Api(tags = "壹鸽工单应用接口")
|
||||
@Slf4j
|
||||
public class OrderManagerController extends BaseController {
|
||||
private final OrderClient orderClient;
|
||||
private final OrderUserToOrderAccountService orderUserToOrderAccountService;
|
||||
private final OrderGroupToOrderCustomerService groupToOrderCustomerService;
|
||||
|
||||
@Autowired
|
||||
public OrderManagerController(OrderClient orderClient, OrderUserToOrderAccountService orderUserToOrderAccountService, OrderGroupToOrderCustomerService groupToOrderCustomerService) {
|
||||
this.orderClient = orderClient;
|
||||
this.orderUserToOrderAccountService = orderUserToOrderAccountService;
|
||||
this.groupToOrderCustomerService = groupToOrderCustomerService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验网点ID
|
||||
*/
|
||||
@GetMapping("/verifyNetwork")
|
||||
@ApiOperation("校验网点ID")
|
||||
public AjaxResult<OrderVerifyVO> verifyNetwork(@Validated @NotBlank @RequestParam("networkId") String networkId) {
|
||||
return AjaxResult.success(orderUserToOrderAccountService.verifyNetworkId(networkId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网点账号列表接口
|
||||
*/
|
||||
@GetMapping("/networkUser")
|
||||
@ApiOperation("获取工单账号列表接口")
|
||||
public AjaxResult<OrderUser> networkUser() {
|
||||
return AjaxResult.success(orderUserToOrderAccountService.networkUser(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取网点客户列表接口
|
||||
*/
|
||||
@GetMapping("/networkCustomer")
|
||||
@ApiOperation("获取网点客户列表接口")
|
||||
public AjaxResult<OrderCustomer> networkCustomer() {
|
||||
return AjaxResult.success(orderUserToOrderAccountService.networkCustomer(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单列表接口
|
||||
*/
|
||||
@PostMapping("/listOrder")
|
||||
@ApiOperation("工单列表接口")
|
||||
public AjaxResult<OrderListVO> listOrder(@Validated @RequestBody OrderListDTO orderListDTO) {
|
||||
orderListDTO.setNetworkId(orderUserToOrderAccountService.getNetworkId(LoginTokenService.getLoginUser().getCorpId()));
|
||||
orderListDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(groupToOrderCustomerService.listOrder(orderListDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态变更接口
|
||||
*/
|
||||
@PostMapping("/handleOrder")
|
||||
@ApiOperation("状态变更接口")
|
||||
public AjaxResult<OrderHandlerVO> handleOrder(@Validated @RequestBody OrderHadlerDTO orderHadlerDTO) {
|
||||
orderHadlerDTO.setNetworkId(orderUserToOrderAccountService.getNetworkId(LoginTokenService.getLoginUser().getCorpId()));
|
||||
return AjaxResult.success(orderClient.handleOrder(orderHadlerDTO).getResult());
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单详情接口
|
||||
*/
|
||||
@PostMapping("/descOrder")
|
||||
@ApiOperation("工单详情接口")
|
||||
public AjaxResult<Order> descOrder(@Validated @RequestBody OrderDetailDTO orderDetailDTO) {
|
||||
orderDetailDTO.setNetworkId(orderUserToOrderAccountService.getNetworkId(LoginTokenService.getLoginUser().getCorpId()));
|
||||
return AjaxResult.success(orderClient.descOrder(orderDetailDTO).getResult());
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单数统计接口
|
||||
*/
|
||||
@PostMapping("/totalNumOrder")
|
||||
@ApiOperation("工单数统计接口")
|
||||
public AjaxResult<OrderTotal> totalNumOrder(@Validated @RequestBody OrderTotalDTO orderTotalDTO) {
|
||||
orderTotalDTO.setNetworkId(orderUserToOrderAccountService.getNetworkId(LoginTokenService.getLoginUser().getCorpId()));
|
||||
return AjaxResult.success(orderClient.totalNumOrder(orderTotalDTO).getResult());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/bindUser")
|
||||
@ApiOperation("绑定员工工单账号")
|
||||
public AjaxResult bindUser(@Validated @RequestBody OrderUserToOrderAccountEntity orderAccountEntity) {
|
||||
orderAccountEntity.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
orderUserToOrderAccountService.bindUser(orderAccountEntity);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/unbindUser")
|
||||
@ApiOperation("解绑员工工单")
|
||||
public AjaxResult unbindUser(@Validated @RequestBody UnBindOrderDTO orderAccountEntity) {
|
||||
orderAccountEntity.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
orderUserToOrderAccountService.unbindUser(orderAccountEntity);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/bindCustomer")
|
||||
@ApiOperation("绑定客户")
|
||||
public AjaxResult bindCustomer(@Validated @RequestBody OrderGroupToOrderCustomerEntity groupToOrderCustomerEntity) {
|
||||
groupToOrderCustomerEntity.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
groupToOrderCustomerService.bindCustomer(groupToOrderCustomerEntity);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/unbindCustomer")
|
||||
@ApiOperation("解绑客户")
|
||||
public AjaxResult unbindCustomer(@Validated @RequestBody unBindCustomerDTO unBindCustomerDTO) {
|
||||
unBindCustomerDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
groupToOrderCustomerService.unbindCustomer(unBindCustomerDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getBindTotal")
|
||||
@ApiOperation("获得员工数量绑定数量")
|
||||
public AjaxResult getBindTotal() {
|
||||
return AjaxResult.success(orderUserToOrderAccountService.getBindTotal(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/listOfBindDetail")
|
||||
@ApiOperation("获取绑定详情")
|
||||
public TableDataInfo listOfBindDetail(BindDetailDTO bindDetailDTO) {
|
||||
bindDetailDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
bindDetailDTO.setNetworkId(orderUserToOrderAccountService.getNetworkId(bindDetailDTO.getCorpId()));
|
||||
startPage();
|
||||
return getDataTable(orderUserToOrderAccountService.listOfBindDetail(bindDetailDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/getBindInfo")
|
||||
@ApiOperation("获取员工客户绑定信息")
|
||||
public AjaxResult<OrderBindInfoVO> getBindInfo(OrderBindInfoDTO orderBindInfoDTO) {
|
||||
if (!LoginTokenService.getLoginUser().isSuperAdmin()) {
|
||||
orderBindInfoDTO.setUserId(LoginTokenService.getLoginUser().getWeUser().getUserId());
|
||||
}
|
||||
orderBindInfoDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(orderUserToOrderAccountService.getBindInfo(orderBindInfoDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 机器人推送工单创建接口
|
||||
*/
|
||||
@PostMapping("/createOrder")
|
||||
@ApiOperation("创建工单")
|
||||
public AjaxResult<OrderCreate> createOrder(@Validated @RequestBody OrderCreateDTO orderCreateDTO) {
|
||||
return AjaxResult.success(orderClient.createOrder(orderCreateDTO));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.easyink.web.controller.pro;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.wecom.domain.dto.pro.EditCustomerFromPlusDTO;
|
||||
import com.easyink.wecom.domain.dto.pro.QueryCustomerFromPlusDTO;
|
||||
import com.easyink.wecom.domain.vo.QueryCustomerFromPlusVO;
|
||||
import com.easyink.wecom.service.WeCustomerService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 类名: 对企微PRO提供的接口控制层
|
||||
*
|
||||
* @author : silver_chariot
|
||||
* @date : 2021/11/2 11:27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/plus")
|
||||
@Api(tags = "对企微PRO提供的接口")
|
||||
@Slf4j
|
||||
public class WecomPlusController extends BaseController {
|
||||
|
||||
private final WeCustomerService weCustomerService;
|
||||
|
||||
@Autowired
|
||||
@Lazy
|
||||
public WecomPlusController(@NotNull WeCustomerService weCustomerService) {
|
||||
this.weCustomerService = weCustomerService;
|
||||
}
|
||||
|
||||
@GetMapping("/queryCustomer")
|
||||
@ApiOperation("根据成员id和客户头像查询客户详情")
|
||||
public AjaxResult<QueryCustomerFromPlusVO> queryCustomer(@Validated QueryCustomerFromPlusDTO dto) {
|
||||
return AjaxResult.success(weCustomerService.getDetailByUserIdAndCustomerAvatar(
|
||||
dto.getCorpId(), dto.getUserId(), dto.getAvatar()
|
||||
));
|
||||
}
|
||||
|
||||
@PostMapping("/editCustomer")
|
||||
@ApiOperation("修改客户资料")
|
||||
public AjaxResult editCustomer(@RequestBody @Validated EditCustomerFromPlusDTO dto) {
|
||||
weCustomerService.editByUserIdAndCustomerAvatar(dto);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.annotation.RepeatSubmit;
|
||||
import com.easyink.common.constant.UserConstants;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.system.SysConfig;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.service.ISysConfigService;
|
||||
import com.easyink.common.utils.poi.ExcelUtil;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/config")
|
||||
@ApiSupport(order = 7, author = "1*+")
|
||||
@Api(value = "SysUserOnlineController", tags = "参数配置接口")
|
||||
public class SysConfigController extends BaseController {
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("参数配置列表")
|
||||
public TableDataInfo<SysConfig> list(SysConfig config) {
|
||||
startPage();
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出参数配置")
|
||||
public AjaxResult export(SysConfig config) {
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<SysConfig> util = new ExcelUtil<>(SysConfig.class);
|
||||
return util.exportExcel(list, "参数数据");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||
@GetMapping(value = "/{configId}")
|
||||
@ApiOperation("获取参数配置详情")
|
||||
public AjaxResult<SysConfig> getInfo(@ApiParam("配置ID") @PathVariable Long configId) {
|
||||
return AjaxResult.success(configService.selectConfigById(configId));
|
||||
}
|
||||
|
||||
@ApiOperation("获取参数值")
|
||||
@GetMapping(value = "/configKey/{configKey}")
|
||||
public AjaxResult<String> getConfigKey(@ApiParam("配置键值") @PathVariable String configKey) {
|
||||
return AjaxResult.success(configService.selectConfigByKey(configKey));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@RepeatSubmit
|
||||
@ApiOperation("新增参数配置")
|
||||
public AjaxResult add(@Validated @RequestBody SysConfig config) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
||||
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(LoginTokenService.getUsername());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("编辑参数配置")
|
||||
public AjaxResult edit(@Validated @RequestBody SysConfig config) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
||||
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(LoginTokenService.getUsername());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
@ApiOperation("删除参数配置")
|
||||
public AjaxResult remove(@ApiParam("配置ID数组") @PathVariable Long[] configIds) {
|
||||
return toAjax(configService.deleteConfigByIds(configIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clearCache")
|
||||
@ApiOperation("清空参数缓存")
|
||||
public AjaxResult clearCache() {
|
||||
configService.clearCache();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.UserConstants;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.SysDept;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.domain.wecom.WeDepartment;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.service.ISysDeptService;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dept")
|
||||
@ApiSupport(order = 8, author = "1*+")
|
||||
@Api(value = "SysDeptController", tags = "系统部门接口", hidden = true)
|
||||
public class SysDeptController extends BaseController {
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
||||
@GetMapping(value = "/{deptId}")
|
||||
@ApiOperation(value = "根据部门编号获取详细信息", hidden = true)
|
||||
@Deprecated
|
||||
public AjaxResult<SysDept> getInfo(@ApiParam("部门ID") @PathVariable Long deptId) {
|
||||
return AjaxResult.success(deptService.selectDeptById(deptId));
|
||||
}
|
||||
|
||||
@GetMapping("/treeselect")
|
||||
@ApiOperation(value = "获取部门下拉树列表", hidden = true)
|
||||
public AjaxResult treeselect() {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
List<WeDepartment> depts = deptService.selectDeptList(
|
||||
WeDepartment.builder().corpId(loginUser.getCorpId()).build(),
|
||||
loginUser);
|
||||
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "加载对应角色部门列表树", hidden = true)
|
||||
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
|
||||
public AjaxResult roleDeptTreeselect(@ApiParam("角色ID") @PathVariable("roleId") Long roleId) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
List<WeDepartment> depts = deptService.selectDeptList(
|
||||
WeDepartment.builder().corpId(loginUser.getCorpId()).build(),
|
||||
loginUser);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增部门", hidden = true)
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@Deprecated
|
||||
public AjaxResult add(@Validated @RequestBody SysDept dept) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
||||
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
dept.setCreateBy(LoginTokenService.getUsername());
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改部门", hidden = true)
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@Deprecated
|
||||
public AjaxResult edit(@Validated @RequestBody SysDept dept) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
} else if (dept.getParentId().equals(dept.getDeptId())) {
|
||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) {
|
||||
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||
}
|
||||
dept.setUpdateBy(LoginTokenService.getUsername());
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除部门", hidden = true)
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
@Deprecated
|
||||
public AjaxResult remove(@ApiParam("部门ID") @PathVariable Long deptId) {
|
||||
if (deptService.hasChildByDeptId(deptId)) {
|
||||
return AjaxResult.error("存在下级部门,不允许删除");
|
||||
}
|
||||
if (deptService.checkDeptExistUser(deptId)) {
|
||||
return AjaxResult.error("部门存在用户,不允许删除");
|
||||
}
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.SysDictData;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.service.ISysDictDataService;
|
||||
import com.easyink.common.service.ISysDictTypeService;
|
||||
import com.easyink.common.utils.poi.ExcelUtil;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/data")
|
||||
@Api(value = "SysDictDataController", tags = "数据字典信息")
|
||||
public class SysDictDataController extends BaseController {
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询列表")
|
||||
public TableDataInfo list(SysDictData dictData) {
|
||||
startPage();
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出字典数据")
|
||||
public AjaxResult export(SysDictData dictData) {
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<SysDictData> util = new ExcelUtil<>(SysDictData.class);
|
||||
return util.exportExcel(list, "字典数据");
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典数据详细")
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictCode) {
|
||||
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
|
||||
}
|
||||
|
||||
@ApiOperation("根据字典类型查询字典数据信息")
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public AjaxResult dictType(@PathVariable String dictType) {
|
||||
return AjaxResult.success(dictTypeService.selectDictDataByType(dictType));
|
||||
}
|
||||
|
||||
@ApiOperation("新增字典类型")
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictData dict) {
|
||||
dict.setCreateBy(LoginTokenService.getUsername());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
@ApiOperation("修改保存字典类型")
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict) {
|
||||
dict.setUpdateBy(LoginTokenService.getUsername());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
@ApiOperation("删除字典类型")
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes) {
|
||||
return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.UserConstants;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.SysDictType;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.service.ISysDictTypeService;
|
||||
import com.easyink.common.utils.poi.ExcelUtil;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/type")
|
||||
@Api(value = "SysDictTypeController", tags = "数据字典信息")
|
||||
public class SysDictTypeController extends BaseController {
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("列表查询")
|
||||
public TableDataInfo list(SysDictType dictType) {
|
||||
startPage();
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出字典数据")
|
||||
public AjaxResult export(SysDictType dictType) {
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<SysDictType> util = new ExcelUtil<>(SysDictType.class);
|
||||
return util.exportExcel(list, "字典类型");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
@ApiOperation("查询字典类型详细")
|
||||
public AjaxResult getInfo(@PathVariable Long dictId) {
|
||||
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增字典类型")
|
||||
public AjaxResult add(@Validated @RequestBody SysDictType dict) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
|
||||
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(LoginTokenService.getUsername());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改字典类型")
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
|
||||
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(LoginTokenService.getUsername());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
@ApiOperation("删除字典类型")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds) {
|
||||
return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clearCache")
|
||||
@ApiOperation("清空缓存")
|
||||
public AjaxResult clearCache() {
|
||||
dictTypeService.clearCache();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/optionselect")
|
||||
@ApiOperation("获取字典选择框列表")
|
||||
public AjaxResult optionselect() {
|
||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return AjaxResult.success(dictTypes);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.SysMenu;
|
||||
import com.easyink.common.core.domain.entity.WeCorpAccount;
|
||||
import com.easyink.common.core.domain.model.LoginBody;
|
||||
import com.easyink.common.core.domain.model.LoginResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.domain.model.LoginUserVO;
|
||||
import com.easyink.common.core.domain.system.RouterVo;
|
||||
import com.easyink.common.enums.LoginTypeEnum;
|
||||
import com.easyink.common.service.ISysMenuService;
|
||||
import com.easyink.common.token.SysPermissionService;
|
||||
import com.easyink.common.token.TokenService;
|
||||
import com.easyink.common.utils.ServletUtils;
|
||||
import com.easyink.wecom.domain.vo.WeInternalPreLoginParamVO;
|
||||
import com.easyink.wecom.login.service.SysLoginService;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeCorpAccountService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 类名: SysLoginController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-09-14 10:32
|
||||
*/
|
||||
@Api(tags = "登录接口")
|
||||
@RestController
|
||||
public class SysLoginController {
|
||||
|
||||
private final SysLoginService loginService;
|
||||
private final ISysMenuService menuService;
|
||||
private final SysPermissionService permissionService;
|
||||
private final TokenService tokenService;
|
||||
private final WeCorpAccountService iWxCorpAccountService;
|
||||
|
||||
@Autowired
|
||||
public SysLoginController(SysLoginService loginService, ISysMenuService menuService, SysPermissionService permissionService, TokenService tokenService, WeCorpAccountService iWxCorpAccountService) {
|
||||
this.loginService = loginService;
|
||||
this.menuService = menuService;
|
||||
this.permissionService = permissionService;
|
||||
this.tokenService = tokenService;
|
||||
this.iWxCorpAccountService = iWxCorpAccountService;
|
||||
}
|
||||
|
||||
@ApiOperation("登录方法")
|
||||
@PostMapping("/login")
|
||||
public AjaxResult<LoginResult> login(@RequestBody LoginBody loginBody) {
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
loginBody.getUuid());
|
||||
return AjaxResult.success(new LoginResult(token));
|
||||
}
|
||||
|
||||
@ApiOperation("第三方SCRM系统获取token")
|
||||
@GetMapping("/lockToken")
|
||||
public AjaxResult<LoginResult> lockToken(@RequestParam("corpId") String corpId, @RequestParam("userId") String userId) {
|
||||
return AjaxResult.success(loginService.getLoginToken(corpId, userId));
|
||||
}
|
||||
|
||||
@ApiOperation("内部扫码登录")
|
||||
@GetMapping("/qrCodeLogin")
|
||||
public AjaxResult<LoginResult> qrCodeLogin(@ApiParam("扫码登录返回的授权码") @RequestParam("code") String code) {
|
||||
LoginResult loginResult = loginService.loginHandler(code, LoginTypeEnum.BY_SCAN.getState());
|
||||
if (StringUtils.isNotBlank(loginResult.getErrorMsg())) {
|
||||
return AjaxResult.error(loginResult.getErrorMsg());
|
||||
}
|
||||
return AjaxResult.success(loginResult);
|
||||
}
|
||||
|
||||
@ApiOperation("网页登录")
|
||||
@GetMapping("/webLogin")
|
||||
public AjaxResult<LoginResult> webLogin(@ApiParam("网页登录返回的授权码") @RequestParam("code") String code) {
|
||||
LoginResult loginResult = loginService.loginHandler(code, LoginTypeEnum.BY_WEB.getState());
|
||||
if (StringUtils.isNotBlank(loginResult.getErrorMsg())) {
|
||||
return AjaxResult.error(loginResult.getErrorMsg());
|
||||
}
|
||||
return AjaxResult.success(loginResult);
|
||||
}
|
||||
|
||||
@ApiOperation("三方扫码登录")
|
||||
@GetMapping("/qrCodeLogin3rd")
|
||||
public AjaxResult<LoginResult> qrCodeLogin3rd(@ApiParam("扫码登录返回的授权码") @RequestParam("authCode") String authCode) {
|
||||
LoginResult loginResult = loginService.loginHandler(authCode, LoginTypeEnum.BY_THIRD_SCAN.getState());
|
||||
loginResult.setLoginUser(null);
|
||||
if (StringUtils.isNotBlank(loginResult.getErrorMsg())) {
|
||||
return AjaxResult.error(loginResult.getErrorMsg());
|
||||
}
|
||||
return AjaxResult.success(loginResult);
|
||||
}
|
||||
|
||||
@ApiOperation("登录处理器(扫码、网页登录)")
|
||||
@GetMapping("/loginHandler")
|
||||
public AjaxResult<LoginResult> loginHandler(@ApiParam("登录返回的授权码") @RequestParam("code") String code,
|
||||
@ApiParam("登录返回的自定义state 内部扫码:INTERNAL_SCAN_LOGIN 三方扫码:THIRD_SCAN_LOGIN 网页登录:WEB_LOGIN ") @RequestParam("state") String state) {
|
||||
LoginResult loginResult = loginService.loginHandler(code, state);
|
||||
if (StringUtils.isNotBlank(loginResult.getErrorMsg())) {
|
||||
return AjaxResult.error(loginResult.getErrorMsg());
|
||||
}
|
||||
return AjaxResult.success(loginResult);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户信息")
|
||||
@GetMapping("getInfo")
|
||||
public AjaxResult<LoginUserVO> getInfo() {
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(loginUser);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(loginUser);
|
||||
// 刷新TOKEN
|
||||
LoginTokenService.refreshDataScope();
|
||||
return AjaxResult.success(new LoginUserVO(loginUser, (HashSet) roles, (HashSet) permissions));
|
||||
}
|
||||
|
||||
@ApiOperation("获取路由信息")
|
||||
@GetMapping("getRouters")
|
||||
public AjaxResult<RouterVo> getRouters() {
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// 用户信息
|
||||
List<SysMenu> menus = menuService.selectMenuTreeByLoginUser(loginUser);
|
||||
List<RouterVo> routerVos = menuService.buildMenus(menus);
|
||||
// delMenuWithNoChild(routerVos);
|
||||
return AjaxResult.success(routerVos);
|
||||
}
|
||||
|
||||
private void delMenuWithNoChild(List<RouterVo> routerVos) {
|
||||
for (Iterator<RouterVo> it = routerVos.iterator(); it.hasNext(); ) {
|
||||
RouterVo vo = it.next();
|
||||
if (CollectionUtils.isEmpty(vo.getChildren()) || isAllPageChildren(vo.getChildren())) {
|
||||
// 判断是否有孩子节点 且不是横栏的目录(比如客户中心)
|
||||
if (isMenu(vo) && !Boolean.TRUE.equals(vo.getIsFrameMenu())) {
|
||||
// 删除该节点
|
||||
it.remove();
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(vo.getChildren())) {
|
||||
delMenuWithNoChild(vo.getChildren());
|
||||
}
|
||||
} else {
|
||||
delMenuWithNoChild(vo.getChildren());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 子节点全部是页面
|
||||
*
|
||||
* @param children 子节点列表
|
||||
* @return true or false
|
||||
*/
|
||||
private boolean isAllPageChildren(List<RouterVo> children) {
|
||||
if(CollectionUtils.isEmpty(children)) {
|
||||
return false ;
|
||||
}
|
||||
boolean isAllPageChildren = true;
|
||||
for(RouterVo vo : children) {
|
||||
if(Boolean.FALSE.equals(vo.getIsPage()) ) {
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return isAllPageChildren;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是菜单节点
|
||||
*
|
||||
* @param vo vo
|
||||
* @return true or false
|
||||
*/
|
||||
private boolean isMenu(RouterVo vo) {
|
||||
String noDirect = "noRedirect";
|
||||
return noDirect.equals(vo.getRedirect());
|
||||
}
|
||||
|
||||
@ApiOperation("获取内部应用登录二维码构造相关参数")
|
||||
@GetMapping("/findWxQrLoginInfo")
|
||||
public AjaxResult<WeInternalPreLoginParamVO> findWxQrLoginInfo() {
|
||||
WeCorpAccount validWeCorpAccount = iWxCorpAccountService.findValidWeCorpAccount();
|
||||
return AjaxResult.success(new WeInternalPreLoginParamVO(validWeCorpAccount));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.Constants;
|
||||
import com.easyink.common.constant.UserConstants;
|
||||
import com.easyink.common.core.MenuTree;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.TreeSelect;
|
||||
import com.easyink.common.core.domain.entity.SysMenu;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.service.ISysMenuService;
|
||||
import com.easyink.common.token.TokenService;
|
||||
import com.easyink.common.utils.ServletUtils;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/menu")
|
||||
@Api(tags = "菜单信息")
|
||||
public class SysMenuController extends BaseController {
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
private static final String ERROR_INFO = "新增菜单'";
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获取菜单列表")
|
||||
public AjaxResult<List<SysMenu>> list(SysMenu menu) {
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, loginUser);
|
||||
return AjaxResult.success(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单编号获取详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:menu:query')")
|
||||
@GetMapping(value = "/{menuId}")
|
||||
@ApiOperation("根据菜单编号获取详细信息")
|
||||
public AjaxResult<SysMenu> getInfo(@PathVariable Long menuId) {
|
||||
return AjaxResult.success(menuService.selectMenuById(menuId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/treeselect")
|
||||
@ApiOperation("获取菜单下拉树列表")
|
||||
public AjaxResult<List<TreeSelect>> treeselect(SysMenu menu) {
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, loginUser);
|
||||
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||
@ApiOperation("加载对应角色菜单列表树")
|
||||
public AjaxResult<MenuTree> roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
MenuTree roleMenuTree = menuService.getRoleMenuTreeSelect(roleId,loginUser);
|
||||
return AjaxResult.success(roleMenuTree);
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增菜单")
|
||||
public AjaxResult<Integer> add(@Validated @RequestBody SysMenu menu) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||
return AjaxResult.error(ERROR_INFO + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
|
||||
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) {
|
||||
return AjaxResult.error(ERROR_INFO + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
menu.setCreateBy(LoginTokenService.getUsername());
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改菜单")
|
||||
public AjaxResult<Integer> edit(@Validated @RequestBody SysMenu menu) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
|
||||
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) {
|
||||
return AjaxResult.error(ERROR_INFO + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
} else if (menu.getMenuId().equals(menu.getParentId())) {
|
||||
return AjaxResult.error(ERROR_INFO + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
}
|
||||
menu.setUpdateBy(LoginTokenService.getUsername());
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{menuId}")
|
||||
@ApiOperation("删除菜单")
|
||||
public AjaxResult<Integer> remove(@PathVariable("menuId") Long menuId) {
|
||||
if (menuService.hasChildByMenuId(menuId)) {
|
||||
return AjaxResult.error("存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.checkMenuExistRole(menuId)) {
|
||||
return AjaxResult.error("菜单已分配,不允许删除");
|
||||
}
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.system.SysNotice;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/notice")
|
||||
@Api(tags = "信息操作处理")
|
||||
@Deprecated
|
||||
public class SysNoticeController extends BaseController {
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{noticeIds}")
|
||||
@ApiOperation("删除通知公告")
|
||||
public AjaxResult remove(@PathVariable Long[] noticeIds) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.system.SysPost;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/post")
|
||||
@Api(tags = "岗位信息操作处理")
|
||||
@Deprecated
|
||||
public class SysPostController extends BaseController {
|
||||
/**
|
||||
* 获取岗位列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获取岗位列表")
|
||||
public TableDataInfo list(SysPost post) {
|
||||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("岗位管理")
|
||||
public AjaxResult export(SysPost post) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("根据岗位编号获取详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||
@GetMapping(value = "/{postId}")
|
||||
public AjaxResult getInfo(@PathVariable Long postId) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增岗位")
|
||||
public AjaxResult add(@Validated @RequestBody SysPost post) {
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改岗位")
|
||||
public AjaxResult edit(@Validated @RequestBody SysPost post) {
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
@ApiOperation("删除岗位")
|
||||
public AjaxResult remove(@PathVariable Long[] postIds) {
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
@ApiOperation("获取岗位选择框列表")
|
||||
public AjaxResult optionselect() {
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.config.RuoYiConfig;
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.SysUser;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.domain.wecom.WeUser;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.MediaType;
|
||||
import com.easyink.common.exception.file.InvalidExtensionException;
|
||||
import com.easyink.common.service.ISysUserService;
|
||||
import com.easyink.common.token.TokenService;
|
||||
import com.easyink.common.utils.SecurityUtils;
|
||||
import com.easyink.common.utils.ServletUtils;
|
||||
import com.easyink.common.utils.file.FileUploadUtils;
|
||||
import com.easyink.common.utils.file.MimeTypeUtils;
|
||||
import com.easyink.wecom.client.WeMediaClient;
|
||||
import com.easyink.wecom.client.WeUserClient;
|
||||
import com.easyink.wecom.domain.dto.WeMediaDTO;
|
||||
import com.easyink.wecom.domain.dto.WeUserDTO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static com.easyink.common.utils.wecom.LoginRsaUtil.decryptByPrivateKey;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/user/profile")
|
||||
@Api(tags = "个人信息 业务处理")
|
||||
public class SysProfileController extends BaseController {
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private WeMediaClient weMediaClient;
|
||||
@Autowired
|
||||
private WeUserService weUserService;
|
||||
@Autowired
|
||||
private WeUserClient weUserClient;
|
||||
@Autowired
|
||||
private RuoYiConfig ruoYiConfig;
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping
|
||||
@ApiOperation("个人信息")
|
||||
public AjaxResult profile() {
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
SysUser user = loginUser.getUser();
|
||||
AjaxResult ajax = AjaxResult.success(user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改用户")
|
||||
public AjaxResult updateProfile(@RequestBody SysUser user) {
|
||||
if (userService.updateUserProfile(user) > 0) {
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// 更新缓存用户信息
|
||||
loginUser.getUser().setNickName(user.getNickName());
|
||||
loginUser.getUser().setPhonenumber(user.getPhonenumber());
|
||||
loginUser.getUser().setEmail(user.getEmail());
|
||||
loginUser.getUser().setSex(user.getSex());
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
@ApiOperation("重置密码")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword) {
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
String userName = loginUser.getUsername();
|
||||
String password = loginUser.getPassword();
|
||||
String decryptOldPassword = decryptByPrivateKey(ruoYiConfig.getLoginRsaPrivateKey(), oldPassword);
|
||||
String decryptNewPassword = decryptByPrivateKey(ruoYiConfig.getLoginRsaPrivateKey(), newPassword);
|
||||
if (!SecurityUtils.matchesPassword(decryptOldPassword, password)) {
|
||||
return AjaxResult.error("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (SecurityUtils.matchesPassword(decryptNewPassword, password)) {
|
||||
return AjaxResult.error("新密码不能与旧密码相同");
|
||||
}
|
||||
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(decryptNewPassword)) > 0) {
|
||||
// 更新缓存用户密码
|
||||
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(decryptNewPassword));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传
|
||||
*/
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/avatar")
|
||||
@ApiOperation("头像上传")
|
||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file, String fileName) throws IOException, InvalidExtensionException {
|
||||
if (!file.isEmpty()) {
|
||||
FileUploadUtils.fileSuffixVerify(fileName, ruoYiConfig.getFile().getAllowUploadExtensionList());
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
//判断是系统用户(超管)还是企微用户
|
||||
if (loginUser.isSuperAdmin()) {
|
||||
// 获取资源映射前缀
|
||||
String avatar = FileUploadUtils.uploadV2(fileName, file, MimeTypeUtils.getDefaultAllowedExtension());
|
||||
userService.updateUserAvatar(loginUser.getUsername(), avatar);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("imgUrl", avatar);
|
||||
// 更新缓存用户头像
|
||||
loginUser.getUser().setAvatar(avatar);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return ajax;
|
||||
}
|
||||
//企微用户
|
||||
if (!loginUser.isSuperAdmin()) {
|
||||
WeUser weUser = loginUser.getWeUser();
|
||||
WeMediaDTO weMediaDTO = weMediaClient.upload(file.getInputStream(), file.getName(), MediaType.IMAGE.getMediaType(), LoginTokenService.getLoginUser().getCorpId(), (int) file.getSize(), WeConstans.WE_UPLOAD_FORM_DATA_CONTENT_TYPE);
|
||||
weUser.setAvatarMediaid(weMediaDTO.getMedia_id());
|
||||
//用临时素材更新头像
|
||||
weUserClient.updateUser(new WeUserDTO(weUser), loginUser.getCorpId());
|
||||
//获取头像地址
|
||||
WeUserDTO user = weUserClient.getUserByUserId(weUser.getUserId(), loginUser.getCorpId());
|
||||
loginUser.getWeUser().setAvatarMediaid(user.getAvatar());
|
||||
weUser.setAvatarMediaid(user.getAvatar());
|
||||
//更新本地
|
||||
weUserService.updateWeUserNoToWeCom(weUser);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("imgUrl", user.getAvatar());
|
||||
return ajax;
|
||||
}
|
||||
|
||||
}
|
||||
return AjaxResult.error("上传图片异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.UserConstants;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.SysRole;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.service.ISysRoleService;
|
||||
import com.easyink.common.utils.poi.ExcelUtil;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/role")
|
||||
@Api(tags = "角色信息")
|
||||
public class SysRoleController extends BaseController {
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("列表查询")
|
||||
public TableDataInfo<SysRole> list(SysRole role) {
|
||||
startPage();
|
||||
role.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出")
|
||||
public AjaxResult export(SysRole role) {
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
role.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
ExcelUtil<SysRole> util = new ExcelUtil<>(SysRole.class);
|
||||
return util.exportExcel(list, "角色数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色编号获取详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/{roleId}")
|
||||
@ApiOperation("根据角色编号获取详细信息")
|
||||
public AjaxResult<SysRole> getInfo(@PathVariable Long roleId) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
return AjaxResult.success(roleService.selectRoleById(loginUser.getCorpId(), roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增角色")
|
||||
public AjaxResult add(@Validated @RequestBody SysRole role) {
|
||||
role.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
role.setCreateBy(LoginTokenService.getUsername());
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存角色
|
||||
*/
|
||||
@ApiOperation("修改保存角色")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysRole role) {
|
||||
role.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
// 检查是否修改了默认角色的名字
|
||||
roleService.checkDefaultRoleEditName(role);
|
||||
role.setUpdateBy(LoginTokenService.getUsername());
|
||||
|
||||
if (roleService.updateRole(role) > 0) {
|
||||
// 更新缓存用户权限
|
||||
LoginTokenService.refreshDataScope();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("修改保存数据权限")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/dataScope")
|
||||
public AjaxResult dataScope(@RequestBody SysRole role) {
|
||||
role.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
roleService.checkRoleAllowed(role);
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
}
|
||||
|
||||
@ApiOperation("状态修改")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysRole role) {
|
||||
roleService.checkRoleAllowed(role);
|
||||
role.setUpdateBy(LoginTokenService.getUsername());
|
||||
return toAjax(roleService.updateRoleStatus(role));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("删除角色")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{roleIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] roleIds) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
return AjaxResult.success(roleService.deleteRoleByIds(corpId, roleIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色选择框列表
|
||||
*/
|
||||
@ApiOperation("获取角色选择框列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult<List<SysRole>> optionselect() {
|
||||
return AjaxResult.success(roleService.selectRoleAll(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,261 @@
|
|||
package com.easyink.web.controller.system;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.UserConstants;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.SysRole;
|
||||
import com.easyink.common.core.domain.entity.SysUser;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.domain.wecom.WeUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.mapper.SysUserMapper;
|
||||
import com.easyink.common.service.ISysRoleService;
|
||||
import com.easyink.common.service.ISysUserService;
|
||||
import com.easyink.common.token.TokenService;
|
||||
import com.easyink.common.utils.SecurityUtils;
|
||||
import com.easyink.common.utils.ServletUtils;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.common.utils.poi.ExcelUtil;
|
||||
import com.easyink.common.utils.sign.Md5Utils;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.mapper.WeUserMapper;
|
||||
import com.easyink.wecom.service.WeUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.easyink.common.constant.WeConstans.USER_ID_PREFIX;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/user")
|
||||
@Api(tags = "用户信息")
|
||||
@Validated
|
||||
public class SysUserController extends BaseController {
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private WeUserService weUserService;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Autowired
|
||||
private WeUserMapper weUserMapper;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获取用户列表")
|
||||
public TableDataInfo list(SysUser user) {
|
||||
startPage();
|
||||
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出数据")
|
||||
public AjaxResult export(SysUser user) {
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<>(SysUser.class);
|
||||
return util.exportExcel(list, "用户数据");
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||
@PostMapping("/importData")
|
||||
@ApiOperation("导入数据")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<>(SysUser.class);
|
||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
String operName = loginUser.getUsername();
|
||||
String message = userService.importUser(userList, updateSupport, operName);
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
@GetMapping("/importTemplate")
|
||||
@ApiOperation("导入模板")
|
||||
public AjaxResult importTemplate() {
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<>(SysUser.class);
|
||||
return util.importTemplateExcel("用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("根据用户编号获取详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping(value = {"/", "/{userId}"})
|
||||
public AjaxResult getInfo(@PathVariable(value = "userId") Long userId) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
List<SysRole> roles = roleService.selectRoleAll(LoginTokenService.getLoginUser().getCorpId());
|
||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
if (StringUtils.isNotNull(userId)) {
|
||||
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
|
||||
}
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@ApiOperation("新增用户")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysUser user) {
|
||||
final String msgPrefix = "新增用户";
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) {
|
||||
return AjaxResult.error(msgPrefix + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
return AjaxResult.error(msgPrefix+ user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||
return AjaxResult.error(msgPrefix + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setCreateBy(LoginTokenService.getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改用户")
|
||||
public AjaxResult edit(@Validated @RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUpdateBy(LoginTokenService.getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
@ApiOperation("删除用户")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds) {
|
||||
return toAjax(userService.deleteUserByIds(userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@ApiOperation("重置密码")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public AjaxResult resetPwd(@RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(LoginTokenService.getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@ApiOperation("状态修改")
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
user.setUpdateBy(LoginTokenService.getUsername());
|
||||
return toAjax(userService.updateUserStatus(user));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("查找当前登录用户")
|
||||
@GetMapping("/findCurrentLoginUser")
|
||||
public AjaxResult findCurrentLoginUser(HttpServletRequest request) {
|
||||
String userId = "";
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
if (null != loginUser) {
|
||||
SysUser user = loginUser.getUser();
|
||||
if (null != user) {
|
||||
List<WeUser> weUsers = weUserService.selectWeUserList(WeUser.builder()
|
||||
.mobile(user.getPhonenumber())
|
||||
.build());
|
||||
if (CollectionUtil.isNotEmpty(weUsers)) {
|
||||
userId = weUsers.get(0).getUserId();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return AjaxResult.success(userId);
|
||||
}
|
||||
|
||||
@ApiOperation(("修改当前用户的UI主题颜色"))
|
||||
@GetMapping("/changeUiColor")
|
||||
public AjaxResult changeUiColor(@ApiParam(value = "颜色(需要urlEncode后传入)") @NotBlank(message = "颜色不能为空") String color) {
|
||||
try {
|
||||
color = URLDecoder.decode(color,"utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return AjaxResult.error("请传入正确的颜色格式");
|
||||
}
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
// 账密登录管理员更换主题颜色
|
||||
if (loginUser.isSuperAdmin()) {
|
||||
sysUserMapper.updateUser(
|
||||
SysUser.builder()
|
||||
.userId(loginUser.getUser().getUserId())
|
||||
.uiColor(color)
|
||||
.build()
|
||||
);
|
||||
} else if (!loginUser.isSuperAdmin() && loginUser.getWeUser() != null) {
|
||||
// 扫码用户更换主题颜色
|
||||
WeUser weUser = loginUser.getWeUser();
|
||||
weUser.setUiColor(color);
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(weUser.getName()) && weUser.getName().startsWith(USER_ID_PREFIX)) {
|
||||
weUser.setName(null);
|
||||
}
|
||||
weUserMapper.updateWeUser(weUser);
|
||||
}
|
||||
// 刷新缓存
|
||||
LoginTokenService.refreshDataScope();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.easyink.web.controller.wechatopen;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.wecom.domain.entity.wechatopen.WeOpenConfig;
|
||||
import com.easyink.wecom.domain.vo.AppIdVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.wechatopen.WechatOpenService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.util.annotation.Nullable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 类名: 微信小程序/公众号相关接口
|
||||
*
|
||||
* @author : silver_chariot
|
||||
* @date : 2022/7/20 10:03
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/wechatopen")
|
||||
public class WechatOpenController extends BaseController {
|
||||
|
||||
private final WechatOpenService wechatOpenService;
|
||||
|
||||
public WechatOpenController(WechatOpenService wechatOpenService) {
|
||||
this.wechatOpenService = wechatOpenService;
|
||||
}
|
||||
|
||||
@GetMapping("/getAppIdByShortCode")
|
||||
@ApiOperation("通过短链获取公众号的appId")
|
||||
public AjaxResult<AppIdVO> getAppId(@Nullable @ApiParam("短链") String shortCode) {
|
||||
return AjaxResult.success("操作成功", wechatOpenService.getAppIdByShortCode(shortCode));
|
||||
}
|
||||
|
||||
@GetMapping("/getAppIdByFormId")
|
||||
@ApiOperation("通过表单id获取公众号的appId")
|
||||
public AjaxResult<AppIdVO> getAppIdByFormId(@Nullable @ApiParam("表单formId") Long formId){
|
||||
return AjaxResult.success("操作成功", wechatOpenService.getAppIdByFormId(formId));
|
||||
}
|
||||
|
||||
@GetMapping("/getDomain")
|
||||
@ApiOperation("获取公众号的域名/中间页域名(需要登录)")
|
||||
public AjaxResult getDomain() {
|
||||
return AjaxResult.success("操作成功", wechatOpenService.getDomain(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/openId")
|
||||
@ApiOperation("获取公众号Openid")
|
||||
public AjaxResult<String> getOpenId(@ApiParam("用户的code") String code ,@ApiParam("corpId")String corpId, @ApiParam("公众号appId")String appId) {
|
||||
return AjaxResult.success("操作成功", wechatOpenService.getOpenId(code,corpId, appId));
|
||||
}
|
||||
|
||||
@GetMapping("/config")
|
||||
@ApiOperation("获取企业的公众号配置")
|
||||
public AjaxResult getConfig() {
|
||||
LoginUser user = LoginTokenService.getLoginUser();
|
||||
return AjaxResult.success(wechatOpenService.getConfigs(user.getCorpId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('officialAccountsManager:set')")
|
||||
@PostMapping("/config")
|
||||
@ApiOperation("修改企业的公众号配置")
|
||||
public AjaxResult updateConfig(@RequestBody WeOpenConfig config) {
|
||||
wechatOpenService.updateConfig(config, true);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('officialAccountsManager:set')")
|
||||
@GetMapping("/getWechatOpen3rdAuthUrl")
|
||||
@ApiOperation("获取微信三方平台授权页url")
|
||||
public AjaxResult getWechatOpen3rdAuthUrl() {
|
||||
return AjaxResult.success(wechatOpenService.getWechatOpen3rdAuthUrl(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/getAuthCode")
|
||||
@ApiOperation("公众号授权三方平台回调")
|
||||
public void getAuthCode(@RequestParam("corpId") String corpId,
|
||||
@RequestParam("auth_code") String authCode,
|
||||
String userId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
response.sendRedirect(wechatOpenService.handle3rdAuthOfficeAccount(corpId, userId, authCode));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.PageDomain;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.core.page.TableSupport;
|
||||
import com.easyink.common.enums.EmployCodeSourceEnum;
|
||||
import com.easyink.common.utils.PageInfoUtil;
|
||||
import com.easyink.wecom.domain.dto.emplecode.*;
|
||||
import com.easyink.wecom.domain.vo.*;
|
||||
import com.easyink.wecom.domain.vo.emple.*;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.CustomerAssistantService;
|
||||
import com.easyink.wecom.service.WeEmpleCodeChannelService;
|
||||
import com.easyink.wecom.service.WeEmpleCodeService;
|
||||
import com.easyink.wecom.service.WeEmpleCodeWarnConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获客助手相关Controller
|
||||
*
|
||||
* @author lichaoyu
|
||||
* @date 2023/8/15 17:04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/customerAssistant")
|
||||
@Slf4j
|
||||
@Api(tags = "获客助手Controller")
|
||||
public class CustomerAssistantController extends BaseController {
|
||||
|
||||
private final WeEmpleCodeService weEmpleCodeService;
|
||||
private final CustomerAssistantService customerAssistantService;
|
||||
private final WeEmpleCodeWarnConfigService weEmpleCodeWarnConfigService;
|
||||
private final WeEmpleCodeChannelService weEmpleCodeChannelService;
|
||||
|
||||
|
||||
public CustomerAssistantController(WeEmpleCodeService weEmpleCodeService, CustomerAssistantService customerAssistantService, WeEmpleCodeWarnConfigService weEmpleCodeWarnConfigService, WeEmpleCodeChannelService weEmpleCodeChannelService) {
|
||||
this.weEmpleCodeService = weEmpleCodeService;
|
||||
this.customerAssistantService = customerAssistantService;
|
||||
this.weEmpleCodeWarnConfigService = weEmpleCodeWarnConfigService;
|
||||
this.weEmpleCodeChannelService = weEmpleCodeChannelService;
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customer:assistant:add')")
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增获客链接")
|
||||
public AjaxResult<Integer> add(@RequestBody AddWeEmpleCodeDTO addWeEmpleCodeDTO) {
|
||||
addWeEmpleCodeDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
addWeEmpleCodeDTO.setSource(EmployCodeSourceEnum.CUSTOMER_ASSISTANT.getSource());
|
||||
return toAjax(customerAssistantService.insertCustomerAssistant(addWeEmpleCodeDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询获客链接列表")
|
||||
public TableDataInfo<WeEmpleCodeVO> list(FindAssistantDTO findAssistantDTO) {
|
||||
findAssistantDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
startPage();
|
||||
findAssistantDTO.setSource(EmployCodeSourceEnum.CUSTOMER_ASSISTANT.getSource());
|
||||
List<WeEmpleCodeVO> list = weEmpleCodeService.selectAssistantList(findAssistantDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取获客链接详细信息")
|
||||
public AjaxResult<WeEmpleCodeVO> getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(customerAssistantService.selectCustomerAssistantById(id, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customer:assistant:edit')")
|
||||
@PutMapping("/edit")
|
||||
@ApiOperation("修改获客链接")
|
||||
public AjaxResult<Integer> edit(@RequestBody AddWeEmpleCodeDTO customerAssistant) {
|
||||
customerAssistant.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return toAjax(customerAssistantService.updateCustomerAssistant(customerAssistant));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customer:assistant:delete')")
|
||||
@DeleteMapping("/delete/{ids}")
|
||||
@ApiOperation("删除/批量删除获客链接")
|
||||
public AjaxResult<Integer> delete(@PathVariable("ids") String ids) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
return toAjax(customerAssistantService.batchRemoveCustomerAssistant(corpId, ids));
|
||||
}
|
||||
|
||||
@PostMapping("/warnConfig")
|
||||
@ApiOperation("获客链接告警设置")
|
||||
public AjaxResult<Integer> config(@RequestBody EmpleWarnConfigDTO warnConfigDTO) {
|
||||
warnConfigDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return toAjax(weEmpleCodeWarnConfigService.saveOrUpdateConfig(warnConfigDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/warnConfig")
|
||||
@ApiOperation("获客链接告警设置查询")
|
||||
public AjaxResult<WeEmpleCodeWarnConfigVO> getConfig() {
|
||||
return AjaxResult.success(weEmpleCodeWarnConfigService.getConfig(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PostMapping("/channel/add")
|
||||
@ApiOperation("新增自定义渠道")
|
||||
public AjaxResult<Integer> addChannel(@RequestBody AddCustomChannelDTO addCustomChannelDTO) {
|
||||
addCustomChannelDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return toAjax(weEmpleCodeChannelService.addChannel(addCustomChannelDTO));
|
||||
}
|
||||
|
||||
@PutMapping("/channel/edit")
|
||||
@ApiOperation("编辑自定义渠道")
|
||||
public AjaxResult<Integer> editChannel(@RequestBody EditCustomerChannelDTO editCustomerChannelDTO) {
|
||||
editCustomerChannelDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return toAjax(weEmpleCodeChannelService.editChannel(editCustomerChannelDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/channel/list")
|
||||
@ApiOperation("查询自定义渠道列表")
|
||||
public TableDataInfo<WeEmpleCodeChannelVO> listChannel(AddCustomChannelDTO addCustomChannelDTO) {
|
||||
addCustomChannelDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weEmpleCodeChannelService.listChannel(addCustomChannelDTO));
|
||||
}
|
||||
|
||||
@DeleteMapping("/channel/delete/{channelId}")
|
||||
@ApiOperation("删除自定义渠道")
|
||||
public AjaxResult<Integer> deleteChannel(@PathVariable("channelId") String channelId) {
|
||||
return toAjax(weEmpleCodeChannelService.delChannel(channelId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customer:assistant:situation')")
|
||||
@GetMapping("/situation")
|
||||
@ApiOperation("主页获客情况查询")
|
||||
public AjaxResult<WeEmpleCodeSituationVO> situation() {
|
||||
return AjaxResult.success(customerAssistantService.listSituation(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/situation/sync")
|
||||
@ApiOperation("同步主页获客情况")
|
||||
public AjaxResult<Integer> syncSituation() {
|
||||
return AjaxResult.success(customerAssistantService.syncSituation(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/detail/total/{empleCodeId}")
|
||||
@ApiOperation("获客链接详情-数据总览")
|
||||
public AjaxResult<CustomerAssistantDetailTotalVO> detailTotal(@PathVariable("empleCodeId") String empleCodeId) {
|
||||
return AjaxResult.success(customerAssistantService.detailTotal(empleCodeId, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/detail/getNewAndLossCustomerCnt")
|
||||
@ApiOperation("获客链接详情-趋势图查询")
|
||||
public AjaxResult<ChannelDetailChartVO> detailChart(FindChannelRangeChartDTO findChannelRangeChartDTO) {
|
||||
findChannelRangeChartDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(customerAssistantService.detailChart(findChannelRangeChartDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/detail/channel/range")
|
||||
@ApiOperation("获客链接详情-渠道新增客户数排行查询")
|
||||
public AjaxResult<ChannelDetailRangeVO> detailRange(FindChannelRangeChartDTO findChannelRangeChartDTO) {
|
||||
findChannelRangeChartDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(customerAssistantService.detailRange(findChannelRangeChartDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/detail/statistic/customer")
|
||||
@ApiOperation("获客链接详情-数据统计-客户维度")
|
||||
public TableDataInfo<AssistantDetailStatisticCustomerVO> detailStatisticByCustomer(FindAssistantDetailStatisticCustomerDTO findAssistantDetailStatisticCustomerDTO) {
|
||||
findAssistantDetailStatisticCustomerDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
PageInfoUtil.setPage();
|
||||
return getDataTable(customerAssistantService.detailStatisticByCustomer(findAssistantDetailStatisticCustomerDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/detail/statistic/channel")
|
||||
@ApiOperation("获客链接详情-数据统计-渠道维度")
|
||||
public TableDataInfo<AssistantDetailStatisticChannelVO> detailStatisticByChannel(FindAssistantDetailStatisticCustomerDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
PageInfoUtil.setPage();
|
||||
return getDataTable(customerAssistantService.detailStatisticByChannel(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/detail/statistic/date")
|
||||
@ApiOperation("获客链接详情-数据统计-日期维度")
|
||||
public TableDataInfo<AssistantDetailStatisticDateVO> detailStatisticByDate(FindAssistantDetailStatisticCustomerDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
List<AssistantDetailStatisticDateVO> list = customerAssistantService.detailStatisticByDate(dto);
|
||||
return PageInfoUtil.getDataTable(list, pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('customer:assistant:export')")
|
||||
@GetMapping("/export/detail/statistic/customer")
|
||||
@ApiOperation("导出获客链接详情-数据统计-客户维度")
|
||||
public AjaxResult exportDetailStatisticByCustomer(FindAssistantDetailStatisticCustomerDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(customerAssistantService.exportDetailStatisticByCustomer(dto));
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('customer:assistant:export')")
|
||||
@GetMapping("/export/detail/statistic/channel")
|
||||
@ApiOperation("导出获客链接详情-数据统计-渠道维度")
|
||||
public AjaxResult exportDetailStatisticByChannel(FindAssistantDetailStatisticCustomerDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(customerAssistantService.exportDetailStatisticByChannel(dto));
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('customer:assistant:export')")
|
||||
@GetMapping("/export/detail/statistic/date")
|
||||
@ApiOperation("导出获客链接详情-数据统计-日期维度")
|
||||
public AjaxResult exportDetailStatisticByDate(FindAssistantDetailStatisticCustomerDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(customerAssistantService.exportDetailStatisticByDate(dto));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.config.RuoYiConfig;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.wecom.domain.vo.ReleaseNotesVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.PageHomeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 类名: PageHomeController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-27 17:16
|
||||
*/
|
||||
@Api(value = "PageHomeController", tags = "首页数据接口")
|
||||
@RestController
|
||||
@RequestMapping("/wecom/pagehome")
|
||||
public class PageHomeController {
|
||||
|
||||
|
||||
private final PageHomeService pageHomeService;
|
||||
|
||||
private final RuoYiConfig ruoYiConfig;
|
||||
|
||||
@Autowired
|
||||
public PageHomeController(PageHomeService pageHomeService, RuoYiConfig ruoYiConfig) {
|
||||
this.pageHomeService = pageHomeService;
|
||||
this.ruoYiConfig = ruoYiConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新统计数据缓存
|
||||
*/
|
||||
@ApiOperation("刷新统计数据缓存")
|
||||
@GetMapping("/reloadredis")
|
||||
public AjaxResult reloadRedis() {
|
||||
pageHomeService.reloadPageHome(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("获取当前版本")
|
||||
@GetMapping("/getCurrVersion")
|
||||
public AjaxResult<ReleaseNotesVO> getCurrVersion() {
|
||||
ReleaseNotesVO notesVO = ReleaseNotesVO.builder().version(ruoYiConfig.getVersion())
|
||||
.notes(ruoYiConfig.getReleaseNotes()).build();
|
||||
return AjaxResult.success(notesVO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,304 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.utils.PageInfoUtil;
|
||||
import com.easyink.wecom.domain.dto.statistics.*;
|
||||
import com.easyink.wecom.domain.vo.statistics.*;
|
||||
import com.easyink.wecom.domain.vo.statistics.emplecode.EmpleCodeDateVO;
|
||||
import com.easyink.wecom.domain.vo.statistics.emplecode.EmpleCodeUserVO;
|
||||
import com.easyink.wecom.domain.vo.statistics.emplecode.EmpleCodeVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.*;
|
||||
import com.easyink.wecom.service.statistic.WeEmpleCodeStatisticService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据统计Controller
|
||||
*
|
||||
* @author wx
|
||||
* 2023/2/14 13:58
|
||||
**/
|
||||
@RestController
|
||||
@Api(value = "StatisticsController", tags = "数据统计接口")
|
||||
@RequestMapping("/wecom/statistics")
|
||||
@RequiredArgsConstructor
|
||||
public class StatisticsController extends BaseController {
|
||||
|
||||
private final WeUserCustomerMessageStatisticsService weUserCustomerMessageStatisticsService;
|
||||
private final WeUserService weUserService;
|
||||
private final PageHomeService pageHomeService;
|
||||
private final WeTagService weTagService;
|
||||
private final WeGroupTagService weGroupTagService;
|
||||
private final WeEmpleCodeStatisticService weEmpleCodeStatisticService;
|
||||
|
||||
@PostMapping("/emple/history/update")
|
||||
@ApiOperation("从活码分析表更新活码统计表历史旧数据")
|
||||
public AjaxResult empleStatisticUpdate() {
|
||||
return weEmpleCodeStatisticService.updateHistoryData();
|
||||
}
|
||||
|
||||
@GetMapping("/data")
|
||||
@ApiOperation("执行对应日期的数据统计任务,执行前需先将we_user_customer_message_statisticsService表中对应日期的数据删除。")
|
||||
@Transactional
|
||||
public AjaxResult getData(String time) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
weUserService.getUserBehaviorDataByCorpId(corpId, time);
|
||||
pageHomeService.doSystemCustomStat(corpId, false, time);
|
||||
weUserCustomerMessageStatisticsService.getMessageStatistics(corpId,time);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/getCustomerOverViewOfTotal")
|
||||
@ApiOperation("获取客户概况-数据总览")
|
||||
public AjaxResult getCustomerOverViewOfTotal(@RequestBody @Validated StatisticsDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserCustomerMessageStatisticsService.getCustomerOverViewOfTotal(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getCustomerOverViewOfUser")
|
||||
@ApiOperation("获取客户概况-数据总览-员工维度")
|
||||
public TableDataInfo<CustomerOverviewVO> getCustomerOverViewOfUser(@RequestBody @Validated CustomerOverviewDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return PageInfoUtil.getDataTable(weUserCustomerMessageStatisticsService.getCustomerOverViewOfUser(dto), dto.getPageNum(), dto.getPageSize());
|
||||
}
|
||||
|
||||
@PostMapping("/getCustomerTagTableView")
|
||||
@ApiOperation("获取标签统计-客户标签-表格视图")
|
||||
public TableDataInfo<WeTagCustomerStatisticsVO> getCustomerTagTableView(@RequestBody @Validated WeTagStatisticsDTO dto){
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return weTagService.selectTagStatistics(dto);
|
||||
}
|
||||
|
||||
@PostMapping("/getCustomerTagChartView")
|
||||
@ApiOperation("获取标签统计-客户标签-图表视图")
|
||||
public TableDataInfo<WeTagCustomerStatisticsChartVO> getCustomerTagChartView(@RequestBody @Validated WeTagStatisticsDTO dto){
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return weTagService.getCustomerTagTableChartView(dto);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('statistic:labelStatistics:export')")
|
||||
@PostMapping("/exportCustomerTagsView")
|
||||
@ApiOperation("导出标签统计-客户标签")
|
||||
public AjaxResult<CustomerOverviewDateVO> exportCustomerTagsView(@RequestBody @Validated WeTagStatisticsDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weTagService.exportCustomerTagsView(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getCustomerOverViewOfDate")
|
||||
@ApiOperation("获取客户概况-数据总览-日期维度")
|
||||
public TableDataInfo<CustomerOverviewDateVO> getCustomerOverViewOfDate(@RequestBody @Validated CustomerOverviewDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weUserCustomerMessageStatisticsService.getCustomerOverViewOfDate(dto, true), dto.getTotal());
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('statistic:customerContact:export')")
|
||||
@PostMapping("/exportCustomerOverViewOfDate")
|
||||
@ApiOperation("导出客户概况-数据总览-日期维度")
|
||||
public AjaxResult<CustomerOverviewDateVO> exportCustomerOverViewOfDare(@RequestBody @Validated CustomerOverviewDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserCustomerMessageStatisticsService.exportCustomerOverViewOfDate(dto));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('statistic:customerContact:export')")
|
||||
@PostMapping("/exportCustomerOverViewOfUser")
|
||||
@ApiOperation("导出客户概况-数据总览-员工维度")
|
||||
public AjaxResult<CustomerOverviewVO> exportCustomerOverViewOfUser(@RequestBody @Validated CustomerOverviewDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserCustomerMessageStatisticsService.exportCustomerOverViewOfUser(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getCustomerActivityOfDateTrend")
|
||||
@ApiOperation("获取客户活跃度-趋势图")
|
||||
public AjaxResult getCustomerActivityOfDateTrend(@RequestBody @Validated CustomerActivityDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserCustomerMessageStatisticsService.getCustomerActivityOfDateTrend(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getCustomerActivityOfDate")
|
||||
@ApiOperation("获取客户活跃度-日期维度")
|
||||
public TableDataInfo<CustomerActivityOfDateVO> getCustomerActivityOfDate(@RequestBody @Validated CustomerActivityDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weUserCustomerMessageStatisticsService.getCustomerActivityOfDate(dto, true), dto.getTotal());
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('statistic:customerContact:export')")
|
||||
@PostMapping("/exportCustomerActivityOfDate")
|
||||
@ApiOperation("导出客户活跃度-日期维度")
|
||||
public AjaxResult exportCustomerActivityOfDate(@RequestBody @Validated CustomerActivityDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserCustomerMessageStatisticsService.exportCustomerActivityOfDate(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getCustomerActivityOfUser")
|
||||
@ApiOperation("获取客户活跃度-员工维度")
|
||||
public TableDataInfo<CustomerActivityOfUserVO> getCustomerActivityOfUser(@RequestBody @Validated CustomerActivityDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weUserCustomerMessageStatisticsService.getCustomerActivityOfUser(dto, true));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('statistic:customerContact:export')")
|
||||
@PostMapping("/exportCustomerActivityOfUser")
|
||||
@ApiOperation("导出客户活跃度-员工维度")
|
||||
public AjaxResult exportCustomerActivityOfUser(@RequestBody @Validated CustomerActivityDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserCustomerMessageStatisticsService.exportCustomerActivityOfUser(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getCustomerActivityOfUserDetail")
|
||||
@ApiOperation("获取客户活跃度-员工维度-详情")
|
||||
public TableDataInfo<CustomerActivityOfCustomerVO> getCustomerActivityOfUserDetail(@RequestBody @Validated CustomerActivityUserDetailDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weUserCustomerMessageStatisticsService.getCustomerActivityOfUserDetail(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getCustomerActivityOfCustomer")
|
||||
@ApiOperation("获取客户活跃度-客户维度")
|
||||
public TableDataInfo<CustomerActivityOfCustomerVO> getCustomerActivityOfCustomer(@RequestBody @Validated CustomerActivityDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weUserCustomerMessageStatisticsService.getCustomerActivityOfCustomer(dto, true));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('statistic:customerContact:export')")
|
||||
@PostMapping("/exportCustomerActivityOfCustomer")
|
||||
@ApiOperation("导出客户活跃度-客户维度")
|
||||
public AjaxResult exportCustomerActivityOfCustomer(@RequestBody @Validated CustomerActivityDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserCustomerMessageStatisticsService.exportCustomerActivityOfCustomer(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getUserServiceOfTotal")
|
||||
@ApiOperation("获取员工服务-数据总览")
|
||||
public AjaxResult getUserServiceOfTotal(@RequestBody @Validated StatisticsDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserCustomerMessageStatisticsService.getUserServiceOfTotal(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getUserServiceOfUser")
|
||||
@ApiOperation("获取员工服务-数据总览-员工维度")
|
||||
public TableDataInfo<UserServiceVO> getUserServiceOfUser(@RequestBody @Validated UserServiceDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
//构建返回条件
|
||||
TableDataInfo tableDataInfo=new TableDataInfo();
|
||||
PageInfo<UserServiceVO> pageInfo=weUserCustomerMessageStatisticsService.getUserServiceOfUser(dto);
|
||||
tableDataInfo.setTotal((int) pageInfo.getTotal());
|
||||
tableDataInfo.setRows(pageInfo.getList());
|
||||
tableDataInfo.setCode(ResultTip.TIP_GENERAL_SUCCESS.getCode());
|
||||
tableDataInfo.setMsg("查询成功");
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('statistic:employeeService:export')")
|
||||
@PostMapping("/exportUserServiceOfUser")
|
||||
@ApiOperation("导出员工服务-数据总览-员工维度")
|
||||
public AjaxResult exportUserServiceOfUser(@RequestBody @Validated UserServiceDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserCustomerMessageStatisticsService.exportUserServiceOfUser(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getUserServiceOfTime")
|
||||
@ApiOperation("获取员工服务-数据总览-时间维度")
|
||||
public TableDataInfo<UserServiceTimeVO> getUserServiceOfTime(@RequestBody @Validated UserServiceDTO dto){
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weUserCustomerMessageStatisticsService.getUserServiceOfTime(dto));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('statistic:employeeService:export')")
|
||||
@PostMapping("/exportUserServiceOfTime")
|
||||
@ApiOperation("导出员工服务-数据总览-时间维度")
|
||||
public AjaxResult exportUserServiceOfTime(@RequestBody @Validated UserServiceDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserCustomerMessageStatisticsService.exportUserServiceOfTime(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/getGroupTagTableView")
|
||||
@ApiOperation("获取群标签-表格视图")
|
||||
public TableDataInfo<WeTagGroupStatisticsVO> getGroupTagTableView(@RequestBody @Validated WeTagStatisticsDTO weTagStatisticsDTO) {
|
||||
weTagStatisticsDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeTagGroupStatisticsVO> weTagGroupStatisticsVOS = weGroupTagService.groupTagTableView(weTagStatisticsDTO);
|
||||
return PageInfoUtil.getDataTable(weTagGroupStatisticsVOS, weTagStatisticsDTO.getPageNum(),weTagStatisticsDTO.getPageSize());
|
||||
}
|
||||
|
||||
@PostMapping("/getGroupTagChartView")
|
||||
@ApiOperation("获取群标签-图表视图")
|
||||
public TableDataInfo<WeTagGroupStatisticChartVO> getGroupTagChartView(@RequestBody @Validated WeTagStatisticsDTO weTagStatisticsDTO) {
|
||||
weTagStatisticsDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeTagGroupStatisticChartVO> weTagStatisticsChartVOList = weGroupTagService.groupTagChartView(weTagStatisticsDTO);
|
||||
return PageInfoUtil.getDataTable(weTagStatisticsChartVOList, weTagStatisticsDTO.getPageNum(),weTagStatisticsDTO.getPageSize());
|
||||
}
|
||||
|
||||
@PostMapping("/exportGroupTagsView")
|
||||
@ApiOperation("导出群标签表格")
|
||||
public AjaxResult exportGroupTagsView(@RequestBody @Validated WeTagStatisticsDTO weTagStatisticsDTO) {
|
||||
weTagStatisticsDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weGroupTagService.exportGroupTags(weTagStatisticsDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/emplecode/total")
|
||||
@ApiOperation("活码统计-数据总览")
|
||||
public AjaxResult listEmpleTotal(@RequestBody EmpleCodeStatisticDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weEmpleCodeStatisticService.listEmpleTotal(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/emplecode/user/list")
|
||||
@ApiOperation("活码统计-员工维度")
|
||||
public TableDataInfo<EmpleCodeUserVO> listEmpleUser(@RequestBody EmpleCodeStatisticDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
// 预设置分页参数
|
||||
PageInfoUtil.setPage();
|
||||
List<EmpleCodeUserVO> list = weEmpleCodeStatisticService.listEmpleUser(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('stastistic:channelStatistics:export')")
|
||||
@PostMapping("/emplecode/user/export")
|
||||
@ApiOperation("活码统计-员工维度-导出报表")
|
||||
public AjaxResult exportEmpleUser(@RequestBody EmpleCodeStatisticDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weEmpleCodeStatisticService.exportEmpleUser(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/emplecode/emple/list")
|
||||
@ApiOperation(("活码统计-活码维度"))
|
||||
public TableDataInfo<EmpleCodeVO> listEmple(@RequestBody EmpleCodeStatisticDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
PageInfoUtil.setPage();
|
||||
List<EmpleCodeVO> list = weEmpleCodeStatisticService.listEmple(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('stastistic:channelStatistics:export')")
|
||||
@PostMapping("/emplecode/emple/export")
|
||||
@ApiOperation("活码统计-活码维度-导出报表")
|
||||
public AjaxResult exportEmple(@RequestBody EmpleCodeStatisticDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weEmpleCodeStatisticService.exportEmple(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/emplecode/date/list")
|
||||
@ApiOperation(("活码统计-日期维度"))
|
||||
public TableDataInfo<EmpleCodeDateVO> listEmpleDate(@RequestBody EmpleCodeStatisticDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weEmpleCodeStatisticService.listEmpleDate(dto));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('stastistic:channelStatistics:export')")
|
||||
@PostMapping("/emplecode/date/export")
|
||||
@ApiOperation("活码统计-日期维度-导出报表")
|
||||
public AjaxResult exportEmpleDate(@RequestBody EmpleCodeStatisticDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weEmpleCodeStatisticService.exportEmpleDate(dto));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.wecom.service.UpdateIDSecurityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* ClassName: UpdateIDSecurityController
|
||||
*
|
||||
* @author wx
|
||||
* @date 2022/8/19 9:49
|
||||
*/
|
||||
@Api("企业微信帐号ID安全性全面升级")
|
||||
@RestController
|
||||
@RequestMapping("/wecom/updateid")
|
||||
@Slf4j
|
||||
public class UpdateIDSecurityController {
|
||||
|
||||
@Autowired
|
||||
private UpdateIDSecurityService updateIDSecurityService;
|
||||
|
||||
@ApiOperation("进行id转换")
|
||||
@GetMapping("")
|
||||
public <T> AjaxResult<T> transfer(@RequestParam(value = "enableFullUpdate") Boolean enableFullUpdate, @RequestParam(value = "corpId") String corpId) {
|
||||
try {
|
||||
updateIDSecurityService.corpIdHandle(enableFullUpdate, corpId);
|
||||
} catch (Exception e) {
|
||||
log.error("企业微信帐号ID安全性全面升级 id转换失败 ex:{}", ExceptionUtils.getStackTrace(e));
|
||||
return AjaxResult.error("转换失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.easyink.common.config.RuoYiConfig;
|
||||
import com.easyink.common.constant.GenConstants;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.WeCorpAccount;
|
||||
import com.easyink.wecom.domain.dto.WePermanentCodeDTO;
|
||||
import com.easyink.wecom.domain.vo.*;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.We3rdAppService;
|
||||
import com.easyink.wecom.service.WeAuthCorpInfoService;
|
||||
import com.easyink.wecom.service.WeCorpAccountService;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 类名: We3rdAppController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-09-08 16:14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/3rdapp")
|
||||
@Slf4j
|
||||
@ApiSupport(author = "1*+")
|
||||
@Api(tags = "三方应用授权接口")
|
||||
public class We3rdAppController {
|
||||
|
||||
|
||||
private final We3rdAppService we3rdAppService;
|
||||
private final WeAuthCorpInfoService weAuthCorpInfoService;
|
||||
private final RuoYiConfig ruoYiConfig;
|
||||
private final WeCorpAccountService weCorpAccountService;
|
||||
|
||||
|
||||
@Autowired
|
||||
public We3rdAppController(We3rdAppService we3rdAppService, WeAuthCorpInfoService weAuthCorpInfoService, RuoYiConfig ruoYiConfig, WeCorpAccountService weCorpAccountService) {
|
||||
this.we3rdAppService = we3rdAppService;
|
||||
this.weAuthCorpInfoService = weAuthCorpInfoService;
|
||||
this.ruoYiConfig = ruoYiConfig;
|
||||
this.weCorpAccountService = weCorpAccountService;
|
||||
}
|
||||
|
||||
@GetMapping("/getPreAuthCode")
|
||||
@ApiOperation(value = "获取预授权码")
|
||||
public AjaxResult<WePreAuthCodeVO> getPreAuthCode() {
|
||||
return AjaxResult.success(we3rdAppService.getPreAuthCode());
|
||||
}
|
||||
|
||||
@GetMapping("/getPermanentCode")
|
||||
@ApiOperation(value = "获取永久授权码")
|
||||
public AjaxResult getPermanentCode(WePermanentCodeDTO wePermanentCodeDTO) {
|
||||
we3rdAppService.handlePermanentCode(wePermanentCodeDTO.getAuthCode(), wePermanentCodeDTO.getSuiteId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getPreLoginParam")
|
||||
@ApiOperation(value = "获取预登录参数")
|
||||
public AjaxResult<WePreLoginParamVO> getPreLoginParam() {
|
||||
return AjaxResult.success(we3rdAppService.getPreLoginParam());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getServerType")
|
||||
@ApiOperation(value = "获取当前服务器类型")
|
||||
public AjaxResult<WeServerTypeVO> getServerType() {
|
||||
return AjaxResult.success(we3rdAppService.getServerType());
|
||||
}
|
||||
|
||||
@GetMapping("/checkDkSuiteAuthStatus")
|
||||
@ApiOperation(value = "检测代开发授权状态")
|
||||
public AjaxResult<SuiteAuthStatusVO> checkDkSuiteAuthStatus() {
|
||||
//授权未启用时 corpId是密文需要获得明文
|
||||
WeCorpAccount weCorpAccount = weCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>().eq(WeCorpAccount::getExternalCorpId, LoginTokenService.getLoginUser().getCorpId()).last(GenConstants.LIMIT_1));
|
||||
String corpId = weCorpAccount == null ? LoginTokenService.getLoginUser().getCorpId() : weCorpAccount.getCorpId();
|
||||
SuiteAuthStatusVO result = SuiteAuthStatusVO.builder().authSuccess(weAuthCorpInfoService.corpAuthorized(corpId, ruoYiConfig.getProvider().getDkSuite().getDkId()))
|
||||
.corpId(LoginTokenService.getLoginUser().getCorpId()).suiteId(ruoYiConfig.getProvider().getDkSuite().getDkId()).build();
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/checkCorpId")
|
||||
@ApiOperation(value = "检测企业id是否为代开发")
|
||||
public AjaxResult<CheckCorpIdVO> checkCorpId() {
|
||||
return AjaxResult.success(weAuthCorpInfoService.isDkCorp(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/getDkQrCode")
|
||||
@ApiOperation(value = "获取待开发应用二维码")
|
||||
public AjaxResult getDkQrCode(){
|
||||
return AjaxResult.success("操作成功", ruoYiConfig.getProvider().getDkSuite().getDkQrCode());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.config.ThirdDefaultDomainConfig;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.wecom.domain.dto.AutoConfigDTO;
|
||||
import com.easyink.wecom.domain.vo.WeAdminQrcodeVO;
|
||||
import com.easyink.wecom.domain.vo.WeCheckQrcodeVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeAutoConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 类名: 企业微信后台接口
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-06 16:53
|
||||
*/
|
||||
@Api(value = "WeAdminController", tags = "企业微信后台接口")
|
||||
@RestController
|
||||
@RequestMapping("/wecom/admin")
|
||||
public class WeAdminController extends BaseController {
|
||||
|
||||
|
||||
private final WeAutoConfigService weAutoConfigService;
|
||||
|
||||
@Autowired
|
||||
public WeAdminController(WeAutoConfigService weAutoConfigService) {
|
||||
this.weAutoConfigService = weAutoConfigService;
|
||||
}
|
||||
|
||||
@ApiOperation("获取登录企业微信后台的二维码")
|
||||
@GetMapping("/getAdminLoginQrcode")
|
||||
public AjaxResult<WeAdminQrcodeVO> getAdminLoginQrcode() {
|
||||
WeAdminQrcodeVO weAdminQrcodeVO = weAutoConfigService.getAdminQrcode();
|
||||
return AjaxResult.success(weAdminQrcodeVO);
|
||||
}
|
||||
|
||||
@ApiOperation("检测登录企业微信后台的二维码")
|
||||
@GetMapping("/checkAdminLoginQrcode")
|
||||
public AjaxResult<WeCheckQrcodeVO> checkAdminLoginQrcode(@ApiParam("二维码Key") @RequestParam("qrcodeKey") String qrcodeKey, @ApiParam("二维码状态") @RequestParam("status") String status) {
|
||||
WeCheckQrcodeVO weCheckQrcodeVO = weAutoConfigService.check(qrcodeKey, status, LoginTokenService.getLoginUser());
|
||||
return AjaxResult.success(weCheckQrcodeVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动自动配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("启动自动配置")
|
||||
@PostMapping("/autoConfig")
|
||||
public AjaxResult autoConfig(@Valid @RequestBody AutoConfigDTO autoConfigDTO) {
|
||||
weAutoConfigService.autoConfig(autoConfigDTO, LoginTokenService.getLoginUser());
|
||||
//主要是为了补偿admin帐号首次配置内部应用时,原本是没有corpid
|
||||
LoginTokenService.refreshDataScope();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/getDepartMemberInfo")
|
||||
@ApiOperation("获取部门成员信息")
|
||||
public AjaxResult getDepartMemberInfo(String qrcodeKey) {
|
||||
String corpId = LoginTokenService.getLoginUser()
|
||||
.getCorpId();
|
||||
weAutoConfigService.getDepartMemberInfo(corpId, qrcodeKey) ;
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("获取默认应用域名配置")
|
||||
@GetMapping("/getDefaultDomainConfig")
|
||||
public AjaxResult<ThirdDefaultDomainConfig> getDefaultDomainConfig() {
|
||||
return AjaxResult.success(weAutoConfigService.getThirdDefaultDomainConfig());
|
||||
}
|
||||
|
||||
@ApiOperation("扫码登录企微后台验证手机短信验证码")
|
||||
@GetMapping("/confirmMobileCaptcha")
|
||||
public AjaxResult confirmMobileCaptcha(@ApiParam(value = "短信验证码") String captcha, @ApiParam(value = "短信验证需要的tlKey") String tlKey,
|
||||
@ApiParam(value = "qrKey由获取二维码接口返回") String qrcodeKey) {
|
||||
weAutoConfigService.confirmMobileCaptcha(captcha, tlKey, qrcodeKey);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("重新发送手机验证码")
|
||||
@GetMapping("/sendCaptcha")
|
||||
public AjaxResult sendCaptcha(@ApiParam(value = "短信验证需要的tlKey") String tlKey, @ApiParam(value = "qrcodeKey") String qrcodeKey) {
|
||||
weAutoConfigService.sendCaptcha(tlKey, qrcodeKey);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.wecom.domain.WeApp;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 类名: WeAppController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-27 17:19
|
||||
*/
|
||||
@Api(value = "WeAppController", tags = "企业微信应用配置接口", hidden = true)
|
||||
@RestController
|
||||
@RequestMapping("/wecom/weapp")
|
||||
public class WeAppController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 应用列表
|
||||
*
|
||||
* @return 应用列表
|
||||
*/
|
||||
@ApiOperation("获取应用列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list() {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.wecom.domain.dto.BaseApplicationDTO;
|
||||
import com.easyink.wecom.domain.dto.QueryApplicationDTO;
|
||||
import com.easyink.wecom.domain.dto.SetApplicationUseScopeDTO;
|
||||
import com.easyink.wecom.domain.dto.UpdateApplicationDTO;
|
||||
import com.easyink.wecom.domain.vo.ApplicationIntroductionVO;
|
||||
import com.easyink.wecom.domain.vo.MyApplicationIntroductionVO;
|
||||
import com.easyink.wecom.domain.vo.WeApplicationDetailVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeApplicationCenterService;
|
||||
import com.easyink.wecom.service.WeMyApplicationService;
|
||||
import com.easyink.wecom.service.WeMyApplicationUseScopeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: WeApplicationManagerController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-10-15 17:17
|
||||
*/
|
||||
@Api(value = "WeApplicationManagerController", tags = "应用管理接口")
|
||||
@RestController
|
||||
@RequestMapping("/wecom/application")
|
||||
public class WeApplicationManagerController {
|
||||
|
||||
private final WeApplicationCenterService weApplicationCenterService;
|
||||
private final WeMyApplicationService weMyApplicationService;
|
||||
private final WeMyApplicationUseScopeService weMyApplicationUseScopeService;
|
||||
|
||||
@Autowired
|
||||
public WeApplicationManagerController(WeApplicationCenterService weApplicationCenterService, WeMyApplicationService weMyApplicationService, WeMyApplicationUseScopeService weMyApplicationUseScopeService) {
|
||||
this.weApplicationCenterService = weApplicationCenterService;
|
||||
this.weMyApplicationService = weMyApplicationService;
|
||||
this.weMyApplicationUseScopeService = weMyApplicationUseScopeService;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取应用中心列表")
|
||||
@GetMapping("/getApplicationList")
|
||||
public AjaxResult<List<ApplicationIntroductionVO>> getApplicationList(@ApiParam @Valid QueryApplicationDTO queryApplicationDTO) {
|
||||
return AjaxResult.success(weApplicationCenterService.listOfEnableApplication(queryApplicationDTO.getType(), queryApplicationDTO.getName()));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取应用中心应用详情")
|
||||
@GetMapping("/getApplicationDetail")
|
||||
public AjaxResult<WeApplicationDetailVO> getApplicationList(BaseApplicationDTO baseApplicationDTO) {
|
||||
return AjaxResult.success(weApplicationCenterService.getApplicationDetail(baseApplicationDTO.getAppid(), LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:application:install')")
|
||||
@ApiOperation("安装应用")
|
||||
@PostMapping("/installApplication")
|
||||
public AjaxResult installApplication(@RequestBody BaseApplicationDTO baseApplicationDTO) {
|
||||
weMyApplicationService.installApplication(LoginTokenService.getLoginUser().getCorpId(), baseApplicationDTO.getAppid());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("获取我的应用列表")
|
||||
@GetMapping("/getMyApplicationList")
|
||||
public AjaxResult<List<MyApplicationIntroductionVO>> getMyApplicationList() {
|
||||
return AjaxResult.success(weMyApplicationService.listOfMyApplication(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@ApiOperation("获取我的应用列表-侧边栏")
|
||||
@GetMapping("/getMyApplicationList2Sidebar")
|
||||
public AjaxResult<List<MyApplicationIntroductionVO>> getMyApplicationList2Sidebar() {
|
||||
return AjaxResult.success(weMyApplicationService.listOfMyApplication2Sidebar(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@ApiOperation("移除我的应用")
|
||||
@PostMapping("/deleteMyApplication")
|
||||
public AjaxResult<List<MyApplicationIntroductionVO>> deleteMyApplication(@RequestBody BaseApplicationDTO baseApplicationDTO) {
|
||||
weMyApplicationService.deleteMyApplication(LoginTokenService.getLoginUser().getCorpId(), baseApplicationDTO.getAppid());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:myApplication:update')")
|
||||
@ApiOperation("更新我的应用配置")
|
||||
@PostMapping("/updateMyApplicationConfig")
|
||||
public AjaxResult<List<MyApplicationIntroductionVO>> updateMyApplicationConfig(@RequestBody UpdateApplicationDTO updateApplicationDTO) {
|
||||
weMyApplicationService.updateMyApplicationConfig(LoginTokenService.getLoginUser().getCorpId(), updateApplicationDTO.getAppid(), updateApplicationDTO.getConfig());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("我的应用使用范围")
|
||||
@PostMapping("/setMyApplicationUseScope")
|
||||
public AjaxResult setMyApplicationUseScope(@Valid @RequestBody SetApplicationUseScopeDTO setApplicationUseScopeDTO) {
|
||||
weMyApplicationUseScopeService.setMyApplicationUseScope(LoginTokenService.getLoginUser().getCorpId(), setApplicationUseScopeDTO.getAppid(), setApplicationUseScopeDTO.getUseScopeList());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.easyink.common.config.RuoYiConfig;
|
||||
import com.easyink.common.config.WeCrypt;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.exception.CustomException;
|
||||
import com.easyink.common.utils.Threads;
|
||||
import com.easyink.common.utils.wecom.WxCryptUtil;
|
||||
import com.easyink.wecom.domain.vo.WxCpXmlMessageVO;
|
||||
import com.easyink.wecom.factory.WeCallBackEventFactory;
|
||||
import com.easyink.wecom.factory.WeEventHandle;
|
||||
import com.easyink.wecom.openapi.service.AppCallbackSettingService;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.security.AnyTypePermission;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
|
||||
import me.chanjar.weixin.cp.bean.WxCpTpXmlPackage;
|
||||
import me.chanjar.weixin.cp.bean.WxCpXmlMessage;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 类名: 企业微信回调接口
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-06 16:52
|
||||
*/
|
||||
@Api(value = "WeCallBackController", tags = "企业微信回调接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wecom/callback")
|
||||
public class WeCallBackController {
|
||||
private final WeEventHandle weEventHandle;
|
||||
private final RuoYiConfig ruoYiConfig;
|
||||
private final AppCallbackSettingService appCallbackSettingService;
|
||||
@Resource(name = "sendCallbackExecutor")
|
||||
private ThreadPoolTaskExecutor sendCallbackExecutor;
|
||||
@Resource(name = "handleCallbackExecutor")
|
||||
private ThreadPoolTaskExecutor handleCallbackExecutor ;
|
||||
|
||||
|
||||
@Autowired
|
||||
public WeCallBackController(WeEventHandle weEventHandle, RuoYiConfig ruoYiConfig, AppCallbackSettingService appCallbackSettingService) {
|
||||
this.weEventHandle = weEventHandle;
|
||||
this.ruoYiConfig = ruoYiConfig;
|
||||
this.appCallbackSettingService = appCallbackSettingService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业微信官方回调入口 请求接收业务数据
|
||||
* (5秒内需要响应给企业微信,否则企业微信端会进行重试推送)
|
||||
*
|
||||
* @param msg bodymsg
|
||||
* @param signature 企业微信加密签名
|
||||
* @param timestamp 时间戳
|
||||
* @param nonce 随机数。与timestamp结合使用,用于防止请求重放攻击。
|
||||
* @return 当接收成功后,http头部返回200表示接收ok,其他错误码企业微信后台会一律当做失败并发起重试
|
||||
*/
|
||||
@ApiOperation("企业微信官方回调入口")
|
||||
@PostMapping(value = "/recive")
|
||||
public String receive(@RequestBody String msg, @RequestParam(name = "msg_signature") String signature,
|
||||
String timestamp, String nonce) {
|
||||
try {
|
||||
WeCrypt weCrypt = ruoYiConfig.getSelfBuild();
|
||||
WxCryptUtil wxCryptUtil = new WxCryptUtil(weCrypt.getToken(), weCrypt.getEncodingAesKey());
|
||||
log.info("msg:{}",msg);
|
||||
String decrypt = wxCryptUtil.decrypt(signature, timestamp, nonce, msg);
|
||||
log.info("decrypt:{}",decrypt);
|
||||
WxCpXmlMessageVO wxCpXmlMessage = strXmlToBean(decrypt);
|
||||
log.info("企微回调通知接口 wxCpXmlMessage:{}", JSON.toJSONString(wxCpXmlMessage));
|
||||
WeCallBackEventFactory factory = weEventHandle.factory(wxCpXmlMessage.getEvent());
|
||||
if (factory != null) {
|
||||
handleCallbackExecutor.submit(() -> factory.eventHandle(wxCpXmlMessage));
|
||||
} else {
|
||||
log.info("[企微回调通知接口]该回调事件不存在对应的处理,{}", wxCpXmlMessage.getEvent());
|
||||
}
|
||||
sendCallbackExecutor.execute(()->appCallbackSettingService.sendCallback(wxCpXmlMessage.getToUserName(),msg, signature,timestamp, nonce));
|
||||
} catch (Exception e) {
|
||||
log.error("企微回调异常:{}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 回调配置校验接口 请求验证URL有效性
|
||||
*
|
||||
* @param request request
|
||||
* @return 在1秒内响应GET请求,响应内容为上一步得到的明文消息内容(不能加引号,不能带bom头,不能带换行符)
|
||||
*/
|
||||
@ApiOperation("回调配置校验接口")
|
||||
@GetMapping(value = "/recive")
|
||||
public String recive(HttpServletRequest request) {
|
||||
log.info("回调配置校验接口开始");
|
||||
// 微信加密签名
|
||||
String sVerifyMsgSig = request.getParameter("msg_signature");
|
||||
// 时间戳
|
||||
String sVerifyTimeStamp = request.getParameter("timestamp");
|
||||
// 随机数
|
||||
String sVerifyNonce = request.getParameter("nonce");
|
||||
// 随机字符串
|
||||
String sVerifyEchoStr = request.getParameter("echostr");
|
||||
|
||||
try {
|
||||
WeCrypt weCrypt = ruoYiConfig.getSelfBuild();
|
||||
WxCryptUtil wxCryptUtil = new WxCryptUtil(weCrypt.getToken(), weCrypt.getEncodingAesKey());
|
||||
return wxCryptUtil.verifyURL(sVerifyMsgSig, sVerifyTimeStamp, sVerifyNonce, sVerifyEchoStr);
|
||||
} catch (Exception e) {
|
||||
log.error("回调配置校验接口:{}", ExceptionUtils.getStackTrace(e));
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业微信官方回调入口 请求接收业务数据
|
||||
* (5秒内需要响应给企业微信,否则企业微信端会进行重试推送)
|
||||
*
|
||||
* @param msg bodymsg
|
||||
* @param signature 企业微信加密签名
|
||||
* @param timestamp 时间戳
|
||||
* @param nonce 随机数。与timestamp结合使用,用于防止请求重放攻击。
|
||||
* @return 当接收成功后,http头部返回200表示接收ok,其他错误码企业微信后台会一律当做失败并发起重试
|
||||
*/
|
||||
@ApiOperation("企业微信官方回调入口")
|
||||
@PostMapping(value = "/recive3rdapp")
|
||||
public String receive3rdapp(@RequestBody String msg, @RequestParam(name = "msg_signature") String signature,
|
||||
String timestamp, String nonce) {
|
||||
try {
|
||||
log.info("msg:{}",msg);
|
||||
WxCpTpXmlPackage wxCpTpXmlPackage = WxCpTpXmlPackage.fromXml(msg);
|
||||
log.info("wxCpTpXmlPackage:{}",wxCpTpXmlPackage);
|
||||
WeCrypt weCrypt = ruoYiConfig.getProvider().getCryptById(wxCpTpXmlPackage.getToUserName());
|
||||
WxCryptUtil wxCryptUtil = new WxCryptUtil(weCrypt.getToken(), weCrypt.getEncodingAesKey());
|
||||
|
||||
String decrypt = wxCryptUtil.decrypt(signature, timestamp, nonce, msg);
|
||||
log.info("企微三方应用回调通知接口,转换前的xml :{}", decrypt);
|
||||
WxCpXmlMessageVO wxCpXmlMessage = strXmlToBean(decrypt);
|
||||
log.info("企微三方应用回调通知接口 wxCpXmlMessage:{}", JSON.toJSONString(wxCpXmlMessage));
|
||||
String event = StringUtils.isNotBlank(wxCpXmlMessage.getInfoType()) ? wxCpXmlMessage.getInfoType() : wxCpXmlMessage.getEvent();
|
||||
WeCallBackEventFactory factory = weEventHandle.factory(event);
|
||||
if (factory != null) {
|
||||
handleCallbackExecutor.submit(() -> factory.eventHandle(wxCpXmlMessage));
|
||||
} else {
|
||||
throw new CustomException(ResultTip.TIP_STRATEGY_IS_EMPTY);
|
||||
}
|
||||
sendCallbackExecutor.execute(()->appCallbackSettingService.sendCallback(wxCpXmlMessage.getToUserName(),msg, signature,timestamp, nonce));
|
||||
} catch (Exception e) {
|
||||
log.error("企微三方应用回调通知接口异常:{}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
/**
|
||||
* (三方应用)回调配置校验接口 请求验证URL有效性
|
||||
*
|
||||
* @param msgSignature 企业微信加密签名,msg_signature结合了企业填写的token、请求中的timestamp、nonce参数、加密的消息体
|
||||
* @param timestamp 时间戳
|
||||
* @param nonce 随机数
|
||||
* @param echostr 加密的字符串。需要解密得到消息内容明文,解密后有random、msg_len、msg、receiveid四个字段,其中msg即为消息内容明文
|
||||
* @return 在1秒内响应GET请求,响应内容为上一步得到的明文消息内容(不能加引号,不能带bom头,不能带换行符)
|
||||
*/
|
||||
@ApiOperation("三方应用回调配置校验接口")
|
||||
@GetMapping(value = "/recive3rdapp")
|
||||
public String check3rdapp(@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("echostr") String echostr) {
|
||||
log.info("三方应用回调配置校验接口");
|
||||
try {
|
||||
WeCrypt weCrypt = ruoYiConfig.getProvider().getCryptById("");
|
||||
WxCryptUtil wxCryptUtil = new WxCryptUtil(weCrypt.getToken(), weCrypt.getEncodingAesKey());
|
||||
return wxCryptUtil.verifyURL(msgSignature, timestamp, nonce, echostr);
|
||||
} catch (Exception e) {
|
||||
log.error("回调配置校验接口:{}", ExceptionUtils.getStackTrace(e));
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
private WxCpXmlMessageVO strXmlToBean(String xmlStr) {
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
xstream.addPermission(AnyTypePermission.ANY);
|
||||
xstream.processAnnotations(WxCpXmlMessage.class);
|
||||
xstream.processAnnotations(WxCpXmlMessageVO.class);
|
||||
xstream.processAnnotations(WxCpXmlMessageVO.ScanCodeInfo.class);
|
||||
xstream.processAnnotations(WxCpXmlMessageVO.SendPicsInfo.class);
|
||||
xstream.processAnnotations(WxCpXmlMessageVO.SendPicsInfo.Item.class);
|
||||
xstream.processAnnotations(WxCpXmlMessageVO.SendLocationInfo.class);
|
||||
xstream.processAnnotations(WxCpXmlMessageVO.BatchJob.class);
|
||||
return (WxCpXmlMessageVO) xstream.fromXML(xmlStr);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.wecom.domain.WeCategory;
|
||||
import com.easyink.wecom.domain.dto.WeCategorySidebarSwitchDTO;
|
||||
import com.easyink.wecom.domain.vo.WeCategoryBaseInfoVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeCategoryService;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: WeCategoryController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-27 11:08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/category")
|
||||
@Api(value = "WeCategoryController", tags = "企业微信素材分类接口")
|
||||
public class WeCategoryController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WeCategoryService weCategoryService;
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wechat:category:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("类目树")
|
||||
public AjaxResult list(@ApiParam(value = "分类类型", allowableValues = "range[0, 5]") @RequestParam("mediaType") Integer mediaType) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
return AjaxResult.success(weCategoryService.findWeCategoryByMediaType(corpId, mediaType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询类目详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wechat:category:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("通过id查询类目详细信息")
|
||||
public AjaxResult<WeCategory> getInfo(@ApiParam("类目ID") @PathVariable("id") Long id) {
|
||||
return AjaxResult.success(weCategoryService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加类目
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wechat:category:add')")
|
||||
@Log(title = "添加类目", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperationSupport(ignoreParameters = {"id"})
|
||||
@ApiOperation("添加类目")
|
||||
public AjaxResult add(@RequestBody WeCategory category) {
|
||||
category.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weCategoryService.insertWeCategory(category);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新目录
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wechat:category:edit')")
|
||||
@Log(title = "更新目录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("更新目录")
|
||||
public AjaxResult edit(@RequestBody WeCategory category) {
|
||||
category.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weCategoryService.updateWeCategory(category);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除类目
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wechat:category:remove')")
|
||||
@Log(title = "删除类目", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除类目")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
weCategoryService.deleteWeCategoryById(corpId, ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wechat:material:sidebar')")
|
||||
@Log(title = "侧边栏开关", businessType = BusinessType.DELETE)
|
||||
@PutMapping("/sidebarSwitch")
|
||||
@ApiOperation("侧边栏开关")
|
||||
public AjaxResult sidebarSwitch(@Validated @RequestBody WeCategorySidebarSwitchDTO sidebarSwitchDTO) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
sidebarSwitchDTO.setCorpId(corpId);
|
||||
weCategoryService.sidebarSwitch(sidebarSwitchDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getList")
|
||||
@ApiOperation("获取所有类型列表")
|
||||
public AjaxResult getList() {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
List<WeCategoryBaseInfoVO> showWeCategory = weCategoryService.findListByCorpId(corpId);
|
||||
return AjaxResult.success(showWeCategory);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.wecom.domain.dto.WeChatCollectionDTO;
|
||||
import com.easyink.wecom.domain.vo.FindCollectionsVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 类名: WeChatCollectionController
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-08-27 17:43
|
||||
*/
|
||||
@Api(value = "WeChatCollectionController", tags = "聊天侧边栏-素材收藏接口")
|
||||
@RequestMapping(value = "/wecom/chat/collection")
|
||||
@RestController
|
||||
@Deprecated
|
||||
public class WeChatCollectionController extends BaseController {
|
||||
/**
|
||||
* 添加收藏
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('chat:collection:add')")
|
||||
@Log(title = "添加收藏", businessType = BusinessType.INSERT)
|
||||
@PostMapping("addCollection")
|
||||
@ApiOperation("添加收藏")
|
||||
public AjaxResult addCollection(@RequestBody WeChatCollectionDTO chatCollectionDto) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取消收藏
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('chat:collection:delete')")
|
||||
// @Log(title = "取消收藏", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "cancleCollection")
|
||||
@ApiOperation("取消收藏")
|
||||
public AjaxResult cancleCollection(@RequestBody WeChatCollectionDTO chatCollectionDto) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 收藏列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('chat:collection:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value = "收藏列表")
|
||||
public TableDataInfo<FindCollectionsVO> list(@ApiParam("员工ID") @RequestParam(value = "userId") String userId, @ApiParam(value = "关键词", required = false) @RequestParam(value = "keyword") String keyword) {
|
||||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.utils.PageInfoUtil;
|
||||
import com.easyink.common.utils.poi.ExcelUtil;
|
||||
import com.easyink.wecom.domain.WeChatContactMapping;
|
||||
import com.easyink.wecom.domain.dto.WeChatMappingDTO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeChatContactMappingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 聊天关系映射Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2020-12-27
|
||||
*/
|
||||
@Api(tags = "聊天关系映射Controller")
|
||||
@RestController
|
||||
@RequestMapping("/chat/mapping")
|
||||
public class WeChatContactMappingController extends BaseController {
|
||||
@Autowired
|
||||
private WeChatContactMappingService weChatContactMappingService;
|
||||
|
||||
/**
|
||||
* 查询聊天关系映射列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('chat:mapping:list')")
|
||||
@ApiOperation(value = "查询聊天关系映射列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WeChatContactMapping> list(WeChatMappingDTO weChatMappingDTO) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
if (StringUtils.isBlank(corpId)) {
|
||||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
PageInfoUtil.setPage();
|
||||
weChatMappingDTO.setCorpId(corpId);
|
||||
List<WeChatContactMapping> list = weChatContactMappingService.selectWeChatContactMappingListV2(weChatMappingDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出聊天关系映射列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('chat:mapping:export')")
|
||||
@Deprecated
|
||||
@Log(title = "聊天关系映射", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出聊天关系映射列表")
|
||||
public AjaxResult export(WeChatContactMapping weChatContactMapping) {
|
||||
weChatContactMapping.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeChatContactMapping> list = weChatContactMappingService.selectWeChatContactMappingList(weChatContactMapping);
|
||||
ExcelUtil<WeChatContactMapping> util = new ExcelUtil<>(WeChatContactMapping.class);
|
||||
return util.exportExcel(list, "mapping");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取聊天关系映射详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('chat:mapping:query')")
|
||||
@Deprecated
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取聊天关系映射详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(weChatContactMappingService.selectWeChatContactMappingById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增聊天关系映射
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('chat:mapping:add')")
|
||||
@Deprecated
|
||||
@Log(title = "聊天关系映射", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增聊天关系映射")
|
||||
public AjaxResult add(@RequestBody WeChatContactMapping weChatContactMapping) {
|
||||
return toAjax(weChatContactMappingService.insertWeChatContactMapping(weChatContactMapping));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改聊天关系映射
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('chat:mapping:edit')")
|
||||
@Deprecated
|
||||
@Log(title = "聊天关系映射", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改聊天关系映射")
|
||||
public AjaxResult edit(@RequestBody WeChatContactMapping weChatContactMapping) {
|
||||
return toAjax(weChatContactMappingService.updateWeChatContactMapping(weChatContactMapping));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除聊天关系映射
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('chat:mapping:remove')")
|
||||
@Deprecated
|
||||
@Log(title = "聊天关系映射", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除聊天关系映射")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(weChatContactMappingService.deleteWeChatContactMappingByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.WeCorpAccount;
|
||||
import com.easyink.common.core.domain.model.LoginResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.exception.CustomException;
|
||||
import com.easyink.wecom.domain.dto.FindWeMaterialDTO;
|
||||
import com.easyink.wecom.domain.vo.WeCategoryBaseInfoVO;
|
||||
import com.easyink.wecom.domain.vo.WeCorpInfoVO;
|
||||
import com.easyink.wecom.domain.vo.WeMaterialVO;
|
||||
import com.easyink.wecom.domain.vo.WeUserInfoVO;
|
||||
import com.easyink.wecom.login.service.SysLoginService;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeCategoryService;
|
||||
import com.easyink.wecom.service.WeCorpAccountService;
|
||||
import com.easyink.wecom.service.WeMaterialService;
|
||||
import com.easyink.wecom.service.WeUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 聊天工具侧边栏
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@RequestMapping(value = "/wecom/chat/side")
|
||||
@RestController
|
||||
@Api(tags = "聊天工具侧边栏")
|
||||
public class WeChatSideController extends BaseController {
|
||||
|
||||
private final WeCorpAccountService weCorpAccountService;
|
||||
private final SysLoginService sysLoginService;
|
||||
private final WeUserService weUserService;
|
||||
private final WeCategoryService weCategoryService;
|
||||
private final WeMaterialService weMaterialService;
|
||||
|
||||
|
||||
@Autowired
|
||||
public WeChatSideController(WeCorpAccountService weCorpAccountService, SysLoginService sysLoginService, WeUserService weUserService, WeCategoryService weCategoryService, WeMaterialService weMaterialService) {
|
||||
this.weCorpAccountService = weCorpAccountService;
|
||||
this.sysLoginService = sysLoginService;
|
||||
this.weUserService = weUserService;
|
||||
this.weCategoryService = weCategoryService;
|
||||
this.weMaterialService = weMaterialService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前启用配置
|
||||
* update by Society my sister Li 增加code、corpId传参,用于确认成员信息,增加返回token,便于后续侧边栏接口直接获取corpId
|
||||
*
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@GetMapping("/getCorpInfo")
|
||||
@ApiOperation("获取当前启用配置")
|
||||
public AjaxResult getCorpInfo(@ApiParam("code") @RequestParam(value = "code") String code, @ApiParam("corpId") @RequestParam(value = "corpId") String corpId) {
|
||||
if (StringUtils.isBlank(corpId) || StringUtils.isBlank(code)) {
|
||||
throw new CustomException(ResultTip.TIP_GENERAL_BAD_REQUEST);
|
||||
}
|
||||
WeCorpAccount validWeCorpAccount = weCorpAccountService.findValidWeCorpAccount(corpId);
|
||||
if (validWeCorpAccount == null) {
|
||||
throw new CustomException(ResultTip.TIP_NOT_CORP_CONFIG);
|
||||
}
|
||||
WeCorpInfoVO weCorpInfoVO = new WeCorpInfoVO();
|
||||
BeanUtils.copyProperties(validWeCorpAccount, weCorpInfoVO);
|
||||
if (StringUtils.isBlank(weCorpInfoVO.getCorpId())) {
|
||||
throw new CustomException(ResultTip.TIP_NOT_CORP_CONFIG);
|
||||
}
|
||||
WeUserInfoVO userInfo = weUserService.getUserInfo(code, validWeCorpAccount.getAgentId(), validWeCorpAccount.getCorpId());
|
||||
LoginResult loginResult = sysLoginService.loginByUserId(userInfo.getUserId(), validWeCorpAccount.getCorpId(), validWeCorpAccount, true, false);
|
||||
weCorpInfoVO.setToken(loginResult.getToken());
|
||||
return AjaxResult.success(weCorpInfoVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 群发侧边栏列表
|
||||
* updateBy Society my sister Li 前端传参token后,可自行获取corpId
|
||||
*/
|
||||
@GetMapping("/h5List")
|
||||
@ApiOperation("侧边栏素材类型列表")
|
||||
public TableDataInfo h5List() {
|
||||
startPage();
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
List<WeCategoryBaseInfoVO> showWeCategory = weCategoryService.findShowWeCategory(corpId);
|
||||
return getDataTable(showWeCategory);
|
||||
}
|
||||
|
||||
@GetMapping("/h5materialList")
|
||||
@ApiOperation("侧边栏素材类型列表")
|
||||
public TableDataInfo materialList(@Validated FindWeMaterialDTO findWeMaterialDTO) {
|
||||
startPage();
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
findWeMaterialDTO.setCorpId(corpId);
|
||||
findWeMaterialDTO.setShowMaterial(WeConstans.DEFAULT_WE_MATERIAL_USING);
|
||||
findWeMaterialDTO.setUsingFlag(WeConstans.DEFAULT_WE_MATERIAL_USING);
|
||||
findWeMaterialDTO.setIsExpire(WeConstans.MATERIAL_UN_EXPIRE);
|
||||
List<WeMaterialVO> weMaterials = weMaterialService.findWeMaterials(findWeMaterialDTO);
|
||||
return getDataTable(weMaterials);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.dto.WeGroupSopDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 社区运营 - 群sop controller
|
||||
*/
|
||||
@Api(tags = "新客自动拉群 Controller")
|
||||
@RestController
|
||||
@RequestMapping(value = "/wecom/communityGroupSop")
|
||||
@Deprecated
|
||||
public class WeCommunityGroupSopController extends BaseController {
|
||||
|
||||
/**
|
||||
* 通过规则id获取sop规则
|
||||
*
|
||||
* @param ruleId 规则id
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "通过规则id获取sop规则详情", httpMethod = "GET")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:query')")
|
||||
@GetMapping(path = "/{ruleId}")
|
||||
public AjaxResult getGroupSop(@PathVariable("ruleId") Long ruleId) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改SOP规则
|
||||
*
|
||||
* @param ruleId SOP规则 id
|
||||
* @param groupSopDto 更新数据
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "更改SOP规则", httpMethod = "PUT")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:edit')")
|
||||
@PutMapping(path = "/{ruleId}")
|
||||
public AjaxResult updateGroupSop(@PathVariable Long ruleId, @Validated @RequestBody WeGroupSopDTO groupSopDto) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id列表批量删除群sop规则
|
||||
*
|
||||
* @param ids 群sop规则列表
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "根据id列表批量删除群sop规则", httpMethod = "DELETE")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communityGroupSop:remove')")
|
||||
@DeleteMapping(path = "/{ids}")
|
||||
public AjaxResult batchDeleteSopRule(@PathVariable("ids") Long[] ids) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.SysUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.CommunityTaskType;
|
||||
import com.easyink.common.service.ISysUserService;
|
||||
import com.easyink.wecom.domain.dto.groupsop.GetSopTaskDetailDTO;
|
||||
import com.easyink.wecom.domain.vo.sop.GetSopTaskByUserIdVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeOperationsCenterSopDetailService;
|
||||
import com.easyink.wecom.service.WePresTagGroupTaskService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 社区运营H5接口
|
||||
*
|
||||
* @author admin
|
||||
* @Date 2021/3/24 10:54
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/wecom/community/h5")
|
||||
@Api(tags = "社区运营H5接口")
|
||||
public class WeCommunityH5Controller extends BaseController {
|
||||
|
||||
private final WePresTagGroupTaskService tagGroupTaskService;
|
||||
private final ISysUserService userService;
|
||||
private final WeOperationsCenterSopDetailService sopDetailService;
|
||||
|
||||
@Autowired
|
||||
public WeCommunityH5Controller(WePresTagGroupTaskService tagGroupTaskService, ISysUserService userService, WeOperationsCenterSopDetailService sopDetailService) {
|
||||
this.tagGroupTaskService = tagGroupTaskService;
|
||||
this.userService = userService;
|
||||
this.sopDetailService = sopDetailService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务对应的执行人列表
|
||||
*
|
||||
* @param taskId 任务id
|
||||
* @param type 任务类型 1:标签建群任务 2:sop任务
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/scope/{taskId}")
|
||||
@ApiOperation("获取任务对应的执行人列表")
|
||||
public AjaxResult getTaskScopeList(@PathVariable("taskId") Long taskId, @RequestParam(value = "type") Integer type) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
if (CommunityTaskType.TAG.getType().equals(type)) {
|
||||
return AjaxResult.success(tagGroupTaskService.getScopeListByTaskId(taskId, corpId));
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* h5页面根据员工id获取老客标签建群和群sop任务信息
|
||||
*
|
||||
* @param emplId 员工id
|
||||
* @param type 数据类型,0:全部数据 1:老客标签建群数据 2:群SOP数据
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{emplId}")
|
||||
@ApiOperation("员工id获取标签建群和群sop任务信息")
|
||||
public AjaxResult getEmplTask(@PathVariable("emplId") String emplId, @RequestParam(value = "type") Integer type) {
|
||||
AjaxResult res = AjaxResult.success();
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
if (CommunityTaskType.TAG.getType().equals(type)) {
|
||||
// 老客标签建群数据
|
||||
res.put("todo", tagGroupTaskService.getEmplTaskList(emplId, Boolean.FALSE, corpId));
|
||||
res.put("done", tagGroupTaskService.getEmplTaskList(emplId, Boolean.TRUE, corpId));
|
||||
} else {
|
||||
// 全部数据
|
||||
List todoList = new ArrayList();
|
||||
List doneList = new ArrayList();
|
||||
todoList.addAll(tagGroupTaskService.getEmplTaskList(emplId, Boolean.FALSE, corpId));
|
||||
res.put("todo", todoList);
|
||||
doneList.addAll(tagGroupTaskService.getEmplTaskList(emplId, Boolean.TRUE, corpId));
|
||||
res.put("done", doneList);
|
||||
}
|
||||
SysUser user = userService.selectUserByUserName(emplId);
|
||||
boolean isAdmin = user != null && user.isAdmin();
|
||||
res.put("isAdmin", isAdmin);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工发送老客标签建群任务信息或者发送sop到其客户群之后,变更其任务状态
|
||||
*
|
||||
* @param taskId 老客标签建群时代表任务id,sop时,代表规则id
|
||||
* @param emplId 老客标签建群时代表员工id,sop时,代表群主
|
||||
* @param type 类型 0:老客标签建群 1:sop
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/changeStatus")
|
||||
@ApiOperation("变更任务状态")
|
||||
public AjaxResult changeStatus(@RequestParam("taskId") Long taskId, @RequestParam("emplId") String emplId, @RequestParam("type") Integer type) {
|
||||
if (type.equals(0)) {
|
||||
return toAjax(tagGroupTaskService.updateEmplTaskStatus(taskId, emplId));
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/sopTaskDetail/{emplId}")
|
||||
@ApiOperation("获取员工的SOP任务详情")
|
||||
public TableDataInfo<GetSopTaskByUserIdVO> sopTaskDetail(@PathVariable("emplId") String emplId, GetSopTaskDetailDTO getSopTaskDetailDTO) {
|
||||
startPage();
|
||||
getSopTaskDetailDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
getSopTaskDetailDTO.setUserId(emplId);
|
||||
List<GetSopTaskByUserIdVO> list = sopDetailService.getTaskDetailByUserId(getSopTaskDetailDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.WeKeywordGroupTask;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 关键词拉群controller
|
||||
*/
|
||||
@Api(tags = "关键词拉群")
|
||||
@RestController
|
||||
@RequestMapping(value = "/wecom/communityKeywordGroup")
|
||||
@Deprecated
|
||||
public class WeCommunityKeywordGroupController extends BaseController {
|
||||
|
||||
/**
|
||||
* 根据过滤条件获取关键词拉群任务列表
|
||||
*/
|
||||
@ApiOperation(value = "获取关键词拉群任务列表")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:list')")
|
||||
@GetMapping(path = "/list")
|
||||
public TableDataInfo<WeKeywordGroupTask> list(WeKeywordGroupTask task) {
|
||||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取任务详情
|
||||
*
|
||||
* @param taskId 任务id
|
||||
* @return 任务详情
|
||||
*/
|
||||
@ApiOperation(value = "获取任务详情")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:query')")
|
||||
@GetMapping(path = "/{taskId}")
|
||||
public AjaxResult getTask(@ApiParam("任务id") @PathVariable("taskId") Long taskId) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加新任务
|
||||
*
|
||||
* @param task 添加任务所需的数据
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "添加新任务")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:add')")
|
||||
@PostMapping(path = "/")
|
||||
public AjaxResult addTask(@RequestBody @Validated WeKeywordGroupTask task) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id及更新数据对指定任务进行更新
|
||||
*/
|
||||
@ApiOperation(value = "更新任务")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:edit')")
|
||||
@PutMapping("/{taskId}")
|
||||
public AjaxResult updateTask(
|
||||
@ApiParam("任务id") @PathVariable("taskId") Long taskId, @RequestBody @Validated WeKeywordGroupTask task) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id列表批量删除任务
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "批量删除任务")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communityKeyword:remove')")
|
||||
@DeleteMapping(path = "/{ids}")
|
||||
public AjaxResult batchDeleteTask(@ApiParam("待删除任务id数组") @PathVariable("ids") Long[] ids) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.EmployCodeSourceEnum;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.exception.CustomException;
|
||||
import com.easyink.common.utils.file.FileUtils;
|
||||
import com.easyink.wecom.domain.WeEmpleCodeUseScop;
|
||||
import com.easyink.wecom.domain.dto.emplecode.AddWeEmpleCodeDTO;
|
||||
import com.easyink.wecom.domain.dto.emplecode.FindWeEmpleCodeDTO;
|
||||
import com.easyink.wecom.domain.vo.WeCommunityNewGroupVO;
|
||||
import com.easyink.wecom.domain.vo.WeEmpleCodeVO;
|
||||
import com.easyink.wecom.domain.vo.WeEmplyCodeDownloadVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeEmpleCodeService;
|
||||
import com.easyink.wecom.service.WeEmpleCodeUseScopService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 社群运营 新客自动拉群 Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021-02-19
|
||||
*/
|
||||
@Api(tags = "新客自动拉群 Controller")
|
||||
@RestController
|
||||
@RequestMapping(value = "/wecom/communityNewGroup")
|
||||
@Slf4j
|
||||
public class WeCommunityNewGroupController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WeEmpleCodeService weEmpleCodeService;
|
||||
|
||||
@Autowired
|
||||
private WeEmpleCodeUseScopService weEmpleCodeUseScopService;
|
||||
|
||||
@ApiOperation(value = "新增新客自动拉群", httpMethod = "POST")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:add')")
|
||||
@Log(title = "新客自动拉群", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/")
|
||||
public <T> AjaxResult<T> add(@RequestBody AddWeEmpleCodeDTO addWeEmpleCodeDTO) {
|
||||
addWeEmpleCodeDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
addWeEmpleCodeDTO.setSource(EmployCodeSourceEnum.NEW_GROUP.getSource());
|
||||
weEmpleCodeService.insertWeEmpleCode(addWeEmpleCodeDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改新客自动拉群
|
||||
*/
|
||||
@ApiOperation(value = "修改新客自动拉群", httpMethod = "PUT")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:edit')")
|
||||
@Log(title = "新客自动拉群", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
public <T> AjaxResult<T> edit(@PathVariable("id") String id, @RequestBody @Validated AddWeEmpleCodeDTO weEmpleCode) {
|
||||
weEmpleCode.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weEmpleCodeService.updateWeEmpleCode(weEmpleCode);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个下载
|
||||
*
|
||||
* @param id 待下载员工活码
|
||||
* @param response 响应
|
||||
*/
|
||||
@ApiOperation(value = "新客建群下载", httpMethod = "GET")
|
||||
@Log(title = "新客建群下载", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/download")
|
||||
public void download(Long id, HttpServletResponse response) {
|
||||
if (id == null) {
|
||||
throw new CustomException(ResultTip.TIP_GENERAL_BAD_REQUEST);
|
||||
}
|
||||
List<Long> idList = new ArrayList<>();
|
||||
idList.add(id);
|
||||
List<WeEmplyCodeDownloadVO> empleCodeList = weEmpleCodeService.downloadWeEmplyCodeData(LoginTokenService.getLoginUser().getCorpId(), idList);
|
||||
if (org.apache.commons.collections4.CollectionUtils.isEmpty(empleCodeList)) {
|
||||
throw new CustomException(ResultTip.TIP_EMPLY_CODE_NOT_FOUND);
|
||||
}
|
||||
WeEmplyCodeDownloadVO emplyCode = empleCodeList.get(0);
|
||||
try {
|
||||
FileUtils.downloadFile(emplyCode.getQrCode(), response.getOutputStream());
|
||||
} catch (IOException exc) {
|
||||
log.error("员工活码下载异常 ex:{}", ExceptionUtils.getStackTrace(exc));
|
||||
throw new CustomException(ResultTip.TIP_DOWNLOAD_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工活码批量下载
|
||||
*
|
||||
* @param ids 新客自动拉群ids
|
||||
* @param response 输出
|
||||
*/
|
||||
@ApiOperation(value = "员工活码批量下载", httpMethod = "GET")
|
||||
@Log(title = "员工活码批量下载", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/downloadBatch")
|
||||
public void downloadBatch(Long[] ids, HttpServletResponse response) {
|
||||
if (ids == null || ids.length == 0) {
|
||||
throw new CustomException(ResultTip.TIP_GENERAL_BAD_REQUEST);
|
||||
}
|
||||
List<Long> idList = Arrays.asList(ids);
|
||||
List<WeEmplyCodeDownloadVO> list = weEmpleCodeService.downloadWeEmplyCodeData(LoginTokenService.getLoginUser().getCorpId(), idList);
|
||||
|
||||
List<Map<String, String>> fileList = list.stream().map(e -> {
|
||||
Map<String, String> fileMap = new HashMap<>();
|
||||
List<WeEmpleCodeUseScop> weEmployCodeUseScopes = weEmpleCodeUseScopService.selectWeEmpleCodeUseScopListById(e.getId(), LoginTokenService.getLoginUser().getCorpId());
|
||||
List<String> userList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(weEmployCodeUseScopes)) {
|
||||
weEmployCodeUseScopes.forEach(useScope -> userList.add(useScope.getBusinessName()));
|
||||
}
|
||||
fileMap.put("fileName", StringUtils.join(userList, ",") + "-" + e.getScenario() + ".jpg");
|
||||
fileMap.put("url", e.getQrCode());
|
||||
return fileMap;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
try {
|
||||
FileUtils.batchDownloadFile(fileList, response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
log.error("员工活码批量下载异常 ex:{}", ExceptionUtils.getStackTrace(e));
|
||||
throw new CustomException(ResultTip.TIP_DOWNLOAD_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询新客自动拉群列表
|
||||
*/
|
||||
@ApiOperation(value = "查询新客自动拉群列表", httpMethod = "GET")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WeEmpleCodeVO> list(FindWeEmpleCodeDTO weEmpleCode) {
|
||||
startPage();
|
||||
weEmpleCode.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weEmpleCode.setSource(EmployCodeSourceEnum.NEW_GROUP.getSource());
|
||||
List<WeEmpleCodeVO> list = weEmpleCodeService.selectGroupWeEmpleCodeList(weEmpleCode);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新客自动拉群详细信息
|
||||
*/
|
||||
@ApiOperation(value = "获取新客自动拉群详细信息", httpMethod = "GET")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult<WeCommunityNewGroupVO> getInfo(@PathVariable("id") @ApiParam("主键ID") Long id) {
|
||||
return AjaxResult.success(weEmpleCodeService.selectWeEmpleCodeById(id, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除新客自动拉群
|
||||
*/
|
||||
@ApiOperation(value = "删除新客进群", httpMethod = "DELETE")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:remove')")
|
||||
@Log(title = "删除新客进群", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public <T> AjaxResult<T> remove(@PathVariable Long[] ids) {
|
||||
if (ids == null || ids.length == 0) {
|
||||
throw new CustomException(ResultTip.TIP_GENERAL_BAD_REQUEST);
|
||||
}
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
List<Long> idList = Arrays.asList(ids);
|
||||
return toAjax(weEmpleCodeService.batchRemoveWeEmpleCodeIds(corpId, idList));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.common.utils.bean.BeanUtils;
|
||||
import com.easyink.wecom.domain.WePresTagGroupTask;
|
||||
import com.easyink.wecom.domain.dto.WePresTagGroupTaskDTO;
|
||||
import com.easyink.wecom.domain.vo.WePresTagGroupTaskStatResultVO;
|
||||
import com.easyink.wecom.domain.vo.WePresTagGroupTaskStatVO;
|
||||
import com.easyink.wecom.domain.vo.WePresTagGroupTaskVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeGroupCodeService;
|
||||
import com.easyink.wecom.service.WePresTagGroupTaskService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: WeCommunityPresTagGroupController
|
||||
*
|
||||
* @author 佚名
|
||||
* @date 2021/9/30 15:27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/wecom/communityPresTagGroup")
|
||||
@Api(tags = "标签建群", hidden = true)
|
||||
@Deprecated
|
||||
public class WeCommunityPresTagGroupController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WePresTagGroupTaskService taskService;
|
||||
|
||||
@Autowired
|
||||
private WeGroupCodeService groupCodeService;
|
||||
private static final String ERROR_MSG = "群活码不存在";
|
||||
|
||||
/**
|
||||
* 获取老客标签建群列表数据
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:list')")
|
||||
@ApiOperation("获取标签建群列表数据")
|
||||
@GetMapping(path = "/list")
|
||||
public TableDataInfo<WePresTagGroupTaskVO> getList(
|
||||
@RequestParam(value = "taskName") String taskName,
|
||||
@RequestParam(value = "sendType") Integer sendType,
|
||||
@RequestParam(value = "createBy") String createBy,
|
||||
@RequestParam(value = "beginTime") String beginTime,
|
||||
@RequestParam(value = "endTime") String endTime) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
startPage();
|
||||
List<WePresTagGroupTaskVO> wePresTagGroupTaskVoList = taskService.selectTaskList(corpId,taskName, sendType, createBy, beginTime, endTime);
|
||||
return getDataTable(wePresTagGroupTaskVoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建老客标签建群任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("新建标签建群任务")
|
||||
public AjaxResult addTask(@RequestBody @Validated WePresTagGroupTaskDTO wePresTagGroupTaskDto) {
|
||||
if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
|
||||
return AjaxResult.error(ResultTip.TIP_GENERAL_NOT_FOUND, ERROR_MSG);
|
||||
}
|
||||
WePresTagGroupTask task = new WePresTagGroupTask();
|
||||
BeanUtils.copyProperties(wePresTagGroupTaskDto, task);
|
||||
task.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
|
||||
// 检测任务名是否可用
|
||||
if (taskService.isNameOccupied(task)) {
|
||||
return AjaxResult.error("任务名已存在");
|
||||
}
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
task.setCreateBy(LoginTokenService.getUsername());
|
||||
return toAjax(taskService.addTask(wePresTagGroupTaskDto, task, loginUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据获取任务详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')")
|
||||
@GetMapping(path = "/{id}")
|
||||
@ApiOperation("根据获取任务详细信息")
|
||||
public AjaxResult getTask(@PathVariable("id") Long id) {
|
||||
WePresTagGroupTaskVO taskVo = taskService.getTaskById(id, LoginTokenService.getLoginUser().getCorpId());
|
||||
if (StringUtils.isNull(taskVo)) {
|
||||
return AjaxResult.error(ResultTip.TIP_GENERAL_NOT_FOUND, ERROR_MSG);
|
||||
}
|
||||
return AjaxResult.success(taskVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新任务信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:edit')")
|
||||
@PutMapping(path = "/{id}")
|
||||
@ApiOperation("更新任务信息")
|
||||
public AjaxResult updateTask(@PathVariable("id") Long id, @RequestBody @Validated WePresTagGroupTaskDTO wePresTagGroupTaskDto) {
|
||||
if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
|
||||
return AjaxResult.error(ResultTip.TIP_GENERAL_NOT_FOUND, ERROR_MSG);
|
||||
}
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
return toAjax(taskService.updateTask(corpId, id, wePresTagGroupTaskDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除老客标签建群任务
|
||||
*/
|
||||
@ApiOperation("批量删除标签建群任务")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:remove')")
|
||||
@DeleteMapping(path = "/{ids}")
|
||||
public AjaxResult batchRemoveTask(@PathVariable("ids") Long[] ids) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
return toAjax(taskService.batchRemoveTaskByIds(corpId, ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据老客标签建群id及过滤条件,获取其统计信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')")
|
||||
@GetMapping(path = "/stat/{id}")
|
||||
@ApiOperation("获取统计信息")
|
||||
public TableDataInfo<WePresTagGroupTaskStatVO> getStatInfo(@PathVariable("id") Long id,
|
||||
@RequestParam(value = "customerName", required = false) String customerName,
|
||||
@RequestParam(value = "isInGroup", required = false) Integer isInGroup,
|
||||
@RequestParam(value = "isSent", required = false) Integer isSent,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
WePresTagGroupTaskStatResultVO resultVO = taskService.getStatByTaskId(corpId, id, customerName, isInGroup, isSent, pageNum, pageSize);
|
||||
//total=null时,以sql查询的total为准
|
||||
if (resultVO.getTotal() == null) {
|
||||
return getDataTable(resultVO.getData());
|
||||
}
|
||||
return getDataTable(resultVO.getData(), Long.parseLong(String.valueOf(resultVO.getTotal())));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.exception.CustomException;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.wecom.domain.dto.QueryPresTagGroupDTO;
|
||||
import com.easyink.wecom.domain.dto.QueryPresTagGroupStatDTO;
|
||||
import com.easyink.wecom.domain.dto.WePresTagGroupTaskDTO;
|
||||
import com.easyink.wecom.domain.vo.PresTagExpectedReceptionVO;
|
||||
import com.easyink.wecom.domain.vo.WePresTagGroupTaskStatResultVO;
|
||||
import com.easyink.wecom.domain.vo.WePresTagGroupTaskStatVO;
|
||||
import com.easyink.wecom.domain.vo.WePresTagGroupTaskVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeGroupCodeService;
|
||||
import com.easyink.wecom.service.WePresTagGroupTaskService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: 老客进群接口
|
||||
*
|
||||
* @author: 1*+
|
||||
* @date: 2021-11-01 17:46
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/wecom/communityPresTagGroupV2")
|
||||
@Api(tags = "老客进群")
|
||||
public class WeCommunityPresTagGroupV2Controller extends BaseController {
|
||||
|
||||
private final WePresTagGroupTaskService taskService;
|
||||
private final WeGroupCodeService groupCodeService;
|
||||
|
||||
@Autowired
|
||||
public WeCommunityPresTagGroupV2Controller(WePresTagGroupTaskService taskService, WeGroupCodeService groupCodeService) {
|
||||
this.taskService = taskService;
|
||||
this.groupCodeService = groupCodeService;
|
||||
}
|
||||
|
||||
@ApiOperation("获取标签入群列表数据")
|
||||
@GetMapping(path = "/list")
|
||||
public TableDataInfo<WePresTagGroupTaskVO> getList(QueryPresTagGroupDTO queryPresTagGroupDTO) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
startPage();
|
||||
List<WePresTagGroupTaskVO> wePresTagGroupTaskVoList =
|
||||
taskService.selectTaskList(corpId, queryPresTagGroupDTO.getTaskName(), queryPresTagGroupDTO.getSendType()
|
||||
, queryPresTagGroupDTO.getCreateBy(), queryPresTagGroupDTO.getBeginTime(), queryPresTagGroupDTO.getEndTime());
|
||||
return getDataTable(wePresTagGroupTaskVoList);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("新建标签建群任务")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 2024, message = "所选群活码失效,请重新选择"),
|
||||
@ApiResponse(code = 2025, message = "任务已存在,请重新填写任务名"),
|
||||
})
|
||||
public AjaxResult<Object> addTask(@RequestBody @Validated WePresTagGroupTaskDTO wePresTagGroupTaskDto) {
|
||||
if(org.apache.commons.lang3.StringUtils.isBlank(wePresTagGroupTaskDto.getWelcomeMsg())||wePresTagGroupTaskDto.getGroupCodeId()==null){
|
||||
throw new CustomException(ResultTip.TIP_GENERAL_BAD_REQUEST);
|
||||
}
|
||||
taskService.addTaskV2(wePresTagGroupTaskDto, LoginTokenService.getLoginUser());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')")
|
||||
@GetMapping(path = "/{id}")
|
||||
@ApiOperation("根据获取任务详细信息")
|
||||
public AjaxResult<WePresTagGroupTaskVO> getTask(@PathVariable("id") Long id) {
|
||||
WePresTagGroupTaskVO taskVo = taskService.getTaskById(id, LoginTokenService.getLoginUser().getCorpId());
|
||||
if (StringUtils.isNull(taskVo)) {
|
||||
return AjaxResult.error(ResultTip.TIP_ACTIVE_CODE_NOT_EXSIT);
|
||||
}
|
||||
return AjaxResult.success(taskVo);
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:edit')")
|
||||
@PutMapping(path = "/{id}")
|
||||
@ApiOperation("更新任务信息")
|
||||
public AjaxResult updateTask(@PathVariable("id") Long id, @RequestBody @Validated WePresTagGroupTaskDTO wePresTagGroupTaskDto) {
|
||||
if(org.apache.commons.lang3.StringUtils.isBlank(wePresTagGroupTaskDto.getWelcomeMsg())||wePresTagGroupTaskDto.getGroupCodeId()==null){
|
||||
throw new CustomException(ResultTip.TIP_GENERAL_BAD_REQUEST);
|
||||
}
|
||||
if (null == groupCodeService.getById(wePresTagGroupTaskDto.getGroupCodeId())) {
|
||||
return AjaxResult.error(ResultTip.TIP_ACTIVE_CODE_NOT_EXSIT);
|
||||
}
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
return toAjax(taskService.updateTask(corpId, id, wePresTagGroupTaskDto));
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除标签建群任务")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:remove')")
|
||||
@DeleteMapping(path = "/{ids}")
|
||||
public AjaxResult batchRemoveTask(@PathVariable("ids") Long[] ids) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
return toAjax(taskService.batchRemoveTaskByIds(corpId, ids));
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:communitytagGroup:query')")
|
||||
@GetMapping(path = "/stat/{id}")
|
||||
@ApiOperation("获取进群详情")
|
||||
public TableDataInfo<WePresTagGroupTaskStatVO> getStatInfo(@PathVariable("id") Long id,
|
||||
QueryPresTagGroupStatDTO queryPresTagGroupStatDTO) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
WePresTagGroupTaskStatResultVO resultVO = taskService.getStatByTaskId(corpId, id, queryPresTagGroupStatDTO.getCustomerName()
|
||||
, queryPresTagGroupStatDTO.getIsInGroup(), queryPresTagGroupStatDTO.getIsSent()
|
||||
, queryPresTagGroupStatDTO.getPageNum(), queryPresTagGroupStatDTO.getPageSize());
|
||||
//total=null时,以sql查询的total为准
|
||||
if (resultVO.getTotal() == null) {
|
||||
return getDataTable(resultVO.getData());
|
||||
}
|
||||
return getDataTable(resultVO.getData(), Long.parseLong(String.valueOf(resultVO.getTotal())));
|
||||
}
|
||||
|
||||
@PostMapping(path = "/getExpectedReceptionData")
|
||||
@ApiOperation("获取预计发送数据")
|
||||
public AjaxResult<PresTagExpectedReceptionVO> getExpectedReceptionData(@RequestBody @Validated WePresTagGroupTaskDTO wePresTagGroupTaskDto) {
|
||||
return AjaxResult.success(taskService.getExpectedReceptionData(wePresTagGroupTaskDto, LoginTokenService.getLoginUser()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.ConversationArchiveQuery;
|
||||
import com.easyink.common.core.domain.ConversationArchiveViewContextDTO;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.token.TokenService;
|
||||
import com.easyink.common.utils.ServletUtils;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.wecom.domain.vo.ConversationArchiveVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeConversationArchiveService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @description 会话存档controller
|
||||
* @date 2020/12/19 13:51
|
||||
**/
|
||||
@Api(tags = "会话存档controller")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wecom/finance")
|
||||
public class WeConversationArchiveController extends BaseController {
|
||||
@Autowired
|
||||
private WeConversationArchiveService weConversationArchiveService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 获取单聊会话数据接口
|
||||
*
|
||||
* @param query 入参
|
||||
*/
|
||||
@ApiOperation(value = "获取单聊会话数据接口", httpMethod = "GET")
|
||||
@GetMapping("/getChatContactList")
|
||||
public AjaxResult<PageInfo<ConversationArchiveVO>> getChatContactList(ConversationArchiveQuery query) {
|
||||
if (StringUtils.isEmpty(LoginTokenService.getLoginUser().getCorpId())){
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weConversationArchiveService.getChatContactList(query));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取群聊会话数据接口
|
||||
*
|
||||
* @param query 入参
|
||||
* @param /fromId 发送人id
|
||||
* @param /room 接收人id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取群聊会话数据接口", httpMethod = "GET")
|
||||
@GetMapping("/getChatRoomContactList")
|
||||
public AjaxResult<PageInfo<ConversationArchiveVO>> getChatRoomContactList(ConversationArchiveQuery query) {
|
||||
if (StringUtils.isEmpty(LoginTokenService.getLoginUser().getCorpId())){
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weConversationArchiveService.getChatRoomContactList(query));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取全局会话数据接口
|
||||
*
|
||||
* @param query 入参
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取全局会话数据接口", httpMethod = "GET")
|
||||
@GetMapping("/getChatAllList")
|
||||
public AjaxResult<PageInfo<ConversationArchiveVO>> getChatAllList(ConversationArchiveQuery query) {
|
||||
if (StringUtils.isEmpty(LoginTokenService.getLoginUser().getCorpId())){
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weConversationArchiveService.getChatAllList(query, tokenService.getLoginUser(ServletUtils.getRequest())));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看消息上下文接口", httpMethod = "GET")
|
||||
@GetMapping("/view/context")
|
||||
public TableDataInfo<ConversationArchiveVO> viewContext(ConversationArchiveViewContextDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return weConversationArchiveService.viewContext(dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.config.ChatRsaKeyConfig;
|
||||
import com.easyink.common.config.RuoYiConfig;
|
||||
import com.easyink.common.config.WeCrypt;
|
||||
import com.easyink.common.constant.Constants;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.entity.WeCorpAccount;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.exception.CustomException;
|
||||
import com.easyink.common.exception.user.NoLoginTokenException;
|
||||
import com.easyink.common.exception.user.UserNoCorpException;
|
||||
import com.easyink.wecom.domain.vo.customerloss.CustomerLossSwitchVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeAuthCorpInfoExtendService;
|
||||
import com.easyink.wecom.service.WeCorpAccountService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业id相关配置Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2020-08-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/corp")
|
||||
@Api(tags = "企业id配置接口")
|
||||
public class WeCorpAccountController extends BaseController {
|
||||
private final WeCorpAccountService weCorpAccountService;
|
||||
private final RuoYiConfig ruoYiConfig;
|
||||
private final WeAuthCorpInfoExtendService weAuthCorpInfoExtendService;
|
||||
private final ChatRsaKeyConfig chatRsaKeyConfig;
|
||||
|
||||
@Autowired
|
||||
public WeCorpAccountController(WeCorpAccountService weCorpAccountService, RuoYiConfig ruoYiConfig, WeAuthCorpInfoExtendService weAuthCorpInfoExtendService, ChatRsaKeyConfig chatRsaKeyConfig) {
|
||||
this.weCorpAccountService = weCorpAccountService;
|
||||
this.ruoYiConfig = ruoYiConfig;
|
||||
this.weAuthCorpInfoExtendService = weAuthCorpInfoExtendService;
|
||||
this.chatRsaKeyConfig = chatRsaKeyConfig;
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wechat:corp:list')")
|
||||
@GetMapping("/list")
|
||||
@Deprecated
|
||||
@ApiOperation("查询企业id相关配置列表")
|
||||
public TableDataInfo<WeCorpAccount> list(WeCorpAccount weCorpAccount) {
|
||||
startPage();
|
||||
List<WeCorpAccount> list = weCorpAccountService.list(new LambdaQueryWrapper<WeCorpAccount>()
|
||||
.eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE)
|
||||
.like(WeCorpAccount::getCompanyName, weCorpAccount.getCompanyName()));
|
||||
list.forEach(corpAccount -> corpAccount.setIsCustomizedApp(weAuthCorpInfoExtendService.isCustomizedApp(corpAccount.getCorpId())));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("查询当前企业微信基础配置")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 503, message = "没有可用的企业微信配置,请联系管理员"),
|
||||
@ApiResponse(code = 1017, message = "当前企业已授权但未启用待开发应用,无法使用该功能")
|
||||
})
|
||||
public AjaxResult<WeCorpAccount> get(){
|
||||
WeCorpAccount account = null;
|
||||
try {
|
||||
//是内部应用服务器
|
||||
if (ruoYiConfig.isInternalServer()) {
|
||||
account = weCorpAccountService.findValidWeCorpAccount();
|
||||
} else {
|
||||
account = weCorpAccountService.findValidWeCorpAccount(LoginTokenService.getLoginUser().getCorpId());
|
||||
}
|
||||
} catch (NoLoginTokenException | UserNoCorpException e) {
|
||||
if (ruoYiConfig.isInternalServer()) {
|
||||
account = weCorpAccountService.findValidWeCorpAccount();
|
||||
}
|
||||
}
|
||||
if(account == null) {
|
||||
throw new CustomException(ResultTip.TIP_NOT_AVAILABLE_CONFIG_FOUND);
|
||||
}
|
||||
// 获取公司名称
|
||||
account.setCompanyName(weCorpAccountService.getCorpName(account.getCorpId()));
|
||||
account.setIsCustomizedApp(weAuthCorpInfoExtendService.isCustomizedApp(account.getCorpId()));
|
||||
return AjaxResult.success(account);
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wechat:corp:add')")
|
||||
@Log(title = "新增企业id相关配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增企业id相关配置")
|
||||
public AjaxResult<WeCorpAccount> add(@Validated @RequestBody WeCorpAccount weCorpAccount) {
|
||||
weCorpAccountService.saveCorpConfig(weCorpAccount, LoginTokenService.getLoginUser());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wechat:corp:edit')")
|
||||
@Log(title = "修改企业id相关配置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改企业id相关配置")
|
||||
public AjaxResult<WeCorpAccount> edit(@Validated @RequestBody WeCorpAccount weCorpAccount) {
|
||||
weCorpAccountService.updateWeCorpAccount(weCorpAccount, LoginTokenService.getLoginUser());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wechat:corp:startCustomerChurnNoticeSwitch')")
|
||||
@Log(title = "客户流失通知开关", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/startCustomerChurnNoticeSwitch/{status}")
|
||||
@ApiOperation("客户流失通知开关")
|
||||
@Deprecated
|
||||
public AjaxResult<WeCorpAccount> startCustomerChurnNoticeSwitch(@PathVariable String status) {
|
||||
weCorpAccountService.startCustomerChurnNoticeSwitch(LoginTokenService.getLoginUser().getCorpId(), status);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
// @PreAuthorize("@ss.hasPermi('wechat:corp:getCustomerChurnNoticeSwitch')")
|
||||
@Log(title = "客户流失通知开关查询", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/getCustomerChurnNoticeSwitch")
|
||||
@ApiOperation("客户流失通知开关查询")
|
||||
@Deprecated
|
||||
public AjaxResult<String> getCustomerChurnNoticeSwitch() {
|
||||
return AjaxResult.success("操作成功", weCorpAccountService.getCustomerChurnNoticeSwitch(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@Log(title = "流失设置开关查询", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/getCustomerLossSwitch")
|
||||
@ApiOperation("流失设置开关查询")
|
||||
public AjaxResult<CustomerLossSwitchVO> getCustomerChurnSwitch() {
|
||||
return AjaxResult.success("操作成功", weCorpAccountService.getCustomerLossSwitch(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/getChatPublicKey")
|
||||
@ApiOperation("获取会话存档加解密的公钥")
|
||||
public AjaxResult<String> getChatKey() {
|
||||
return AjaxResult.success("操作成功", chatRsaKeyConfig.getPublicKey());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,283 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.utils.PageInfoUtil;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.wecom.domain.WeCustomer;
|
||||
import com.easyink.wecom.domain.dto.WeCustomerSearchDTO;
|
||||
import com.easyink.wecom.domain.dto.customer.EditCustomerDTO;
|
||||
import com.easyink.wecom.domain.dto.tag.RemoveWeCustomerTagDTO;
|
||||
import com.easyink.wecom.domain.entity.WeCustomerExportDTO;
|
||||
import com.easyink.wecom.domain.vo.WeMakeCustomerTagVO;
|
||||
import com.easyink.wecom.domain.vo.customer.*;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeCustomerService;
|
||||
import com.easyink.wecom.utils.OprIdGenerator;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import static com.easyink.common.constant.Constants.EXPORT_MAX_WAIT_TIME;
|
||||
|
||||
/**
|
||||
* 企业微信客户Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2020-09-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/customer")
|
||||
@Slf4j
|
||||
@Api(tags = "企业微信客户")
|
||||
public class WeCustomerController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
@Lazy
|
||||
private WeCustomerService weCustomerService;
|
||||
|
||||
@Resource(name = "threadPoolTaskExecutor")
|
||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||
|
||||
/**
|
||||
* 查询企业微信客户列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询企业微信客户列表")
|
||||
public TableDataInfo<WeCustomer> list(WeCustomer weCustomer) {
|
||||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 由于之前离职客户和在职客户是分两个表存储, 本期将会把离职客户和在职客户存在同一张表(we_flower_customer_rel)中,用状态做区分
|
||||
* @since V1.7
|
||||
*/
|
||||
@PostMapping("/listV2")
|
||||
@ApiOperation("查询企业微信客户列表第二版")
|
||||
public TableDataInfo<WeCustomerVO> listV2(@RequestBody WeCustomerSearchDTO weCustomerSearchDTO) {
|
||||
Integer pageNum = weCustomerSearchDTO.getPageNum();
|
||||
Integer pageSize = weCustomerSearchDTO.getPageSize();
|
||||
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
||||
//预设分页参数
|
||||
PageInfoUtil.setPage(pageNum, pageSize);
|
||||
}
|
||||
weCustomerSearchDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
WeCustomer weCustomer=weCustomerService.changeWecustomer(weCustomerSearchDTO);
|
||||
List<WeCustomerVO> list = weCustomerService.selectWeCustomerListV3(weCustomer);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/listToUnionid")
|
||||
@ApiOperation("通过unionid查询客户")
|
||||
public TableDataInfo<WeCustomer> listToUnionid(@RequestBody WeCustomer weCustomer){
|
||||
List<WeCustomer> listToUnionid = weCustomerService.getListToUnionid(weCustomer);
|
||||
return getDataTable(listToUnionid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话存档客户检索客户列表
|
||||
*
|
||||
* @description: 因为会话存档模块的客户检索列表需要对客户去重,
|
||||
* 因此使用该接口代替原本{@link com.easyink.web.controller.wecom.WeCustomerController# listV2(com.easyink.wecom.domain.WeCustomer)} 接口
|
||||
*/
|
||||
@GetMapping("/listDistinct")
|
||||
@ApiOperation("会话存档客户检索客户列表")
|
||||
public TableDataInfo<SessionArchiveCustomerVO> listDistinct(WeCustomer weCustomer) {
|
||||
weCustomer.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
PageInfoUtil.setPage();
|
||||
List<SessionArchiveCustomerVO> list = weCustomerService.selectWeCustomerListDistinctV3(weCustomer);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listDistinct/count")
|
||||
@ApiOperation("会话存档客户检索客户列表-去重后的客户总数")
|
||||
public AjaxResult<WeCustomerSumVO> listDistinctCount(WeCustomer weCustomer) {
|
||||
weCustomer.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weCustomerService.customerCount(weCustomer));
|
||||
}
|
||||
|
||||
@PostMapping("/sum")
|
||||
@ApiOperation("查询企业客户统计数据")
|
||||
public AjaxResult<WeCustomerSumVO> sum(@RequestBody WeCustomerSearchDTO weCustomerSearchDTO) {
|
||||
weCustomerSearchDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
WeCustomer weCustomer=weCustomerService.changeWecustomer(weCustomerSearchDTO);
|
||||
weCustomer.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weCustomerService.weCustomerCount(weCustomer));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:lossRemind:view') || @ss.hasPermi('customerManage:customer:view')")
|
||||
@GetMapping("/getCustomersByUserIdV2/{externalUserid}/{userId}")
|
||||
@ApiOperation("根据客户ID和员工ID获取客户详情V2")
|
||||
public AjaxResult<List<WeCustomerVO>> getCustomersByUserIdV2(@PathVariable String externalUserid, @PathVariable String userId) {
|
||||
return AjaxResult.success(weCustomerService.getCustomersByUserIdV2(externalUserid, userId, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出企业微信客户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:customer:export') || @ss.hasPermi('customerManage:lossRemind:export')")
|
||||
@Log(title = "企业微信客户", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
@ApiOperation("导出企业微信客户列表")
|
||||
@Deprecated
|
||||
public <T> AjaxResult<T> export(@RequestBody WeCustomerExportDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
log.info("[导出客户]开始导出,corpId:{}", dto.getCorpId());
|
||||
long startTime = System.currentTimeMillis();
|
||||
AjaxResult<T> export = weCustomerService.export(dto);
|
||||
long endTime = System.currentTimeMillis();
|
||||
log.info("[导出客户]导出完成,corpId:{} , time:{} ", dto.getCorpId(), (endTime - startTime) / 1000.00D);
|
||||
return export;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出企业微信客户列表V2
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:customer:export') || @ss.hasPermi('customerManage:lossRemind:export')")
|
||||
@Log(title = "企业微信客户", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出企业微信客户列表")
|
||||
public AjaxResult<ExportOprVO> exportV2(@RequestBody WeCustomerExportDTO dto) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
dto.setCorpId(loginUser.getCorpId());
|
||||
dto.setAdmin(loginUser.isSuperAdmin());
|
||||
String oprId = OprIdGenerator.EXPORT.get();
|
||||
String fileName = UUID.randomUUID() + "_" + "customer" + ".xlsx";
|
||||
ExportOprVO result = ExportOprVO.builder().oprId(oprId).fileName(fileName).hasFinished(false).build();
|
||||
if(dto.getSelectedProperties() == null || dto.getSelectedProperties().size() == 0) {
|
||||
dto.setSelectedProperties( Lists.newArrayList("客户","添加时间","所属员工","标签"));
|
||||
}
|
||||
WeCustomerExportDTO customer = weCustomerService.transferData(dto);
|
||||
CompletableFuture future = CompletableFuture.runAsync(() -> {
|
||||
// 执行异步处理任务
|
||||
weCustomerService.genExportData(customer, oprId, fileName);
|
||||
}, threadPoolTaskExecutor);
|
||||
try {
|
||||
// 在3秒内等待异步处理任务完成
|
||||
future.get(EXPORT_MAX_WAIT_TIME, TimeUnit.SECONDS);
|
||||
result.setHasFinished(true);
|
||||
return AjaxResult.success(result);
|
||||
} catch (TimeoutException e) {
|
||||
// 处理未完成,只返回OprId
|
||||
return AjaxResult.success(result);
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
// 处理出现异常
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/export/result")
|
||||
@ApiOperation("获取导出客户的结果")
|
||||
public AjaxResult getExportResult(String oprId) {
|
||||
return AjaxResult.success(new CustomerExportResultVO(
|
||||
weCustomerService.getExportResult(oprId)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取企业微信客户详细信息-> 未被使用
|
||||
*/
|
||||
@Deprecated
|
||||
@GetMapping(value = "/{externalUserId}")
|
||||
@ApiOperation("获取企业微信客户详细信息-> 未被使用")
|
||||
public <T> AjaxResult<T> getInfo(@PathVariable("externalUserId") String externalUserId) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
return AjaxResult.success(weCustomerService.selectWeCustomerById(externalUserId, corpId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改企业微信客户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:customer:edit')")
|
||||
@Log(title = "企业微信客户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改企业微信客户")
|
||||
public <T> AjaxResult<T> edit(@Validated @RequestBody EditCustomerDTO dto) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
dto.setCorpId(loginUser.getCorpId());
|
||||
dto.setUpdateBy(loginUser.getUsername());
|
||||
weCustomerService.editCustomer(dto);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户同步接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "企业微信客户同步接口", businessType = BusinessType.DELETE)
|
||||
@GetMapping("/synchWeCustomer")
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:customer:sync')")
|
||||
@ApiOperation("客户同步接口")
|
||||
public <T> AjaxResult<T> synchWeCustomer() {
|
||||
|
||||
weCustomerService.syncWeCustomerV2(LoginTokenService.getLoginUser().getCorpId());
|
||||
|
||||
return AjaxResult.success(WeConstans.SYNCH_TIP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户批量打标签
|
||||
*
|
||||
* @param weMakeCustomerTag
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "客户打标签", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/makeLabelbatch")
|
||||
@ApiOperation("客户批量打标签")
|
||||
public <T> AjaxResult<T> makeLabelbatch(@Validated @RequestBody List<WeMakeCustomerTagVO> weMakeCustomerTag) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
weMakeCustomerTag.forEach(weMakeCustomerTagVO -> weMakeCustomerTagVO.setCorpId(loginUser.getCorpId()));
|
||||
weCustomerService.batchMakeLabel(weMakeCustomerTag, loginUser.getUsername());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除客户标签
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:customer:removeTag')")
|
||||
@Log(title = "移除客户标签", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/removeLabel")
|
||||
@ApiOperation("移除客户标签")
|
||||
public <T> AjaxResult<T> removeLabel(@RequestBody RemoveWeCustomerTagDTO removeWeCustomerTagDTO) {
|
||||
removeWeCustomerTagDTO.getCustomerList().forEach(weUserCustomer -> weUserCustomer.setCorpId(LoginTokenService.getLoginUser().getCorpId()));
|
||||
weCustomerService.removeLabel(removeWeCustomerTagDTO);
|
||||
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("查询客户所属的员工列表")
|
||||
@GetMapping("/listUserByCustomerId/{customerId}")
|
||||
public AjaxResult<WeCustomerUserListVO> getCustomerUserList(@PathVariable(value = "customerId") String customerId) {
|
||||
List<WeCustomerUserListVO> list = weCustomerService.listUserListByCustomerId(customerId, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.utils.bean.BeanUtils;
|
||||
import com.easyink.wecom.domain.dto.BatchSaveCustomerExtendPropertyDTO;
|
||||
import com.easyink.wecom.domain.dto.QueryCustomerExtendPropertyDTO;
|
||||
import com.easyink.wecom.domain.dto.SaveCustomerExtendPropertyDTO;
|
||||
import com.easyink.wecom.domain.entity.customer.WeCustomerExtendProperty;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeCustomerExtendPropertyService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: 员工扩展属性接口
|
||||
*
|
||||
* @author : silver_chariot
|
||||
* @date : 2021/11/10 18:01
|
||||
*/
|
||||
@RequestMapping("/wecom/extendProperty")
|
||||
@RestController
|
||||
@Api(tags = "客户扩展属性接口")
|
||||
public class WeCustomerExtendPropertyController extends BaseController {
|
||||
private final WeCustomerExtendPropertyService weCustomerExtendPropertyService;
|
||||
|
||||
@Autowired
|
||||
public WeCustomerExtendPropertyController(@NotNull WeCustomerExtendPropertyService weCustomerExtendPropertyService) {
|
||||
this.weCustomerExtendPropertyService = weCustomerExtendPropertyService;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(("获取客户扩展属性列表"))
|
||||
public AjaxResult<List<WeCustomerExtendProperty>> list(@Validated QueryCustomerExtendPropertyDTO dto) {
|
||||
WeCustomerExtendProperty property = new WeCustomerExtendProperty();
|
||||
BeanUtils.copyPropertiesASM(dto, property);
|
||||
property.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weCustomerExtendPropertyService.getList(property));
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("保存客户扩展属性")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 4006, message = "该客户扩展标签已存在")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermi('customer:extendProp:add')")
|
||||
public AjaxResult<Integer> add(@Validated @RequestBody SaveCustomerExtendPropertyDTO dto) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
dto.setCreateBy(loginUser);
|
||||
dto.setCorpId(loginUser.getCorpId());
|
||||
int result = weCustomerExtendPropertyService.add(dto);
|
||||
return result > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
@PutMapping("/edit")
|
||||
@ApiOperation("编辑客户扩展属性")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 4006, message = "该客户扩展标签已存在"),
|
||||
@ApiResponse(code = 4007, message = "更新客户自定义属性失败"),
|
||||
@ApiResponse(code = 4008, message = "缺少多选选项值")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermi('customer:extendProp:edit')")
|
||||
public AjaxResult<Integer> edit(@Validated @RequestBody SaveCustomerExtendPropertyDTO dto) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
dto.setCorpId(loginUser.getCorpId());
|
||||
weCustomerExtendPropertyService.edit(dto);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PutMapping("/editBatch")
|
||||
@ApiOperation("批量编辑客户扩展属性")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 4006, message = "该客户扩展标签已存在"),
|
||||
@ApiResponse(code = 4007, message = "更新客户自定义属性失败"),
|
||||
@ApiResponse(code = 4008, message = "缺少多选选项值"),
|
||||
@ApiResponse(code = 4009, message = "标签类型无法编辑")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermi('customer:extendProp:edit')")
|
||||
public AjaxResult<Integer> editBatch(@RequestBody BatchSaveCustomerExtendPropertyDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weCustomerExtendPropertyService.editBatch(dto);
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping("/del/{ids}")
|
||||
@ApiOperation("删除客户扩展属性")
|
||||
@PreAuthorize("@ss.hasPermi('customer:extendProp:remove')")
|
||||
public AjaxResult<Integer> del(@Validated @NotEmpty(message = "id不能为空") @ApiParam("删除id数组") @PathVariable String[] ids) {
|
||||
weCustomerExtendPropertyService.del(LoginTokenService.getLoginUser().getCorpId(), ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.utils.DateUtils;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.wecom.domain.dto.WeCustomerMessageDTO;
|
||||
import com.easyink.wecom.domain.dto.WeCustomerMessagePushResultDTO;
|
||||
import com.easyink.wecom.domain.dto.WeCustomerMessageToUserDTO;
|
||||
import com.easyink.wecom.domain.dto.message.AsyncResultDTO;
|
||||
import com.easyink.wecom.domain.dto.message.CustomerMessagePushDTO;
|
||||
import com.easyink.wecom.domain.vo.CustomerMessagePushVO;
|
||||
import com.easyink.wecom.domain.vo.WeCustomerMessageResultVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeCustomerMessageOriginalService;
|
||||
import com.easyink.wecom.service.WeCustomerMessagePushService;
|
||||
import com.easyink.wecom.service.WeCustomerMessgaeResultService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: 企业微信 群发消息
|
||||
*
|
||||
* @author 佚名
|
||||
* @date 2021/9/13 18:21
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wecom/customerMessagePush")
|
||||
@Api(value = "WeCustomerMessagePushController", tags = "企业微信群发消息接口")
|
||||
public class WeCustomerMessagePushController extends BaseController {
|
||||
private final WeCustomerMessagePushService weCustomerMessagePushService;
|
||||
private final WeCustomerMessageOriginalService weCustomerMessageOriginalService;
|
||||
private final WeCustomerMessgaeResultService weCustomerMessgaeResultService;
|
||||
|
||||
@Autowired
|
||||
public WeCustomerMessagePushController(WeCustomerMessagePushService weCustomerMessagePushService, WeCustomerMessageOriginalService weCustomerMessageOriginalService, WeCustomerMessgaeResultService weCustomerMessgaeResultService) {
|
||||
this.weCustomerMessagePushService = weCustomerMessagePushService;
|
||||
this.weCustomerMessageOriginalService = weCustomerMessageOriginalService;
|
||||
this.weCustomerMessgaeResultService = weCustomerMessgaeResultService;
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:add')")
|
||||
@Log(title = "新增群发消息发送", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "add")
|
||||
@ApiOperation("新增群发消息发送")
|
||||
public <T> AjaxResult<T> add(@Validated @RequestBody CustomerMessagePushDTO customerMessagePushDTO) {
|
||||
try {
|
||||
customerMessagePushDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weCustomerMessagePushService.addWeCustomerMessagePush(customerMessagePushDTO, LoginTokenService.getLoginUser());
|
||||
} catch (JsonProcessingException | ParseException | CloneNotSupportedException e) {
|
||||
log.error("新增群发消息发送异常 ex:{}", ExceptionUtils.getStackTrace(e));
|
||||
return AjaxResult.error("群发失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:list')")
|
||||
@GetMapping(value = "/list")
|
||||
@ApiOperation("获取群发消息列表")
|
||||
public TableDataInfo<CustomerMessagePushVO> list(@RequestParam(value = "sender", required = false) String sender
|
||||
, @RequestParam(value = "content", required = false) String content
|
||||
, @RequestParam(value = "pushType", required = false) String pushType
|
||||
, @RequestParam(value = "beginTime", required = false) String beginTime
|
||||
, @RequestParam(value = "endTime", required = false) String endTime) {
|
||||
startPage();
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
WeCustomerMessageDTO weCustomerMessageDTO = new WeCustomerMessageDTO(loginUser.isSuperAdmin(), sender, content, pushType, DateUtils.parseBeginDay(beginTime), DateUtils.parseEndDay(endTime));
|
||||
weCustomerMessageDTO.setCorpId(loginUser.getCorpId());
|
||||
List<CustomerMessagePushVO> list = weCustomerMessagePushService.customerMessagePushs(weCustomerMessageDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:view')")
|
||||
@GetMapping(value = "/getInfo")
|
||||
@ApiOperation("群发消息详情")
|
||||
public <T> AjaxResult<T> getInfo(@RequestParam(value = "messageId") Long messageId) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
CustomerMessagePushVO customerMessagePushVo = weCustomerMessageOriginalService.customerMessagePushDetail(messageId, corpId);
|
||||
return AjaxResult.success(customerMessagePushVo);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getMessageTask")
|
||||
@ApiOperation("群发任务数据回显(编辑时使用)")
|
||||
public AjaxResult<CustomerMessagePushDTO> getMessageTask(@RequestParam(value = "messageId") Long messageId){
|
||||
return AjaxResult.success(weCustomerMessagePushService.getCopyInfo(messageId));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getCopyInfo")
|
||||
@ApiOperation("群发任务复制")
|
||||
public AjaxResult<CustomerMessagePushDTO> getCopyInfo(@RequestParam(value = "messageId") Long messageId) {
|
||||
return AjaxResult.success(weCustomerMessagePushService.getCopyInfo(messageId));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/getSendSize")
|
||||
@ApiOperation("获取消息发送人数")
|
||||
public AjaxResult getSendSize(@Validated @RequestBody CustomerMessagePushDTO customerMessagePushDTO) {
|
||||
return AjaxResult.success(weCustomerMessagePushService.getSendSize(customerMessagePushDTO, LoginTokenService.getLoginUser()));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "修改定时群发消息", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "/update")
|
||||
@ApiOperation("修改定时群发消息")
|
||||
public AjaxResult update(@Validated @RequestBody CustomerMessagePushDTO customerMessagePushDTO){
|
||||
try {
|
||||
weCustomerMessagePushService.updateTimeTask(customerMessagePushDTO, LoginTokenService.getLoginUser());
|
||||
} catch (ParseException e) {
|
||||
log.error("修改定时群发异常:ex:{}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "删除定时群发消息", businessType = BusinessType.INSERT)
|
||||
@DeleteMapping(value = "/delete")
|
||||
@ApiOperation("删除定时群发消息")
|
||||
public AjaxResult delete(@RequestParam(value = "messageId") Long messageId) {
|
||||
weCustomerMessagePushService.delete(messageId, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/pushResults")
|
||||
@ApiOperation("群发消息结果列表")
|
||||
public TableDataInfo<WeCustomerMessageResultVO> customerMessagePushResult(@Validated @RequestBody WeCustomerMessagePushResultDTO weCustomerMessagePushResultDTO) {
|
||||
weCustomerMessagePushResultDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
if (StringUtils.isNotNull(weCustomerMessagePushResultDTO.getPageNum()) && StringUtils.isNotNull(weCustomerMessagePushResultDTO.getPageSize())) {
|
||||
PageHelper.startPage(weCustomerMessagePushResultDTO.getPageNum(), weCustomerMessagePushResultDTO.getPageSize());
|
||||
}
|
||||
List<WeCustomerMessageResultVO> weCustomerMessageResuls = weCustomerMessgaeResultService.customerMessagePushs(weCustomerMessagePushResultDTO);
|
||||
return getDataTable(weCustomerMessageResuls);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:asyncResult')")
|
||||
@PostMapping(value = "/asyncResult")
|
||||
@ApiOperation("同步消息发送结果")
|
||||
@ApiResponses(
|
||||
{@ApiResponse(code = 2041, message = "正在派送群发任务,请稍后再试")}
|
||||
)
|
||||
public <T> AjaxResult<T> asyncResult(@RequestBody AsyncResultDTO asyncResultDTO) throws JsonProcessingException {
|
||||
weCustomerMessageOriginalService.asyncResult(asyncResultDTO, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/sendToUser")
|
||||
@ApiOperation("发送消息提醒员工接口")
|
||||
public AjaxResult sendToUser(@Validated @RequestBody WeCustomerMessageToUserDTO weCustomerMessageToUserDTO) {
|
||||
weCustomerMessageToUserDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weCustomerMessagePushService.sendToUser(weCustomerMessageToUserDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.CustomerTrajectoryEnums;
|
||||
import com.easyink.common.enums.MethodParamType;
|
||||
import com.easyink.wecom.annotation.Convert2Cipher;
|
||||
import com.easyink.wecom.domain.WeCustomerPortrait;
|
||||
import com.easyink.wecom.domain.WeCustomerTrajectory;
|
||||
import com.easyink.wecom.domain.WeTagGroup;
|
||||
import com.easyink.wecom.domain.vo.WeMakeCustomerTagVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.*;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @description: 客户画像相关controller
|
||||
* @create: 2021-03-03 15:10
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/portrait")
|
||||
@Api(tags = "客户画像相关controller")
|
||||
public class WeCustomerPortraitController extends BaseController {
|
||||
|
||||
|
||||
private final WeCustomerService weCustomerService;
|
||||
private final WeTagGroupService weTagGroupService;
|
||||
private final WeUserService weUserService;
|
||||
private final WeGroupService weGroupService;
|
||||
private final WeCustomerTrajectoryService weCustomerTrajectoryService;
|
||||
private final WeOperationsCenterSopDetailService sopDetailService;
|
||||
|
||||
@Autowired
|
||||
public WeCustomerPortraitController(WeCustomerService weCustomerService, WeTagGroupService weTagGroupService, WeUserService weUserService, WeGroupService weGroupService, WeCustomerTrajectoryService weCustomerTrajectoryService, WeOperationsCenterSopDetailService sopDetailService) {
|
||||
this.weCustomerService = weCustomerService;
|
||||
this.weTagGroupService = weTagGroupService;
|
||||
this.weUserService = weUserService;
|
||||
this.weGroupService = weGroupService;
|
||||
this.weCustomerTrajectoryService = weCustomerTrajectoryService;
|
||||
this.sopDetailService = sopDetailService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户id和当前企业员工id获取客户详细信息
|
||||
*
|
||||
* @param externalUserid
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取客户详细信息")
|
||||
@GetMapping(value = "/findWeCustomerInfo")
|
||||
public AjaxResult findWeCustomerInfo(@NotBlank(message = "外部联系人ID不能为空") String externalUserid, @NotBlank(message = "员工ID不能为空") String userId) {
|
||||
return AjaxResult.success(weCustomerService.findCustomerByOperUseridAndCustomerId(externalUserid, userId, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前系统所有可用标签
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取当前系统所有可用标签")
|
||||
@GetMapping(value = "/findAllTags")
|
||||
public AjaxResult findAllTags() {
|
||||
return AjaxResult.success(weTagGroupService.selectWeTagGroupList(WeTagGroup.builder()
|
||||
.corpId(LoginTokenService.getLoginUser().getCorpId())
|
||||
.build()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看客户添加的员工
|
||||
*
|
||||
* @param externalUserid
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查看客户添加的员工")
|
||||
@GetMapping(value = "/findAddaddEmployes/{externalUserid}")
|
||||
public AjaxResult findaddEmployes(@PathVariable String externalUserid) {
|
||||
return AjaxResult.success(
|
||||
weUserService.findWeUserByCutomerId(LoginTokenService.getLoginUser().getCorpId(),externalUserid)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户添加的群
|
||||
*
|
||||
* @param externalUserid
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取用户添加的群")
|
||||
@GetMapping(value = "/findAddGroupNum")
|
||||
public AjaxResult findAddGroupNum(@NotBlank(message = "外部联系人ID不能为空") String externalUserid, @NotBlank(message = "员工ID不能为空") String userId) {
|
||||
return AjaxResult.success(weGroupService.findWeGroupByCustomer(userId, externalUserid, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取轨迹信息
|
||||
*
|
||||
* @param trajectoryType
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取轨迹信息")
|
||||
@GetMapping(value = "/findTrajectory")
|
||||
@Convert2Cipher
|
||||
public TableDataInfo<WeCustomerTrajectory> findTrajectory(String userId, String externalUserid, Integer trajectoryType) {
|
||||
startPage();
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
|
||||
return getDataTable(
|
||||
weCustomerTrajectoryService.listOfTrajectory(loginUser.getCorpId(), externalUserid, trajectoryType, userId)
|
||||
);
|
||||
}
|
||||
|
||||
@ApiOperation("修改任务完成状态")
|
||||
@PutMapping(value = "/finishTask")
|
||||
public AjaxResult finishTask(@RequestParam("detailId") Long detailId){
|
||||
sopDetailService.finishTask(LoginTokenService.getLoginUser().getCorpId(),detailId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("获取待办事项数量")
|
||||
@GetMapping(value = "/todoCount")
|
||||
@Convert2Cipher
|
||||
public AjaxResult<Integer> getUnFinishedCount(@ApiParam("跟进人userId") @NotBlank(message = "参数缺失") String userId,
|
||||
@ApiParam("外部联系人userId") @NotBlank(message = "参数缺失") String externalUserid) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
return AjaxResult.success(weCustomerTrajectoryService.count(new LambdaQueryWrapper<WeCustomerTrajectory>()
|
||||
.eq(WeCustomerTrajectory::getCorpId, loginUser.getCorpId())
|
||||
.ne(WeCustomerTrajectory::getStatus, CustomerTrajectoryEnums.TodoTaskStatusEnum.DEL.getCode())
|
||||
.eq(WeCustomerTrajectory::getExternalUserid, externalUserid)
|
||||
.eq(WeCustomerTrajectory::getTrajectoryType, CustomerTrajectoryEnums.Type.TO_DO.getDesc())
|
||||
.eq(WeCustomerTrajectory::getUserId, userId)
|
||||
.in(WeCustomerTrajectory::getStatus, new String[]{CustomerTrajectoryEnums.TodoTaskStatusEnum.NORMAL.getCode(), CustomerTrajectoryEnums.TodoTaskStatusEnum.INFORMED.getCode()})
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加或编辑轨迹
|
||||
*
|
||||
* @param trajectory
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("添加或编辑轨迹")
|
||||
@PostMapping(value = "/addOrEditWaitHandle")
|
||||
@Convert2Cipher(paramType = MethodParamType.STRUCT)
|
||||
public AjaxResult addOrEditWaitHandle(@RequestBody WeCustomerTrajectory trajectory) {
|
||||
trajectory.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weCustomerTrajectoryService.saveOrUpdate(trajectory);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除轨迹
|
||||
*
|
||||
* @param trajectoryId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("删除轨迹")
|
||||
@DeleteMapping(value = "/removeTrajectory/{trajectoryId}")
|
||||
public AjaxResult removeTrajectory(@PathVariable String trajectoryId) {
|
||||
weCustomerTrajectoryService.updateById(WeCustomerTrajectory.builder()
|
||||
.id(trajectoryId)
|
||||
.status(CustomerTrajectoryEnums.TodoTaskStatusEnum.DEL.getCode())
|
||||
.build());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 完成待办
|
||||
*
|
||||
* @param trajectoryId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("完成待办")
|
||||
@DeleteMapping(value = "/handleWait/{trajectoryId}")
|
||||
public AjaxResult handleWait(@PathVariable String trajectoryId) {
|
||||
weCustomerTrajectoryService.updateById(WeCustomerTrajectory.builder()
|
||||
.id(trajectoryId)
|
||||
.status(CustomerTrajectoryEnums.TodoTaskStatusEnum.FINISHED.getCode())
|
||||
.build());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.utils.PageInfoUtil;
|
||||
import com.easyink.wecom.domain.WeCustomer;
|
||||
import com.easyink.wecom.domain.dto.transfer.TransferCustomerDTO;
|
||||
import com.easyink.wecom.domain.dto.transfer.TransferRecordPageDTO;
|
||||
import com.easyink.wecom.domain.entity.transfer.WeCustomerTransferConfig;
|
||||
import com.easyink.wecom.domain.vo.customer.WeCustomerVO;
|
||||
import com.easyink.wecom.domain.vo.transfer.WeCustomerTransferRecordVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeCustomerTransferConfigService;
|
||||
import com.easyink.wecom.service.WeCustomerTransferRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: 在职继承分配记录表控制层接口
|
||||
*
|
||||
* @author : silver_chariot
|
||||
* @date : 2021/11/29 17:56
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/transfer")
|
||||
@Api(tags = "在职继承接口")
|
||||
public class WeCustomerTransferRecordController extends BaseController {
|
||||
|
||||
private final WeCustomerTransferRecordService weCustomerTransferRecordService;
|
||||
private final WeCustomerTransferConfigService weCustomerTransferConfigService;
|
||||
|
||||
@Autowired
|
||||
public WeCustomerTransferRecordController(@NotNull WeCustomerTransferRecordService weCustomerTransferRecordService, @NotNull WeCustomerTransferConfigService weCustomerTransferConfigService) {
|
||||
this.weCustomerTransferRecordService = weCustomerTransferRecordService;
|
||||
this.weCustomerTransferConfigService = weCustomerTransferConfigService;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("在职继承")
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:active:transfer')")
|
||||
public AjaxResult transfer(@Validated @RequestBody TransferCustomerDTO dto) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
weCustomerTransferRecordService.transfer(corpId, dto.getCustomerList(), dto.getTakeoverUserid(), dto.getTransferSuccessMsg());
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/recordList")
|
||||
@ApiOperation("在职继承记录列表")
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:transfer:record')")
|
||||
public TableDataInfo<WeCustomerTransferRecordVO> recordList(@Validated TransferRecordPageDTO dto) {
|
||||
startPage();
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weCustomerTransferRecordService.getList(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/customerList")
|
||||
@ApiOperation("在职继承客户列表")
|
||||
public TableDataInfo<WeCustomerVO> transferCustomerList(WeCustomer weCustomer) {
|
||||
PageInfoUtil.setPage();
|
||||
weCustomer.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeCustomerVO> list = weCustomerTransferRecordService.transferCustomerList(weCustomer);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/config")
|
||||
@ApiOperation("获取继承设置")
|
||||
public AjaxResult<WeCustomerTransferConfig> getConfig() {
|
||||
return AjaxResult.success(weCustomerTransferConfigService.getById(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PutMapping("/editConfig")
|
||||
@ApiOperation("修改继承设置")
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:transfer:config')")
|
||||
public AjaxResult editConfig(@RequestBody WeCustomerTransferConfig weCustomerTransferConfig) {
|
||||
weCustomerTransferConfig.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weCustomerTransferConfigService.editConfig(weCustomerTransferConfig);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.domain.wecom.WeDepartment;
|
||||
import com.easyink.common.core.domain.wecom.WeUser;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.service.ISysDeptService;
|
||||
import com.easyink.wecom.domain.vo.OrganizationVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeDepartmentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业微信组织架构相关Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2020-09-01
|
||||
*/
|
||||
@Api(value = "WeDepartmentController",tags = "微信部门相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/wecom/department")
|
||||
public class WeDepartmentController extends BaseController {
|
||||
@Autowired
|
||||
private WeDepartmentService weDepartmentService;
|
||||
@Autowired
|
||||
private ISysDeptService sysDeptService;
|
||||
/**
|
||||
* 查询企业微信组织架构相关列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('contacts:organization:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获取部门列表")
|
||||
public AjaxResult list(Integer isActivate) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
List<WeDepartment> list = weDepartmentService.selectWeDepartmentList(loginUser.getCorpId(), isActivate, loginUser);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询企业微信组织架构相关列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('contacts:organization:list')")
|
||||
@GetMapping("/organization")
|
||||
@ApiOperation("获取组织架构-部门员工列表")
|
||||
public AjaxResult<OrganizationVO> organization(WeUser weUser) {
|
||||
return AjaxResult.success(weDepartmentService.getOrganization(weUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增企业微信组织架构相关
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('contacts:organization:addMember')")
|
||||
@Log(title = "企业微信组织架构相关", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加部门")
|
||||
public AjaxResult add(@Validated @RequestBody WeDepartment weDepartment) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
weDepartment.setCorpId(loginUser.getCorpId());
|
||||
if (weDepartmentService.insertWeDepartment(weDepartment)) {
|
||||
// 刷新loginUser中的部门数据权限信息
|
||||
LoginTokenService.refreshDataScope();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改企业微信组织架构相关
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('contacts:organization:editDep')")
|
||||
@Log(title = "企业微信组织架构相关", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("更新部门")
|
||||
public AjaxResult edit(@Validated @RequestBody WeDepartment weDepartment) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
weDepartment.setCorpId(loginUser.getCorpId());
|
||||
weDepartmentService.updateWeDepartment(weDepartment);
|
||||
// 修改员工部门后刷新 登录用户的数据权限
|
||||
LoginTokenService.refreshDataScope();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除企业微信组织架构相关
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:department:remove')")
|
||||
@Log(title = "企业微信组织架构相关", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除企业微信组织架构相关")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
weDepartmentService.deleteWeDepartmentByIds(loginUser.getCorpId(), ids);
|
||||
LoginTokenService.refreshDataScope();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,225 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.EmployCodeSourceEnum;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.exception.CustomException;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.common.utils.file.FileUtils;
|
||||
import com.easyink.wecom.domain.WeEmpleCode;
|
||||
import com.easyink.wecom.domain.WeEmpleCodeUseScop;
|
||||
import com.easyink.wecom.domain.dto.emplecode.AddWeEmpleCodeDTO;
|
||||
import com.easyink.wecom.domain.dto.emplecode.FindWeEmpleCodeAnalyseDTO;
|
||||
import com.easyink.wecom.domain.dto.emplecode.FindWeEmpleCodeDTO;
|
||||
import com.easyink.wecom.domain.vo.WeEmpleCodeVO;
|
||||
import com.easyink.wecom.domain.vo.WeEmplyCodeScopeUserVO;
|
||||
import com.easyink.wecom.domain.vo.statistics.emplecode.EmpleCodeByNameVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeEmpleCodeAnalyseService;
|
||||
import com.easyink.wecom.service.WeEmpleCodeService;
|
||||
import com.easyink.wecom.service.WeEmpleCodeUseScopService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 类名: WeEmpleCodeController
|
||||
*
|
||||
* @author 佚名
|
||||
* @date 2021/9/30 15:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/code")
|
||||
@Slf4j
|
||||
@Api(tags = "员工活码Controller")
|
||||
public class WeEmpleCodeController extends BaseController {
|
||||
|
||||
private final WeEmpleCodeService weEmpleCodeService;
|
||||
private final WeEmpleCodeUseScopService weEmpleCodeUseScopService;
|
||||
private final WeEmpleCodeAnalyseService weEmpleCodeAnalyseService;
|
||||
|
||||
@Autowired
|
||||
public WeEmpleCodeController(WeEmpleCodeService weEmpleCodeService, WeEmpleCodeUseScopService weEmpleCodeUseScopService, WeEmpleCodeAnalyseService weEmpleCodeAnalyseService) {
|
||||
this.weEmpleCodeService = weEmpleCodeService;
|
||||
this.weEmpleCodeUseScopService = weEmpleCodeUseScopService;
|
||||
this.weEmpleCodeAnalyseService = weEmpleCodeAnalyseService;
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:code:add')")
|
||||
@Log(title = "员工活码", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增员工活码")
|
||||
public <T> AjaxResult<T> add(@RequestBody @Validated AddWeEmpleCodeDTO addWeEmpleCodeDTO) {
|
||||
addWeEmpleCodeDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
addWeEmpleCodeDTO.setSource(EmployCodeSourceEnum.CODE_CREATE.getSource());
|
||||
weEmpleCodeService.insertWeEmpleCode(addWeEmpleCodeDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询员工活码列表")
|
||||
public TableDataInfo<WeEmpleCodeVO> list(FindWeEmpleCodeDTO weEmpleCode) {
|
||||
weEmpleCode.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
startPage();
|
||||
weEmpleCode.setSource(EmployCodeSourceEnum.CODE_CREATE.getSource());
|
||||
List<WeEmpleCodeVO> list = weEmpleCodeService.selectWeEmpleCodeList(weEmpleCode);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listByName")
|
||||
@ApiOperation("活码统计-根据名称模糊搜索活码信息")
|
||||
public TableDataInfo<EmpleCodeByNameVO> listByName(FindWeEmpleCodeDTO weEmpleCode) {
|
||||
weEmpleCode.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
startPage();
|
||||
List<EmpleCodeByNameVO> list = weEmpleCodeService.listByName(weEmpleCode);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:code:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取员工活码详细信息")
|
||||
public <T> AjaxResult<T> getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(weEmpleCodeService.selectWeEmpleCodeById(id, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
@GetMapping(value = "/Permissions/{id}")
|
||||
@ApiOperation("获取员工活码详细信息")
|
||||
public <T> AjaxResult<T> getInfoPermissions(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(weEmpleCodeService.getById(id));
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('wecom:code:edit')")
|
||||
@Log(title = "员工活码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改员工活码")
|
||||
public <T> AjaxResult<T> edit(@Validated @RequestBody AddWeEmpleCodeDTO weEmpleCode) {
|
||||
weEmpleCode.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weEmpleCodeService.updateWeEmpleCode(weEmpleCode);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:code:remove')")
|
||||
@Log(title = "员工活码", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/delete/{ids}")
|
||||
@ApiOperation("删除员工活码")
|
||||
public <T> AjaxResult<T> remove(@PathVariable String ids) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
List<Long> idList = Arrays.stream(StringUtils.split(ids, ",")).map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
|
||||
return toAjax(weEmpleCodeService.batchRemoveWeEmpleCodeIds(corpId, idList));
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:code:qrcode')")
|
||||
@Log(title = "获取员工二维码", businessType = BusinessType.DELETE)
|
||||
@GetMapping("/getQrcode")
|
||||
@ApiOperation("获取员工二维码")
|
||||
public <T> AjaxResult<T> getQrcode(String userIds, String departmentIds) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
return AjaxResult.success(weEmpleCodeService.getQrcode(userIds, departmentIds, corpId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工活码批量下载
|
||||
*
|
||||
* @param ids 员工活码ids
|
||||
* @param response 输出
|
||||
*/
|
||||
@Log(title = "员工活码批量下载", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/downloadBatch")
|
||||
@ApiOperation("员工活码批量下载")
|
||||
public void downloadBatch(String ids, HttpServletResponse response) {
|
||||
List<Map<String, String>> fileList = Arrays
|
||||
.stream(Optional.ofNullable(ids).orElse(StringUtils.EMPTY).split(WeConstans.COMMA))
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.map(id -> {
|
||||
WeEmpleCode code = weEmpleCodeService.getById(id);
|
||||
List<WeEmpleCodeUseScop> weEmpleCodeUseScops = weEmpleCodeUseScopService.selectWeEmpleCodeUseScopListById(Long.parseLong(id), LoginTokenService.getLoginUser().getCorpId());
|
||||
Map<String, String> fileMap = new HashMap<>();
|
||||
//code=null说明活码已被删除,不下载
|
||||
if (code != null) {
|
||||
//查出使用者
|
||||
StringBuilder useUserName = new StringBuilder();
|
||||
if (CollectionUtils.isNotEmpty(weEmpleCodeUseScops)) {
|
||||
weEmpleCodeUseScops.forEach(weEmpleCodeUseScop -> useUserName.append(weEmpleCodeUseScop.getBusinessName()).append(WeConstans.COMMA));
|
||||
useUserName.deleteCharAt(useUserName.lastIndexOf(WeConstans.COMMA));
|
||||
}
|
||||
fileMap.put("fileName", useUserName + "-" + code.getScenario() + ".jpg");
|
||||
fileMap.put("url", code.getQrCode());
|
||||
}
|
||||
return fileMap;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
try {
|
||||
FileUtils.batchDownloadFile(fileList, response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
log.error("员工活码批量下载异常 ex:{}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "员工活码下载", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/download")
|
||||
@ApiOperation("员工活码下载")
|
||||
public void download(String id, HttpServletResponse response) {
|
||||
WeEmpleCode weEmpleCode = weEmpleCodeService.selectWeEmpleCodeById(Long.valueOf(id), LoginTokenService.getLoginUser().getCorpId());
|
||||
if (StringUtils.isEmpty(weEmpleCode.getQrCode())) {
|
||||
throw new CustomException("活码不存在");
|
||||
}
|
||||
try {
|
||||
FileUtils.downloadFile(weEmpleCode.getQrCode(), response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
log.error("员工活码下载异常 ex:{}", ExceptionUtils.getStackTrace(e));
|
||||
throw new CustomException(ResultTip.TIP_DOWNLOAD_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "时间段内新增和流失客户数据统计", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/getTimeRangeAnalyseCount")
|
||||
@ApiOperation("时间段内新增和流失客户数据统计")
|
||||
public <T> AjaxResult<T> getTimeRangeAnalyseCount(@Validated FindWeEmpleCodeAnalyseDTO findWeEmpleCodeAnalyseDTO) {
|
||||
findWeEmpleCodeAnalyseDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weEmpleCodeAnalyseService.getTimeRangeAnalyseCount(findWeEmpleCodeAnalyseDTO));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "导出时间段内新增和流失客户数据", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('wecom:codeAnalyse:export')")
|
||||
@GetMapping("/exportTimeRangeAnalyseCount")
|
||||
@ApiOperation("导出时间段内新增和流失客户数据")
|
||||
public <T> AjaxResult<T> exportTimeRangeAnalyseCount(@Validated FindWeEmpleCodeAnalyseDTO findWeEmpleCodeAnalyseDTO) {
|
||||
findWeEmpleCodeAnalyseDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weEmpleCodeAnalyseService.exportTimeRangeAnalyseCount(findWeEmpleCodeAnalyseDTO));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "获取员工活码的使用员工数据", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/getUserByEmplyCode/{id}")
|
||||
@ApiOperation("获取员工活码的使用员工数据")
|
||||
public AjaxResult<List<WeEmplyCodeScopeUserVO>> getUserByEmplyCode(@PathVariable Long id) {
|
||||
return AjaxResult.success(weEmpleCodeService.getUserByEmplyCode(LoginTokenService.getLoginUser().getCorpId(), id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/appLink")
|
||||
@ApiOperation("获取活码小程序短链")
|
||||
public AjaxResult getCodeAppLink(@ApiParam("活码id")Long id ) {
|
||||
return AjaxResult.success("success",weEmpleCodeService.getCodeAppLink(id));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.utils.DateUtils;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.wecom.domain.WeGroupCodeActual;
|
||||
import com.easyink.wecom.service.WeGroupCodeActualService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 实际群码接口
|
||||
* 类名: WeGroupCodeActualController
|
||||
*
|
||||
* @author 佚名
|
||||
* @date 2021/9/30 16:05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/actual")
|
||||
@Api(tags = "实际群码Controller")
|
||||
public class WeGroupCodeActualController extends BaseController {
|
||||
@Autowired
|
||||
private WeGroupCodeActualService weGroupCodeActualService;
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:actual:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询实际群码列表")
|
||||
public TableDataInfo list(WeGroupCodeActual weGroupCodeActual) {
|
||||
startPage();
|
||||
List<WeGroupCodeActual> list = weGroupCodeActualService.selectWeGroupCodeActualList(weGroupCodeActual);
|
||||
list.forEach(groupCode -> {
|
||||
//如果为2099年 显示空值给前端
|
||||
if (DateUtils.isSameDay(groupCode.getEffectTime(), DateUtils.dateTime(com.easyink.common.utils.DateUtils.YYYY_MM_DD_HH_MM, WeConstans.DEFAULT_MATERIAL_NOT_EXPIRE))) {
|
||||
groupCode.setEffectTime(null);
|
||||
}
|
||||
});
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:actual:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取实际群码详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
WeGroupCodeActual weGroupCodeActual = weGroupCodeActualService.selectWeGroupCodeActualById(id);
|
||||
if (StringUtils.isNull(weGroupCodeActual)) {
|
||||
return AjaxResult.error(ResultTip.TIP_GENERAL_NOT_FOUND, "数据不存在");
|
||||
}
|
||||
return AjaxResult.success(weGroupCodeActual);
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:actual:add')")
|
||||
@Log(title = "实际群码", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增实际群码查询")
|
||||
@Deprecated
|
||||
public AjaxResult add(@Validated @RequestBody WeGroupCodeActual weGroupCodeActual) {
|
||||
return toAjax(weGroupCodeActualService.insertWeGroupCodeActual(weGroupCodeActual));
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:actual:edit')")
|
||||
@Log(title = "实际群码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改实际群码")
|
||||
public AjaxResult edit(@RequestBody WeGroupCodeActual weGroupCodeActual) {
|
||||
WeGroupCodeActual original = weGroupCodeActualService.selectWeGroupCodeActualById(weGroupCodeActual.getId());
|
||||
if (StringUtils.isNull(original)) {
|
||||
return AjaxResult.error(ResultTip.TIP_GENERAL_NOT_FOUND, "数据不存在");
|
||||
}
|
||||
return toAjax(weGroupCodeActualService.updateWeGroupCodeActual(weGroupCodeActual));
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:actual:remove')")
|
||||
@Log(title = "实际群码", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除实际群码")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(weGroupCodeActualService.deleteWeGroupCodeActualByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.utils.DateUtils;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.common.utils.file.FileUtils;
|
||||
import com.easyink.wecom.domain.WeGroupCode;
|
||||
import com.easyink.wecom.domain.WeGroupCodeActual;
|
||||
import com.easyink.wecom.domain.dto.FindWeGroupCodeDTO;
|
||||
import com.easyink.wecom.domain.query.groupcode.GroupCodeDetailQuery;
|
||||
import com.easyink.wecom.domain.vo.groupcode.GroupCodeActivityFirstVO;
|
||||
import com.easyink.wecom.domain.vo.groupcode.GroupCodeDetailVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeCorpAccountService;
|
||||
import com.easyink.wecom.service.WeGroupCodeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 客户群活码Controller
|
||||
* 类名: WeGroupCodeController
|
||||
*
|
||||
* @author 佚名
|
||||
* @date 2021/9/30 16:07
|
||||
*/
|
||||
@Api(tags = "客户群活码Controller")
|
||||
@RestController
|
||||
@RequestMapping("/wecom/groupCode")
|
||||
@Slf4j
|
||||
@Validated
|
||||
public class WeGroupCodeController extends BaseController {
|
||||
|
||||
private final WeGroupCodeService groupCodeService;
|
||||
private final WeCorpAccountService weCorpAccountService;
|
||||
|
||||
@Autowired
|
||||
public WeGroupCodeController(WeGroupCodeService groupCodeService, WeCorpAccountService weCorpAccountService) {
|
||||
this.groupCodeService = groupCodeService;
|
||||
this.weCorpAccountService = weCorpAccountService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户群活码列表
|
||||
*/
|
||||
@ApiOperation(value = "查询客户群活码列表", httpMethod = "GET")
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:groupCode:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WeGroupCode> list(FindWeGroupCodeDTO weGroupCode) {
|
||||
startPage();
|
||||
//设置企业id
|
||||
weGroupCode.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeGroupCode> list = groupCodeService.selectWeGroupCodeList(weGroupCode);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量下载群活码", httpMethod = "GET")
|
||||
@Log(title = "群活码批量下载", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/downloadBatch")
|
||||
public void downloadBatch(String ids, HttpServletRequest request, HttpServletResponse response) {
|
||||
// 构建文件信息列表
|
||||
List<Map<String, String>> fileList = Arrays
|
||||
.stream(Optional.ofNullable(ids).orElse("").split(","))
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.map(id -> {
|
||||
WeGroupCode code = groupCodeService.getById(id);
|
||||
Map<String, String> fileMap = new HashMap<>();
|
||||
fileMap.put("fileName", code.getActivityName() + ".png");
|
||||
fileMap.put("url", code.getCodeUrl());
|
||||
return fileMap;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
try {
|
||||
FileUtils.batchDownloadFile(fileList, response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
log.error("下载群活码异常 ex:{}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "群活码下载", httpMethod = "GET")
|
||||
@Log(title = "群活码下载", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/download")
|
||||
public void download(String id, HttpServletResponse response) {
|
||||
WeGroupCode weGroupCode = groupCodeService.getById(Long.valueOf(id));
|
||||
try {
|
||||
FileUtils.downloadFile(weGroupCode.getCodeUrl(), response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
log.error("下载群活码异常 ex:{}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取客户群活码详细信息", httpMethod = "GET")
|
||||
@GetMapping
|
||||
public AjaxResult getInfo(@Validated GroupCodeDetailQuery groupCodeDetailQuery) {
|
||||
WeGroupCode weGroupCode = groupCodeService.getById(groupCodeDetailQuery.getId());
|
||||
if (StringUtils.isNull(weGroupCode)) {
|
||||
return AjaxResult.error(ResultTip.TIP_GENERAL_NOT_FOUND, "数据不存在");
|
||||
}
|
||||
startPage();
|
||||
List<GroupCodeDetailVO> groupCodeDetailVOList = groupCodeService.getGroupCodeDetail(groupCodeDetailQuery, weGroupCode.getCreateType());
|
||||
groupCodeDetailVOList.forEach(groupCode -> {
|
||||
//如果为2099年 显示空值给前端
|
||||
if (DateUtils.isSameDay(groupCode.getEffectTime(), DateUtils.dateTime(com.easyink.common.utils.DateUtils.YYYY_MM_DD_HH_MM, WeConstans.DEFAULT_MATERIAL_NOT_EXPIRE))) {
|
||||
groupCode.setEffectTime(null);
|
||||
}
|
||||
});
|
||||
weGroupCode.setGroupCodeDetailVOList(groupCodeDetailVOList);
|
||||
return AjaxResult.success(weGroupCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增客户群活码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wecom:groupCode:add')")
|
||||
@Log(title = "客户群活码", businessType = BusinessType.INSERT)
|
||||
@ApiOperation(value = "新增客户群活码", httpMethod = "POST")
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody WeGroupCode weGroupCode) {
|
||||
weGroupCode.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
if (LoginTokenService.getLoginUser().isSuperAdmin()) {
|
||||
weGroupCode.setCreateBy(LoginTokenService.getUsername());
|
||||
} else {
|
||||
//员工则保存userId
|
||||
weGroupCode.setCreateBy(LoginTokenService.getLoginUser().getWeUser().getUserId());
|
||||
}
|
||||
groupCodeService.add(weGroupCode);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户群活码
|
||||
*/
|
||||
@ApiOperation(value = "修改客户群活码", httpMethod = "PUT")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:groupCode:edit')")
|
||||
@Log(title = "客户群活码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping(value = "/{id}")
|
||||
public AjaxResult edit(@PathVariable("id") Long id, @RequestBody WeGroupCode weGroupCode) {
|
||||
weGroupCode.setId(id);
|
||||
weGroupCode.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
if (LoginTokenService.getLoginUser().isSuperAdmin()) {
|
||||
weGroupCode.setUpdateBy(LoginTokenService.getUsername());
|
||||
} else {
|
||||
//员工则保存userId
|
||||
weGroupCode.setUpdateBy(LoginTokenService.getLoginUser().getWeUser().getUserId());
|
||||
}
|
||||
return toAjax(groupCodeService.edit(weGroupCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户群活码
|
||||
*/
|
||||
@ApiOperation(value = "删除客户群活码", httpMethod = "DELETE")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:groupCode:remove')")
|
||||
@Log(title = "客户群活码", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult batchRemove(@PathVariable Long[] ids) {
|
||||
return toAjax(groupCodeService.remove(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 从群活码获取第一个可用的实际码
|
||||
*/
|
||||
@ApiOperation(value = "从群活码获取第一个可用的实际码", httpMethod = "GET")
|
||||
@GetMapping("/getActualCode/{groupCodeId}")
|
||||
public AjaxResult<WeGroupCodeActual> getActual(@PathVariable("groupCodeId") Long id) {
|
||||
WeGroupCode groupCode = groupCodeService.getById(id);
|
||||
if (groupCode == null) {
|
||||
return AjaxResult.success(ResultTip.TIP_NO_AVAILABLE_GROUP_CODE.getTipMsg());
|
||||
}
|
||||
GroupCodeActivityFirstVO activityFirstVO = groupCodeService.doGetActual(id, groupCode);
|
||||
|
||||
if (activityFirstVO != null) {
|
||||
return AjaxResult.success(activityFirstVO);
|
||||
}
|
||||
// 找不到可用的实际群活码也不要抛出错误,否则前端H5页面不好处理。
|
||||
return AjaxResult.success(ResultTip.TIP_NO_AVAILABLE_GROUP_CODE.getTipMsg());
|
||||
}
|
||||
|
||||
@GetMapping("/appLink")
|
||||
@ApiOperation("获取群活码小程序短链")
|
||||
public AjaxResult getAppLink(@ApiParam("群活码id") Long id ){
|
||||
return AjaxResult.success("success",groupCodeService.getCodeAppLink(id));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.wecom.domain.WeGroupCodeActual;
|
||||
import com.easyink.wecom.domain.dto.groupcode.AddCorpCodeDTO;
|
||||
import com.easyink.wecom.domain.dto.groupcode.EditCorpCodeDTO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeGroupCodeActualService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业微信活码Controller
|
||||
*
|
||||
* @author tigger
|
||||
* 2022/2/9 16:14
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/corp/actual")
|
||||
@Api(tags = "企业微信活码Controller")
|
||||
public class WeGroupCodeCorpActualController extends BaseController {
|
||||
|
||||
private WeGroupCodeActualService weGroupCodeActualService;
|
||||
|
||||
|
||||
@Autowired
|
||||
public WeGroupCodeCorpActualController(WeGroupCodeActualService weGroupCodeActualService) {
|
||||
this.weGroupCodeActualService = weGroupCodeActualService;
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "新增企业微信活码", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增企业微信活码")
|
||||
public AjaxResult<List<WeGroupCodeActual>> addCorpCode(@Validated @RequestBody AddCorpCodeDTO addCorpCodeDTO) {
|
||||
return AjaxResult.success(weGroupCodeActualService.addBatch(addCorpCodeDTO.getWeGroupCodeCorpActualList(), addCorpCodeDTO.getGroupCodeId(), LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "修改企业微信活码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改企业微信活码")
|
||||
public AjaxResult editCorpCpde(@Validated @RequestBody EditCorpCodeDTO editCorpCodeDTO) {
|
||||
return toAjax(weGroupCodeActualService.editBatch(editCorpCodeDTO.getWeGroupCodeCorpActualList(), editCorpCodeDTO.getGroupCodeId(), LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@Log(title = "删除企业微信活码", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除企业微信活码")
|
||||
public AjaxResult removeCorpCode(@PathVariable(value = "ids") List<Long> removeIds) {
|
||||
|
||||
return toAjax(weGroupCodeActualService.removeBatch(removeIds, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.vo.AllocateWeGroupResp;
|
||||
import com.easyink.wecom.domain.WeGroup;
|
||||
import com.easyink.wecom.domain.WeGroupMember;
|
||||
import com.easyink.wecom.domain.dto.FindWeGroupDTO;
|
||||
import com.easyink.wecom.domain.dto.FindWeGroupMemberDTO;
|
||||
import com.easyink.wecom.domain.vo.FindWeGroupMemberCountVO;
|
||||
import com.easyink.wecom.domain.vo.WeLeaveAllocateVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeGroupMemberService;
|
||||
import com.easyink.wecom.service.WeGroupService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 群组相关
|
||||
*
|
||||
* @author admin
|
||||
* @Description:
|
||||
* @Date: create in 2020/9/21 0021 23:53
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/wecom/group/chat")
|
||||
@Slf4j
|
||||
@Api(tags = "群组相关")
|
||||
public class WeGroupController extends BaseController {
|
||||
@Autowired
|
||||
private WeGroupService weGroupService;
|
||||
|
||||
@Autowired
|
||||
private WeGroupMemberService weGroupMemberService;
|
||||
|
||||
@GetMapping({"/list"})
|
||||
@ApiOperation("查看群列表")
|
||||
public TableDataInfo<WeGroup> list(FindWeGroupDTO weGroup) {
|
||||
startPage();
|
||||
weGroup.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeGroup> list = weGroupService.list(weGroup);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:group:export')")
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出客户群")
|
||||
public <T> AjaxResult export(FindWeGroupDTO weGroup) {
|
||||
weGroup.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return weGroupService.export(weGroup);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:group:view')")
|
||||
@GetMapping({"/members"})
|
||||
@ApiOperation("群成员列表")
|
||||
public TableDataInfo<WeGroupMember> list(FindWeGroupMemberDTO weGroupMember) {
|
||||
startPage();
|
||||
weGroupMember.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeGroupMember> list = this.weGroupMemberService.selectWeGroupMemberList(weGroupMember);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:group:sync')")
|
||||
@GetMapping({"/synchWeGroup"})
|
||||
@ApiOperation("同步客户群")
|
||||
public AjaxResult<T> synchWeGroup() {
|
||||
try {
|
||||
SecurityContext context = SecurityContextHolder.getContext();
|
||||
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
|
||||
SecurityContextHolder.setContext(context);
|
||||
weGroupService.syncWeGroup(LoginTokenService.getLoginUser().getCorpId());
|
||||
} catch (Exception e) {
|
||||
log.error("同步客户群异常 ex:{}", ExceptionUtils.getStackTrace(e));
|
||||
}
|
||||
return AjaxResult.success(WeConstans.SYNCH_TIP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据员工id获取员工相关群
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping({"/getGroupsByUserId/{userId}"})
|
||||
@ApiOperation("根据员工id获取员工相关群")
|
||||
public AjaxResult<T> getGroupsByUserId(@PathVariable String userId) {
|
||||
return AjaxResult.success(weGroupService
|
||||
.list(new LambdaQueryWrapper<WeGroup>().eq(WeGroup::getOwner, userId)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping(value = "/allocatedStaffDetail")
|
||||
@ApiOperation("根据群聊id获取群聊详情")
|
||||
public AjaxResult<T> allocatedStaffDetail(@NotBlank(message = "群id不能为空") String charId){
|
||||
return AjaxResult.success(weGroupService.selectWeGroupDetail(charId,LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/getMemberCount")
|
||||
@ApiOperation("获取群成员数量")
|
||||
public AjaxResult<FindWeGroupMemberCountVO> getMemberCount(FindWeGroupMemberDTO findWeGroupMemberDTO){
|
||||
findWeGroupMemberDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weGroupMemberService.selectWeGroupMemberCount(findWeGroupMemberDTO));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.wecom.domain.dto.customersop.EditUserDTO;
|
||||
import com.easyink.wecom.domain.dto.groupsop.*;
|
||||
import com.easyink.wecom.domain.vo.sop.*;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeGroupSopV2Service;
|
||||
import com.easyink.wecom.service.WeOperationsCenterSopDetailService;
|
||||
import com.easyink.wecom.service.WeOperationsCenterSopService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名:WeGroupSopController
|
||||
*
|
||||
* @author Society my sister Li
|
||||
* @date 2021-11-30 14:54
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/sop")
|
||||
@Api(tags = "SOP相关接口")
|
||||
public class WeGroupSopController extends BaseController {
|
||||
|
||||
private final WeGroupSopV2Service weGroupSopV2Service;
|
||||
private final WeOperationsCenterSopService sopService;
|
||||
private final WeOperationsCenterSopDetailService weOperationsCenterSopDetailService;
|
||||
|
||||
@Autowired
|
||||
public WeGroupSopController(WeGroupSopV2Service weGroupSopV2Service, WeOperationsCenterSopService sopService, WeOperationsCenterSopDetailService weOperationsCenterSopDetailService) {
|
||||
this.weGroupSopV2Service = weGroupSopV2Service;
|
||||
this.sopService = sopService;
|
||||
this.weOperationsCenterSopDetailService = weOperationsCenterSopDetailService;
|
||||
}
|
||||
|
||||
@Log(title = "新增SOP(客户sop/群sop)", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增SOP(客户sop/群sop)")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:groupSop:add') || @ss.hasPermi('wecom:customerSop:add') || @ss.hasPermi('wecom:groupCalendar:add')")
|
||||
public AjaxResult add(@Validated @RequestBody AddWeGroupSopDTO addWeGroupSopDTO) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
addWeGroupSopDTO.setCreateBy(loginUser.getWeUser() == null ? loginUser.getUsername() : loginUser.getWeUser().getUserId());
|
||||
addWeGroupSopDTO.setCorpId(loginUser.getCorpId());
|
||||
weGroupSopV2Service.addSop(addWeGroupSopDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "删除SOP(定时SOP/循环SOP)", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/del")
|
||||
@ApiOperation("删除SOP(定时SOP/循环SOP)")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:groupSop:del') || @ss.hasPermi('wecom:customerSop:del') || @ss.hasPermi('wecom:groupCalendar:del')")
|
||||
public AjaxResult delSop(@Validated @RequestBody DelWeGroupSopDTO delWeGroupSopDTO) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
delWeGroupSopDTO.setCorpId(loginUser.getCorpId());
|
||||
weGroupSopV2Service.delSop(delWeGroupSopDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "查询SOP列表", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询SOP列表")
|
||||
public TableDataInfo<BaseWeOperationsCenterSopVo> list(@Validated FindWeGroupSopDTO findWeGroupSopDTO) {
|
||||
startPage();
|
||||
List<BaseWeOperationsCenterSopVo> list = sopService.list(LoginTokenService.getLoginUser().getCorpId(), findWeGroupSopDTO.getSopType(), findWeGroupSopDTO.getName(), findWeGroupSopDTO.getUserName(), findWeGroupSopDTO.getIsOpen());
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "SOP批量开关", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/batchSwitch")
|
||||
@ApiOperation("SOP批量开关")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:groupSop:switch') || @ss.hasPermi('wecom:customerSop:switch') || @ss.hasPermi('wecom:groupCalendar:switch')")
|
||||
public AjaxResult batchSwitch(@Validated @RequestBody SopBatchSwitchDTO switchDTO) {
|
||||
switchDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
sopService.batchSwitch(switchDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "修改SOP", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改SOP")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:groupSop:edit') || @ss.hasPermi('wecom:customerSop:edit') || @ss.hasPermi('wecom:groupCalendar:edit')")
|
||||
public AjaxResult update(@Validated @RequestBody UpdateWeSopDTO updateWeSopDTO) {
|
||||
updateWeSopDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weGroupSopV2Service.update(updateWeSopDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "修改SOP使用员工", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/editUser")
|
||||
@ApiOperation("修改SOP使用员工")
|
||||
@PreAuthorize("@ss.hasPermi('wecom:customerSop:edit')")
|
||||
public AjaxResult editUser(@Validated @RequestBody EditUserDTO updateWeSopDTO) {
|
||||
updateWeSopDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
sopService.editUser(updateWeSopDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("查询客户SOP类型的执行详情")
|
||||
@GetMapping("/detail/list/customer")
|
||||
public TableDataInfo<WeOperationsCenterSopDetailCustomerVO> listByCustomer(@Validated FindWeSopDetailDTO findWeSopDetailDTO){
|
||||
startPage();
|
||||
findWeSopDetailDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeOperationsCenterSopDetailCustomerVO> list = weOperationsCenterSopDetailService.getSopDetailBySopIdWithCustomerType(findWeSopDetailDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询群SOP定时类型的执行详情")
|
||||
@GetMapping("/detail/list/timing")
|
||||
public TableDataInfo<WeOperationsCenterSopDetailByTimingTypeVO> listByTiming(@Validated FindWeSopDetailDTO findWeSopDetailDTO){
|
||||
startPage();
|
||||
findWeSopDetailDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeOperationsCenterSopDetailByTimingTypeVO> list = weOperationsCenterSopDetailService.getSopDetailBySopIdWithTimingType(findWeSopDetailDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询群SOP循环类型的执行详情")
|
||||
@GetMapping("/detail/list/cycle")
|
||||
public TableDataInfo<WeOperationsCenterSopDetailByCycleTypeVO> listByCycle(@Validated FindWeSopDetailDTO findWeSopDetailDTO){
|
||||
startPage();
|
||||
findWeSopDetailDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeOperationsCenterSopDetailByCycleTypeVO> list = weOperationsCenterSopDetailService.getSopDetailBySopIdWithCycleType(findWeSopDetailDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/listOfDetail")
|
||||
@ApiOperation("sop详情")
|
||||
public AjaxResult<SopDetailVO> listOfDetail(@RequestParam("sopId") Long sopId) {
|
||||
return AjaxResult.success(sopService.listOfDetail(sopId, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@Log(title = "sop规则执行记录分页", businessType = BusinessType.OTHER)
|
||||
@ApiOperation("sop规则执行记录分页")
|
||||
@GetMapping("/rules")
|
||||
public TableDataInfo<WeSopExecutedRulesVO> listRecordByRule(@Validated FindWeSopExecutedRulesDTO findWeSopExecutedRulesDTO){
|
||||
startPage();
|
||||
findWeSopExecutedRulesDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeSopExecutedRulesVO> list = weOperationsCenterSopDetailService.getSopExecutedRulesBySopId(findWeSopExecutedRulesDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "sop员工执行记录分页", businessType = BusinessType.OTHER)
|
||||
@ApiOperation("sop员工执行记录分页")
|
||||
@GetMapping("/users")
|
||||
public TableDataInfo<WeSopExecutedUsersVO> listRecordByUser(@Validated FindWeSopExecutedUsersDTO findWeSopExecutedUsersDTO){
|
||||
startPage();
|
||||
findWeSopExecutedUsersDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeSopExecutedUsersVO> list = weOperationsCenterSopDetailService.getSopExecutedUsersBySopId(findWeSopExecutedUsersDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "sop任务统计", businessType = BusinessType.OTHER)
|
||||
@ApiOperation("sop任务统计")
|
||||
@GetMapping("/count")
|
||||
public AjaxResult<WeSopTaskCountVO> taskCount(@RequestParam("sopId") String sopId){
|
||||
return AjaxResult.success(weOperationsCenterSopDetailService.taskCount(sopId, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.utils.PageInfoUtil;
|
||||
import com.easyink.wecom.domain.WeGroupTag;
|
||||
import com.easyink.wecom.domain.dto.statistics.WeTagStatisticsDTO;
|
||||
import com.easyink.wecom.domain.dto.wegrouptag.*;
|
||||
import com.easyink.wecom.domain.vo.statistics.WeTagGroupListVO;
|
||||
import com.easyink.wecom.domain.vo.wegrouptag.PageWeGroupTagCategoryVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.mapper.WeGroupTagMapper;
|
||||
import com.easyink.wecom.service.WeGroupTagCategoryService;
|
||||
import com.easyink.wecom.service.WeGroupTagRelService;
|
||||
import com.easyink.wecom.service.WeGroupTagService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 类名:WeGroupTagController
|
||||
*
|
||||
* @author Society my sister Li
|
||||
* @date 2021-11-12 15:55
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/grouptag")
|
||||
@Api(tags = "群标签相关接口")
|
||||
public class WeGroupTagController extends BaseController {
|
||||
|
||||
private final WeGroupTagCategoryService weGroupTagCategoryService;
|
||||
private final WeGroupTagRelService weGroupTagRelService;
|
||||
private final WeGroupTagService weGroupTagService;
|
||||
|
||||
@Autowired
|
||||
private WeGroupTagMapper weGroupTagMapper;
|
||||
|
||||
@Autowired
|
||||
public WeGroupTagController(WeGroupTagCategoryService weGroupTagCategoryService, WeGroupTagRelService weGroupTagRelService, WeGroupTagService weGroupTagService) {
|
||||
this.weGroupTagCategoryService = weGroupTagCategoryService;
|
||||
this.weGroupTagRelService = weGroupTagRelService;
|
||||
this.weGroupTagService = weGroupTagService;
|
||||
}
|
||||
|
||||
@Log(title = "新增群标签组", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增群标签组")
|
||||
public AjaxResult add(@Validated @RequestBody AddWeGroupTagCategoryDTO weGroupTagCategory) {
|
||||
weGroupTagCategory.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weGroupTagCategoryService.add(weGroupTagCategory));
|
||||
}
|
||||
|
||||
@Log(title = "编辑群标签组", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("编辑群标签组")
|
||||
public AjaxResult update(@Validated @RequestBody UpdateWeGroupTagCategoryDTO weGroupTagCategory) {
|
||||
weGroupTagCategory.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weGroupTagCategoryService.update(weGroupTagCategory));
|
||||
}
|
||||
|
||||
@Log(title = "删除群标签组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping
|
||||
@ApiOperation("删除群标签组")
|
||||
public AjaxResult del(@Validated @RequestBody DelWeGroupTagCategoryDTO weGroupTagCategory) {
|
||||
weGroupTagCategory.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weGroupTagCategoryService.delete(weGroupTagCategory);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "分页查询标签组列表", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("分页查询标签组列表")
|
||||
public TableDataInfo<PageWeGroupTagCategoryVO> page(@Validated PageWeGroupTagCategoryDTO weGroupTagCategory) {
|
||||
weGroupTagCategory.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
startPage();
|
||||
return getDataTable(weGroupTagCategoryService.page(weGroupTagCategory));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "查询标签组列表", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询标签组列表")
|
||||
public AjaxResult list(@Validated FindWeGroupTagCategoryDTO weGroupTagCategory) {
|
||||
weGroupTagCategory.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weGroupTagCategoryService.list(weGroupTagCategory));
|
||||
}
|
||||
|
||||
@Log(title = "查询标签组列表", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("查询标签组列表")
|
||||
public AjaxResult findInfo(@Validated FindWeGroupTagCategoryDTO weGroupTagCategory) {
|
||||
weGroupTagCategory.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weGroupTagCategoryService.findInfo(weGroupTagCategory));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "批量打标签", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/batchAddTagRel")
|
||||
@ApiOperation("批量打标签")
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:group:edit')")
|
||||
public AjaxResult batchAddTagRel(@Validated @RequestBody BatchTagRelDTO batchTagRelDTO) {
|
||||
batchTagRelDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weGroupTagRelService.batchAddTagRel(batchTagRelDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "批量移除标签", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/batchDelTagRel")
|
||||
@ApiOperation("批量打标签")
|
||||
public AjaxResult batchDelTagRel(@Validated @RequestBody BatchTagRelDTO batchTagRelDTO) {
|
||||
batchTagRelDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weGroupTagRelService.batchDelTagRel(batchTagRelDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/getGroupTagList")
|
||||
@ApiOperation("获取所有群标签组名和id")
|
||||
public TableDataInfo<WeTagGroupListVO> getGroupTagList(){
|
||||
WeTagStatisticsDTO statisticsDTO=new WeTagStatisticsDTO();
|
||||
statisticsDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return PageInfoUtil.getDataTable(weGroupTagService.groupTagList(statisticsDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/totalTagCnt")
|
||||
@ApiOperation("企业未删除标签总数")
|
||||
public AjaxResult totalTagCnt(){
|
||||
int total = weGroupTagMapper.selectCount(new LambdaQueryWrapper<WeGroupTag>().eq(WeGroupTag::getCorpId,LoginTokenService.getLoginUser().getCorpId()));
|
||||
return AjaxResult.success(total);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.wecom.domain.WeLockSidebarConfig;
|
||||
import com.easyink.wecom.domain.dto.LockSidebarConfigDTO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeLockSidebarConfigService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 第三方SCRM系统侧边栏配置(WeLockSidebarConfig)表控制层
|
||||
*
|
||||
* @author wx
|
||||
* @since 2023-03-14 15:39:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/lockSideBar")
|
||||
public class WeLockSidebarConfigController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private WeLockSidebarConfigService weLockSidebarConfigService;
|
||||
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("第三方SCRM系统查询侧边栏配置")
|
||||
public AjaxResult get(@RequestParam("appId") String appId) {
|
||||
return AjaxResult.success(weLockSidebarConfigService.getConfig(appId));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询侧边栏配置")
|
||||
public AjaxResult list() {
|
||||
return AjaxResult.success(weLockSidebarConfigService.list(new LambdaQueryWrapper<WeLockSidebarConfig>().eq(WeLockSidebarConfig::getCorpId, LoginTokenService.getLoginUser().getCorpId())));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("配置侧边栏配置")
|
||||
public AjaxResult edit(@RequestBody @Validated LockSidebarConfigDTO dto) {
|
||||
weLockSidebarConfigService.edit(dto);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.wecom.domain.dto.customerloss.CustomerAddLossTagDTO;
|
||||
import com.easyink.wecom.domain.vo.customerloss.CustomerLossTagVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeLossTagService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 流失标签Controller
|
||||
*
|
||||
* @author lichaoyu
|
||||
* @date 2023/3/24 11:44
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/lossTag")
|
||||
@Api(tags = "流失提醒相关接口")
|
||||
public class WeLossTagController {
|
||||
|
||||
|
||||
private final WeLossTagService weLossTagService;
|
||||
|
||||
@Autowired
|
||||
public WeLossTagController(WeLossTagService weLossTagService) {
|
||||
this.weLossTagService = weLossTagService;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("添加流失标签")
|
||||
@PreAuthorize("@ss.hasPermi('wechat:corp:loss:setting')")
|
||||
@PostMapping("/addLossTag")
|
||||
public AjaxResult addLossTag(@RequestBody CustomerAddLossTagDTO customerAddLossTagDTO) {
|
||||
weLossTagService.insertWeLossTag(customerAddLossTagDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("查找流失标签")
|
||||
@GetMapping("/selectLossTag")
|
||||
public AjaxResult<CustomerLossTagVO> selectLossTag() {
|
||||
return AjaxResult.success("操作成功!", weLossTagService.selectLossWeTag(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.wecom.domain.WeMaterialConfig;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeMaterialConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 类名:WeMaterialConfigController
|
||||
*
|
||||
* @author Society my sister Li
|
||||
* @date 2021-10-11 15:56
|
||||
*/
|
||||
@Api(tags = "企业素材配置表")
|
||||
@RestController
|
||||
@RequestMapping("/wecom/materialConfig")
|
||||
public class WeMaterialConfigController {
|
||||
|
||||
private final WeMaterialConfigService weMaterialConfigService;
|
||||
|
||||
@Autowired
|
||||
public WeMaterialConfigController(WeMaterialConfigService weMaterialConfigService) {
|
||||
this.weMaterialConfigService = weMaterialConfigService;
|
||||
}
|
||||
|
||||
@Log(title = "获取素材配置", businessType = BusinessType.OTHER)
|
||||
@GetMapping(value = "/get")
|
||||
@ApiOperation("获取素材配置信息")
|
||||
public AjaxResult<WeMaterialConfig> get() {
|
||||
return AjaxResult.success(weMaterialConfigService.findByCorpId(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@Log(title = "更新素材配置", businessType = BusinessType.OTHER)
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新素材配置")
|
||||
public AjaxResult upload(@Valid @RequestBody WeMaterialConfig weMaterialConfig) {
|
||||
weMaterialConfig.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weMaterialConfigService.update(weMaterialConfig);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,234 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.MediaType;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.exception.CustomException;
|
||||
import com.easyink.wecom.domain.WeMaterial;
|
||||
import com.easyink.wecom.domain.WeMaterialTagEntity;
|
||||
import com.easyink.wecom.domain.dto.*;
|
||||
import com.easyink.wecom.domain.dto.tag.WeMaterialTagAddDTO;
|
||||
import com.easyink.wecom.domain.vo.*;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeMaterialService;
|
||||
import com.easyink.wecom.service.WeMaterialTagService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jodd.util.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 企业微信素材Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2020-10-08
|
||||
*/
|
||||
@Api(tags = "企业微信素材管理接口")
|
||||
@RestController
|
||||
@RequestMapping("/wecom/material")
|
||||
public class WeMaterialController extends BaseController {
|
||||
private final WeMaterialService materialService;
|
||||
private final WeMaterialTagService weMaterialTagService;
|
||||
|
||||
@Autowired
|
||||
public WeMaterialController(@NotNull WeMaterialService materialService, @NotNull WeMaterialTagService weMaterialTagService) {
|
||||
this.materialService = materialService;
|
||||
this.weMaterialTagService = weMaterialTagService;
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:material:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询素材列表")
|
||||
public TableDataInfo<WeMaterialVO> list(@Validated FindWeMaterialDTO findWeMaterialDTO) {
|
||||
startPage();
|
||||
findWeMaterialDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeMaterialVO> list = materialService.findWeMaterials(findWeMaterialDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wechat:material:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("查询素材详细信息")
|
||||
public AjaxResult<WeMaterial> getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(materialService.findWeMaterialById(id));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wechat:material:add')")
|
||||
@Log(title = "添加素材信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加素材信息")
|
||||
public AjaxResult<InsertWeMaterialVO> add(@Validated @RequestBody AddWeMaterialDTO material) {
|
||||
return AjaxResult.success(materialService.insertWeMaterial(material));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wechat:material:edit')")
|
||||
@Log(title = "更新素材信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("更新素材信息")
|
||||
public AjaxResult edit(@Validated @RequestBody UpdateWeMaterialDTO material) {
|
||||
material.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
material.setUpdateBy(LoginTokenService.getUsername());
|
||||
return toAjax(materialService.updateWeMaterial(material));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wechat:material:remove')")
|
||||
@Log(title = "删除素材信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/remove")
|
||||
@ApiOperation("删除素材信息")
|
||||
public AjaxResult remove(@Validated @RequestBody RemoveMaterialDTO removeMaterialDTO) {
|
||||
removeMaterialDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
materialService.deleteWeMaterialByIds(removeMaterialDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wechat:material:upload')")
|
||||
@Log(title = "上传素材信息", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/upload")
|
||||
@ApiOperation("上传素材信息")
|
||||
public AjaxResult upload(@RequestParam(value = "file") MultipartFile file, @RequestParam(value = "mediaType") String mediaType) {
|
||||
WeMaterialFileVO weMaterialFileVO = materialService.uploadWeMaterialFile(file, mediaType);
|
||||
return AjaxResult.success(weMaterialFileVO);
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wechat:material:resetCategory')")
|
||||
@Log(title = "更换分组", businessType = BusinessType.OTHER)
|
||||
@PutMapping("/resetCategory")
|
||||
@ApiOperation("更换分组")
|
||||
public AjaxResult resetCategory(@RequestBody ResetCategoryDTO resetCategoryDTO) {
|
||||
materialService.resetCategory(resetCategoryDTO.getCategoryId(), resetCategoryDTO.getMaterials());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
//@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
|
||||
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/temporaryMaterialMediaId")
|
||||
@ApiOperation("H5端发送获取素材media_id")
|
||||
public AjaxResult temporaryMaterialMediaId(String url, String type, String name) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
WeMediaDTO weMediaDto = materialService.uploadTemporaryMaterial(url, type, name, corpId);
|
||||
return AjaxResult.success(weMediaDto);
|
||||
}
|
||||
|
||||
|
||||
//@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
|
||||
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/temporaryMaterialMediaIdForWeb")
|
||||
@ApiOperation("web端发送获取素材media_id")
|
||||
public AjaxResult temporaryMaterialMediaIdForWeb(@RequestBody TemporaryMaterialDTO temporaryMaterialDTO) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
Optional<MediaType> mediaType = MediaType.of(temporaryMaterialDTO.getType());
|
||||
if(!mediaType.isPresent()){
|
||||
throw new CustomException(ResultTip.TIP_MEDIA_TYPE_ERROR);
|
||||
}
|
||||
WeMediaDTO weMediaDto = materialService.uploadTemporaryMaterial(temporaryMaterialDTO.getUrl(),
|
||||
mediaType.get().getMediaType()
|
||||
, temporaryMaterialDTO.getName(), corpId);
|
||||
return AjaxResult.success(weMediaDto);
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "上传素材图片", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/uploadimg")
|
||||
@ApiOperation("上传素材图片")
|
||||
public AjaxResult<WeMediaDTO> uploadImg(MultipartFile file, HttpServletRequest request) {
|
||||
WeMediaDTO weMediaDto = new WeMediaDTO();
|
||||
WeMaterialFileVO weMaterialFileVO = materialService.uploadWeMaterialFile(file, MediaType.IMAGE.getType());
|
||||
weMediaDto.setFileName(weMaterialFileVO.getMaterialName());
|
||||
weMediaDto.setUrl(weMaterialFileVO.getMaterialUrl() + weMaterialFileVO.getMaterialName());
|
||||
return AjaxResult.success(weMediaDto);
|
||||
}
|
||||
|
||||
@Log(title = "保存素材标签", businessType = BusinessType.OTHER)
|
||||
@ApiOperation("保存素材标签")
|
||||
@PostMapping("/saveTag")
|
||||
public AjaxResult saveTag(@Validated @RequestBody WeMaterialTagAddDTO weMaterialTagAddDTO) {
|
||||
WeMaterialTagEntity weMaterialTagEntity = new WeMaterialTagEntity();
|
||||
weMaterialTagEntity.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weMaterialTagEntity.setTagName(weMaterialTagAddDTO.getTagName().trim());
|
||||
weMaterialTagService.insertTag(weMaterialTagEntity);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "删除素材标签", businessType = BusinessType.OTHER)
|
||||
@ApiOperation("删除素材标签")
|
||||
@DeleteMapping("/delTag/{tagId}")
|
||||
public AjaxResult delTag(@PathVariable Long tagId) {
|
||||
weMaterialTagService.delTag(tagId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "批量打标签", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/markTags")
|
||||
@ApiOperation("批量打标签")
|
||||
public AjaxResult markTags(@RequestBody WeMaterialTagDTO weMaterialTagDTO) {
|
||||
weMaterialTagService.markTags(weMaterialTagDTO.getMaterialIds(), weMaterialTagDTO.getTagIds());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "批量移除标签", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/removeTags")
|
||||
@ApiOperation("批量移除标签")
|
||||
public AjaxResult removeTags(@Validated @RequestBody WeMaterialTagRelRemoveDTO weMaterialTagRelRemoveDTO) {
|
||||
weMaterialTagService.removeTags(weMaterialTagRelRemoveDTO.getTagIds(), weMaterialTagRelRemoveDTO.getMaterialIds());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "查询标签列表", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/listTagByName")
|
||||
@ApiOperation("查询标签列表")
|
||||
public AjaxResult<WeMaterialTagVO> listTagByName(@Param("tagName") String tagName) {
|
||||
return AjaxResult.success(weMaterialTagService.listByName(tagName, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wechat:material:publish')")
|
||||
@Log(title = "素材发布/取消发布", businessType = BusinessType.OTHER)
|
||||
@PutMapping("/showMaterialSwitch")
|
||||
@ApiOperation("素材发布/取消发布")
|
||||
public AjaxResult showMaterialSwitch(@Validated @RequestBody ShowMaterialSwitchDTO showMaterialSwitchDTO) {
|
||||
showMaterialSwitchDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
materialService.showMaterialSwitch(showMaterialSwitchDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "过期素材恢复/批量恢复", businessType = BusinessType.OTHER)
|
||||
@PutMapping("/restore")
|
||||
@ApiOperation("过期素材恢复/批量恢复")
|
||||
public AjaxResult<WeMediaDTO> restore(@Validated @RequestBody RestoreMaterialDTO restoreMaterialDTO) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
restoreMaterialDTO.setCorpId(corpId);
|
||||
materialService.restore(restoreMaterialDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "查询素材/侧边栏数量", businessType = BusinessType.OTHER)
|
||||
@ApiOperation("查询素材/侧边栏数量接口")
|
||||
@PostMapping("/getMaterialCount")
|
||||
public AjaxResult<WeMaterialCountVO> getMaterialCount(@RequestBody FindWeMaterialDTO findWeMaterialDTO) {
|
||||
findWeMaterialDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(materialService.getMaterialCount(findWeMaterialDTO));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.utils.poi.ExcelUtil;
|
||||
import com.easyink.wecom.domain.WeMessagePush;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeMessagePushService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 消息发送的Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2020-10-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/push")
|
||||
@Api(tags = "消息发送的Controller")
|
||||
public class WeMessagePushController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WeMessagePushService weMessagePushService;
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('system:push:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询消息发送的列表")
|
||||
public TableDataInfo list(WeMessagePush weMessagePush) {
|
||||
startPage();
|
||||
List<WeMessagePush> list = weMessagePushService.selectWeMessagePushList(weMessagePush);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('system:push:export')")
|
||||
@Log(title = "消息发送的", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出消息发送的列表")
|
||||
public AjaxResult export(WeMessagePush weMessagePush) {
|
||||
List<WeMessagePush> list = weMessagePushService.selectWeMessagePushList(weMessagePush);
|
||||
ExcelUtil<WeMessagePush> util = new ExcelUtil<>(WeMessagePush.class);
|
||||
return util.exportExcel(list, "push");
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('system:push:query')")
|
||||
@GetMapping(value = "/{messagePushId}")
|
||||
@ApiOperation("获取消息发送的详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("messagePushId") Long messagePushId) {
|
||||
return AjaxResult.success(weMessagePushService.selectWeMessagePushById(messagePushId));
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('system:push:add')")
|
||||
@Log(title = "消息发送的", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "add")
|
||||
@ApiOperation("新增消息发送")
|
||||
public AjaxResult add(@RequestBody WeMessagePush weMessagePush) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
weMessagePushService.insertWeMessagePush(weMessagePush, corpId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('system:push:remove')")
|
||||
@Log(title = "消息发送的", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{messagePushIds}")
|
||||
@ApiOperation("删除消息发送")
|
||||
public AjaxResult remove(@PathVariable Long[] messagePushIds) {
|
||||
return toAjax(weMessagePushService.deleteWeMessagePushByIds(messagePushIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.dto.moment.CreateMomentTaskDTO;
|
||||
import com.easyink.wecom.domain.dto.moment.MomentUserCustomerDTO;
|
||||
import com.easyink.wecom.domain.dto.moment.SearchMomentContentDTO;
|
||||
import com.easyink.wecom.domain.dto.moment.SendToUserDTO;
|
||||
import com.easyink.wecom.domain.vo.moment.MomentTotalVO;
|
||||
import com.easyink.wecom.domain.vo.moment.MomentUserCustomerVO;
|
||||
import com.easyink.wecom.domain.vo.moment.SearchMomentVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.moment.WeMomentTaskService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 类名: 朋友圈接口
|
||||
*
|
||||
* @author 佚名
|
||||
* @date 2022/1/11 11:29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/moment")
|
||||
@Api(tags = "朋友圈")
|
||||
public class WeMomentController extends BaseController {
|
||||
private final WeMomentTaskService weMomentTaskService;
|
||||
|
||||
@Autowired
|
||||
public WeMomentController(WeMomentTaskService weMomentTaskService) {
|
||||
this.weMomentTaskService = weMomentTaskService;
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:moments:publish')")
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建朋友圈任务")
|
||||
public AjaxResult createMoment(@Validated @RequestBody CreateMomentTaskDTO createMomentTaskDTO) {
|
||||
createMomentTaskDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weMomentTaskService.createMomentTask(createMomentTaskDTO, LoginTokenService.getLoginUser());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:moments:del')")
|
||||
@DeleteMapping("/deleteMoment")
|
||||
@ApiOperation("删除朋友圈")
|
||||
public AjaxResult deleteMoment(@RequestParam("momentTaskId") Long momentTaskId) {
|
||||
weMomentTaskService.deleteMoment(momentTaskId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:moments:edit')")
|
||||
@PostMapping("/updateMoment")
|
||||
@ApiOperation("编辑朋友圈")
|
||||
public AjaxResult updateMoment(@RequestBody CreateMomentTaskDTO createMomentTaskDTO) {
|
||||
weMomentTaskService.updateMoment(createMomentTaskDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/listOfMomentTask")
|
||||
@ApiOperation("查询朋友圈发布记录")
|
||||
public TableDataInfo<SearchMomentVO> listOfMomentTask(@Validated SearchMomentContentDTO searchMomentContentDTO) {
|
||||
searchMomentContentDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weMomentTaskService.listOfMomentTask(searchMomentContentDTO.initTime(), LoginTokenService.getLoginUser()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:moments:detail')")
|
||||
@GetMapping("/listOfMomentPublishDetail")
|
||||
@ApiOperation("查询朋友圈发布记录详情")
|
||||
public TableDataInfo<MomentUserCustomerVO> listOfMomentPublishDetail(@Validated MomentUserCustomerDTO momentUserCustomerDTO) {
|
||||
startPage();
|
||||
return getDataTable(weMomentTaskService.listOfMomentPublishDetail(momentUserCustomerDTO));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:moments:detail')")
|
||||
@GetMapping("/getTotal")
|
||||
@ApiOperation("获取详情统计接口")
|
||||
public AjaxResult<MomentTotalVO> getTotal(@RequestParam("momentTaskId") Long momentTaskId) {
|
||||
return AjaxResult.success(weMomentTaskService.getTotal(momentTaskId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:moments:detail')")
|
||||
@GetMapping("/getMomentTaskBasicInfo")
|
||||
@ApiOperation("获取朋友圈任务基础信息")
|
||||
public AjaxResult<SearchMomentVO> getMomentTaskBasicInfo(@RequestParam("momentTaskId") Long momentTaskId) {
|
||||
return AjaxResult.success(weMomentTaskService.getMomentTaskBasicInfo(momentTaskId));
|
||||
}
|
||||
@PutMapping("/refreshMomentTask")
|
||||
@ApiOperation("刷新朋友圈执行")
|
||||
public AjaxResult refreshMomentTask(@RequestParam("momentTaskId") Long momentTaskId) {
|
||||
weMomentTaskService.refreshMoment(momentTaskId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/sendToUser")
|
||||
@ApiOperation("发送提醒信息")
|
||||
public AjaxResult sendToUser(@Validated @RequestBody SendToUserDTO sendToUserDTO) {
|
||||
weMomentTaskService.sendToUser(sendToUserDTO.getUserIds(), sendToUserDTO.getType(), sendToUserDTO.getSendTime(), sendToUserDTO.getMomentTaskId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PutMapping("/updateUserMoment")
|
||||
@ApiOperation("修改员工朋友圈执行详情(h5个人朋友圈)")
|
||||
public AjaxResult updateUserMoment(@RequestParam("momentTaskId") Long momentTaskId, @RequestParam("userId") String userId) {
|
||||
weMomentTaskService.updateUserMoment(momentTaskId, userId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/getMomentTask")
|
||||
@ApiOperation("h5查询接口")
|
||||
public AjaxResult<SearchMomentVO> getMomentTask(@RequestParam("momentTaskId") Long momentTaskId, @RequestParam("userId") String userId) {
|
||||
return AjaxResult.success(weMomentTaskService.getMomentTask(momentTaskId, userId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.WelcomeMsgTplTypeEnum;
|
||||
import com.easyink.wecom.domain.WeMsgTlp;
|
||||
import com.easyink.wecom.domain.dto.welcomemsg.WelComeMsgAddDTO;
|
||||
import com.easyink.wecom.domain.dto.welcomemsg.WelComeMsgDeleteDTO;
|
||||
import com.easyink.wecom.domain.dto.welcomemsg.WelComeMsgUpdateEmployDTO;
|
||||
import com.easyink.wecom.domain.dto.welcomemsg.WelComeMsgUpdateGroupDTO;
|
||||
import com.easyink.wecom.domain.vo.welcomemsg.WeMsgTlpListVO;
|
||||
import com.easyink.wecom.domain.vo.welcomemsg.WelcomeMsgGroupMaterialCountVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeMsgTlpService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 欢迎语模板Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2020-10-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/tlp")
|
||||
@Api(tags = "欢迎语模板Controller")
|
||||
public class WeMsgTlpController extends BaseController {
|
||||
|
||||
private final WeMsgTlpService weMsgTlpService;
|
||||
|
||||
@Autowired
|
||||
public WeMsgTlpController(WeMsgTlpService weMsgTlpService) {
|
||||
this.weMsgTlpService = weMsgTlpService;
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:tlp:add')")
|
||||
@Log(title = "新增好友欢迎语模板", businessType = BusinessType.INSERT)
|
||||
@PostMapping("employ")
|
||||
@ApiOperation("新增好友欢迎语模板")
|
||||
public AjaxResult addEmployMsg(@Validated @RequestBody WelComeMsgAddDTO welComeMsgAddDTO) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
welComeMsgAddDTO.getWeMsgTlp().setCorpId(loginUser.getCorpId());
|
||||
if (loginUser.isSuperAdmin()) {
|
||||
welComeMsgAddDTO.getWeMsgTlp().setCreateBy(loginUser.getUser().getUserId().toString());
|
||||
} else {
|
||||
welComeMsgAddDTO.getWeMsgTlp().setCreateBy(loginUser.getWeUser().getUserId());
|
||||
}
|
||||
welComeMsgAddDTO.getWeMsgTlp().setWelcomeMsgTplType(WelcomeMsgTplTypeEnum.EMP_WELCOME.getType());
|
||||
weMsgTlpService.insertWeMsgTlpWithEmploy(welComeMsgAddDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:groupWelcome:add')")
|
||||
@Log(title = "新增群欢迎语模板", businessType = BusinessType.INSERT)
|
||||
@PostMapping("group")
|
||||
@ApiOperation("新增群欢迎语模板")
|
||||
public AjaxResult addGroupMsg(@Validated @RequestBody WelComeMsgAddDTO welComeMsgAddDTO) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
welComeMsgAddDTO.getWeMsgTlp().setCorpId(loginUser.getCorpId());
|
||||
if (loginUser.isSuperAdmin()) {
|
||||
welComeMsgAddDTO.getWeMsgTlp().setCreateBy(loginUser.getUser().getUserId().toString());
|
||||
} else {
|
||||
welComeMsgAddDTO.getWeMsgTlp().setCreateBy(loginUser.getWeUser().getUserId());
|
||||
}
|
||||
welComeMsgAddDTO.getWeMsgTlp().setWelcomeMsgTplType(WelcomeMsgTplTypeEnum.GROUP_WELCOME.getType());
|
||||
weMsgTlpService.insertWeMsgTlpWithGroup(welComeMsgAddDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list/employ")
|
||||
@ApiOperation("查询欢迎语模板列表")
|
||||
public TableDataInfo<WeMsgTlpListVO> list(WeMsgTlp weMsgTlp) {
|
||||
weMsgTlp.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
startPage();
|
||||
List<WeMsgTlpListVO> list = weMsgTlpService.selectWeMsgTlpList(weMsgTlp);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:tlp:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取欢迎语模板详细信息")
|
||||
public AjaxResult<WeMsgTlpListVO> getInfo(@ApiParam("默认欢迎语id") @PathVariable("id") Long id) {
|
||||
|
||||
return AjaxResult.success(
|
||||
weMsgTlpService.detail(WeMsgTlp.builder().corpId(LoginTokenService.getLoginUser().getCorpId()).id(id).build())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:tlp:edit')")
|
||||
@Log(title = "修改好友迎语模板", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit/employ")
|
||||
@ApiOperation("修改好友迎语模板")
|
||||
public AjaxResult editWithEmploy(@Validated @RequestBody WelComeMsgUpdateEmployDTO welComeMsgUpdateDTO) {
|
||||
welComeMsgUpdateDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weMsgTlpService.updateWeMsgTlpWithEmploy(welComeMsgUpdateDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:groupWelcome:edit')")
|
||||
@Log(title = "修改群欢迎语模板", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit/group")
|
||||
@ApiOperation("修改群欢迎语模板")
|
||||
public AjaxResult editWithGroup(@Validated @RequestBody WelComeMsgUpdateGroupDTO welComeMsgUpdateDTO) {
|
||||
welComeMsgUpdateDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weMsgTlpService.updateWeMsgTlpWithGroup(welComeMsgUpdateDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:tlp:remove')")
|
||||
@Log(title = "删除好友欢迎语模板", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/employ")
|
||||
@ApiOperation("删除好友欢迎语模板")
|
||||
public AjaxResult removeWithEmploy(@Validated @RequestBody WelComeMsgDeleteDTO welComeMsgDeleteDTO) {
|
||||
weMsgTlpService.deleteEmployWeMsgTlpById(LoginTokenService.getLoginUser().getCorpId(), welComeMsgDeleteDTO.getIds());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:groupWelcome:del')")
|
||||
@Log(title = "删除群欢迎语模板", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/group")
|
||||
@ApiOperation("删除群欢迎语模板")
|
||||
public AjaxResult removeWithGroup(@Validated @RequestBody WelComeMsgDeleteDTO welComeMsgDeleteDTO) {
|
||||
weMsgTlpService.deleteGroupWeMsgTlpById(LoginTokenService.getLoginUser().getCorpId(), welComeMsgDeleteDTO.getIds());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/group/count")
|
||||
@ApiOperation("群欢迎语模板统计")
|
||||
public AjaxResult groupCount() {
|
||||
WelcomeMsgGroupMaterialCountVO vo = weMsgTlpService.groupCount(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.easyink.common.config.WechatOpenConfig;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.exception.CustomException;
|
||||
import com.easyink.common.utils.Threads;
|
||||
import com.easyink.common.utils.WXBizMsgCrypt;
|
||||
import com.easyink.wecom.domain.vo.WeOpenXmlMessageVO;
|
||||
import com.easyink.wecom.domain.vo.WxCpXmlMessageVO;
|
||||
import com.easyink.wecom.factory.WeOpenCallBackEventFactory;
|
||||
import com.easyink.wecom.factory.WeOpenEventHandle;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.security.AnyTypePermission;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
|
||||
import me.chanjar.weixin.cp.bean.WxCpXmlMessage;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 微信开放平台回调接口
|
||||
*
|
||||
* @author wx
|
||||
* 2023/1/12 18:10
|
||||
**/
|
||||
@Api(value = "WeOpenCallBackController", tags = "企业微信回调接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wecom/weopen/callback")
|
||||
@RequiredArgsConstructor
|
||||
public class WeOpenCallBackController {
|
||||
private final WeOpenEventHandle weOpenEventHandle;
|
||||
private final WechatOpenConfig wechatOpenConfig;
|
||||
|
||||
@ApiOperation(value = "微信开放平台-第三方平台授权事件接收接口(授权事件通知、component_verify_ticket)")
|
||||
@PostMapping(value = "/${wechatopen.platform3rdAccount.appId}/receive3rdPlatform")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public String receive3rdPlatform(@RequestParam("timestamp") String timeStamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestBody String postData) {
|
||||
try {
|
||||
//这个类是微信官网提供的解密类,需要用到消息校验Token 消息加密Key和服务平台appid
|
||||
WechatOpenConfig.Platform3rdAccount platform3rdAccount = wechatOpenConfig.getPlatform3rdAccount();
|
||||
WXBizMsgCrypt weCrypt = new WXBizMsgCrypt(platform3rdAccount.getComponentToken(), platform3rdAccount.getAesKey(), platform3rdAccount.getAppId());
|
||||
String decrypt = weCrypt.decryptMsg(msgSignature, timeStamp, nonce, postData);
|
||||
log.info("微信第三方平台回调通知接口,转换前的xml :{}", decrypt);
|
||||
WeOpenXmlMessageVO wxCpXmlMessage = strXmlToBean(decrypt);
|
||||
log.info("微信第三方平台回调通知接口,转换后的wxCpXmlMessage:{}", JSON.toJSONString(wxCpXmlMessage));
|
||||
String event = StringUtils.isNotBlank(wxCpXmlMessage.getInfoType()) ? wxCpXmlMessage.getInfoType() : wxCpXmlMessage.getEvent();
|
||||
WeOpenCallBackEventFactory factory = weOpenEventHandle.factory(event);
|
||||
if (factory != null) {
|
||||
Threads.WE_OPEN_THREAD_POOL.submit(() -> factory.eventHandle(wxCpXmlMessage));
|
||||
} else {
|
||||
throw new CustomException(ResultTip.TIP_STRATEGY_IS_EMPTY);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("微信第三方平台回调异常, e:{}", ExceptionUtils.getStackTrace(e));
|
||||
return "error";
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
private WeOpenXmlMessageVO strXmlToBean(String xmlStr) {
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
xstream.addPermission(AnyTypePermission.ANY);
|
||||
xstream.processAnnotations(WxCpXmlMessage.class);
|
||||
xstream.processAnnotations(WeOpenXmlMessageVO.class);
|
||||
return (WeOpenXmlMessageVO) xstream.fromXML(xmlStr);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.constant.RedisKeyConstants;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.redis.RedisCache;
|
||||
import com.easyink.wecom.domain.dto.WePageStaticDataDTO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @description 首页统计
|
||||
* @date 2021/2/23 15:30
|
||||
**/
|
||||
@Api(tags = "首页统计controller")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("wecom/page/")
|
||||
public class WePageDataController {
|
||||
private final RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
public WePageDataController(RedisCache redisCache) {
|
||||
this.redisCache = redisCache;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiOperation(value = "数据总览controller", httpMethod = "GET")
|
||||
@GetMapping("/getCorpBasicData")
|
||||
public AjaxResult getCorpBasicData() {
|
||||
return AjaxResult.success(redisCache.getCacheMap(RedisKeyConstants.CORP_BASIC_DATA + LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "实时数据controller", httpMethod = "GET")
|
||||
@GetMapping("/getCorpRealTimeData")
|
||||
public AjaxResult getCorpRealTimeData() {
|
||||
WePageStaticDataDTO wePageStaticDataDto = redisCache.getCacheObject(RedisKeyConstants.CORP_REAL_TIME + LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(wePageStaticDataDto);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.dto.transfer.GetResignedTransferDetailDTO;
|
||||
import com.easyink.wecom.domain.dto.transfer.TransferResignedUserDTO;
|
||||
import com.easyink.wecom.domain.vo.transfer.GetResignedTransferCustomerDetailVO;
|
||||
import com.easyink.wecom.domain.vo.transfer.GetResignedTransferGroupDetailVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeResignedTransferRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类名: 离职继承记录接口 V3
|
||||
*
|
||||
* @author : silver_chariot
|
||||
* @date : 2021/12/6 14:36
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/resigned/transfer")
|
||||
@Api(tags = "离职继承记录接口V3")
|
||||
public class WeResignedTransferRecordController extends BaseController {
|
||||
|
||||
private final WeResignedTransferRecordService weResignedTransferRecordService;
|
||||
|
||||
@Autowired
|
||||
public WeResignedTransferRecordController(@NotNull WeResignedTransferRecordService weResignedTransferRecordService) {
|
||||
this.weResignedTransferRecordService = weResignedTransferRecordService;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("离职继承分配V3")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 3005, message = "接替成员不存在或未激活"),
|
||||
@ApiResponse(code = 3006, message = "该企业不存在可分配员工"),
|
||||
@ApiResponse(code = 3997, message = "该成员不存在可分配客户"),
|
||||
@ApiResponse(code = 4011, message = "指定的客户不可被分配"),
|
||||
@ApiResponse(code = 4012, message = "指定的群聊不可被分配"),
|
||||
@ApiResponse(code = 4013, message = "原跟进人与接手人一样,不可继承")
|
||||
})
|
||||
public AjaxResult transfer(@Validated @RequestBody TransferResignedUserDTO dto) {
|
||||
weResignedTransferRecordService.transfer(
|
||||
LoginTokenService.getLoginUser().getCorpId(),
|
||||
dto.getHandoverUserList(),
|
||||
dto.getTakeoverUserid(),
|
||||
dto.getChatId(),
|
||||
dto.getExternalUserid()
|
||||
);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("获取历史已分配客户详情列表V3")
|
||||
@GetMapping("/customerRecord")
|
||||
public TableDataInfo<GetResignedTransferCustomerDetailVO> customerRecord(@Validated GetResignedTransferDetailDTO dto) {
|
||||
startPage();
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<GetResignedTransferCustomerDetailVO> list = weResignedTransferRecordService.listOfCustomerRecord(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/groupRecord")
|
||||
@ApiOperation("获取历史已分配的客户群V3")
|
||||
public TableDataInfo<GetResignedTransferGroupDetailVO> groupRecord(@Validated GetResignedTransferDetailDTO dto ){
|
||||
startPage();
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<GetResignedTransferGroupDetailVO> list = weResignedTransferRecordService.listOfGroupRecord(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.RootEntity;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.common.utils.poi.ExcelUtil;
|
||||
import com.easyink.wecom.domain.WeSensitiveAct;
|
||||
import com.easyink.wecom.domain.WeSensitiveActHit;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeSensitiveActHitService;
|
||||
import com.easyink.wecom.service.WeSensitiveActService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 敏感行为管理接口
|
||||
*
|
||||
* @author admin
|
||||
* @version 1.0
|
||||
* @date 2021/1/12 18:07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/sensitive/act")
|
||||
@Api(tags = "敏感行为管理接口")
|
||||
public class WeSensitiveActController extends BaseController {
|
||||
private final WeSensitiveActService weSensitiveActService;
|
||||
private final WeSensitiveActHitService weSensitiveActHitService;
|
||||
|
||||
@Autowired
|
||||
public WeSensitiveActController(@NotNull WeSensitiveActService weSensitiveActService, @NotNull WeSensitiveActHitService weSensitiveActHitService) {
|
||||
this.weSensitiveActHitService = weSensitiveActHitService;
|
||||
this.weSensitiveActService = weSensitiveActService;
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:sensitiveact:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询敏感行为列表")
|
||||
public TableDataInfo list(WeSensitiveAct weSensitiveAct) {
|
||||
startPage();
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
if (StringUtils.isNotBlank(corpId)){
|
||||
weSensitiveAct.setCorpId(corpId);
|
||||
}
|
||||
List<WeSensitiveAct> list = weSensitiveActService.selectWeSensitiveActList(weSensitiveAct);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取敏感行为详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:sensitiveact:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取敏感行为详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(weSensitiveActService.selectWeSensitiveActById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增敏感行为设置
|
||||
* @Deprecated 该接口暂时未暴露给前端调用
|
||||
*/
|
||||
@Deprecated
|
||||
@PreAuthorize("@ss.hasPermi('wecom:sensitiveact:add')")
|
||||
@Log(title = "新增敏感行为", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增敏感行为设置")
|
||||
public AjaxResult add(@Valid @RequestBody WeSensitiveAct weSensitiveAct) {
|
||||
return weSensitiveActService.insertWeSensitiveAct(weSensitiveAct) ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改敏感词设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wecom:sensitiveact:edit')")
|
||||
@Log(title = "修改敏感行为", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改敏感词设置")
|
||||
public AjaxResult edit(@RequestBody WeSensitiveAct weSensitiveAct) {
|
||||
Long id = weSensitiveAct.getId();
|
||||
WeSensitiveAct originData = weSensitiveActService.selectWeSensitiveActById(id);
|
||||
if (originData == null) {
|
||||
return AjaxResult.error(ResultTip.TIP_GENERAL_NOT_FOUND, "数据不存在");
|
||||
}
|
||||
return weSensitiveActService.updateWeSensitiveAct(weSensitiveAct) ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除敏感词设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wecom:sensitiveact:remove')")
|
||||
@Log(title = "删除敏感行为", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除敏感词设置")
|
||||
public AjaxResult remove(@PathVariable("ids") String ids) {
|
||||
String[] id = ids.split(",");
|
||||
Long[] idArray = new Long[id.length];
|
||||
Arrays.stream(id).map(Long::parseLong).collect(Collectors.toList()).toArray(idArray);
|
||||
return weSensitiveActService.deleteWeSensitiveActByIds(idArray) ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 敏感词命中查询
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:sensitiveacthit:list')")
|
||||
@GetMapping("/hit/list")
|
||||
@ApiOperation("敏感词命中查询")
|
||||
public TableDataInfo hitList() {
|
||||
startPage();
|
||||
RootEntity rootEntity = new RootEntity();
|
||||
rootEntity.getParams().put("corpId", LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeSensitiveActHit> list = weSensitiveActHitService.selectWeSensitiveActHitList(rootEntity);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出敏感行为记录
|
||||
* @Deprecated 暂未使用
|
||||
*/
|
||||
@Deprecated
|
||||
// @PreAuthorize("@ss.hasPermi('wecom:sensitiveacthit:export')")
|
||||
@PostMapping("/hit/export")
|
||||
@ApiOperation("导出敏感行为记录")
|
||||
public AjaxResult export() {
|
||||
List<WeSensitiveActHit> list = weSensitiveActHitService.list();
|
||||
ExcelUtil<WeSensitiveActHit> util = new ExcelUtil<>(WeSensitiveActHit.class);
|
||||
return util.exportExcel(list, "敏感行为记录");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.ResultTip;
|
||||
import com.easyink.wecom.domain.WeSensitive;
|
||||
import com.easyink.wecom.domain.query.WeSensitiveHitQuery;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeSensitiveService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 敏感词Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2020-12-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/sensitive")
|
||||
@Api(tags = "敏感词管理")
|
||||
public class WeSensitiveController extends BaseController {
|
||||
@Autowired
|
||||
private WeSensitiveService weSensitiveService;
|
||||
|
||||
/**
|
||||
* 查询敏感词设置列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询敏感词列表")
|
||||
public TableDataInfo list(WeSensitive weSensitive) {
|
||||
startPage();
|
||||
weSensitive.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeSensitive> list = weSensitiveService.selectWeSensitiveList(weSensitive);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取敏感词设置详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("查询敏感词详情")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(weSensitiveService.selectWeSensitiveById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增敏感词设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wecom:sensitive:add')")
|
||||
@Log(title = "敏感词设置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加敏感词")
|
||||
public AjaxResult add(@Valid @RequestBody WeSensitive weSensitive) {
|
||||
weSensitive.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return toAjax(weSensitiveService.insertWeSensitive(weSensitive));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改敏感词设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wecom:sensitive:edit')")
|
||||
@Log(title = "敏感词设置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改敏感词")
|
||||
public AjaxResult edit(@Valid @RequestBody WeSensitive weSensitive) {
|
||||
Long id = weSensitive.getId();
|
||||
WeSensitive originData = weSensitiveService.selectWeSensitiveById(id);
|
||||
if (originData == null) {
|
||||
return AjaxResult.error(ResultTip.TIP_GENERAL_NOT_FOUND, "数据不存在");
|
||||
}
|
||||
weSensitive.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return toAjax(weSensitiveService.updateWeSensitive(weSensitive));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除敏感词设置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wecom:sensitive:remove')")
|
||||
@Log(title = "敏感词设置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除敏感词")
|
||||
public AjaxResult remove(@PathVariable("ids") String ids) {
|
||||
String[] id = ids.split(",");
|
||||
Long[] idArray = new Long[id.length];
|
||||
Arrays.stream(id).map(Long::parseLong).collect(Collectors.toList()).toArray(idArray);
|
||||
return toAjax(weSensitiveService.destroyWeSensitiveByIds(idArray));
|
||||
}
|
||||
|
||||
/**
|
||||
* 敏感词命中查询
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wecom:sensitive:list')")
|
||||
@GetMapping("/hit/list")
|
||||
@ApiOperation("敏感词命中查询")
|
||||
public TableDataInfo hitList(WeSensitiveHitQuery query) {
|
||||
return getDataTable(weSensitiveService.getHitSensitiveList(query, LoginTokenService.getLoginUser()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.Constants;
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.wecom.domain.WeTag;
|
||||
import com.easyink.wecom.domain.WeTagGroup;
|
||||
import com.easyink.wecom.domain.dto.statistics.WeTagStatisticsDTO;
|
||||
import com.easyink.wecom.domain.dto.tag.WeGroupTagDTO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.mapper.WeTagMapper;
|
||||
import com.easyink.wecom.service.WeTagGroupService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 标签组Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2020-09-07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/group")
|
||||
@Api(tags = "标签组相关接口")
|
||||
public class WeTagGroupController extends BaseController {
|
||||
@Autowired
|
||||
private WeTagGroupService weTagGroupService;
|
||||
|
||||
@Autowired
|
||||
private WeTagMapper weTagMapper;
|
||||
|
||||
/**
|
||||
* 查询标签组列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询标签列表")
|
||||
public TableDataInfo list(WeTagGroup weTagGroup) {
|
||||
startPage();
|
||||
weTagGroup.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weTagGroupService.selectWeTagGroupList(weTagGroup));
|
||||
}
|
||||
|
||||
@GetMapping("/totalTagCnt")
|
||||
@ApiOperation("企业未删除标签总数")
|
||||
public AjaxResult totalTagCnt(){
|
||||
WeTagStatisticsDTO weTagStatisticsDTO =new WeTagStatisticsDTO();
|
||||
weTagStatisticsDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weTagMapper.totalTagCnt(weTagStatisticsDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有标签组信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/tagGroupList")
|
||||
@ApiOperation("查询所有标签组信息")
|
||||
public TableDataInfo tagGroupList() {
|
||||
return getDataTable(weTagGroupService.findWeTagGroupList(LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询标签组是否存在
|
||||
*
|
||||
* @param tagGroupName
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/checkTagGroupName")
|
||||
@ApiOperation("查询标签组是否已存在")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 500, message = "请求参数为空")
|
||||
})
|
||||
public AjaxResult<WeGroupTagDTO> checkTagGroupName(@ApiParam(name = "tagGroupName", value = "标签组名", required = true) String tagGroupName) {
|
||||
//状态码
|
||||
int repeat = 0;
|
||||
if (tagGroupName == null || StringUtils.isEmpty(tagGroupName)) {
|
||||
return AjaxResult.error("tagGroupName不能为空");
|
||||
}
|
||||
//查询是否存在标签名为tagGroupName且是正常状态的群组
|
||||
int count = weTagGroupService.count(new LambdaQueryWrapper<WeTagGroup>()
|
||||
.eq(WeTagGroup::getGroupName, tagGroupName)
|
||||
.eq(WeTagGroup::getCorpId, LoginTokenService.getLoginUser().getCorpId())
|
||||
.eq(WeTagGroup::getStatus, Constants.NORMAL_CODE));
|
||||
|
||||
//如果大于1则是存在数据库
|
||||
if (count > 0) {
|
||||
repeat = 1;
|
||||
}
|
||||
|
||||
//创建返回参数返回
|
||||
return AjaxResult.success(WeGroupTagDTO.builder().repeat(repeat).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增标签组
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:tag:add')")
|
||||
@Log(title = "标签组", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增标签组")
|
||||
public AjaxResult add(@Validated @RequestBody WeTagGroup weTagGroup) {
|
||||
|
||||
//校验标签组名称与标签名称是否相同
|
||||
if (StrUtil.isNotBlank(weTagGroup.getGroupName())) {
|
||||
List<WeTag> weTags = weTagGroup.getWeTags();
|
||||
if (CollUtil.isNotEmpty(weTags) && weTags.stream().anyMatch(m -> m.getName().equals(weTagGroup.getGroupName()))) {
|
||||
return AjaxResult.error("标签组名称与标签名不可重复");
|
||||
}
|
||||
}
|
||||
weTagGroup.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weTagGroupService.insertWeTagGroup(weTagGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改标签组
|
||||
*/
|
||||
@ApiOperation("修改标签组")
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:tag:edit')")
|
||||
@Log(title = "标签组", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody WeTagGroup weTagGroup) {
|
||||
weTagGroup.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weTagGroupService.updateWeTagGroup(weTagGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除标签组
|
||||
*/
|
||||
@ApiOperation("删除标签组")
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:tag:remove')")
|
||||
@Log(title = "标签组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(weTagGroupService.deleteWeTagGroupByIds(ids, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步标签
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("同步标签")
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:tag:sync')")
|
||||
@GetMapping("/synchWeTags")
|
||||
public AjaxResult synchWeTags() {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
//异步同步一下标签库,解决标签不同步问题
|
||||
weTagGroupService.synchWeTags(loginUser.getCorpId());
|
||||
|
||||
return AjaxResult.success(WeConstans.SYNCH_TIP);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.redis.RedisCache;
|
||||
import com.easyink.common.utils.StringUtils;
|
||||
import com.easyink.common.utils.wecom.TicketUtils;
|
||||
import com.easyink.wecom.client.WeTicketClient;
|
||||
import com.easyink.wecom.domain.WeH5TicketDto;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @description h5 ticket校验接口
|
||||
* @date 2021/1/6 11:23
|
||||
**/
|
||||
@Slf4j
|
||||
@RequestMapping(value = "/wecom/ticket/")
|
||||
@Api(tags = "h5 ticket校验接口")
|
||||
@RestController
|
||||
public class WeTicketController extends BaseController {
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
@Autowired
|
||||
private WeTicketClient weTicketClient;
|
||||
|
||||
|
||||
/**
|
||||
* 获取企业的jsapi_ticket
|
||||
*
|
||||
* @param url JS接口页面的完整URL
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取企业的jsapi_ticket")
|
||||
@GetMapping("/getAppTicket")
|
||||
public AjaxResult getAppTicket(String url, String agentId) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
String key = WeConstans.APP_TICKET_KEY + ":" + corpId + ":" + agentId;
|
||||
String ticketVaule = redisCache.getCacheObject(key);
|
||||
if (StringUtils.isEmpty(ticketVaule)) {
|
||||
WeH5TicketDto ticketRes = weTicketClient.getJsapiTicket(agentId, LoginTokenService.getLoginUser().getCorpId());
|
||||
if (ticketRes != null && StringUtils.isNotEmpty(ticketRes.getTicket())) {
|
||||
redisCache.setCacheObject(key, ticketRes.getTicket(), ticketRes.getExpiresIn(), TimeUnit.SECONDS);
|
||||
ticketVaule = ticketRes.getTicket();
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(TicketUtils.getSignatureMap(ticketVaule, url));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用的jsapi_ticket
|
||||
*
|
||||
* @param url JS接口页面的完整URL
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取应用的jsapi_ticket")
|
||||
@GetMapping("/getAgentTicket")
|
||||
public AjaxResult getAgentTicket(String url, String agentId) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
String key = WeConstans.AGENT_TICKET_KEY + ":" + corpId + ":" + agentId;
|
||||
String ticketVaule = redisCache.getCacheObject(key);
|
||||
if (StringUtils.isEmpty(ticketVaule)) {
|
||||
WeH5TicketDto ticketRes = weTicketClient.getTicket("agent_config", agentId, LoginTokenService.getLoginUser().getCorpId());
|
||||
if (ticketRes != null && StringUtils.isNotEmpty(ticketRes.getTicket())) {
|
||||
redisCache.setCacheObject(key, ticketRes.getTicket(), ticketRes.getExpiresIn(), TimeUnit.SECONDS);
|
||||
ticketVaule = ticketRes.getTicket();
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(TicketUtils.getSignatureMap(ticketVaule, url));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,275 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.core.domain.wecom.WeUser;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.token.TokenService;
|
||||
import com.easyink.common.utils.ServletUtils;
|
||||
import com.easyink.common.utils.spring.SpringUtils;
|
||||
import com.easyink.wecom.annotation.Convert2Cipher;
|
||||
import com.easyink.wecom.domain.vo.AllocateLeaveUserResp;
|
||||
import com.easyink.wecom.domain.WeUserRole;
|
||||
import com.easyink.wecom.domain.dto.BatchUpdateUserInfoDTO;
|
||||
import com.easyink.wecom.domain.dto.QueryUserDTO;
|
||||
import com.easyink.wecom.domain.dto.transfer.TransferResignedUserListDTO;
|
||||
import com.easyink.wecom.domain.vo.*;
|
||||
import com.easyink.wecom.domain.vo.transfer.TransferResignedUserVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeDepartmentService;
|
||||
import com.easyink.wecom.service.WeResignedTransferRecordService;
|
||||
import com.easyink.wecom.service.WeUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 通讯录相关客户Controller
|
||||
*
|
||||
* @author admin
|
||||
* @date 2020-08-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/user")
|
||||
@Api(tags = "通讯录人员接口")
|
||||
@Slf4j
|
||||
public class WeUserController extends BaseController {
|
||||
|
||||
|
||||
private final WeUserService weUserService;
|
||||
private final WeDepartmentService weDepartmentService;
|
||||
private final WeResignedTransferRecordService weResignedTransferRecordService;
|
||||
|
||||
@Autowired
|
||||
@Lazy
|
||||
public WeUserController(WeUserService weUserService,WeDepartmentService weDepartmentService, WeResignedTransferRecordService weResignedTransferRecordService) {
|
||||
this.weUserService = weUserService;
|
||||
this.weDepartmentService = weDepartmentService;
|
||||
this.weResignedTransferRecordService = weResignedTransferRecordService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询员工信息
|
||||
* @param queryUserDTO 查询条件
|
||||
* @return TableDataInfo
|
||||
*/
|
||||
@GetMapping("/listOfUser")
|
||||
@ApiOperation("查询员工信息")
|
||||
public TableDataInfo<WeUserVO> listOfUser(@Validated QueryUserDTO queryUserDTO) {
|
||||
startPage();
|
||||
queryUserDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weUserService.listOfUser(queryUserDTO));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getUser")
|
||||
@ApiOperation("查询单个员工信息")
|
||||
public AjaxResult<WeUserVO> getUser(String userId) {
|
||||
return AjaxResult.success(weUserService.getUser(LoginTokenService.getLoginUser().getCorpId(), userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询员工详情列表 (需要校验数据权限)
|
||||
*
|
||||
* @param weUser
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获取员工详细信息列表")
|
||||
public TableDataInfo<WeUser> list(WeUser weUser) {
|
||||
startPage();
|
||||
weUser.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeUser> list = weUserService.selectWeUserList(weUser);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询员工简短信息列表 (无需校验功能权限和数据权限 )
|
||||
*
|
||||
* @param weUser
|
||||
* @return 所有员工 userId和name的集合
|
||||
*/
|
||||
@GetMapping("/briefList")
|
||||
@ApiOperation("获取员工id和名字列表")
|
||||
public TableDataInfo<WeUserBriefInfoVO> briefList(WeUser weUser) {
|
||||
startPage();
|
||||
weUser.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<WeUserBriefInfoVO> list = weUserService.selectWeUserBriefInfo(weUser);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取通讯录相关客户详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{userId}")
|
||||
@ApiOperation("获取通讯录相关客户详细信息")
|
||||
@Convert2Cipher
|
||||
public AjaxResult getInfo(@PathVariable("userId") String userId) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
return AjaxResult.success(weUserService.selectWeUserById(loginUser.getCorpId(), userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通讯录相关客户
|
||||
*/
|
||||
@Log(title = "新增成员", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增成员")
|
||||
public AjaxResult add(@Validated @RequestBody WeUser weUser) {
|
||||
weUser.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weUserService.insertWeUser(weUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/getJoinQrCode")
|
||||
@ApiOperation("获取加入企业二维码")
|
||||
public AjaxResult<String> getJoinQrCode() {
|
||||
return AjaxResult.success(
|
||||
"获取成功",weUserService.getJoinQrCode(LoginTokenService.getLoginUser().getCorpId())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改员工
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('contacts:organization:edit')")
|
||||
@Log(title = "修改员工信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改员工信息")
|
||||
public AjaxResult edit(@Validated @RequestBody WeUser weUser) {
|
||||
weUser.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weUserService.updateWeUser(weUser);
|
||||
if (weUser.getRoleId() != null){
|
||||
WeUserRole weUserRole = new WeUserRole();
|
||||
BeanUtils.copyProperties(weUser,weUserRole);
|
||||
weUserService.updateUserRole(weUserRole);
|
||||
}
|
||||
//修改员工信息后 刷新数据权限范围
|
||||
LoginTokenService.refreshDataScope();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新员工登录账号信息
|
||||
*
|
||||
* @param weUser 员工信息
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@PostMapping("/editUserAccount")
|
||||
@ApiOperation("更新员工登录账号信息")
|
||||
public AjaxResult editUserAccount(@Validated @RequestBody WeUser weUser) {
|
||||
weUser.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weUserService.updateWeUser(weUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 启用或者禁止
|
||||
*
|
||||
* @param weUser
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('contacts:organization:forbidden')")
|
||||
@Log(title = "启用禁用用户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/startOrStop")
|
||||
@ApiOperation("是否启用(1表示启用成员,0表示禁用成员)")
|
||||
public AjaxResult startOrStop(@RequestBody WeUser weUser) {
|
||||
weUser.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weUserService.startOrStop(weUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 离职已分配 V3
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/v3/leaveUserAllocateList")
|
||||
@ApiOperation("离职已分配员工列表V3")
|
||||
public TableDataInfo<TransferResignedUserVO> leaveUserAllocateListV3(TransferResignedUserListDTO dto) {
|
||||
startPage();
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return getDataTable(weResignedTransferRecordService.listOfRecord(dto));
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/v3/leaveUserNoAllocateList")
|
||||
@ApiOperation("获取离职未分配离职员工V3")
|
||||
public TableDataInfo<TransferResignedUserVO> leaveUserListV3(@Validated TransferResignedUserListDTO dto) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
dto.setCorpId(loginUser.getCorpId());
|
||||
return getDataTable(weUserService.leaveUserListV3(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步成员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('contacts:organization:sync')")
|
||||
@GetMapping({"/synchWeUser"})
|
||||
@ApiOperation("同步成员")
|
||||
public AjaxResult syncWeUser() {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
// 1. 同步部门 (同步执行)
|
||||
String userKey = SpringUtils.getBean(TokenService.class).getUserKey(ServletUtils.getRequest());
|
||||
weDepartmentService.synchWeDepartment(loginUser.getCorpId(),userKey);
|
||||
// 2. 同步成员 (异步执行)
|
||||
weUserService.syncWeUser(loginUser.getCorpId(), loginUser);
|
||||
return AjaxResult.success(WeConstans.SYNCH_TIP);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('contacts:organization:removeMember')")
|
||||
@DeleteMapping({"/{ids}"})
|
||||
@ApiOperation("删除客户")
|
||||
public AjaxResult deleteUser(@PathVariable String[] ids) {
|
||||
weUserService.deleteUser(LoginTokenService.getLoginUser().getCorpId(), ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 内部应用获取用户userId
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getUserInfo")
|
||||
@ApiOperation("内部应用获取用户userId")
|
||||
public AjaxResult getUserInfo(String code, String agentId) {
|
||||
WeUserInfoVO userInfo = weUserService.getUserInfo(code, agentId, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(userInfo);
|
||||
}
|
||||
|
||||
@PostMapping("/batchUpdateUserInfo")
|
||||
@ApiOperation("批量修改员工信息")
|
||||
public AjaxResult<BatchUpdateUserInfoVO> batchUpdateUserInfo(@Validated @RequestBody BatchUpdateUserInfoDTO batchUpdateUserInfoDTO) {
|
||||
batchUpdateUserInfoDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weUserService.batchUpdateUserInfo(batchUpdateUserInfoDTO));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.domain.model.LoginUser;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.common.enums.WeWordsCategoryTypeEnum;
|
||||
import com.easyink.wecom.domain.dto.wordscategory.*;
|
||||
import com.easyink.wecom.domain.vo.WeWordsCategoryVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeWordsCategoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 类名: WeWordsCategoryController
|
||||
*
|
||||
* @author: Society my sister Li
|
||||
* @date: 2021-10-25 10:32
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/wordscategory")
|
||||
@Api(value = "WeWordsCategoryController", tags = "企业话术库文件夹接口")
|
||||
public class WeWordsCategoryController extends BaseController {
|
||||
|
||||
private final WeWordsCategoryService weWordsCategoryService;
|
||||
|
||||
@Autowired
|
||||
public WeWordsCategoryController(WeWordsCategoryService weWordsCategoryService) {
|
||||
this.weWordsCategoryService = weWordsCategoryService;
|
||||
}
|
||||
|
||||
@Log(title = "新增文件夹", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增文件夹")
|
||||
public AjaxResult add(@Validated @RequestBody AddWeWordsCategoryDTO weWordsCategory) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
weWordsCategory.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weWordsCategoryService.insert(loginUser, weWordsCategory);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "修改文件夹", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改文件夹")
|
||||
public AjaxResult update(@Validated @RequestBody UpdateWeWordsCategoryDTO updateWeWordsCategoryDTO) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
updateWeWordsCategoryDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weWordsCategoryService.update(loginUser, updateWeWordsCategoryDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "删除文件夹", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除文件夹")
|
||||
public AjaxResult delete(@Validated @RequestBody DeleteWeWordsCategoryDTO deleteWeWordsCategoryDTO) {
|
||||
deleteWeWordsCategoryDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weWordsCategoryService.delete(deleteWeWordsCategoryDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "查询列表", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询列表")
|
||||
public AjaxResult<WeWordsCategoryVO> list(@Validated FindWeWordsCategoryDTO findWeWordsCategoryDTO) {
|
||||
LoginUser loginUser = LoginTokenService.getLoginUser();
|
||||
Integer type = findWeWordsCategoryDTO.getType();
|
||||
//设置权限范围,若为admin则 不能查询部门和个人文件夹
|
||||
if (WeWordsCategoryTypeEnum.CORP.getType().equals(type)) {
|
||||
findWeWordsCategoryDTO.setUseRange(WeConstans.WE_ROOT_DEPARMENT_ID.toString());
|
||||
} else {
|
||||
if (loginUser.getWeUser() == null) {
|
||||
return AjaxResult.success(new ArrayList());
|
||||
}
|
||||
if (WeWordsCategoryTypeEnum.DEPARTMENT.getType().equals(type)) {
|
||||
findWeWordsCategoryDTO.setUseRange(loginUser.getWeUser().getMainDepartment().toString());
|
||||
} else {
|
||||
findWeWordsCategoryDTO.setUseRange(loginUser.getWeUser().getUserId());
|
||||
}
|
||||
}
|
||||
findWeWordsCategoryDTO.setCorpId(loginUser.getCorpId());
|
||||
return AjaxResult.success(weWordsCategoryService.list(findWeWordsCategoryDTO));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "文件夹上移/下移/置顶", businessType = BusinessType.OTHER)
|
||||
@PutMapping("/changeSort")
|
||||
@ApiOperation("文件夹上移/下移/置顶")
|
||||
public AjaxResult changeSort(@Validated @RequestBody WeWordsCategoryChangeSortDTO weWordsCategoryChangeSortDTO) {
|
||||
weWordsCategoryChangeSortDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weWordsCategoryService.changeSort(weWordsCategoryChangeSortDTO));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
package com.easyink.web.controller.wecom;
|
||||
|
||||
import com.easyink.common.constant.WeConstans;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.WeWordsGroupEntity;
|
||||
import com.easyink.wecom.domain.WeWordsLastUseEntity;
|
||||
import com.easyink.wecom.domain.dto.WeWordsDTO;
|
||||
import com.easyink.wecom.domain.dto.WeWordsDelDTO;
|
||||
import com.easyink.wecom.domain.dto.WeWordsQueryDTO;
|
||||
import com.easyink.wecom.domain.dto.WeWordsSortDTO;
|
||||
import com.easyink.wecom.domain.dto.tag.WeWordsModifyCategoryDTO;
|
||||
import com.easyink.wecom.domain.vo.WeWordsUrlVO;
|
||||
import com.easyink.wecom.domain.vo.WeWordsVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.WeWordsGroupService;
|
||||
import com.easyink.wecom.service.WeWordsLastUseService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 类名: 企业话术库接口
|
||||
*
|
||||
* @author 佚名
|
||||
* @date 2021/10/28 14:51
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/wordsGroup")
|
||||
@Slf4j
|
||||
@Api(value = "WeWordsGroupController", tags = "企业话术库接口")
|
||||
public class WeWordsGroupController extends BaseController {
|
||||
private final WeWordsGroupService weWordsGroupService;
|
||||
private final WeWordsLastUseService weWordsLastUseService;
|
||||
|
||||
public WeWordsGroupController(WeWordsGroupService weWordsGroupService, WeWordsLastUseService weWordsLastUseService) {
|
||||
this.weWordsGroupService = weWordsGroupService;
|
||||
this.weWordsLastUseService = weWordsLastUseService;
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("添加")
|
||||
public AjaxResult add(@Validated @RequestBody WeWordsDTO weWordsDTO) {
|
||||
weWordsDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
//非admin 设置员工主部门
|
||||
if (!LoginTokenService.getLoginUser().isSuperAdmin()) {
|
||||
weWordsDTO.setMainDepartment(LoginTokenService.getLoginUser().getWeUser().getMainDepartment());
|
||||
}
|
||||
weWordsGroupService.add(weWordsDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除")
|
||||
public AjaxResult delete(@Validated @RequestBody WeWordsDelDTO weWordsDelDTO) {
|
||||
weWordsGroupService.delete(weWordsDelDTO.getIds(), LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改")
|
||||
public AjaxResult update(@Validated @RequestBody WeWordsDTO weWordsDTO) {
|
||||
weWordsDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
if (!LoginTokenService.getLoginUser().isSuperAdmin()) {
|
||||
weWordsDTO.setMainDepartment(LoginTokenService.getLoginUser().getWeUser().getMainDepartment());
|
||||
}
|
||||
weWordsGroupService.update(weWordsDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/listOfWords")
|
||||
@ApiOperation("查询")
|
||||
public TableDataInfo<WeWordsVO> listOfWords(@Validated @RequestBody WeWordsQueryDTO weWordsQueryDTO) {
|
||||
weWordsQueryDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
if (weWordsQueryDTO.getPageSize() != null) {
|
||||
if (weWordsQueryDTO.getPageNum() == null) {
|
||||
weWordsQueryDTO.setPageNum(WeConstans.FIRST_PAGE);
|
||||
}
|
||||
if (weWordsQueryDTO.getId() != null) {
|
||||
WeWordsGroupEntity weWordsGroupEntity = weWordsGroupService.get(weWordsQueryDTO.getId());
|
||||
weWordsQueryDTO.setSort(weWordsGroupEntity.getSort());
|
||||
}
|
||||
PageHelper.startPage(weWordsQueryDTO.getPageNum(), weWordsQueryDTO.getPageSize());
|
||||
}
|
||||
return getDataTable(weWordsGroupService.listOfWords(weWordsQueryDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/updateCategory")
|
||||
@ApiOperation("批量修改所属文件夹")
|
||||
public AjaxResult updateCategory(@Validated @RequestBody WeWordsModifyCategoryDTO weWordsModifyCategoryDTO) {
|
||||
weWordsGroupService.updateCategory(weWordsModifyCategoryDTO.getCategoryId(), weWordsModifyCategoryDTO.getIds(), LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/importWords")
|
||||
@ApiOperation("导入话术")
|
||||
public AjaxResult importWords(MultipartFile file, @RequestParam("type") Integer type) {
|
||||
return AjaxResult.success(weWordsGroupService.importWords(file, LoginTokenService.getLoginUser(), type));
|
||||
}
|
||||
|
||||
@PostMapping("/addOrUpdateLastUse")
|
||||
@ApiOperation("保存或更新最近使用")
|
||||
public AjaxResult addOrUpdateLastUse(@RequestBody WeWordsLastUseEntity weWordsLastUseEntity) {
|
||||
weWordsLastUseEntity.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
String userId;
|
||||
if (LoginTokenService.getLoginUser().isSuperAdmin()) {
|
||||
userId = LoginTokenService.getLoginUser().getUsername();
|
||||
} else {
|
||||
userId = LoginTokenService.getLoginUser().getWeUser().getUserId();
|
||||
}
|
||||
weWordsLastUseEntity.setUserId(userId);
|
||||
weWordsLastUseService.addOrUpdateLastUse(weWordsLastUseEntity);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/getLastUse")
|
||||
@ApiOperation("查询最近使用")
|
||||
public AjaxResult<WeWordsGroupEntity> getLastUse(@RequestParam("type") Integer type) {
|
||||
String userId;
|
||||
if (LoginTokenService.getLoginUser().isSuperAdmin()) {
|
||||
userId = LoginTokenService.getLoginUser().getUsername();
|
||||
} else {
|
||||
userId = LoginTokenService.getLoginUser().getWeUser().getUserId();
|
||||
}
|
||||
return AjaxResult.success(weWordsLastUseService.listOfWordsVO(userId, LoginTokenService.getLoginUser().getCorpId(), type));
|
||||
}
|
||||
|
||||
@GetMapping("/getUrlContent")
|
||||
@ApiOperation("获取链接信息")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 2035, message = "话术库获取链接内容失败")
|
||||
})
|
||||
public AjaxResult<WeWordsUrlVO> getUrlContent(@RequestParam("url") String url) {
|
||||
return AjaxResult.success(weWordsGroupService.matchUrl(url));
|
||||
}
|
||||
|
||||
@PostMapping("/changeSort")
|
||||
@ApiOperation("修改排序")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 2036, message = "话术库缺少排序号、话术id,修改失败")
|
||||
})
|
||||
public AjaxResult changeSort(@RequestBody WeWordsSortDTO weWordsSortDTO) {
|
||||
weWordsSortDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weWordsGroupService.changeSort(weWordsSortDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
package com.easyink.web.controller.wecom.autotag;
|
||||
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.dto.autotag.TagRuleBatchStatusDTO;
|
||||
import com.easyink.wecom.domain.dto.autotag.TagRuleDeleteDTO;
|
||||
import com.easyink.wecom.domain.dto.autotag.customer.AddCustomerTagRuleDTO;
|
||||
import com.easyink.wecom.domain.dto.autotag.customer.UpdateCustomerTagRuleDTO;
|
||||
import com.easyink.wecom.domain.dto.autotag.group.AddGroupTagRuleDTO;
|
||||
import com.easyink.wecom.domain.dto.autotag.group.UpdateGroupTagRuleDTO;
|
||||
import com.easyink.wecom.domain.dto.autotag.keyword.AddKeywordTagRuleDTO;
|
||||
import com.easyink.wecom.domain.dto.autotag.keyword.UpdateKeywordTagRuleDTO;
|
||||
import com.easyink.wecom.domain.query.autotag.RuleInfoQuery;
|
||||
import com.easyink.wecom.domain.query.autotag.TagRuleQuery;
|
||||
import com.easyink.wecom.domain.vo.autotag.TagRuleListVO;
|
||||
import com.easyink.wecom.domain.vo.autotag.customer.TagRuleCustomerInfoVO;
|
||||
import com.easyink.wecom.domain.vo.autotag.group.TagRuleGroupInfoVO;
|
||||
import com.easyink.wecom.domain.vo.autotag.keyword.TagRuleKeywordInfoVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.autotag.WeAutoTagRuleService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 标签规则表(WeAutoTagRule)表控制层
|
||||
*
|
||||
* @author tigger
|
||||
* @since 2022-02-27 15:52:39
|
||||
*/
|
||||
@Api(tags = "自动标签规则")
|
||||
@RestController
|
||||
@RequestMapping("wecom/auto/tag/rule")
|
||||
public class WeAutoTagRuleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WeAutoTagRuleService weAutoTagRuleService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:autoLabel:list')")
|
||||
@ApiOperation("关键词规则列表")
|
||||
@PostMapping("keyword/list")
|
||||
public TableDataInfo<TagRuleListVO> listKeyword(@RequestBody TagRuleQuery query) {
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
startPage();
|
||||
List<TagRuleListVO> list = weAutoTagRuleService.listKeyword(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:autoLabel:list')")
|
||||
@ApiOperation("群规则列表")
|
||||
@PostMapping("group/list")
|
||||
public TableDataInfo<TagRuleListVO> listGroup(@RequestBody TagRuleQuery query) {
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
startPage();
|
||||
List<TagRuleListVO> list = weAutoTagRuleService.listGroup(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('customerManage:autoLabel:list')")
|
||||
@ApiOperation("新客规则列表")
|
||||
@PostMapping("customer/list")
|
||||
public TableDataInfo<TagRuleListVO> listCustomer(@RequestBody TagRuleQuery query) {
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
startPage();
|
||||
List<TagRuleListVO> list = weAutoTagRuleService.listCustomer(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@ApiOperation("关键词规则详情")
|
||||
@GetMapping("keyword/info")
|
||||
public AjaxResult<TagRuleKeywordInfoVO> keywordInfo(RuleInfoQuery query) {
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weAutoTagRuleService.keywordInfo(query));
|
||||
}
|
||||
|
||||
@ApiOperation("群规则详情")
|
||||
@GetMapping("group/info")
|
||||
public AjaxResult<TagRuleGroupInfoVO> groupInfo(RuleInfoQuery query) {
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weAutoTagRuleService.groupInfo(query));
|
||||
}
|
||||
|
||||
@ApiOperation("新客规则详情")
|
||||
@GetMapping("customer/info")
|
||||
public AjaxResult<TagRuleCustomerInfoVO> customerInfo(RuleInfoQuery query) {
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weAutoTagRuleService.customerInfo(query));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:autotag:add')")
|
||||
@ApiOperation("关键词规则新增")
|
||||
@PostMapping("keyword/add")
|
||||
public AjaxResult keywordAdd(@RequestBody AddKeywordTagRuleDTO addKeywordTagRuleDTO) {
|
||||
if (LoginTokenService.getLoginUser().isSuperAdmin()) {
|
||||
addKeywordTagRuleDTO.setCreateBy(LoginTokenService.getUsername());
|
||||
} else {
|
||||
addKeywordTagRuleDTO.setCreateBy(LoginTokenService.getLoginUser().getWeUser().getUserId());
|
||||
}
|
||||
addKeywordTagRuleDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return toAjax(weAutoTagRuleService.keywordAdd(addKeywordTagRuleDTO));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:autotag:add')")
|
||||
@ApiOperation("入群规则新增")
|
||||
@PostMapping("group/add")
|
||||
public AjaxResult groupAdd(@RequestBody AddGroupTagRuleDTO addGroupTagRuleDTO) {
|
||||
if (LoginTokenService.getLoginUser().isSuperAdmin()) {
|
||||
addGroupTagRuleDTO.setCreateBy(LoginTokenService.getUsername());
|
||||
} else {
|
||||
addGroupTagRuleDTO.setCreateBy(LoginTokenService.getLoginUser().getWeUser().getUserId());
|
||||
}
|
||||
addGroupTagRuleDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return toAjax(weAutoTagRuleService.groupAdd(addGroupTagRuleDTO));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:autotag:add')")
|
||||
@ApiOperation("新客规则新增")
|
||||
@PostMapping("customer/add")
|
||||
public AjaxResult customerAdd(@RequestBody AddCustomerTagRuleDTO addCustomerTagRuleDTO) {
|
||||
addCustomerTagRuleDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
if (LoginTokenService.getLoginUser().isSuperAdmin()) {
|
||||
addCustomerTagRuleDTO.setCreateBy(LoginTokenService.getUsername());
|
||||
} else {
|
||||
addCustomerTagRuleDTO.setCreateBy(LoginTokenService.getLoginUser().getWeUser().getUserId());
|
||||
}
|
||||
return toAjax(weAutoTagRuleService.customerAdd(addCustomerTagRuleDTO));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:autotag:edit')")
|
||||
@ApiOperation("关键词规则修改")
|
||||
@PutMapping("keyword/edit")
|
||||
public AjaxResult keywordEdit(@RequestBody UpdateKeywordTagRuleDTO updateKeywordTagRuleDTO) {
|
||||
return toAjax(weAutoTagRuleService.keywordEdit(updateKeywordTagRuleDTO, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:autotag:edit')")
|
||||
@ApiOperation("入群规则修改")
|
||||
@PutMapping("group/edit")
|
||||
public AjaxResult groupEdit(@RequestBody UpdateGroupTagRuleDTO updateGroupTagRuleDTO) {
|
||||
return toAjax(weAutoTagRuleService.groupEdit(updateGroupTagRuleDTO, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:autotag:edit')")
|
||||
@ApiOperation("新客规则修改")
|
||||
@PutMapping("customer/edit")
|
||||
public AjaxResult customerEdit(@RequestBody UpdateCustomerTagRuleDTO updateCustomerTagRuleDTO) {
|
||||
return toAjax(weAutoTagRuleService.customerEdit(updateCustomerTagRuleDTO, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wecom:autotag:del')")
|
||||
@ApiOperation("关键词规则删除")
|
||||
@DeleteMapping("keyword/remove")
|
||||
public AjaxResult keywordDelete(@Validated @RequestBody TagRuleDeleteDTO deleteDTO) {
|
||||
return toAjax(weAutoTagRuleService.keywordDelete(deleteDTO, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:autotag:del')")
|
||||
@ApiOperation("入群规则删除")
|
||||
@DeleteMapping("group/remove")
|
||||
public AjaxResult groupDelete(@Validated @RequestBody TagRuleDeleteDTO deleteDTO) {
|
||||
return toAjax(weAutoTagRuleService.groupDelete(deleteDTO, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:autotag:del')")
|
||||
@ApiOperation("新客规则删除")
|
||||
@DeleteMapping("customer/remove")
|
||||
public AjaxResult customerDelete(@Validated @RequestBody TagRuleDeleteDTO deleteDTO) {
|
||||
return toAjax(weAutoTagRuleService.customerDelete(deleteDTO, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:autotag:enable')")
|
||||
@ApiOperation("批量启用禁用")
|
||||
@PostMapping("batch/status")
|
||||
public AjaxResult batchStatus(@Validated @RequestBody TagRuleBatchStatusDTO tagRuleBatchStatusDTO) {
|
||||
tagRuleBatchStatusDTO.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
weAutoTagRuleService.batchStatus(tagRuleBatchStatusDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.easyink.web.controller.wecom.autotag;
|
||||
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.query.autotag.CustomerTagRuleRecordQuery;
|
||||
import com.easyink.wecom.domain.query.autotag.GroupTagRuleRecordQuery;
|
||||
import com.easyink.wecom.domain.query.autotag.TagRuleRecordKeywordDetailQuery;
|
||||
import com.easyink.wecom.domain.query.autotag.TagRuleRecordQuery;
|
||||
import com.easyink.wecom.domain.vo.autotag.record.CustomerCountVO;
|
||||
import com.easyink.wecom.domain.vo.autotag.record.customer.CustomerTagRuleRecordVO;
|
||||
import com.easyink.wecom.domain.vo.autotag.record.group.GroupTagRuleRecordVO;
|
||||
import com.easyink.wecom.domain.vo.autotag.record.keyword.KeywordRecordDetailVO;
|
||||
import com.easyink.wecom.domain.vo.autotag.record.keyword.KeywordTagRuleRecordVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.autotag.WeAutoTagRuleHitCustomerRecordService;
|
||||
import com.easyink.wecom.service.autotag.WeAutoTagRuleHitGroupRecordService;
|
||||
import com.easyink.wecom.service.autotag.WeAutoTagRuleHitKeywordRecordService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 客户打标签记录表(WeAutoTagRuleHitRecord)表控制层
|
||||
*
|
||||
* @author tigger
|
||||
* @since 2022-02-27 15:52:40
|
||||
*/
|
||||
@Api(tags = "自动标签记录")
|
||||
@RestController
|
||||
@RequestMapping("wecom/auto/tag/hit/record")
|
||||
public class WeAutoTagRuleHitRecordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WeAutoTagRuleHitKeywordRecordService weAutoTagRuleHitKeywordRecordService;
|
||||
@Autowired
|
||||
private WeAutoTagRuleHitGroupRecordService weAutoTagRuleHitGroupRecordService;
|
||||
@Autowired
|
||||
private WeAutoTagRuleHitCustomerRecordService weAutoTagRuleHitCustomerRecordService;
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("关键词规则记录列表")
|
||||
@PostMapping("keyword/list")
|
||||
public TableDataInfo<KeywordTagRuleRecordVO> listKeywordRecord(@Validated @RequestBody TagRuleRecordQuery query) {
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
PageHelper.startPage(query.getPageNum(), query.getPageSize(), null);
|
||||
List<KeywordTagRuleRecordVO> list = weAutoTagRuleHitKeywordRecordService.listKeywordRecord(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("触发关键词详情列表")
|
||||
@PostMapping("keyword/detail")
|
||||
public TableDataInfo<KeywordRecordDetailVO> listKeywordDetail(@Validated @RequestBody TagRuleRecordKeywordDetailQuery query) {
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
PageHelper.startPage(query.getPageNum(), query.getPageSize(), null);
|
||||
List<KeywordRecordDetailVO> list = weAutoTagRuleHitKeywordRecordService.listKeywordDetail(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("群规则记录列表")
|
||||
@PostMapping("group/list")
|
||||
public TableDataInfo<GroupTagRuleRecordVO> listGroupRecord(@Validated @RequestBody GroupTagRuleRecordQuery query) {
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
PageHelper.startPage(query.getPageNum(), query.getPageSize(), null);
|
||||
List<GroupTagRuleRecordVO> list = weAutoTagRuleHitGroupRecordService.listGroupRecord(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("新客规则记录列表")
|
||||
@PostMapping("customer/list")
|
||||
public TableDataInfo<CustomerTagRuleRecordVO> listCustomerRecord(@RequestBody CustomerTagRuleRecordQuery query) {
|
||||
query.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
PageHelper.startPage(query.getPageNum(), query.getPageSize(), null);
|
||||
List<CustomerTagRuleRecordVO> list = weAutoTagRuleHitCustomerRecordService.listCustomerRecord(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("关键词记录统计")
|
||||
@GetMapping("keyword/count/{id}")
|
||||
public AjaxResult<CustomerCountVO> keywordCount(@PathVariable("id") Long ruleId) {
|
||||
CustomerCountVO countVO = weAutoTagRuleHitKeywordRecordService.keywordCustomerCount(ruleId, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(countVO);
|
||||
}
|
||||
|
||||
@ApiOperation("群记录统计")
|
||||
@GetMapping("group/count/{id}")
|
||||
public AjaxResult<CustomerCountVO> groupCount(@PathVariable("id") Long ruleId) {
|
||||
CustomerCountVO countVO = weAutoTagRuleHitGroupRecordService.groupCustomerCount(ruleId, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(countVO);
|
||||
}
|
||||
|
||||
@ApiOperation("新客记录统计")
|
||||
@GetMapping("customer/count/{id}")
|
||||
public AjaxResult<CustomerCountVO> customerCount(@PathVariable("id") Long ruleId) {
|
||||
CustomerCountVO countVO = weAutoTagRuleHitCustomerRecordService.customerCustomerCount(ruleId, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(countVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.easyink.web.controller.wecom.autotag;
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.dto.autotag.batchtag.BatchTagTaskDTO;
|
||||
import com.easyink.wecom.domain.dto.autotag.batchtag.BatchTagTaskDetailDTO;
|
||||
import com.easyink.wecom.domain.vo.autotag.BatchTagTaskDetailVO;
|
||||
import com.easyink.wecom.domain.vo.autotag.BatchTagTaskVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.autotag.WeBatchTagTaskDetailService;
|
||||
import com.easyink.wecom.service.autotag.WeBatchTagTaskService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量打标签-Controller
|
||||
*
|
||||
* @author lichaoyu
|
||||
* @date 2023/6/5 9:47
|
||||
*/
|
||||
@Api(tags = "批量打标签任务")
|
||||
@RestController
|
||||
@RequestMapping("wecom/batchTagTask")
|
||||
public class WeBatchTagTaskController extends BaseController {
|
||||
|
||||
private final WeBatchTagTaskService weBatchTagTaskService;
|
||||
|
||||
private final WeBatchTagTaskDetailService weBatchTagTaskDetailService;
|
||||
|
||||
public WeBatchTagTaskController(WeBatchTagTaskService weBatchTagTaskService, WeBatchTagTaskDetailService weBatchTagTaskDetailService) {
|
||||
this.weBatchTagTaskService = weBatchTagTaskService;
|
||||
this.weBatchTagTaskDetailService = weBatchTagTaskDetailService;
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:batchtag:add')")
|
||||
@ApiOperation(value = "导入批量打标签任务", httpMethod = "POST")
|
||||
@PostMapping("/import")
|
||||
public <T> AjaxResult<T> importTask (@RequestParam("file") MultipartFile file, @RequestParam("tagIds") List<String> tagIds, @RequestParam("taskName") String taskName) throws Exception {
|
||||
return AjaxResult.success(weBatchTagTaskService.importBatchTagTask(file, tagIds, taskName));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:batchtag:del')")
|
||||
@ApiOperation("批量删除打标签任务")
|
||||
@DeleteMapping("/delete")
|
||||
public AjaxResult remove(@ApiParam("记录ID数组") @RequestParam("taskIds") Long[] taskIds) {
|
||||
return toAjax(weBatchTagTaskService.deleteBatchTaskByIds(LoginTokenService.getLoginUser().getCorpId(), taskIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:batchtag:list')")
|
||||
@ApiOperation("查询批量打标签任务列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BatchTagTaskVO> list(BatchTagTaskDTO dto){
|
||||
startPage();
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<BatchTagTaskVO> resultList = weBatchTagTaskService.selectBatchTaskList(dto);
|
||||
return getDataTable(resultList);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:batchtag:list')")
|
||||
@ApiOperation("查询批量打标签任务详情")
|
||||
@GetMapping("/detail")
|
||||
public TableDataInfo<BatchTagTaskDetailVO> detail(BatchTagTaskDetailDTO dto){
|
||||
startPage();
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
List<BatchTagTaskDetailVO> resultList = weBatchTagTaskDetailService.selectBatchTaskDetailList(dto);
|
||||
return getDataTable(resultList);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('wecom:batchtag:export')")
|
||||
@ApiOperation("导出批量打标签任务详情")
|
||||
@PostMapping("/export")
|
||||
public AjaxResult<BatchTagTaskDetailVO> export(@RequestBody BatchTagTaskDetailDTO dto) {
|
||||
dto.setCorpId(LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success(weBatchTagTaskDetailService.exportBatchTaskDetailList(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
* @param rows 影响行数
|
||||
* @return 操作结果
|
||||
*/
|
||||
protected AjaxResult toAjax(int rows) {
|
||||
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
package com.easyink.web.controller.wecom.form;
|
||||
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.dto.form.*;
|
||||
import com.easyink.wecom.domain.query.form.FormQuery;
|
||||
import com.easyink.wecom.domain.vo.form.*;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.form.WeFormService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 表单表(WeForm)表控制层
|
||||
*
|
||||
* @author tigger
|
||||
* @since 2023-01-09 15:00:44
|
||||
*/
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/wecom/form")
|
||||
@Slf4j
|
||||
public class WeFormController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WeFormService weFormService;
|
||||
|
||||
@ApiOperation("新增表单")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult insert(@Validated @RequestBody FormAddRequestDTO addDTO) {
|
||||
this.weFormService.saveForm(addDTO, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("编辑表单")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult update(@Validated @RequestBody FormUpdateRequestDTO updateDTO) {
|
||||
this.weFormService.updateForm(updateDTO, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("删除表单")
|
||||
@PostMapping("/remove")
|
||||
public AjaxResult delete(@Validated @RequestBody DeleteFormDTO deleteDTO) {
|
||||
this.weFormService.deleteForm(deleteDTO.getIdList(), LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("表单分页")
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo<FormPageVO> page(@Valid FormQuery formQuery) {
|
||||
return getDataTable(this.weFormService.getPage(formQuery, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@ApiOperation("表单编辑详情")
|
||||
@GetMapping("/edit/detail")
|
||||
public AjaxResult<WeFormEditDetailVO> editDetail(@ApiParam(value = "表单id") @RequestParam(value = "id") Long id) {
|
||||
return AjaxResult.success(this.weFormService.getEditDetail(id, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@ApiOperation("表单详情")
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult<FormDetailViewVO> detail(@ApiParam(value = "表单id") @RequestParam(value = "id") Long id) {
|
||||
return AjaxResult.success(this.weFormService.getDetail(id, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@ApiOperation("表单数据总览")
|
||||
@GetMapping("/total/view")
|
||||
public AjaxResult<FormTotalView> totalView(@ApiParam(value = "表单id") @RequestParam(value = "id") Long id) {
|
||||
return AjaxResult.success(this.weFormService.totalView(id, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改分组")
|
||||
@PostMapping("/updateBatch/group")
|
||||
public AjaxResult updateBatchGroup(@Validated @RequestBody BatchUpdateGroupDTO batchDTO) {
|
||||
weFormService.updateBatchGroup(batchDTO, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("推广")
|
||||
@GetMapping("/promotional")
|
||||
public AjaxResult<PromotionalVO> promotional(@ApiParam(value = "表单id") @RequestParam("id") Long id, HttpServletResponse response) {
|
||||
return AjaxResult.success(weFormService.promotion(id, response)
|
||||
);
|
||||
}
|
||||
|
||||
@ApiOperation("启用禁用表单")
|
||||
@PostMapping("/enableForm")
|
||||
public AjaxResult<PromotionalVO> enableForm(
|
||||
@ApiParam(value = "表单id") @RequestParam("id") Long id,
|
||||
@ApiParam(value = "启用禁用状态") @RequestParam("enableFlag") Boolean enableFlag
|
||||
) {
|
||||
weFormService.enableForm(id, enableFlag, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("中间页获取表单内容,同时异步记录点击事件")
|
||||
@GetMapping("/getContent")
|
||||
public AjaxResult getContent(@ApiParam("表单id") Long formId,
|
||||
@ApiParam("员工id") String userId,
|
||||
@ApiParam("用户的公众号openid") String openId,
|
||||
@ApiParam("表单渠道id") Integer channelType) {
|
||||
log.info("[点击表单] formId:{}, userId:{}, openId:{}, channelType:{}", formId, userId, openId, channelType);
|
||||
return AjaxResult.success(weFormService.getContent(formId, userId, openId, channelType));
|
||||
}
|
||||
|
||||
@ApiOperation("中间页提交表单结果")
|
||||
@PostMapping("/commit")
|
||||
public AjaxResult commit(@RequestBody @Validated FormCommitDTO formCommitDTO) {
|
||||
weFormService.commit(formCommitDTO);
|
||||
return AjaxResult.success("success");
|
||||
}
|
||||
|
||||
@ApiOperation("侧边栏获取表单URL")
|
||||
@GetMapping("/genFormUrl")
|
||||
public AjaxResult<String> genFormUrl(
|
||||
@ApiParam("表单id") @RequestParam("formId") Long formId,
|
||||
@ApiParam("员工id") @RequestParam("userId") String userId,
|
||||
@ApiParam("渠道类型") @RequestParam("channelType") Integer channelType
|
||||
) {
|
||||
return AjaxResult.success("success", weFormService.sideBarGenFormUrl(formId, userId, channelType));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.easyink.web.controller.wecom.form;
|
||||
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.wecom.domain.dto.form.ChangeFormGroupSortDTO;
|
||||
import com.easyink.wecom.domain.dto.form.FormGroupAddDTO;
|
||||
import com.easyink.wecom.domain.dto.form.FormGroupUpdateDTO;
|
||||
import com.easyink.wecom.domain.vo.form.FormGroupTreeVO;
|
||||
import com.easyink.wecom.domain.vo.form.FormGroupTrees;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.form.WeFormGroupService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表单分组表(WeFormGroup)表控制层
|
||||
*
|
||||
* @author tigger
|
||||
* @since 2023-01-09 11:23:21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/form/group")
|
||||
public class WeFormGroupController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WeFormGroupService weFormGroupService;
|
||||
|
||||
|
||||
@GetMapping("/tree")
|
||||
public AjaxResult<List<FormGroupTreeVO>> selectTree(
|
||||
@RequestParam(value = "sourceType") Integer sourceType,
|
||||
@RequestParam(value = "departmentId",required = false) Integer departmentId
|
||||
) {
|
||||
|
||||
return AjaxResult.success(this.weFormGroupService.selectTree(sourceType,departmentId,
|
||||
LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@GetMapping("/trees")
|
||||
public AjaxResult<FormGroupTrees> selectTrees(@RequestParam(value = "departmentId",required = false) Integer departmentId) {
|
||||
return AjaxResult.success(this.weFormGroupService.selectTrees(departmentId,
|
||||
LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@ApiOperation("新增分组")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult insert(@Validated @RequestBody FormGroupAddDTO addDTO) {
|
||||
this.weFormGroupService.saveGroup(addDTO, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("删除分组")
|
||||
@DeleteMapping("/remove")
|
||||
public AjaxResult delete(@RequestParam("id") Integer id) {
|
||||
this.weFormGroupService.deleteGroup(id, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("更新分组")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult update(@Validated @RequestBody FormGroupUpdateDTO updateDTO) {
|
||||
this.weFormGroupService.updateGroup(updateDTO, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("修改排序")
|
||||
@PostMapping("/changeSort")
|
||||
public AjaxResult changeSort(@Validated @RequestBody ChangeFormGroupSortDTO sortDTO) {
|
||||
this.weFormGroupService.changeSort(sortDTO, LoginTokenService.getLoginUser().getCorpId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.easyink.web.controller.wecom.form;
|
||||
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.vo.form.FormCustomerOperRecordVO;
|
||||
import com.easyink.wecom.domain.vo.form.FormOperRecordDetailVO;
|
||||
import com.easyink.wecom.domain.vo.form.FormUserSendRecordVO;
|
||||
import com.easyink.wecom.service.form.WeFormOperRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 智能表单操作记录表(WeFormOperRecord)表控制层
|
||||
*
|
||||
* @author wx
|
||||
* @since 2023-01-13 11:49:44
|
||||
*/
|
||||
@Api(value = "WeFormOperRecordController", tags = "智能表单操作记录Controller")
|
||||
@RestController
|
||||
@RequestMapping("/wecom/form/record")
|
||||
@RequiredArgsConstructor
|
||||
public class WeFormOperRecordController extends BaseController {
|
||||
|
||||
private final WeFormOperRecordService weFormOperRecordService;
|
||||
|
||||
@ApiOperation("客户操作记录")
|
||||
@GetMapping("/getCustomerOperRecord")
|
||||
public TableDataInfo<FormCustomerOperRecordVO> getCustomerOperRecord(@ApiParam("表单id") @RequestParam("formId") @NotNull Long formId,
|
||||
@ApiParam("时间类型,1:点击时间,2:提交时间") Integer timeType,
|
||||
@ApiParam("开始时间") Date beginTime,
|
||||
@ApiParam("结束时间") Date endTime,
|
||||
@ApiParam("客户名称") String customerName,
|
||||
@ApiParam("点击渠道") Integer channelType) {
|
||||
startPage();
|
||||
return getDataTable(weFormOperRecordService.getCustomerOperRecord(formId, timeType, beginTime, endTime, customerName, channelType));
|
||||
}
|
||||
|
||||
@ApiOperation("员工发送记录")
|
||||
@GetMapping("/getUserSendRecord")
|
||||
public TableDataInfo<FormUserSendRecordVO> getUserSendRecord(@ApiParam("表单id") @RequestParam("formId") @NotNull Long formId,
|
||||
@ApiParam("时间类型,1:点击时间,2:提交时间") Integer timeType,
|
||||
@ApiParam("开始时间") Date beginTime,
|
||||
@ApiParam("结束时间") Date endTime,
|
||||
@ApiParam("员工姓名") String userName) {
|
||||
startPage();
|
||||
return getDataTable(weFormOperRecordService.getUserSendRecord(formId, timeType, beginTime, endTime, userName));
|
||||
}
|
||||
|
||||
@ApiOperation("获取表单详情")
|
||||
@GetMapping("/getFormResult")
|
||||
public AjaxResult<FormOperRecordDetailVO> getFormResult(@ApiParam("表单id") @RequestParam("formId") @NotNull Long formId, @ApiParam("点击渠道") @RequestParam("channelType") Integer channelType) {
|
||||
return AjaxResult.success(weFormOperRecordService.getFormResult(formId, channelType));
|
||||
}
|
||||
|
||||
@ApiOperation("导出客户操作记录")
|
||||
@GetMapping("/exportCustomerOperRecord")
|
||||
public AjaxResult exportCustomerOperRecord(@ApiParam("表单id") @RequestParam("formId") @NotNull Long formId,
|
||||
@ApiParam("时间类型,1:点击时间,2:提交时间") Integer timeType,
|
||||
@ApiParam("开始时间") Date beginTime,
|
||||
@ApiParam("结束时间") Date endTime,
|
||||
@ApiParam("客户名称") String customerName,
|
||||
@ApiParam("点击渠道") Integer channelType) {
|
||||
return AjaxResult.success(weFormOperRecordService.exportCustomerOperRecord(formId, timeType, beginTime, endTime, customerName, channelType));
|
||||
}
|
||||
|
||||
@ApiOperation("导出员工发送记录")
|
||||
@GetMapping("/exportUserSendRecord")
|
||||
public AjaxResult exportUserSendRecord(@ApiParam("表单id") @RequestParam("formId") @NotNull Long formId,
|
||||
@ApiParam("时间类型,1:点击时间,2:提交时间") Integer timeType,
|
||||
@ApiParam("开始时间") Date beginTime,
|
||||
@ApiParam("结束时间") Date endTime,
|
||||
@ApiParam("员工姓名") String userName) {
|
||||
return AjaxResult.success(weFormOperRecordService.exportUserSendRecord(formId, timeType, beginTime, endTime, userName));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.easyink.web.controller.wecom.form;
|
||||
|
||||
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.wecom.domain.vo.form.FormSimpleInfoVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.form.WeFormUseRecordService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 表单使用记录表(WeFormUseRecord)表控制层
|
||||
*
|
||||
* @author tigger
|
||||
* @since 2023-01-13 10:12:29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wecom/form/use/record")
|
||||
public class WeFormUseRecordController extends BaseController {
|
||||
|
||||
private final WeFormUseRecordService weFormUseRecordService;
|
||||
|
||||
@Lazy
|
||||
public WeFormUseRecordController(WeFormUseRecordService weFormUseRecordService) {
|
||||
this.weFormUseRecordService = weFormUseRecordService;
|
||||
}
|
||||
|
||||
@ApiOperation("表单使用记录分页")
|
||||
@GetMapping("/page/record")
|
||||
public TableDataInfo<FormSimpleInfoVO> page(@ApiParam("表单所属类别") @RequestParam(value = "sourceType") Integer sourceType) {
|
||||
return getDataTable(this.weFormUseRecordService.pageRecord(sourceType, LoginTokenService.getLoginUser().getCorpId()));
|
||||
}
|
||||
|
||||
@ApiOperation("新增侧边栏表单使用记录")
|
||||
@GetMapping("/add")
|
||||
public AjaxResult add(
|
||||
@ApiParam("表单id") @RequestParam(value = "formId") Long formId,
|
||||
@ApiParam("员工id") @RequestParam(value = "userId") String userId,
|
||||
@ApiParam("客户id") @RequestParam(value = "externalUserId") String externalUserId,
|
||||
@ApiParam("企业id") @RequestParam(value = "corpId") String corpId) {
|
||||
weFormUseRecordService.saveRecord(formId, userId, externalUserId, corpId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.easyink.web.controller.wecom.radar;
|
||||
|
||||
import com.easyink.common.annotation.Log;
|
||||
import com.easyink.common.core.controller.BaseController;
|
||||
import com.easyink.common.core.domain.AjaxResult;
|
||||
import com.easyink.common.core.page.TableDataInfo;
|
||||
import com.easyink.common.enums.BusinessType;
|
||||
import com.easyink.wecom.domain.dto.radar.DeleteRadarChannelDTO;
|
||||
import com.easyink.wecom.domain.dto.radar.RadarChannelDTO;
|
||||
import com.easyink.wecom.domain.dto.radar.SearchRadarChannelDTO;
|
||||
import com.easyink.wecom.domain.vo.radar.WeRadarChannelVO;
|
||||
import com.easyink.wecom.login.util.LoginTokenService;
|
||||
import com.easyink.wecom.service.radar.WeRadarChannelService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ClassName: weRadarChannelController
|
||||
*
|
||||
* @author wx
|
||||
* @date 2022/7/19 14:48
|
||||
*/
|
||||
@Api(tags = "雷达渠道Controller")
|
||||
@RestController
|
||||
@RequestMapping("/wecom/radar/channel")
|
||||
public class WeRadarChannelController extends BaseController {
|
||||
|
||||
private final WeRadarChannelService radarChannelService;
|
||||
|
||||
@Autowired
|
||||
public WeRadarChannelController(WeRadarChannelService radarChannelService) {
|
||||
this.radarChannelService = radarChannelService;
|
||||
}
|
||||
|
||||
@Log(title = "新增雷达渠道", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增雷达渠道")
|
||||
// @PreAuthorize("@ss.hasPermi('redeeomCode:activity:add')")
|
||||
public AjaxResult add(@RequestBody @Validated RadarChannelDTO radarChannelDTO) {
|
||||
radarChannelService.saveRadarChannel(radarChannelDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询雷达渠道序列")
|
||||
public TableDataInfo<WeRadarChannelVO> list(SearchRadarChannelDTO radarChannelDTO) {
|
||||
startPage();
|
||||
List<WeRadarChannelVO> list = radarChannelService.getRadarChannelList(radarChannelDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
//@PreAuthorize("@ss.hasPermi('wecom:redeemcode:remove')")
|
||||
@Log(title = "删除雷达渠道", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/remove")
|
||||
@ApiOperation("删除雷达渠道")
|
||||
public AjaxResult remove(@Validated @RequestBody DeleteRadarChannelDTO deleteDTO) {
|
||||
radarChannelService.batchRemoveRadarChannel(deleteDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获取雷达渠道详情")
|
||||
public AjaxResult<WeRadarChannelVO> get(@RequestParam("id") Long id) {
|
||||
String corpId = LoginTokenService.getLoginUser().getCorpId();
|
||||
return AjaxResult.success(radarChannelService.getRadarChannel(corpId, id));
|
||||
}
|
||||
|
||||
//@PreAuthorize("@ss.hasPermi('wecom:redeemcode:edit')")
|
||||
@Log(title = "修改雷达渠道", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改雷达渠道")
|
||||
// @PreAuthorize("@ss.hasPermi('redeeomCode:activity:edit')")
|
||||
public <T> AjaxResult<T> edit(@Validated @RequestBody RadarChannelDTO radarChannelDTO) {
|
||||
radarChannelService.updateRadarChannel(radarChannelDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue