last commit

This commit is contained in:
zhuruiyang 2024-07-26 14:10:54 +08:00
parent 2ce75d8b13
commit 06f03c7506
4894 changed files with 258102 additions and 5207 deletions

476
LICENSE
View File

@ -1,339 +1,201 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Copyright (C) 1989, 1991 Free Software Foundation, Inc., [http://fsf.org/]
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Preamble
1. Definitions.
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
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
this service 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.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. 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.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
The precise terms and conditions for copying, distribution and
modification follow.
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
END OF TERMS AND CONDITIONS
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
APPENDIX: How to apply the Apache License to your work.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
Copyright {yyyy} {name of copyright owner}
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
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
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
http://www.apache.org/licenses/LICENSE-2.0
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE 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.
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
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) 2017 小柒2012
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 2 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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision 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, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This 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.
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.

4
backend/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM harbor.svnlan.com/library/office6_jdk8_ffmpeg6_libraw_skagent_centos7
COPY target/disk-0.0.1-SNAPSHOT.jar /app.jar
COPY src/main/resources/itest/agent.config /agent/config/agent.config
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

35
backend/harbor Normal file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import os
import sys
site_name = "harbor.svnlan.com"
app_name = "library/java/disk"
dep_version = "latest"
docker_login_name = "admin"
docker_login_password = "Harbor12345"
#执行shell命令
def docker_cmd(cmd):
return_code = subprocess.call(cmd, shell=True)
if return_code != 0:
print "command === %s === error" % (cmd)
usage()
return return_code
def main():
global dep_version
if len(sys.argv) >= 2:
dep_version = sys.argv[1]
docker_login = 'docker login -u %s -p %s https://%s' % (docker_login_name, docker_login_password, site_name )
docker_tag = 'docker build -t %s/%s:%s .' % ( site_name.lower(), app_name.lower(), dep_version)
docker_push = 'docker push %s/%s:%s' % ( site_name.lower(), app_name.lower(),dep_version)
for cmd in [docker_login, docker_tag, docker_push]:
docker_cmd(cmd)
print "docker cmd is run..."
if __name__ =='__main__':
main()

View File

@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: java-disk
namespace: default
labels:
app-name: java-disk
spec:
replicas: 1
minReadySeconds: 30
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app-name: java-disk
template:
metadata:
labels:
app-name: java-disk
spec:
nodeSelector:
type: deployment
containers:
- name: java-disk
image: harbor.svnlan.com/library/java/disk:latest
imagePullPolicy: Always
securityContext:
privileged: true
ports:
- containerPort: 80
name: disk
protocol: TCP
volumeMounts:
- name: nfs-pvc-svnlan-cloud-disk
mountPath: "/uploads"
- name: nfs-pvc-svnlan-log30
mountPath: "/log"
- name: mem
mountPath: "/dev/mem"
volumes:
- name: nfs-pvc-svnlan-cloud-disk
persistentVolumeClaim:
claimName: svnlan-cloud-disk
- name: nfs-pvc-svnlan-log30
hostPath:
path: /data0/logs/app
- name: mem
hostPath:
path: /dev/mem

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

644
backend/pom.xml Normal file
View File

