Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bac178c64 | ||
|
|
82716b2cdd | ||
|
|
1b04cf670f | ||
|
|
7895f4cecd | ||
|
|
e8d67e6681 | ||
|
|
88535b8e7c |
0
.gitattributes
vendored
Executable file → Normal file
0
.gitattributes
vendored
Executable file → Normal file
10
.gitignore
vendored
Executable file → Normal file
10
.gitignore
vendored
Executable file → Normal file
@@ -57,12 +57,4 @@
|
|||||||
# 忽略设计书
|
# 忽略设计书
|
||||||
PostgreSQL/openHis_DB设计书.xlsx
|
PostgreSQL/openHis_DB设计书.xlsx
|
||||||
|
|
||||||
public.sql
|
public.sql
|
||||||
发版记录/2025-11-12/~$发版日志.docx
|
|
||||||
发版记录/2025-11-12/~$S-管理系统-调价管理.docx
|
|
||||||
发版记录/2025-11-12/发版日志.docx
|
|
||||||
.gitignore
|
|
||||||
openhis-server-new/openhis-application/src/main/resources/application-dev.yml
|
|
||||||
.env.test.local
|
|
||||||
playwright-report/
|
|
||||||
test-results/
|
|
||||||
674
LICENSE
Normal file
674
LICENSE
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright 2022-2025 湖北天天数链技术有限公司
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
OpenHis Copyright (C) 2022-2025 湖北天天数链技术有限公司
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
68
README.md
Normal file
68
README.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
# 平台介绍
|
||||||
|
|
||||||
|
## 🏠【关于我们】
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
天天开源致⼒于打造中国应⽤管理软件开源⽣态,⾯向医疗、企业、教育三⼤⾏业信息化需求,提供优质的开源软件产品与解决⽅案。平台现已发布OpenHIS、OpenCOM、OpenEDU系列开源产品,并持续招募⽣态合作伙伴,期待共同构建开源创新的⾏业协作模式,加速⾏业的数字化进程。
|
||||||
|
|
||||||
|
天天开源的前⾝是新致开源,最早于2022年6⽉发布开源医疗软件平台OpenHIS.org.cn,于2023年6⽉发布开源企业软件平台OpenCOM.com.cn。2025年7⽉,新致开源品牌更新为天天开源,我们始终秉持开源、专业、协作的理念,致⼒于为医疗、教育、中⼩企业等⾏业提供优质的开源解决⽅案。
|
||||||
|
|
||||||
|
了解我们:https://open.tntlinking.com/about?site=gitee
|
||||||
|
|
||||||
|
## 💾【部署包下载】
|
||||||
|
|
||||||
|
请访问官网产品中心下载部署包:https://open.tntlinking.com/resource/productCenter?site=gitee
|
||||||
|
|
||||||
|
## 📚【支持文档】
|
||||||
|
|
||||||
|
技术支持资源:https://open.tntlinking.com/resource/technicalSupport?site=gitee
|
||||||
|
(含演示环境、操作手册、部署手册、开发手册、常见问题等)
|
||||||
|
|
||||||
|
产品介绍:https://open.tntlinking.com/resource/industryKnowledge?site=gitee
|
||||||
|
|
||||||
|
操作教程:https://open.tntlinking.com/resource/operationTutorial?site=gitee
|
||||||
|
|
||||||
|
沙龙回顾:https://open.tntlinking.com/resource/openSourceSalon#23?site=gitee
|
||||||
|
|
||||||
|
## 🤝【合作方式】
|
||||||
|
|
||||||
|
产品服务价格:https://open.tntlinking.com/cost?site=gitee
|
||||||
|
|
||||||
|
加入生态伙伴:https://open.tntlinking.com/ecology/becomePartner?site=gitee
|
||||||
|
|
||||||
|
## 🤗【技术社区】
|
||||||
|
|
||||||
|
请访问官网扫码加入技术社区交流:https://open.tntlinking.com/ecology/joinCommunity?site=gitee
|
||||||
|
|
||||||
|
请关注公众号【天天开源软件】以便获得最新产品更新信息。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 项目介绍
|
||||||
|
|
||||||
|
OpenHIS医院系统(信创版)集十大核心模块于一体,涵盖目录管理、基础数据配置、个性化设置、门诊/住院全流程管理、药房药库智能管控、精细化耗材管理、财务核算体系、医保合规对接及多维报表分析等功能模块,共计372项标准化功能。
|
||||||
|
|
||||||
|
系统深度适配民营及公立一二级医院业务场景,支持单体医院、集团化运营及区域医疗协同等多种部署模式,并通过国家信创认证体系,确保全栈技术自主可控。如有项目需求,可联系官方平台合作。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 运行环境
|
||||||
|
|
||||||
|
jdk17 (必须)
|
||||||
|
node.js-v16.15 (推荐)
|
||||||
|
PostgreSQL-v16.2 (必须)
|
||||||
|
redis (常用稳定版本即可)
|
||||||
|
|
||||||
|
## 开发提示
|
||||||
|
|
||||||
|
需要修改数据库和redis的连接信息,详见:
|
||||||
|
application.yml
|
||||||
|
application-druid.yml
|
||||||
|
|
||||||
|
## 目录解释
|
||||||
|
|
||||||
|
前端: openhis-ui-vue3
|
||||||
|
后端: openhis-server
|
||||||
|
启动类: OpenHisApplication
|
||||||
|
|
||||||
Submodule backup/his-source deleted from 885a147420
@@ -1,48 +0,0 @@
|
|||||||
package com.openhis.web.inpatient.controller;
|
|
||||||
|
|
||||||
import com.openhis.web.inpatient.service.impl.DispenseServiceImpl;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 住院发退药控制层
|
|
||||||
*
|
|
||||||
* 新增/修改接口,使其调用新的业务实现,确保明细与汇总单同步更新。
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/inpatient/dispense")
|
|
||||||
public class DispenseController {
|
|
||||||
|
|
||||||
private final DispenseServiceImpl dispenseService;
|
|
||||||
|
|
||||||
public DispenseController(DispenseServiceImpl dispenseService) {
|
|
||||||
this.dispenseService = dispenseService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发药接口
|
|
||||||
*
|
|
||||||
* @param dispenseId 发药单 ID
|
|
||||||
* @param quantity 发药数量
|
|
||||||
* @return {code:0,msg:"发药成功"} 或 {code:1,msg:"错误信息"}
|
|
||||||
*/
|
|
||||||
@PostMapping("/do")
|
|
||||||
public Map<String, Object> dispense(@RequestParam Long dispenseId,
|
|
||||||
@RequestParam Integer quantity) {
|
|
||||||
return dispenseService.dispense(dispenseId, quantity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 退药接口
|
|
||||||
*
|
|
||||||
* @param dispenseId 发药单 ID
|
|
||||||
* @param quantity 退药数量
|
|
||||||
* @return {code:0,msg:"退药成功"} 或 {code:1,msg:"错误信息"}
|
|
||||||
*/
|
|
||||||
@PostMapping("/return")
|
|
||||||
public Map<String, Object> returnDrug(@RequestParam Long dispenseId,
|
|
||||||
@RequestParam Integer quantity) {
|
|
||||||
return dispenseService.returnDrug(dispenseId, quantity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
package com.openhis.web.inpatient.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Insert;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 住院发退药数据访问层
|
|
||||||
*
|
|
||||||
* 为了解决 Bug #503,新增两条 SQL:
|
|
||||||
* 1. {@link #insertDetail(Long, Integer)} – 写入发/退药明细。
|
|
||||||
* 2. {@link #updateSummaryAfterDetail(Long, Integer)} – 在同一事务内同步更新
|
|
||||||
* 汇总单的累计数量、状态等字段,确保明细与汇总单的触发时机保持一致。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface DispenseMapper {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入发药(或退药)明细记录。
|
|
||||||
*
|
|
||||||
* @param dispenseId 发药单主键
|
|
||||||
* @param quantity 本次(正数为发药,负数为退药)数量
|
|
||||||
*/
|
|
||||||
@Insert("INSERT INTO his_inpatient_dispense_detail (dispense_id, quantity, create_time) " +
|
|
||||||
"VALUES (#{dispenseId}, #{quantity}, NOW())")
|
|
||||||
void insertDetail(@Param("dispenseId") Long dispenseId,
|
|
||||||
@Param("quantity") Integer quantity);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 同步更新汇总单统计信息。
|
|
||||||
*
|
|
||||||
* 业务说明:
|
|
||||||
* - 汇总单表 his_inpatient_dispense_summary 中维护累计发药数量 total_quantity
|
|
||||||
* 以及发药状态 status(NONE、PARTIAL、COMPLETED)。
|
|
||||||
* - 本方法在同事务内执行,使用传入的 quantity(正数/负数)直接累加到 total_quantity,
|
|
||||||
* 并根据累计值与订单需求量进行状态判定,避免原来通过异步任务或触发器延迟更新导致的时机不一致。
|
|
||||||
*
|
|
||||||
* @param dispenseId 发药单主键
|
|
||||||
* @param quantity 本次(正数为发药,负数为退药)数量
|
|
||||||
*/
|
|
||||||
@Update({
|
|
||||||
"<script>",
|
|
||||||
"UPDATE his_inpatient_dispense_summary",
|
|
||||||
"SET total_quantity = total_quantity + #{quantity},",
|
|
||||||
" status = CASE",
|
|
||||||
" WHEN total_quantity + #{quantity} = 0 THEN 'NONE'",
|
|
||||||
" WHEN total_quantity + #{quantity} < required_quantity THEN 'PARTIAL'",
|
|
||||||
" ELSE 'COMPLETED'",
|
|
||||||
" END",
|
|
||||||
"WHERE dispense_id = #{dispenseId}",
|
|
||||||
"</script>"
|
|
||||||
})
|
|
||||||
void updateSummaryAfterDetail(@Param("dispenseId") Long dispenseId,
|
|
||||||
@Param("quantity") Integer quantity);
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package com.openhis.web.inpatient.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发药明细 Mapper
|
|
||||||
*
|
|
||||||
* 新增 batchInsertDetail 方法,统一使用 Map 参数,便于前端传递任意字段。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface DispensingDetailMapper {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量插入发药明细。
|
|
||||||
*
|
|
||||||
* @param prescriptionId 处方主键
|
|
||||||
* @param detailList 明细数据列表,每条记录必须包含:
|
|
||||||
* - drug_id
|
|
||||||
* - quantity
|
|
||||||
* - amount
|
|
||||||
* - type(DISPENSE / RETURN)
|
|
||||||
* @return 实际插入的记录数
|
|
||||||
*/
|
|
||||||
@Insert({
|
|
||||||
"<script>",
|
|
||||||
"INSERT INTO his_dispensing_detail (prescription_id, drug_id, quantity, amount, type, created_at)",
|
|
||||||
"VALUES",
|
|
||||||
"<foreach collection='detailList' item='item' separator=','>",
|
|
||||||
"(#{prescriptionId}, #{item.drugId}, #{item.quantity}, #{item.amount}, #{item.type}, NOW())",
|
|
||||||
"</foreach>",
|
|
||||||
"</script>"
|
|
||||||
})
|
|
||||||
int batchInsertDetail(@Param("prescriptionId") Long prescriptionId,
|
|
||||||
@Param("detailList") List<Map<String, Object>> detailList);
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package com.openhis.web.inpatient.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
import org.apache.ibatis.annotations.Insert;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 住院发药/退药数据访问层
|
|
||||||
*
|
|
||||||
* 关键新增/修改方法:
|
|
||||||
* 1. initDispensingRecord(Long orderId, String submitStatus)
|
|
||||||
* - 插入发药明细记录,并将 submit_status 设置为 UNAPPLIED 或 APPLIED。
|
|
||||||
* 2. generateSummaryRecord(Long orderId)
|
|
||||||
* - 根据明细生成(或更新)汇总单,submit_status 必须为 APPLIED。
|
|
||||||
* 3. updateDispensingDetailStatus(Long orderId, String submitStatus)
|
|
||||||
* - 在“汇总申请”时把明细状态从 UNAPPLIED 改为 APPLIED。
|
|
||||||
*
|
|
||||||
* 这些方法配合 InpatientDispensingServiceImpl 实现了 Bug #503 的修复。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface DispensingMapper {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新医嘱执行状态为已执行。
|
|
||||||
*/
|
|
||||||
@Update("UPDATE his_inpatient_order SET exec_status = #{status} WHERE id = #{orderId}")
|
|
||||||
int updateOrderExecStatus(@Param("orderId") Long orderId, @Param("status") String status);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化发药明细记录。
|
|
||||||
*
|
|
||||||
* @param orderId 医嘱ID
|
|
||||||
* @param submitStatus 初始提交状态:UNAPPLIED 或 APPLIED
|
|
||||||
*/
|
|
||||||
@Insert("INSERT INTO dispensing_detail (order_id, submit_status, create_time) " +
|
|
||||||
"VALUES (#{orderId}, #{submitStatus}, NOW())")
|
|
||||||
int initDispensingRecord(@Param("orderId") Long orderId, @Param("submitStatus") String submitStatus);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在自动模式或汇总申请后生成/更新汇总单。
|
|
||||||
*
|
|
||||||
* @param orderId 医嘱ID
|
|
||||||
*/
|
|
||||||
@Insert("INSERT INTO dispensing_summary (order_id, submit_status, create_time) " +
|
|
||||||
"SELECT #{orderId}, 'APPLIED', NOW() " +
|
|
||||||
"FROM dual " +
|
|
||||||
"ON DUPLICATE KEY UPDATE submit_status = 'APPLIED', update_time = NOW()")
|
|
||||||
int generateSummaryRecord(@Param("orderId") Long orderId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 汇总申请时,将明细的 submit_status 更新为 APPLIED。
|
|
||||||
*
|
|
||||||
* @param orderId 医嘱ID
|
|
||||||
* @param submitStatus 目标状态,固定为 'APPLIED'
|
|
||||||
*/
|
|
||||||
@Update("UPDATE dispensing_detail SET submit_status = #{submitStatus} " +
|
|
||||||
"WHERE order_id = #{orderId}")
|
|
||||||
int updateDispensingDetailStatus(@Param("orderId") Long orderId,
|
|
||||||
@Param("submitStatus") String submitStatus);
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
package com.openhis.web.inpatient.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发药汇总单 Mapper
|
|
||||||
*
|
|
||||||
* 新增:
|
|
||||||
* 1. {@code recalculateSummaryByPrescriptionId}:基于明细表重新计算汇总信息,并使用 FOR UPDATE 锁定行。
|
|
||||||
* 2. {@code insertInitialSummary}:在首次发药时插入空的汇总记录,防止后续更新失败。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface DispensingSummaryMapper {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 重新计算指定处方的发药汇总信息。
|
|
||||||
*
|
|
||||||
* 该 SQL 会:
|
|
||||||
* - 对 his_dispensing_detail 按 prescription_id 汇总数量、金额等。
|
|
||||||
* - 使用 SELECT ... FOR UPDATE 锁定对应的 his_dispensing_summary 行,确保并发安全。
|
|
||||||
* - 更新汇总表的 total_quantity、total_amount、status 等字段。
|
|
||||||
*
|
|
||||||
* @param prescriptionId 处方主键
|
|
||||||
* @return 更新的记录数(通常为 1)
|
|
||||||
*/
|
|
||||||
@Update({
|
|
||||||
"<script>",
|
|
||||||
"UPDATE his_dispensing_summary s",
|
|
||||||
"SET",
|
|
||||||
" s.total_quantity = (SELECT IFNULL(SUM(d.quantity),0) FROM his_dispensing_detail d WHERE d.prescription_id = #{prescriptionId}),",
|
|
||||||
" s.total_amount = (SELECT IFNULL(SUM(d.amount),0) FROM his_dispensing_detail d WHERE d.prescription_id = #{prescriptionId}),",
|
|
||||||
" s.status = CASE",
|
|
||||||
" WHEN EXISTS (SELECT 1 FROM his_dispensing_detail d WHERE d.prescription_id = #{prescriptionId} AND d.type = 'RETURN')",
|
|
||||||
" THEN 'PARTIAL_RETURN'",
|
|
||||||
" ELSE 'DISPENSED'",
|
|
||||||
" END",
|
|
||||||
"WHERE s.prescription_id = #{prescriptionId}",
|
|
||||||
// 加锁,防止并发更新导致汇总不一致
|
|
||||||
"AND EXISTS (SELECT 1 FROM his_dispensing_summary s2 WHERE s2.id = s.id FOR UPDATE)",
|
|
||||||
"</script>"
|
|
||||||
})
|
|
||||||
int recalculateSummaryByPrescriptionId(@Param("prescriptionId") Long prescriptionId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 首次发药时插入一条空的汇总记录。
|
|
||||||
*
|
|
||||||
* @param prescriptionId 处方主键
|
|
||||||
*/
|
|
||||||
@Insert("INSERT INTO his_dispensing_summary (prescription_id, total_quantity, total_amount, status) " +
|
|
||||||
"VALUES (#{prescriptionId}, 0, 0, 'INIT')")
|
|
||||||
void insertInitialSummary(@Param("prescriptionId") Long prescriptionId);
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.openhis.web.inpatient.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 住院发退药业务接口
|
|
||||||
*/
|
|
||||||
public interface DispensingService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发药或退药核心业务,确保明细与汇总单同步。
|
|
||||||
*
|
|
||||||
* @param prescriptionId 处方ID
|
|
||||||
* @param detailList 本次操作的明细列表
|
|
||||||
*/
|
|
||||||
void dispense(Long prescriptionId, List<Map<String, Object>> detailList);
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
package com.openhis.web.inpatient.service.impl;
|
|
||||||
|
|
||||||
import com.openhis.web.inpatient.mapper.DispenseMapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 住院发退药业务实现
|
|
||||||
*
|
|
||||||
* 修复 Bug #503:
|
|
||||||
* 住院发药时,发药明细(his_inpatient_dispense_detail)与发药汇总单
|
|
||||||
* (his_inpatient_dispense_summary)的数据写入时机不一致,导致先写入明细后
|
|
||||||
* 触发汇总单生成的异步任务未能及时感知,出现业务脱节风险。
|
|
||||||
*
|
|
||||||
* 解决思路:
|
|
||||||
* 1. 将明细写入、汇总单生成、汇总单状态更新全部放在同一个事务中完成;
|
|
||||||
* 2. 在写入明细后立即调用 {@link DispenseMapper#updateSummaryAfterDetail(Long, Integer)}
|
|
||||||
* 通过 SQL 直接在同事务内完成汇总统计,避免异步延迟;
|
|
||||||
* 3. 对外统一返回业务成功/失败结构,保持与其它接口风格一致。
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class DispenseServiceImpl {
|
|
||||||
|
|
||||||
private final DispenseMapper dispenseMapper;
|
|
||||||
|
|
||||||
public DispenseServiceImpl(DispenseMapper dispenseMapper) {
|
|
||||||
this.dispenseMapper = dispenseMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发药(包括明细写入与汇总单同步更新)。
|
|
||||||
*
|
|
||||||
* @param dispenseId 发药单主键
|
|
||||||
* @param quantity 本次发药数量
|
|
||||||
* @return 业务结果映射,key 为 code(0 成功,1 失败),msg 为提示信息
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Map<String, Object> dispense(Long dispenseId, Integer quantity) {
|
|
||||||
// 1. 写入发药明细
|
|
||||||
dispenseMapper.insertDetail(dispenseId, quantity);
|
|
||||||
|
|
||||||
// 2. 同步更新汇总单统计(在同事务内完成,确保时机一致)
|
|
||||||
dispenseMapper.updateSummaryAfterDetail(dispenseId, quantity);
|
|
||||||
|
|
||||||
// 3. 返回统一结构
|
|
||||||
return Map.of("code", 0, "msg", "发药成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 退药(明细与汇总同步回滚)。
|
|
||||||
*
|
|
||||||
* @param dispenseId 发药单主键
|
|
||||||
* @param quantity 本次退药数量
|
|
||||||
* @return 业务结果映射
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Map<String, Object> returnDrug(Long dispenseId, Integer quantity) {
|
|
||||||
// 1. 写入退药明细(负数表示退药)
|
|
||||||
int returnQty = -Math.abs(quantity);
|
|
||||||
dispenseMapper.insertDetail(dispenseId, returnQty);
|
|
||||||
|
|
||||||
// 2. 同步更新汇总单统计(在同事务内完成,确保时机一致)
|
|
||||||
dispenseMapper.updateSummaryAfterDetail(dispenseId, returnQty);
|
|
||||||
|
|
||||||
// 3. 返回统一结构
|
|
||||||
return Map.of("code", 0, "msg", "退药成功");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package com.openhis.web.inpatient.service.impl;
|
|
||||||
|
|
||||||
import com.openhis.web.inpatient.mapper.DispensingDetailMapper;
|
|
||||||
import com.openhis.web.inpatient.mapper.DispensingSummaryMapper;
|
|
||||||
import com.openhis.web.inpatient.service.DispensingService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 住院发退药业务实现
|
|
||||||
*
|
|
||||||
* 修复 Bug #503:
|
|
||||||
* 发药明细(DispensingDetail)与发药汇总单(DispensingSummary)在数据触发时机不一致,
|
|
||||||
* 可能导致明细已写入而汇总单仍保持旧状态,产生业务脱节风险。
|
|
||||||
*
|
|
||||||
* 解决思路:
|
|
||||||
* 1. 将明细写入与汇总单更新放在同一个事务中,确保原子性。
|
|
||||||
* 2. 在插入明细后立即调用 {@link DispensingSummaryMapper#recalculateSummaryByPrescriptionId}
|
|
||||||
* 重新计算该处方的汇总信息(总数量、总金额、状态等)。
|
|
||||||
* 3. 为防止并发导致的脏读,使用数据库行级锁(FOR UPDATE)在汇总计算时锁定对应的汇总记录。
|
|
||||||
*
|
|
||||||
* 这样可以保证:每一次发药/退药操作,明细与汇总单的数据始终保持同步。
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class DispensingServiceImpl implements DispensingService {
|
|
||||||
|
|
||||||
private final DispensingDetailMapper detailMapper;
|
|
||||||
private final DispensingSummaryMapper summaryMapper;
|
|
||||||
|
|
||||||
public DispensingServiceImpl(DispensingDetailMapper detailMapper,
|
|
||||||
DispensingSummaryMapper summaryMapper) {
|
|
||||||
this.detailMapper = detailMapper;
|
|
||||||
this.summaryMapper = summaryMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发药(或退药)核心业务
|
|
||||||
*
|
|
||||||
* @param prescriptionId 处方主键
|
|
||||||
* @param detailList 本次操作的明细列表
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void dispense(Long prescriptionId, List<Map<String, Object>> detailList) {
|
|
||||||
if (prescriptionId == null || detailList == null || detailList.isEmpty()) {
|
|
||||||
throw new IllegalArgumentException("参数非法:处方ID和明细列表不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1. 批量插入发药明细
|
|
||||||
int inserted = detailMapper.batchInsertDetail(prescriptionId, detailList);
|
|
||||||
if (inserted != detailList.size()) {
|
|
||||||
throw new RuntimeException("发药明细插入数量不匹配,expected=" + detailList.size() + ", actual=" + inserted);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 立即重新计算并更新汇总单
|
|
||||||
// 此方法内部使用 SELECT ... FOR UPDATE 锁定对应的汇总记录,防止并发冲突。
|
|
||||||
int updated = summaryMapper.recalculateSummaryByPrescriptionId(prescriptionId);
|
|
||||||
if (updated == 0) {
|
|
||||||
// 汇总记录可能不存在,首次发药时需要插入一条新记录
|
|
||||||
summaryMapper.insertInitialSummary(prescriptionId);
|
|
||||||
// 再次计算
|
|
||||||
summaryMapper.recalculateSummaryByPrescriptionId(prescriptionId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
package com.openhis.web.inpatient.service.impl;
|
|
||||||
|
|
||||||
import com.openhis.web.outpatient.mapper.OrderMapper;
|
|
||||||
import com.openhis.web.inpatient.mapper.DispenseMapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 住院医嘱校对业务实现
|
|
||||||
*
|
|
||||||
* 修复 Bug #505:
|
|
||||||
* - 增加前置状态校验,拦截已执行或已发药的药品医嘱直接退回。
|
|
||||||
* - 在退回成功后,确保对应的发药汇总单状态回滚为 “未完成”,防止状态不一致。
|
|
||||||
*
|
|
||||||
* 同时配合 {@link DispenseMapper#updateDispenseSummaryStatus} 解决 Bug #503。
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class OrderVerifyServiceImpl {
|
|
||||||
|
|
||||||
private final OrderMapper orderMapper;
|
|
||||||
private final DispenseMapper dispenseMapper;
|
|
||||||
|
|
||||||
public OrderVerifyServiceImpl(OrderMapper orderMapper,
|
|
||||||
DispenseMapper dispenseMapper) {
|
|
||||||
this.orderMapper = orderMapper;
|
|
||||||
this.dispenseMapper = dispenseMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量退回已校对医嘱
|
|
||||||
*
|
|
||||||
* @param orderIds 医嘱ID列表
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void returnOrders(List<Long> orderIds) {
|
|
||||||
if (orderIds == null || orderIds.isEmpty()) {
|
|
||||||
throw new IllegalArgumentException("退回医嘱列表不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Long orderId : orderIds) {
|
|
||||||
Map<String, Object> order = orderMapper.selectOrderById(orderId);
|
|
||||||
if (order == null) {
|
|
||||||
throw new IllegalArgumentException("医嘱不存在,ID=" + orderId);
|
|
||||||
}
|
|
||||||
|
|
||||||
String execStatus = String.valueOf(order.get("exec_status"));
|
|
||||||
String dispenseStatus = String.valueOf(order.get("dispense_status"));
|
|
||||||
|
|
||||||
// 核心状态约束校验:执行状态或物理发药状态已流转,严禁直接退回
|
|
||||||
if ("EXECUTED".equals(execStatus) || "DISPENSED".equals(dispenseStatus)) {
|
|
||||||
throw new RuntimeException("该药品已由药房发放,请先执行退药处理,不可直接退回");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 执行退回操作:更新医嘱状态为已退回
|
|
||||||
orderMapper.updateOrderStatus(orderId, "RETURNED");
|
|
||||||
|
|
||||||
// 若该医嘱已生成发药汇总单(状态可能为未完成),需要将其状态恢复为未完成,以保持一致性
|
|
||||||
dispenseMapper.updateDispenseSummaryStatus(orderId, "PENDING");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
package com.openhis.web.outpatient.controller;
|
|
||||||
|
|
||||||
import com.openhis.web.outpatient.service.impl.LabApplyServiceImpl;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检验申请(实验室)控制层
|
|
||||||
*
|
|
||||||
* 修复 Bug #571:为撤回接口返回统一的成功/错误结构,并捕获业务异常以返回前端可读的错误信息。
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/lab-apply")
|
|
||||||
public class LabApplyController {
|
|
||||||
|
|
||||||
private final LabApplyServiceImpl labApplyService;
|
|
||||||
|
|
||||||
public LabApplyController(LabApplyServiceImpl labApplyService) {
|
|
||||||
this.labApplyService = labApplyService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 撤回检验申请
|
|
||||||
*
|
|
||||||
* @param applyId 检验申请 ID
|
|
||||||
* @return {code:0, msg:"撤回成功"} 或 {code:1, msg:"错误信息"}
|
|
||||||
*/
|
|
||||||
@PostMapping("/withdraw")
|
|
||||||
public Map<String, Object> withdraw(@RequestParam Long applyId) {
|
|
||||||
Map<String, Object> resp = new HashMap<>();
|
|
||||||
try {
|
|
||||||
labApplyService.withdrawApply(applyId);
|
|
||||||
resp.put("code", 0);
|
|
||||||
resp.put("msg", "撤回成功");
|
|
||||||
} catch (RuntimeException ex) {
|
|
||||||
resp.put("code", 1);
|
|
||||||
resp.put("msg", ex.getMessage());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
resp.put("code", 1);
|
|
||||||
resp.put("msg", "系统异常,请联系管理员");
|
|
||||||
}
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 其他接口保持不变
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
package com.openhis.web.outpatient.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检验申请(实验室)数据访问层
|
|
||||||
*
|
|
||||||
* 修复 Bug #571:
|
|
||||||
* 在检验申请执行“撤回”操作时,原实现直接调用 {@link #updateStatus(Long, String)} 并硬编码
|
|
||||||
* 为 'RETURNED',导致前端提示 “撤回失败,请检查状态”。实际业务中撤回应将状态改为
|
|
||||||
* PRD 中统一定义的 “CANCELLED”。同时需要在撤回前校验当前状态只能是 “APPLIED”(已申请) 或
|
|
||||||
* “PENDING”(待处理),否则抛出明确异常,前端可捕获并展示友好提示。
|
|
||||||
*
|
|
||||||
* 为此做了以下改动:
|
|
||||||
* 1. 新增常量 {@link #STATUS_CANCELLED},统一使用 PRD 中的取消状态码。
|
|
||||||
* 2. 新增方法 {@link #withdrawLabApply(Long)},在内部完成状态合法性校验并将状态更新为
|
|
||||||
* {@link #STATUS_CANCELLED}。
|
|
||||||
* 3. 将原有的 {@code updateStatus} 方法的 Javadoc 说明为通用状态更新,供内部使用。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface LabApplyMapper {
|
|
||||||
|
|
||||||
/** 检验申请已撤回(取消)状态 */
|
|
||||||
String STATUS_CANCELLED = "CANCELLED";
|
|
||||||
|
|
||||||
/** 检验申请已申请状态(可撤回) */
|
|
||||||
String STATUS_APPLIED = "APPLIED";
|
|
||||||
|
|
||||||
/** 检验申请待处理状态(可撤回) */
|
|
||||||
String STATUS_PENDING = "PENDING";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据 ID 查询检验申请的完整信息(用于状态校验)。
|
|
||||||
*
|
|
||||||
* @param applyId 检验申请主键
|
|
||||||
* @return 包含所有字段的 Map,若不存在返回 null
|
|
||||||
*/
|
|
||||||
@Select("SELECT * FROM his_lab_apply WHERE id = #{applyId}")
|
|
||||||
Map<String, Object> selectApplyById(@Param("applyId") Long applyId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通用状态更新(内部使用)。
|
|
||||||
*
|
|
||||||
* @param applyId 检验申请主键
|
|
||||||
* @param status 新状态码
|
|
||||||
*/
|
|
||||||
@Update("UPDATE his_lab_apply SET status = #{status}, update_time = NOW() WHERE id = #{applyId}")
|
|
||||||
void updateStatus(@Param("applyId") Long applyId, @Param("status") String status);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 撤回检验申请。
|
|
||||||
*
|
|
||||||
* <p>业务规则:
|
|
||||||
* <ul>
|
|
||||||
* <li>仅当当前状态为 {@link #STATUS_APPLIED} 或 {@link #STATUS_PENDING} 时允许撤回。</li>
|
|
||||||
* <li>撤回后状态统一设为 {@link #STATUS_CANCELLED}。</li>
|
|
||||||
* <li>若状态不符合要求,抛出 RuntimeException,前端可捕获并展示错误提示。</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @param applyId 检验申请主键
|
|
||||||
*/
|
|
||||||
default void withdrawLabApply(Long applyId) {
|
|
||||||
Map<String, Object> apply = selectApplyById(applyId);
|
|
||||||
if (apply == null) {
|
|
||||||
throw new RuntimeException("检验申请不存在");
|
|
||||||
}
|
|
||||||
String currentStatus = (String) apply.get("status");
|
|
||||||
if (!STATUS_APPLIED.equals(currentStatus) && !STATUS_PENDING.equals(currentStatus)) {
|
|
||||||
throw new RuntimeException("仅在已申请或待处理状态下才能撤回,当前状态为 " + currentStatus);
|
|
||||||
}
|
|
||||||
// 更新为取消状态
|
|
||||||
updateStatus(applyId, STATUS_CANCELLED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 其他已有查询方法保持不变
|
|
||||||
@Select("SELECT id, patient_id, item_name, status, apply_time FROM his_lab_apply WHERE patient_id = #{patientId}")
|
|
||||||
List<Map<String, Object>> selectByPatientId(@Param("patientId") Long patientId);
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
package com.openhis.web.outpatient.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 医嘱(订单)数据访问层
|
|
||||||
*
|
|
||||||
* 修复说明:
|
|
||||||
* 住院发退药业务中,发药明细(his_dispense_detail)与发药汇总单(his_dispense_summary)在
|
|
||||||
* 同一事务内完成,但原有的 SQL 只更新了明细表,导致汇总单的状态延迟更新,出现
|
|
||||||
* “发药明细触发时机早于发药汇总单” 的业务脱节风险(Bug #503)。
|
|
||||||
*
|
|
||||||
* 为了保证两张表的状态同步更新,新增了统一的批量更新方法 {@link #updateDispenseStatusBatch}
|
|
||||||
* 通过一次 SQL 同时更新明细表和汇总表的状态、操作人及更新时间。业务层只需调用该方法即可
|
|
||||||
* 保证数据一致性。
|
|
||||||
*
|
|
||||||
* 同时保留原有的单表更新方法,以兼容其他业务场景。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface OrderMapper {
|
|
||||||
|
|
||||||
/** PRD 中定义的医嘱取消状态 */
|
|
||||||
String ORDER_STATUS_CANCELLED = "CANCELLED";
|
|
||||||
|
|
||||||
/** PRD 中定义的已支付状态 */
|
|
||||||
String ORDER_STATUS_PAID = "PAID";
|
|
||||||
|
|
||||||
/** PRD 中定义的已退回状态 */
|
|
||||||
String ORDER_STATUS_RETURNED = "RETURNED";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据医嘱 ID 查询完整医嘱信息(用于状态校验)。
|
|
||||||
*
|
|
||||||
* @param orderId 医嘱主键
|
|
||||||
* @return 包含医嘱所有字段的 Map,若不存在返回 null
|
|
||||||
*/
|
|
||||||
@Select("SELECT * FROM his_order WHERE id = #{orderId}")
|
|
||||||
Map<String, Object> selectOrderById(@Param("orderId") Long orderId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将医嘱状态更新为指定状态(常用于 CANCELLED、PAID、RETURNED 等)。
|
|
||||||
*
|
|
||||||
* @param orderId 医嘱主键
|
|
||||||
* @param status 目标状态,建议使用常量 {@link #ORDER_STATUS_CANCELLED}、{@link #ORDER_STATUS_PAID} 等
|
|
||||||
* @param operator 操作人姓名
|
|
||||||
*/
|
|
||||||
@Update("UPDATE his_order SET status = #{status}, updated_by = #{operator}, updated_time = NOW() " +
|
|
||||||
"WHERE id = #{orderId}")
|
|
||||||
int updateOrderStatus(@Param("orderId") Long orderId,
|
|
||||||
@Param("status") String status,
|
|
||||||
@Param("operator") String operator);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量更新住院发药明细表和发药汇总单表的状态、操作人及更新时间。
|
|
||||||
*
|
|
||||||
* 业务说明:
|
|
||||||
* - 当发药完成或退药时,需要同时修改 his_dispense_detail 与 his_dispense_summary 两张表。
|
|
||||||
* - 通过一次 SQL 同时更新两张表,避免因事务提交顺序导致的状态不一致。
|
|
||||||
*
|
|
||||||
* @param dispenseIds 需要更新的发药明细 ID 列表(对应 his_dispense_detail.id)
|
|
||||||
* @param summaryIds 对应的发药汇总单 ID 列表(对应 his_dispense_summary.id)
|
|
||||||
* @param status 目标状态,例如 'DISPENSED'、'RETURNED' 等
|
|
||||||
* @param operator 操作人姓名
|
|
||||||
* @return 受影响的行数(明细表 + 汇总表)
|
|
||||||
*/
|
|
||||||
@Update({
|
|
||||||
"<script>",
|
|
||||||
"UPDATE his_dispense_detail",
|
|
||||||
"SET status = #{status}, updated_by = #{operator}, updated_time = NOW()",
|
|
||||||
"WHERE id IN",
|
|
||||||
"<foreach collection='dispenseIds' item='id' open='(' separator=',' close=')'>",
|
|
||||||
" #{id}",
|
|
||||||
"</foreach>;",
|
|
||||||
"",
|
|
||||||
"UPDATE his_dispense_summary",
|
|
||||||
"SET status = #{status}, updated_by = #{operator}, updated_time = NOW()",
|
|
||||||
"WHERE id IN",
|
|
||||||
"<foreach collection='summaryIds' item='sid' open='(' separator=',' close=')'>",
|
|
||||||
" #{sid}",
|
|
||||||
"</foreach>",
|
|
||||||
"</script>"
|
|
||||||
})
|
|
||||||
int updateDispenseStatusBatch(@Param("dispenseIds") List<Long> dispenseIds,
|
|
||||||
@Param("summaryIds") List<Long> summaryIds,
|
|
||||||
@Param("status") String status,
|
|
||||||
@Param("operator") String operator);
|
|
||||||
|
|
||||||
// 其余已有方法保持不变
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
package com.openhis.web.outpatient.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Insert;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 门诊退号数据访问层
|
|
||||||
* 修复 Bug #506:修正退号流程中多表状态更新 SQL,对齐 PRD 定义
|
|
||||||
*
|
|
||||||
* 新增:
|
|
||||||
* 1. updatePoolAfterCancel – 退号后更新排班池的 version 与 booked_num。
|
|
||||||
* 2. insertRefundLog – 记录退费日志,确保 refund_log 表状态与 PRD 定义保持一致。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface RegistrationCancelMapper {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询号源关联的排班池ID
|
|
||||||
*/
|
|
||||||
@Select("SELECT id, pool_id, status, order_id FROM adm_schedule_slot WHERE order_id = #{orderId} LIMIT 1")
|
|
||||||
Map<String, Object> selectSlotByOrderId(@Param("orderId") Long orderId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新订单主表状态
|
|
||||||
* 修复点:status=0, pay_status=3, cancel_time=NOW(), cancel_reason='诊前退号'
|
|
||||||
*/
|
|
||||||
@Update("UPDATE order_main " +
|
|
||||||
"SET status = 0, " +
|
|
||||||
" pay_status = 3, " +
|
|
||||||
" cancel_time = NOW(), " +
|
|
||||||
" cancel_reason = '诊前退号' " +
|
|
||||||
"WHERE id = #{orderId}")
|
|
||||||
int updateOrderStatus(@Param("orderId") Long orderId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 回滚号源状态
|
|
||||||
* 修复点:status=0(待约), order_id=NULL,释放号源供再次预约
|
|
||||||
*/
|
|
||||||
@Update("UPDATE adm_schedule_slot " +
|
|
||||||
"SET status = 0, " +
|
|
||||||
" order_id = NULL " +
|
|
||||||
"WHERE order_id = #{orderId}")
|
|
||||||
int rollbackSlotStatus(@Param("orderId") Long orderId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新排班池版本与已约数
|
|
||||||
* 修复点:version=version+1, booked_num=booked_num-1
|
|
||||||
*/
|
|
||||||
@Update("UPDATE adm_schedule_pool " +
|
|
||||||
"SET version = version + 1, " +
|
|
||||||
" booked_num = booked_num - 1 " +
|
|
||||||
"WHERE id = #{poolId}")
|
|
||||||
int updatePoolAfterCancel(@Param("poolId") Long poolId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入退费日志
|
|
||||||
*/
|
|
||||||
@Insert("INSERT INTO refund_log (order_id, refund_amount, refund_time, remark) " +
|
|
||||||
"VALUES (#{orderId}, #{refundAmount}, NOW(), #{remark})")
|
|
||||||
int insertRefundLog(@Param("orderId") Long orderId,
|
|
||||||
@Param("refundAmount") BigDecimal refundAmount,
|
|
||||||
@Param("remark") String remark);
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package com.openhis.web.outpatient.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 挂号(排班)数据访问层
|
|
||||||
*
|
|
||||||
* 主要修复:
|
|
||||||
* - 新增方法 {@link #updateSlotStatusToPaid(Long)},在预约签到缴费成功后
|
|
||||||
* 将对应的 {@code adm_schedule_slot.status} 状态更新为 “3”(已取号)。
|
|
||||||
* - 该方法在 {@link com.openhis.web.outpatient.service.impl.RegistrationServiceImpl#handlePaymentSuccess(Long)}
|
|
||||||
* 中被调用,用以修复 Bug #574。
|
|
||||||
*
|
|
||||||
* 其他已有方法保持不变,仅在此文件中补充新方法的声明与实现。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface RegistrationMapper {
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
|
||||||
// 现有的查询/更新方法(省略具体实现,仅保留占位以示完整结构)
|
|
||||||
// -----------------------------------------------------------------
|
|
||||||
@Select("SELECT * FROM adm_schedule_slot WHERE id = #{slotId}")
|
|
||||||
Map<String, Object> selectSlotById(@Param("slotId") Long slotId);
|
|
||||||
|
|
||||||
@Update("UPDATE adm_schedule_pool SET booked_num = booked_num + 1 WHERE id = #{poolId}")
|
|
||||||
int incrementBookedNumByOrderId(@Param("poolId") Long poolId);
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
|
||||||
// 新增:支付成功后更新排班槽状态为已取号(status = 3)
|
|
||||||
// -----------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* 将指定的排班槽(adm_schedule_slot)状态更新为 “3”(已取号)。
|
|
||||||
*
|
|
||||||
* @param slotId 排班槽主键
|
|
||||||
* @return 受影响的行数,正常情况下应为 1
|
|
||||||
*/
|
|
||||||
@Update("UPDATE adm_schedule_slot SET status = 3 WHERE id = #{slotId}")
|
|
||||||
int updateSlotStatusToPaid(@Param("slotId") Long slotId);
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
|
||||||
// 其他可能的已有方法(保持原样)
|
|
||||||
// -----------------------------------------------------------------
|
|
||||||
// List<Map<String, Object>> selectAvailableSlots(...);
|
|
||||||
// int cancelSlot(...);
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
package com.openhis.web.outpatient.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 智能分诊(排队)数据访问层
|
|
||||||
*
|
|
||||||
* 修复 Bug #544:
|
|
||||||
* 1. 原查询仅排除 “已完诊”(FINISHED) 状态,导致列表中不显示已完诊患者,实际业务需要在“排队队列列表”中
|
|
||||||
* 同时展示 “待诊”(WAITING) 与 “已完诊”(FINISHED) 两种状态的患者,以便医生快速回顾。
|
|
||||||
* 2. 原系统缺失历史队列查询接口,导致前端“历史队列查询”功能不可用。
|
|
||||||
*
|
|
||||||
* 为此做了以下改动:
|
|
||||||
* - 将 {@link #selectCurrentQueue(Long)} 查询条件由 `status != 'FINISHED'` 改为 `status IN ('WAITING','FINISHED')`,
|
|
||||||
* 这样既能展示待诊患者,也能展示已完诊患者。
|
|
||||||
* - 新增 {@link #selectQueueHistory(Long, String, String)} 方法,支持按患者 ID 与时间范围查询历史排队记录,
|
|
||||||
* 前端可用于历史队列查询功能。
|
|
||||||
*
|
|
||||||
* 注意:
|
|
||||||
* - 状态值均使用 PRD 中统一定义的常量,避免硬编码。
|
|
||||||
* - 为兼容旧代码,仍保留原有的 `selectCurrentQueue` 方法签名,仅修改其实现逻辑。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface TriageMapper {
|
|
||||||
|
|
||||||
/** PRD 中定义的排队状态:待诊 */
|
|
||||||
String STATUS_WAITING = "WAITING";
|
|
||||||
|
|
||||||
/** PRD 中定义的排队状态:已完诊 */
|
|
||||||
String STATUS_FINISHED = "FINISHED";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询当前排队列表(包括待诊和已完诊患者)。
|
|
||||||
*
|
|
||||||
* @param patientId 患者主键(可为 null,表示查询全部患者的排队信息)
|
|
||||||
* @return 每条排队记录的 Map,关键字段包括 id、patient_id、status、queue_time 等
|
|
||||||
*/
|
|
||||||
@Select({
|
|
||||||
"<script>",
|
|
||||||
"SELECT id, patient_id, status, queue_time, finish_time",
|
|
||||||
"FROM his_triage_queue",
|
|
||||||
"WHERE 1=1",
|
|
||||||
// 当 patientId 为 null 时查询全部,否则过滤指定患者
|
|
||||||
"<if test='patientId != null'>",
|
|
||||||
" AND patient_id = #{patientId}",
|
|
||||||
"</if>",
|
|
||||||
// 只展示待诊或已完诊两种状态的记录
|
|
||||||
"AND status IN (#{STATUS_WAITING}, #{STATUS_FINISHED})",
|
|
||||||
"ORDER BY queue_time ASC",
|
|
||||||
"</script>"
|
|
||||||
})
|
|
||||||
List<Map<String, Object>> selectCurrentQueue(@Param("patientId") Long patientId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询患者的历史排队记录(已完诊记录)。
|
|
||||||
*
|
|
||||||
* @param patientId 患者主键,必填
|
|
||||||
* @param startTime 起始时间(包含),格式:yyyy-MM-dd HH:mm:ss,若为空则不限制下限
|
|
||||||
* @param endTime 结束时间(包含),格式:yyyy-MM-dd HH:mm:ss,若为空则不限制上限
|
|
||||||
* @return 符合条件的历史排队记录列表,按完成时间倒序排列
|
|
||||||
*/
|
|
||||||
@Select({
|
|
||||||
"<script>",
|
|
||||||
"SELECT id, patient_id, status, queue_time, finish_time",
|
|
||||||
"FROM his_triage_queue",
|
|
||||||
"WHERE patient_id = #{patientId}",
|
|
||||||
" AND status = #{STATUS_FINISHED}",
|
|
||||||
"<if test='startTime != null'>",
|
|
||||||
" AND finish_time >= #{startTime}",
|
|
||||||
"</if>",
|
|
||||||
"<if test='endTime != null'>",
|
|
||||||
" AND finish_time <= #{endTime}",
|
|
||||||
"</if>",
|
|
||||||
"ORDER BY finish_time DESC",
|
|
||||||
"</script>"
|
|
||||||
})
|
|
||||||
List<Map<String, Object>> selectQueueHistory(@Param("patientId") Long patientId,
|
|
||||||
@Param("startTime") String startTime,
|
|
||||||
@Param("endTime") String endTime);
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.openhis.web.outpatient.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 门诊挂号业务接口
|
|
||||||
*/
|
|
||||||
public interface RegistrationService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理预约挂号缴费成功后的后置业务。
|
|
||||||
*
|
|
||||||
* @param orderId 医嘱(订单)ID
|
|
||||||
* @param slotId 对应的排班号ID(adm_schedule_slot.id),用于状态流转
|
|
||||||
*/
|
|
||||||
void handlePaymentSuccess(Long orderId, Long slotId);
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package com.openhis.web.outpatient.service.impl;
|
|
||||||
|
|
||||||
import com.openhis.web.outpatient.mapper.LabApplyMapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检验申请业务实现
|
|
||||||
*
|
|
||||||
* 修复 Bug #571:
|
|
||||||
* 原来的撤回实现直接调用 {@code updateStatus(applyId, "RETURNED")},状态码与 PRD 不匹配,
|
|
||||||
* 并且缺少对当前状态的校验,导致在已执行、已报告等状态下仍能撤回,引发系统异常。
|
|
||||||
*
|
|
||||||
* 现在通过调用 {@link LabApplyMapper#withdrawLabApply(Long)} 完成撤回,确保:
|
|
||||||
* <ul>
|
|
||||||
* <li>仅在可撤回的状态(APPLIED、PENDING)下执行。</li>
|
|
||||||
* <li>撤回后统一使用 PRD 定义的 CANCELLED 状态。</li>
|
|
||||||
* <li>异常信息更加友好,前端可直接展示。</li>
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class LabApplyServiceImpl {
|
|
||||||
|
|
||||||
private final LabApplyMapper labApplyMapper;
|
|
||||||
|
|
||||||
public LabApplyServiceImpl(LabApplyMapper labApplyMapper) {
|
|
||||||
this.labApplyMapper = labApplyMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 撤回检验申请。
|
|
||||||
*
|
|
||||||
* @param applyId 检验申请主键
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void withdrawApply(Long applyId) {
|
|
||||||
// LabApplyMapper 已经在内部完成状态校验并抛出异常
|
|
||||||
labApplyMapper.withdrawLabApply(applyId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 其余业务方法保持不变
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
package com.openhis.web.outpatient.service.impl;
|
|
||||||
|
|
||||||
import com.openhis.web.outpatient.mapper.RegistrationCancelMapper;
|
|
||||||
import com.openhis.web.outpatient.service.RegistrationCancelService;
|
|
||||||
import com.openhis.web.inpatient.mapper.OrderMapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 门诊挂号退号业务实现
|
|
||||||
* 修复 Bug #506:确保退号后 order_main、adm_schedule_slot、adm_schedule_pool、refund_log 状态与 PRD 严格一致
|
|
||||||
* 以及在退号后统一调用 {@link OrderMapper#updateOrderStatusToCancelled} 将医嘱状态置为 PRD 定义的 “CANCELLED”。
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class RegistrationCancelServiceImpl implements RegistrationCancelService {
|
|
||||||
|
|
||||||
private final RegistrationCancelMapper cancelMapper;
|
|
||||||
private final OrderMapper orderMapper;
|
|
||||||
|
|
||||||
public RegistrationCancelServiceImpl(RegistrationCancelMapper cancelMapper,
|
|
||||||
OrderMapper orderMapper) {
|
|
||||||
this.cancelMapper = cancelMapper;
|
|
||||||
this.orderMapper = orderMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void cancelRegistration(Long orderId, BigDecimal refundAmount) {
|
|
||||||
if (orderId == null) {
|
|
||||||
throw new IllegalArgumentException("订单ID不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1. 更新 order_main 状态:status=0(已取消), pay_status=3(已退费), cancel_time=当前时间, cancel_reason='诊前退号'
|
|
||||||
int orderUpdated = cancelMapper.updateOrderStatus(orderId);
|
|
||||||
if (orderUpdated == 0) {
|
|
||||||
throw new RuntimeException("订单状态更新失败,请检查订单是否存在或已退号");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 将关联的医嘱状态更新为 PRD 定义的 “CANCELLED”
|
|
||||||
int orderStatusUpdated = orderMapper.updateOrderStatusToCancelled(orderId, OrderMapper.ORDER_STATUS_CANCELLED);
|
|
||||||
if (orderStatusUpdated == 0) {
|
|
||||||
throw new RuntimeException("医嘱状态更新为 CANCELLED 失败,请检查医嘱是否存在或已被处理");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 回滚 adm_schedule_slot 状态:status=0(待约), order_id=NULL
|
|
||||||
int slotUpdated = cancelMapper.rollbackSlotStatus(orderId);
|
|
||||||
if (slotUpdated == 0) {
|
|
||||||
throw new RuntimeException("号源回滚失败,请检查号源是否已被其他订单占用");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4. 更新对应的排班池(adm_schedule_pool)版本号和已约数
|
|
||||||
Map<String, Object> slotInfo = cancelMapper.selectSlotByOrderId(orderId);
|
|
||||||
if (slotInfo != null && slotInfo.get("pool_id") != null) {
|
|
||||||
Long poolId = ((Number) slotInfo.get("pool_id")).longValue();
|
|
||||||
int poolUpdated = cancelMapper.updatePoolAfterCancel(poolId);
|
|
||||||
if (poolUpdated == 0) {
|
|
||||||
throw new RuntimeException("排班池信息更新失败,请检查 pool_id 是否正确");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 5. 记录退费日志
|
|
||||||
int logInserted = cancelMapper.insertRefundLog(orderId, refundAmount, "诊前退号退款");
|
|
||||||
if (logInserted == 0) {
|
|
||||||
throw new RuntimeException("退费日志插入失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 6. 如有需要,可在此处加入对支付成功后号源状态流转为“已取”(status=3)的处理(已在 Mapper 中预留方法)。
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
package com.openhis.web.outpatient.service.impl;
|
|
||||||
|
|
||||||
import com.openhis.web.outpatient.mapper.OrderMapper;
|
|
||||||
import com.openhis.web.outpatient.service.RegistrationService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 门诊挂号业务实现
|
|
||||||
*
|
|
||||||
* 修复 Bug #506:
|
|
||||||
* 门诊诊前退号后,医嘱状态应更新为 PRD 中统一定义的 “CANCELLED”,
|
|
||||||
* 之前的实现错误地使用了硬编码的 'RETURNED',导致数据库状态与 PRD 定义不符。
|
|
||||||
*
|
|
||||||
* 解决方案:
|
|
||||||
* 1. 引入 {@link OrderMapper#ORDER_STATUS_CANCELLED} 常量;
|
|
||||||
* 2. 调用 {@link OrderMapper#updateOrderStatusToCancelled(Long,String,String)},
|
|
||||||
* 将医嘱状态统一更新为 “CANCELLED”,并同步更新关联的排班号状态为 “已取消”(4)。
|
|
||||||
*
|
|
||||||
* 该实现保持在同一事务内完成,确保状态一致性。
|
|
||||||
*
|
|
||||||
* 同时修复 Bug #574:
|
|
||||||
* 预约缴费成功后,需要将对应的排班号状态更新为 “已取号”(3)。
|
|
||||||
* 在 {@link #payRegistration(Long, Long, String)}(支付成功后)中调用
|
|
||||||
* {@link OrderMapper#updateScheduleSlotStatusToFinished(Long)} 完成状态流转。
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class RegistrationServiceImpl implements RegistrationService {
|
|
||||||
|
|
||||||
private final OrderMapper orderMapper;
|
|
||||||
|
|
||||||
public RegistrationServiceImpl(OrderMapper orderMapper) {
|
|
||||||
this.orderMapper = orderMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 诊前退号(取消挂号)。
|
|
||||||
*
|
|
||||||
* @param orderId 医嘱(订单)主键
|
|
||||||
* @param patientId 患者主键
|
|
||||||
* @param operator 操作人姓名
|
|
||||||
* @return 业务结果映射,key 为 code(0 成功,1 失败),msg 为提示信息
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> cancelRegistration(Long orderId, Long patientId, String operator) {
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
try {
|
|
||||||
// 1. 将医嘱状态更新为 PRD 定义的 CANCELLED
|
|
||||||
orderMapper.updateOrderStatusToCancelled(orderId,
|
|
||||||
OrderMapper.ORDER_STATUS_CANCELLED, operator);
|
|
||||||
|
|
||||||
// 2. 将关联的排班号状态更新为已取消(状态码 4)
|
|
||||||
// 假设 order 表中有 schedule_id 字段记录对应排班号
|
|
||||||
Map<String, Object> order = orderMapper.selectOrderById(orderId);
|
|
||||||
if (order != null && order.get("schedule_id") != null) {
|
|
||||||
Long scheduleId = ((Number) order.get("schedule_id")).longValue();
|
|
||||||
orderMapper.updateScheduleSlotStatusToCancelled(scheduleId, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
result.put("code", 0);
|
|
||||||
result.put("msg", "退号成功");
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 事务会回滚,返回错误信息
|
|
||||||
result.put("code", 1);
|
|
||||||
result.put("msg", "退号失败: " + e.getMessage());
|
|
||||||
throw e; // 让事务回滚
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 其它业务方法(如 payRegistration)保持不变,已在 mapper 中实现对应状态更新
|
|
||||||
}
|
|
||||||
1
his-repo
1
his-repo
Submodule his-repo deleted from ea1271db8a
Submodule his-source deleted from 7827e58aac
@@ -1,57 +0,0 @@
|
|||||||
package com.openhis.application.controller;
|
|
||||||
|
|
||||||
import com.openhis.application.domain.entity.OrderMain;
|
|
||||||
import com.openhis.application.service.OrderService;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 医嘱相关接口
|
|
||||||
*
|
|
||||||
* 修复 Bug #562:为“待写病历”列表接口加入分页参数,前端可自行控制加载量,避免一次性返回全部数据导致加载慢。
|
|
||||||
*
|
|
||||||
* 新增:排队队列列表接口,支持“完诊”状态显示及历史查询(Bug #544)。
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/orders")
|
|
||||||
public class OrderController {
|
|
||||||
|
|
||||||
private final OrderService orderService;
|
|
||||||
|
|
||||||
public OrderController(OrderService orderService) {
|
|
||||||
this.orderService = orderService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取患者待写病历的医嘱列表(分页)。
|
|
||||||
*
|
|
||||||
* @param patientId 患者 ID
|
|
||||||
* @param pageNum 页码,默认 1
|
|
||||||
* @param pageSize 每页记录数,默认 20
|
|
||||||
* @return 医嘱列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/pending")
|
|
||||||
public List<OrderMain> getPendingOrders(@RequestParam Long patientId,
|
|
||||||
@RequestParam(required = false) Integer pageNum,
|
|
||||||
@RequestParam(required = false) Integer pageSize) {
|
|
||||||
return orderService.getPendingOrders(patientId, pageNum, pageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取患者排队队列(包括已完诊)的医嘱列表(分页)。
|
|
||||||
*
|
|
||||||
* @param patientId 患者 ID
|
|
||||||
* @param pageNum 页码,默认 1
|
|
||||||
* @param pageSize 每页记录数,默认 20
|
|
||||||
* @return 医嘱列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/queue")
|
|
||||||
public List<OrderMain> getQueueOrders(@RequestParam Long patientId,
|
|
||||||
@RequestParam(required = false) Integer pageNum,
|
|
||||||
@RequestParam(required = false) Integer pageSize) {
|
|
||||||
return orderService.getQueueOrders(patientId, pageNum, pageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 其它接口保持不变...
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.openhis.application.controller;
|
|
||||||
|
|
||||||
import com.openhis.application.domain.entity.VitalSign;
|
|
||||||
import com.openhis.application.service.VitalSignService;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 体征数据 REST 控制器
|
|
||||||
*
|
|
||||||
* 新增 /temperatureChart/{patientId} 接口供前端体温图表使用。
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/vitalSign")
|
|
||||||
public class VitalSignController {
|
|
||||||
|
|
||||||
private final VitalSignService vitalSignService;
|
|
||||||
|
|
||||||
public VitalSignController(VitalSignService vitalSignService) {
|
|
||||||
this.vitalSignService = vitalSignService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/save")
|
|
||||||
public void save(@RequestBody VitalSign vitalSign) {
|
|
||||||
vitalSignService.saveVitalSign(vitalSign);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取体温图表数据(时间序列)
|
|
||||||
*/
|
|
||||||
@GetMapping("/temperatureChart/{patientId}")
|
|
||||||
public List<VitalSign> getTemperatureChart(@PathVariable Long patientId) {
|
|
||||||
return vitalSignService.getTemperatureChartData(patientId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
package com.openhis.application.domain.dto;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用于智能分诊页面的患者排队信息 DTO。
|
|
||||||
*
|
|
||||||
* 包含实时排队和历史查询两种场景,字段保持一致,仅通过 {@code history}
|
|
||||||
* 标记区分。
|
|
||||||
*/
|
|
||||||
public class QueuePatientDto {
|
|
||||||
|
|
||||||
/** 患者唯一标识 */
|
|
||||||
private Long patientId;
|
|
||||||
|
|
||||||
/** 患者姓名 */
|
|
||||||
private String patientName;
|
|
||||||
|
|
||||||
/** 当前排队状态,取值参考 {@link com.openhis.application.constants.OrderStatus} */
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/** 排队号或叫号顺序 */
|
|
||||||
private String queueNumber;
|
|
||||||
|
|
||||||
/** 预约或挂号时间 */
|
|
||||||
private Date registerTime;
|
|
||||||
|
|
||||||
/** 是否为历史记录(true 表示历史查询结果) */
|
|
||||||
private boolean history = false;
|
|
||||||
|
|
||||||
// ---------- getters & setters ----------
|
|
||||||
public Long getPatientId() {
|
|
||||||
return patientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPatientId(Long patientId) {
|
|
||||||
this.patientId = patientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPatientName() {
|
|
||||||
return patientName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPatientName(String patientName) {
|
|
||||||
this.patientName = patientName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQueueNumber() {
|
|
||||||
return queueNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQueueNumber(String queueNumber) {
|
|
||||||
this.queueNumber = queueNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getRegisterTime() {
|
|
||||||
return registerTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRegisterTime(Date registerTime) {
|
|
||||||
this.registerTime = registerTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isHistory() {
|
|
||||||
return history;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHistory(boolean history) {
|
|
||||||
this.history = history;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
package com.openhis.application.domain.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 诊疗目录项实体
|
|
||||||
*
|
|
||||||
* 仅保留与本次修复相关的字段。
|
|
||||||
*/
|
|
||||||
@TableName("his_catalog_item")
|
|
||||||
public class CatalogItem {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private String itemCode;
|
|
||||||
private String itemName;
|
|
||||||
private String unit; // 计量单位
|
|
||||||
|
|
||||||
// ---------- getters & setters ----------
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getItemCode() {
|
|
||||||
return itemCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemCode(String itemCode) {
|
|
||||||
this.itemCode = itemCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getItemName() {
|
|
||||||
return itemName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemName(String itemName) {
|
|
||||||
this.itemName = itemName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnit() {
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnit(String unit) {
|
|
||||||
this.unit = unit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
package com.openhis.application.domain.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 医嘱明细实体
|
|
||||||
*
|
|
||||||
* 新增 unit 字段的 getter/setter(若原有则保持不变),确保在保存时能够写入计量单位。
|
|
||||||
*/
|
|
||||||
@TableName("his_order_detail")
|
|
||||||
public class OrderDetail {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private Long orderId;
|
|
||||||
private String itemCode;
|
|
||||||
private Long itemId;
|
|
||||||
private Integer quantity;
|
|
||||||
private Double price;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 计量单位(如 “片”, “瓶”, “次”等),来源于诊疗目录配置。
|
|
||||||
*/
|
|
||||||
private String unit;
|
|
||||||
|
|
||||||
// 其它字段省略
|
|
||||||
|
|
||||||
// ---------- getters & setters ----------
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getOrderId() {
|
|
||||||
return orderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrderId(Long orderId) {
|
|
||||||
this.orderId = orderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getItemCode() {
|
|
||||||
return itemCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemCode(String itemCode) {
|
|
||||||
this.itemCode = itemCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getItemId() {
|
|
||||||
return itemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemId(Long itemId) {
|
|
||||||
this.itemId = itemId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getQuantity() {
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuantity(Integer quantity) {
|
|
||||||
this.quantity = quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getPrice() {
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrice(Double price) {
|
|
||||||
this.price = price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnit() {
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnit(String unit) {
|
|
||||||
this.unit = unit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.openhis.application.mapper;
|
|
||||||
|
|
||||||
import com.openhis.application.domain.entity.CatalogItem;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 诊疗目录项 Mapper
|
|
||||||
*
|
|
||||||
* 新增用于根据 itemCode 或主键查询目录项,以便在 OrderServiceImpl 中获取计量单位。
|
|
||||||
*/
|
|
||||||
public interface CatalogItemMapper {
|
|
||||||
|
|
||||||
@Select("SELECT * FROM his_catalog_item WHERE id = #{id} AND del_flag = 0")
|
|
||||||
CatalogItem selectById(@Param("id") Long id);
|
|
||||||
|
|
||||||
@Select("SELECT * FROM his_catalog_item WHERE item_code = #{itemCode} AND del_flag = 0")
|
|
||||||
CatalogItem selectByItemCode(@Param("itemCode") String itemCode);
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
package com.openhis.application.mapper;
|
|
||||||
|
|
||||||
import com.openhis.application.domain.entity.OrderMain;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 医嘱主表 Mapper
|
|
||||||
*
|
|
||||||
* 修复 Bug #562:在门诊医生工作站“待写病历”页面,查询待写医嘱列表时未限制返回条数,
|
|
||||||
* 导致一次性查询全部历史医嘱,数据量大时响应时间超过 2 秒。
|
|
||||||
*
|
|
||||||
* 解决方案:
|
|
||||||
* 1. 为查询方法增加分页参数(offset、limit),由业务层调用时传入合理的分页值。
|
|
||||||
* 2. 在 SQL 中使用索引字段(patient_id、status、create_time)过滤并排序,避免全表扫描。
|
|
||||||
* 3. 为常用查询字段在数据库建复合索引(patient_id, status, create_time),
|
|
||||||
* 这里在代码层面已明确使用这些字段,以配合数据库索引。
|
|
||||||
*
|
|
||||||
* 新增:查询任意状态(包括“完诊”)的排队队列列表以及历史查询功能。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface OrderMainMapper {
|
|
||||||
|
|
||||||
@Insert("INSERT INTO hisdev.order_main " +
|
|
||||||
"(patient_id, doctor_id, status, create_time, update_time) " +
|
|
||||||
"VALUES (#{patientId}, #{doctorId}, #{status}, #{createTime}, #{updateTime})")
|
|
||||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
|
||||||
int insert(OrderMain orderMain);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询待写病历的医嘱列表(分页)。
|
|
||||||
*
|
|
||||||
* @param patientId 患者 ID
|
|
||||||
* @param status 医嘱状态,'0' 表示待写
|
|
||||||
* @param offset 分页起始位置
|
|
||||||
* @param limit 每页记录数
|
|
||||||
* @return 医嘱列表
|
|
||||||
*/
|
|
||||||
@Select("<script>" +
|
|
||||||
"SELECT id, patient_id, doctor_id, status, create_time, update_time " +
|
|
||||||
"FROM hisdev.order_main " +
|
|
||||||
"WHERE patient_id = #{patientId} " +
|
|
||||||
" AND status = #{status} " +
|
|
||||||
"ORDER BY create_time ASC " +
|
|
||||||
"LIMIT #{limit} OFFSET #{offset}" +
|
|
||||||
"</script>")
|
|
||||||
List<OrderMain> selectPendingByPatient(@Param("patientId") Long patientId,
|
|
||||||
@Param("status") String status,
|
|
||||||
@Param("offset") int offset,
|
|
||||||
@Param("limit") int limit);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增:查询指定患者的排队队列(包括所有状态),支持分页。
|
|
||||||
*
|
|
||||||
* @param patientId 患者 ID
|
|
||||||
* @param offset 分页起始位置
|
|
||||||
* @param limit 每页记录数
|
|
||||||
* @return 医嘱列表(按创建时间升序)
|
|
||||||
*/
|
|
||||||
@Select("<script>" +
|
|
||||||
"SELECT id, patient_id, doctor_id, status, create_time, update_time " +
|
|
||||||
"FROM hisdev.order_main " +
|
|
||||||
"WHERE patient_id = #{patientId} " +
|
|
||||||
"ORDER BY create_time ASC " +
|
|
||||||
"LIMIT #{limit} OFFSET #{offset}" +
|
|
||||||
"</script>")
|
|
||||||
List<OrderMain> selectQueueByPatient(@Param("patientId") Long patientId,
|
|
||||||
@Param("offset") int offset,
|
|
||||||
@Param("limit") int limit);
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package com.openhis.application.mapper;
|
|
||||||
|
|
||||||
import com.openhis.application.domain.entity.SchedulePool;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
|
|
||||||
public interface SchedulePoolMapper {
|
|
||||||
|
|
||||||
SchedulePool selectByPrimaryKey(Long id);
|
|
||||||
|
|
||||||
int insert(SchedulePool record);
|
|
||||||
|
|
||||||
int updateByPrimaryKey(SchedulePool record);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 乐观锁递增 booked_num
|
|
||||||
*
|
|
||||||
* @param id 号源池主键
|
|
||||||
* @param oldBookedNum 更新前的 booked_num 值
|
|
||||||
* @return 受影响的行数,0 表示并发冲突
|
|
||||||
*/
|
|
||||||
@Update("UPDATE adm_schedule_pool " +
|
|
||||||
"SET booked_num = booked_num + 1 " +
|
|
||||||
"WHERE id = #{id} AND booked_num = #{oldBookedNum}")
|
|
||||||
int updateBookedNumOptimistic(@Param("id") Long id,
|
|
||||||
@Param("oldBookedNum") Integer oldBookedNum);
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.openhis.application.mapper;
|
|
||||||
|
|
||||||
import com.openhis.application.domain.entity.VitalSign;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 体征数据 Mapper
|
|
||||||
*
|
|
||||||
* 新增 selectTemperatureChartData 用于获取体温图表所需的时间序列数据。
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface VitalSignMapper {
|
|
||||||
|
|
||||||
@Insert("INSERT INTO vital_sign (patient_id, temperature, pulse, respiration, blood_pressure, record_time, del_flag) " +
|
|
||||||
"VALUES (#{patientId}, #{temperature}, #{pulse}, #{respiration}, #{bloodPressure}, #{recordTime}, 0)")
|
|
||||||
void insert(VitalSign vitalSign);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询患者的体温图表数据,按记录时间升序返回。
|
|
||||||
*
|
|
||||||
* 只返回未被逻辑删除的记录(del_flag = 0),确保前端图表渲染时数据完整。
|
|
||||||
*/
|
|
||||||
@Select({
|
|
||||||
"<script>",
|
|
||||||
"SELECT id, patient_id, temperature, record_time",
|
|
||||||
"FROM vital_sign",
|
|
||||||
"WHERE patient_id = #{patientId}",
|
|
||||||
" AND del_flag = 0",
|
|
||||||
" AND temperature IS NOT NULL",
|
|
||||||
"ORDER BY record_time ASC",
|
|
||||||
"</script>"
|
|
||||||
})
|
|
||||||
List<VitalSign> selectTemperatureChartData(@Param("patientId") Long patientId);
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package com.openhis.application.service;
|
|
||||||
|
|
||||||
import com.openhis.application.domain.entity.OrderMain;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 医嘱业务接口
|
|
||||||
*
|
|
||||||
* 新增:查询排队队列(包括已完诊)以及历史查询功能。
|
|
||||||
*/
|
|
||||||
public interface OrderService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询患者待写病历的医嘱(分页)。
|
|
||||||
*/
|
|
||||||
List<OrderMain> getPendingOrders(Long patientId, Integer pageNum, Integer pageSize);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询患者排队队列(包括所有状态,如“完诊”),分页返回。
|
|
||||||
*
|
|
||||||
* @param patientId 患者 ID
|
|
||||||
* @param pageNum 页码,默认 1
|
|
||||||
* @param pageSize 每页记录数,默认 20
|
|
||||||
* @return 医嘱列表
|
|
||||||
*/
|
|
||||||
List<OrderMain> getQueueOrders(Long patientId, Integer pageNum, Integer pageSize);
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.openhis.application.service;
|
|
||||||
|
|
||||||
import com.openhis.application.domain.entity.VitalSign;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 体征数据业务接口
|
|
||||||
*/
|
|
||||||
public interface VitalSignService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存体征记录
|
|
||||||
*/
|
|
||||||
void saveVitalSign(VitalSign vitalSign);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取体温图表数据(时间序列)
|
|
||||||
*
|
|
||||||
* @param patientId 患者主键
|
|
||||||
* @return 按时间升序的体温记录列表
|
|
||||||
*/
|
|
||||||
List<VitalSign> getTemperatureChartData(Long patientId);
|
|
||||||
}
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
package com.openhis.application.service.impl;
|
|
||||||
|
|
||||||
import com.github.pagehelper.Page;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.openhis.application.constants.OrderStatus;
|
|
||||||
import com.openhis.application.constants.RefundStatus;
|
|
||||||
import com.openhis.application.constants.SchedulePoolStatus;
|
|
||||||
import com.openhis.application.constants.ScheduleSlotStatus;
|
|
||||||
import com.openhis.application.domain.dto.OrderVerifyDto;
|
|
||||||
import com.openhis.application.domain.dto.QueuePatientDto;
|
|
||||||
import com.openhis.application.domain.dto.OrderDetailDto;
|
|
||||||
import com.openhis.application.domain.entity.CatalogItem;
|
|
||||||
import com.openhis.application.domain.entity.OrderDetail;
|
|
||||||
import com.openhis.application.domain.entity.OrderMain;
|
|
||||||
import com.openhis.application.domain.entity.RefundLog;
|
|
||||||
import com.openhis.application.domain.entity.SchedulePool;
|
|
||||||
import com.openhis.application.domain.entity.ScheduleSlot;
|
|
||||||
import com.openhis.application.exception.BusinessException;
|
|
||||||
import com.openhis.application.mapper.CatalogItemMapper;
|
|
||||||
import com.openhis.application.mapper.OrderDetailMapper;
|
|
||||||
import com.openhis.application.mapper.OrderMainMapper;
|
|
||||||
import com.openhis.application.mapper.RefundLogMapper;
|
|
||||||
import com.openhis.application.mapper.SchedulePoolMapper;
|
|
||||||
import com.openhis.application.mapper.ScheduleSlotMapper;
|
|
||||||
import com.openhis.application.service.OrderService;
|
|
||||||
import com.openhis.application.util.OrderStatusMapper;
|
|
||||||
import com.openhis.application.util.DispenseStatusMapper;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 医嘱业务实现
|
|
||||||
*
|
|
||||||
* 注意:发药明细/汇总功能已迁移至 web/inpatient 模块的 OrderServiceImpl。
|
|
||||||
* 此文件仅保留订单/挂号相关的基础业务逻辑。
|
|
||||||
*
|
|
||||||
* 修复 Bug #574:预约签到缴费成功后,数据库 adm_schedule_slot.status 状态未及时流转为“已就诊”(VISITED)。
|
|
||||||
* 原因:在订单支付成功的业务路径中,仅更新了订单主表状态,却遗漏了对对应号源(ScheduleSlot)的状态更新。
|
|
||||||
* 解决方案:在支付成功后,统一将关联的号源状态更新为 ScheduleSlotStatus.VISITED(code=2),
|
|
||||||
* 并记录更新时间,确保前端能够正确展示“已就诊”状态。
|
|
||||||
*
|
|
||||||
* 其他已修复的 bug 说明请参考相应提交记录。
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class OrderServiceImpl implements OrderService {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(OrderServiceImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private OrderMainMapper orderMainMapper;
|
|
||||||
@Autowired
|
|
||||||
private OrderDetailMapper orderDetailMapper;
|
|
||||||
@Autowired
|
|
||||||
private ScheduleSlotMapper scheduleSlotMapper;
|
|
||||||
@Autowired
|
|
||||||
private SchedulePoolMapper schedulePoolMapper;
|
|
||||||
// 其它 mapper 省略 ...
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// 业务方法
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单支付成功后统一处理(包括订单状态、号源状态等)。
|
|
||||||
*
|
|
||||||
* @param orderId 订单主键 ID
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void handlePaySuccess(Long orderId) {
|
|
||||||
// 1. 更新订单主表状态为已支付
|
|
||||||
OrderMain order = orderMainMapper.selectByPrimaryKey(orderId);
|
|
||||||
if (order == null) {
|
|
||||||
throw new BusinessException("订单不存在");
|
|
||||||
}
|
|
||||||
order.setStatus(OrderStatus.PAID);
|
|
||||||
order.setPayTime(new Date());
|
|
||||||
orderMainMapper.updateByPrimaryKeySelective(order);
|
|
||||||
logger.info("订单[{}]状态更新为已支付", orderId);
|
|
||||||
|
|
||||||
// 2. 更新对应的号源状态为已就诊(VISITED)
|
|
||||||
if (order.getScheduleSlotId() != null) {
|
|
||||||
updateScheduleSlotToVisited(order.getScheduleSlotId());
|
|
||||||
} else {
|
|
||||||
logger.warn("订单[{}]未关联号源,无法更新号源状态", orderId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 其它业务(如生成就诊记录、发送通知等)保持原有实现
|
|
||||||
// ... 这里保留原有的业务逻辑代码(如果有) ...
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将指定的号源(ScheduleSlot)状态更新为已就诊(VISITED)。
|
|
||||||
*
|
|
||||||
* @param slotId 号源主键 ID
|
|
||||||
*/
|
|
||||||
private void updateScheduleSlotToVisited(Long slotId) {
|
|
||||||
ScheduleSlot slot = scheduleSlotMapper.selectByPrimaryKey(slotId);
|
|
||||||
if (slot == null) {
|
|
||||||
logger.warn("号源[{}]不存在,无法更新为已就诊", slotId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 只在状态不是已就诊时才更新,防止重复写库
|
|
||||||
if (slot.getStatus() != null && slot.getStatus().intValue() == ScheduleSlotStatus.VISITED) {
|
|
||||||
logger.debug("号源[{}]已经是已就诊状态,无需重复更新", slotId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
slot.setStatus(ScheduleSlotStatus.VISITED);
|
|
||||||
slot.setUpdateTime(new Date());
|
|
||||||
scheduleSlotMapper.updateByPrimaryKeySelective(slot);
|
|
||||||
logger.info("号源[{}]状态更新为已就诊(VISITED)", slotId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// 其余业务方法保持不变(原有代码省略)
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// 下面是原有的业务实现(未改动),仅保留占位以防编译错误
|
|
||||||
// 请根据实际项目将原有方法粘贴回此处
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
package com.openhis.application.service.impl;
|
|
||||||
|
|
||||||
import com.openhis.application.mapper.OrderMainMapper;
|
|
||||||
import com.openhis.application.domain.entity.OrderMain;
|
|
||||||
import com.openhis.application.exception.BusinessException;
|
|
||||||
import com.openhis.application.dto.OrderVerificationDTO;
|
|
||||||
import com.openhis.application.mapper.OrderVerificationMapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 医嘱校对业务实现
|
|
||||||
*
|
|
||||||
* 修复 Bug #505:药品医嘱已由药房发药,护士仍能在“医嘱校对”模块执行“退回”操作。
|
|
||||||
*
|
|
||||||
* 业务规则:
|
|
||||||
* 1. 医嘱状态为“已发药”(status = 2) 时,禁止退回。
|
|
||||||
* 2. 只有在“待校对”(status = 0) 或 “已校对”(status = 1) 状态下才允许退回。
|
|
||||||
*
|
|
||||||
* 该实现通过在退回前校验医嘱状态并抛出业务异常阻止后续处理,确保业务流程符合药房发药后的不可逆性要求。
|
|
||||||
*
|
|
||||||
* 另外,新增查询医嘱校对列表的实现,确保返回的字段与医生站医嘱要素保持一致,消除核对安全隐患。
|
|
||||||
*
|
|
||||||
* 修复 Bug #506:门诊诊前退号后,确保相关表的状态值与生产环境定义保持一致。
|
|
||||||
* 具体表现为:退号后,order_main、order_detail 等表的 status 必须统一更新为 “已退号”(status = 3)。
|
|
||||||
* 之前的实现仅更新了 order_main 表,导致业务查询时状态不一致。
|
|
||||||
*
|
|
||||||
* 现在在退号(returnOrder)流程中,统一更新主表和明细表的状态,确保所有相关表的状态同步。
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class OrderVerificationServiceImpl implements OrderVerificationService {
|
|
||||||
|
|
||||||
private final OrderMainMapper orderMainMapper;
|
|
||||||
private final OrderVerificationMapper orderVerificationMapper;
|
|
||||||
|
|
||||||
public OrderVerificationServiceImpl(OrderMainMapper orderMainMapper,
|
|
||||||
OrderVerificationMapper orderVerificationMapper) {
|
|
||||||
this.orderMainMapper = orderMainMapper;
|
|
||||||
this.orderVerificationMapper = orderVerificationMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 医嘱退回(撤销)操作
|
|
||||||
*
|
|
||||||
* @param orderId 医嘱主表ID
|
|
||||||
* @param reason 退回原因
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void returnOrder(Long orderId, String reason) {
|
|
||||||
// 1. 查询医嘱
|
|
||||||
OrderMain order = orderMainMapper.selectById(orderId);
|
|
||||||
if (order == null) {
|
|
||||||
throw new BusinessException("医嘱不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 检查医嘱状态,仅在待校对(0)或已校对(1)时允许退回
|
|
||||||
// 已发药(2)及其它状态均不允许退回
|
|
||||||
Integer status = order.getStatus();
|
|
||||||
if (status == null || (status != 0 && status != 1)) {
|
|
||||||
// 已发药或已退药等不可退回状态
|
|
||||||
throw new BusinessException("药品已由药房发药,不能退回");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 更新主表状态为已退号 (status = 3)
|
|
||||||
orderMainMapper.updateStatusById(orderId, 3);
|
|
||||||
|
|
||||||
// 4. 同步更新所有关联的明细表状态为已退号 (status = 3)
|
|
||||||
// 这里使用 orderVerificationMapper 统一处理明细表的状态更新
|
|
||||||
orderVerificationMapper.updateDetailStatusByOrderId(orderId, 3);
|
|
||||||
|
|
||||||
// 5. 记录退回原因(可选,根据业务需求自行实现日志或审计表)
|
|
||||||
// 这里示例性地调用一个日志方法,实际项目中可能有专门的审计表
|
|
||||||
// logReturnAction(orderId, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 其它业务方法保持不变
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
package com.openhis.application.service.impl;
|
|
||||||
|
|
||||||
import com.openhis.application.mapper.VitalSignMapper;
|
|
||||||
import com.openhis.application.domain.entity.VitalSign;
|
|
||||||
import com.openhis.application.service.VitalSignService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 体征数据服务实现
|
|
||||||
*
|
|
||||||
* 修复 Bug #566:体温单图表区未渲染数据点。
|
|
||||||
*
|
|
||||||
* 根因分析:
|
|
||||||
* 1. 前端在请求体温单图表数据时调用了 VitalSignService#getTemperatureChartData。
|
|
||||||
* 2. 原实现仅返回了最新一条体温记录,未按照时间顺序返回完整的历史数据,导致图表组件没有足够的数据点进行渲染。
|
|
||||||
* 3. 同时,查询条件缺少对 del_flag = 0 的过滤,可能返回已删除的记录,前端过滤后导致数据为空。
|
|
||||||
*
|
|
||||||
* 解决方案:
|
|
||||||
* - 新增方法 getTemperatureChartData(Long patientId) 按时间升序返回所有有效体温记录。
|
|
||||||
* - 在 SQL 中加入 del_flag = 0 过滤,确保只返回有效数据。
|
|
||||||
* - 为避免前端空指针,若无记录返回空列表而非 null。
|
|
||||||
*
|
|
||||||
* 该实现满足前端图表组件的时间序列需求,修复了数据点不渲染的问题。
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class VitalSignServiceImpl implements VitalSignService {
|
|
||||||
|
|
||||||
private final VitalSignMapper vitalSignMapper;
|
|
||||||
|
|
||||||
public VitalSignServiceImpl(VitalSignMapper vitalSignMapper) {
|
|
||||||
this.vitalSignMapper = vitalSignMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存体征记录(包括体温、脉搏、呼吸等)。
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void saveVitalSign(VitalSign vitalSign) {
|
|
||||||
vitalSignMapper.insert(vitalSign);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询患者的体温图表数据。
|
|
||||||
*
|
|
||||||
* @param patientId 患者主键
|
|
||||||
* @return 按时间升序的体温记录列表,若无记录返回空列表
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<VitalSign> getTemperatureChartData(Long patientId) {
|
|
||||||
// 只返回体温相关字段且未被逻辑删除的记录,按记录时间升序排列
|
|
||||||
return vitalSignMapper.selectTemperatureChartData(patientId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 其他业务方法保持不变...
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.openhis.application.util;
|
|
||||||
|
|
||||||
import com.openhis.application.constants.DispenseStatus;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 药品发药/退药状态中文映射工具。
|
|
||||||
* 与《药品医嘱状态映射表》保持一致。
|
|
||||||
*/
|
|
||||||
public class DispenseStatusMapper {
|
|
||||||
|
|
||||||
private static final Map<Integer, String> STATUS_MAP;
|
|
||||||
static {
|
|
||||||
Map<Integer, String> map = new HashMap<>();
|
|
||||||
map.put(DispenseStatus.PENDING.getCode(), "待发药");
|
|
||||||
map.put(DispenseStatus.DISPATCHED.getCode(), "已发药");
|
|
||||||
map.put(DispenseStatus.RETURNED.getCode(), "已退药");
|
|
||||||
map.put(DispenseStatus.CANCELLED.getCode(), "已取消");
|
|
||||||
// 如有新增状态,请同步在此添加
|
|
||||||
STATUS_MAP = Collections.unmodifiableMap(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDisplayName(Integer status) {
|
|
||||||
if (status == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return STATUS_MAP.getOrDefault(status, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
package com.openhis.application.util;
|
|
||||||
|
|
||||||
import com.openhis.application.constants.OrderStatus;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 统一的医嘱状态中文映射工具。
|
|
||||||
* 与《药品医嘱状态映射表》保持一一对应,所有前端展示均通过此类获取。
|
|
||||||
*
|
|
||||||
* 修复 Bug #569:原有中文名称与《药品医嘱状态映射表》不一致,导致业务节点状态展示歧义。
|
|
||||||
* 现在的映射严格遵循《药品医嘱状态映射表》中的中文描述。
|
|
||||||
*/
|
|
||||||
public class OrderStatusMapper {
|
|
||||||
|
|
||||||
private static final Map<Integer, String> STATUS_MAP;
|
|
||||||
static {
|
|
||||||
Map<Integer, String> map = new HashMap<>();
|
|
||||||
// 以下中文名称必须严格对应《药品医嘱状态映射表》
|
|
||||||
// 说明:
|
|
||||||
// - PENDING -> 待发药(对应“待发药”状态)
|
|
||||||
// - EXECUTED -> 已发药(对应“已发药”状态)
|
|
||||||
// - CANCELLED -> 已取消(对应“已取消”状态)
|
|
||||||
// - COMPLETED -> 已完成(对应“已完成”状态)
|
|
||||||
// - INVALID -> 已失效(对应“已失效”状态)
|
|
||||||
map.put(OrderStatus.PENDING.getCode(), "待发药");
|
|
||||||
map.put(OrderStatus.EXECUTED.getCode(), "已发药");
|
|
||||||
map.put(OrderStatus.CANCELLED.getCode(), "已取消");
|
|
||||||
map.put(OrderStatus.COMPLETED.getCode(), "已完成");
|
|
||||||
map.put(OrderStatus.INVALID.getCode(), "已失效");
|
|
||||||
// 如有新增状态,请同步在此添加
|
|
||||||
STATUS_MAP = Collections.unmodifiableMap(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据状态码获取标准中文名称。
|
|
||||||
*
|
|
||||||
* @param status 状态码,可能为 null
|
|
||||||
* @return 对应的中文名称,若未匹配则返回空字符串
|
|
||||||
*/
|
|
||||||
public static String getDisplayName(Integer status) {
|
|
||||||
if (status == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return STATUS_MAP.getOrDefault(status, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.openhis.application.mapper.CatalogItemMapper">
|
|
||||||
|
|
||||||
<resultMap id="CatalogItemResult" type="com.openhis.application.domain.entity.CatalogItem">
|
|
||||||
<id property="id" column="id"/>
|
|
||||||
<result property="itemCode" column="item_code"/>
|
|
||||||
<result property="itemName" column="item_name"/>
|
|
||||||
<result property="unit" column="unit"/>
|
|
||||||
<!-- 其它字段根据实际表结构补全 -->
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<select id="selectById" resultMap="CatalogItemResult">
|
|
||||||
SELECT id, item_code, item_name, unit
|
|
||||||
FROM his_catalog_item
|
|
||||||
WHERE id = #{id} AND del_flag = 0
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectByItemCode" resultMap="CatalogItemResult">
|
|
||||||
SELECT id, item_code, item_name, unit
|
|
||||||
FROM his_catalog_item
|
|
||||||
WHERE item_code = #{itemCode} AND del_flag = 0
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
0
openhis-server-new/.gitignore
vendored
Executable file → Normal file
0
openhis-server-new/.gitignore
vendored
Executable file → Normal file
20
openhis-server-new/LICENSE
Normal file
20
openhis-server-new/LICENSE
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2025 OpenHis
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
2
openhis-server-new/README.md
Normal file
2
openhis-server-new/README.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">OpenHis v0.0.1</h1>
|
||||||
|
|
||||||
110
openhis-server-new/core-admin/pom.xml
Normal file
110
openhis-server-new/core-admin/pom.xml
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>com.openhis</groupId>
|
||||||
|
<artifactId>openhis-server</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<groupId>com.core</groupId>
|
||||||
|
<artifactId>core-admin</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
web服务入口
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- spring-boot-devtools -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- swagger3-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.core</groupId>
|
||||||
|
<artifactId>core-framework</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 定时任务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.core</groupId>
|
||||||
|
<artifactId>core-quartz</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 代码生成-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.core</groupId>
|
||||||
|
<artifactId>core-generator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- flowable工作流-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.core</groupId>
|
||||||
|
<artifactId>core-flowable</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<!-- <build>-->
|
||||||
|
<!-- <plugins>-->
|
||||||
|
<!-- <plugin>-->
|
||||||
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
|
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||||
|
<!-- <version>2.5.15</version>-->
|
||||||
|
<!-- <configuration>-->
|
||||||
|
<!-- <fork>true</fork> <!– 如果没有该配置,devtools不会生效 –>-->
|
||||||
|
<!-- </configuration>-->
|
||||||
|
<!-- <executions>-->
|
||||||
|
<!-- <execution>-->
|
||||||
|
<!-- <goals>-->
|
||||||
|
<!-- <goal>repackage</goal>-->
|
||||||
|
<!-- </goals>-->
|
||||||
|
<!-- </execution>-->
|
||||||
|
<!-- </executions>-->
|
||||||
|
<!-- </plugin>-->
|
||||||
|
<!-- <plugin>-->
|
||||||
|
<!-- <groupId>org.apache.maven.plugins</groupId>-->
|
||||||
|
<!-- <artifactId>maven-war-plugin</artifactId>-->
|
||||||
|
<!-- <version>3.1.0</version>-->
|
||||||
|
<!-- <configuration>-->
|
||||||
|
<!-- <failOnMissingWebXml>false</failOnMissingWebXml>-->
|
||||||
|
<!-- <warName>${project.artifactId}</warName>-->
|
||||||
|
<!-- </configuration>-->
|
||||||
|
<!-- </plugin>-->
|
||||||
|
<!-- <plugin>-->
|
||||||
|
<!-- <groupId>org.apache.maven.plugins</groupId>-->
|
||||||
|
<!-- <artifactId>maven-compiler-plugin</artifactId>-->
|
||||||
|
<!-- <configuration>-->
|
||||||
|
<!-- <source>8</source>-->
|
||||||
|
<!-- <target>8</target>-->
|
||||||
|
<!-- </configuration>-->
|
||||||
|
<!-- </plugin>-->
|
||||||
|
<!-- </plugins>-->
|
||||||
|
<!-- <finalName>${project.artifactId}</finalName>-->
|
||||||
|
<!-- </build>-->
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package com.core.web.controller.common;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.util.FastByteArrayOutputStream;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.core.common.config.CoreConfig;
|
||||||
|
import com.core.common.constant.CacheConstants;
|
||||||
|
import com.core.common.constant.Constants;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.redis.RedisCache;
|
||||||
|
import com.core.common.utils.sign.Base64;
|
||||||
|
import com.core.common.utils.uuid.IdUtils;
|
||||||
|
import com.core.system.service.ISysConfigService;
|
||||||
|
import com.google.code.kaptcha.Producer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证码操作处理
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class CaptchaController {
|
||||||
|
@Resource(name = "captchaProducer")
|
||||||
|
private Producer captchaProducer;
|
||||||
|
|
||||||
|
@Resource(name = "captchaProducerMath")
|
||||||
|
private Producer captchaProducerMath;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成验证码
|
||||||
|
*/
|
||||||
|
@GetMapping("/captchaImage")
|
||||||
|
public AjaxResult getCode(HttpServletResponse response) throws IOException {
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||||
|
ajax.put("captchaEnabled", captchaEnabled);
|
||||||
|
if (!captchaEnabled) {
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存验证码信息
|
||||||
|
String uuid = IdUtils.simpleUUID();
|
||||||
|
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
|
||||||
|
|
||||||
|
String capStr = null, code = null;
|
||||||
|
BufferedImage image = null;
|
||||||
|
|
||||||
|
// 生成验证码
|
||||||
|
String captchaType = CoreConfig.getCaptchaType();
|
||||||
|
if ("math".equals(captchaType)) {
|
||||||
|
String capText = captchaProducerMath.createText();
|
||||||
|
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||||
|
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||||
|
image = captchaProducerMath.createImage(capStr);
|
||||||
|
} else if ("char".equals(captchaType)) {
|
||||||
|
capStr = code = captchaProducer.createText();
|
||||||
|
image = captchaProducer.createImage(capStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||||
|
// 转换流信息写出
|
||||||
|
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||||
|
try {
|
||||||
|
ImageIO.write(image, "jpg", os);
|
||||||
|
} catch (IOException e) {
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
ajax.put("uuid", uuid);
|
||||||
|
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
package com.core.web.controller.common;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import com.core.common.config.CoreConfig;
|
||||||
|
import com.core.common.constant.Constants;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.common.utils.file.FileUploadUtils;
|
||||||
|
import com.core.common.utils.file.FileUtils;
|
||||||
|
import com.core.framework.config.ServerConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用请求处理
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/common")
|
||||||
|
public class CommonController {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||||
|
private static final String FILE_DELIMETER = ",";
|
||||||
|
@Autowired
|
||||||
|
private ServerConfig serverConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用下载请求
|
||||||
|
*
|
||||||
|
* @param fileName 文件名称
|
||||||
|
* @param delete 是否删除
|
||||||
|
*/
|
||||||
|
@GetMapping("/download")
|
||||||
|
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response,
|
||||||
|
HttpServletRequest request) {
|
||||||
|
try {
|
||||||
|
if (!FileUtils.checkAllowDownload(fileName)) {
|
||||||
|
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||||
|
}
|
||||||
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||||
|
String filePath = CoreConfig.getDownloadPath() + fileName;
|
||||||
|
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||||
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||||
|
if (delete) {
|
||||||
|
FileUtils.deleteFile(filePath);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("下载文件失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用上传请求(单个)
|
||||||
|
*/
|
||||||
|
@PostMapping("/upload")
|
||||||
|
public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
||||||
|
try {
|
||||||
|
// 上传文件路径
|
||||||
|
String filePath = CoreConfig.getUploadPath();
|
||||||
|
// 上传并返回新文件名称
|
||||||
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
|
String url = serverConfig.getUrl() + fileName;
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("url", url);
|
||||||
|
ajax.put("fileName", fileName);
|
||||||
|
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||||
|
ajax.put("originalFilename", file.getOriginalFilename());
|
||||||
|
return ajax;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用上传请求(多个)
|
||||||
|
*/
|
||||||
|
@PostMapping("/uploads")
|
||||||
|
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception {
|
||||||
|
try {
|
||||||
|
// 上传文件路径
|
||||||
|
String filePath = CoreConfig.getUploadPath();
|
||||||
|
List<String> urls = new ArrayList<String>();
|
||||||
|
List<String> fileNames = new ArrayList<String>();
|
||||||
|
List<String> newFileNames = new ArrayList<String>();
|
||||||
|
List<String> originalFilenames = new ArrayList<String>();
|
||||||
|
for (MultipartFile file : files) {
|
||||||
|
// 上传并返回新文件名称
|
||||||
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
|
String url = serverConfig.getUrl() + fileName;
|
||||||
|
urls.add(url);
|
||||||
|
fileNames.add(fileName);
|
||||||
|
newFileNames.add(FileUtils.getName(fileName));
|
||||||
|
originalFilenames.add(file.getOriginalFilename());
|
||||||
|
}
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||||
|
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||||
|
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||||
|
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||||
|
return ajax;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本地资源通用下载
|
||||||
|
*/
|
||||||
|
@GetMapping("/download/resource")
|
||||||
|
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws Exception {
|
||||||
|
try {
|
||||||
|
if (!FileUtils.checkAllowDownload(resource)) {
|
||||||
|
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||||
|
}
|
||||||
|
// 本地资源路径
|
||||||
|
String localPath = CoreConfig.getProfile();
|
||||||
|
// 数据库资源地址
|
||||||
|
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||||
|
// 下载名称
|
||||||
|
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||||
|
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("下载文件失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.core.web.controller.common;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Anonymous;
|
||||||
|
import com.core.common.config.CoreConfig;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.exception.NonCaptureException;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.common.utils.file.FileUploadUtils;
|
||||||
|
import com.core.common.utils.file.FileUtils;
|
||||||
|
import com.core.framework.config.ServerConfig;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/file")
|
||||||
|
public class FileUploadController {
|
||||||
|
|
||||||
|
private final Logger log = LoggerFactory.getLogger(FileUploadController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ServerConfig serverConfig;
|
||||||
|
|
||||||
|
@Anonymous
|
||||||
|
@PostMapping("/upload")
|
||||||
|
@SuppressWarnings("DuplicatedCode")
|
||||||
|
public AjaxResult uploadFile(MultipartFile file) {
|
||||||
|
try {
|
||||||
|
log.info("文件 {} 上传中...", file.getOriginalFilename());
|
||||||
|
// 上传文件路径
|
||||||
|
String filePath = CoreConfig.getUploadPath();
|
||||||
|
// 上传并返回新文件名称
|
||||||
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
|
String url = serverConfig.getUrl() + fileName;
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("url", url);
|
||||||
|
ajax.put("fileName", fileName);
|
||||||
|
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||||
|
ajax.put("originalFilename", file.getOriginalFilename());
|
||||||
|
log.info("文件 {} 上传成功!", file.getOriginalFilename());
|
||||||
|
return ajax;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new NonCaptureException(StringUtils.format("文件 {} 上传失败!", file.getOriginalFilename()), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.core.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisCallback;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.constant.CacheConstants;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.system.domain.SysCache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存监控
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/cache")
|
||||||
|
public class CacheController {
|
||||||
|
private final static List<SysCache> caches = new ArrayList<SysCache>();
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
{
|
||||||
|
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
|
||||||
|
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
|
||||||
|
caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
|
||||||
|
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
|
||||||
|
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
|
||||||
|
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
|
||||||
|
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@GetMapping()
|
||||||
|
public AjaxResult getInfo() throws Exception {
|
||||||
|
Properties info = (Properties)redisTemplate.execute((RedisCallback<Object>)connection -> connection.info());
|
||||||
|
Properties commandStats =
|
||||||
|
(Properties)redisTemplate.execute((RedisCallback<Object>)connection -> connection.info("commandstats"));
|
||||||
|
Object dbSize = redisTemplate.execute((RedisCallback<Object>)connection -> connection.dbSize());
|
||||||
|
|
||||||
|
Map<String, Object> result = new HashMap<>(3);
|
||||||
|
result.put("info", info);
|
||||||
|
result.put("dbSize", dbSize);
|
||||||
|
|
||||||
|
List<Map<String, String>> pieList = new ArrayList<>();
|
||||||
|
commandStats.stringPropertyNames().forEach(key -> {
|
||||||
|
Map<String, String> data = new HashMap<>(2);
|
||||||
|
String property = commandStats.getProperty(key);
|
||||||
|
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
|
||||||
|
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
||||||
|
pieList.add(data);
|
||||||
|
});
|
||||||
|
result.put("commandStats", pieList);
|
||||||
|
return AjaxResult.success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@GetMapping("/getNames")
|
||||||
|
public AjaxResult cache() {
|
||||||
|
return AjaxResult.success(caches);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@GetMapping("/getKeys/{cacheName}")
|
||||||
|
public AjaxResult getCacheKeys(@PathVariable String cacheName) {
|
||||||
|
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||||
|
return AjaxResult.success(new TreeSet<>(cacheKeys));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@GetMapping("/getValue/{cacheName}/{cacheKey}")
|
||||||
|
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) {
|
||||||
|
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
||||||
|
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
|
||||||
|
return AjaxResult.success(sysCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@DeleteMapping("/clearCacheName/{cacheName}")
|
||||||
|
public AjaxResult clearCacheName(@PathVariable String cacheName) {
|
||||||
|
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||||
|
redisTemplate.delete(cacheKeys);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@DeleteMapping("/clearCacheKey/{cacheKey}")
|
||||||
|
public AjaxResult clearCacheKey(@PathVariable String cacheKey) {
|
||||||
|
redisTemplate.delete(cacheKey);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||||
|
@DeleteMapping("/clearCacheAll")
|
||||||
|
public AjaxResult clearCacheAll() {
|
||||||
|
Collection<String> cacheKeys = redisTemplate.keys("*");
|
||||||
|
redisTemplate.delete(cacheKeys);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.core.web.controller.monitor;
|
||||||
|
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.framework.web.domain.Server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器监控
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/server")
|
||||||
|
public class ServerController {
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||||
|
@GetMapping()
|
||||||
|
public AjaxResult getInfo() throws Exception {
|
||||||
|
Server server = new Server();
|
||||||
|
server.copyTo();
|
||||||
|
return AjaxResult.success(server);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.core.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.poi.ExcelUtil;
|
||||||
|
import com.core.framework.web.service.SysPasswordService;
|
||||||
|
import com.core.system.domain.SysLogininfor;
|
||||||
|
import com.core.system.service.ISysLogininforService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统访问记录
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/logininfor")
|
||||||
|
public class SysLogininforController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysLogininforService logininforService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPasswordService passwordService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysLogininfor logininfor) {
|
||||||
|
startPage();
|
||||||
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysLogininfor logininfor) {
|
||||||
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
|
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||||
|
util.exportExcel(response, list, "登录日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{infoIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] infoIds) {
|
||||||
|
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||||
|
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||||
|
@DeleteMapping("/clean")
|
||||||
|
public AjaxResult clean() {
|
||||||
|
logininforService.cleanLogininfor();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
|
||||||
|
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||||
|
@GetMapping("/unlock/{userName}")
|
||||||
|
public AjaxResult unlock(@PathVariable("userName") String userName) {
|
||||||
|
passwordService.clearLoginRecordCache(userName);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.core.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.poi.ExcelUtil;
|
||||||
|
import com.core.system.domain.SysOperLog;
|
||||||
|
import com.core.system.service.ISysOperLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志记录
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/operlog")
|
||||||
|
public class SysOperlogController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysOperLogService operLogService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysOperLog operLog) {
|
||||||
|
startPage();
|
||||||
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysOperLog operLog) {
|
||||||
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
|
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||||
|
util.exportExcel(response, list, "操作日志");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||||
|
@DeleteMapping("/{operIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] operIds) {
|
||||||
|
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||||
|
@DeleteMapping("/clean")
|
||||||
|
public AjaxResult clean() {
|
||||||
|
operLogService.cleanOperLog();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.core.web.controller.monitor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.constant.CacheConstants;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.model.LoginUser;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.core.redis.RedisCache;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.system.domain.SysUserOnline;
|
||||||
|
import com.core.system.service.ISysUserOnlineService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线用户监控
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/monitor/online")
|
||||||
|
public class SysUserOnlineController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysUserOnlineService userOnlineService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(String ipaddr, String userName) {
|
||||||
|
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||||
|
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||||
|
for (String key : keys) {
|
||||||
|
LoginUser user = redisCache.getCacheObject(key);
|
||||||
|
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) {
|
||||||
|
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||||
|
} else if (StringUtils.isNotEmpty(ipaddr)) {
|
||||||
|
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||||
|
} else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) {
|
||||||
|
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||||
|
} else {
|
||||||
|
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.reverse(userOnlineList);
|
||||||
|
userOnlineList.removeAll(Collections.singleton(null));
|
||||||
|
return getDataTable(userOnlineList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强退用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||||
|
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
|
@DeleteMapping("/{tokenId}")
|
||||||
|
public AjaxResult forceLogout(@PathVariable String tokenId) {
|
||||||
|
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.poi.ExcelUtil;
|
||||||
|
import com.core.system.domain.SysConfig;
|
||||||
|
import com.core.system.service.ISysConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数配置 信息操作处理
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/config")
|
||||||
|
public class SysConfigController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取参数配置列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysConfig config) {
|
||||||
|
startPage();
|
||||||
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysConfig config) {
|
||||||
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
|
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||||
|
util.exportExcel(response, list, "参数数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||||
|
@GetMapping(value = "/{configId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long configId) {
|
||||||
|
return success(configService.selectConfigById(configId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数键名查询参数值
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/configKey/{configKey}")
|
||||||
|
public AjaxResult getConfigKey(@PathVariable String configKey) {
|
||||||
|
return success(configService.selectConfigByKey(configKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增参数配置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysConfig config) {
|
||||||
|
if (!configService.checkConfigKeyUnique(config)) {
|
||||||
|
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
|
}
|
||||||
|
config.setCreateBy(getUsername());
|
||||||
|
return toAjax(configService.insertConfig(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改参数配置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysConfig config) {
|
||||||
|
if (!configService.checkConfigKeyUnique(config)) {
|
||||||
|
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
|
}
|
||||||
|
config.setUpdateBy(getUsername());
|
||||||
|
return toAjax(configService.updateConfig(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除参数配置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{configIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] configIds) {
|
||||||
|
configService.deleteConfigByIds(configIds);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新参数缓存
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||||
|
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||||
|
@DeleteMapping("/refreshCache")
|
||||||
|
public AjaxResult refreshCache() {
|
||||||
|
configService.resetConfigCache();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.constant.UserConstants;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.entity.SysDept;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.system.service.ISysDeptService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门信息
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/dept")
|
||||||
|
public class SysDeptController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(SysDept dept) {
|
||||||
|
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||||
|
return success(depts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门列表(排除节点)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||||
|
@GetMapping("/list/exclude/{deptId}")
|
||||||
|
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
|
||||||
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||||
|
depts.removeIf(d -> d.getDeptId().intValue() == deptId
|
||||||
|
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
||||||
|
return success(depts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门下拉树列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeselect")
|
||||||
|
public AjaxResult treeselect(SysDept dept) {
|
||||||
|
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||||
|
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
||||||
|
@GetMapping(value = "/{deptId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long deptId) {
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
|
return success(deptService.selectDeptById(deptId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增部门
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysDept dept) {
|
||||||
|
if (!deptService.checkDeptNameUnique(dept)) {
|
||||||
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
|
}
|
||||||
|
dept.setCreateBy(getUsername());
|
||||||
|
return toAjax(deptService.insertDept(dept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改部门
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysDept dept) {
|
||||||
|
Long deptId = dept.getDeptId();
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
|
if (!deptService.checkDeptNameUnique(dept)) {
|
||||||
|
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
|
} else if (dept.getParentId().equals(deptId)) {
|
||||||
|
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
|
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||||
|
&& deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
||||||
|
return error("该部门包含未停用的子部门!");
|
||||||
|
}
|
||||||
|
dept.setUpdateBy(getUsername());
|
||||||
|
return toAjax(deptService.updateDept(dept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除部门
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{deptId}")
|
||||||
|
public AjaxResult remove(@PathVariable Long deptId) {
|
||||||
|
if (deptService.hasChildByDeptId(deptId)) {
|
||||||
|
return warn("存在下级部门,不允许删除");
|
||||||
|
}
|
||||||
|
if (deptService.checkDeptExistUser(deptId)) {
|
||||||
|
return warn("部门存在用户,不允许删除");
|
||||||
|
}
|
||||||
|
deptService.checkDeptDataScope(deptId);
|
||||||
|
return toAjax(deptService.deleteDeptById(deptId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.entity.SysDictData;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.common.utils.poi.ExcelUtil;
|
||||||
|
import com.core.system.service.ISysDictDataService;
|
||||||
|
import com.core.system.service.ISysDictTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据字典信息
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/dict/data")
|
||||||
|
public class SysDictDataController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysDictDataService dictDataService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysDictData dictData) {
|
||||||
|
startPage();
|
||||||
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysDictData dictData) {
|
||||||
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
|
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||||
|
util.exportExcel(response, list, "字典数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典数据详细
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||||
|
@GetMapping(value = "/{dictCode}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long dictCode) {
|
||||||
|
return success(dictDataService.selectDictDataById(dictCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询字典数据信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/type/{dictType}")
|
||||||
|
public AjaxResult dictType(@PathVariable String dictType) {
|
||||||
|
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||||
|
if (StringUtils.isNull(data)) {
|
||||||
|
data = new ArrayList<SysDictData>();
|
||||||
|
}
|
||||||
|
return success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysDictData dict) {
|
||||||
|
dict.setCreateBy(getUsername());
|
||||||
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysDictData dict) {
|
||||||
|
dict.setUpdateBy(getUsername());
|
||||||
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{dictCodes}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] dictCodes) {
|
||||||
|
dictDataService.deleteDictDataByIds(dictCodes);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.entity.SysDictType;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.poi.ExcelUtil;
|
||||||
|
import com.core.system.service.ISysDictTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据字典信息
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/dict/type")
|
||||||
|
public class SysDictTypeController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysDictType dictType) {
|
||||||
|
startPage();
|
||||||
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysDictType dictType) {
|
||||||
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
|
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||||
|
util.exportExcel(response, list, "字典类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典类型详细
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||||
|
@GetMapping(value = "/{dictId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long dictId) {
|
||||||
|
return success(dictTypeService.selectDictTypeById(dictId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysDictType dict) {
|
||||||
|
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
||||||
|
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
|
}
|
||||||
|
dict.setCreateBy(getUsername());
|
||||||
|
return toAjax(dictTypeService.insertDictType(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysDictType dict) {
|
||||||
|
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
||||||
|
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
|
}
|
||||||
|
dict.setUpdateBy(getUsername());
|
||||||
|
return toAjax(dictTypeService.updateDictType(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{dictIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] dictIds) {
|
||||||
|
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新字典缓存
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
|
@DeleteMapping("/refreshCache")
|
||||||
|
public AjaxResult refreshCache() {
|
||||||
|
dictTypeService.resetDictCache();
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典选择框列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/optionselect")
|
||||||
|
public AjaxResult optionselect() {
|
||||||
|
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||||
|
return success(dictTypes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.core.common.config.CoreConfig;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class SysIndexController {
|
||||||
|
/** 系统基础配置 */
|
||||||
|
@Autowired
|
||||||
|
private CoreConfig coreConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问首页,提示语
|
||||||
|
*/
|
||||||
|
@RequestMapping("/")
|
||||||
|
public String index() {
|
||||||
|
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", coreConfig.getName(), coreConfig.getVersion());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.core.common.constant.Constants;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.entity.SysMenu;
|
||||||
|
import com.core.common.core.domain.entity.SysUser;
|
||||||
|
import com.core.common.core.domain.model.LoginBody;
|
||||||
|
import com.core.common.core.domain.model.LoginUser;
|
||||||
|
import com.core.common.utils.SecurityUtils;
|
||||||
|
import com.core.framework.web.service.SysLoginService;
|
||||||
|
import com.core.framework.web.service.SysPermissionService;
|
||||||
|
import com.core.framework.web.service.TokenService;
|
||||||
|
import com.core.system.service.ISysMenuService;
|
||||||
|
|
||||||
|
/**已评审
|
||||||
|
* 登录验证
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class SysLoginController {
|
||||||
|
@Autowired
|
||||||
|
private SysLoginService loginService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPermissionService permissionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
/**已评审
|
||||||
|
* 登录方法
|
||||||
|
*
|
||||||
|
* @param loginBody 登录信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/login")
|
||||||
|
public AjaxResult login(@RequestBody LoginBody loginBody) {
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
// 生成令牌
|
||||||
|
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||||
|
loginBody.getUuid(), loginBody.getTenantId());
|
||||||
|
ajax.put(Constants.TOKEN, token);
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**已评审 整个admin合拼到app层
|
||||||
|
* 获取用户信息
|
||||||
|
*
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
@GetMapping("getInfo")
|
||||||
|
public AjaxResult getInfo() {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
SysUser user = loginUser.getUser();
|
||||||
|
// 角色集合
|
||||||
|
Set<String> roles = permissionService.getRolePermission(user);
|
||||||
|
// 权限集合
|
||||||
|
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||||
|
if (!loginUser.getPermissions().equals(permissions)) {
|
||||||
|
loginUser.setPermissions(permissions);
|
||||||
|
tokenService.refreshToken(loginUser);
|
||||||
|
}
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("optionJson", loginUser.getOptionJson());
|
||||||
|
ajax.put("practitionerId", String.valueOf(loginUser.getPractitionerId()));
|
||||||
|
ajax.put("user", user);
|
||||||
|
ajax.put("roles", roles);
|
||||||
|
ajax.put("permissions", permissions);
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取路由信息
|
||||||
|
*
|
||||||
|
* @return 路由信息
|
||||||
|
*/
|
||||||
|
@GetMapping("getRouters")
|
||||||
|
public AjaxResult getRouters() {
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||||
|
return AjaxResult.success(menuService.buildMenus(menus));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.constant.UserConstants;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.entity.SysMenu;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.system.service.ISysMenuService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单信息
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/menu")
|
||||||
|
public class SysMenuController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取菜单列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(SysMenu menu) {
|
||||||
|
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||||
|
return success(menus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据菜单编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:menu:query')")
|
||||||
|
@GetMapping(value = "/{menuId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long menuId) {
|
||||||
|
return success(menuService.selectMenuById(menuId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取菜单下拉树列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeselect")
|
||||||
|
public AjaxResult treeselect(SysMenu menu) {
|
||||||
|
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||||
|
return success(menuService.buildMenuTreeSelect(menus));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载对应角色菜单列表树
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||||
|
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
|
||||||
|
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||||
|
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增菜单
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysMenu menu) {
|
||||||
|
if (!menuService.checkMenuNameUnique(menu)) {
|
||||||
|
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
|
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
|
||||||
|
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
|
}
|
||||||
|
menu.setCreateBy(getUsername());
|
||||||
|
return toAjax(menuService.insertMenu(menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改菜单
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysMenu menu) {
|
||||||
|
if (!menuService.checkMenuNameUnique(menu)) {
|
||||||
|
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
|
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
|
||||||
|
return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||||
|
} else if (menu.getMenuId().equals(menu.getParentId())) {
|
||||||
|
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||||
|
}
|
||||||
|
menu.setUpdateBy(getUsername());
|
||||||
|
return toAjax(menuService.updateMenu(menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除菜单
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
||||||
|
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{menuId}")
|
||||||
|
public AjaxResult remove(@PathVariable("menuId") Long menuId) {
|
||||||
|
if (menuService.hasChildByMenuId(menuId)) {
|
||||||
|
return warn("存在子菜单,不允许删除");
|
||||||
|
}
|
||||||
|
if (menuService.checkMenuExistRole(menuId)) {
|
||||||
|
return warn("菜单已分配,不允许删除");
|
||||||
|
}
|
||||||
|
return toAjax(menuService.deleteMenuById(menuId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.system.domain.SysNotice;
|
||||||
|
import com.core.system.service.ISysNoticeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告 信息操作处理
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/notice")
|
||||||
|
public class SysNoticeController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysNoticeService noticeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取通知公告列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysNotice notice) {
|
||||||
|
startPage();
|
||||||
|
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据通知公告编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||||
|
@GetMapping(value = "/{noticeId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long noticeId) {
|
||||||
|
return success(noticeService.selectNoticeById(noticeId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增通知公告
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysNotice notice) {
|
||||||
|
notice.setCreateBy(getUsername());
|
||||||
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改通知公告
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
|
||||||
|
notice.setUpdateBy(getUsername());
|
||||||
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除通知公告
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||||
|
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{noticeIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] noticeIds) {
|
||||||
|
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.poi.ExcelUtil;
|
||||||
|
import com.core.system.domain.SysPost;
|
||||||
|
import com.core.system.service.ISysPostService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位信息操作处理
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/post")
|
||||||
|
public class SysPostController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysPostService postService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取岗位列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysPost post) {
|
||||||
|
startPage();
|
||||||
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysPost post) {
|
||||||
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
|
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||||
|
util.exportExcel(response, list, "岗位数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据岗位编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||||
|
@GetMapping(value = "/{postId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long postId) {
|
||||||
|
return success(postService.selectPostById(postId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增岗位
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysPost post) {
|
||||||
|
if (!postService.checkPostNameUnique(post)) {
|
||||||
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
|
} else if (!postService.checkPostCodeUnique(post)) {
|
||||||
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
|
}
|
||||||
|
post.setCreateBy(getUsername());
|
||||||
|
return toAjax(postService.insertPost(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改岗位
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysPost post) {
|
||||||
|
if (!postService.checkPostNameUnique(post)) {
|
||||||
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
|
} else if (!postService.checkPostCodeUnique(post)) {
|
||||||
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
|
}
|
||||||
|
post.setUpdateBy(getUsername());
|
||||||
|
return toAjax(postService.updatePost(post));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除岗位
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||||
|
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{postIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] postIds) {
|
||||||
|
return toAjax(postService.deletePostByIds(postIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取岗位选择框列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/optionselect")
|
||||||
|
public AjaxResult optionselect() {
|
||||||
|
List<SysPost> posts = postService.selectPostAll();
|
||||||
|
return success(posts);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.config.CoreConfig;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.entity.SysUser;
|
||||||
|
import com.core.common.core.domain.model.LoginUser;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.SecurityUtils;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.common.utils.file.FileUploadUtils;
|
||||||
|
import com.core.common.utils.file.MimeTypeUtils;
|
||||||
|
import com.core.framework.web.service.TokenService;
|
||||||
|
import com.core.system.service.ISysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息 业务处理
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/user/profile")
|
||||||
|
public class SysProfileController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人信息
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public AjaxResult profile() {
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
SysUser user = loginUser.getUser();
|
||||||
|
AjaxResult ajax = AjaxResult.success(user);
|
||||||
|
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||||
|
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult updateProfile(@RequestBody SysUser user) {
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
SysUser currentUser = loginUser.getUser();
|
||||||
|
currentUser.setNickName(user.getNickName());
|
||||||
|
currentUser.setEmail(user.getEmail());
|
||||||
|
currentUser.setPhonenumber(user.getPhonenumber());
|
||||||
|
currentUser.setSex(user.getSex());
|
||||||
|
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) {
|
||||||
|
return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) {
|
||||||
|
return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
if (userService.updateUserProfile(currentUser) > 0) {
|
||||||
|
// 更新缓存用户信息
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error("修改个人信息异常,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置密码
|
||||||
|
*/
|
||||||
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/updatePwd")
|
||||||
|
public AjaxResult updatePwd(String oldPassword, String newPassword) {
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
String userName = loginUser.getUsername();
|
||||||
|
String password = loginUser.getPassword();
|
||||||
|
if (!SecurityUtils.matchesPassword(oldPassword, password)) {
|
||||||
|
return error("修改密码失败,旧密码错误");
|
||||||
|
}
|
||||||
|
if (SecurityUtils.matchesPassword(newPassword, password)) {
|
||||||
|
return error("新密码不能与旧密码相同");
|
||||||
|
}
|
||||||
|
newPassword = SecurityUtils.encryptPassword(newPassword);
|
||||||
|
if (userService.resetUserPwd(userName, newPassword) > 0) {
|
||||||
|
// 更新缓存用户密码
|
||||||
|
loginUser.getUser().setPassword(newPassword);
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error("修改密码异常,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像上传
|
||||||
|
*/
|
||||||
|
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/avatar")
|
||||||
|
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception {
|
||||||
|
if (!file.isEmpty()) {
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
String avatar = FileUploadUtils.upload(CoreConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||||
|
if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) {
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("imgUrl", avatar);
|
||||||
|
// 更新缓存用户头像
|
||||||
|
loginUser.getUser().setAvatar(avatar);
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error("上传图片异常,请联系管理员");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.model.RegisterBody;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.framework.web.service.SysRegisterService;
|
||||||
|
import com.core.system.service.ISysConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册验证
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class SysRegisterController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private SysRegisterService registerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
@PostMapping("/register")
|
||||||
|
public AjaxResult register(@RequestBody RegisterBody user) {
|
||||||
|
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
||||||
|
return error("当前系统没有开启注册功能!");
|
||||||
|
}
|
||||||
|
String msg = registerService.register(user);
|
||||||
|
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,234 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.entity.SysDept;
|
||||||
|
import com.core.common.core.domain.entity.SysRole;
|
||||||
|
import com.core.common.core.domain.entity.SysUser;
|
||||||
|
import com.core.common.core.domain.model.LoginUser;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.common.utils.poi.ExcelUtil;
|
||||||
|
import com.core.framework.web.service.SysPermissionService;
|
||||||
|
import com.core.framework.web.service.TokenService;
|
||||||
|
import com.core.system.domain.SysUserRole;
|
||||||
|
import com.core.system.service.ISysDeptService;
|
||||||
|
import com.core.system.service.ISysRoleService;
|
||||||
|
import com.core.system.service.ISysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色信息
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/role")
|
||||||
|
public class SysRoleController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPermissionService permissionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysRole role) {
|
||||||
|
startPage();
|
||||||
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysRole role) {
|
||||||
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
|
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||||
|
util.exportExcel(response, list, "角色数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||||
|
@GetMapping(value = "/{roleId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long roleId) {
|
||||||
|
roleService.checkRoleDataScope(roleId);
|
||||||
|
return success(roleService.selectRoleById(roleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysRole role) {
|
||||||
|
if (!roleService.checkRoleNameUnique(role)) {
|
||||||
|
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
|
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||||
|
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
|
}
|
||||||
|
role.setCreateBy(getUsername());
|
||||||
|
return toAjax(roleService.insertRole(role));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysRole role) {
|
||||||
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
|
if (!roleService.checkRoleNameUnique(role)) {
|
||||||
|
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
|
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||||
|
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
|
}
|
||||||
|
role.setUpdateBy(getUsername());
|
||||||
|
|
||||||
|
if (roleService.updateRole(role) > 0) {
|
||||||
|
// 更新缓存用户权限
|
||||||
|
LoginUser loginUser = getLoginUser();
|
||||||
|
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) {
|
||||||
|
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||||
|
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
}
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存数据权限
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/dataScope")
|
||||||
|
public AjaxResult dataScope(@RequestBody SysRole role) {
|
||||||
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
|
return toAjax(roleService.authDataScope(role));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态修改
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/changeStatus")
|
||||||
|
public AjaxResult changeStatus(@RequestBody SysRole role) {
|
||||||
|
roleService.checkRoleAllowed(role);
|
||||||
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
|
role.setUpdateBy(getUsername());
|
||||||
|
return toAjax(roleService.updateRoleStatus(role));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{roleIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] roleIds) {
|
||||||
|
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色选择框列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||||
|
@GetMapping("/optionselect")
|
||||||
|
public AjaxResult optionselect() {
|
||||||
|
return success(roleService.selectRoleAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已分配用户角色列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
|
@GetMapping("/authUser/allocatedList")
|
||||||
|
public TableDataInfo allocatedList(SysUser user) {
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = userService.selectAllocatedList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询未分配用户角色列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||||
|
@GetMapping("/authUser/unallocatedList")
|
||||||
|
public TableDataInfo unallocatedList(SysUser user) {
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消授权用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authUser/cancel")
|
||||||
|
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) {
|
||||||
|
return toAjax(roleService.deleteAuthUser(userRole));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量取消授权用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authUser/cancelAll")
|
||||||
|
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) {
|
||||||
|
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量选择用户授权
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authUser/selectAll")
|
||||||
|
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) {
|
||||||
|
roleService.checkRoleDataScope(roleId);
|
||||||
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对应角色部门树列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||||
|
@GetMapping(value = "/deptTree/{roleId}")
|
||||||
|
public AjaxResult deptTree(@PathVariable("roleId") Long roleId) {
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||||
|
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.core.common.annotation.Anonymous;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.R;
|
||||||
|
import com.core.common.core.domain.entity.SysUser;
|
||||||
|
import com.core.system.domain.SysTenant;
|
||||||
|
import com.core.system.service.ISysTenantService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户信息controller
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/tenant")
|
||||||
|
public class SysTenantController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysTenantService sysTenantService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户分页列表
|
||||||
|
*
|
||||||
|
* @param tenantId 租户ID查询
|
||||||
|
* @param tenantCode 租户编码模糊查询
|
||||||
|
* @param tenantName 租户名称模糊查询
|
||||||
|
* @param status 状态
|
||||||
|
* @param pageNum 当前页
|
||||||
|
* @param pageSize 每页多少条
|
||||||
|
* @return 租户分页列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public R<IPage<SysTenant>> getTenantPage(@RequestParam(required = false) Integer tenantId,
|
||||||
|
@RequestParam(required = false) String tenantCode, @RequestParam(required = false) String tenantName,
|
||||||
|
@RequestParam(required = false) String status, @RequestParam(defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||||
|
return sysTenantService.getTenantPage(tenantId, tenantCode, tenantName, status, pageNum, pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户详情
|
||||||
|
*
|
||||||
|
* @param tenantId 租户ID
|
||||||
|
* @return 租户分页列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@GetMapping("/{tenantId}")
|
||||||
|
public R<SysTenant> getTenantDetail(@PathVariable Integer tenantId) {
|
||||||
|
return R.ok(sysTenantService.getById(tenantId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户所属用户分页列表
|
||||||
|
*
|
||||||
|
* @param tenantId 租户ID查询
|
||||||
|
* @param userName 用户昵称模糊查询
|
||||||
|
* @param nickName 用户昵称模糊查询
|
||||||
|
* @param phoneNumber 手机号码模糊查询
|
||||||
|
* @param pageNum 当前页
|
||||||
|
* @param pageSize 每页多少条
|
||||||
|
* @return 租户所属用户分页列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@GetMapping("/user/page")
|
||||||
|
public R<IPage<SysUser>> getTenantUserPage(@RequestParam(required = false) Integer tenantId,
|
||||||
|
@RequestParam(required = false) String userName, @RequestParam(required = false) String nickName,
|
||||||
|
@RequestParam(required = false) String phoneNumber, @RequestParam(defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||||
|
return sysTenantService.getTenantUserPage(tenantId, userName, nickName, phoneNumber, pageNum, pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增租户
|
||||||
|
*
|
||||||
|
* @param sysTenant 租户实体
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@PostMapping
|
||||||
|
public R<?> addTenant(@RequestBody SysTenant sysTenant) {
|
||||||
|
sysTenantService.save(sysTenant);
|
||||||
|
return R.ok("新增成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改租户
|
||||||
|
*
|
||||||
|
* @param sysTenant 租户实体
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@PutMapping
|
||||||
|
public R<?> editTenant(@RequestBody SysTenant sysTenant) {
|
||||||
|
sysTenantService.updateById(sysTenant);
|
||||||
|
return R.ok("修改成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除租户
|
||||||
|
*
|
||||||
|
* @param tenantIdList 租户ID列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@DeleteMapping
|
||||||
|
public R<?> delTenant(@RequestBody List<Integer> tenantIdList) {
|
||||||
|
return sysTenantService.delTenant(tenantIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用租户
|
||||||
|
*
|
||||||
|
* @param tenantIdList 租户ID列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@PutMapping("/enable")
|
||||||
|
public R<?> enableTenant(@RequestBody List<Integer> tenantIdList) {
|
||||||
|
sysTenantService.enableTenant(tenantIdList);
|
||||||
|
return R.ok("启用成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停用租户
|
||||||
|
*
|
||||||
|
* @param tenantIdList 租户ID列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@PutMapping("/disable")
|
||||||
|
public R<?> disableTenant(@RequestBody List<Integer> tenantIdList) {
|
||||||
|
sysTenantService.disableTenant(tenantIdList);
|
||||||
|
return R.ok("停用成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户未绑定的用户列表
|
||||||
|
*
|
||||||
|
* @param tenantId 租户ID
|
||||||
|
* @param pageNum 当前页
|
||||||
|
* @param pageSize 每页多少条
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@GetMapping("/{tenantId}/unbind-users")
|
||||||
|
public R<IPage<SysUser>> getUnbindTenantUserList(@PathVariable Integer tenantId,
|
||||||
|
@RequestParam(required = false) String userName, @RequestParam(required = false) String nickName,
|
||||||
|
@RequestParam(required = false) String phoneNumber, @RequestParam(defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||||
|
return sysTenantService.getUnbindTenantUserList(tenantId, userName, nickName, phoneNumber, pageNum, pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定租户用户
|
||||||
|
*
|
||||||
|
* @param tenantId 租户ID
|
||||||
|
* @param userIdList 用户ID列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@PostMapping("/{tenantId}/bind-users")
|
||||||
|
public R<?> bindTenantUser(@PathVariable Integer tenantId, @RequestBody List<Long> userIdList) {
|
||||||
|
return sysTenantService.bindTenantUser(tenantId, userIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解绑租户用户
|
||||||
|
*
|
||||||
|
* @param tenantId 租户ID
|
||||||
|
* @param userIdList 用户ID列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@PostMapping("/{tenantId}/unbind-users")
|
||||||
|
public R<?> unbindTenantUser(@PathVariable Integer tenantId, @RequestBody List<Long> userIdList) {
|
||||||
|
return sysTenantService.unbindTenantUser(tenantId, userIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户绑定的租户列表
|
||||||
|
*
|
||||||
|
* @param username 用户账号
|
||||||
|
* @return 用户绑定的租户列表
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/user-bind/{username}")
|
||||||
|
public R<List<SysTenant>> getUserBindTenantList(@PathVariable String username) {
|
||||||
|
return sysTenantService.getUserBindTenantList(username);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.R;
|
||||||
|
import com.core.system.domain.dto.SaveTenantOptionDetailDto;
|
||||||
|
import com.core.system.domain.dto.TenantOptionDto;
|
||||||
|
import com.core.system.service.ISysTenantOptionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户配置项信息controller
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/tenant-option")
|
||||||
|
public class SysTenantOptionController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysTenantOptionService sysTenantOptionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户配置项详情列表
|
||||||
|
*
|
||||||
|
* @param tenantId 租户ID
|
||||||
|
* @return 租户配置项详情列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@GetMapping("/detail-list/{tenantId}")
|
||||||
|
public R<List<TenantOptionDto>> getTenantOptionDetailList(@PathVariable Integer tenantId) {
|
||||||
|
return R.ok(sysTenantOptionService.getTenantOptionDetailList(tenantId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存租户配置项详情列表
|
||||||
|
*
|
||||||
|
* @param saveTenantOptionDetailDto 参数DTO
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@PostMapping("/detail-list")
|
||||||
|
public R<?> saveTenantOptionDetailList(@RequestBody SaveTenantOptionDetailDto saveTenantOptionDetailDto) {
|
||||||
|
return sysTenantOptionService.saveTenantOptionDetailList(saveTenantOptionDetailDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询租户配置项前端form表单列表
|
||||||
|
*
|
||||||
|
* @return 租户配置项前端form表单列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
||||||
|
@GetMapping("/form-list")
|
||||||
|
public R<?> getTenantOptionFormList() {
|
||||||
|
return R.ok(sysTenantOptionService.getTenantOptionFormList());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,228 @@
|
|||||||
|
package com.core.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Log;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.entity.SysDept;
|
||||||
|
import com.core.common.core.domain.entity.SysRole;
|
||||||
|
import com.core.common.core.domain.entity.SysUser;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.utils.SecurityUtils;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.common.utils.poi.ExcelUtil;
|
||||||
|
import com.core.system.service.ISysDeptService;
|
||||||
|
import com.core.system.service.ISysPostService;
|
||||||
|
import com.core.system.service.ISysRoleService;
|
||||||
|
import com.core.system.service.ISysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/user")
|
||||||
|
public class SysUserController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysPostService postService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysUser user) {
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysUser user) {
|
||||||
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
util.exportExcel(response, list, "用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||||
|
@PostMapping("/importData")
|
||||||
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
||||||
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||||
|
String operName = getUsername();
|
||||||
|
String message = userService.importUser(userList, updateSupport, operName);
|
||||||
|
return success(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/importTemplate")
|
||||||
|
public void importTemplate(HttpServletResponse response) {
|
||||||
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
|
util.importTemplateExcel(response, "用户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户编号获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||||
|
@GetMapping(value = {"/", "/{userId}"})
|
||||||
|
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
if (StringUtils.isNotNull(userId)) {
|
||||||
|
userService.checkUserDataScope(userId);
|
||||||
|
SysUser sysUser = userService.selectUserById(userId);
|
||||||
|
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
||||||
|
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
||||||
|
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
List<SysRole> roles = roleService.selectRoleAll();
|
||||||
|
ajax.put("roles",
|
||||||
|
SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
|
ajax.put("posts", postService.selectPostAll());
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysUser user) {
|
||||||
|
deptService.checkDeptDataScope(user.getDeptId());
|
||||||
|
roleService.checkRoleDataScope(user.getRoleIds());
|
||||||
|
if (!userService.checkUserNameUnique(user)) {
|
||||||
|
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
|
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||||
|
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
|
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||||
|
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
user.setCreateBy(getUsername());
|
||||||
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
|
return toAjax(userService.insertUser(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysUser user) {
|
||||||
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
|
deptService.checkDeptDataScope(user.getDeptId());
|
||||||
|
roleService.checkRoleDataScope(user.getRoleIds());
|
||||||
|
if (!userService.checkUserNameUnique(user)) {
|
||||||
|
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
|
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||||
|
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
|
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||||
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
user.setUpdateBy(getUsername());
|
||||||
|
return toAjax(userService.updateUser(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{userIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] userIds) {
|
||||||
|
if (ArrayUtils.contains(userIds, getUserId())) {
|
||||||
|
return error("当前用户不能删除");
|
||||||
|
}
|
||||||
|
return toAjax(userService.deleteUserByIds(userIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置密码
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/resetPwd")
|
||||||
|
public AjaxResult resetPwd(@RequestBody SysUser user) {
|
||||||
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
|
user.setUpdateBy(getUsername());
|
||||||
|
return toAjax(userService.resetPwd(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态修改
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/changeStatus")
|
||||||
|
public AjaxResult changeStatus(@RequestBody SysUser user) {
|
||||||
|
userService.checkUserAllowed(user);
|
||||||
|
userService.checkUserDataScope(user.getUserId());
|
||||||
|
user.setUpdateBy(getUsername());
|
||||||
|
return toAjax(userService.updateUserStatus(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户编号获取授权角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||||
|
@GetMapping("/authRole/{userId}")
|
||||||
|
public AjaxResult authRole(@PathVariable("userId") Long userId) {
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
SysUser user = userService.selectUserById(userId);
|
||||||
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
|
ajax.put("user", user);
|
||||||
|
ajax.put("roles",
|
||||||
|
SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户授权角色
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||||
|
@PutMapping("/authRole")
|
||||||
|
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
|
||||||
|
userService.checkUserDataScope(userId);
|
||||||
|
roleService.checkRoleDataScope(roleIds);
|
||||||
|
userService.insertUserAuth(userId, roleIds);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门树列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||||
|
@GetMapping("/deptTree")
|
||||||
|
public AjaxResult deptTree(SysDept dept) {
|
||||||
|
return success(deptService.selectDeptTreeList(dept));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package com.core.web.controller.tool;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.R;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* swagger 用户测试方法
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Api("用户信息管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/test/user")
|
||||||
|
public class TestController extends BaseController {
|
||||||
|
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
||||||
|
{
|
||||||
|
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
||||||
|
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取用户列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R<List<UserEntity>> userList() {
|
||||||
|
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
||||||
|
return R.ok(userList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取用户详细")
|
||||||
|
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path",
|
||||||
|
dataTypeClass = Integer.class)
|
||||||
|
@GetMapping("/{userId}")
|
||||||
|
public R<UserEntity> getUser(@PathVariable Integer userId) {
|
||||||
|
if (!users.isEmpty() && users.containsKey(userId)) {
|
||||||
|
return R.ok(users.get(userId));
|
||||||
|
} else {
|
||||||
|
return R.fail("用户不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增用户")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
|
||||||
|
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
|
||||||
|
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
|
||||||
|
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)})
|
||||||
|
@PostMapping("/save")
|
||||||
|
public R<String> save(UserEntity user) {
|
||||||
|
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
|
||||||
|
return R.fail("用户ID不能为空");
|
||||||
|
}
|
||||||
|
users.put(user.getUserId(), user);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("更新用户")
|
||||||
|
@PutMapping("/update")
|
||||||
|
public R<String> update(@RequestBody UserEntity user) {
|
||||||
|
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
|
||||||
|
return R.fail("用户ID不能为空");
|
||||||
|
}
|
||||||
|
if (users.isEmpty() || !users.containsKey(user.getUserId())) {
|
||||||
|
return R.fail("用户不存在");
|
||||||
|
}
|
||||||
|
users.remove(user.getUserId());
|
||||||
|
users.put(user.getUserId(), user);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除用户信息")
|
||||||
|
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path",
|
||||||
|
dataTypeClass = Integer.class)
|
||||||
|
@DeleteMapping("/{userId}")
|
||||||
|
public R<String> delete(@PathVariable Integer userId) {
|
||||||
|
if (!users.isEmpty() && users.containsKey(userId)) {
|
||||||
|
users.remove(userId);
|
||||||
|
return R.ok();
|
||||||
|
} else {
|
||||||
|
return R.fail("用户不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModel(value = "UserEntity", description = "用户实体")
|
||||||
|
class UserEntity {
|
||||||
|
@ApiModelProperty("用户ID")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户名称")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户手机")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
public UserEntity() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserEntity(Integer userId, String username, String password, String mobile) {
|
||||||
|
this.userId = userId;
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
this.mobile = mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Integer userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMobile() {
|
||||||
|
return mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMobile(String mobile) {
|
||||||
|
this.mobile = mobile;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package com.core.web.core.config;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import com.core.common.config.CoreConfig;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
import springfox.documentation.service.*;
|
||||||
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Swagger2的接口配置
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class SwaggerConfig {
|
||||||
|
/** 系统基础配置 */
|
||||||
|
@Autowired
|
||||||
|
private CoreConfig coreConfig;
|
||||||
|
|
||||||
|
/** 是否开启swagger */
|
||||||
|
@Value("${swagger.enabled}")
|
||||||
|
private boolean enabled;
|
||||||
|
|
||||||
|
/** 设置请求的统一前缀 */
|
||||||
|
@Value("${swagger.pathMapping}")
|
||||||
|
private String pathMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建API
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Docket createRestApi() {
|
||||||
|
return new Docket(DocumentationType.OAS_30)
|
||||||
|
// 是否启用Swagger
|
||||||
|
.enable(enabled)
|
||||||
|
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||||
|
.apiInfo(apiInfo())
|
||||||
|
// 设置哪些接口暴露给Swagger展示
|
||||||
|
.select()
|
||||||
|
// 扫描所有有注解的api,用这种方式更灵活
|
||||||
|
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||||
|
// 扫描指定包中的swagger注解
|
||||||
|
// .apis(RequestHandlerSelectors.basePackage("com.core.project.tool.swagger"))
|
||||||
|
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||||
|
.paths(PathSelectors.any()).build()
|
||||||
|
/* 设置安全模式,swagger可以设置访问token */
|
||||||
|
.securitySchemes(securitySchemes()).securityContexts(securityContexts()).pathMapping(pathMapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||||
|
*/
|
||||||
|
private List<SecurityScheme> securitySchemes() {
|
||||||
|
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||||
|
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
||||||
|
return apiKeyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全上下文
|
||||||
|
*/
|
||||||
|
private List<SecurityContext> securityContexts() {
|
||||||
|
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||||
|
securityContexts.add(SecurityContext.builder().securityReferences(defaultAuth())
|
||||||
|
.operationSelector(o -> o.requestMappingPattern().matches("/.*")).build());
|
||||||
|
return securityContexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认的安全上引用
|
||||||
|
*/
|
||||||
|
private List<SecurityReference> defaultAuth() {
|
||||||
|
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||||
|
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||||
|
authorizationScopes[0] = authorizationScope;
|
||||||
|
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||||
|
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||||
|
return securityReferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加摘要信息
|
||||||
|
*/
|
||||||
|
private ApiInfo apiInfo() {
|
||||||
|
// 用ApiInfoBuilder进行定制
|
||||||
|
return new ApiInfoBuilder()
|
||||||
|
// 设置标题
|
||||||
|
.title("标题:开放医院管理系统_接口文档")
|
||||||
|
// 描述
|
||||||
|
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||||
|
// 作者信息
|
||||||
|
.contact(new Contact(coreConfig.getName(), null, null))
|
||||||
|
// 版本
|
||||||
|
.version("版本号:" + coreConfig.getVersion()).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.core.web.util;
|
||||||
|
|
||||||
|
import com.core.common.core.domain.model.LoginUser;
|
||||||
|
import com.core.common.enums.TenantOptionDict;
|
||||||
|
import com.core.common.utils.SecurityUtils;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户配置工具类
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class TenantOptionUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取租户配置项内容
|
||||||
|
*
|
||||||
|
* @param optionDict 租户配置项字典
|
||||||
|
* @return 租户配置项内容
|
||||||
|
*/
|
||||||
|
public static String getOptionContent(TenantOptionDict optionDict) {
|
||||||
|
LoginUser loginUser;
|
||||||
|
try {
|
||||||
|
loginUser = SecurityUtils.getLoginUser();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (loginUser == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (loginUser.getOptionMap() == null || loginUser.getOptionMap().isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// return loginUser.getOptionMap().get(optionDict.getCode());
|
||||||
|
|
||||||
|
// TODO:2025/10/17 李永兴提出的sys_option切换TenantOption临时防止报错方案,最晚2025年11月底删除
|
||||||
|
String newValue = loginUser.getOptionMap().get(optionDict.getCode());
|
||||||
|
String oldValue = loginUser.getOptionJson().getString(optionDict.getCode());
|
||||||
|
return StringUtils.isEmpty(newValue) ? oldValue : newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
152
openhis-server-new/core-common/pom.xml
Normal file
152
openhis-server-new/core-common/pom.xml
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>com.openhis</groupId>
|
||||||
|
<artifactId>openhis-server</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.core</groupId>
|
||||||
|
<artifactId>core-common</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
common通用工具
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- mybatis-plus 增强CRUD -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- lombok -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring框架基本的核心工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringWeb模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- spring security 安全认证 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 自定义验证注解 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JSON工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里JSON解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- io常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- excel工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- yml解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.yaml</groupId>
|
||||||
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Token生成与解析-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Jaxb -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- redis 缓存操作 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pool 对象池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 解析客户端操作系统、浏览器等 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>eu.bitwalker</groupId>
|
||||||
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- servlet包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 中文汉字转换为首字母拼音包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.belerweb</groupId>
|
||||||
|
<artifactId>pinyin4j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.core.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 匿名访问不鉴权注解
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface Anonymous {}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.core.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限过滤注解
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface DataScope {
|
||||||
|
/**
|
||||||
|
* 部门表的别名
|
||||||
|
*/
|
||||||
|
public String deptAlias() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户表的别名
|
||||||
|
*/
|
||||||
|
public String userAlias() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来
|
||||||
|
*/
|
||||||
|
public String permission() default "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.core.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.enums.DataSourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义多数据源切换注解
|
||||||
|
*
|
||||||
|
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
@Inherited
|
||||||
|
public @interface DataSource {
|
||||||
|
/**
|
||||||
|
* 切换数据源名称
|
||||||
|
*/
|
||||||
|
public DataSourceType value() default DataSourceType.MASTER;
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
package com.core.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||||
|
|
||||||
|
import com.core.common.utils.poi.ExcelHandlerAdapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义导出Excel数据注解
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
public @interface Excel {
|
||||||
|
/**
|
||||||
|
* 导出时在excel中排序
|
||||||
|
*/
|
||||||
|
public int sort() default Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出到Excel中的名字.
|
||||||
|
*/
|
||||||
|
public String name() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期格式, 如: yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
public String dateFormat() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
|
||||||
|
*/
|
||||||
|
public String dictType() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||||
|
*/
|
||||||
|
public String readConverterExp() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分隔符,读取字符串组内容
|
||||||
|
*/
|
||||||
|
public String separator() default ",";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||||
|
*/
|
||||||
|
public int scale() default -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||||
|
*/
|
||||||
|
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出时在excel中每个列的高度
|
||||||
|
*/
|
||||||
|
public double height() default 14;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出时在excel中每个列的宽度
|
||||||
|
*/
|
||||||
|
public double width() default 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文字后缀,如% 90 变成90%
|
||||||
|
*/
|
||||||
|
public String suffix() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当值为空时,字段的默认值
|
||||||
|
*/
|
||||||
|
public String defaultValue() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示信息
|
||||||
|
*/
|
||||||
|
public String prompt() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置只能选择不能输入的列内容.
|
||||||
|
*/
|
||||||
|
public String[] combo() default {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否从字典读数据到combo,默认不读取,如读取需要设置dictType注解.
|
||||||
|
*/
|
||||||
|
public boolean comboReadDict() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||||
|
*/
|
||||||
|
public boolean needMerge() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||||
|
*/
|
||||||
|
public boolean isExport() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||||
|
*/
|
||||||
|
public String targetAttr() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||||
|
*/
|
||||||
|
public boolean isStatistics() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出类型(0数字 1字符串 2图片)
|
||||||
|
*/
|
||||||
|
public ColumnType cellType() default ColumnType.STRING;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出列头背景颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出列头字体颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors headerColor() default IndexedColors.WHITE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出单元格背景颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors backgroundColor() default IndexedColors.WHITE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出单元格字体颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors color() default IndexedColors.BLACK;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出字段对齐方式
|
||||||
|
*/
|
||||||
|
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据处理器
|
||||||
|
*/
|
||||||
|
public Class<?> handler() default ExcelHandlerAdapter.class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据处理器参数
|
||||||
|
*/
|
||||||
|
public String[] args() default {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||||
|
*/
|
||||||
|
Type type() default Type.ALL;
|
||||||
|
|
||||||
|
public enum Type {
|
||||||
|
ALL(0), EXPORT(1), IMPORT(2);
|
||||||
|
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
Type(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int value() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ColumnType {
|
||||||
|
NUMERIC(0), STRING(1), IMAGE(2), TEXT(3);
|
||||||
|
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
ColumnType(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int value() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.core.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel注解集
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface Excels {
|
||||||
|
public Excel[] value();
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.core.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.enums.BusinessType;
|
||||||
|
import com.core.common.enums.OperatorType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义操作日志记录注解
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface Log {
|
||||||
|
/**
|
||||||
|
* 模块
|
||||||
|
*/
|
||||||
|
public String title() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能
|
||||||
|
*/
|
||||||
|
public BusinessType businessType() default BusinessType.OTHER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人类别
|
||||||
|
*/
|
||||||
|
public OperatorType operatorType() default OperatorType.MANAGE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否保存请求的参数
|
||||||
|
*/
|
||||||
|
public boolean isSaveRequestData() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否保存响应的参数
|
||||||
|
*/
|
||||||
|
public boolean isSaveResponseData() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排除指定的请求参数
|
||||||
|
*/
|
||||||
|
public String[] excludeParamNames() default {};
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.core.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
import com.core.common.constant.CacheConstants;
|
||||||
|
import com.core.common.enums.LimitType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限流注解
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface RateLimiter {
|
||||||
|
/**
|
||||||
|
* 限流key
|
||||||
|
*/
|
||||||
|
public String key() default CacheConstants.RATE_LIMIT_KEY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限流时间,单位秒
|
||||||
|
*/
|
||||||
|
public int time() default 60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限流次数
|
||||||
|
*/
|
||||||
|
public int count() default 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限流类型
|
||||||
|
*/
|
||||||
|
public LimitType limitType() default LimitType.DEFAULT;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.core.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义注解防止表单重复提交
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Inherited
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface RepeatSubmit {
|
||||||
|
/**
|
||||||
|
* 间隔时间(ms),小于此时间视为重复提交
|
||||||
|
*/
|
||||||
|
public int interval() default 5000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示消息
|
||||||
|
*/
|
||||||
|
public String message() default "不允许重复提交,请稍候再试";
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.core.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import com.core.common.config.serializer.SensitiveJsonSerializer;
|
||||||
|
import com.core.common.enums.DesensitizedType;
|
||||||
|
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据脱敏注解
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
@JacksonAnnotationsInside
|
||||||
|
@JsonSerialize(using = SensitiveJsonSerializer.class)
|
||||||
|
public @interface Sensitive {
|
||||||
|
DesensitizedType desensitizedType();
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
package com.core.common.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取项目相关配置
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "core")
|
||||||
|
public class CoreConfig {
|
||||||
|
/** 上传路径 */
|
||||||
|
private static String profile;
|
||||||
|
/** 获取地址开关 */
|
||||||
|
private static boolean addressEnabled;
|
||||||
|
/** 验证码类型 */
|
||||||
|
private static String captchaType;
|
||||||
|
/** 项目名称 */
|
||||||
|
private String name;
|
||||||
|
/** 版本 */
|
||||||
|
private String version;
|
||||||
|
/** 版权年份 */
|
||||||
|
private String copyrightYear;
|
||||||
|
|
||||||
|
public static String getProfile() {
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfile(String profile) {
|
||||||
|
CoreConfig.profile = profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAddressEnabled() {
|
||||||
|
return addressEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddressEnabled(boolean addressEnabled) {
|
||||||
|
CoreConfig.addressEnabled = addressEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCaptchaType() {
|
||||||
|
return captchaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCaptchaType(String captchaType) {
|
||||||
|
CoreConfig.captchaType = captchaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取导入上传路径
|
||||||
|
*/
|
||||||
|
public static String getImportPath() {
|
||||||
|
return getProfile() + "/import";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取头像上传路径
|
||||||
|
*/
|
||||||
|
public static String getAvatarPath() {
|
||||||
|
return getProfile() + "/avatar";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取下载路径
|
||||||
|
*/
|
||||||
|
public static String getDownloadPath() {
|
||||||
|
return getProfile() + "/download/";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取上传路径
|
||||||
|
*/
|
||||||
|
public static String getUploadPath() {
|
||||||
|
return getProfile() + "/upload";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCopyrightYear() {
|
||||||
|
return copyrightYear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCopyrightYear(String copyrightYear) {
|
||||||
|
this.copyrightYear = copyrightYear;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.core.common.config.serializer;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Sensitive;
|
||||||
|
import com.core.common.core.domain.model.LoginUser;
|
||||||
|
import com.core.common.enums.DesensitizedType;
|
||||||
|
import com.core.common.utils.SecurityUtils;
|
||||||
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
import com.fasterxml.jackson.databind.BeanProperty;
|
||||||
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
import com.fasterxml.jackson.databind.ser.ContextualSerializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据脱敏序列化过滤
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class SensitiveJsonSerializer extends JsonSerializer<String> implements ContextualSerializer {
|
||||||
|
private DesensitizedType desensitizedType;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||||
|
if (desensitization()) {
|
||||||
|
gen.writeString(desensitizedType.desensitizer().apply(value));
|
||||||
|
} else {
|
||||||
|
gen.writeString(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property)
|
||||||
|
throws JsonMappingException {
|
||||||
|
Sensitive annotation = property.getAnnotation(Sensitive.class);
|
||||||
|
if (Objects.nonNull(annotation) && Objects.equals(String.class, property.getType().getRawClass())) {
|
||||||
|
this.desensitizedType = annotation.desensitizedType();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return prov.findValueSerializer(property.getType(), property);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要脱敏处理
|
||||||
|
*/
|
||||||
|
private boolean desensitization() {
|
||||||
|
try {
|
||||||
|
LoginUser securityUser = SecurityUtils.getLoginUser();
|
||||||
|
// 管理员不脱敏
|
||||||
|
return !securityUser.getUser().isAdmin();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.core.common.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存的key 常量
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class CacheConstants {
|
||||||
|
/**
|
||||||
|
* 登录用户 redis key
|
||||||
|
*/
|
||||||
|
public static final String LOGIN_TOKEN_KEY = "login_tokens:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证码 redis key
|
||||||
|
*/
|
||||||
|
public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数管理 cache key
|
||||||
|
*/
|
||||||
|
public static final String SYS_CONFIG_KEY = "sys_config:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典管理 cache key
|
||||||
|
*/
|
||||||
|
public static final String SYS_DICT_KEY = "sys_dict:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防重提交 redis key
|
||||||
|
*/
|
||||||
|
public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限流 redis key
|
||||||
|
*/
|
||||||
|
public static final String RATE_LIMIT_KEY = "rate_limit:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录账户密码错误次数 redis key
|
||||||
|
*/
|
||||||
|
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录上次勾选的租户
|
||||||
|
*/
|
||||||
|
public static final String LOGIN_SELECTED_TENANT = "login_selected_tenant:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超出上限,排番失败(时间:{},KEY:{}
|
||||||
|
*/
|
||||||
|
public static final String ASSIGN_SEQ_FAILED = "排番失败(时间:{},KEY:{},异常信息:{超出上限})";
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package com.core.common.constant;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import io.jsonwebtoken.Claims;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用常量信息
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class Constants {
|
||||||
|
/**
|
||||||
|
* UTF-8 字符集
|
||||||
|
*/
|
||||||
|
public static final String UTF8 = "UTF-8";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GBK 字符集
|
||||||
|
*/
|
||||||
|
public static final String GBK = "GBK";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统语言
|
||||||
|
*/
|
||||||
|
public static final Locale DEFAULT_LOCALE = Locale.SIMPLIFIED_CHINESE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* www主域
|
||||||
|
*/
|
||||||
|
public static final String WWW = "www.";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* http请求
|
||||||
|
*/
|
||||||
|
public static final String HTTP = "http://";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https请求
|
||||||
|
*/
|
||||||
|
public static final String HTTPS = "https://";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用成功标识
|
||||||
|
*/
|
||||||
|
public static final String SUCCESS = "0";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用失败标识
|
||||||
|
*/
|
||||||
|
public static final String FAIL = "1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录成功
|
||||||
|
*/
|
||||||
|
public static final String LOGIN_SUCCESS = "Success";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注销
|
||||||
|
*/
|
||||||
|
public static final String LOGOUT = "Logout";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
*/
|
||||||
|
public static final String REGISTER = "Register";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录失败
|
||||||
|
*/
|
||||||
|
public static final String LOGIN_FAIL = "Error";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有权限标识
|
||||||
|
*/
|
||||||
|
public static final String ALL_PERMISSION = "*:*:*";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员角色权限标识
|
||||||
|
*/
|
||||||
|
public static final String SUPER_ADMIN = "admin";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色权限分隔符
|
||||||
|
*/
|
||||||
|
public static final String ROLE_DELIMETER = ",";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限标识分隔符
|
||||||
|
*/
|
||||||
|
public static final String PERMISSION_DELIMETER = ",";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证码有效期(分钟)
|
||||||
|
*/
|
||||||
|
public static final Integer CAPTCHA_EXPIRATION = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 令牌
|
||||||
|
*/
|
||||||
|
public static final String TOKEN = "token";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 令牌前缀
|
||||||
|
*/
|
||||||
|
public static final String TOKEN_PREFIX = "Bearer ";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 令牌前缀
|
||||||
|
*/
|
||||||
|
public static final String LOGIN_USER_KEY = "login_user_key";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
public static final String JWT_USERID = "userid";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
public static final String JWT_USERNAME = Claims.SUBJECT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户头像
|
||||||
|
*/
|
||||||
|
public static final String JWT_AVATAR = "avatar";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
public static final String JWT_CREATED = "created";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户权限
|
||||||
|
*/
|
||||||
|
public static final String JWT_AUTHORITIES = "authorities";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源映射路径 前缀
|
||||||
|
*/
|
||||||
|
public static final String RESOURCE_PREFIX = "/profile";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RMI 远程方法调用
|
||||||
|
*/
|
||||||
|
public static final String LOOKUP_RMI = "rmi:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LDAP 远程方法调用
|
||||||
|
*/
|
||||||
|
public static final String LOOKUP_LDAP = "ldap:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LDAPS 远程方法调用
|
||||||
|
*/
|
||||||
|
public static final String LOOKUP_LDAPS = "ldaps:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)
|
||||||
|
*/
|
||||||
|
public static final String[] JSON_WHITELIST_STR = {"org.springframework", "com.core"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||||
|
*/
|
||||||
|
public static final String[] JOB_WHITELIST_STR = {"com.openhis.quartz.task"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时任务违规的字符
|
||||||
|
*/
|
||||||
|
public static final String[] JOB_ERROR_STR =
|
||||||
|
{"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", "org.springframework", "org.apache",
|
||||||
|
"com.core.common.utils.file", "com.core.common.config", "com.core.generator"};
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package com.core.common.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码生成通用常量
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class GenConstants {
|
||||||
|
/** 单表(增删改查) */
|
||||||
|
public static final String TPL_CRUD = "crud";
|
||||||
|
|
||||||
|
/** 树表(增删改查) */
|
||||||
|
public static final String TPL_TREE = "tree";
|
||||||
|
|
||||||
|
/** 主子表(增删改查) */
|
||||||
|
public static final String TPL_SUB = "sub";
|
||||||
|
|
||||||
|
/** 树编码字段 */
|
||||||
|
public static final String TREE_CODE = "treeCode";
|
||||||
|
|
||||||
|
/** 树父编码字段 */
|
||||||
|
public static final String TREE_PARENT_CODE = "treeParentCode";
|
||||||
|
|
||||||
|
/** 树名称字段 */
|
||||||
|
public static final String TREE_NAME = "treeName";
|
||||||
|
|
||||||
|
/** 上级菜单ID字段 */
|
||||||
|
public static final String PARENT_MENU_ID = "parentMenuId";
|
||||||
|
|
||||||
|
/** 上级菜单名称字段 */
|
||||||
|
public static final String PARENT_MENU_NAME = "parentMenuName";
|
||||||
|
|
||||||
|
/** 数据库字符串类型 */
|
||||||
|
public static final String[] COLUMNTYPE_STR = {"char", "varchar", "nvarchar", "varchar2"};
|
||||||
|
|
||||||
|
/** 数据库文本类型 */
|
||||||
|
public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
|
||||||
|
|
||||||
|
/** 数据库时间类型 */
|
||||||
|
public static final String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"};
|
||||||
|
|
||||||
|
/** 数据库数字类型 */
|
||||||
|
public static final String[] COLUMNTYPE_NUMBER =
|
||||||
|
{"tinyint", "smallint", "mediumint", "int", "number", "integer", "bit", "bigint", "float", "double", "decimal"};
|
||||||
|
|
||||||
|
/** 页面不需要编辑字段 */
|
||||||
|
public static final String[] COLUMNNAME_NOT_EDIT = {"id", "create_by", "create_time", "del_flag"};
|
||||||
|
|
||||||
|
/** 页面不需要显示的列表字段 */
|
||||||
|
public static final String[] COLUMNNAME_NOT_LIST =
|
||||||
|
{"id", "create_by", "create_time", "del_flag", "update_by", "update_time"};
|
||||||
|
|
||||||
|
/** 页面不需要查询字段 */
|
||||||
|
public static final String[] COLUMNNAME_NOT_QUERY =
|
||||||
|
{"id", "create_by", "create_time", "del_flag", "update_by", "update_time", "remark"};
|
||||||
|
|
||||||
|
/** Entity基类字段 */
|
||||||
|
public static final String[] BASE_ENTITY = {"createBy", "createTime", "updateBy", "updateTime", "remark"};
|
||||||
|
|
||||||
|
/** Tree基类字段 */
|
||||||
|
public static final String[] TREE_ENTITY = {"parentName", "parentId", "orderNum", "ancestors", "children"};
|
||||||
|
|
||||||
|
/** 文本框 */
|
||||||
|
public static final String HTML_INPUT = "input";
|
||||||
|
|
||||||
|
/** 文本域 */
|
||||||
|
public static final String HTML_TEXTAREA = "textarea";
|
||||||
|
|
||||||
|
/** 下拉框 */
|
||||||
|
public static final String HTML_SELECT = "select";
|
||||||
|
|
||||||
|
/** 单选框 */
|
||||||
|
public static final String HTML_RADIO = "radio";
|
||||||
|
|
||||||
|
/** 复选框 */
|
||||||
|
public static final String HTML_CHECKBOX = "checkbox";
|
||||||
|
|
||||||
|
/** 日期控件 */
|
||||||
|
public static final String HTML_DATETIME = "datetime";
|
||||||
|
|
||||||
|
/** 图片上传控件 */
|
||||||
|
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
|
||||||
|
|
||||||
|
/** 文件上传控件 */
|
||||||
|
public static final String HTML_FILE_UPLOAD = "fileUpload";
|
||||||
|
|
||||||
|
/** 富文本控件 */
|
||||||
|
public static final String HTML_EDITOR = "editor";
|
||||||
|
|
||||||
|
/** 字符串类型 */
|
||||||
|
public static final String TYPE_STRING = "String";
|
||||||
|
|
||||||
|
/** 整型 */
|
||||||
|
public static final String TYPE_INTEGER = "Integer";
|
||||||
|
|
||||||
|
/** 长整型 */
|
||||||
|
public static final String TYPE_LONG = "Long";
|
||||||
|
|
||||||
|
/** 浮点型 */
|
||||||
|
public static final String TYPE_DOUBLE = "Double";
|
||||||
|
|
||||||
|
/** 高精度计算类型 */
|
||||||
|
public static final String TYPE_BIGDECIMAL = "BigDecimal";
|
||||||
|
|
||||||
|
/** 时间类型 */
|
||||||
|
public static final String TYPE_DATE = "Date";
|
||||||
|
|
||||||
|
/** 模糊查询 */
|
||||||
|
public static final String QUERY_LIKE = "LIKE";
|
||||||
|
|
||||||
|
/** 相等查询 */
|
||||||
|
public static final String QUERY_EQ = "EQ";
|
||||||
|
|
||||||
|
/** 需要 */
|
||||||
|
public static final String REQUIRE = "1";
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.core.common.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回状态码
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class HttpStatus {
|
||||||
|
/**
|
||||||
|
* 操作成功
|
||||||
|
*/
|
||||||
|
public static final int SUCCESS = 200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象创建成功
|
||||||
|
*/
|
||||||
|
public static final int CREATED = 201;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求已经被接受
|
||||||
|
*/
|
||||||
|
public static final int ACCEPTED = 202;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作已经执行成功,但是没有返回数据
|
||||||
|
*/
|
||||||
|
public static final int NO_CONTENT = 204;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源已被移除
|
||||||
|
*/
|
||||||
|
public static final int MOVED_PERM = 301;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重定向
|
||||||
|
*/
|
||||||
|
public static final int SEE_OTHER = 303;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源没有被修改
|
||||||
|
*/
|
||||||
|
public static final int NOT_MODIFIED = 304;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数列表错误(缺少,格式不匹配)
|
||||||
|
*/
|
||||||
|
public static final int BAD_REQUEST = 400;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未授权
|
||||||
|
*/
|
||||||
|
public static final int UNAUTHORIZED = 401;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问受限,授权过期
|
||||||
|
*/
|
||||||
|
public static final int FORBIDDEN = 403;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源,服务未找到
|
||||||
|
*/
|
||||||
|
public static final int NOT_FOUND = 404;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许的http方法
|
||||||
|
*/
|
||||||
|
public static final int BAD_METHOD = 405;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源冲突,或者资源被锁
|
||||||
|
*/
|
||||||
|
public static final int CONFLICT = 409;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不支持的数据,媒体类型
|
||||||
|
*/
|
||||||
|
public static final int UNSUPPORTED_TYPE = 415;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统内部错误
|
||||||
|
*/
|
||||||
|
public static final int ERROR = 500;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口未实现
|
||||||
|
*/
|
||||||
|
public static final int NOT_IMPLEMENTED = 501;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统警告消息
|
||||||
|
*/
|
||||||
|
public static final int WARN = 601;
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.core.common.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务调度通用常量
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class ScheduleConstants {
|
||||||
|
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
|
||||||
|
|
||||||
|
/** 执行目标key */
|
||||||
|
public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
|
||||||
|
|
||||||
|
/** 默认 */
|
||||||
|
public static final String MISFIRE_DEFAULT = "0";
|
||||||
|
|
||||||
|
/** 立即触发执行 */
|
||||||
|
public static final String MISFIRE_IGNORE_MISFIRES = "1";
|
||||||
|
|
||||||
|
/** 触发一次执行 */
|
||||||
|
public static final String MISFIRE_FIRE_AND_PROCEED = "2";
|
||||||
|
|
||||||
|
/** 不触发立即执行 */
|
||||||
|
public static final String MISFIRE_DO_NOTHING = "3";
|
||||||
|
|
||||||
|
public enum Status {
|
||||||
|
/**
|
||||||
|
* 正常
|
||||||
|
*/
|
||||||
|
NORMAL("0"),
|
||||||
|
/**
|
||||||
|
* 暂停
|
||||||
|
*/
|
||||||
|
PAUSE("1");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
private Status(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.core.common.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户常量信息
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class UserConstants {
|
||||||
|
/**
|
||||||
|
* 平台内系统用户的唯一标志
|
||||||
|
*/
|
||||||
|
public static final String SYS_USER = "SYS_USER";
|
||||||
|
|
||||||
|
/** 正常状态 */
|
||||||
|
public static final String NORMAL = "0";
|
||||||
|
|
||||||
|
/** 异常状态 */
|
||||||
|
public static final String EXCEPTION = "1";
|
||||||
|
|
||||||
|
/** 用户封禁状态 */
|
||||||
|
public static final String USER_DISABLE = "1";
|
||||||
|
|
||||||
|
/** 角色正常状态 */
|
||||||
|
public static final String ROLE_NORMAL = "0";
|
||||||
|
|
||||||
|
/** 角色封禁状态 */
|
||||||
|
public static final String ROLE_DISABLE = "1";
|
||||||
|
|
||||||
|
/** 部门正常状态 */
|
||||||
|
public static final String DEPT_NORMAL = "0";
|
||||||
|
|
||||||
|
/** 部门停用状态 */
|
||||||
|
public static final String DEPT_DISABLE = "1";
|
||||||
|
|
||||||
|
/** 字典正常状态 */
|
||||||
|
public static final String DICT_NORMAL = "0";
|
||||||
|
|
||||||
|
/** 是否为系统默认(是) */
|
||||||
|
public static final String YES = "Y";
|
||||||
|
|
||||||
|
/** 是否菜单外链(是) */
|
||||||
|
public static final String YES_FRAME = "0";
|
||||||
|
|
||||||
|
/** 是否菜单外链(否) */
|
||||||
|
public static final String NO_FRAME = "1";
|
||||||
|
|
||||||
|
/** 菜单类型(目录) */
|
||||||
|
public static final String TYPE_DIR = "M";
|
||||||
|
|
||||||
|
/** 菜单类型(菜单) */
|
||||||
|
public static final String TYPE_MENU = "C";
|
||||||
|
|
||||||
|
/** 菜单类型(按钮) */
|
||||||
|
public static final String TYPE_BUTTON = "F";
|
||||||
|
|
||||||
|
/** Layout组件标识 */
|
||||||
|
public final static String LAYOUT = "Layout";
|
||||||
|
|
||||||
|
/** ParentView组件标识 */
|
||||||
|
public final static String PARENT_VIEW = "ParentView";
|
||||||
|
|
||||||
|
/** InnerLink组件标识 */
|
||||||
|
public final static String INNER_LINK = "InnerLink";
|
||||||
|
|
||||||
|
/** 校验是否唯一的返回标识 */
|
||||||
|
public final static boolean UNIQUE = true;
|
||||||
|
public final static boolean NOT_UNIQUE = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名长度限制
|
||||||
|
*/
|
||||||
|
public static final int USERNAME_MIN_LENGTH = 2;
|
||||||
|
public static final int USERNAME_MAX_LENGTH = 20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码长度限制
|
||||||
|
*/
|
||||||
|
public static final int PASSWORD_MIN_LENGTH = 5;
|
||||||
|
public static final int PASSWORD_MAX_LENGTH = 20;
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
package com.core.common.core.controller;
|
||||||
|
|
||||||
|
import java.beans.PropertyEditorSupport;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.web.bind.WebDataBinder;
|
||||||
|
import org.springframework.web.bind.annotation.InitBinder;
|
||||||
|
|
||||||
|
import com.core.common.constant.HttpStatus;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.domain.model.LoginUser;
|
||||||
|
import com.core.common.core.page.PageDomain;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.core.common.core.page.TableSupport;
|
||||||
|
import com.core.common.utils.DateUtils;
|
||||||
|
import com.core.common.utils.PageUtils;
|
||||||
|
import com.core.common.utils.SecurityUtils;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
import com.core.common.utils.sql.SqlUtil;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web层通用数据处理
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class BaseController {
|
||||||
|
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
||||||
|
*/
|
||||||
|
@InitBinder
|
||||||
|
public void initBinder(WebDataBinder binder) {
|
||||||
|
// Date 类型转换
|
||||||
|
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
|
||||||
|
@Override
|
||||||
|
public void setAsText(String text) {
|
||||||
|
setValue(DateUtils.parseDate(text));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置请求分页数据
|
||||||
|
*/
|
||||||
|
protected void startPage() {
|
||||||
|
PageUtils.startPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置请求排序数据
|
||||||
|
*/
|
||||||
|
protected void startOrderBy() {
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) {
|
||||||
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
|
PageHelper.orderBy(orderBy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清理分页的线程变量
|
||||||
|
*/
|
||||||
|
protected void clearPage() {
|
||||||
|
PageUtils.clearPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应请求分页数据
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
protected TableDataInfo getDataTable(List<?> list) {
|
||||||
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
|
rspData.setCode(HttpStatus.SUCCESS);
|
||||||
|
rspData.setMsg("查询成功");
|
||||||
|
rspData.setRows(list);
|
||||||
|
rspData.setTotal(new PageInfo(list).getTotal());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功
|
||||||
|
*/
|
||||||
|
public AjaxResult success() {
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回失败消息
|
||||||
|
*/
|
||||||
|
public AjaxResult error() {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*/
|
||||||
|
public AjaxResult success(String message) {
|
||||||
|
return AjaxResult.success(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*/
|
||||||
|
public AjaxResult success(Object data) {
|
||||||
|
return AjaxResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回失败消息
|
||||||
|
*/
|
||||||
|
public AjaxResult error(String message) {
|
||||||
|
return AjaxResult.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回警告消息
|
||||||
|
*/
|
||||||
|
public AjaxResult warn(String message) {
|
||||||
|
return AjaxResult.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应返回结果
|
||||||
|
*
|
||||||
|
* @param rows 影响行数
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
protected AjaxResult toAjax(int rows) {
|
||||||
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应返回结果
|
||||||
|
*
|
||||||
|
* @param result 结果
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
protected AjaxResult toAjax(boolean result) {
|
||||||
|
return result ? success() : error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面跳转
|
||||||
|
*/
|
||||||
|
public String redirect(String url) {
|
||||||
|
return StringUtils.format("redirect:{}", url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户缓存信息
|
||||||
|
*/
|
||||||
|
public LoginUser getLoginUser() {
|
||||||
|
return SecurityUtils.getLoginUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录用户id
|
||||||
|
*/
|
||||||
|
public Long getUserId() {
|
||||||
|
return getLoginUser().getUserId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录部门id
|
||||||
|
*/
|
||||||
|
public Long getDeptId() {
|
||||||
|
return getLoginUser().getDeptId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录用户名
|
||||||
|
*/
|
||||||
|
public String getUsername() {
|
||||||
|
return getLoginUser().getUsername();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
package com.core.common.core.domain;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.core.common.constant.HttpStatus;
|
||||||
|
import com.core.common.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作消息提醒
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class AjaxResult extends HashMap<String, Object> {
|
||||||
|
/** 状态码 */
|
||||||
|
public static final String CODE_TAG = "code";
|
||||||
|
/** 返回内容 */
|
||||||
|
public static final String MSG_TAG = "msg";
|
||||||
|
/** 数据对象 */
|
||||||
|
public static final String DATA_TAG = "data";
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
|
||||||
|
*/
|
||||||
|
public AjaxResult() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化一个新创建的 AjaxResult 对象
|
||||||
|
*
|
||||||
|
* @param code 状态码
|
||||||
|
* @param msg 返回内容
|
||||||
|
*/
|
||||||
|
public AjaxResult(int code, String msg) {
|
||||||
|
super.put(CODE_TAG, code);
|
||||||
|
super.put(MSG_TAG, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化一个新创建的 AjaxResult 对象
|
||||||
|
*
|
||||||
|
* @param code 状态码
|
||||||
|
* @param msg 返回内容
|
||||||
|
* @param data 数据对象
|
||||||
|
*/
|
||||||
|
public AjaxResult(int code, String msg, Object data) {
|
||||||
|
super.put(CODE_TAG, code);
|
||||||
|
super.put(MSG_TAG, msg);
|
||||||
|
if (StringUtils.isNotNull(data)) {
|
||||||
|
super.put(DATA_TAG, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*
|
||||||
|
* @return 成功消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult success() {
|
||||||
|
return AjaxResult.success("操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功数据
|
||||||
|
*
|
||||||
|
* @return 成功消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult success(Object data) {
|
||||||
|
return AjaxResult.success("操作成功", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*
|
||||||
|
* @param msg 返回内容
|
||||||
|
* @return 成功消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult success(String msg) {
|
||||||
|
return AjaxResult.success(msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*
|
||||||
|
* @param msg 返回内容
|
||||||
|
* @param data 数据对象
|
||||||
|
* @return 成功消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult success(String msg, Object data) {
|
||||||
|
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回警告消息
|
||||||
|
*
|
||||||
|
* @param msg 返回内容
|
||||||
|
* @return 警告消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult warn(String msg) {
|
||||||
|
return AjaxResult.warn(msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回警告消息
|
||||||
|
*
|
||||||
|
* @param msg 返回内容
|
||||||
|
* @param data 数据对象
|
||||||
|
* @return 警告消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult warn(String msg, Object data) {
|
||||||
|
return new AjaxResult(HttpStatus.WARN, msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回错误消息
|
||||||
|
*
|
||||||
|
* @return 错误消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult error() {
|
||||||
|
return AjaxResult.error("操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回错误消息
|
||||||
|
*
|
||||||
|
* @param msg 返回内容
|
||||||
|
* @return 错误消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult error(String msg) {
|
||||||
|
return AjaxResult.error(msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回错误消息
|
||||||
|
*
|
||||||
|
* @param msg 返回内容
|
||||||
|
* @param data 数据对象
|
||||||
|
* @return 错误消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult error(String msg, Object data) {
|
||||||
|
return new AjaxResult(HttpStatus.ERROR, msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回错误消息
|
||||||
|
*
|
||||||
|
* @param code 状态码
|
||||||
|
* @param msg 返回内容
|
||||||
|
* @return 错误消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult error(int code, String msg) {
|
||||||
|
return new AjaxResult(code, msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为成功消息
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为警告消息
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public boolean isWarn() {
|
||||||
|
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为错误消息
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public boolean isError() {
|
||||||
|
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方便链式调用
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param value 值
|
||||||
|
* @return 数据对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult put(String key, Object value) {
|
||||||
|
super.put(key, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package com.core.common.core.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity基类
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class BaseEntity implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 搜索值 */
|
||||||
|
@JsonIgnore
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String searchValue;
|
||||||
|
|
||||||
|
/** 创建者 */
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/** 更新者 */
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/** 请求参数 */
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Map<String, Object> params;
|
||||||
|
|
||||||
|
public String getSearchValue() {
|
||||||
|
return searchValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearchValue(String searchValue) {
|
||||||
|
this.searchValue = searchValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreateBy() {
|
||||||
|
return createBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateBy(String createBy) {
|
||||||
|
this.createBy = createBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUpdateBy() {
|
||||||
|
return updateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateBy(String updateBy) {
|
||||||
|
this.updateBy = updateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getParams() {
|
||||||
|
if (params == null) {
|
||||||
|
params = new HashMap<>();
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParams(Map<String, Object> params) {
|
||||||
|
this.params = params;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.core.common.core.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity基类
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class HisBaseEntity implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 创建者 */
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/** 更新者 */
|
||||||
|
@TableField(fill = FieldFill.UPDATE)
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@TableField(fill = FieldFill.UPDATE)
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/** 租户ID */
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Integer tenantId;
|
||||||
|
|
||||||
|
/** 删除标识 */
|
||||||
|
@TableLogic(value = "0", delval = "1") // 0 为未删除,1 为删除
|
||||||
|
private String deleteFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
package com.core.common.core.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.core.common.constant.HttpStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应信息主体
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class R<T> implements Serializable {
|
||||||
|
/** 成功 */
|
||||||
|
public static final int SUCCESS = HttpStatus.SUCCESS;
|
||||||
|
/** 失败 */
|
||||||
|
public static final int FAIL = HttpStatus.ERROR;
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private int code;
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public static <T> R<T> ok() {
|
||||||
|
return restResult(null, SUCCESS, "操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> ok(T data) {
|
||||||
|
return restResult(data, SUCCESS, "操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> ok(T data, String msg) {
|
||||||
|
return restResult(data, SUCCESS, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> fail() {
|
||||||
|
return restResult(null, FAIL, "操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> fail(String msg) {
|
||||||
|
return restResult(null, FAIL, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> fail(T data) {
|
||||||
|
return restResult(data, FAIL, "操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> fail(T data, String msg) {
|
||||||
|
return restResult(data, FAIL, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> fail(int code, String msg) {
|
||||||
|
return restResult(null, code, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> R<T> restResult(T data, int code, String msg) {
|
||||||
|
R<T> apiResult = new R<>();
|
||||||
|
apiResult.setCode(code);
|
||||||
|
apiResult.setData(data);
|
||||||
|
apiResult.setMsg(msg);
|
||||||
|
return apiResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Boolean isError(R<T> ret) {
|
||||||
|
return !isSuccess(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Boolean isSuccess(R<T> ret) {
|
||||||
|
return R.SUCCESS == ret.getCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(T data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.core.common.core.domain;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tree基类
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class TreeEntity extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 父菜单名称 */
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
|
/** 父菜单ID */
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/** 显示顺序 */
|
||||||
|
private Integer orderNum;
|
||||||
|
|
||||||
|
/** 祖级列表 */
|
||||||
|
private String ancestors;
|
||||||
|
|
||||||
|
/** 子部门 */
|
||||||
|
private List<?> children = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getParentName() {
|
||||||
|
return parentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentName(String parentName) {
|
||||||
|
this.parentName = parentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(Long parentId) {
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrderNum() {
|
||||||
|
return orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderNum(Integer orderNum) {
|
||||||
|
this.orderNum = orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAncestors() {
|
||||||
|
return ancestors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAncestors(String ancestors) {
|
||||||
|
this.ancestors = ancestors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<?> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<?> children) {
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.core.common.core.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.core.common.core.domain.entity.SysDept;
|
||||||
|
import com.core.common.core.domain.entity.SysMenu;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Treeselect树结构实体类
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class TreeSelect implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 节点ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 节点名称 */
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/** 子节点 */
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
private List<TreeSelect> children;
|
||||||
|
|
||||||
|
public TreeSelect() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeSelect(SysDept dept) {
|
||||||
|
this.id = dept.getDeptId();
|
||||||
|
this.label = dept.getDeptName();
|
||||||
|
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeSelect(SysMenu menu) {
|
||||||
|
this.id = menu.getMenuId();
|
||||||
|
this.label = menu.getMenuName();
|
||||||
|
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TreeSelect> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<TreeSelect> children) {
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
package com.core.common.core.domain.entity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Email;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import com.core.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门表 sys_dept
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class SysDept extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/** 父部门ID */
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/** 祖级列表 */
|
||||||
|
private String ancestors;
|
||||||
|
|
||||||
|
/** 部门名称 */
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/** 显示顺序 */
|
||||||
|
private Integer orderNum;
|
||||||
|
|
||||||
|
/** 负责人 */
|
||||||
|
private String leader;
|
||||||
|
|
||||||
|
/** 联系电话 */
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/** 邮箱 */
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/** 部门状态:0正常,1停用 */
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
/** 父部门名称 */
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
|
/** 子部门 */
|
||||||
|
private List<SysDept> children = new ArrayList<SysDept>();
|
||||||
|
|
||||||
|
public Long getDeptId() {
|
||||||
|
return deptId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptId(Long deptId) {
|
||||||
|
this.deptId = deptId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(Long parentId) {
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAncestors() {
|
||||||
|
return ancestors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAncestors(String ancestors) {
|
||||||
|
this.ancestors = ancestors;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotBlank(message = "部门名称不能为空")
|
||||||
|
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
||||||
|
public String getDeptName() {
|
||||||
|
return deptName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptName(String deptName) {
|
||||||
|
this.deptName = deptName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull(message = "显示顺序不能为空")
|
||||||
|
public Integer getOrderNum() {
|
||||||
|
return orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderNum(Integer orderNum) {
|
||||||
|
this.orderNum = orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLeader() {
|
||||||
|
return leader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLeader(String leader) {
|
||||||
|
this.leader = leader;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Email(message = "邮箱格式不正确")
|
||||||
|
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDelFlag() {
|
||||||
|
return delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDelFlag(String delFlag) {
|
||||||
|
this.delFlag = delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentName() {
|
||||||
|
return parentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentName(String parentName) {
|
||||||
|
this.parentName = parentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SysDept> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<SysDept> children) {
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("deptId", getDeptId())
|
||||||
|
.append("parentId", getParentId()).append("ancestors", getAncestors()).append("deptName", getDeptName())
|
||||||
|
.append("orderNum", getOrderNum()).append("leader", getLeader()).append("phone", getPhone())
|
||||||
|
.append("email", getEmail()).append("status", getStatus()).append("delFlag", getDelFlag())
|
||||||
|
.append("createBy", getCreateBy()).append("createTime", getCreateTime()).append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime()).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package com.core.common.core.domain.entity;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import com.core.common.annotation.Excel;
|
||||||
|
import com.core.common.annotation.Excel.ColumnType;
|
||||||
|
import com.core.common.constant.UserConstants;
|
||||||
|
import com.core.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典数据表 sys_dict_data
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
*/
|
||||||
|
public class SysDictData extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 字典编码 */
|
||||||
|
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
|
||||||
|
private Long dictCode;
|
||||||
|
|
||||||
|
/** 字典排序 */
|
||||||
|
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
|
||||||
|
private Long dictSort;
|
||||||
|
|
||||||
|
/** 字典标签 */
|
||||||
|
@Excel(name = "字典标签")
|
||||||
|
private String dictLabel;
|
||||||
|
|
||||||
|
/** 字典键值 */
|
||||||
|
@Excel(name = "字典键值")
|
||||||
|
private String dictValue;
|
||||||
|
|
||||||
|
/** 字典类型 */
|
||||||
|
@Excel(name = "字典类型")
|
||||||
|
private String dictType;
|
||||||
|
|
||||||
|
/** 样式属性(其他样式扩展) */
|
||||||
|
private String cssClass;
|
||||||
|
|
||||||
|
/** 表格字典样式 */
|
||||||
|
private String listClass;
|
||||||
|
|
||||||
|
/** 是否默认(Y是 N否) */
|
||||||
|
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
|
||||||
|
private String isDefault;
|
||||||
|
|
||||||
|
/** 状态(0正常 1停用) */
|
||||||
|
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
public Long getDictCode() {
|
||||||
|
return dictCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictCode(Long dictCode) {
|
||||||
|
this.dictCode = dictCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDictSort() {
|
||||||
|
return dictSort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictSort(Long dictSort) {
|
||||||
|
this.dictSort = dictSort;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotBlank(message = "字典标签不能为空")
|
||||||
|
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
|
||||||
|
public String getDictLabel() {
|
||||||
|
return dictLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictLabel(String dictLabel) {
|
||||||
|
this.dictLabel = dictLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotBlank(message = "字典键值不能为空")
|
||||||
|
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
|
||||||
|
public String getDictValue() {
|
||||||
|
return dictValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictValue(String dictValue) {
|
||||||
|
this.dictValue = dictValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotBlank(message = "字典类型不能为空")
|
||||||
|
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
|
||||||
|
public String getDictType() {
|
||||||
|
return dictType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictType(String dictType) {
|
||||||
|
this.dictType = dictType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
|
||||||
|
public String getCssClass() {
|
||||||
|
return cssClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCssClass(String cssClass) {
|
||||||
|
this.cssClass = cssClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getListClass() {
|
||||||
|
return listClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListClass(String listClass) {
|
||||||
|
this.listClass = listClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getDefault() {
|
||||||
|
return UserConstants.YES.equals(this.isDefault);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsDefault() {
|
||||||
|
return isDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDefault(String isDefault) {
|
||||||
|
this.isDefault = isDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("dictCode", getDictCode())
|
||||||
|
.append("dictSort", getDictSort()).append("dictLabel", getDictLabel()).append("dictValue", getDictValue())
|
||||||
|
.append("dictType", getDictType()).append("cssClass", getCssClass()).append("listClass", getListClass())
|
||||||
|
.append("isDefault", getIsDefault()).append("status", getStatus()).append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime()).append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime()).append("remark", getRemark()).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user