@ -0,0 +1,644 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.svnlan</groupId>
<artifactId>disk</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>disk</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.12.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<mybatis-spring-boot>1.2.0</mybatis-spring-boot>
<mysql-connector>5.1.47</mysql-connector>
<spring-boot-starter-redis-version>1.3.2.RELEASE</spring-boot-starter-redis-version>
<lucene-core.version>7.5.0</lucene-core.version>
<tika-core.version>1.28.5</tika-core.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-trace</artifactId>
<version>8.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId>
<version>8.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x-activation</artifactId>
<version>8.6.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.2.12.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.0.9.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.26</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox-tools</artifactId>
<version>2.0.26</version>
</dependency>
<!-- 实现web功能 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>23.4</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/aspose-pdf-23.4-crack.jar</systemPath>
</dependency>
<!-- Spring Boot Redis 依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--使用redisson作为分布式锁-->
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.16.8</version>
</dependency>
<!-- 单元测试 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Spring Boot Mybatis 依赖 -->
<!-- <dependency>-->
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
<!-- <version>${mybatis-spring-boot}</version>-->
<!-- </dependency>-->
<!-- Junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector}</version>
</dependency>
<!-- 支持发送邮件 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<!-- email -->
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.48.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.1.7.RELEASE</version>
</dependency>
<!-- mp3处理工具 -->
<dependency>
<groupId>com.mpatric</groupId>
<artifactId>mp3agic</artifactId>
<version>0.9.1</version>
</dependency>
<!-- mp3处理工具 -->
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-compress -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.9</version>
</dependency>
<!-- 解压rar所需的依赖 -->
<dependency>
<groupId>com.github.junrar</groupId>
<artifactId>junrar</artifactId>
<version>4.0.0</version>
</dependency>
<!--Jsoup解析html-->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.12.1</version>
</dependency>
<!-- JWT -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- 阿里oss上传-->
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.8.0</version>
</dependency>
<!-- apache的ant解压-->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.5</version>
</dependency>
<!-- 对 rar5 的支持 和其他众多压缩支持 可参考 package net.sf.sevenzipjbinding.ArchiveFormat; -->
<dependency>
<groupId>net.sf.sevenzipjbinding</groupId>
<artifactId>sevenzipjbinding</artifactId>
<version>9.20-2.00beta</version>
</dependency>
<dependency>
<groupId>net.sf.sevenzipjbinding</groupId>
<artifactId>sevenzipjbinding-all-platforms</artifactId>
<version>9.20-2.00beta</version>
</dependency>
<!-- apache的ant解压-->
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>2.11.5</version>
</dependency>
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.13</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.12</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>fontbox</artifactId>
<version>2.0.12</version>
</dependency>
<!-- word 转码-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>com.github.eljah</groupId>
<artifactId>xmindjbehaveplugin</artifactId>
<version>0.8</version>
</dependency>
<!--alibaba工具类-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<!-- java服务器信息监控【oshi】 -->
<!-- java服务器信息监控【oshi】end -->
<!--pinyin4j-->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.0</version>
</dependency>
<!--分页助手工具-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>4.1.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/eu.bitwalker/UserAgentUtils -->
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>1.21</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.6</version>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.6</version>
</dependency>
<!--jpushclient-->
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jmessage-client</artifactId>
<version>1.1.8</version>
</dependency>
<!--gson-->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- 解决 localDate 与 Date 映射的问题 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-typehandlers-jsr310</artifactId>
<version>1.0.2</version>
</dependency>
<!-- excel 导出 -->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>4.0.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<!-- excel 导出 结束 -->
<!-- 基于 jvm 的缓存 -->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.8.0</version>
</dependency>
<!-- dingding -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>dingtalk</artifactId>
<version>1.5.58</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
<version>2.0.0</version>
</dependency>
<!-- &lt;!&ndash; 模版引擎 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.thymeleaf</groupId>-->
<!-- <artifactId>thymeleaf</artifactId>-->
<!-- <version>3.0.15.RELEASE</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.0</version>
</dependency>
<!-- new webdav -->
<dependency>
<groupId>com.ithit.webdav</groupId>
<artifactId>webdav-server</artifactId>
<version>6.2.9090-Beta</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/webdav-server-6.2.9090-Beta.jar</systemPath>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!-- JNA dependencies -->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.13.0</version>
<exclusions>
<exclusion>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.13.0</version>
</dependency>
<!-- Search dependencies -->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>${lucene-core.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>${lucene-core.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
<version>${lucene-core.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>${tika-core.version}</version>
<exclusions>
<exclusion>
<artifactId>cxf-core</artifactId>
<groupId>org.apache.cxf</groupId>
</exclusion>
<exclusion>
<artifactId>cxf-rt-rs-client</artifactId>
<groupId>org.apache.cxf</groupId>
</exclusion>
<exclusion>
<artifactId>httpservices</artifactId>
<groupId>edu.ucar</groupId>
</exclusion>
<exclusion>
<artifactId>maven-scm-provider-svnexe</artifactId>
<groupId>org.apache.maven.scm</groupId>
</exclusion>
<exclusion>
<artifactId>maven-scm-api</artifactId>
<groupId>org.apache.maven.scm</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>c3p0</artifactId>
<groupId>c3p0</groupId>
</exclusion>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>grib</artifactId>
<groupId>edu.ucar</groupId>
</exclusion>
<exclusion>
<artifactId>cdm</artifactId>
<groupId>edu.ucar</groupId>
</exclusion>
<exclusion>
<artifactId>unit-api</artifactId>
<groupId>javax.measure</groupId>
</exclusion>
<exclusion>
<artifactId>activation</artifactId>
<groupId>javax.activation</groupId>
</exclusion>
<exclusion>
<groupId>org.apache.sis.storage</groupId>
<artifactId>sis-netcdf</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.plugin</groupId>-->
<!-- <artifactId>spring-plugin-core</artifactId>-->
<!-- <version>2.0.0.RELEASE</version>-->
<!-- </dependency>-->
<!--<dependency>-->
<!--<groupId>com.svnlan</groupId>-->
<!--<artifactId>redis-lock</artifactId>-->
<!--<version>0.0.1-SNAPSHOT</version>-->
<!--</dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<configurationFile>${basedir}/src/main/resources/generatorConfig.xml</configurationFile>
<overwrite>false</overwrite>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<!-- 覆盖原有文件 -->
<overwrite>true</overwrite>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<!-- 也可以用下面这样的方式指定相对url的方式指定outputDirectory <outputDirectory>target/classes</outputDirectory> -->
<!-- 待处理的资源定义 -->
<resources>
<resource>
<!-- 指定resources插件处理哪个目录下的资源文件 -->
<directory>src/main/resources/${package.environment}</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>lib</directory>
<targetPath>WEB-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>pufay</id>
<activation>
<property>
<name>env</name>
<value>pufay</value>
</property>
</activation>
<properties>
<package.environment>pufay</package.environment>
</properties>
</profile>
<profile>
<id>dev</id>
<activation>
<property>
<name>env</name>
<value>dev</value>
</property>
</activation>
<properties>
<package.environment>dev</package.environment>
</properties>
</profile>
<profile>
<id>pre</id>
<activation>
<property>
<name>env</name>
<value>pre</value>
</property>
</activation>
<properties>
<package.environment>pre</package.environment>
</properties>
</profile>
<profile>
<id>itest</id>
<activation>
<property>
<name>env</name>
<value>itest</value>
</property>
</activation>
<properties>
<package.environment>itest</package.environment>
</properties>
</profile>
<profile>
<id>pro</id>
<activation>
<property>
<name>env</name>
<value>pro</value>
</property>
</activation>
<properties>
<package.environment>pro</package.environment>
</properties>
</profile>
</profiles>
</project>

View File

@ -6,7 +6,6 @@ import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties
import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
@ -24,7 +23,7 @@ import java.util.concurrent.ThreadPoolExecutor;
@SpringBootApplication
// mapper 接口类扫描包配置
@MapperScan("com.svnlan.**.dao")
//@MapperScan("com.svnlan.**.dao")
@EnableAsync
@EnableVisitRecord
@ServletComponentScan(basePackages = {"com.svnlan.interceptor", "com.svnlan.webdav"})
@ -48,7 +47,16 @@ public class DiskApplication {
SpringApplication.run(DiskApplication.class, args);
}
/** 用做异步 */
/**
* 用做异步
* 线程池按以下行为执行任务
*
* 当线程数小于核心线程数时创建线程
* 当线程数大于等于核心线程数且任务队列未满时将任务放入任务队列
* 当线程数大于等于核心线程数且任务队列已满若线程数小于最大线程数创建线程
* 若线程数等于最大线程数则执行拒绝策略
* @return
*/
@Bean(name = "asyncTaskExecutor")
public ThreadPoolTaskExecutor executor() {
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
@ -102,6 +110,34 @@ public class DiskApplication {
return executor;
}
/**
* 执行转码线程
*
* @return Executor
*/
@Bean
public ThreadPoolTaskExecutor threadExecConvert() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//核心线程数目
executor.setCorePoolSize(6);
//指定最大线程数
executor.setMaxPoolSize(60);
//队列中最大的数目
executor.setQueueCapacity(24);
//线程名称前缀
executor.setThreadNamePrefix("diskThreadExecConvert_");
//rejection-policy当pool已经达到max size的时候如何处理新任务
//CALLER_RUNS不在新线程中执行任务而是由调用者所在的线程来执行
//对拒绝task的处理策略
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
//线程空闲后的最大存活时间
executor.setKeepAliveSeconds(120);
//加载
executor.initialize();
return executor;
}
@Bean(name="encryptorBean")
public StringEncryptor stringEncryptor() {
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();

View File

@ -8,6 +8,7 @@ import java.time.format.DateTimeFormatter;
*/
public class GlobalConfig {
public static final String COMMA_DELIMITER = ",";
public static final String DIVIDING_LINE = "DividingLine";
public static final String PWD_SALT = "PJEA4DR2WS8DF651DGT";
public static final String JWT_REDIS_PREFIX = "jwt";
@ -92,14 +93,16 @@ public class GlobalConfig {
public static final String[] CAMERA_TYPE_ARR = {"arw", "mrw", "erf", "raf","cr2", "nrw", "nef", "orf", "rw2", "pef", "srf"
, "dcr", "kdc", "dng"};
// 手机拍照后缀用于校验竖屏拍照上传照片旋转问题
public static final String[] IMAGE_TYPE_PHOTOGRAPH = {"jpg", "jpeg", "png", "heic"};
public static final String[] DOC_SHOW_TYPE_ARR = {"doc", "docx", "ppt", "pptx", "pdf", "xls", "xlsx", "pps", "wps", "txt"};
public static final String[] AUDIO_SHOW_TYPE_ARR = {"mp3", "wav", "flac", "mpa"};
public static final String[] AUDIO_SHOW_TYPE_ARR = {"mp3", "wav", "flac", "mpa", "aac", "m4a"};
public static final String[] UNZIP_SHOW_TYPE_ARR = {"tar", "zip", "gzip", "bz2", "rar", "7z", "gz", "iso", "ar", "bz", "xz", "arj"};
public static final String[] ZIP_SHOW_TYPE_ARR = {"zip", "tar"};
public static final String[] VIDEO_TYPE_ARR = {"mp4", "flv", "rm", "rmvb", "avi", "mkv", "mov", "f4v", "mpeg", "mpg", "vob", "wmv", "ogv", "webm", "3gp", "mts", "m2ts", "m4v", "mpe", "3g2", "asf", "dat", "asx", "wvx"};
public static final String[] VIDEO_AUDIO_TYPE_CONVERT = {"mp4", "wav", "flac", "flv", "rm", "rmvb", "avi", "mkv", "mov", "f4v", "mpeg", "mpg", "vob", "wmv", "ogv", "webm", "3gp", "mts", "m2ts", "m4v", "mpe", "3g2", "asf", "dat", "asx", "wvx"};
public static final String[] AUDIO_VIDEO_SHOW_TYPE_ARR = {"mp4", "flv", "rm", "rmvb", "avi", "mkv", "mov", "f4v", "mpeg", "mpg", "vob", "wmv", "ogv", "webm", "3gp", "mts", "m2ts", "m4v", "mpe", "3g2", "asf", "dat", "asx", "wvx", "mpa", "mp3", "wav", "wma", "m4a", "ogg", "omf", "amr", "aa3", "flac", "aac", "cda", "aif", "aiff", "mid", "ra", "ape"};
public static final String[] VIDEO_TYPE_ARR = {"mp4", "flv", "rm", "rmvb", "avi", "mkv", "mov", "f4v", "mpeg", "mpg", "vob", "wmv", "ogv", "webm", "3gp", "mts", "m2ts", "m4v", "mpe", "3g2", "asf", "asx", "wvx"};
public static final String[] VIDEO_AUDIO_TYPE_CONVERT = {"mp4", "wav", "flac", "flv", "rm", "rmvb", "avi", "mkv", "mov", "f4v", "mpeg", "mpg", "vob", "wmv", "ogv", "webm", "3gp", "mts", "m2ts", "m4v", "mpe", "3g2", "asf", "asx", "wvx"};
public static final String[] AUDIO_VIDEO_SHOW_TYPE_ARR = {"mp4", "flv", "rm", "rmvb", "avi", "mkv", "mov", "f4v", "mpeg", "mpg", "vob", "wmv", "ogv", "webm", "3gp", "mts", "m2ts", "m4v", "mpe", "3g2", "asf", "asx", "wvx", "mpa", "mp3", "wav", "wma", "m4a", "ogg", "omf", "amr", "aa3", "flac", "aac", "cda", "aif", "aiff", "mid", "ra", "ape"};
public static final String CONVERT_SOURCE_ID_H5_MAP = "convert_source_id_h5";
public static final String CONVERT_SOURCE_ID_SWF_MAP = "convert_source_id_swf";
public static final String M3U8_KEY_INFO_SEPARATOR = "_&_&_";
@ -191,6 +194,7 @@ public class GlobalConfig {
public static final DateTimeFormatter dateTimeStandardFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
public static final DateTimeFormatter dateStandardFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
public static final String BAN_WORDS_LIB_FILE_NAME = "banWords.txt";
public static final String INITIAL_DATA = "initial_data.txt";
//非小程序其他最多装扮数量限制
public static final Integer MaxDesignCount = 100;
@ -246,8 +250,61 @@ public class GlobalConfig {
public static final String temp_img_video_key = "temp_img_video_key_";
public static final String homeExplorerRedisKey = "homeExplorerRedisKey_";
public static final String homeExplorerOneRedisKey = "homeExplorerOneRedisKey_";
public static final String tenantIdRedisKey = "tenantId_key_";
public static final String async_key_convert_img_video = "async_key_convert_img_video_";
public static final String progress_key_convert_img_video = "progress_key_convert_img_video_";
/** 钉钉企业内部应用的accessToken key */
public static final String ding_accessToken_key = "ding_accessToken_key_";
public static final String systemConfig_dingding_captcha = "systemConfig_dingding_captcha_";
public static final String systemConfig_enWebchat_captcha = "systemConfig_enWebchat_captcha_";
public static final String ding_core_accessToken_key = "ding_core_accessToken_key_";
public static final String async_key_pull_ding = "async_key_pull_ding:";
public static final String progress_key_pull_ding = "progress_key_pull_ding:";
public static final String async_key_pull_enwebchat = "async_key_pull_enwebchat:";
public static final String progress_key_pull_enwebchat = "progress_key_pull_enwebchat:";
public static final String systemConfig_cube_captcha = "systemConfig_cube_captcha_";
public static final String async_key_pull_cube = "async_key_pull_cube:";
public static final String progress_key_pull_cube = "progress_key_pull_cube:";
public static final String SUITE_TICKET_KEY = "suiteTicket";
public static final String CUBE_SUITE_TICKET_CORP_ID = "cube_ticket_corp_id";
// 上传
public static final String lock_upload_md5_captcha = "lock_upload_md5_captcha_%s_%s";
public static final String upload_md5_captcha = "upload_md5_captcha_%s_%s";
public static final String upload_md5_captcha_sourceId = "upload_md5_captcha_sourceId_%s_%s";
public static final String upload_md5_captcha_merge = "upload_md5_captcha_merge_%s_%s";
public static final String upload_md5_captcha_merge_check = "upload_md5_captcha_merge_check_%s_%s";
public static final String user_ip_location = "user_ip_location";
public static final String uploadUUidKey = "uploadUUidKey_";
// 家校通
public static final String[] NOT_TEACHER = {"学生", "家长"};
public static final String videoRedisExecKey = "videoRedisExecKey";
public static final String videoRedisExecRedisKey = "videoRedisExecRedisKey_";
public static final String audioRedisExecKey = "audioRedisExecKey";
public static final String audioRedisRedisExecKey = "audioRedisRedisExecKey_";
public static final String safe_code = "safe";
public static final String safe_meta_code = "mySafePwd";
public static final String user_safe_redis_key = "user_safe_redis_key_";
public static final String user_safe_redis_id_key = "user_safe_redis_id_key_";
public static final String getDingUserInfoByuserid_error_key = "getDingUserInfoByuserid_error_key";
public static final String user_upload_file_repeat_type_key = "user_upload_file_repeat_type_key";
public static final String ding_create_user_openId_phone_key = "ding_create_user_openId_phone_";
public static final String lock_dingParentId_key = "lock_dingParentId_key_";
public static final String pull_error_key = "pull_error_key_";
public static final String checkMemory_key = "checkMemory_key";
public static final String DAV_SALT = "Dav4DR2WS8DF651DGT";
public static final String dav_login_key = "dav_login_key_";
public static final String upload_local_captcha_checkMemory = "upload_local_captcha_checkMemory_%s";

View File

@ -0,0 +1,57 @@
//package com.svnlan.config;
//
//import com.github.pagehelper.PageHelper;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Profile;
//
//import java.util.Properties;
//
///**
// * mybatis配置
// *
// * @author lingxu 2023/05/25 10:02
// */
//@Configuration
//public class MybatisConfig {
// /**
// * mp 分页插件
// */
// @Bean
// public PaginationInterceptor paginationInterceptor() {
// PaginationInterceptor interceptor = new PaginationInterceptor();
// interceptor.setDialectType(DbType.MYSQL.getDb());
// return interceptor;
// }
//
// /**
// * 性能分析插件
// */
// @Bean
// @Profile({"dev", "test"})
// public PerformanceInterceptor performanceInterceptor() {
// PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
// performanceInterceptor.setMaxTime(15000);
// performanceInterceptor.setFormat(false);
// return performanceInterceptor;
// }
//
// /**
// * 功能描述: 配置mybatis的分页插件pageHelper
// *
// * @param:
// * @return:
// */
// @Bean
// public PageHelper pageHelper() {
// PageHelper pageHelper = new PageHelper();
// Properties properties = new Properties();
// properties.setProperty("offsetAsPageNum", "true");
// properties.setProperty("rowBoundsWithCount", "true");
// properties.setProperty("reasonable", "false");
// //配置mysql数据库的方言
// properties.setProperty("dialect", "mysql");
// pageHelper.setProperties(properties);
// return pageHelper;
// }
//}

View File

@ -55,6 +55,9 @@ public class RedisConfig {
ObjectMapper om = new ObjectMapper();
//PropertyAccessor.ALL所有JsonAutoDetect.Visibility.ANY修饰范围ANY-所有
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
//om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
//指定序列化输入的类型类必须是非final修饰的
om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
jackson2JsonRedisSerializer.setObjectMapper(om);
@ -80,7 +83,7 @@ public class RedisConfig {
private Environment environment;
// 这些环境的 redis 配置将被认做 single
private static final List<String> redisSingleList = Arrays.asList("local", "dev", "pro", "pufay");
private static final List<String> redisSingleList = Arrays.asList("local", "dev", "pro","pre","test", "pufay", "docker");
@ConditionalOnBean(name = "redisTemplate")
@Bean(destroyMethod = "shutdown")

View File

@ -0,0 +1,161 @@
package com.svnlan.edu.controller;
import com.svnlan.common.Result;
import com.svnlan.edu.domain.CatalogueResult;
import com.svnlan.edu.domain.EduInfo;
import com.svnlan.edu.domain.EduType;
import com.svnlan.edu.dto.EduDto;
import com.svnlan.edu.service.EduService;
import com.svnlan.exception.CodeMessageEnum;
import com.svnlan.exception.SvnlanRuntimeException;
import com.svnlan.jwt.tool.JWTTool;
import com.svnlan.utils.JsonUtils;
import com.svnlan.utils.LogUtil;
import com.svnlan.utils.PageResult;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
public class EduController {
@Resource
JWTTool jwtTool;
@Resource
EduService eduService;
/**
* @Description: 通用教学分类树
* @params: [dto]
* @Modified:
*/
@RequestMapping(value = "/api/disk/edu/getTeachTypeTree", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String getTeachTypeTree(HttpServletRequest request) {
String prefix = this.jwtTool.findApiPrefix(request);
Result result;
try {
List<EduType> list = eduService.getTeachTypeTree();
result = new Result(true, CodeMessageEnum.success.getCode(), list);
} catch (SvnlanRuntimeException e) {
result = new Result(false, e.getErrorCode(), e.getMessage());
} catch (Exception e) {
LogUtil.error(e, prefix + "error 失败" );
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
}
return JsonUtils.beanToJson(result);
}
/**
* 搜索页-教学分类树 每个分类下包含全部
* @param request
* @return
*/
@RequestMapping(value = "/api/disk/edu/getTeachTypeTreeAll", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String getTeachTypeTreeAll(HttpServletRequest request) {
String prefix = this.jwtTool.findApiPrefix(request);
Result result;
try {
List<EduType> list = eduService.getTeachTypeTreeAll();
result = new Result(true, CodeMessageEnum.success.getCode(), list);
} catch (SvnlanRuntimeException e) {
result = new Result(false, e.getErrorCode(), e.getMessage());
} catch (Exception e) {
LogUtil.error(e, prefix + "error 失败" );
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
}
return JsonUtils.beanToJson(result);
}
/**
* 2 学科课程-目录列表
* @param request
* @return
*/
@RequestMapping(value = "/api/disk/edu/catalogue", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String catalogue(EduDto eduDto, HttpServletRequest request) {
String prefix = this.jwtTool.findApiPrefix(request);
Result result;
try {
CatalogueResult re = eduService.catalogue(eduDto);
result = new Result(true, CodeMessageEnum.success.getCode(), re);
} catch (SvnlanRuntimeException e) {
result = new Result(false, e.getErrorCode(), e.getMessage());
} catch (Exception e) {
LogUtil.error(e, prefix + "error 失败" );
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
}
return JsonUtils.beanToJson(result);
}
/**
* 2 搜索页-搜索课时
* @param request
* @return
*/
@RequestMapping(value = "/api/disk/edu/searchCourseList", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String searchCourseList(EduDto eduDto, HttpServletRequest request) {
String prefix = this.jwtTool.findApiPrefix(request);
Result result;
try {
PageResult re = eduService.searchCourseList(eduDto);
result = new Result(true, CodeMessageEnum.success.getCode(), re);
} catch (SvnlanRuntimeException e) {
result = new Result(false, e.getErrorCode(), e.getMessage());
} catch (Exception e) {
LogUtil.error(e, prefix + "error 失败" );
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
}
return JsonUtils.beanToJson(result);
}
/**
* 5.拓展课程-拓展课程列表
* @param request
* @return
*/
@RequestMapping(value = "/api/disk/edu/courseCateList", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String courseCateList(EduDto eduDto, HttpServletRequest request) {
String prefix = this.jwtTool.findApiPrefix(request);
Result result;
try {
PageResult re = eduService.courseCateList(eduDto);
result = new Result(true, CodeMessageEnum.success.getCode(), re);
} catch (SvnlanRuntimeException e) {
result = new Result(false, e.getErrorCode(), e.getMessage());
} catch (Exception e) {
LogUtil.error(e, prefix + "error 失败" );
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
}
return JsonUtils.beanToJson(result);
}
/**
* 3.学科课程-标签关联的课时
* @param request
* @return
*/
@RequestMapping(value = "/api/disk/edu/tagCourseList", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String tagCourseList(EduDto eduDto, HttpServletRequest request) {
String prefix = this.jwtTool.findApiPrefix(request);
Result result;
try {
PageResult re = eduService.tagCourseList(eduDto);
result = new Result(true, CodeMessageEnum.success.getCode(), re);
} catch (SvnlanRuntimeException e) {
result = new Result(false, e.getErrorCode(), e.getMessage());
} catch (Exception e) {
LogUtil.error(e, prefix + "error 失败" );
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
}
return JsonUtils.beanToJson(result);
}
}

View File

@ -0,0 +1,24 @@
package com.svnlan.edu.domain;
import lombok.Data;
import java.util.List;
@Data
public class CatalogueResult {
List<EduInfo> catalogueList;
/** 学段名称 */
private String periodName;
/** 年级名称 */
private String gradeName;
/** 学科名称 */
private String subjectName;
/** 版本名称 */
private String editionName;
/** 册次名称 */
private String volumeName;
private Integer pvNum;
private Integer courseNum;
}

View File

@ -0,0 +1,41 @@
package com.svnlan.edu.domain;
import lombok.Data;
@Data
public class Course {
/** 课时id */
private Long id;
/** */
private Long rootId;
/** 单元id */
private Long courseCateId;
private Long courseId;
private Long courseCateTeacherId;
private Integer type;
/** 点击数 */
private Integer pvNum;
/** 直播状态 0未开始1直播中2已结束 */
private Integer status;
/** 课时名称 */
private String courseName;
private String orgName;
private String courseUuid;
private String teacherName;
private String teacherIds;
private String courseCateUuid;
private String liveStartTime;
private String liveEndTime;
private String courseCateName;
private String mainTeacherIds;
private String cateName;
private String termName;
private String teacherAvatarImage;
private String subjectName;
private String coverImage;
private String gradeName;
private boolean review;
/** 课时地址 */
private String url;
}

View File

@ -0,0 +1,19 @@
package com.svnlan.edu.domain;
import lombok.Data;
import java.util.List;
@Data
public class EduInfo {
/** 单元id */
private Long courseCateId;
/** 单元名称 */
private String name;
/** 1单元 2标签 */
private Integer type;
/** 标签列表 */
private List<NodeInfo> nodeList;
/** 课时列表 */
private List<Course> courseList;
}

View File

@ -0,0 +1,22 @@
package com.svnlan.edu.domain;
import lombok.Data;
import java.util.List;
/**
* 之江汇教学分类
*/
@Data
public class EduType {
/** 类型id*/
private Long id;
private Long rlId;
private Long parentId;
private Boolean hasTag;
/** 类型名称*/
private String typeName;
/** 类型 1学段 2年级 3学科 4版本 5册次*/
private Integer type;
private List<EduType> nodeList;
}

View File

@ -0,0 +1,13 @@
package com.svnlan.edu.domain;
import lombok.Data;
@Data
public class NodeInfo {
/** /标签名称 */
private String name;
/** 关联课时数 */
private Long courseNum;
/** 1单元 2标签 */
private Integer type;
}

View File

@ -0,0 +1,39 @@
package com.svnlan.edu.dto;
import lombok.Data;
@Data
public class EduDto {
/** 学段 */
private Long periodId;
/** 年级 */
private Long gradeId;
/** 学科 */
private Long subjectId;
/** 版本 */
private Long editionId;
/** 册次 */
private Long volumeId;
/** 学段名称 */
private String periodName;
/** 年级名称 */
private String gradeName;
/** 学科名称 */
private String subjectName;
/** 版本名称 */
private String editionName;
/** 册次名称 */
private String volumeName;
/** 关键词 */
private String keyword;
/** 搜索类型 0默认全部 1名称 2老师 3学校 */
private String searchType;
private Integer pageSize;
private Integer pageNum;
private Long courseCateId;
private String tagName;
}

View File

@ -0,0 +1,19 @@
package com.svnlan.edu.service;
import com.svnlan.edu.domain.CatalogueResult;
import com.svnlan.edu.domain.EduInfo;
import com.svnlan.edu.domain.EduType;
import com.svnlan.edu.dto.EduDto;
import com.svnlan.utils.PageResult;
import java.util.List;
public interface EduService {
List<EduType> getTeachTypeTree();
List<EduType> getTeachTypeTreeAll();
CatalogueResult catalogue(EduDto eduDto);
PageResult searchCourseList(EduDto eduDto);
PageResult courseCateList(EduDto eduDto);
PageResult tagCourseList(EduDto eduDto);
}

View File

@ -0,0 +1,57 @@
package com.svnlan.edu.service.impl;
import com.svnlan.edu.domain.CatalogueResult;
import com.svnlan.edu.domain.EduInfo;
import com.svnlan.edu.domain.EduType;
import com.svnlan.edu.dto.EduDto;
import com.svnlan.edu.service.EduService;
import com.svnlan.edu.tool.EduInfoUtils;
import com.svnlan.utils.PageResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class EduServiceimpl implements EduService {
@Resource
EduInfoUtils eduInfoUtils;
@Override
public List<EduType> getTeachTypeTree(){
return eduInfoUtils.getTeachTypeTree();
}
@Override
public List<EduType> getTeachTypeTreeAll(){
return eduInfoUtils.getTeachTypeTreeAll();
}
@Override
public CatalogueResult catalogue(EduDto eduDto){
CatalogueResult re= new CatalogueResult();
List<EduInfo> list = eduInfoUtils.catalogue(eduDto);
re.setCatalogueList(list);
re.setEditionName(eduDto.getEditionName());
re.setVolumeName(eduDto.getVolumeName());
re.setSubjectName(eduDto.getSubjectName());
re.setGradeName(eduDto.getGradeName());
re.setPeriodName(eduDto.getPeriodName());
return re;
}
@Override
public PageResult searchCourseList(EduDto eduDto){
return eduInfoUtils.searchCourseList(eduDto);
}
@Override
public PageResult courseCateList(EduDto eduDto){
return eduInfoUtils.courseCateList(eduDto);
}
@Override
public PageResult tagCourseList(EduDto eduDto){
return eduInfoUtils.tagCourseList(eduDto);
}
}

View File

@ -0,0 +1,35 @@
package com.svnlan.edu.tool;
public class EduHostConfig {
/**
* 1.通用-教学分类树 不包含全部选项
*/
public static final String teachTypeTree_host = "https://uc.zjedu.com/api/base/eduInfo/teachTypeTree";
/**
* 7搜索页-教学分类树 每个分类下包含全部
*/
public static final String teachTypeTreeAll_host = "https://uc.zjedu.com/api/base/eduInfo/teachType/treeHasAll";
/**
* 2.学科课程-目录列表
*/
public static final String catalogue_host = "https://uc.zjedu.com/api/base/eduInfo/catalogue";
/**
* 5.拓展课程-拓展课程列表
*/
public static final String courseCateList_host = "https://uc.zjedu.com/api/base/eduInfo/courseCate/list";
/**
* 8.搜索页-搜索课时
*/
public static final String searchCourseList_host = "https://uc.zjedu.com/api/base/eduInfo/search/course/list";
/**
* 3.学科课程-标签关联的课时
*/
public static final String tagCourseList_host = "https://uc.zjedu.com/api/base/eduInfo/course/list";
}

View File

@ -0,0 +1,281 @@
package com.svnlan.edu.tool;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.svnlan.edu.domain.Course;
import com.svnlan.edu.domain.EduInfo;
import com.svnlan.edu.domain.EduType;
import com.svnlan.edu.dto.EduDto;
import com.svnlan.exception.CodeMessageEnum;
import com.svnlan.exception.SvnlanRuntimeException;
import com.svnlan.utils.LogUtil;
import com.svnlan.utils.PageResult;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.*;
/**
* 之江汇文档
*/
@Component
public class EduInfoUtils {
@Resource
RestTemplate restTemplate;
/**
* 1.通用-教学分类树 不包含全部选项
* https://uc.zjedu.com/api/base/eduInfo/teachTypeTree
* @return
*/
public List<EduType> getTeachTypeTree(){
List<EduType> list = null;
Map<String, Object> paramMap = new HashMap<>();
try {
String result = restTemplate.postForEntity(EduHostConfig.teachTypeTree_host, paramMap, String.class).getBody();
LogUtil.info("getTeachTypeTree result=" + result);
if (!ObjectUtils.isEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result);
if ("0".equals(jsonObject.getString("code"))){
JSONArray jsonArray = jsonObject.getJSONArray("data");
if (jsonArray.size() > 0) {
list = jsonArray.toJavaList(EduType.class);
}
}else {
LogUtil.error("getTeachTypeTree 查询数据异常 result=" + result);
throw new SvnlanRuntimeException(CodeMessageEnum.explorerDataError);
}
}
} catch (Exception e) {
LogUtil.error(e, "通用-教学分类树 获取失败");
}
return list;
}
/**
* 搜索页-教学分类树 每个分类下包含全部
* https://uc.zjedu.com/api/base/eduInfo/teachType/treeHasAll
* @return
*/
public List<EduType> getTeachTypeTreeAll(){
List<EduType> list = null;
Map<String, Object> paramMap = new HashMap<>();
try {
String result = restTemplate.postForEntity(EduHostConfig.teachTypeTreeAll_host, paramMap, String.class).getBody();
LogUtil.info("getTeachTypeTreeAll result=" + result);
if (!ObjectUtils.isEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result);
if ("0".equals(jsonObject.getString("code"))){
JSONArray jsonArray = jsonObject.getJSONArray("data");
if (jsonArray.size() > 0) {
list = jsonArray.toJavaList(EduType.class);
}
}else {
LogUtil.error("getTeachTypeTreeAll 查询数据异常 result=" + result);
throw new SvnlanRuntimeException(CodeMessageEnum.explorerDataError);
}
}
} catch (Exception e) {
LogUtil.error(e, "getTeachTypeTreeAll 搜索页-教学分类树 获取失败");
}
return list;
}
/**
* 2.学科课程-目录列表
* https://uc.zjedu.com/api/base/eduInfo/catalogue
* @return
*/
public List<EduInfo> catalogue(EduDto eduDto){
List<EduInfo> list = null;
StringBuilder sb = new StringBuilder();
sb.append("?periodId=" + (!ObjectUtils.isEmpty(eduDto.getPeriodId()) ? eduDto.getPeriodId() : 0));
sb.append("&gradeId=" + (!ObjectUtils.isEmpty(eduDto.getGradeId()) ? eduDto.getGradeId() : 0));
sb.append("&subjectId=" + (!ObjectUtils.isEmpty(eduDto.getSubjectId()) ? eduDto.getSubjectId() : 0));
sb.append("&editionId=" + (!ObjectUtils.isEmpty(eduDto.getEditionId()) ? eduDto.getEditionId() : 0));
sb.append("&volumeId=" + (!ObjectUtils.isEmpty(eduDto.getVolumeId()) ? eduDto.getVolumeId() : 0));
try {
String result = restTemplate.postForEntity(EduHostConfig.catalogue_host + sb.toString(), null, String.class).getBody();
LogUtil.info("catalogue result=" + result);
if (!ObjectUtils.isEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result);
if ("0".equals(jsonObject.getString("code"))){
JSONArray jsonArray = jsonObject.getJSONArray("data");
if (jsonArray.size() > 0) {
list = jsonArray.toJavaList(EduInfo.class);
}
}else {
LogUtil.error("catalogue 查询数据异常 result=" + result);
throw new SvnlanRuntimeException(CodeMessageEnum.explorerDataError);
}
}
} catch (Exception e) {
LogUtil.error(e, "catalogue 学科课程-目录列表 获取失败");
}
return list;
}
/**
* 8.搜索页-搜索课时
* https://uc.zjedu.com/api/base/eduInfo/search/course/list
* @return
*/
public PageResult searchCourseList(EduDto eduDto){
PageResult pageResult = new PageResult(0L, new ArrayList());
pageResult.setHasNextPage(false);
List<Course> list = null;
StringBuilder sb = new StringBuilder();
sb.append("?periodId=" + (!ObjectUtils.isEmpty(eduDto.getPeriodId()) ? eduDto.getPeriodId() : 0));
sb.append("&gradeId=" + (!ObjectUtils.isEmpty(eduDto.getGradeId()) ? eduDto.getGradeId() : 0));
sb.append("&subjectId=" + (!ObjectUtils.isEmpty(eduDto.getSubjectId()) ? eduDto.getSubjectId() : 0));
sb.append("&editionId=" + (!ObjectUtils.isEmpty(eduDto.getEditionId()) ? eduDto.getEditionId() : 0));
sb.append("&volumeId=" + (!ObjectUtils.isEmpty(eduDto.getVolumeId()) ? eduDto.getVolumeId() : 0));
sb.append("&searchType=" + (!ObjectUtils.isEmpty(eduDto.getSearchType()) ? eduDto.getSearchType() : 0));
if (!ObjectUtils.isEmpty(eduDto.getKeyword())) {
sb.append("&keyword=" + eduDto.getKeyword());
}
sb.append("&pageSize=" + (!ObjectUtils.isEmpty(eduDto.getPageSize()) ? eduDto.getPageSize() : 20));
sb.append("&pageNum=" + (!ObjectUtils.isEmpty(eduDto.getPageNum()) ? eduDto.getPageNum() : 1));
String url = EduHostConfig.searchCourseList_host + sb.toString();
try {
String result = restTemplate.postForEntity(url, null, String.class).getBody();
LogUtil.info("searchCourseList_host result=" + result + "url=" + url);
if (!ObjectUtils.isEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result);
if ("0".equals(jsonObject.getString("code"))){
JSONObject data = (JSONObject)jsonObject.get("data");
pageResult.setTotal(data.getLong("total"));
pageResult.setHasNextPage(data.getBoolean("hasNext"));
JSONArray jsonArray = data.getJSONArray("data");
if (jsonArray.size() > 0) {
list = jsonArray.toJavaList(Course.class);
pageResult.setList(list);
}
}else {
LogUtil.error("searchCourseList_host 查询数据异常 result=" + result);
throw new SvnlanRuntimeException(CodeMessageEnum.explorerDataError);
}
}
} catch (Exception e) {
LogUtil.error(e, "searchCourseList_host 搜索页-搜索课时 获取失败");
}
return pageResult;
}
/**
* 5.拓展课程-拓展课程列表
* https://uc.zjedu.com/api/base/eduInfo/courseCate/list
* @return
*/
public PageResult courseCateList(EduDto eduDto){
PageResult pageResult = new PageResult(0L, new ArrayList());
pageResult.setHasNextPage(false);
List<Course> list = null;
StringBuilder sb = new StringBuilder();
sb.append("?periodId=" + (!ObjectUtils.isEmpty(eduDto.getPeriodId()) ? eduDto.getPeriodId() : 0));
sb.append("&gradeId=" + (!ObjectUtils.isEmpty(eduDto.getGradeId()) ? eduDto.getGradeId() : 0));
sb.append("&subjectId=" + (!ObjectUtils.isEmpty(eduDto.getSubjectId()) ? eduDto.getSubjectId() : 0));
sb.append("&editionId=" + (!ObjectUtils.isEmpty(eduDto.getEditionId()) ? eduDto.getEditionId() : 0));
sb.append("&volumeId=" + (!ObjectUtils.isEmpty(eduDto.getVolumeId()) ? eduDto.getVolumeId() : 0));
sb.append("&pageSize=" + (!ObjectUtils.isEmpty(eduDto.getPageSize()) ? eduDto.getPageSize() : 20));
sb.append("&pageNum=" + (!ObjectUtils.isEmpty(eduDto.getPageNum()) ? eduDto.getPageNum() : 1));
String url = EduHostConfig.courseCateList_host + sb.toString();
try {
String result = restTemplate.postForEntity(url, null, String.class).getBody();
LogUtil.info("courseCateList result=" + result + "url=" + url);
if (!ObjectUtils.isEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result);
if ("0".equals(jsonObject.getString("code"))){
JSONObject data = (JSONObject)jsonObject.get("data");
pageResult.setTotal(data.getLong("total"));
pageResult.setHasNextPage(data.getBoolean("hasNext"));
JSONArray jsonArray = data.getJSONArray("data");
if (jsonArray.size() > 0) {
list = jsonArray.toJavaList(Course.class);
pageResult.setList(list);
}
}else {
LogUtil.error("courseCateList 查询数据异常 result=" + result);
throw new SvnlanRuntimeException(CodeMessageEnum.explorerDataError);
}
}
} catch (Exception e) {
LogUtil.error(e, "courseCateList 拓展课程-拓展课程列表 获取失败");
}
return pageResult;
}
/**
* 3.学科课程-标签关联的课时
* https://uc.zjedu.com/api/base/eduInfo/course/list?courseCateId=1249&tagName=象形字&pageSize=20&pageNum=1
* @return
*/
public PageResult tagCourseList(EduDto eduDto){
PageResult pageResult = new PageResult(0L, new ArrayList());
pageResult.setHasNextPage(false);
List<Course> list = null;
StringBuilder sb = new StringBuilder();
sb.append("?courseCateId=" + (!ObjectUtils.isEmpty(eduDto.getCourseCateId()) ? eduDto.getCourseCateId() : 0));
sb.append("&tagName=" + (!ObjectUtils.isEmpty(eduDto.getTagName()) ? eduDto.getTagName() : ""));
sb.append("&pageSize=" + (!ObjectUtils.isEmpty(eduDto.getPageSize()) ? eduDto.getPageSize() : 20));
sb.append("&pageNum=" + (!ObjectUtils.isEmpty(eduDto.getPageNum()) ? eduDto.getPageNum() : 1));
String url = EduHostConfig.tagCourseList_host + sb.toString();
try {
String result = restTemplate.postForEntity(url, null, String.class).getBody();
LogUtil.info("tagCourseList result=" + result + "url=" + url);
if (!ObjectUtils.isEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result);
if ("0".equals(jsonObject.getString("code"))){
JSONObject data = (JSONObject)jsonObject.get("data");
Map<String, Object> re = new HashMap<>();
re.put("courseCateId", eduDto.getCourseCateId());
re.put("tagName", eduDto.getTagName());
re.put("periodId", jsonObject.getLongValue("periodId"));
re.put("gradeId", jsonObject.getLongValue("gradeId"));
re.put("editionId", jsonObject.getLongValue("editionId"));
re.put("subjectId", jsonObject.getLongValue("subjectId"));
re.put("volumeId", jsonObject.getLongValue("volumeId"));
re.put("gradeName", jsonObject.getString("gradeName"));
re.put("editionName", jsonObject.getString("editionName"));
re.put("periodName", jsonObject.getString("periodName"));
re.put("volumeName", jsonObject.getString("volumeName"));
re.put("courseCateName", jsonObject.getString("courseCateName"));
re.put("subjectName", jsonObject.getString("subjectName"));
pageResult.setResult(re);
pageResult.setTotal(data.getLong("total"));
pageResult.setHasNextPage(data.getBoolean("hasNext"));
JSONArray jsonArray = data.getJSONArray("data");
if (jsonArray.size() > 0) {
list = jsonArray.toJavaList(Course.class);
pageResult.setList(list);
}
}else {
LogUtil.error("tagCourseList 查询数据异常 result=" + result);
throw new SvnlanRuntimeException(CodeMessageEnum.explorerDataError);
}
}
} catch (Exception e) {
LogUtil.error(e, "tagCourseList 学科课程-标签关联的课时 获取失败");
}
return pageResult;
}
}

View File

@ -0,0 +1,33 @@
package com.svnlan.enums;
/**
* @Author: sulijuan
* @Description:
* @Date: 2023/10/26 9:41
*/
public enum DingSpaceTypeEnum {
org("1", "org"),
co("4", "co"),
group("2", "group"),
hideOrgEmp("3", "hideOrgEmp"),
;
private String code;
private String value;
private DingSpaceTypeEnum(String code, String value) {
this.code = code;
this.value = value;
}
public String getCode() {
return code;
}
public String getValue() {
return value;
}
}

View File

@ -47,6 +47,15 @@ public enum LogTypeEnum {
zipDownload(32, "explorer.index.zipDownload", "文件夹下载", "admin.log.downFolder"),
fileOut(33, "explorer.index.fileOut", "", "admin.log.downFile"),
clearTenant(34, "tenant.clear", "租户资源清理", "admin.tenant.clear"),
pullDing(35, "pull.ding", "同步钉钉组织结构", ""),
pullDingGroup(36, "pull.ding.group", "同步钉钉部门", ""),
pullDingUser(37, "pull.ding.user", "同步钉钉用户", ""),
pullEnWebchat(38, "pull.enWebchat", "同步企业微信组织结构", ""),
pullEnWebchatGroup(39, "pull.enWebchat.group", "同步企业微信部门", ""),
pullEnWebchatUser(40, "pull.enWebchat.user", "同步企业微信用户", ""),
pullCube(41, "pull.Cube", "同步魔方组织结构", ""),
pullCubeGroup(42, "pull.Cube.group", "同步魔方部门", ""),
pullCubeUser(43, "pull.Cube.user", "同步魔方用户", ""),
;
private int id;

View File

@ -16,7 +16,9 @@ public enum SecurityTypeEnum {
ALIPAY("6", "alipay"),
EN_WECHAT("7", "enWechat"),
DING_DING("8", "dingding"),
WECHAT_APP("12", "wechatApp");
WECHAT_APP("12", "wechatApp"),
CUBE("13", "cube")
;
private String code;

View File

@ -8,7 +8,8 @@ public enum SendOperateTypeEnum {
BINDING("1","绑定"),
FIND("2","忘记登录密码"),
FORGET("3","设置支付密码");
FORGET("3","设置支付密码"),
SAFE("4","私密保险箱");
private String code;

View File

@ -25,11 +25,11 @@ public enum SortFieldEnum {
public static String getSortField(String value) {
switch (value) {
case "sizeUse":
return sizeUse.getValue();
return "size_use";
case "roleID":
return roleID.getValue();
return "role_id";
default:
return sizeUse.getValue();
return "size_use";
}
}

View File

@ -13,10 +13,10 @@ import java.util.stream.Collectors;
*/
public enum SourceFieldEnum {
name("1", "name"),
fileType("2", "fileType"),
fileType("2", "file_type"),
size("3", "size"),
modifyTime("4", "modifyTime"),
createTime("3", "createTime"),
modifyTime("4", "modify_time"),
createTime("3", "create_time"),
;
private String code;
@ -49,16 +49,16 @@ public enum SourceFieldEnum {
}
switch (value) {
case "name":
return "io." + name.getValue();
return "" + name.getValue();
case "size":
return "io." + size.getValue();
return "" + size.getValue();
case "fileType":
case "ext":
return "io." + fileType.getValue();
return "" + fileType.getValue();
case "modifyTime":
return "cc." + modifyTime.getValue();
return "common_convert." + modifyTime.getValue();
case "createTime":
return "cc." + createTime.getValue();
return "common_convert." + createTime.getValue();
default:
return "stateSort";
}

View File

@ -33,6 +33,7 @@ public enum UserOptionEnum {
listSortKeep("listSortKeep", "1", ""),
fileRepeat("fileRepeat", "replace", ""),
recycleOpen("recycleOpen", "1", ""),
kodAppDefault("kodAppDefault", "", ""),
fileIconSizeDesktop("fileIconSizeDesktop", "70", ""),
fileIconSizePhoto("fileIconSizePhoto", "120", ""),
photoConfig("photoConfig", "", ""),
@ -54,10 +55,10 @@ public enum UserOptionEnum {
return keyList.contains(value);
}
public static List<UserOption> setDefaultOptionList(Long userID){
public static List<UserOption> setDefaultOptionList(Long userID, Long tenantId){
List<UserOption> paramList = new ArrayList<>();
for (UserOptionEnum optionEnum :values()){
paramList.add(new UserOption(userID, optionEnum.getType(), optionEnum.getCode(), optionEnum.getValue()));
paramList.add(new UserOption(userID, optionEnum.getType(), optionEnum.getCode(), optionEnum.getValue(), tenantId));
}
return paramList;
}

View File

@ -130,7 +130,7 @@ public enum CodeMessageEnum {
repeatError("explorer.repeatError", "操作失败,该名称已存在"),
pathExists("explorer.pathExists", "该名称已存在"),
groupDelError("explorer.groupDelError", "抱歉部门文件夹不支持删除"),
unzipErrorTips("explorer.unzipErrorTips", "出错了!未识别的压缩文件格式;<br/> 请检查该文件是否为压缩文件或者是否损坏。"),
unzipErrorTips("explorer.unzipErrorTips", "出错了!未识别的压缩文件格式;请检查该文件是否为压缩文件或者是否损坏。"),
dragDownloadOpenTips("admin.setting.dragDownloadOpenTips", "请联系管理员在后台设置中开启"),
infoTypeDelError("admin.info.typeDelError", "删除失败,有子分类或数据"),
DOMAIN_CANNOT_RECOGNIZE("admin.info.domainIdentifyError", "网站无法识别"),
@ -144,6 +144,10 @@ public enum CodeMessageEnum {
TEMP_AUTH_INVALID("explorer.TEMP_AUTH_INVALID", "临时授权码无效(失效)"),
QR_INVALID("explorer.QR_INVALID", "二维码已失效"),
uploadError("explorer.upload.error", "上传失败"),
totalUsersLimit("admin.totalUsers.exceeds.limit", "用户总数超过限制"),
userBindingExist("user.binding.exist", "已绑定该账号"),
userBindingOtherExist("user.binding.other.exist", "已绑定其他账号,请先进行解绑"),
downLimitSizeError("explorer.downLimitSizeError", "下载超过文件限制大小!"),
;
private String code;
private String msg;

View File

@ -0,0 +1,91 @@
package com.svnlan.home.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.svnlan.common.Result;
import com.svnlan.exception.DingCallbackCrypto;
import com.svnlan.home.service.DingEventService;
import com.svnlan.user.domain.ThirdUserInitializeConfig;
import com.svnlan.user.tools.OptionTool;
import com.svnlan.user.vo.DingConfigVo;
import com.svnlan.utils.LogUtil;
import io.jsonwebtoken.lang.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Map;
/**
* @Author: sulijuan
* @Description:
* @Date: 2023/10/19 10:50
*/
@RestController
public class DingCallbackController {
@Resource
DingEventService dingEventService;
@Resource
OptionTool optionTool;
private final Logger LOGGER = LoggerFactory.getLogger("error");
/**
* 钉钉登录获取授权码回调接口
*/
@PostMapping("/api/ding/even/callback")
public Map<String, String> callBack(
@RequestParam(value = "msg_signature", required = false) String msg_signature,
@RequestParam(value = "timestamp", required = false) String timeStamp,
@RequestParam(value = "nonce", required = false) String nonce,
@RequestBody(required = false) JSONObject json) {
DingConfigVo dingConfigVo = optionTool.getDingDingConfig();
String AES_KEY = dingConfigVo.getAesKey();
String AES_TOKEN = dingConfigVo.getAesToken();
String OWNER_KEY = dingConfigVo.getCorpId();
try {
// 1. 从http请求中获取加解密参数
// 2. 使用加解密类型
// Constant.OWNER_KEY 说明
// 1开发者后台配置的订阅事件为应用级事件推送此时OWNER_KEY为应用的APP_KEY
// 2调用订阅事件接口订阅的事件为企业级事件推送
// 此时OWNER_KEY为企业的appkey企业内部应用或SUITE_KEY三方应用
DingCallbackCrypto callbackCrypto = new DingCallbackCrypto(AES_TOKEN, AES_KEY, OWNER_KEY);
String encryptMsg = json.getString("encrypt");
String decryptMsg = callbackCrypto.getDecryptMsg(msg_signature, timeStamp, nonce, encryptMsg);
LogUtil.info("dingEventCallBack decryptMsg=" +decryptMsg);
// 3. 反序列化回调事件json数据
JSONObject eventJson = JSON.parseObject(decryptMsg);
String eventType = eventJson.getString("EventType");
// 4. 根据EventType分类处理
if ("check_url".equals(eventType)) {
// 测试回调url的正确性
LOGGER.info("测试回调url的正确性");
} else {
// 添加已注册的
LOGGER.info("other 发生了:" + eventType + "事件");
dingEventService.dingEventCallback(eventJson);
}
// 5. 返回success的加密数据
Map<String, String> successMap = callbackCrypto.getEncryptedMap("success");
return successMap;
} catch (DingCallbackCrypto.DingTalkEncryptException e) {
LogUtil.error(e, "/api/ding/even/callback DingTalkEncryptException error");
} catch (Exception e) {
LogUtil.error(e, "/api/ding/even/callback error");
}
return null;
}
}

View File

@ -11,9 +11,12 @@ import com.svnlan.home.dto.DingDto;
import com.svnlan.home.dto.LabelDto;
import com.svnlan.home.vo.CommonLabelVo;
import com.svnlan.jwt.domain.LoginUser;
import com.svnlan.user.tools.OptionTool;
import com.svnlan.user.vo.DingConfigVo;
import com.svnlan.utils.JsonUtils;
import com.svnlan.utils.LogUtil;
import org.apache.tomcat.util.bcel.classfile.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -30,14 +33,8 @@ import java.util.Map;
*/
@RestController
public class DingController {
@Value("${dingding.token}")
private String dingToken;
@Value("${dingding.aes.key}")
private String dingAesKey;
@Value("${dingding.app.key}")
private String ownKey;
@Autowired
OptionTool optionTool;
@PostMapping("/api/disk/dingCallback2")
public Map<String, String> eventCallback(HttpServletRequest request,
@ -45,7 +42,8 @@ public class DingController {
@RequestParam(value = "timestamp", required = false) String timeStamp,
@RequestParam(value = "nonce", required = false) String nonce,
@RequestBody(required = false) JSONObject json) throws DingCallbackCrypto.DingTalkEncryptException {
DingCallbackCrypto callbackCrypto = new DingCallbackCrypto(dingToken, dingAesKey, ownKey);
DingConfigVo config = optionTool.getDingDingConfig();
DingCallbackCrypto callbackCrypto = new DingCallbackCrypto(config.getAesToken(), config.getAesKey(), config.getCorpId());
Map<String, String> successMap = callbackCrypto.getEncryptedMap("success");
LogUtil.info(successMap.toString());
return successMap;
@ -65,7 +63,8 @@ public class DingController {
// 1开发者后台配置的订阅事件为应用级事件推送此时OWNER_KEY为应用的APP_KEY
// 2调用订阅事件接口订阅的事件为企业级事件推送
// 此时OWNER_KEY为企业的appkey企业内部应用或SUITE_KEY三方应用
DingCallbackCrypto callbackCrypto = new DingCallbackCrypto(dingToken, dingAesKey, ownKey);
DingConfigVo config = optionTool.getDingDingConfig();
DingCallbackCrypto callbackCrypto = new DingCallbackCrypto(config.getAesToken(), config.getAesKey(), config.getCorpId());
String encryptMsg = json.getString("encrypt");
String decryptMsg = callbackCrypto.getDecryptMsg(msg_signature, timeStamp, nonce, encryptMsg);

View File

@ -0,0 +1,193 @@
package com.svnlan.home.controller;
import com.alibaba.fastjson.JSONObject;
import com.svnlan.common.GlobalConfig;
import com.svnlan.common.Result;
import com.svnlan.exception.CodeMessageEnum;
import com.svnlan.exception.SvnlanRuntimeException;
import com.svnlan.home.dto.CheckFileDTO;
import com.svnlan.home.dto.ExplorerOperationsDTO;
import com.svnlan.home.dto.ExplorerShareDTO;
import com.svnlan.home.service.ExplorerOperationsService;
import com.svnlan.home.vo.HomeExplorerVO;
import com.svnlan.jwt.domain.LoginUser;
import com.svnlan.jwt.tool.JWTTool;
import com.svnlan.user.dto.UserDTO;
import com.svnlan.utils.JsonUtils;
import com.svnlan.utils.LogUtil;
import com.svnlan.utils.LoginUserUtil;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @author KingMgg
* @data 2023/2/7 16:07
*/
@Api("用户操作")
@RestController
public class ExplorerOperationsController {
@Autowired
ExplorerOperationsService operationsService;
@Resource
JWTTool jwtTool;
@Resource
LoginUserUtil loginUserUtil;
/**
* 初始化io_source的 parentLevel 父路径id; 例如: ,0,2,5,10,
*
* @param
* @return
*/
@RequestMapping(value = "/api/disk/initSourcePathLevel", method = RequestMethod.GET)
public String initSourcePathLevel(ExplorerOperationsDTO dto) {
Result result;
try {
operationsService.initSourcePathLevel(dto.getSourceID());
result = new Result(true, CodeMessageEnum.success.getCode(), null);
} catch (SvnlanRuntimeException e) {
LogUtil.error(e, " initSourcePathLevel Svnlan error!");
//处理异常
result = new Result(false, e.getErrorCode(), null);
return JsonUtils.beanToJson(result);
} catch (Exception e) {
LogUtil.error(e, " initSourcePathLevel Exception error!");
//处理异常
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
return JsonUtils.beanToJson(result);
}
return JsonUtils.beanToJson(result);
}
/**
* @Description: 根据入参统计文件夹的size
* @params: [operation 需要统计的文件夹ID多个用英文逗号,隔开,status=1则统计未删除的不传默认都统计]
* @Return: java.lang.String
* @Author: sulijuan
* @Date: 2023/9/9 12:51
* @Modified:
*/
@RequestMapping(value = "/api/disk/countSize", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String zip(@RequestBody CheckFileDTO updateFileDTO) {
Result result;
Map<String, Object> resultMap = new HashMap<>(1);
LoginUser loginUser = loginUserUtil.getLoginUser();
if (ObjectUtils.isEmpty(loginUser.getUserType()) || loginUser.getUserType().intValue() != 1) {
result = new Result(false, CodeMessageEnum.errorAdminAuth.getCode(), null);
return JsonUtils.beanToJson(result);
}
try {
operationsService.countSize(updateFileDTO, resultMap, loginUser);
result = new Result(true, CodeMessageEnum.success.getCode(), resultMap);
} catch (SvnlanRuntimeException e) {
result = new Result(false, e.getErrorCode(), resultMap);
} catch (Exception e) {
LogUtil.error(e, "压缩zip失败" + JsonUtils.beanToJson(updateFileDTO));
result = new Result(false, CodeMessageEnum.system_error.getCode(), resultMap);
}
return JsonUtils.beanToJson(result);
}
@RequestMapping(value = "/api/disk/setSafePwd", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String setSafePwd(@RequestBody CheckFileDTO updateFileDTO) {
Result result;
Map<String, Object> resultMap = new HashMap<>(1);
LoginUser loginUser = loginUserUtil.getLoginUser();
try {
operationsService.setSafePwd(updateFileDTO, resultMap, loginUser);
result = new Result(true, CodeMessageEnum.success.getCode(), resultMap);
} catch (SvnlanRuntimeException e) {
result = new Result(false, e.getErrorCode(), resultMap);
} catch (Exception e) {
LogUtil.error(e, "设置私密密码箱密码" + JsonUtils.beanToJson(updateFileDTO));
result = new Result(false, CodeMessageEnum.system_error.getCode(), resultMap);
}
return JsonUtils.beanToJson(result);
}
@RequestMapping(value = "/api/disk/checkSafePwd", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String checkSafePwd(@RequestBody CheckFileDTO updateFileDTO) {
Result result;
Map<String, Object> resultMap = new HashMap<>(1);
LoginUser loginUser = loginUserUtil.getLoginUser();
try {
operationsService.checkSafePwd(updateFileDTO, resultMap, loginUser);
result = new Result(true, CodeMessageEnum.success.getCode(), resultMap);
} catch (SvnlanRuntimeException e) {
result = new Result(false, e.getErrorCode(), resultMap);
} catch (Exception e) {
LogUtil.error(e, "校验私密密码箱密码" + JsonUtils.beanToJson(updateFileDTO));
result = new Result(false, CodeMessageEnum.system_error.getCode(), resultMap);
}
return JsonUtils.beanToJson(result);
}
@RequestMapping(value = "/api/disk/file/send", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String sendFile(@RequestBody UserDTO userDTO) {
JSONObject check;
Result result;
try {
LoginUser loginUser = loginUserUtil.getLoginUser();
//发送验证码
check = operationsService.sendEmailFile(userDTO, loginUser);
} catch (SvnlanRuntimeException e) {
//处理异常
result = new Result(Boolean.FALSE, e.getErrorCode(), null);
return JsonUtils.beanToJson(result);
} catch (Exception ex) {
//处理异常
result = new Result(Boolean.FALSE, CodeMessageEnum.system_error.getCode(), null);
return JsonUtils.beanToJson(result);
}
// 返回操作成功信息
result = new Result(Boolean.TRUE, CodeMessageEnum.success.getCode(), check);
return JsonUtils.beanToJson(result);
}
@RequestMapping(value = "/api/disk/file/checkSend", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String checkSend(@RequestBody UserDTO userDTO) {
JSONObject check;
Result result;
try {
LoginUser loginUser = loginUserUtil.getLoginUser();
//发送验证码
check = operationsService.sendEmailCheck(userDTO, loginUser);
} catch (SvnlanRuntimeException e) {
//处理异常
result = new Result(Boolean.FALSE, e.getErrorCode(), null);
return JsonUtils.beanToJson(result);
} catch (Exception ex) {
//处理异常
result = new Result(Boolean.FALSE, CodeMessageEnum.system_error.getCode(), null);
return JsonUtils.beanToJson(result);
}
String code = check.getString("code");
if ("0".equals(code)){
// 返回操作成功信息
result = new Result(Boolean.TRUE, CodeMessageEnum.success.getCode(), check);
}else {
// 返回操作成功信息
result = new Result(Boolean.FALSE, CodeMessageEnum.sendFail.getCode(), check);
}
return JsonUtils.beanToJson(result);
}
}

View File

@ -20,12 +20,15 @@ import com.svnlan.jwt.domain.LoginUser;
import com.svnlan.jwt.tool.JWTTool;
import com.svnlan.user.service.IoSourceService;
import com.svnlan.user.service.SystemLogService;
import com.svnlan.user.tools.OptionTool;
import com.svnlan.user.vo.EnWebChatConfigVo;
import com.svnlan.utils.JsonUtils;
import com.svnlan.utils.LogUtil;
import com.svnlan.utils.LoginUserUtil;
import com.svnlan.utils.PageResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
@ -61,6 +64,10 @@ public class HomeExplorerController {
SourceFileService sourceFileService;
@Resource
StringRedisTemplate stringRedisTemplate;
@Resource
OptionTool optionTool;
@Value("${third.search.appId}")
private String searchAppId;
@Resource
@ -251,6 +258,7 @@ public class HomeExplorerController {
Map<String, Object> explorerResult;
try {
explorerResult = homeExplorerService.systemOpenInfo();
explorerResult.put("isShowSearch",!ObjectUtils.isEmpty(searchAppId) ? 1 : 0 );
} catch (SvnlanRuntimeException e) {
LogUtil.error(e, prefix + " Svnlan error!");
//处理异常
@ -404,6 +412,29 @@ public class HomeExplorerController {
return JsonUtils.beanToJson(result);
}
@GetMapping("/api/disk/sourcePreview")
public String parentSourceList2(HttpServletRequest request, HomeExplorerDTO homeExplorerDTO) {
String prefix = this.jwtTool.findApiPrefix(request);
Result result;
JSONObject re;
try {
re = sourceHistoryService.parentSourceList2(homeExplorerDTO, loginUserUtil.getLoginUser());
} catch (SvnlanRuntimeException e) {
LogUtil.error(e, prefix + " Svnlan error!");
//处理异常
result = new Result(false, e.getErrorCode(), null);
return JsonUtils.beanToJson(result);
} catch (Exception e) {
LogUtil.error(e, prefix + " Exception error!");
//处理异常
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
return JsonUtils.beanToJson(result);
}
// 返回平台信息
result = new Result(true, CodeMessageEnum.success.getCode(), re);
return JsonUtils.beanToJson(result);
}
/**
* 获取用户文件类型占比
@ -496,6 +527,75 @@ public class HomeExplorerController {
}
return JsonUtils.beanToJson(result);
}
@RequestMapping(value = "/api/disk/getAboutEnInfo", method = RequestMethod.GET)
public String getAboutEnInfo(HomeExplorerDTO homeExp) {
Result result = null;
try {
EnWebChatConfigVo config = optionTool.getEnWebChatConfig();
Map<String, String> re = new HashMap<>(1);
re.put("agentId", config.getAgentId());
result = new Result(true, CodeMessageEnum.success.getCode(), re);
} catch (SvnlanRuntimeException e) {
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
} catch (Exception e) {
LogUtil.error(e, "/api/disk/getAboutEnInfo" + JsonUtils.beanToJson(homeExp));
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
}
return JsonUtils.beanToJson(result);
}
@RequestMapping(value = "/api/disk/setCover", method = RequestMethod.POST)
public String setCover(@RequestBody HomeExplorerDTO homeExp) {
Result result = null;
try {
LoginUser loginUser = loginUserUtil.getLoginUser();
boolean re = sourceFileService.setCover(homeExp, loginUser);
result = new Result(true, CodeMessageEnum.success.getCode(), re);
} catch (SvnlanRuntimeException e) {
LogUtil.error(e, "/api/disk/setCover svn=" + JsonUtils.beanToJson(homeExp));
result = new Result(false, e.getErrorCode(), null);
} catch (Exception e) {
LogUtil.error(e, "/api/disk/setCover e=" + JsonUtils.beanToJson(homeExp));
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
}
return JsonUtils.beanToJson(result);
}
@RequestMapping(value = "/api/disk/setDesktopCover", method = RequestMethod.POST)
public String setDesktopCover(@RequestBody HomeExplorerDTO homeExp) {
Result result = null;
try {
LoginUser loginUser = loginUserUtil.getLoginUser();
boolean re = sourceFileService.setDesktopCover(homeExp, loginUser);
result = new Result(true, CodeMessageEnum.success.getCode(), re);
} catch (SvnlanRuntimeException e) {
result = new Result(false, e.getErrorCode(), null);
} catch (Exception e) {
LogUtil.error(e, "/api/disk/setDesktopCover" + JsonUtils.beanToJson(homeExp));
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
}
return JsonUtils.beanToJson(result);
}
@RequestMapping(value = "/api/disk/mkDir", method = RequestMethod.POST)
public String mkDir(@Valid @RequestBody AddCloudDirectoryDTO addCloudDirectoryDTO) {
Result result = null;
Long sourceId = 0L;
try {
LoginUser loginUser = loginUserUtil.getLoginUser();
sourceId = sourceFileService.mkDir(addCloudDirectoryDTO, loginUser);
result = new Result(true, CodeMessageEnum.success.getCode(), sourceId);
} catch (SvnlanRuntimeException e) {
result = new Result(false, CodeMessageEnum.system_error.getCode(), e.getMessage(), null);
} catch (Exception e) {
LogUtil.error(e, "云盘文件夹创建失败" + JsonUtils.beanToJson(addCloudDirectoryDTO));
result = new Result(false, CodeMessageEnum.system_error.getCode(), null);
}
return JsonUtils.beanToJson(result);
}
}

Some files were not shown because too many files have changed in this diff Show More