| | |
| | | # Compiled class file |
| | | *.class |
| | | |
| | | # Log file |
| | | *.log |
| | | |
| | | # BlueJ files |
| | | *.ctxt |
| | | |
| | | # Mobile Tools for Java (J2ME) |
| | | .mtj.tmp/ |
| | |
| | | # Package Files # |
| | | *.jar |
| | | *.war |
| | | *.nar |
| | | *.ear |
| | | *.zip |
| | | *.tar.gz |
| | | *.rar |
| | | |
| | | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml |
| | | hs_err_pid* |
| | | .idea/* |
| | | *.iml |
| | | */target/* |
| | | */*.iml |
| | | /.gradle/ |
| | | /application.pid |
| | | *.yml |
| | | */*.yml |
| | | *.prefs |
| | | .project |
| | | *.classpath |
| | | *.gitignore |
| | | *.pid |
New file |
| | |
| | | GNU AFFERO GENERAL PUBLIC LICENSE |
| | | Version 3, 19 November 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 Affero General Public License is a free, copyleft license for |
| | | software and other kinds of works, specifically designed to ensure |
| | | cooperation with the community in the case of network server software. |
| | | |
| | | The licenses for most software and other practical works are designed |
| | | to take away your freedom to share and change the works. By contrast, |
| | | our General Public Licenses are 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. |
| | | |
| | | 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. |
| | | |
| | | Developers that use our General Public Licenses protect your rights |
| | | with two steps: (1) assert copyright on the software, and (2) offer |
| | | you this License which gives you legal permission to copy, distribute |
| | | and/or modify the software. |
| | | |
| | | A secondary benefit of defending all users' freedom is that |
| | | improvements made in alternate versions of the program, if they |
| | | receive widespread use, become available for other developers to |
| | | incorporate. Many developers of free software are heartened and |
| | | encouraged by the resulting cooperation. However, in the case of |
| | | software used on network servers, this result may fail to come about. |
| | | The GNU General Public License permits making a modified version and |
| | | letting the public access it on a server without ever releasing its |
| | | source code to the public. |
| | | |
| | | The GNU Affero General Public License is designed specifically to |
| | | ensure that, in such cases, the modified source code becomes available |
| | | to the community. It requires the operator of a network server to |
| | | provide the source code of the modified version running there to the |
| | | users of that server. Therefore, public use of a modified version, on |
| | | a publicly accessible server, gives the public access to the source |
| | | code of the modified version. |
| | | |
| | | An older license, called the Affero General Public License and |
| | | published by Affero, was designed to accomplish similar goals. This is |
| | | a different license, not a version of the Affero GPL, but Affero has |
| | | released a new version of the Affero GPL which permits relicensing under |
| | | this license. |
| | | |
| | | 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 Affero 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. Remote Network Interaction; Use with the GNU General Public License. |
| | | |
| | | Notwithstanding any other provision of this License, if you modify the |
| | | Program, your modified version must prominently offer all users |
| | | interacting with it remotely through a computer network (if your version |
| | | supports such interaction) an opportunity to receive the Corresponding |
| | | Source of your version by providing access to the Corresponding Source |
| | | from a network server at no charge, through some standard or customary |
| | | means of facilitating copying of software. This Corresponding Source |
| | | shall include the Corresponding Source for any work covered by version 3 |
| | | of the GNU General Public License that is incorporated pursuant to the |
| | | following paragraph. |
| | | |
| | | 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 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 work with which it is combined will remain governed by version |
| | | 3 of the GNU General Public License. |
| | | |
| | | 14. Revised Versions of this License. |
| | | |
| | | The Free Software Foundation may publish revised and/or new versions of |
| | | the GNU Affero 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 Affero 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 Affero 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 Affero General Public License can be used, that proxy's |
| | | public statement of acceptance of a version permanently authorizes you |
| | | to choose that version for the Program. |
| | | |
| | | Later license versions may give you additional or different |
| | | permissions. However, no additional obligations are imposed on any |
| | | author or copyright holder as a result of your choosing to follow a |
| | | later version. |
| | | |
| | | 15. Disclaimer of Warranty. |
| | | |
| | | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
| | | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
| | | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
| | | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
| | | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| | | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
| | | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
| | | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
| | | |
| | | 16. Limitation of Liability. |
| | | |
| | | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
| | | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
| | | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
| | | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
| | | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
| | | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
| | | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
| | | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
| | | SUCH DAMAGES. |
| | | |
| | | 17. Interpretation of Sections 15 and 16. |
| | | |
| | | If the disclaimer of warranty and limitation of liability provided |
| | | above cannot be given local legal effect according to their terms, |
| | | reviewing courts shall apply local law that most closely approximates |
| | | an absolute waiver of all civil liability in connection with the |
| | | Program, unless a warranty or assumption of liability accompanies a |
| | | copy of the Program in return for a fee. |
| | | |
| | | END OF TERMS AND CONDITIONS |
| | | |
| | | How to Apply These Terms to Your New Programs |
| | | |
| | | If you develop a new program, and you want it to be of the greatest |
| | | possible use to the public, the best way to achieve this is to make it |
| | | free software which everyone can redistribute and change under these terms. |
| | | |
| | | To do so, attach the following notices to the program. It is safest |
| | | to attach them to the start of each source file to most effectively |
| | | state the exclusion of warranty; and each file should have at least |
| | | the "copyright" line and a pointer to where the full notice is found. |
| | | |
| | | <one line to give the program's name and a brief idea of what it does.> |
| | | Copyright (C) <year> <name of author> |
| | | |
| | | This program is free software: you can redistribute it and/or modify |
| | | it under the terms of the GNU Affero 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 Affero General Public License for more details. |
| | | |
| | | You should have received a copy of the GNU Affero 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 your software can interact with users remotely through a computer |
| | | network, you should also make sure that it provides a way for users to |
| | | get its source. For example, if your program is a web application, its |
| | | interface could display a "Source" link that leads users to an archive |
| | | of the code. There are many ways you could offer source, and different |
| | | solutions will be better for different programs; see section 13 for the |
| | | specific requirements. |
| | | |
| | | 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 AGPL, see |
| | | <https://www.gnu.org/licenses/>. |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <groupId>com.zzg</groupId> |
| | | <artifactId>congzhLand</artifactId> |
| | | <version>3.8.7</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
| | | <artifactId>land-admin</artifactId> |
| | | |
| | | <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> |
| | | <version>1.6.2</version> |
| | | </dependency> |
| | | |
| | | <!-- Mysql驱动包 --> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>mysql</groupId>--> |
| | | <!-- <artifactId>mysql-connector-java</artifactId>--> |
| | | <!-- </dependency>--> |
| | | <dependency> |
| | | <groupId>org.postgresql</groupId> |
| | | <artifactId>postgresql</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.highgo</groupId> |
| | | <artifactId>HgdbJdbc</artifactId> |
| | | <version>6.2.4</version> |
| | | </dependency> |
| | | |
| | | <!-- 核心模块--> |
| | | <dependency> |
| | | <groupId>com.zzg</groupId> |
| | | <artifactId>land-framework</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.mapstruct</groupId> |
| | | <artifactId>mapstruct</artifactId> |
| | | <version>1.5.2.Final</version> |
| | | </dependency> |
| | | |
| | | <!--mapstruct编译--> |
| | | <dependency> |
| | | <groupId>org.mapstruct</groupId> |
| | | <artifactId>mapstruct-processor</artifactId> |
| | | <version>1.5.2.Final</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok-mapstruct-binding</artifactId> |
| | | <version>0.2.0</version> |
| | | </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> |
| | | <version>3.8.0</version> |
| | | <configuration> |
| | | <source>1.8</source> |
| | | <target>1.8</target> |
| | | <annotationProcessorPaths> |
| | | <path> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.18.24</version> |
| | | </path> |
| | | <path> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok-mapstruct-binding</artifactId> |
| | | <version>0.2.0</version> |
| | | </path> |
| | | <path> |
| | | <groupId>org.mapstruct</groupId> |
| | | <artifactId>mapstruct-processor</artifactId> |
| | | <version>1.5.2.Final</version> |
| | | </path> |
| | | </annotationProcessorPaths> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | <finalName>${project.artifactId}</finalName> |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.zzg; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | import org.springframework.cache.annotation.EnableCaching; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.oas.annotations.EnableOpenApi; |
| | | |
| | | /** |
| | | * 启动程序 |
| | | * |
| | | * @author |
| | | */ |
| | | @Slf4j |
| | | @EnableOpenApi |
| | | @EnableCaching |
| | | @EnableScheduling |
| | | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) |
| | | public class CongzhApplication { |
| | | public static void main(String[] args) { |
| | | // System.setProperty("spring.devtools.restart.enabled", "false"); |
| | | SpringApplication.run(CongzhApplication.class, args); |
| | | // log.info("----崇州征地系统启动成功----"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg; |
| | | |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | |
| | | /** |
| | | * web容器中进行部署 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CongzhServletInitializer extends SpringBootServletInitializer { |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
| | | return application.sources(CongzhApplication.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.common; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.system.domain.AttachFile; |
| | | import com.zzg.system.service.system.IAttachFileService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | |
| | | @RestController |
| | | @Api(tags = "附件管理") |
| | | @RequestMapping("/attachFile") |
| | | public class AttachFileController { |
| | | |
| | | @Resource |
| | | IAttachFileService attachFileService; |
| | | |
| | | /** |
| | | * @param id 外键id |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | @ApiOperation("根据外键查询") |
| | | public AjaxResult getBy(@PathVariable String id) { |
| | | List<AttachFile> list = attachFileService.list(new LambdaQueryWrapper<AttachFile>() |
| | | .eq(AttachFile::getInventoryId, id)); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.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.google.code.kaptcha.Producer; |
| | | import com.zzg.common.config.RuoYiConfig; |
| | | import com.zzg.common.constant.CacheConstants; |
| | | import com.zzg.common.constant.Constants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.redis.RedisCache; |
| | | import com.zzg.common.utils.sign.Base64; |
| | | import com.zzg.common.utils.uuid.IdUtils; |
| | | import com.zzg.system.service.system.ISysConfigService; |
| | | |
| | | /** |
| | | * 验证码操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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 = RuoYiConfig.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; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.common; |
| | | |
| | | import com.alibaba.excel.EasyExcelFactory; |
| | | import com.alibaba.excel.write.builder.ExcelWriterBuilder; |
| | | import com.zzg.common.config.RuoYiConfig; |
| | | import com.zzg.common.constant.Constants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.enums.HouseProductionTypeEnum; |
| | | import com.zzg.common.enums.HouseUsingTypeEnum; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.common.utils.Threads; |
| | | import com.zzg.common.utils.file.FileUploadUtils; |
| | | import com.zzg.common.utils.file.FileUtils; |
| | | import com.zzg.framework.config.ServerConfig; |
| | | import com.zzg.system.convert.easyExcel.MultiDropdownWriteHandler; |
| | | import com.zzg.system.domain.SysCity; |
| | | import com.zzg.system.service.system.ISysCityService; |
| | | import com.zzg.web.core.enums.TemplateFileTypeEnum; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.lang.reflect.Method; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 通用请求处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/common") |
| | | public class CommonController { |
| | | private static final Logger log = LoggerFactory.getLogger(CommonController.class); |
| | | |
| | | @Autowired |
| | | private ServerConfig serverConfig; |
| | | @Autowired |
| | | private ISysCityService sysCityService; |
| | | @Value("${server.config}") |
| | | String myServerConfig; |
| | | |
| | | private static final String FILE_DELIMETER = ","; |
| | | |
| | | /** |
| | | * 通用下载请求 |
| | | * |
| | | * @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 = RuoYiConfig.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); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("/download/template") |
| | | public void fileDownload(@RequestParam Integer fileType, HttpServletResponse response) { |
| | | try { |
| | | TemplateFileTypeEnum pathByFileType = TemplateFileTypeEnum.getEnumByFileType(fileType); |
| | | Method generateExampleDataMethod = pathByFileType.getClazz().getMethod("generateExampleData"); |
| | | |
| | | Object exampleData = generateExampleDataMethod.invoke(null); |
| | | |
| | | Object headerData; |
| | | if (fileType.equals(TemplateFileTypeEnum.FILE_2.getFileType())) { |
| | | headerData = generateHeaderData(); |
| | | } else { |
| | | Method generateHeaderDataMethod = pathByFileType.getClazz().getMethod("generateHeaderData"); |
| | | headerData = generateHeaderDataMethod.invoke(null); |
| | | } |
| | | |
| | | FileUtils.setExcelResponseHeader(response, pathByFileType.getFileName()); |
| | | ExcelWriterBuilder write = EasyExcelFactory.write(response.getOutputStream(), pathByFileType.getClazz()); |
| | | if (Objects.nonNull(headerData)) { |
| | | write.registerWriteHandler((MultiDropdownWriteHandler) headerData); |
| | | } |
| | | write.sheet("sheet") |
| | | .doWrite(Collections.singletonList(exampleData)); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | Threads.sleep(1000); |
| | | } catch (Exception e) { |
| | | log.error("下载文件失败", e); |
| | | } |
| | | } |
| | | |
| | | public MultiDropdownWriteHandler generateHeaderData() { |
| | | Map<Integer, String[]> dropdownOptionsMap = new HashMap<>(); |
| | | dropdownOptionsMap.put(0, Arrays.stream(HouseUsingTypeEnum.values()) |
| | | .map(HouseUsingTypeEnum::getText) |
| | | .toArray(String[]::new)); |
| | | dropdownOptionsMap.put(10, Arrays.stream(HouseProductionTypeEnum.values()) |
| | | .map(HouseProductionTypeEnum::getText) |
| | | .toArray(String[]::new)); |
| | | List<SysCity> towns = sysCityService.getTowns(); |
| | | dropdownOptionsMap.put(12, towns.stream().map(SysCity::getName).toArray(String[]::new)); |
| | | return new MultiDropdownWriteHandler(dropdownOptionsMap); |
| | | } |
| | | |
| | | /** |
| | | * 通用上传请求(单个) |
| | | */ |
| | | @PostMapping("/upload") |
| | | public AjaxResult uploadFile(MultipartFile file) throws Exception { |
| | | try { |
| | | // 上传文件路径 |
| | | String filePath = RuoYiConfig.getUploadPath(); |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = myServerConfig + 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 = RuoYiConfig.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(file.getOriginalFilename())); |
| | | 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 (!resource.contains("profile")) { |
| | | // 提取日期部分:20240521 |
| | | String datePart = resource.substring(resource.indexOf('/') + 1, resource.indexOf('/') + 9); |
| | | String formattedDate = formatDate(datePart); |
| | | resource = "/profile/upload/" + formattedDate + resource.replace("upload", ""); |
| | | |
| | | } |
| | | if (!FileUtils.checkAllowDownload(resource)) { |
| | | throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); |
| | | } |
| | | // 本地资源路径 |
| | | String localPath = RuoYiConfig.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); |
| | | } |
| | | } |
| | | |
| | | public static String formatDate(String inputDate) { |
| | | try { |
| | | SimpleDateFormat inputFormat = new SimpleDateFormat("yyyyMMdd"); |
| | | Date date = inputFormat.parse(inputDate); |
| | | |
| | | SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy/MM/dd"); |
| | | return outputFormat.format(date); |
| | | } catch (ParseException e) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.common; |
| | | |
| | | import cn.hutool.core.lang.Dict; |
| | | import cn.hutool.core.text.StrPool; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.system.service.system.IFileService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 文件上传 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "文件上传,下载") |
| | | @RequestMapping("/file") |
| | | public class FileController { |
| | | private static final Logger log = LoggerFactory.getLogger(FileController.class); |
| | | |
| | | @Resource |
| | | private IFileService fileService; |
| | | @Value("${ruoyi.upload}") |
| | | String landexp; |
| | | |
| | | @ApiOperation(value = "文件上传", notes = "返回文件的名字,下载文件时可以通过文件的名字下载!") |
| | | @PostMapping("/public/upload") |
| | | public List<Dict> publicUpload(@RequestParam("file") MultipartFile[] file, HttpServletRequest req) { |
| | | // return fileService.upload2Temp(Arrays.asList(file), req); |
| | | List<MultipartFile> fileList = Arrays.asList(file); |
| | | if (fileList.size() > 10) { |
| | | throw new RuntimeException("一次最多上传10份文件"); |
| | | } |
| | | return fileService.upload2Temp(fileList, req); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/public/download") |
| | | @ApiOperation(value = "文件下载", notes = "单文件") |
| | | public AjaxResult download(@RequestParam String filename, HttpServletResponse response) throws IOException, InterruptedException { |
| | | File absFile = new File(landexp + filename); |
| | | if (absFile.exists()) { |
| | | //协议文件名称没有下划线,只有upload路径--pload/征地拆迁住房安置协议-许肖肖-204125.pdf |
| | | filename = filename.substring(filename.lastIndexOf(StrPool.SLASH) + 1); |
| | | //不同文件 |
| | | filename = filename.substring(filename.indexOf(StrPool.UNDERLINE) + 1); |
| | | response.setContentType("application/octet-stream;charset=utf-8"); |
| | | response.addHeader("Content-Disposition", "attachment; filename=" + |
| | | URLEncoder.encode(filename, "UTF-8")); |
| | | FileInputStream fileInputStream = new FileInputStream(absFile); |
| | | int len = 0; |
| | | byte[] buffer = new byte[1024]; |
| | | OutputStream outputStream = response.getOutputStream(); |
| | | while ((len = fileInputStream.read(buffer)) > 0) { |
| | | outputStream.write(buffer, 0, len); |
| | | } |
| | | fileInputStream.close(); |
| | | outputStream.flush(); |
| | | outputStream.close(); |
| | | return AjaxResult.success(); |
| | | } else { |
| | | log.error("下载文件地址:" + filename); |
| | | return AjaxResult.error("文件不存在!"); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.land; |
| | | |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.system.SysUser; |
| | | import com.zzg.common.core.domain.model.LoginUser; |
| | | import com.zzg.common.utils.ExcelUtils; |
| | | import com.zzg.common.utils.SecurityUtils; |
| | | import com.zzg.common.utils.uuid.IdUtils; |
| | | import com.zzg.system.domain.SysCity; |
| | | import com.zzg.system.domain.vo.City; |
| | | import com.zzg.system.service.system.ISysCityService; |
| | | import com.zzg.system.service.system.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Api(tags = "测试") |
| | | @RestController |
| | | @RequestMapping("demo") |
| | | public class DemoController { |
| | | |
| | | @Resource |
| | | ISysUserService userService; |
| | | @Resource |
| | | ISysCityService sysCityService; |
| | | |
| | | @ApiOperation("用户列表") |
| | | @GetMapping("list") |
| | | public AjaxResult getUserList() { |
| | | List<SysUser> list = userService.list(); |
| | | |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @ApiOperation("获取当前登录用户信息") |
| | | @GetMapping("getLoginUser") |
| | | public AjaxResult getLoginUser() { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | return AjaxResult.success(loginUser); |
| | | } |
| | | |
| | | @ApiOperation("初始化村组信息") |
| | | @GetMapping("/initGroups") |
| | | public AjaxResult initGroups() throws IOException { |
| | | File file = new File("D:\\Work\\崇州征地项目\\崇州村组(2).xlsx"); |
| | | FileInputStream fileInputStream = new FileInputStream(file); |
| | | |
| | | List<City> list = Optional.ofNullable(ExcelUtils.importExcel(fileInputStream, 0, 1, City.class)).orElse(new ArrayList<>()); |
| | | Map<String, List<City>> collect = list.stream().collect(Collectors.groupingBy(City::getTown)); |
| | | |
| | | List<SysCity> groupList = new ArrayList<>(); |
| | | SysCity district = new SysCity(); |
| | | district.setId("0"); |
| | | district.setPid("-1"); |
| | | district.setName("崇州市"); |
| | | district.setLevel(0); |
| | | district.setState(0); |
| | | district.setRanking(1); |
| | | groupList.add(district); |
| | | |
| | | Integer a = 1; |
| | | for (Map.Entry<String, List<City>> entry : collect.entrySet()) { |
| | | String townName = entry.getKey(); |
| | | SysCity town = new SysCity(); |
| | | town.setId(IdUtils.fastSimpleUUID()); |
| | | town.setPid("0"); |
| | | town.setName(townName); |
| | | town.setLevel(1); |
| | | town.setState(0); |
| | | town.setRanking(a); |
| | | a += 1; |
| | | groupList.add(town); |
| | | List<City> value = entry.getValue(); |
| | | Integer b = 1; |
| | | for (City c : value) { |
| | | SysCity village = new SysCity(); |
| | | village.setId(IdUtils.fastSimpleUUID()); |
| | | village.setPid(town.getId()); |
| | | village.setName(c.getVillage()); |
| | | village.setLevel(2); |
| | | village.setState(0); |
| | | village.setRanking(b); |
| | | b += 1; |
| | | groupList.add(village); |
| | | |
| | | for (int i = 1; i <= c.getNum(); i++) { |
| | | SysCity group = new SysCity(); |
| | | group.setId(IdUtils.fastSimpleUUID()); |
| | | group.setPid(village.getId()); |
| | | group.setName(i + "组"); |
| | | group.setLevel(3); |
| | | group.setState(0); |
| | | group.setRanking(i); |
| | | groupList.add(group); |
| | | } |
| | | if (c.getType().equals("社区")) { |
| | | SysCity group = new SysCity(); |
| | | group.setId(IdUtils.fastSimpleUUID()); |
| | | group.setPid(village.getId()); |
| | | group.setName("社区集体"); |
| | | group.setLevel(3); |
| | | group.setState(0); |
| | | group.setRanking(c.getNum() + 1); |
| | | groupList.add(group); |
| | | } else { |
| | | SysCity group = new SysCity(); |
| | | group.setId(IdUtils.fastSimpleUUID()); |
| | | group.setPid(village.getId()); |
| | | group.setName("村集体"); |
| | | group.setLevel(3); |
| | | group.setState(0); |
| | | group.setRanking(c.getNum() + 1); |
| | | groupList.add(group); |
| | | } |
| | | } |
| | | } |
| | | sysCityService.saveBatch(groupList); |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.monitor; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Properties; |
| | | import java.util.Set; |
| | | 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.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.zzg.common.constant.CacheConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.system.domain.SysCache; |
| | | |
| | | /** |
| | | * 缓存监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/cache") |
| | | public class CacheController |
| | | { |
| | | @Autowired |
| | | private RedisTemplate<String, String> redisTemplate; |
| | | |
| | | private final static List<SysCache> caches = new ArrayList<SysCache>(); |
| | | { |
| | | 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(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(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.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.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.framework.web.domain.Server; |
| | | |
| | | /** |
| | | * 服务器监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.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.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.poi.ExcelUtil; |
| | | import com.zzg.framework.web.service.SysPasswordService; |
| | | import com.zzg.system.domain.SysLogininfor; |
| | | import com.zzg.system.service.system.ISysLogininforService; |
| | | |
| | | /** |
| | | * 系统访问记录 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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')") |
| | | @GetMapping("/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 String[] 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(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.monitor; |
| | | |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.poi.ExcelUtil; |
| | | import com.zzg.system.domain.SysOperLog; |
| | | import com.zzg.system.service.system.ISysOperLogService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 操作日志记录 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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')") |
| | | @GetMapping("/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 String[] 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(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.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.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.constant.CacheConstants; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.model.LoginUser; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.core.redis.RedisCache; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.system.domain.SysUserOnline; |
| | | import com.zzg.system.service.system.ISysUserOnlineService; |
| | | |
| | | /** |
| | | * 在线用户监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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<>(); |
| | | 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(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.state; |
| | | |
| | | import cn.afterturn.easypoi.word.WordExportUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.zzg.common.constant.state.UrlConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.state.StateAgreement; |
| | | import com.zzg.common.core.domain.entity.state.StateHousehold; |
| | | import com.zzg.common.core.domain.entity.state.StateProject; |
| | | import com.zzg.common.enums.AgreementTypeEnum; |
| | | import com.zzg.common.enums.ProcessCategoryEnum; |
| | | import com.zzg.common.enums.SubmitStatusEnum; |
| | | import com.zzg.common.exception.GlobalException; |
| | | import com.zzg.common.utils.file.FileUtils; |
| | | import com.zzg.system.domain.bo.*; |
| | | import com.zzg.system.domain.vo.AgreementDetailVO; |
| | | import com.zzg.system.domain.vo.StateAgreementVO; |
| | | import com.zzg.system.service.state.StateAgreementService; |
| | | import com.zzg.system.service.state.StateHouseholdService; |
| | | import com.zzg.system.service.state.StateProcessTemplateService; |
| | | import com.zzg.system.service.state.StateProjectService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.poi.xwpf.usermodel.XWPFDocument; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateAgreementController { |
| | | |
| | | private final StateAgreementService stateAgreementService; |
| | | private final StateHouseholdService stateHouseholdService; |
| | | private final StateProcessTemplateService stateProcessTemplateService; |
| | | private final StateProjectService stateProjectService; |
| | | |
| | | @PostMapping(UrlConstants.STATE_AGREEMENT_SAVE) |
| | | public AjaxResult<Boolean> createAgreement(@RequestBody StateAgreementSaveBO saveBO) { |
| | | |
| | | //根据协议类型和房产id进行排重 每个协议只能存在一份 |
| | | LambdaQueryWrapper<StateAgreement> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(StateAgreement::getAgreementFileType, saveBO.getAgreementFileType()); |
| | | queryWrapper.eq(StateAgreement::getStateHouseholdId, saveBO.getStateHouseholdId()); |
| | | queryWrapper.isNotNull(StateAgreement::getAgreementNumber); |
| | | |
| | | StateAgreement stateAgreement = stateAgreementService.getOne(queryWrapper); |
| | | if (ObjectUtil.isNotEmpty(stateAgreement) && Objects.isNull(saveBO.getId())) { |
| | | throw new GlobalException("每种协议类型只能存在一份"); |
| | | } |
| | | if (!CollectionUtils.isEmpty(saveBO.getFileBOList())) { |
| | | saveBO.setFileUrl(JSON.toJSONString(saveBO.getFileBOList())); |
| | | String appendFileName = saveBO.getFileBOList().stream().map(FileBO::getOriginalFilename).collect(Collectors.joining(",")); |
| | | saveBO.setAppendFileName(appendFileName); |
| | | } |
| | | return AjaxResult.success(stateAgreementService.saveOrUpdate(saveBO)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_AGREEMENT_UPDATE) |
| | | public AjaxResult<Boolean> updateAgreement(@RequestBody UpdateAgreementBO bo) { |
| | | return AjaxResult.success(stateAgreementService.updateStateAgreement(bo.getHouseId())); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_AGREEMENT_UPDATE_AGREEMENT) |
| | | public AjaxResult<StateAgreementSaveBO> updateAgreement(@RequestBody StateAgreementSaveBO saveBO) { |
| | | if (!CollectionUtils.isEmpty(saveBO.getFileBOList())) { |
| | | saveBO.setFileUrl(JSON.toJSONString(saveBO.getFileBOList())); |
| | | String appendFileName = saveBO.getFileBOList().stream().map(FileBO::getOriginalFilename).collect(Collectors.joining(",")); |
| | | saveBO.setAppendFileName(appendFileName); |
| | | } |
| | | stateAgreementService.saveOrUpdate(saveBO); |
| | | return AjaxResult.success(saveBO); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_AGREEMENT_DEL) |
| | | public AjaxResult<Boolean> deleteAgreement(@RequestParam String agreementId) { |
| | | StateAgreement stateAgreement = stateAgreementService.getById(agreementId); |
| | | if (ObjectUtil.isNull(stateAgreement)) { |
| | | throw new GlobalException("该协议不存在"); |
| | | } |
| | | List<Integer> fileList = Stream.of(AgreementTypeEnum.values()).map(AgreementTypeEnum::getValue).collect(Collectors.toList()); |
| | | |
| | | //保留固定协议数据 |
| | | if (fileList.contains(stateAgreement.getAgreementFileType()) |
| | | && !Objects.equals(stateAgreement.getAgreementFileType(), AgreementTypeEnum.OTHER_AGREEMENT.getValue())) { |
| | | LambdaUpdateWrapper<StateAgreement> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(StateAgreement::getId, stateAgreement.getId()) // 根据 ID 进行更新 |
| | | .set(StateAgreement::getSignAt, null) |
| | | .set(StateAgreement::getMoney, null) |
| | | .set(StateAgreement::getAppendFileName, null) |
| | | .set(StateAgreement::getAgreementNumber, null) |
| | | .set(StateAgreement::getFileUrl, null); |
| | | return AjaxResult.success(stateAgreementService.update(updateWrapper)); |
| | | } |
| | | |
| | | return AjaxResult.success(stateAgreementService.removeById(agreementId)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_AGREEMENT_LIST) |
| | | public AjaxResult<PageInfo<StateAgreementVO>> listStateAgreement(@RequestBody StateAgreementBO request) { |
| | | return AjaxResult.success(stateAgreementService.listDataByCondition(request)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_AGREEMENT_DETAIL) |
| | | public AjaxResult<List<AgreementDetailVO>> getAgreementDetail(@RequestParam String stateHouseId) { |
| | | return AjaxResult.success(stateAgreementService.listAgreementDetailByHouseId(stateHouseId)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_AGREEMENT_GENERATE) |
| | | public void generateAgreementDetail(@RequestParam String stateHouseholdId, @RequestParam String stateAgreementId, HttpServletResponse response) throws Exception { |
| | | StateAgreementBO request = new StateAgreementBO(); |
| | | request.setStateHouseholdId(stateHouseholdId); |
| | | Map<String, Object> wordData = stateAgreementService.getWordData(stateHouseholdId, stateAgreementId); |
| | | LambdaQueryWrapper<StateAgreement> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(StateAgreement::getId, stateAgreementId) |
| | | .eq(StateAgreement::getStateHouseholdId, stateHouseholdId); |
| | | StateAgreement one = stateAgreementService.getOne(queryWrapper); |
| | | Integer agreementFileType = one.getAgreementFileType(); |
| | | AgreementTypeEnum enumByValue = AgreementTypeEnum.getEnumByValue(agreementFileType); |
| | | String templatePath; |
| | | switch (enumByValue) { |
| | | case STATE_AGREEMENT: |
| | | templatePath = "templates/成都市国有土地上房屋征收补协议.docx"; |
| | | break; |
| | | case VIRTUAL_STATE_AGREEMENT: |
| | | templatePath = "templates/成都市国有土地上房屋模拟搬迁补偿协议(房屋征收).docx"; |
| | | break; |
| | | case VIRTUAL_STATE_MOVE_AGREEMENT: |
| | | templatePath = "templates/成都市国有土地上房屋模拟搬迁补偿协议(协议搬迁).docx"; |
| | | break; |
| | | default: |
| | | templatePath = "templates/word_template.docx"; |
| | | } |
| | | |
| | | |
| | | XWPFDocument document = WordExportUtil.exportWord07(templatePath, wordData); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | // 4. 设置响应头,生成下载 |
| | | FileUtils.setAttachmentResponseHeader(response, "协议文件.docx"); |
| | | // 5. 将生成的文档写入响应流 |
| | | document.write(response.getOutputStream()); |
| | | document.close(); |
| | | } |
| | | |
| | | //协议提交审核接口 |
| | | @GetMapping(UrlConstants.STATE_AGREEMENT_WORKFLOW_SUBMIT) |
| | | public AjaxResult<Boolean> submitAgreement(@RequestParam List<String> agreementId) { |
| | | if (CollectionUtils.isEmpty(agreementId)) { |
| | | return AjaxResult.success(Boolean.FALSE); |
| | | } |
| | | List<StateAgreement> agreementList = stateAgreementService.listByIds(agreementId); |
| | | if (CollectionUtils.isEmpty(agreementList)) { |
| | | return AjaxResult.success(false); |
| | | } |
| | | agreementList.forEach(stateAgreement -> stateAgreement.setAuditStatus(SubmitStatusEnum.SUBMITTED.getValue())); |
| | | StateHousehold stateHousehold = stateHouseholdService.getById(agreementList.get(0).getStateHouseholdId()); |
| | | if (ObjectUtil.isNotEmpty(stateHousehold)) { |
| | | //审核中 |
| | | stateHousehold.setAgreementStatus(SubmitStatusEnum.PENDING_REVIEW.getValue()); |
| | | stateHouseholdService.updateById(stateHousehold); |
| | | |
| | | //提交审核(协议签订) |
| | | ProcessStartBO processStartBO = new ProcessStartBO(); |
| | | processStartBO.setCategory(ProcessCategoryEnum.CATEGORY3.getValue().toString()); |
| | | processStartBO.setModuleName("协议签订"); |
| | | //查询征收单位 |
| | | StateProject stateProject = stateProjectService.getProjectById(stateHousehold.getStateProjectId()); |
| | | String name = ObjectUtil.isEmpty(stateProject) ? "" : stateProject.getProjectName(); |
| | | processStartBO.setName(name); |
| | | |
| | | String cedName = ObjectUtil.isEmpty(stateProject) ? "" : stateProject.getDepartment(); |
| | | String remark = String.format("【镇/街】:%s,【征收实施单位】:%s", stateHousehold.getBelongingStreetTown(), cedName); |
| | | processStartBO.setRemark(remark); |
| | | Map<String, Object> variable = new HashMap<>(); |
| | | variable.put("stateHouseholdId", stateHousehold.getId()); |
| | | processStartBO.setVariable(variable); |
| | | stateProcessTemplateService.start(processStartBO); |
| | | } |
| | | |
| | | return AjaxResult.success(stateAgreementService.saveOrUpdateBatch(agreementList)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.state; |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.zzg.common.constant.state.UrlConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.state.StateApplyRecordItem; |
| | | import com.zzg.system.domain.bo.*; |
| | | import com.zzg.system.domain.vo.ApplyHouseholdOwnerVO; |
| | | import com.zzg.system.domain.vo.StateApplyRecordPageInfoLevelVO; |
| | | import com.zzg.system.domain.vo.StateApplyRecordVO; |
| | | import com.zzg.system.service.state.StateApplyRecordService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateApplyRecordController { |
| | | private final StateApplyRecordService stateApplyRecordService; |
| | | |
| | | @PostMapping(UrlConstants.STATE_APPLY_RECORD_PAGE) |
| | | @ApiOperation(value = "分页查询台账", notes = "分页查询台账") |
| | | public AjaxResult<PageInfo<StateApplyRecordVO>> page(@RequestBody StateApplyRecordPageBO stateApplyRecordPageBO) { |
| | | return AjaxResult.success(stateApplyRecordService.pageInfo(stateApplyRecordPageBO)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_APPLY_RECORD_PAGE_LEVEL) |
| | | @ApiOperation(value = "分页查询一级台账", notes = "分页查询一级台账") |
| | | public AjaxResult<StateApplyRecordPageInfoLevelVO> pageInfoLevel(@RequestBody StateApplyRecordPageInfoLevelBO stateApplyRecordPageInfoLevelBO) { |
| | | return AjaxResult.success(stateApplyRecordService.pageInfoLevel(stateApplyRecordPageInfoLevelBO)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_APPLY_RECORD_SAVE) |
| | | @ApiOperation(value = "保存请账", notes = "保存请账") |
| | | public AjaxResult<Boolean> saveStateApplyRecordAndItem(@RequestBody SaveRecordAndItemBO saveRecordAndItemBO) { |
| | | return AjaxResult.success(stateApplyRecordService.saveStateApplyRecordAndItem(saveRecordAndItemBO)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_APPLY_RECORD_IMPORT) |
| | | @ApiOperation(value = "导入权利人", notes = "导入权利人") |
| | | public AjaxResult<List<ApplyOwnerBO>> importOwnerByFile(ImportApplyRecordBO importApplyRecordBO) { |
| | | return AjaxResult.success(stateApplyRecordService.importOwnerByFile(importApplyRecordBO)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_APPLY_RECORD_GET_OWNER) |
| | | @ApiOperation(value = "通过项目id查询权利人", notes = "通过项目id查询权利人") |
| | | public AjaxResult<ApplyHouseholdOwnerVO> getApplyHouseholdOwner(@RequestBody GetApplyHouseholdOwnerBO getApplyHouseholdOwnerBO) { |
| | | return AjaxResult.success(stateApplyRecordService.getApplyHouseholdOwner(getApplyHouseholdOwnerBO)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_APPLY_RECORD_GET_OWNER_INFO) |
| | | @ApiOperation(value = "住宅临时安置补助费户详情或者 或者 停产停业补助费详情", notes = "停产停业补助费详情") |
| | | public AjaxResult<PageInfo<ApplyOwnerBO>> getApplyHouseholdOwnerInfo(@RequestBody GetApplyHouseholdOwnerBO getApplyHouseholdOwnerBO) { |
| | | return AjaxResult.success(stateApplyRecordService.getApplyHouseholdOwnerInfo(getApplyHouseholdOwnerBO)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_APPLY_RECORD_DETAIL) |
| | | @ApiOperation(value = "任务中心-请帐详情",notes = "任务中心-请帐详情") |
| | | public AjaxResult<ApplyBO> stateApplyRecordDetail(@RequestBody GetApplyHouseholdOwnerBO getApplyHouseholdOwnerBO) { |
| | | return AjaxResult.success(stateApplyRecordService.stateApplyRecordDetail(getApplyHouseholdOwnerBO)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.state; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.zzg.common.constant.state.UrlConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.state.StateAsset; |
| | | import com.zzg.common.enums.DeleteFlagEnum; |
| | | import com.zzg.system.domain.bo.AssetDetailBO; |
| | | import com.zzg.system.domain.bo.StateAssetBO; |
| | | import com.zzg.system.domain.vo.StateAssetDetailVO; |
| | | import com.zzg.system.service.state.StateAssetService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateAssetController { |
| | | |
| | | private final StateAssetService assetService; |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_ASSET_SAVE) |
| | | public AjaxResult<Boolean> saveAsset(@RequestBody StateAssetBO asset) { |
| | | return AjaxResult.success(assetService.saveAsset(asset)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_PROJECT_ASSET_DEL) |
| | | public AjaxResult<Boolean> delAsset(@RequestParam String assetId) { |
| | | StateAsset asset = assetService.getById(assetId); |
| | | if (Objects.isNull(asset)) { |
| | | return AjaxResult.error(); |
| | | } |
| | | LambdaUpdateWrapper<StateAsset> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(StateAsset::getId, asset.getId()); |
| | | updateWrapper.set(StateAsset::getDelFlag, DeleteFlagEnum.DELETED.getKey()); |
| | | return AjaxResult.success(assetService.update(updateWrapper)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_PROJECT_ASSET_LIST) |
| | | public AjaxResult<List<StateAsset>> listAsset(@RequestParam String projectId, |
| | | @RequestParam String street, |
| | | @RequestParam(required = false) String assetId) { |
| | | LambdaQueryWrapper<StateAsset> stateAssetQueryWrapper = new LambdaQueryWrapper<>(); |
| | | stateAssetQueryWrapper.eq(StateAsset::getStateProjectId, projectId); |
| | | stateAssetQueryWrapper.eq(StateAsset::getStreet, street); |
| | | if (StringUtils.isNoneBlank(assetId)) { |
| | | stateAssetQueryWrapper.eq(StateAsset::getId, assetId); |
| | | } |
| | | stateAssetQueryWrapper.eq(StateAsset::getDelFlag, DeleteFlagEnum.NOT_DELETED.getKey()); |
| | | List<StateAsset> list = assetService.list(stateAssetQueryWrapper); |
| | | list.forEach(e-> e.setVirtualMoney(e.getVirtualMoney() |
| | | .setScale(4, RoundingMode.HALF_UP))); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_PROJECT_ASSET_SUM) |
| | | public AjaxResult<JSONObject> sumAsset(@RequestParam String projectId) { |
| | | return AjaxResult.success(assetService.sumAsset(projectId)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_ASSET_DETAIL) |
| | | public AjaxResult<PageInfo<StateAssetDetailVO>> listAssetDetail(@RequestBody AssetDetailBO detailBO) { |
| | | return AjaxResult.success(assetService.listAssetDetail(detailBO)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.state; |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.zzg.common.constant.state.UrlConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.system.domain.bo.PlacementStatisticsBO; |
| | | import com.zzg.system.domain.bo.ProjectStatisticsBO; |
| | | import com.zzg.system.domain.vo.*; |
| | | import com.zzg.system.service.state.StateDateCenterService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateDataCenterController { |
| | | |
| | | private final StateDateCenterService dateCenterService; |
| | | |
| | | @GetMapping(UrlConstants.STATE_DATA_CENTER_SUM) |
| | | public AjaxResult<ProjectAnalysisSumVO> dataCenterSum(@RequestParam(required = false) String location, |
| | | @RequestParam(required = false) Integer projectStatus, |
| | | @RequestParam(required = false) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") Date projectStartTime) { |
| | | return AjaxResult.success(dateCenterService.projectSumCount(location, projectStatus, projectStartTime)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_DATA_CENTER_SUM_EXPIRED) |
| | | public AjaxResult<PageInfo<ProjectStatusExpiredVO>> sumExpiredAgreement(@RequestBody(required = false) ProjectStatisticsBO statisticsBO) { |
| | | return AjaxResult.success(dateCenterService.expiredProjectStatus(statisticsBO)); |
| | | } |
| | | |
| | | //安置情况 |
| | | @GetMapping(UrlConstants.STATE_DATA_CENTER_PLACEMENT_STATISTICS) |
| | | public AjaxResult<PlacementStatisticsVO> stateDataCenterPlacementStatistics( |
| | | @RequestParam(required = false) String projectStreet, |
| | | @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date projectStartTime, |
| | | @RequestParam(required = false) Integer type |
| | | //type 首页传1 安置传2 |
| | | ) { |
| | | return AjaxResult.success(dateCenterService.placementStatistics(projectStreet, projectStartTime,type)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_DATA_CENTER_PLACEMENT_STATISTICS_STREET) |
| | | public AjaxResult<PlacementStreetVO> stateDataCenterPlacementStatisticsStreet( |
| | | @RequestParam(required = false) String projectStreet, |
| | | @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date projectStartTime) { |
| | | return AjaxResult.success(dateCenterService.sumPlacementStreet(projectStreet, projectStartTime)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_DATA_CENTER_PLACEMENT_STATISTICS_PAGE) |
| | | public AjaxResult<PageInfo<TransitionPageVO>> stateDataCenterPlacementStatisticsPage(@RequestBody PlacementStatisticsBO placementStatisticsBO) throws ParseException { |
| | | return AjaxResult.success(dateCenterService.placementStatisticsPage(placementStatisticsBO)); |
| | | } |
| | | |
| | | //项目资金 |
| | | @GetMapping(UrlConstants.STATE_DATA_CENTER_ASSET_SUM_MONEY) |
| | | public AjaxResult<AssetMoneyVO> stateCenterAssetSumMoney(@RequestParam(required = false) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") Date projectStartTime) { |
| | | return AjaxResult.success(dateCenterService.sumAssetMoney(projectStartTime)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_DATA_CENTER_ASSET_SUM_MONEY_GRAPH) |
| | | public AjaxResult<List<AssetGraphVO>> stateCenterAssetSumGraph(@RequestParam(required = false) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") Date projectStartTime) { |
| | | return AjaxResult.success(dateCenterService.listAssetGraph(projectStartTime)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.state; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.zzg.common.constant.state.UrlConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import com.zzg.common.core.domain.entity.state.StateProcessModule; |
| | | import com.zzg.common.core.domain.entity.state.StateProcessTemplate; |
| | | import com.zzg.common.core.domain.entity.system.SysUser; |
| | | import com.zzg.common.core.page.PageDomain; |
| | | import com.zzg.common.enums.DeleteFlagEnum; |
| | | import com.zzg.common.exception.GlobalException; |
| | | import com.zzg.common.utils.SecurityUtils; |
| | | import com.zzg.framework.web.domain.server.Sys; |
| | | import com.zzg.system.domain.bo.*; |
| | | import com.zzg.system.domain.vo.ProcessTaskListVO; |
| | | import com.zzg.system.service.state.StateProcessModuleService; |
| | | import com.zzg.system.service.state.StateProcessTemplateService; |
| | | import com.zzg.system.service.system.ISysUserService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateProcessController { |
| | | |
| | | private final StateProcessTemplateService processTemplateService; |
| | | private final StateProcessModuleService processModuleService; |
| | | private final ISysUserService sysUserService; |
| | | |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROCESS_STATE_MODULE_PAGE) |
| | | public AjaxResult<PageInfo<StateProcessModule>> modulePage(@RequestBody PageDomain pageDomain) { |
| | | PageHelper.startPage(pageDomain.getPageNum(), pageDomain.getPageSize()); |
| | | LambdaQueryWrapper<StateProcessModule> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.orderByAsc(StateProcessModule::getCategory); |
| | | List<StateProcessModule> moduleList = processModuleService.list(queryWrapper); |
| | | if (CollectionUtils.isEmpty(moduleList)) { |
| | | return AjaxResult.success(new PageInfo<>()); |
| | | } |
| | | PageInfo<StateProcessModule> pageInfo = new PageInfo<>(moduleList); |
| | | List<String> updateUserId = pageInfo.getList().stream().map(BaseEntity::getUpdateBy).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(updateUserId)){ |
| | | List<SysUser> sysUsers = sysUserService.selectUserByIdList(updateUserId); |
| | | Map<String, SysUser> sysUserMap; |
| | | if (!CollectionUtils.isEmpty(sysUsers)){ |
| | | sysUserMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity())); |
| | | } else { |
| | | sysUserMap = new HashMap<>(); |
| | | } |
| | | pageInfo.getList().forEach(e -> { |
| | | SysUser sysUser = sysUserMap.get(e.getUpdateBy()); |
| | | if (Objects.nonNull(sysUser)){ |
| | | e.setUpdateBy(sysUser.getNickName()); |
| | | } |
| | | }); |
| | | } |
| | | return AjaxResult.success(pageInfo); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROCESS_STATE_MODULE_UPDATE) |
| | | public AjaxResult<PageInfo<StateProcessModule>> moduleUpdate(@RequestBody ProcessModuleUpdateBO processModuleUpdateBO) { |
| | | StateProcessTemplate stateProcessTemplate = processTemplateService.getById(processModuleUpdateBO.getTemplateId()); |
| | | if (Objects.isNull(stateProcessTemplate)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | StateProcessModule stateProcessModule = new StateProcessModule(); |
| | | stateProcessModule.setId(processModuleUpdateBO.getId()); |
| | | stateProcessModule.setTemplateId(processModuleUpdateBO.getTemplateId()); |
| | | stateProcessModule.setTemplateName(stateProcessTemplate.getTemplateName()); |
| | | System.out.println(JSONUtil.toJsonStr(SecurityUtils.getLoginUser().getUser())); |
| | | stateProcessModule.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName()); |
| | | stateProcessModule.setCreateTime(new Date()); |
| | | stateProcessModule.setUpdateTime(new Date()); |
| | | stateProcessModule.setRemark(processModuleUpdateBO.getRemark()); |
| | | processModuleService.updateById(stateProcessModule); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | //流程模版分页 |
| | | @PostMapping(UrlConstants.STATE_PROCESS_TEMPLATE_PAGE) |
| | | public AjaxResult<Page<StateProcessTemplate>> page(ProcessTemplatePageBO request) { |
| | | Page<StateProcessTemplate> templatePage = processTemplateService.page(request); |
| | | |
| | | return AjaxResult.success(templatePage); |
| | | } |
| | | |
| | | //查询流程模版 |
| | | @GetMapping(UrlConstants.STATE_PROCESS_TEMPLATE_GET_BY_ID) |
| | | public AjaxResult<StateProcessTemplate> selectById(@PathVariable String id) { |
| | | return AjaxResult.success(processTemplateService.getById(id)); |
| | | } |
| | | |
| | | //修改并部署模版 |
| | | @PostMapping(UrlConstants.STATE_PROCESS_TEMPLATE_UPDATE) |
| | | public AjaxResult<Boolean> update(@RequestBody ProcessUpdateBO processUpdateBO) { |
| | | return AjaxResult.success(processTemplateService.update(processUpdateBO)); |
| | | } |
| | | |
| | | //删除模版 |
| | | @GetMapping(UrlConstants.STATE_PROCESS_TEMPLATE_DELETE) |
| | | public AjaxResult<Boolean> deleteById(@PathVariable String id) { |
| | | StateProcessTemplate template = processTemplateService.getById(id); |
| | | //查询是否存在使用的 |
| | | LambdaUpdateWrapper<StateProcessModule> moduleLambdaUpdateWrapper = new LambdaUpdateWrapper<>();; |
| | | moduleLambdaUpdateWrapper.eq(StateProcessModule::getTemplateId, template.getId()); |
| | | if (processModuleService.getBaseMapper().exists(moduleLambdaUpdateWrapper)) { |
| | | throw new GlobalException("该模版在应用流程中已使用!"); |
| | | } |
| | | //根据key修改所有版本为已删除 |
| | | LambdaUpdateWrapper<StateProcessTemplate> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.set(StateProcessTemplate::getDelFlag, DeleteFlagEnum.DELETED.getKey()); |
| | | updateWrapper.eq(StateProcessTemplate::getTemplateKey, template.getTemplateKey()); |
| | | return AjaxResult.success(processTemplateService.update(updateWrapper)); |
| | | } |
| | | |
| | | //创建并部署模版 |
| | | @PostMapping(UrlConstants.STATE_PROCESS_TEMPLATE_CREATE) |
| | | public AjaxResult<Boolean> create(@RequestBody ProcessCreateBO processCreateBO) { |
| | | return AjaxResult.success(processTemplateService.create(processCreateBO)); |
| | | } |
| | | |
| | | //流程发起 |
| | | @PostMapping(UrlConstants.STATE_PROCESS_START) |
| | | public AjaxResult<Boolean> start(@RequestBody ProcessStartBO processStartBO) { |
| | | return AjaxResult.success(processTemplateService.start(processStartBO)); |
| | | } |
| | | |
| | | //待办 |
| | | @PostMapping(UrlConstants.STATE_PROCESS_WAIT_TASK_PAGE) |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> waitTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { |
| | | return AjaxResult.success(processTemplateService.waitTaskPage(processTemplatePageBO)); |
| | | } |
| | | |
| | | //已办 |
| | | @PostMapping(UrlConstants.STATE_PROCESS_DEAL_TASK_PAGE) |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> dealTaskPage(@RequestBody ProcessTaskListBO processTemplatePageBO) { |
| | | return AjaxResult.success(processTemplateService.dealTaskPage(processTemplatePageBO)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROCESS_COPY_TASK_PAGE) |
| | | public AjaxResult<PageInfo<ProcessTaskListVO>> copyTaskPage(@RequestBody ProcessTaskListBO processTaskListBO){ |
| | | return AjaxResult.success(processTemplateService.copyTaskPage(processTaskListBO)); |
| | | } |
| | | |
| | | //审核通过 |
| | | @PostMapping(UrlConstants.STATE_PROCESS_AGREE) |
| | | public AjaxResult<Object> agree(@RequestBody ProcessAgreeBO processAgreeBO) { |
| | | processTemplateService.agree(processAgreeBO); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | //审核拒绝 |
| | | @PostMapping(UrlConstants.STATE_PROCESS_REFUSE) |
| | | public AjaxResult<Object> refuse(@RequestBody ProcessRefuseBO processRefuseBO) { |
| | | processTemplateService.refuse(processRefuseBO); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.state; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.zzg.common.constant.state.UrlConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.state.StateProjectCompensateStandard; |
| | | import com.zzg.system.domain.vo.StateProjectCompensateStandardVO; |
| | | import com.zzg.system.service.state.StateProjectCompensateStandardService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateProjectCompensateStandardController { |
| | | private final StateProjectCompensateStandardService stateProjectCompensateStandardService; |
| | | |
| | | @GetMapping(UrlConstants.STATE_PROJECT_COMPENSATE_STANDARD_LIST) |
| | | public AjaxResult<Map<String, List<StateProjectCompensateStandardVO>>> getAll(@RequestParam(required = false) String standardName, |
| | | @RequestParam(required = false) Integer stopFlag, |
| | | @RequestParam(required = false) Integer compensateType |
| | | ) { |
| | | |
| | | return AjaxResult.success(stateProjectCompensateStandardService.getCompensateStandardMap(standardName, stopFlag, compensateType)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_COMPENSATE_STANDARD_ADD) |
| | | public AjaxResult<Boolean> create(@RequestBody StateProjectCompensateStandard stateProjectCompensateStandard) { |
| | | |
| | | return AjaxResult.success(stateProjectCompensateStandardService.createCompensatesStandard(stateProjectCompensateStandard)); |
| | | } |
| | | @PostMapping(UrlConstants.STATE_PROJECT_COMPENSATE_STANDARD_UPDATE) |
| | | public AjaxResult<Boolean> update(@RequestBody StateProjectCompensateStandard stateProjectCompensateStandard) { |
| | | return AjaxResult.success(stateProjectCompensateStandardService.saveOrUpdate(stateProjectCompensateStandard)); |
| | | } |
| | | @PostMapping(UrlConstants.STATE_PROJECT_COMPENSATE_STANDARD_UPDATE_NAME) |
| | | public AjaxResult<Boolean> updateName(@RequestBody StateProjectCompensateStandard stateProjectCompensateStandard) { |
| | | return AjaxResult.success(stateProjectCompensateStandardService.updateName(stateProjectCompensateStandard)); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_COMPENSATE_STANDARD_STOP) |
| | | public AjaxResult<Boolean> stop(@RequestParam String standardName, @RequestParam Integer compensateType) { |
| | | LambdaUpdateWrapper<StateProjectCompensateStandard> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.eq(StateProjectCompensateStandard::getCompensateType, compensateType) |
| | | .eq(StateProjectCompensateStandard::getStandardName, standardName) |
| | | .set(StateProjectCompensateStandard::getStopFlag, 0); |
| | | return AjaxResult.success(stateProjectCompensateStandardService.update(wrapper)); |
| | | } |
| | | @PostMapping(UrlConstants.STATE_PROJECT_COMPENSATE_STANDARD_START) |
| | | public AjaxResult<Boolean> start(@RequestParam String standardName, @RequestParam Integer compensateType) { |
| | | LambdaUpdateWrapper<StateProjectCompensateStandard> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.eq(StateProjectCompensateStandard::getCompensateType, compensateType) |
| | | .eq(StateProjectCompensateStandard::getStandardName, standardName) |
| | | .set(StateProjectCompensateStandard::getStopFlag, 1); |
| | | return AjaxResult.success(stateProjectCompensateStandardService.update(wrapper)); |
| | | } |
| | | @PostMapping(UrlConstants.STATE_PROJECT_COMPENSATE_STANDARD_IMPORT) |
| | | public AjaxResult<Boolean> importExcelFile(@RequestParam("file") MultipartFile file) { |
| | | return AjaxResult.success(stateProjectCompensateStandardService.importByExcel(file)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.state; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.zzg.common.constant.state.UrlConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.state.StateHousehold; |
| | | import com.zzg.common.core.domain.entity.state.StateProject; |
| | | import com.zzg.common.core.domain.entity.state.StateProjectCollectionFile; |
| | | import com.zzg.common.core.domain.entity.state.StateProjectNotice; |
| | | import com.zzg.common.enums.HouseSearchStatusEnum; |
| | | import com.zzg.common.enums.StateProjectStatusEnum; |
| | | import com.zzg.common.exception.GlobalException; |
| | | import com.zzg.common.utils.DateUtils; |
| | | import com.zzg.system.convert.StateProjectConvert; |
| | | import com.zzg.system.domain.bo.*; |
| | | import com.zzg.system.domain.vo.CalculateCompensationVO; |
| | | import com.zzg.system.domain.vo.ParentCollectionFileVO; |
| | | import com.zzg.system.domain.vo.ProjectImplPageVO; |
| | | import com.zzg.system.domain.vo.StateProjectNoticeVO; |
| | | import com.zzg.system.service.state.*; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateProjectController { |
| | | |
| | | |
| | | private final StateProjectService stateProjectService; |
| | | private final StateProjectCollectionFileService stateProjectCollectionFileService; |
| | | private final StateProjectNoticeService stateProjectNoticeService; |
| | | private final StateProcessTemplateService processTemplateService; |
| | | private final StateHouseholdService stateHouseholdService; |
| | | |
| | | // 查询所有项目 |
| | | @GetMapping(UrlConstants.STATE_PROJECT_LIST) |
| | | public AjaxResult<List<StateProject>> list() { |
| | | return AjaxResult.success(stateProjectService.list()); |
| | | } |
| | | |
| | | // 分页查询 |
| | | @PostMapping(UrlConstants.STATE_PROJECT_PAGE) |
| | | @ApiOperation(value = "分页查询项目列表", notes = "分页查询项目列表") |
| | | public AjaxResult<JSONObject> page(@RequestBody GetProjectPageBO getProjectPageBO) { |
| | | return AjaxResult.success(stateProjectService.getPage(getProjectPageBO)); |
| | | } |
| | | |
| | | // 分页查询 |
| | | @PostMapping(UrlConstants.STATE_PROJECT_PAGE_APPLY_RECORD) |
| | | @ApiOperation(value = "分页查询项目列表 仅针对住宅临时安置费处进行查询", notes = "分页查询项目列表") |
| | | public AjaxResult<JSONObject> pageForApplyRecord(@RequestBody GetProjectPageBO getProjectPageBO) { |
| | | return AjaxResult.success(stateProjectService.getPageForApplyRecord(getProjectPageBO)); |
| | | } |
| | | |
| | | |
| | | // 根据ID查询项目 |
| | | @GetMapping(UrlConstants.STATE_PROJECT_GET_BY_ID) |
| | | public AjaxResult<StateProjectBO> getById(@PathVariable String id) { |
| | | return AjaxResult.success(stateProjectService.getProjectInfoById(id)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_PROJECT_GET_STREET_BY_ID) |
| | | public AjaxResult<String[]> getProjectBelongingStreetTownById(@PathVariable String id) { |
| | | return AjaxResult.success(stateProjectService.getProjectBelongingStreetTownById(id)); |
| | | } |
| | | |
| | | // 创建项目 |
| | | @PostMapping(UrlConstants.STATE_PROJECT_SAVE) |
| | | @ApiOperation(value = "新建或更新项目", notes = "新建或更新项目") |
| | | public AjaxResult<StateProject> create(@RequestBody StateProjectBO stateProject) { |
| | | return AjaxResult.success(stateProjectService.saveProjectAndInfo(stateProject)); |
| | | } |
| | | |
| | | // 更新项目 |
| | | @PutMapping(UrlConstants.STATE_PROJECT_UPDATE) |
| | | public AjaxResult<Boolean> update(@RequestBody StateProject stateProject) { |
| | | return AjaxResult.success(stateProjectService.updateById(stateProject)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_UPDATE_STATUS) |
| | | @ApiOperation(value = "修改项目状态,例如转征收,并发布公告", notes = "修改项目状态,例如转征收,并发布公告") |
| | | public AjaxResult<Boolean> update(@RequestBody UpdateProjectAndAddNoticeBO updateProjectAndAddNoticeBO) { |
| | | |
| | | |
| | | if (StateProjectStatusEnum.LEVY.getKey().equals(updateProjectAndAddNoticeBO.getProjectStatus()) |
| | | || StateProjectStatusEnum.SIMULATE.getKey().equals(updateProjectAndAddNoticeBO.getProjectStatus())) { |
| | | HouseAgreeMoveRateBO houseAgreeMoveRateBO = stateHouseholdService.currentProjectRate(updateProjectAndAddNoticeBO.getProjectId()); |
| | | if (Objects.isNull(houseAgreeMoveRateBO)) { |
| | | throw new GlobalException("当前项目未添加任何房产信息数据"); |
| | | } |
| | | if (houseAgreeMoveRateBO.getAreaAgreeMoveRate() <= 66.66) { |
| | | throw new GlobalException("房产同意面积未超过2/3"); |
| | | } |
| | | if (houseAgreeMoveRateBO.getPersonAgreeMoveRate() <= 95.00) { |
| | | throw new GlobalException("房产同意率未超过95%"); |
| | | } |
| | | } |
| | | |
| | | StateProject projectById = stateProjectService.getProjectById(updateProjectAndAddNoticeBO.getProjectId()); |
| | | projectById.setStatus(updateProjectAndAddNoticeBO.getProjectStatus()); |
| | | projectById.setIsNeedEvaluate(updateProjectAndAddNoticeBO.getIsNeedEvaluate()); |
| | | if (updateProjectAndAddNoticeBO.getProjectStatus().equals(StateProjectStatusEnum.SIMULATE.getKey())) { |
| | | projectById.setSimulatedTime(DateUtil.parseDate(com.zzg.common.utils.DateUtil.formatDate(com.zzg.common.utils.DateUtil.getNewDate(), DateUtils.YYYY_MM_DD))); |
| | | projectById.setStage(StateProjectStatusEnum.SIMULATE.getKey()); |
| | | } else if (updateProjectAndAddNoticeBO.getProjectStatus().equals(StateProjectStatusEnum.LEVY.getKey())) { |
| | | projectById.setLevyTime(DateUtil.parseDate(com.zzg.common.utils.DateUtil.formatDate(com.zzg.common.utils.DateUtil.getNewDate(), DateUtils.YYYY_MM_DD))); |
| | | projectById.setStage(StateProjectStatusEnum.LEVY.getKey()); |
| | | if (projectById.getIsNeedEvaluate() == 1) { |
| | | LambdaQueryWrapper<StateHousehold> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(StateHousehold::getStateProjectId, projectById.getId()); |
| | | List<StateHousehold> householdList = stateHouseholdService.list(queryWrapper); |
| | | if (!CollectionUtils.isEmpty(householdList)) { |
| | | householdList.forEach(e -> { |
| | | //协议状态、调查评估签订状态重置 |
| | | e.setAgreementStatus(null); |
| | | if (StringUtils.isNotBlank(e.getAppendData())) { |
| | | String appendData = e.getAppendData(); |
| | | CalculateCompensationVO calculateCompensationVO = JSON.parseObject(appendData, CalculateCompensationVO.class); |
| | | if (Objects.nonNull(calculateCompensationVO.getSurveyResultRegistrationBO())) { |
| | | calculateCompensationVO.getSurveyResultRegistrationBO().setIsSignedVirtualAgreement(null); |
| | | } |
| | | e.setAppendData(JSON.toJSONString(calculateCompensationVO)); |
| | | } |
| | | }); |
| | | stateHouseholdService.saveOrUpdateBatch(householdList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | stateProjectService.saveProject(projectById); |
| | | |
| | | StateProjectNotice stateProjectNotice = StateProjectConvert.INSTANCE.updateProjectAndAddNoticeBOToEntity(updateProjectAndAddNoticeBO); |
| | | if (Objects.nonNull(updateProjectAndAddNoticeBO.getFileBOList()) && !CollectionUtils.isEmpty(updateProjectAndAddNoticeBO.getFileBOList())) { |
| | | stateProjectNotice.setFileUrl(JSON.toJSONString(updateProjectAndAddNoticeBO.getFileBOList())); |
| | | } |
| | | if (Objects.nonNull(updateProjectAndAddNoticeBO.getImgBOList()) && !CollectionUtils.isEmpty(updateProjectAndAddNoticeBO.getImgBOList())) { |
| | | stateProjectNotice.setImgUrl(JSON.toJSONString(updateProjectAndAddNoticeBO.getImgBOList())); |
| | | } |
| | | //1 正常公告 2转征收的公告 |
| | | stateProjectNotice.setType(2); |
| | | stateProjectNoticeService.saveOrUpdate(stateProjectNotice); |
| | | //转征收后,将房产调查状态改为调查过 用于app端展示对应数据 |
| | | LambdaUpdateWrapper<StateHousehold> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(StateHousehold::getStateProjectId, updateProjectAndAddNoticeBO.getProjectId()); |
| | | if (updateProjectAndAddNoticeBO.getProjectStatus().equals(StateProjectStatusEnum.LEVY.getKey())) { |
| | | updateWrapper.set(StateHousehold::getSearchStatus, HouseSearchStatusEnum.SEARCHED.getValue()); |
| | | } |
| | | updateWrapper.set(StateHousehold::getStage, StateProjectStatusEnum.LEVY.getKey()); |
| | | //对于转征收的数据 协议的审核状态挂在房产上的 房产的对应状态需要置空 |
| | | updateWrapper.set(StateHousehold::getAgreementStatus, null); |
| | | stateHouseholdService.update(updateWrapper); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | // 删除项目 |
| | | @DeleteMapping(UrlConstants.STATE_PROJECT_DELETE) |
| | | @ApiOperation(value = "删除项目", notes = "删除项目") |
| | | public AjaxResult<Boolean> delete(@PathVariable String id) { |
| | | return AjaxResult.success(stateProjectService.removeById(id)); |
| | | } |
| | | // 删除项目 |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_SUCCESS) |
| | | @ApiOperation(value = "将项目改为已完成", notes = "将项目改为已完成") |
| | | public AjaxResult<Boolean> successProject(@RequestBody GetProjectPageBO getProjectPageBO) { |
| | | //todo接workflow 并计算金额 |
| | | stateProjectService.updateProjectAppStage(getProjectPageBO.getProjectId(), StateProjectStatusEnum.SUCCESS.getKey()); |
| | | return AjaxResult.success(stateProjectService.updateProjectStatus(getProjectPageBO.getProjectId(), StateProjectStatusEnum.SUCCESS.getKey())); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_APP_SUCCESS) |
| | | @ApiOperation(value = "app将项目改为已完成", notes = "app将项目改为已完成") |
| | | public AjaxResult<Boolean> appSuccessProject(@RequestBody GetProjectPageBO getProjectPageBO) { |
| | | //todo接workflow 并计算金额 |
| | | return AjaxResult.success(stateProjectService.updateProjectAppStage(getProjectPageBO.getProjectId(), StateProjectStatusEnum.SUCCESS.getKey())); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_NOTICE_SIMULATE) |
| | | @ApiOperation(value = "将项目改为模拟", notes = "将项目改为模拟") |
| | | public AjaxResult<Boolean> simulatedProject(@RequestBody GetProjectPageBO getProjectPageBO) { |
| | | //todo接workflow 并计算金额 |
| | | stateProjectService.updateProjectAppStage(getProjectPageBO.getProjectId(), StateProjectStatusEnum.SIMULATE.getKey()); |
| | | return AjaxResult.success(stateProjectService.updateProjectStatus(getProjectPageBO.getProjectId(), StateProjectStatusEnum.SIMULATE.getKey())); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping(UrlConstants.STATE_PROJECT_CANCELLATION) |
| | | @ApiOperation(value = "作废项目", notes = "作废项目") |
| | | public AjaxResult<Boolean> cancellationStateProject(@PathVariable String id) { |
| | | return AjaxResult.success(stateProjectService.cancellationStateProject(id)); |
| | | } |
| | | |
| | | //查询所有征集文件 |
| | | @GetMapping(UrlConstants.STATE_PROJECT_COLLECTION_FILE_LIST) |
| | | @ApiOperation(value = "查询所有征集文件", notes = "查询所有征集文件") |
| | | public AjaxResult<List<StateProjectCollectionFile>> listCollectionFile(@RequestParam String projectId, @RequestParam Integer fileType, @RequestParam Boolean isBefore) { |
| | | return AjaxResult.success(stateProjectCollectionFileService.getByProjectIdAndType(projectId, fileType, isBefore)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_PROJECT_COLLECTION_FILE_PARENT) |
| | | @ApiOperation(value = "查询所有父亲文件", notes = "查询所有父亲文件") |
| | | public AjaxResult<List<ParentCollectionFileVO>> listCollectionFileParent(@RequestParam Boolean isBefore) { |
| | | return AjaxResult.success(stateProjectCollectionFileService.getParentCollectionFile(isBefore)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_PROJECT_REMOVE_COLLECTION_FILE) |
| | | @ApiOperation(value = "删除征收文件", notes = "删除征收文件") |
| | | public AjaxResult<Boolean> removeCollectionFile(@RequestParam String fileId) { |
| | | return AjaxResult.success(stateProjectCollectionFileService.removeById(fileId)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_ADD_COLLECTION_FILE) |
| | | @ApiOperation(value = "添加征收文件", notes = "添加征收文件") |
| | | public AjaxResult<Object> addCollectionFile(@RequestBody @Validated UploadFileBO uploadFileBO) { |
| | | return AjaxResult.success(stateProjectCollectionFileService.addCollectionFile(uploadFileBO)); |
| | | } |
| | | |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_NOTICE_PAGE) |
| | | @ApiOperation(value = "分页查询公告", notes = "分页查询公告") |
| | | public AjaxResult<Page<StateProjectNotice>> pageNotice(@RequestBody GetProjectPageBO getProjectPageBO) { |
| | | return AjaxResult.success(stateProjectNoticeService.page(new Page<>(getProjectPageBO.getPageNum(), getProjectPageBO.getPageSize()))); |
| | | } |
| | | |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_NOTICE_PAGE_AFTER_UPDATE_PROJECT) |
| | | @ApiOperation(value = "分页查询公告", notes = "分页查询公告在更新项目之后") |
| | | public AjaxResult<Page<StateProjectNotice>> pageNoticeAfterUpdateProject(@RequestBody GetProjectPageBO getProjectPageBO) { |
| | | LambdaQueryWrapper<StateProjectNotice> stateProjectNoticeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | //对于新建项目而言 此处没有公告 |
| | | if (Objects.isNull(getProjectPageBO.getProjectId())) { |
| | | return AjaxResult.success(); |
| | | } |
| | | stateProjectNoticeLambdaQueryWrapper.eq(StateProjectNotice::getProjectId, getProjectPageBO.getProjectId()); |
| | | return AjaxResult.success(stateProjectNoticeService.page(new Page<>(getProjectPageBO.getPageNum(), getProjectPageBO.getPageSize()), stateProjectNoticeLambdaQueryWrapper)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_PROJECT_NOTICE_GET) |
| | | @ApiOperation(value = "查询公告详情", notes = "查询公告详情") |
| | | public AjaxResult<StateProjectNoticeVO> getNoticeInfo(@RequestParam String noticeId) { |
| | | StateProjectNoticeVO stateProjectNoticeVO = stateProjectNoticeService.getStateProjectNoticeVO(noticeId); |
| | | return AjaxResult.success(stateProjectNoticeVO); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping(UrlConstants.STATE_PROJECT_NOTICE_DELETE) |
| | | @ApiOperation(value = "删除公告", notes = "删除公告") |
| | | public AjaxResult<Boolean> deleteNotice(@PathVariable String id) { |
| | | return AjaxResult.success(stateProjectNoticeService.removeById(id)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_NOTICE_ADD) |
| | | @ApiOperation(value = "新增公告", notes = "新增公告") |
| | | public AjaxResult<Boolean> addNotice(@RequestBody UpdateProjectAndAddNoticeBO updateProjectAndAddNoticeBO) { |
| | | StateProjectNotice stateProjectNotice = StateProjectConvert.INSTANCE.updateProjectAndAddNoticeBOToEntity(updateProjectAndAddNoticeBO); |
| | | if (Objects.nonNull(updateProjectAndAddNoticeBO.getFileBOList()) && !CollectionUtils.isEmpty(updateProjectAndAddNoticeBO.getFileBOList())) { |
| | | stateProjectNotice.setFileUrl(JSON.toJSONString(updateProjectAndAddNoticeBO.getFileBOList())); |
| | | } |
| | | if (Objects.nonNull(updateProjectAndAddNoticeBO.getImgBOList()) && !CollectionUtils.isEmpty(updateProjectAndAddNoticeBO.getImgBOList())) { |
| | | stateProjectNotice.setImgUrl(JSON.toJSONString(updateProjectAndAddNoticeBO.getImgBOList())); |
| | | } |
| | | //1 正常公告 2转征收的公告 |
| | | stateProjectNotice.setType(1); |
| | | |
| | | return AjaxResult.success(stateProjectNoticeService.saveOrUpdate(stateProjectNotice)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_PROJECT_IMPL_PAGE) |
| | | @ApiOperation(value = "项目实施查询", notes = "项目实施查询") |
| | | public AjaxResult<PageInfo<ProjectImplPageVO>> projectImplPage(@RequestBody GetProjectPageBO getProjectPageBO) { |
| | | |
| | | |
| | | return AjaxResult.success(stateProjectService.getProjectImplPage(getProjectPageBO)); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.zzg.web.controller.state; |
| | | |
| | | import com.alibaba.excel.EasyExcelFactory; |
| | | import com.alibaba.excel.write.builder.ExcelWriterBuilder; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.zzg.common.constant.state.UrlConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.state.StateSettlement; |
| | | import com.zzg.common.core.domain.entity.system.SysDept; |
| | | import com.zzg.common.enums.SettledProcessEnum; |
| | | import com.zzg.common.enums.SubmitStatusEnum; |
| | | import com.zzg.common.exception.GlobalException; |
| | | import com.zzg.common.utils.file.FileUtils; |
| | | import com.zzg.system.convert.StateProjectConvert; |
| | | import com.zzg.system.convert.easyExcel.MultiDropdownWriteHandler; |
| | | import com.zzg.system.domain.bo.*; |
| | | import com.zzg.system.domain.vo.*; |
| | | import com.zzg.system.service.state.StateHouseholdService; |
| | | import com.zzg.system.service.state.StateSettlementService; |
| | | import com.zzg.system.service.system.ISysDeptService; |
| | | import com.zzg.web.core.enums.TemplateFileTypeEnum; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.lang.reflect.Method; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.zzg.system.service.state.impl.StateSettlementImpl.extractNumber; |
| | | |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @Slf4j |
| | | public class StateSettlementController { |
| | | |
| | | private final StateSettlementService settlementService; |
| | | private final StateHouseholdService stateHouseholdService; |
| | | private final ISysDeptService deptService; |
| | | |
| | | @PostMapping(UrlConstants.STATE_SETTLEMENT_SAVE) |
| | | public AjaxResult<List<StateSettlement>> saveSettlement(@RequestBody List<StateSettlement> stateSettlement) { |
| | | settlementService.saveOrUpdateSettlement(stateSettlement); |
| | | return AjaxResult.success(stateSettlement); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_SETTLEMENT_DEL) |
| | | public AjaxResult<Boolean> delSettlement(@RequestParam String settlementId) { |
| | | settlementService.deleteSettlement(settlementId); |
| | | return AjaxResult.success(true); |
| | | } |
| | | |
| | | //安置详情 |
| | | @PostMapping(UrlConstants.STATE_SETTLEMENT_DETAIL_LIST) |
| | | public AjaxResult<SettlementDetailPageVO> listSettlementDetail(@RequestBody SettlementDetailBO settlementBO) { |
| | | return AjaxResult.success(settlementService.listDetailData(settlementBO)); |
| | | } |
| | | |
| | | //安置详情 |
| | | @PostMapping(UrlConstants.STATE_SETTLEMENT_DETAIL_UPDATE_LIST) |
| | | public AjaxResult<SettlementDetailPageVO> listSettlementDetailUpdate(@RequestBody SettlementDetailBO settlementBO) { |
| | | return AjaxResult.success(settlementService.listDetailUpdateData(settlementBO)); |
| | | } |
| | | |
| | | //外层项目实施数据 |
| | | @GetMapping(UrlConstants.STATE_SETTLEMENT_SUM) |
| | | public AjaxResult<SettlementSumVO> sumSettled(@RequestParam String projectId) { |
| | | return AjaxResult.success(settlementService.sumSettleData(projectId)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_SETTLEMENT_LIST) |
| | | public AjaxResult<PageInfo<HouseholdVO>> listSettlement(@RequestBody SettlementBO settlementBO) { |
| | | return AjaxResult.success(settlementService.listSettleData(settlementBO)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_SETTLEMENT_EXPORT) |
| | | public AjaxResult<Void> exportSettlement(@RequestBody SettlementBO settlementBO, HttpServletResponse response) { |
| | | try { |
| | | List<HouseholdVO> result = settlementService.exportSettleData(settlementBO, response); |
| | | |
| | | if (Objects.equals(settlementBO.getIsSettled(), SettledProcessEnum.NOT_SETTLE.getValue())) { |
| | | List<NotResettlementHouseholdExportVO> exportVOList = StateProjectConvert.INSTANCE.toNotResettlementHouseholdExportVO(result); |
| | | List<String> deptIdList = exportVOList.stream() |
| | | .map(NotResettlementHouseholdExportVO::getDeptId) |
| | | .collect(Collectors.toList()); |
| | | Map<String, SysDept> stringSysDeptMap = deptService.selectMapDeptById(deptIdList); |
| | | Collections.reverse(exportVOList); |
| | | for (int i = 0; i < exportVOList.size(); i++) { |
| | | NotResettlementHouseholdExportVO exportVO = exportVOList.get(i); |
| | | if (StringUtils.isNoneBlank(exportVO.getAgreeMoveStr())) { |
| | | if (exportVO.getAgreeMoveStr().contains("同意")) { |
| | | exportVO.setAgreeMoveStr("是"); |
| | | } else if (exportVO.getAgreeMoveStr().contains("拒绝")) { |
| | | exportVO.setAgreeMoveStr("否"); |
| | | } |
| | | } else { |
| | | exportVO.setAgreeMoveStr("否"); |
| | | } |
| | | exportVO.setIndex(String.valueOf(i + 1)); |
| | | SysDept sysDept = stringSysDeptMap.get(exportVO.getDeptId()); |
| | | if (Objects.nonNull(sysDept)) { |
| | | exportVO.setBelongingStreetTown(sysDept.getDeptName()); |
| | | } |
| | | } |
| | | |
| | | FileUtils.setExcelResponseHeader(response, "未安置情况导出.xlsx"); |
| | | EasyExcelFactory.write(response.getOutputStream(), NotResettlementHouseholdExportVO.class) |
| | | .sheet("sheet") |
| | | .doWrite(exportVOList); |
| | | } else if (Objects.equals(settlementBO.getIsSettled(), SettledProcessEnum.SETTLE.getValue())) { |
| | | List<ResettlementHouseholdExportVO> exportVOList = StateProjectConvert.INSTANCE.toResettlementHouseholdExportVO(result); |
| | | List<String> deptIdList = exportVOList.stream() |
| | | .map(ResettlementHouseholdExportVO::getDeptId) |
| | | .collect(Collectors.toList()); |
| | | Map<String, SysDept> stringSysDeptMap = deptService.selectMapDeptById(deptIdList); |
| | | exportVOList.sort((o1, o2) -> { |
| | | int num1 = extractNumber(o1.getSettleName()); |
| | | int num2 = extractNumber(o2.getSettleName()); |
| | | return Integer.compare(num1, num2); |
| | | }); |
| | | // Collections.reverse(exportVOList); |
| | | for (int i = 0; i < exportVOList.size(); i++) { |
| | | ResettlementHouseholdExportVO exportVO = exportVOList.get(i); |
| | | if (StringUtils.isNoneBlank(exportVO.getAgreeMoveStr())) { |
| | | if (exportVO.getAgreeMoveStr().contains("同意")) { |
| | | exportVO.setAgreeMoveStr("是"); |
| | | } else if (exportVO.getAgreeMoveStr().contains("拒绝")) { |
| | | exportVO.setAgreeMoveStr("否"); |
| | | } |
| | | } else { |
| | | exportVO.setAgreeMoveStr("否"); |
| | | } |
| | | exportVO.setIndex(String.valueOf(i + 1)); |
| | | exportVO.setSettleStatusStr(SubmitStatusEnum.getTextByValue(exportVO.getSettleStatus())); |
| | | SysDept sysDept = stringSysDeptMap.get(exportVO.getDeptId()); |
| | | if (Objects.nonNull(sysDept)) { |
| | | exportVO.setBelongingStreetTown(sysDept.getDeptName()); |
| | | } |
| | | } |
| | | |
| | | FileUtils.setExcelResponseHeader(response, "已安置情况导出.xlsx"); |
| | | EasyExcelFactory.write(response.getOutputStream(), ResettlementHouseholdExportVO.class) |
| | | .sheet("sheet") |
| | | .doWrite(exportVOList); |
| | | } |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | return AjaxResult.success(); |
| | | } catch (IOException e) { |
| | | return AjaxResult.error(); |
| | | } |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_SETTLEMENT_IMPORT_TEMPLATE) |
| | | public void importStateHouseholdTemplate(@RequestParam Integer compensationType, HttpServletResponse response) { |
| | | |
| | | try { |
| | | TemplateFileTypeEnum pathByFileType; |
| | | if (1 == compensationType) { |
| | | pathByFileType = TemplateFileTypeEnum.getEnumByFileType(4); |
| | | } else if (2 == compensationType) { |
| | | pathByFileType = TemplateFileTypeEnum.getEnumByFileType(7); |
| | | } else { |
| | | throw new GlobalException("补偿类型错误"); |
| | | } |
| | | Method generateExampleDataMethod = pathByFileType.getClazz().getMethod("generateExampleData"); |
| | | Method generateHeaderDataMethod = pathByFileType.getClazz().getMethod("generateHeaderData"); |
| | | Object exampleData = generateExampleDataMethod.invoke(null); |
| | | Object headerData = generateHeaderDataMethod.invoke(null); |
| | | |
| | | FileUtils.setExcelResponseHeader(response, pathByFileType.getFileName()); |
| | | ExcelWriterBuilder write = EasyExcelFactory.write(response.getOutputStream(), pathByFileType.getClazz()); |
| | | if (Objects.nonNull(headerData)) { |
| | | write.registerWriteHandler((MultiDropdownWriteHandler) headerData); |
| | | } |
| | | write.sheet("sheet") |
| | | .doWrite(Collections.singletonList(exampleData)); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | } catch (Exception e) { |
| | | log.error("下载文件失败", e); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping(UrlConstants.STATE_SETTLEMENT_IMPORT) |
| | | public AjaxResult<Void> importSettlement(ImportSettlementBO importSettlementBO) throws IOException { |
| | | |
| | | settlementService.stateSettlementImport(importSettlementBO); |
| | | return AjaxResult.success(); |
| | | |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_SETTLEMENT_LIST_EXPORT) |
| | | public AjaxResult<Void> exportSettlementDetail(@RequestBody(required = false) StateExecutionBO executionBO, HttpServletResponse response) { |
| | | try { |
| | | List<StateExecutionDetailVO> exportVOList = settlementService.exportExecution(executionBO); |
| | | List<StateExecutionDetailExportVO> detailExportVOList = StateProjectConvert.INSTANCE.toExportVO(exportVOList); |
| | | |
| | | FileUtils.setExcelResponseHeader(response, "实施明细.xlsx"); |
| | | |
| | | EasyExcelFactory.write(response.getOutputStream(), StateExecutionDetailExportVO.class) |
| | | .sheet("sheet") |
| | | .doWrite(detailExportVOList); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | return AjaxResult.success(); |
| | | } catch (IOException e) { |
| | | return AjaxResult.error(); |
| | | } |
| | | } |
| | | |
| | | |
| | | //项目实施明细 |
| | | @PostMapping(UrlConstants.STATE_EXECUTION_DETAIL) |
| | | public AjaxResult<PageInfo<StateExecutionDetailVO>> listExecution(@RequestBody(required = false) StateExecutionBO executionBO) { |
| | | return AjaxResult.success(settlementService.listExecution(executionBO)); |
| | | } |
| | | |
| | | //给项目展示使用 |
| | | @PostMapping(UrlConstants.STATE_EXECUTION_SUM) |
| | | public AjaxResult<Map<String, Map<Integer, ProjectExecutionSumVO>>> listProjectExecution(@RequestBody List<String> projectIdList) { |
| | | return AjaxResult.success(settlementService.listProjectExecutionByProjectId(projectIdList, null)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_SETTLEMENT_EXECUTION_WORKFLOW_SUBMIT) |
| | | public AjaxResult<Boolean> submitSettle(@RequestBody WorkFlowSubmitBO workFlowSubmitBO) { |
| | | if (Objects.isNull(workFlowSubmitBO.getSettlementIdList()) || workFlowSubmitBO.getSettlementIdList().isEmpty()) { |
| | | return AjaxResult.success(false); |
| | | } |
| | | List<StateSettlement> agreementList = settlementService.listByIds(workFlowSubmitBO.getSettlementIdList()); |
| | | if (CollectionUtils.isEmpty(agreementList)) { |
| | | return AjaxResult.success(false); |
| | | } |
| | | agreementList.forEach(stateAgreement -> { |
| | | //需要显示文件名,直接存json |
| | | stateAgreement.setSettleName(workFlowSubmitBO.getBatchName()); |
| | | stateAgreement.setFileUrl(workFlowSubmitBO.getFileBO()); |
| | | stateAgreement.setAuditStatus(SubmitStatusEnum.PENDING_REVIEW.getValue()); |
| | | }); |
| | | settlementService.workflowSubmit(workFlowSubmitBO.getSettlementIdList()); |
| | | return AjaxResult.success(settlementService.saveOrUpdateBatch(agreementList)); |
| | | } |
| | | |
| | | /** |
| | | * @param projectId |
| | | * @param componsationType 前端传 “null” 无办法 |
| | | * @return |
| | | */ |
| | | @GetMapping(UrlConstants.STATE_SETTLEMENT_GENERATE_SETTLE_BATCH) |
| | | public AjaxResult<String> generateSettleBatch(@RequestParam String projectId, @RequestParam(required = false) String componsationType) { |
| | | return AjaxResult.success(settlementService.generateBatchName(projectId, componsationType)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_SETTLEMENT_BATCH_NAME_LIST) |
| | | public AjaxResult<List<String>> listBatchName(@RequestParam String projectId) { |
| | | return AjaxResult.success(settlementService.listBatchName(projectId)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.zzg.web.controller.state.householdQuery; |
| | | |
| | | |
| | | import com.alibaba.excel.EasyExcelFactory; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.zzg.common.constant.state.UrlConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.state.StateHousehold; |
| | | import com.zzg.common.enums.HouseMoveEnum; |
| | | import com.zzg.common.enums.HouseSearchStatusEnum; |
| | | import com.zzg.common.enums.HouseUsingTypeEnum; |
| | | import com.zzg.common.enums.StateHouseholdStageEnums; |
| | | import com.zzg.common.exception.GlobalException; |
| | | import com.zzg.common.utils.file.FileUtils; |
| | | import com.zzg.system.convert.StateProjectConvert; |
| | | import com.zzg.system.domain.bo.CalculateCompensationBO; |
| | | import com.zzg.system.domain.bo.HouseQueryBO; |
| | | import com.zzg.system.domain.bo.HouseholdBO; |
| | | import com.zzg.system.domain.bo.StateHouseholdBO; |
| | | import com.zzg.system.domain.vo.*; |
| | | import com.zzg.system.service.state.StateHouseholdService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateHouseholdController { |
| | | |
| | | private final StateHouseholdService stateHouseholdService; |
| | | |
| | | // 分页查询 |
| | | @GetMapping(UrlConstants.STATA_HOUSEHOLD_PAGE) |
| | | public AjaxResult<Page<StateHousehold>> page(@RequestParam int currentPage, @RequestParam int pageSize) { |
| | | return AjaxResult.success(stateHouseholdService.page(new Page<>(currentPage, pageSize))); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_HOUSEHOLD_LIST_BY_CONDITION) |
| | | public AjaxResult<HouseholdDetailVO> list(@RequestBody(required = false) HouseholdBO householdBOBody) { |
| | | return AjaxResult.success(stateHouseholdService.queryList(householdBOBody)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_HOUSEHOLD_QUERY) |
| | | public AjaxResult<PageInfo<HouseQueryVO>> houseQuery(@RequestBody HouseQueryBO houseQueryBO) { |
| | | return AjaxResult.success(stateHouseholdService.queryData(houseQueryBO)); |
| | | } |
| | | |
| | | |
| | | @PostMapping(UrlConstants.STATE_HOUSEHOLD_LIST_EXPORT) |
| | | public AjaxResult<HouseholdDetailVO> export(@RequestBody(required = false) HouseholdBO householdBOBody, HttpServletResponse response) throws IOException { |
| | | householdBOBody.setPageNum(1); |
| | | householdBOBody.setPageSize(5000); |
| | | HouseholdDetailVO householdDetailVO = stateHouseholdService.queryList(householdBOBody); |
| | | PageInfo<HouseholdVO> householdVOS = householdDetailVO.getHouseholdVOS(); |
| | | if (Objects.isNull(householdVOS)) { |
| | | throw new GlobalException("当前项目没有房产数据"); |
| | | } |
| | | List<HouseholdVO> list = householdVOS.getList(); |
| | | List<StateHouseholdExportVO> exportVOList = StateProjectConvert.INSTANCE.toStateHouseholdExportVO(list); |
| | | for (int i = 0; i < exportVOList.size(); i++) { |
| | | StateHouseholdExportVO e = exportVOList.get(i); |
| | | e.setIndex(String.valueOf(i + 1)); |
| | | e.setHouseUsingTypeStr(HouseUsingTypeEnum.getText(e.getHouseUsingType())); |
| | | if (Objects.nonNull(e.getAgreeMove())) { |
| | | e.setAgreeMoveStr(HouseMoveEnum.getText(e.getAgreeMove())); |
| | | if (e.getAgreeMoveStr().contains("同意")) { |
| | | e.setAgreeMoveStr("是"); |
| | | } else if (e.getAgreeMoveStr().contains("拒绝")) { |
| | | e.setAgreeMoveStr("否"); |
| | | } |
| | | } else { |
| | | e.setAgreeMoveStr("-"); |
| | | } |
| | | } |
| | | |
| | | FileUtils.setExcelResponseHeader(response, "房产导出.xlsx"); |
| | | |
| | | EasyExcelFactory.write(response.getOutputStream(), StateHouseholdExportVO.class) |
| | | .sheet("sheet") |
| | | .doWrite(exportVOList); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_HOUSEHOLD_LIST_IMPORT) |
| | | public AjaxResult<Boolean> importStateHousehold(@RequestParam("file") MultipartFile file, String projectId) { |
| | | |
| | | return AjaxResult.success(stateHouseholdService.importStateHousehold(file, projectId)); |
| | | } |
| | | |
| | | //展示房屋用途 |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_USING_TYPE_LIST) |
| | | public AjaxResult<List<HouseUsingTypeVO>> usingTypeList() { |
| | | Set<HouseUsingTypeEnum> houseTypeSet = EnumSet.allOf(HouseUsingTypeEnum.class); |
| | | List<HouseUsingTypeVO> houseUsingTypeVOS = new ArrayList<>(); |
| | | houseTypeSet.forEach(data -> { |
| | | HouseUsingTypeVO houseUsingTypeVO = new HouseUsingTypeVO(); |
| | | houseUsingTypeVO.setName(data.getText()); |
| | | houseUsingTypeVO.setValue(data.getValue()); |
| | | houseUsingTypeVOS.add(houseUsingTypeVO); |
| | | }); |
| | | return AjaxResult.success(houseUsingTypeVOS); |
| | | } |
| | | |
| | | // 根据ID查询项目 |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_GET_BY_ID) |
| | | public AjaxResult<StateHouseholdVO> getById(@RequestParam String id) { |
| | | return AjaxResult.success(stateHouseholdService.getStateHouseholdInfo(id)); |
| | | } |
| | | |
| | | // 创建项目 |
| | | @PostMapping(UrlConstants.STATE_HOUSEHOLD_CREATE) |
| | | public AjaxResult<StateHouseholdBO> create(@RequestBody StateHouseholdBO household) { |
| | | |
| | | return AjaxResult.success(stateHouseholdService.createAndUpdateHouse(household)); |
| | | } |
| | | |
| | | |
| | | // 删除项目 |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_DELETE) |
| | | public AjaxResult<Boolean> delete(@RequestParam String id) { |
| | | return AjaxResult.success(stateHouseholdService.removeById(id)); |
| | | } |
| | | |
| | | //安置情况数据统计 |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_SUM) |
| | | public AjaxResult<Void> sumHouseholdData(@RequestParam String stateProjectId) { |
| | | stateHouseholdService.sumHouseholdData(stateProjectId); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | //协议提交审核 修改房产状态 |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_WORKFLOW_SUBMIT) |
| | | public AjaxResult<Boolean> submit(@RequestParam String projectId, @RequestParam Integer category) { |
| | | stateHouseholdService.submitHouseHoldAudit(projectId, category); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_STREET_LIST) |
| | | public AjaxResult<List<JSONObject>> listHouseStreet(@RequestParam String projectId) { |
| | | return AjaxResult.success(stateHouseholdService.listStreet(projectId)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_COMPLETE_SEARCH) |
| | | public AjaxResult<Boolean> completeSearch(@RequestParam String houseId, |
| | | @RequestParam Integer searchStatus) { |
| | | StateHousehold stateHousehold = stateHouseholdService.getById(houseId); |
| | | if (Objects.isNull(stateHousehold)) { |
| | | throw new GlobalException("该房产数据不存在"); |
| | | } |
| | | stateHousehold.setSearchStatus(searchStatus); |
| | | if (Objects.equals(stateHousehold.getStage(), StateHouseholdStageEnums.SIMULATE.getValue())) { |
| | | stateHousehold.setStage(StateHouseholdStageEnums.SIMULATE_SUCCESS.getValue()); |
| | | } |
| | | //撤回 |
| | | if(searchStatus == 0){ |
| | | CalculateCompensationBO calculateCompensationBO = new CalculateCompensationBO(); |
| | | if (Objects.nonNull(stateHousehold.getAppendData()) && StringUtils.isNotBlank(stateHousehold.getAppendData())) { |
| | | calculateCompensationBO = JSON.parseObject(stateHousehold.getAppendData(), CalculateCompensationBO.class); |
| | | if (Objects.nonNull(calculateCompensationBO.getSurveyResultRegistrationBO())) { |
| | | calculateCompensationBO.getSurveyResultRegistrationBO().setIsAgree(null); |
| | | calculateCompensationBO.getSurveyResultRegistrationBO().setIsConfirm(null); |
| | | } |
| | | } |
| | | LambdaUpdateWrapper<StateHousehold> stateHouseholdUpdateWrapper = new LambdaUpdateWrapper<>(); |
| | | stateHouseholdUpdateWrapper.eq(StateHousehold::getId, houseId); |
| | | stateHouseholdUpdateWrapper.set(StateHousehold::getAgreeMove, null); |
| | | stateHouseholdUpdateWrapper.set(StateHousehold::getAppendData, JSON.toJSONString(calculateCompensationBO)); |
| | | stateHouseholdService.update(stateHouseholdUpdateWrapper); |
| | | stateHousehold = stateHouseholdService.getById(houseId); |
| | | stateHousehold.setSearchStatus(searchStatus); |
| | | } |
| | | return AjaxResult.success(stateHouseholdService.saveOrUpdate(stateHousehold)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_MOBILE_BACK) |
| | | public AjaxResult<Boolean> mobileBack(@RequestParam String houseId) { |
| | | return AjaxResult.success(stateHouseholdService.mobileBack(houseId)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.state.householdQuery; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.zzg.common.constant.state.UrlConstants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.state.StateHouseholdOwner; |
| | | import com.zzg.common.core.domain.entity.state.StateProjectCompensateStandard; |
| | | import com.zzg.common.enums.HelpTypeEnum; |
| | | import com.zzg.system.domain.bo.CalculateCompensationBO; |
| | | import com.zzg.system.domain.bo.StateHouseholdOwnerBO; |
| | | import com.zzg.system.domain.vo.CalculateCompensationVO; |
| | | import com.zzg.system.service.state.StateHouseholdOwnerService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class StateHouseholdOwnerController { |
| | | |
| | | private final StateHouseholdOwnerService householdOwnerService; |
| | | |
| | | |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_OWNER_LIST_BY_SATE_HOUSEHOLD_ID) |
| | | public AjaxResult<Object> listPersons(@RequestParam String stateHouseholdId) { |
| | | JSONObject jsonObject = householdOwnerService.getPersonsInfo(stateHouseholdId); |
| | | return AjaxResult.success(jsonObject); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_HOUSEHOLD_OWNER_SAVE) |
| | | public AjaxResult<Boolean> savePerson(@RequestBody StateHouseholdOwnerBO person) { |
| | | List<StateHouseholdOwner> ownerBOList = person.getOwnerBOList(); |
| | | ownerBOList.forEach(e -> { |
| | | //修改当对象重新修改为不是救助对象时删除救助类型 |
| | | e.setHelpType(person.getHelpType()); |
| | | if (Objects.equals(person.getIsHelp(), HelpTypeEnum.NOT_HELP_PERSON.getValue())) { |
| | | e.setHelpType(""); |
| | | } |
| | | e.setIsHelp(person.getIsHelp()); |
| | | e.setCompensationType(person.getCompensationType()); |
| | | e.setAppendData(person.getAppendData()); |
| | | } |
| | | ); |
| | | return AjaxResult.success(householdOwnerService.saveOrUpdateBatch(ownerBOList)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_HOUSEHOLD_OWNER_UPDATE) |
| | | public AjaxResult<Boolean> updatePerson(@RequestBody StateHouseholdOwner stateHouseholdOwner) { |
| | | //查询当前项目下所有的 |
| | | List<StateHouseholdOwner> list = householdOwnerService.list(Wrappers.<StateHouseholdOwner>lambdaQuery() |
| | | .eq(StateHouseholdOwner::getStateHouseholdId, stateHouseholdOwner.getStateHouseholdId())); |
| | | if (ObjectUtil.isNotEmpty(list)) { |
| | | list.forEach(e -> { |
| | | //修改当对象重新修改为不是救助对象时删除救助类型 |
| | | e.setHelpType(stateHouseholdOwner.getHelpType()); |
| | | if (Objects.equals(stateHouseholdOwner.getIsHelp(), HelpTypeEnum.NOT_HELP_PERSON.getValue())) { |
| | | e.setHelpType(null); |
| | | } |
| | | e.setIsHelp(stateHouseholdOwner.getIsHelp()); |
| | | e.setCompensationType(stateHouseholdOwner.getCompensationType()); |
| | | e.setAppendData(stateHouseholdOwner.getAppendData()); |
| | | } |
| | | ); |
| | | householdOwnerService.saveOrUpdateBatch(list); |
| | | } |
| | | householdOwnerService.saveOrUpdate(stateHouseholdOwner); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_OWNER_DELETE) |
| | | public AjaxResult<Boolean> deletePerson(@RequestParam String stateHouseholdOwnerId) { |
| | | return AjaxResult.success(householdOwnerService.removeById(stateHouseholdOwnerId)); |
| | | } |
| | | |
| | | @PostMapping(UrlConstants.STATE_HOUSEHOLD_OWNER_CALCULATE_COMPENSATION) |
| | | @ApiOperation(value = "计算入户补偿的预估数据", notes = "计算入户补偿的预估数据") |
| | | public AjaxResult<CalculateCompensationVO> calculateCompensation(@RequestBody CalculateCompensationBO calculateCompensationBO) { |
| | | calculateCompensationBO.setIsFirst(true); |
| | | return AjaxResult.success(householdOwnerService.calculateCompensation(calculateCompensationBO)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_OWNER_GET_CALCULATE_COMPENSATION) |
| | | @ApiOperation(value = "获取计算入户补偿的标准", notes = "获取计算入户补偿的标准") |
| | | public AjaxResult<List<StateProjectCompensateStandard>> getCalculateCompensation(@RequestParam(required = false) String projectId) { |
| | | |
| | | if (StringUtils.isBlank(projectId)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | return AjaxResult.success(householdOwnerService.getCalculateCompensation(projectId)); |
| | | } |
| | | |
| | | @GetMapping(UrlConstants.STATE_HOUSEHOLD_OWNER_GET_CALCULATE_COMPENSATION_WEB) |
| | | @ApiOperation(value = "web获取计算入户补偿的标准", notes = "获取计算入户补偿的标准") |
| | | public AjaxResult<Map<String, List<StateProjectCompensateStandard>>> getWebCalculateCompensation(@RequestParam String projectId) { |
| | | List<StateProjectCompensateStandard> calculateCompensation = householdOwnerService.getCalculateCompensation(projectId); |
| | | // 使用 groupingBy 并将键转换为 String |
| | | Map<String, List<StateProjectCompensateStandard>> collect = calculateCompensation.stream() |
| | | .collect(Collectors.groupingBy( |
| | | standard -> String.valueOf(standard.getCategory()) |
| | | )); |
| | | return AjaxResult.success(collect); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.utils.SecurityUtils; |
| | | import com.zzg.system.domain.SysCity; |
| | | import com.zzg.system.service.system.ISysCityService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @Api(tags = "镇村组数据") |
| | | @RequestMapping("/system/city") |
| | | public class SysCityController extends BaseController { |
| | | |
| | | @Resource |
| | | ISysCityService sysCityService; |
| | | |
| | | private static Integer DEFAULT_LEVEl = 1; |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("新增数据") |
| | | @PreAuthorize("@ss.hasPermi('system:city:add')") |
| | | public AjaxResult add(@RequestBody SysCity sysCity) { |
| | | if (sysCity.getId() != null) { |
| | | SysCity group = sysCityService.getById(sysCity.getId()); |
| | | if (group.getState().equals(1)) { |
| | | return AjaxResult.error("撤销/合并的数据不能修改!"); |
| | | } |
| | | sysCityService.updateById(sysCity); |
| | | } else { |
| | | SysCity group = sysCityService.getOne(new LambdaQueryWrapper<SysCity>() |
| | | .eq(sysCity.getPid() != null && !sysCity.getPid().isEmpty(), SysCity::getPid, sysCity.getPid()) |
| | | .eq(SysCity::getName, sysCity.getName())); |
| | | if (group != null) { |
| | | return AjaxResult.error("当前级别下" + sysCity.getName() + "已存在!"); |
| | | } |
| | | //设置级别 |
| | | if (sysCity.getPid() != null && !sysCity.getPid().equals("")) { |
| | | group = sysCityService.getOne(new LambdaQueryWrapper<SysCity>() |
| | | .eq(SysCity::getId, sysCity.getPid())); |
| | | sysCity.setLevel(group.getLevel() + 1); |
| | | } else { |
| | | sysCity.setLevel(DEFAULT_LEVEl); |
| | | } |
| | | sysCity.setCreateName(SecurityUtils.getUsername()); |
| | | } |
| | | sysCityService.saveOrUpdate(sysCity); |
| | | return AjaxResult.success(sysCity); |
| | | } |
| | | |
| | | @GetMapping("/getListTree") |
| | | @ApiOperation("树形列表") |
| | | @PreAuthorize("@ss.hasPermi('system:city:getListTree')") |
| | | public AjaxResult getListTree() { |
| | | return AjaxResult.success(sysCityService.getListTree()); |
| | | } |
| | | |
| | | /** |
| | | * 通过ID向上查询整个镇村组名称 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("/getUpwardById/{id}") |
| | | @ApiOperation("通过ID向上查询整个镇村组名称") |
| | | public AjaxResult getUpwardById(@PathVariable("id") String id) { |
| | | return AjaxResult.success(sysCityService.getUpwardById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有乡镇 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/getTowns") |
| | | @ApiOperation("获取所有乡镇") |
| | | // @PreAuthorize("@ss.hasPermi('system:city:getTowns')") |
| | | public AjaxResult getTowns() { |
| | | List<SysCity> list; |
| | | try { |
| | | list = sysCityService.getTowns(); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | /** |
| | | * 原始表 |
| | | * |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | @GetMapping("/getNextTree/{pid}") |
| | | @ApiOperation("通过上级ID获取下面的树形") |
| | | @PreAuthorize("@ss.hasPermi('system:city:getNextTree')") |
| | | public AjaxResult getNextTree(@PathVariable("pid") String pid) { |
| | | return AjaxResult.success(sysCityService.getNextTree(pid)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.poi.ExcelUtil; |
| | | import com.zzg.system.domain.SysConfig; |
| | | import com.zzg.system.service.system.ISysConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 参数配置 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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 String 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 String[] 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(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.constant.UserConstants; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.system.SysDept; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.system.service.system.ISysDeptService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 部门信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dept") |
| | | @Api(tags = "部门管理") |
| | | public class SysDeptController extends BaseController { |
| | | @Resource |
| | | private ISysDeptService deptService; |
| | | |
| | | @PostMapping("/listByCity") |
| | | @ApiOperation(value = "通过行政区划查询对应的部门") |
| | | public AjaxResult listByCity(@RequestParam("cityIds") List<String> cityIds) { |
| | | List<SysDept> deptList = deptService.list(new LambdaQueryWrapper<SysDept>().in(SysDept::getCityId, cityIds).eq(SysDept::getDelFlag, "0").eq(SysDept::getStatus, "0")); |
| | | return success(deptList); |
| | | } |
| | | |
| | | /** |
| | | * 获取部门列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取部门列表") |
| | | public AjaxResult list(SysDept dept) { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return success(depts); |
| | | } |
| | | |
| | | /** |
| | | * 查询部门列表(排除节点) |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list/exclude/{deptId}") |
| | | @ApiOperation(value = "查询部门列表(排除节点)") |
| | | public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) String deptId) { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | depts.removeIf(d -> d.getDeptId().equals(deptId) || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | | return success(depts); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:query')") |
| | | @GetMapping(value = "/{deptId}") |
| | | @ApiOperation(value = "根据部门编号获取详细信息") |
| | | public AjaxResult getInfo(@PathVariable String deptId) { |
| | | deptService.checkDeptDataScope(deptId); |
| | | return success(deptService.selectDeptById(deptId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增部门 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:add')") |
| | | @Log(title = "部门管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @ApiOperation(value = "新增部门") |
| | | 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 |
| | | @ApiOperation(value = "修改部门") |
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept) { |
| | | String 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 (UserConstants.DEPT_DISABLE.equals(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}") |
| | | @ApiOperation(value = "删除部门") |
| | | public AjaxResult remove(@PathVariable String deptId) { |
| | | if (deptService.hasChildByDeptId(deptId)) { |
| | | return warn("存在下级部门,不允许删除"); |
| | | } |
| | | if (deptService.checkDeptExistUser(deptId)) { |
| | | return warn("部门存在用户,不允许删除"); |
| | | } |
| | | deptService.checkDeptDataScope(deptId); |
| | | return toAjax(deptService.deleteDeptById(deptId)); |
| | | } |
| | | |
| | | /** |
| | | * 获取部门树列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/deptTree") |
| | | @ApiOperation(value = "获取部门树列表") |
| | | public AjaxResult deptTree(SysDept dept) { |
| | | return success(deptService.selectDeptTreeList(dept)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:user:deptTreeNew')") |
| | | @GetMapping("/deptTreeNew") |
| | | @ApiOperation(value = "获取部门树列表(新)") |
| | | public AjaxResult deptTreeNew() { |
| | | return success(deptService.deptTreeNew()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.system.SysDictData; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.common.utils.poi.ExcelUtil; |
| | | import com.zzg.system.service.system.ISysDictDataService; |
| | | import com.zzg.system.service.system.ISysDictTypeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Api(tags = "数据字典") |
| | | @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); |
| | | } |
| | | |
| | | @ApiOperation("字典数据列表") |
| | | @GetMapping("/newList") |
| | | public AjaxResult newList(SysDictData dictData) { |
| | | return AjaxResult.success( dictDataService.getList(dictData)); |
| | | } |
| | | |
| | | @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 String 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 String[] dictCodes) { |
| | | dictDataService.deleteDictDataByIds(dictCodes); |
| | | return success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.system.SysDictType; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.poi.ExcelUtil; |
| | | import com.zzg.system.service.system.ISysDictTypeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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 String 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 String[] 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); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.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.zzg.common.config.RuoYiConfig; |
| | | import com.zzg.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 首页 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | public class SysIndexController |
| | | { |
| | | /** 系统基础配置 */ |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | |
| | | /** |
| | | * 访问首页,提示语 |
| | | */ |
| | | @RequestMapping("/") |
| | | public String index() |
| | | { |
| | | return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.system.domain.SysLayer; |
| | | import com.zzg.system.domain.vo.SysLayerVo; |
| | | import com.zzg.system.service.system.ISysLayerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.dao.DataIntegrityViolationException; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 图层管理接口 |
| | | */ |
| | | @Api(tags = "图层管理") |
| | | @RestController |
| | | @RequestMapping("/layer") |
| | | public class SysLayerController { |
| | | @Resource |
| | | ISysLayerService sysLayerService; |
| | | |
| | | @ApiOperation(value = "添加图层") |
| | | @PostMapping(value = "/addLayer") |
| | | public AjaxResult addLayer(@RequestBody SysLayer layer) { |
| | | if (layer == null) { |
| | | throw new RuntimeException("获取数据失败"); |
| | | } |
| | | if (layer.getName().contains("-")) { |
| | | return AjaxResult.error(""); |
| | | } |
| | | |
| | | sysLayerService.save(layer); |
| | | return AjaxResult.success(layer); |
| | | } |
| | | |
| | | @ApiOperation(value = "更新图层") |
| | | @PostMapping(value = "/updateLayer") |
| | | public AjaxResult updateLayer(@RequestBody SysLayer layer) { |
| | | if (layer == null) { |
| | | throw new RuntimeException(""); |
| | | } |
| | | if (StringUtils.isEmpty(StringUtils.trim(layer.getId().toString()))) { |
| | | return AjaxResult.error(""); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(StrUtil.trim(layer.getName()))) { |
| | | return AjaxResult.error(""); |
| | | } |
| | | if (layer.getName().contains("-")) { |
| | | return AjaxResult.error(""); |
| | | } |
| | | try { |
| | | sysLayerService.updateById(layer); |
| | | } catch (DataIntegrityViolationException e) { |
| | | throw new RuntimeException(""); |
| | | } |
| | | return AjaxResult.success(layer); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除图层") |
| | | @DeleteMapping(value = "/delLayer/{id}") |
| | | public AjaxResult delLayer(@NotEmpty(message = "id不为空") @PathVariable String id) { |
| | | try { |
| | | sysLayerService.delLayer(id); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | return AjaxResult.success("删除成功"); |
| | | } |
| | | |
| | | /** |
| | | * 图层树 |
| | | */ |
| | | @GetMapping("/layerTree") |
| | | @ApiOperation(value = "获取图层树") |
| | | public AjaxResult getLayerTree() { |
| | | List<SysLayerVo> layerTreeList = sysLayerService.getLayerTree(); |
| | | return AjaxResult.success(layerTreeList); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | import com.zzg.common.constant.Constants; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.system.SysMenu; |
| | | import com.zzg.common.core.domain.entity.system.SysUser; |
| | | import com.zzg.common.core.domain.model.LoginBody; |
| | | import com.zzg.common.utils.SecurityUtils; |
| | | import com.zzg.framework.web.service.SysLoginService; |
| | | import com.zzg.framework.web.service.SysPermissionService; |
| | | import com.zzg.system.service.system.ISysMenuService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 登录验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @Api(tags = "登录") |
| | | public class SysLoginController { |
| | | @Autowired |
| | | private SysLoginService loginService; |
| | | |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | |
| | | /** |
| | | * 登录方法 |
| | | * |
| | | * @param loginBody 登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @PostMapping("/login") |
| | | @ApiOperation(value = "登录") |
| | | public AjaxResult login(@RequestBody LoginBody loginBody) { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // 生成令牌 |
| | | String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
| | | loginBody.getUuid()); |
| | | ajax.put(Constants.TOKEN, token); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | @GetMapping("getInfo") |
| | | @ApiOperation(value = "用户信息") |
| | | public AjaxResult getInfo() { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | // 角色集合 |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // 权限集合 |
| | | Set<String> permissions = permissionService.getMenuPermission(user); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", roles); |
| | | ajax.put("permissions", permissions); |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 获取路由信息 |
| | | * |
| | | * @return 路由信息 |
| | | */ |
| | | @GetMapping("getRouters") |
| | | public AjaxResult getRouters() { |
| | | String userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); |
| | | return AjaxResult.success(menuService.buildMenus(menus)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.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.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.constant.UserConstants; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.system.SysMenu; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.system.service.system.ISysMenuService; |
| | | |
| | | /** |
| | | * 菜单信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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 String 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") String 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") String menuId) |
| | | { |
| | | if (menuService.hasChildByMenuId(menuId)) |
| | | { |
| | | return warn("存在子菜单,不允许删除"); |
| | | } |
| | | if (menuService.checkMenuExistRole(menuId)) |
| | | { |
| | | return warn("菜单已分配,不允许删除"); |
| | | } |
| | | return toAjax(menuService.deleteMenuById(menuId)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.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.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.system.domain.SysNotice; |
| | | import com.zzg.system.service.system.ISysNoticeService; |
| | | |
| | | /** |
| | | * 公告 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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 String 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 String[] noticeIds) { |
| | | return toAjax(noticeService.deleteNoticeByIds(noticeIds)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.poi.ExcelUtil; |
| | | import com.zzg.system.domain.SysPost; |
| | | import com.zzg.system.service.system.ISysPostService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 岗位信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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 String 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 String[] postIds) { |
| | | return toAjax(postService.deletePostByIds(postIds)); |
| | | } |
| | | |
| | | /** |
| | | * 获取岗位选择框列表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() { |
| | | List<SysPost> posts = postService.selectPostAll(); |
| | | return success(posts); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | 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.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.config.RuoYiConfig; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.system.SysUser; |
| | | import com.zzg.common.core.domain.model.LoginUser; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.SecurityUtils; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.common.utils.file.FileUploadUtils; |
| | | import com.zzg.common.utils.file.MimeTypeUtils; |
| | | import com.zzg.framework.web.service.TokenService; |
| | | import com.zzg.system.service.system.ISysUserService; |
| | | |
| | | /** |
| | | * 个人信息 业务处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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(RuoYiConfig.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("上传图片异常,请联系管理员"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.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.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.model.RegisterBody; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.framework.web.service.SysRegisterService; |
| | | import com.zzg.system.service.system.ISysConfigService; |
| | | |
| | | /** |
| | | * 注册验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.system.SysDept; |
| | | import com.zzg.common.core.domain.entity.system.SysRole; |
| | | import com.zzg.common.core.domain.entity.system.SysUser; |
| | | import com.zzg.common.core.domain.model.LoginUser; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.common.utils.poi.ExcelUtil; |
| | | import com.zzg.framework.web.service.SysPermissionService; |
| | | import com.zzg.framework.web.service.TokenService; |
| | | import com.zzg.system.domain.SysUserRole; |
| | | import com.zzg.system.service.system.ISysDeptService; |
| | | import com.zzg.system.service.system.ISysRoleService; |
| | | import com.zzg.system.service.system.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 角色信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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 String 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.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); |
| | | loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); |
| | | 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 String[] 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(String roleId, String[] userIds) { |
| | | return toAjax(roleService.deleteAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择用户授权 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/selectAll") |
| | | public AjaxResult selectAuthUserAll(String roleId, String[] 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") String roleId) { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); |
| | | ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); |
| | | return ajax; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.controller.system; |
| | | |
| | | import com.zzg.common.annotation.Log; |
| | | import com.zzg.common.core.controller.BaseController; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.entity.system.SysDept; |
| | | import com.zzg.common.core.domain.entity.system.SysRole; |
| | | import com.zzg.common.core.domain.entity.system.SysUser; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.utils.SecurityUtils; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.common.utils.poi.ExcelUtil; |
| | | import com.zzg.system.service.system.ISysDeptService; |
| | | import com.zzg.system.service.system.ISysPostService; |
| | | import com.zzg.system.service.system.ISysRoleService; |
| | | import com.zzg.system.service.system.ISysUserService; |
| | | 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 javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 用户信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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) String userId) { |
| | | userService.checkUserDataScope(userId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | 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()); |
| | | if (StringUtils.isNotNull(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())); |
| | | } |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:add')") |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) { |
| | | 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()); |
| | | 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 String[] 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") String 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(String userId, String[] roleIds) { |
| | | userService.checkUserDataScope(userId); |
| | | userService.insertUserAuth(userId, roleIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取部门树列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/deptTree") |
| | | public AjaxResult deptTree(SysDept dept) { |
| | | return success(deptService.selectDeptTreeList(dept)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.core.config; |
| | | |
| | | import com.zzg.common.config.RuoYiConfig; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.models.auth.In; |
| | | 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 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; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Swagger2的接口配置 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Configuration |
| | | public class SwaggerConfig { |
| | | /** |
| | | * 系统基础配置 |
| | | */ |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | |
| | | /** |
| | | * 是否开启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.zzg.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("描述:") |
| | | // 作者信息 |
| | | .contact(new Contact(ruoyiConfig.getName(), null, null)) |
| | | // 版本 |
| | | .version("版本号:" + ruoyiConfig.getVersion()) |
| | | .build(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.web.core.enums; |
| | | |
| | | import com.zzg.system.domain.vo.*; |
| | | |
| | | /** |
| | | * 模板文件类型 enum |
| | | * 为了方便引入所以放在这个包里面 |
| | | * |
| | | * @date 2024/09/05 |
| | | */ |
| | | public enum TemplateFileTypeEnum { |
| | | FILE_1(1, StateProjectCompensateStandardVO.class, "补偿标准导入模板.xlsx"), |
| | | FILE_2(2, StateHouseholdImportVO.class, "房产导入模板.xlsx"), |
| | | FILE_3(3, StateProjectCompensateStandardVO.class, "房产导出.xlsx"), |
| | | FILE_4(4, ImportSettlementTemplateCurrencyVO.class, "安置货币补偿导入模板.xlsx"), |
| | | FILE_5(5, SettleDetailExportVO.class, "安置详情.xlsx"), |
| | | FILE_6(6, ApplyOwnerVO.class, "权利人导入模板.xlsx"), |
| | | |
| | | FILE_7(7, ImportSettlementTemplatePropertyVO.class, "安置产权置换导入模板.xlsx"), |
| | | |
| | | ; |
| | | |
| | | |
| | | private final Integer fileType; |
| | | private final Class<?> clazz; |
| | | private final String fileName; |
| | | |
| | | TemplateFileTypeEnum(Integer fileType, Class<?> clazz, String fileName) { |
| | | this.fileType = fileType; |
| | | this.clazz = clazz; |
| | | this.fileName = fileName; |
| | | } |
| | | |
| | | public Integer getFileType() { |
| | | return fileType; |
| | | } |
| | | |
| | | public Class<?> getClazz() { |
| | | return clazz; |
| | | } |
| | | |
| | | public String getFileName() { |
| | | return fileName; |
| | | } |
| | | |
| | | public static Class<?> getClazzByFileType(Integer fileType) { |
| | | for (TemplateFileTypeEnum file : TemplateFileTypeEnum.values()) { |
| | | if (file.getFileType().equals(fileType)) { |
| | | return file.getClazz(); |
| | | } |
| | | } |
| | | throw new IllegalArgumentException("Invalid file name: " + fileType); |
| | | } |
| | | |
| | | public static TemplateFileTypeEnum getEnumByFileType(Integer fileType) { |
| | | for (TemplateFileTypeEnum file : TemplateFileTypeEnum.values()) { |
| | | if (file.getFileType().equals(fileType)) { |
| | | return file; |
| | | } |
| | | } |
| | | throw new IllegalArgumentException("Invalid file name: " + fileType); |
| | | } |
| | | } |
New file |
| | |
| | | restart.include.json=/com.alibaba.fastjson2.*.jar |
New file |
| | |
| | | # 数据源配置 |
| | | spring: |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: org.postgresql.Driver |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:postgresql://192.168.163.221:5432/congzhLand_test?currentSchema=public |
| | | # url: jdbc:postgresql://localhost:5432/congzhLand?currentSchema=public |
| | | username: postgres |
| | | password: postgres |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # 初始连接数 |
| | | initialSize: 5 |
| | | # 最小连接池数量 |
| | | minIdle: 10 |
| | | # 最大连接池数量 |
| | | maxActive: 20 |
| | | # 配置获取连接等待超时的时间 |
| | | maxWait: 60000 |
| | | # 配置连接超时时间 |
| | | connectTimeout: 30000 |
| | | # 配置网络超时时间 |
| | | socketTimeout: 60000 |
| | | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # 配置一个连接在池中最小生存的时间,单位是毫秒 |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # 配置一个连接在池中最大生存的时间,单位是毫秒 |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # 配置检测连接是否有效 |
| | | validationQuery: SELECT 1 |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置白名单,不填则允许所有访问 |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # 控制台管理用户名和密码 |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # 慢SQL记录 |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
New file |
| | |
| | | Application Version: ${ruoyi.version} |
| | | Spring Boot Version: ${spring-boot.version} |
| | | //////////////////////////////////////////////////////////////////// |
| | | // _ooOoo_ // |
| | | // o8888888o // |
| | | // 88" . "88 // |
| | | // (| ^_^ |) // |
| | | // O\ = /O // |
| | | // ____/`---'\____ // |
| | | // .' \\| |// `. // |
| | | // / \\||| : |||// \ // |
| | | // / _||||| -:- |||||- \ // |
| | | // | | \\\ - /// | | // |
| | | // | \_| ''\---/'' | | // |
| | | // \ .-\__ `-` ___/-. / // |
| | | // ___`. .' /--.--\ `. . ___ // |
| | | // ."" '< `.___\_<|>_/___.' >'"". // |
| | | // | | : `- \`.;`\ _ /`;.`/ - ` : | | // |
| | | // \ \ `-. \_ __\ /__ _/ .-` / / // |
| | | // ========`-.____`-.___\_____/___.-`____.-'======== // |
| | | // `=---=' // |
| | | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // |
| | | // 佛祖保佑 永不宕机 永无BUG // |
| | | //////////////////////////////////////////////////////////////////// |
New file |
| | |
| | | #错误消息 |
| | | not.null=* 必须填写 |
| | | user.jcaptcha.error=验证码错误 |
| | | user.jcaptcha.expire=验证码已失效 |
| | | user.not.exists=用户不存在/密码错误 |
| | | user.password.not.match=用户不存在/密码错误 |
| | | user.password.retry.limit.count=密码输入错误{0}次 |
| | | user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟 |
| | | user.password.delete=对不起,您的账号已被删除 |
| | | user.blocked=用户已封禁,请联系管理员 |
| | | role.blocked=角色已封禁,请联系管理员 |
| | | login.blocked=很遗憾,访问IP已被列入系统黑名单 |
| | | user.logout.success=退出成功 |
| | | |
| | | length.not.valid=长度必须在{min}到{max}个字符之间 |
| | | |
| | | user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 |
| | | user.password.not.valid=* 5-50个字符 |
| | | |
| | | user.email.not.valid=邮箱格式错误 |
| | | user.mobile.phone.number.not.valid=手机号格式错误 |
| | | user.login.success=登录成功 |
| | | user.register.success=注册成功 |
| | | user.notfound=请重新登录 |
| | | user.forcelogout=管理员强制退出,请重新登录 |
| | | user.unknown.error=未知错误,请重新登录 |
| | | |
| | | ##文件上传消息 |
| | | upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! |
| | | upload.filename.exceed.length=上传的文件名最长{0}个字符 |
| | | |
| | | ##权限 |
| | | no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] |
| | | no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] |
| | | no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] |
| | | no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] |
| | | no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] |
| | | no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <configuration> |
| | | <!-- 日志存放路径 --> |
| | | <property name="log.path" value="./home/ruoyi/logs" /> |
| | | <!-- 日志输出格式 --> |
| | | <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> |
| | | |
| | | <!-- 控制台输出 --> |
| | | <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 系统日志输出 --> |
| | | <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-info.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>INFO</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-error.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- 过滤的级别 --> |
| | | <level>ERROR</level> |
| | | <!-- 匹配时的操作:接收(记录) --> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <!-- 不匹配时的操作:拒绝(不记录) --> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 用户访问日志输出 --> |
| | | <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-user.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 按天回滚 daily --> |
| | | <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 系统模块日志级别控制 --> |
| | | <logger name="com.zzg" level="info" /> |
| | | <!-- Spring日志级别控制 --> |
| | | <logger name="org.springframework" level="warn" /> |
| | | |
| | | <root level="info"> |
| | | <appender-ref ref="console" /> |
| | | </root> |
| | | |
| | | <!--系统操作日志--> |
| | | <root level="info"> |
| | | <appender-ref ref="file_info" /> |
| | | <appender-ref ref="file_error" /> |
| | | </root> |
| | | |
| | | <!--系统用户操作日志--> |
| | | <logger name="sys-user" level="info"> |
| | | <appender-ref ref="sys-user"/> |
| | | </logger> |
| | | </configuration> |
New file |
| | |
| | | <!--<?xml version="1.0" encoding="UTF-8" ?>--> |
| | | <!--<!DOCTYPE configuration--> |
| | | <!--PUBLIC "-//mybatis.org//DTD Config 3.0//EN"--> |
| | | <!--"http://mybatis.org/dtd/mybatis-3-config.dtd">--> |
| | | <!--<configuration>--> |
| | | <!-- <!– 全局参数 –>--> |
| | | <!-- <settings>--> |
| | | <!-- <!– 使全局的映射器启用或禁用缓存 –>--> |
| | | <!-- <setting name="cacheEnabled" value="true" />--> |
| | | <!-- <!– 允许JDBC 支持自动生成主键 –>--> |
| | | <!-- <setting name="useGeneratedKeys" value="true" />--> |
| | | <!-- <!– 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 –>--> |
| | | <!-- <setting name="defaultExecutorType" value="SIMPLE" />--> |
| | | <!-- <!– 指定 MyBatis 所用日志的具体实现 –>--> |
| | | <!-- <setting name="logImpl" value="SLF4J" />--> |
| | | <!-- <!– 使用驼峰命名法转换字段 –>--> |
| | | <!-- <!– <setting name="mapUnderscoreToCamelCase" value="true"/> –>--> |
| | | <!-- </settings>--> |
| | | <!-- --> |
| | | <!--</configuration>--> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <groupId>com.zzg</groupId> |
| | | <artifactId>congzhLand</artifactId> |
| | | <version>3.8.7</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>land-common</artifactId> |
| | | |
| | | <description> |
| | | common通用工具 |
| | | </description> |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- Spring框架基本的核心工具 --> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-context-support</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringWeb模块 --> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-beans</artifactId> |
| | | </dependency> |
| | | <!-- spring cache --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-cache</artifactId> |
| | | </dependency> |
| | | <!-- spring security 安全认证 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-security</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> |
| | | |
| | | <!-- 动态数据源 --> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>dynamic-datasource-spring-boot-starter</artifactId> |
| | | <version>3.5.2</version> |
| | | </dependency> |
| | | |
| | | <!-- 阿里JSON解析器 --> |
| | | <dependency> |
| | | <groupId>com.alibaba.fastjson2</groupId> |
| | | <artifactId>fastjson2</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> |
| | | <!--knife4j--> |
| | | <dependency> |
| | | <groupId>com.github.xiaoymin</groupId> |
| | | <artifactId>knife4j-spring-boot-starter</artifactId> |
| | | <version>2.0.8</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.swagger</groupId> |
| | | <artifactId>swagger-annotations</artifactId> |
| | | <version>1.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | <!-- pagehelper 分页插件 --> |
| | | <dependency> |
| | | <groupId>com.github.pagehelper</groupId> |
| | | <artifactId>pagehelper-spring-boot-starter</artifactId> |
| | | </dependency> |
| | | <!--mybatis-plus--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>3.5.7</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>com.github.jsqlparser</groupId> |
| | | <artifactId>jsqlparser</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.jsqlparser</groupId> |
| | | <artifactId>jsqlparser</artifactId> |
| | | <version>4.7</version> |
| | | </dependency> |
| | | <!-- hutool--> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.8.4</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.datatype</groupId> |
| | | <artifactId>jackson-datatype-jsr310</artifactId> |
| | | </dependency> |
| | | <!-- Google Guava --> |
| | | <dependency> |
| | | <groupId>com.google.guava</groupId> |
| | | <artifactId>guava</artifactId> |
| | | <version>30.1-jre</version> |
| | | </dependency> |
| | | <!-- Apache Commons BeanUtils --> |
| | | <dependency> |
| | | <groupId>commons-beanutils</groupId> |
| | | <artifactId>commons-beanutils</artifactId> |
| | | <version>1.9.4</version> |
| | | </dependency> |
| | | |
| | | <!--easypoi--> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-base</artifactId> |
| | | <version>4.4.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-web</artifactId> |
| | | <version>4.4.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-annotation</artifactId> |
| | | <version>4.4.0</version> |
| | | </dependency> |
| | | |
| | | <!--操作pdf--> |
| | | <dependency> |
| | | <groupId>fr.opensagres.xdocreport.itext-gae</groupId> |
| | | <artifactId>itext-gae</artifactId> |
| | | <version>4.2.0-1</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <!--pdf转图片--> |
| | | <dependency> |
| | | <groupId>org.apache.pdfbox</groupId> |
| | | <artifactId>pdfbox</artifactId> |
| | | <version>2.0.9</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.pdfbox</groupId> |
| | | <artifactId>fontbox</artifactId> |
| | | <version>2.0.9</version> |
| | | </dependency> |
| | | |
| | | <!-- <!–doc 转 docx–>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>e-iceblue</groupId>--> |
| | | <!-- <artifactId>spire.doc.free</artifactId>--> |
| | | <!-- <version>5.2.0</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>e-iceblue</groupId>--> |
| | | <!-- <artifactId>spire.pdf.free</artifactId>--> |
| | | <!-- <version>3.9.0</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- <!– geotools –>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.geotools</groupId>--> |
| | | <!-- <artifactId>gt-main</artifactId>--> |
| | | <!-- <version>24.2</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.geotools</groupId>--> |
| | | <!-- <artifactId>gt-shapefile</artifactId>--> |
| | | <!-- <version>24.2</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.geotools</groupId>--> |
| | | <!-- <artifactId>gt-geojson</artifactId>--> |
| | | <!-- <version>24.2</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.geotools</groupId>--> |
| | | <!-- <artifactId>gt-csv</artifactId>--> |
| | | <!-- <version>24.2</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.geotools</groupId>--> |
| | | <!-- <artifactId>gt-opengis</artifactId>--> |
| | | <!-- <version>24.2</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.geotools</groupId>--> |
| | | <!-- <artifactId>gt-referencing</artifactId>--> |
| | | <!-- <version>24.2</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.geotools</groupId>--> |
| | | <!-- <artifactId>gt-metadata</artifactId>--> |
| | | <!-- <version>24.2</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>org.locationtech.jts</groupId> |
| | | <artifactId>jts-core</artifactId> |
| | | <version>1.17.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>systems.uom</groupId> |
| | | <artifactId>systems-common-java8</artifactId> |
| | | <version>0.8</version> |
| | | </dependency> |
| | | <!-- https://mvnrepository.com/artifact/tech.units/indriya --> |
| | | <dependency> |
| | | <groupId>tech.units</groupId> |
| | | <artifactId>indriya</artifactId> |
| | | <version>2.0.4</version> |
| | | </dependency> |
| | | <!-- https://mvnrepository.com/artifact/org.ejml/ejml-simple --> |
| | | <dependency> |
| | | <groupId>org.ejml</groupId> |
| | | <artifactId>ejml-simple</artifactId> |
| | | <version>0.39</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.mapstruct</groupId> |
| | | <artifactId>mapstruct</artifactId> |
| | | <version>1.5.2.Final</version> |
| | | </dependency> |
| | | |
| | | <!--mapstruct编译--> |
| | | <dependency> |
| | | <groupId>org.mapstruct</groupId> |
| | | <artifactId>mapstruct-processor</artifactId> |
| | | <version>1.5.2.Final</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok-mapstruct-binding</artifactId> |
| | | <version>0.2.0</version> |
| | | </dependency> |
| | | <!--zip压缩--> |
| | | <dependency> |
| | | <groupId>net.lingala.zip4j</groupId> |
| | | <artifactId>zip4j</artifactId> |
| | | <version>1.3.2</version> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel</artifactId> |
| | | <version>4.0.2</version> |
| | | </dependency> |
| | | |
| | | <!-- 工作流--> |
| | | <dependency> |
| | | <groupId>com.aizuda</groupId> |
| | | <artifactId>flowlong-spring-boot-starter</artifactId> |
| | | <version>1.0.4</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | <repositories> |
| | | <repository> |
| | | <id>OSGeo Repository</id> |
| | | <url>http://download.osgeo.org/webdav/geotools/</url> |
| | | </repository> |
| | | |
| | | <repository> |
| | | <id>com.e-iceblue</id> |
| | | <name>e-iceblue</name> |
| | | <url>https://repo.e-iceblue.cn/repository/maven-public/</url> |
| | | </repository> |
| | | |
| | | <repository> |
| | | <id>GeoSolutions</id> |
| | | <url>https://maven.geo-solutions.it/</url> |
| | | </repository> |
| | | <repository> |
| | | <id>maven2-repository.dev.java.net</id> |
| | | <name>Java.net repository</name> |
| | | <url>https://download.java.net/maven/2</url> |
| | | </repository> |
| | | <repository> |
| | | <id>osgeo</id> |
| | | <name>Open Source Geospatial Foundation Repository</name> |
| | | <url>https://download.osgeo.org/webdav/geotools/</url> |
| | | </repository> |
| | | <repository> |
| | | <id>postgis</id> |
| | | <name>postgis</name> |
| | | <url>https://52north.org/maven/repo/releases/</url> |
| | | </repository> |
| | | </repositories> |
| | | </project> |
New file |
| | |
| | | package com.zzg.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * 匿名访问不鉴权注解 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target({ ElementType.METHOD, ElementType.TYPE }) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface Anonymous |
| | | { |
| | | } |
New file |
| | |
| | | package com.zzg.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * 数据权限过滤注解 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target(ElementType.METHOD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface DataScope |
| | | { |
| | | /** |
| | | * 部门表的别名 |
| | | */ |
| | | public String deptAlias() default ""; |
| | | |
| | | /** |
| | | * 用户表的别名 |
| | | */ |
| | | public String userAlias() default ""; |
| | | |
| | | /** |
| | | * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来 |
| | | */ |
| | | public String permission() default ""; |
| | | } |
New file |
| | |
| | | package com.zzg.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Inherited; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import com.zzg.common.enums.DataSourceType; |
| | | |
| | | /** |
| | | * 自定义多数据源切换注解 |
| | | * |
| | | * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target({ ElementType.METHOD, ElementType.TYPE }) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | @Inherited |
| | | public @interface DataSource |
| | | { |
| | | /** |
| | | * 切换数据源名称 |
| | | */ |
| | | public DataSourceType value() default DataSourceType.MASTER; |
| | | } |
New file |
| | |
| | | package com.zzg.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.zzg.common.utils.poi.ExcelHandlerAdapter; |
| | | |
| | | /** |
| | | * 自定义导出Excel数据注解 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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 {}; |
| | | |
| | | /** |
| | | * 是否需要纵向合并单元格,应对需求:含有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); |
| | | private final int value; |
| | | |
| | | ColumnType(int value) |
| | | { |
| | | this.value = value; |
| | | } |
| | | |
| | | public int value() |
| | | { |
| | | return this.value; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.annotation; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * Excel注解集 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target(ElementType.FIELD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface Excels |
| | | { |
| | | public Excel[] value(); |
| | | } |
New file |
| | |
| | | package com.zzg.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import com.zzg.common.enums.BusinessType; |
| | | import com.zzg.common.enums.OperatorType; |
| | | |
| | | /** |
| | | * 自定义操作日志记录注解 |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | @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 {}; |
| | | } |
New file |
| | |
| | | package com.zzg.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import com.zzg.common.constant.CacheConstants; |
| | | import com.zzg.common.enums.LimitType; |
| | | |
| | | /** |
| | | * 限流注解 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @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; |
| | | } |
New file |
| | |
| | | package com.zzg.common.annotation; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Inherited; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * 自定义注解防止表单重复提交 |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | @Inherited |
| | | @Target(ElementType.METHOD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface RepeatSubmit |
| | | { |
| | | /** |
| | | * 间隔时间(ms),小于此时间视为重复提交 |
| | | */ |
| | | public int interval() default 5000; |
| | | |
| | | /** |
| | | * 提示消息 |
| | | */ |
| | | public String message() default "不允许重复提交,请稍候再试"; |
| | | } |
New file |
| | |
| | | package com.zzg.common.config; |
| | | |
| | | import org.springframework.cache.concurrent.ConcurrentMapCacheManager; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class CacheManagerConfig { |
| | | |
| | | @Bean |
| | | public ConcurrentMapCacheManager cacheManager() { |
| | | return new ConcurrentMapCacheManager(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.config; |
| | | |
| | | |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; |
| | | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.Primary; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * 用于解决jackson无法序列化LocalDateTime类型字段问题 https://www.jianshu.com/p/3b600728a843 |
| | | * |
| | | * @author gaofan@youngbai.com |
| | | * @date Created in 2020/9/3 |
| | | */ |
| | | @Configuration |
| | | public class DateFormatConfig { |
| | | |
| | | /** |
| | | * Date格式化字符串 |
| | | */ |
| | | private static final String DATE_FORMAT = "yyyy-MM-dd"; |
| | | /** |
| | | * DateTime格式化字符串 |
| | | */ |
| | | private static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; |
| | | /** |
| | | * Time格式化字符串 |
| | | */ |
| | | private static final String TIME_FORMAT = "HH:mm:ss"; |
| | | |
| | | /** |
| | | * 自定义Bean |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | @Primary |
| | | public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { |
| | | return builder -> builder.serializerByType(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT))) |
| | | .serializerByType(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DATE_FORMAT))) |
| | | .serializerByType(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(TIME_FORMAT))) |
| | | .deserializerByType(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT))) |
| | | .deserializerByType(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DATE_FORMAT))) |
| | | .deserializerByType(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(TIME_FORMAT))); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.config; |
| | | |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.exception.ExcelDataConvertException; |
| | | import com.alibaba.excel.read.listener.ReadListener; |
| | | |
| | | public class ExcelReadListenerConfig<T> implements ReadListener<T> { |
| | | |
| | | @Override |
| | | public void invoke(T data, AnalysisContext context) { |
| | | // 这里可以处理每一行数据的逻辑 |
| | | System.out.println("读取到一行数据: " + data); |
| | | } |
| | | |
| | | @Override |
| | | public void onException(Exception exception, AnalysisContext context) throws Exception { |
| | | // 判断是否为数据转换异常 |
| | | if (exception instanceof ExcelDataConvertException) { |
| | | ExcelDataConvertException ex = (ExcelDataConvertException) exception; |
| | | int rowIndex = ex.getRowIndex(); |
| | | int columnIndex = ex.getColumnIndex(); |
| | | |
| | | String errorMessage = String.format("数据转换错误: 第%d行,第%d列,错误值:%s", |
| | | rowIndex + 1, columnIndex + 1, ex.getCellData().toString()); |
| | | |
| | | throw new ExcelDataConvertException(rowIndex + 1, columnIndex + 1, ex.getCellData(), null, errorMessage); |
| | | } else { |
| | | throw exception; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext context) { |
| | | // 所有数据解析完成后的处理逻辑 |
| | | System.out.println("所有数据解析完成"); |
| | | } |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.zzg.common.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.zzg.common.exception.ServiceException; |
| | | import com.zzg.common.utils.SecurityUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Configuration |
| | | @Slf4j |
| | | public class MetaObjectHandlerConfig implements MetaObjectHandler { |
| | | |
| | | |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | try{ |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("createBy", SecurityUtils.getUserId()==null ? "1":String.valueOf(SecurityUtils.getUserId()), metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | }catch(ServiceException badException){ |
| | | log.info("insertFill"+badException.getMessage()); |
| | | }catch (Exception e) { |
| | | log.error("insertFill",e); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | |
| | | try { |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateBy",SecurityUtils.getUserId() == null ? "1" : String.valueOf(SecurityUtils.getUserId()),metaObject); |
| | | } catch (ServiceException badException) { |
| | | log.info("insertFill" + badException.getMessage()); |
| | | } catch (Exception e) { |
| | | log.error("insertFill", e); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.config; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 读取项目相关配置 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | @ConfigurationProperties(prefix = "ruoyi") |
| | | public class RuoYiConfig { |
| | | /** |
| | | * 项目名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 版本 |
| | | */ |
| | | private String version; |
| | | |
| | | /** |
| | | * 版权年份 |
| | | */ |
| | | private String copyrightYear; |
| | | |
| | | /** |
| | | * 上传路径 |
| | | */ |
| | | private static String profile; |
| | | private static String upload; |
| | | private static String temp; |
| | | |
| | | /** |
| | | * 获取地址开关 |
| | | */ |
| | | private static boolean addressEnabled; |
| | | |
| | | /** |
| | | * 验证码类型 |
| | | */ |
| | | private static String captchaType; |
| | | |
| | | 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; |
| | | } |
| | | |
| | | public static String getProfile() { |
| | | return profile; |
| | | } |
| | | |
| | | public void setProfile(String profile) { |
| | | RuoYiConfig.profile = profile; |
| | | } |
| | | |
| | | public static String getUpload() { |
| | | return upload; |
| | | } |
| | | |
| | | public void setUpload(String upload) { |
| | | RuoYiConfig.upload = upload; |
| | | } |
| | | |
| | | public static String getTemp() { |
| | | return temp; |
| | | } |
| | | |
| | | public void setTemp(String temp) { |
| | | RuoYiConfig.temp = temp; |
| | | } |
| | | |
| | | public static boolean isAddressEnabled() { |
| | | return addressEnabled; |
| | | } |
| | | |
| | | public void setAddressEnabled(boolean addressEnabled) { |
| | | RuoYiConfig.addressEnabled = addressEnabled; |
| | | } |
| | | |
| | | public static String getCaptchaType() { |
| | | return captchaType; |
| | | } |
| | | |
| | | public void setCaptchaType(String captchaType) { |
| | | RuoYiConfig.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"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.constant; |
| | | |
| | | /** |
| | | * 缓存的key 常量 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | 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:"; |
| | | } |
New file |
| | |
| | | package com.zzg.common.constant; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * @author: xxxg |
| | | * @date: 2021/11/17 14:14 |
| | | */ |
| | | public class CommonConstant { |
| | | /** |
| | | * 自定义错误 |
| | | */ |
| | | public static final String X_ERROR = "x.servlet.exception.code"; |
| | | public static final String X_ERROR_CODE = "x.servlet.exception.error"; |
| | | public static final String X_ERROR_MESSAGE = "x.servlet.exception.message"; |
| | | public static final String X_ACCESS_DENIED = "x.access.denied"; |
| | | |
| | | /** |
| | | * 超级管理员ID |
| | | */ |
| | | public static final String SUPER_ADMIN_ID = "1"; |
| | | |
| | | /** |
| | | * 超级管理员名称 |
| | | */ |
| | | public static final String SUPER_ADMIN_NAME = "admin"; |
| | | |
| | | /** |
| | | * 默认最小页码 |
| | | */ |
| | | public static final long MIN_PAGE = 0; |
| | | /** |
| | | * 最大显示条数 |
| | | */ |
| | | public static final long MAX_LIMIT = 1000; |
| | | /** |
| | | * 默认页码 |
| | | */ |
| | | public static final long DEFAULT_PAGE = 1; |
| | | /** |
| | | * 默认显示条数 |
| | | */ |
| | | public static final long DEFAULT_LIMIT = 10; |
| | | /** |
| | | * 页码 KEY |
| | | */ |
| | | public static final String PAGE_KEY = "page"; |
| | | /** |
| | | * 显示条数 KEY |
| | | */ |
| | | public static final String PAGE_LIMIT_KEY = "limit"; |
| | | /** |
| | | * 排序字段 KEY |
| | | */ |
| | | public static final String PAGE_SORT_KEY = "sort"; |
| | | /** |
| | | * 排序方向 KEY |
| | | */ |
| | | public static final String PAGE_ORDER_KEY = "order"; |
| | | |
| | | /** |
| | | * 逻辑删除 del_flag |
| | | */ |
| | | public static final String DEL_FLAG = "1"; |
| | | |
| | | /** |
| | | * 临时文件夹 |
| | | */ |
| | | public static final String TEMP = "temp"; |
| | | |
| | | /** |
| | | * 持久文件夹 |
| | | */ |
| | | public static final String UPLOAD = "upload"; |
| | | |
| | | /** |
| | | * 事件附件存放目录 |
| | | */ |
| | | public static final String DIRECTORY_EVENT = "event"; |
| | | |
| | | /** |
| | | * 消息模板可替换参数 |
| | | */ |
| | | public static final String MESSAGE_TEMPLATE_REPLACE_VALUE = "{{xx}}"; |
| | | |
| | | /** |
| | | * 登录最大重试次数 |
| | | */ |
| | | public static final Integer MAX_LOGIN_RETRY_COUNT = 5; |
| | | |
| | | public static final List<String> EXCELFIELDLIST = Arrays.asList("一级", "二级", "三级", "四级", "五级", "六级", "七级", "八级", "九级", "十级", "十一级", "十二级", "十三级", "十四级", "十五级", "十六级", "十七级", "十八级", "十九级", "二十级", "二十一级", "二十二级", "二十三级", "二十四级"); |
| | | |
| | | /** |
| | | * 图层模式 |
| | | */ |
| | | public static final String LAYER_SCHEMA = "layer"; |
| | | |
| | | /** |
| | | * 防止过期登录后出现多次302 |
| | | */ |
| | | public static final AtomicInteger EXPIRE_LOGIN_REQUEST_FILTER = new AtomicInteger(0); |
| | | } |
New file |
| | |
| | | package com.zzg.common.constant; |
| | | |
| | | import io.jsonwebtoken.Claims; |
| | | |
| | | /** |
| | | * 通用常量信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class Constants |
| | | { |
| | | /** |
| | | * UTF-8 字符集 |
| | | */ |
| | | public static final String UTF8 = "UTF-8"; |
| | | |
| | | /** |
| | | * GBK 字符集 |
| | | */ |
| | | public static final String GBK = "GBK"; |
| | | |
| | | /** |
| | | * 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"; |
| | | public static final String RESOURCE_UPLOAD = "/upload"; |
| | | public static final String RESOURCE_TEMP = "/temp"; |
| | | |
| | | /** |
| | | * 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.zzg" }; |
| | | |
| | | /** |
| | | * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) |
| | | */ |
| | | public static final String[] JOB_WHITELIST_STR = { "com.zzg" }; |
| | | |
| | | /** |
| | | * 定时任务违规的字符 |
| | | */ |
| | | public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", |
| | | "org.springframework", "org.apache", "com.zzg.common.utils.file", "com.zzg.common.config", "com.zzg.generator" }; |
| | | } |
New file |
| | |
| | | package com.zzg.common.constant; |
| | | |
| | | /** |
| | | * 代码生成通用常量 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | 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"; |
| | | } |
New file |
| | |
| | | package com.zzg.common.constant; |
| | | |
| | | /** |
| | | * 返回状态码 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | 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; |
| | | } |
New file |
| | |
| | | package com.zzg.common.constant; |
| | | |
| | | /** |
| | | * 任务调度通用常量 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | 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; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.constant; |
| | | |
| | | /** |
| | | * 系统级常量类 |
| | | * |
| | | * @author wangjiang 2018-08-10 |
| | | * @version 1.0 |
| | | */ |
| | | public class SysConstants { |
| | | |
| | | /** |
| | | * 路径 |
| | | */ |
| | | public interface Path { |
| | | |
| | | /** |
| | | * 临时文件夹 |
| | | */ |
| | | String TEMP = "temp"; |
| | | |
| | | /** |
| | | * 转换出来的PDF位置 |
| | | */ |
| | | String PDF = "pdf"; |
| | | /** |
| | | * 持久文件夹 |
| | | */ |
| | | String UPLOAD = "upload"; |
| | | /** |
| | | * db文件存放位置 |
| | | */ |
| | | String DB = "db"; |
| | | |
| | | /** |
| | | * 地图图层文件存放位置 |
| | | */ |
| | | String MAP = "map"; |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.constant; |
| | | |
| | | /** |
| | | * 用户常量信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | 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_DISABLE = "1"; |
| | | |
| | | /** 部门正常状态 */ |
| | | public static final String DEPT_NORMAL = "0"; |
| | | |
| | | /** 部门停用状态 */ |
| | | public static final Integer 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; |
| | | } |
New file |
| | |
| | | package com.zzg.common.constant.state; |
| | | |
| | | public class UrlConstants { |
| | | |
| | | public static final String STATE_PROJECT_LIST = "/state-project/list"; |
| | | public static final String STATE_PROJECT_PAGE = "/state-project/page"; |
| | | public static final String STATE_PROJECT_PAGE_APPLY_RECORD = "/state-project/page/apply-record"; |
| | | public static final String STATE_PROJECT_GET_BY_ID = "/state-project/get/{id}"; |
| | | public static final String STATE_PROJECT_GET_STREET_BY_ID = "/state-project/get-street/{id}"; |
| | | public static final String STATE_PROJECT_SAVE = "/state-project/save"; |
| | | public static final String STATE_PROJECT_UPDATE = "/state-project/update"; |
| | | public static final String STATE_PROJECT_DELETE = "/state-project/delete/{id}"; |
| | | public static final String STATE_PROJECT_CANCELLATION = "/state-project/cancellation/{id}"; |
| | | public static final String STATE_PROJECT_ADD_COLLECTION_FILE = "/state-project/add/collection-file"; |
| | | public static final String STATE_PROJECT_REMOVE_COLLECTION_FILE = "/state-project/remove/collection-file"; |
| | | public static final String STATE_PROJECT_COLLECTION_FILE_LIST = "/state-project/list/collection-file"; |
| | | public static final String STATE_PROJECT_COLLECTION_FILE_PARENT = "/state-project/parent/collection-file"; |
| | | public static final String STATE_PROJECT_NOTICE_PAGE = "/state-project/page/notice"; |
| | | public static final String STATE_PROJECT_NOTICE_PAGE_AFTER_UPDATE_PROJECT = "/state-project/page/notice/after-update"; |
| | | public static final String STATE_PROJECT_NOTICE_SIMULATE = "/state-project/simulate"; |
| | | public static final String STATE_PROJECT_SUCCESS = "/state-project/success"; |
| | | public static final String STATE_PROJECT_APP_SUCCESS = "/state-project/app-success"; |
| | | public static final String STATE_PROJECT_NOTICE_GET = "/state-project/notice/get"; |
| | | public static final String STATE_PROJECT_NOTICE_DELETE = "/state-project/delete/notice/{id}"; |
| | | public static final String STATE_PROJECT_NOTICE_ADD = "/state-project/add/notice/"; |
| | | public static final String STATE_PROJECT_UPDATE_STATUS = "/state-project/update/status/"; |
| | | public static final String STATE_PROJECT_COMPENSATE_STANDARD_LIST = "/state-project/compensate-standard/list/"; |
| | | public static final String STATE_PROJECT_COMPENSATE_STANDARD_ADD = "/state-project/compensate-standard/add/"; |
| | | public static final String STATE_PROJECT_COMPENSATE_STANDARD_UPDATE = "/state-project/compensate-standard/update/"; |
| | | public static final String STATE_PROJECT_COMPENSATE_STANDARD_UPDATE_NAME = "/state-project/compensate-standard/update/name"; |
| | | public static final String STATE_PROJECT_COMPENSATE_STANDARD_STOP = "/state-project/compensate-standard/stop"; |
| | | public static final String STATE_PROJECT_COMPENSATE_STANDARD_START = "/state-project/compensate-standard/start"; |
| | | public static final String STATE_PROJECT_COMPENSATE_STANDARD_IMPORT = "/state-project/compensate-standard/import"; |
| | | public static final String STATE_PROJECT_IMPL_PAGE = "/state-project/impl/page/"; |
| | | |
| | | |
| | | //入户调查 |
| | | public static final String STATA_HOUSEHOLD_PAGE = "/state-household/page"; |
| | | public static final String STATE_HOUSEHOLD_GET_BY_ID = "/state-household/get"; |
| | | public static final String STATE_HOUSEHOLD_LIST_BY_CONDITION = "/state-household/list-household"; |
| | | public static final String STATE_HOUSEHOLD_QUERY = "/state-household/query"; |
| | | public static final String STATE_HOUSEHOLD_LIST_EXPORT = "/state-household/export"; |
| | | public static final String STATE_HOUSEHOLD_LIST_IMPORT = "/state-household/import"; |
| | | public static final String STATE_HOUSEHOLD_CREATE = "/state-household/save"; |
| | | public static final String STATE_HOUSEHOLD_DELETE = "/state-household/delete"; |
| | | public static final String STATE_HOUSEHOLD_USING_TYPE_LIST = "/state-household/using-type/list"; |
| | | public static final String STATE_HOUSEHOLD_SUM = "/state-household/sum"; |
| | | //todo 房产提交审核接口 |
| | | public static final String STATE_HOUSEHOLD_WORKFLOW_SUBMIT = "/state-household/workflow-submit"; |
| | | public static final String STATE_HOUSEHOLD_STREET_LIST = "/state-household/street/list"; |
| | | public static final String STATE_HOUSEHOLD_COMPLETE_SEARCH = "/state-household/complete-search"; |
| | | public static final String STATE_HOUSEHOLD_MOBILE_BACK = "/state-household/mobile-back"; |
| | | |
| | | |
| | | //入户调查-个人 |
| | | public static final String STATE_HOUSEHOLD_OWNER_LIST_BY_SATE_HOUSEHOLD_ID = "/state-household-person/list-by-household-id"; |
| | | public static final String STATE_HOUSEHOLD_OWNER_SAVE = "/state-household-person/save"; |
| | | public static final String STATE_HOUSEHOLD_OWNER_UPDATE = "/state-household-person/update"; |
| | | public static final String STATE_HOUSEHOLD_OWNER_DELETE = "/state-household-person/delete"; |
| | | public static final String STATE_HOUSEHOLD_OWNER_CALCULATE_COMPENSATION = "/state-household-person/calculate-compensation"; |
| | | public static final String STATE_HOUSEHOLD_OWNER_GET_CALCULATE_COMPENSATION = "/state-household-person/get-calculate-compensation"; |
| | | public static final String STATE_HOUSEHOLD_OWNER_GET_CALCULATE_COMPENSATION_WEB = "/state-household-person/get-calculate-compensation-web"; |
| | | //协议 |
| | | public static final String STATE_AGREEMENT_SAVE = "/state-agreement/save"; |
| | | public static final String STATE_AGREEMENT_UPDATE = "/state-agreement/update"; |
| | | public static final String STATE_AGREEMENT_UPDATE_AGREEMENT = "/state-agreement/update-agreement"; |
| | | public static final String STATE_AGREEMENT_DEL = "/state-agreement/del"; |
| | | public static final String STATE_AGREEMENT_LIST = "/state-agreement/list"; |
| | | public static final String STATE_AGREEMENT_DETAIL = "/state-agreement/detail"; |
| | | public static final String STATE_AGREEMENT_GENERATE = "/state-agreement/generate"; |
| | | public static final String STATE_AGREEMENT_WORKFLOW_SUBMIT = "/state-agreement/workflow-submit"; |
| | | |
| | | //项目资金 |
| | | public static final String STATE_PROJECT_ASSET_SAVE = "/state-project-asset/save"; |
| | | public static final String STATE_PROJECT_ASSET_DEL = "/state-project-asset/del"; |
| | | public static final String STATE_PROJECT_ASSET_LIST = "/state-project-asset/list"; |
| | | public static final String STATE_PROJECT_ASSET_DETAIL = "/state-project-asset/detail"; |
| | | public static final String STATE_PROJECT_ASSET_SUM = "/state-project-asset/sum"; |
| | | |
| | | //安置情况 |
| | | public static final String STATE_SETTLEMENT_SAVE = "/state-settlement/save"; |
| | | public static final String STATE_SETTLEMENT_DEL = "/state-settlement/del"; |
| | | public static final String STATE_SETTLEMENT_DETAIL_LIST = "/state-settlement/detail-list"; |
| | | public static final String STATE_SETTLEMENT_DETAIL_UPDATE_LIST = "/state-settlement/detail-update-list"; |
| | | |
| | | public static final String STATE_SETTLEMENT_SUM = "/state-settlement/sum"; |
| | | public static final String STATE_SETTLEMENT_LIST = "/state-settlement/list"; |
| | | public static final String STATE_SETTLEMENT_EXPORT = "/state-settlement/export"; |
| | | public static final String STATE_SETTLEMENT_IMPORT = "/state-settlement/import"; |
| | | public static final String STATE_SETTLEMENT_IMPORT_TEMPLATE = "/state-settlement/import-template"; |
| | | public static final String STATE_SETTLEMENT_GENERATE_SETTLE_BATCH = "/state-settlement/generate-settle-batch"; |
| | | public static final String STATE_SETTLEMENT_BATCH_NAME_LIST = "/state-settlement/batch-name/list"; |
| | | |
| | | public static final String STATE_SETTLEMENT_LIST_EXPORT = "/state-settlement/list-export"; |
| | | public static final String STATE_EXECUTION_DETAIL = "/state-execution/detail"; |
| | | public static final String STATE_EXECUTION_SUM = "/state-execution/sum"; |
| | | public static final String STATE_SETTLEMENT_EXECUTION_WORKFLOW_SUBMIT = "/state-settlement/workflow-submit"; |
| | | |
| | | |
| | | //数据中心 |
| | | public static final String STATE_DATA_CENTER_SUM = "/state-data-center/sum"; |
| | | public static final String STATE_DATA_CENTER_SUM_EXPIRED = "/state-data-center/sum-expired"; |
| | | |
| | | public static final String STATE_DATA_CENTER_PLACEMENT_STATISTICS = "/state-data-center/placement-statistics"; |
| | | public static final String STATE_DATA_CENTER_PLACEMENT_STATISTICS_STREET = "/state-data-center/placement-statistics/street"; |
| | | public static final String STATE_DATA_CENTER_PLACEMENT_STATISTICS_PAGE = "/state-data-center/placement-statistics/page"; |
| | | |
| | | //数据中心-项目资金 |
| | | public static final String STATE_DATA_CENTER_ASSET_SUM_MONEY = "/state-data-center/asset/sum-money"; |
| | | public static final String STATE_DATA_CENTER_ASSET_SUM_MONEY_GRAPH = "/state-data-center/asset/sum-money-graph"; |
| | | |
| | | //请账 |
| | | public static final String STATE_APPLY_RECORD_PAGE = "/state-apply-record/page"; |
| | | public static final String STATE_APPLY_RECORD_PAGE_LEVEL = "/state-apply-record/page-level"; |
| | | public static final String STATE_APPLY_RECORD_SAVE = "/state-apply-record/save"; |
| | | public static final String STATE_APPLY_RECORD_IMPORT = "/state-apply-record/import"; |
| | | public static final String STATE_APPLY_RECORD_GET_OWNER = "/state-apply-record/get-owner"; |
| | | public static final String STATE_APPLY_RECORD_GET_OWNER_INFO = "/state-apply-record/get-owner-info"; |
| | | public static final String STATE_APPLY_RECORD_DETAIL = "/state-apply-record/detail"; |
| | | //工作流 |
| | | public static final String STATE_PROCESS_STATE_MODULE_PAGE = "/state-process/module/page"; |
| | | public static final String STATE_PROCESS_STATE_MODULE_UPDATE = "/state-process/module/update"; |
| | | public static final String STATE_PROCESS_TEMPLATE_PAGE = "/state-process-template/page"; |
| | | public static final String STATE_PROCESS_TEMPLATE_GET_BY_ID = "/state-process-template/get/{id}"; |
| | | public static final String STATE_PROCESS_TEMPLATE_DELETE = "/state-process-template/delete/{id}"; |
| | | public static final String STATE_PROCESS_TEMPLATE_UPDATE = "/state-process-template/update"; |
| | | public static final String STATE_PROCESS_TEMPLATE_CREATE = "/state-process/template/create"; |
| | | public static final String STATE_PROCESS_START = "/state-process/start"; |
| | | public static final String STATE_PROCESS_WAIT_TASK_PAGE = "/state-process/wait/task/page"; |
| | | public static final String STATE_PROCESS_DEAL_TASK_PAGE = "/state-process/deal/task/page"; |
| | | public static final String STATE_PROCESS_COPY_TASK_PAGE = "/state-process/copy/task/page"; |
| | | public static final String STATE_PROCESS_AGREE = "/state-process/agree"; |
| | | public static final String STATE_PROCESS_REFUSE = "/state-process/refuse"; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.api; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author gf |
| | | * @date 2024-03-06 15:30 |
| | | */ |
| | | public class CommonPage<T> { |
| | | private Integer pageNum; |
| | | private Integer pageSize; |
| | | private Integer totalPage; |
| | | private Long total; |
| | | private List<T> list; |
| | | |
| | | |
| | | /** |
| | | * 将mybatis plus的分页IPage转为分页信息 |
| | | * |
| | | * @param pageInfo |
| | | * @return CommonPage<T> |
| | | * @date 2020/4/15 14:38 |
| | | */ |
| | | public static <T> CommonPage<T> restPage(IPage<T> pageInfo) { |
| | | CommonPage<T> result = new CommonPage<T>(); |
| | | result.setTotalPage((int) pageInfo.getPages()); |
| | | result.setPageNum((int) pageInfo.getCurrent()); |
| | | result.setPageSize((int) pageInfo.getSize()); |
| | | result.setTotal(pageInfo.getTotal()); |
| | | result.setList(pageInfo.getRecords()); |
| | | return result; |
| | | } |
| | | |
| | | public Integer getPageNum() { |
| | | return pageNum; |
| | | } |
| | | |
| | | public void setPageNum(Integer pageNum) { |
| | | this.pageNum = pageNum; |
| | | } |
| | | |
| | | public Integer getPageSize() { |
| | | return pageSize; |
| | | } |
| | | |
| | | public void setPageSize(Integer pageSize) { |
| | | this.pageSize = pageSize; |
| | | } |
| | | |
| | | public Integer getTotalPage() { |
| | | return totalPage; |
| | | } |
| | | |
| | | public void setTotalPage(Integer totalPage) { |
| | | this.totalPage = totalPage; |
| | | } |
| | | |
| | | public List<T> getList() { |
| | | return list; |
| | | } |
| | | |
| | | public void setList(List<T> list) { |
| | | this.list = list; |
| | | } |
| | | |
| | | public Long getTotal() { |
| | | return total; |
| | | } |
| | | |
| | | public void setTotal(Long total) { |
| | | this.total = total; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.api; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * HTTP 返回数据格式 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class CommonResult<T> implements Serializable { |
| | | |
| | | private long code; |
| | | private String msg; |
| | | private T data; |
| | | |
| | | protected CommonResult() { |
| | | } |
| | | |
| | | protected CommonResult(long code, String msg, T data) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | this.data = data; |
| | | } |
| | | |
| | | /** |
| | | * 成功返回结果 |
| | | */ |
| | | public static <T> CommonResult<T> success() { |
| | | return new CommonResult<T>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMsg(), null); |
| | | } |
| | | |
| | | /** |
| | | * 成功返回结果 |
| | | * |
| | | * @param data 获取的数据 |
| | | */ |
| | | public static <T> CommonResult<T> success(T data) { |
| | | return new CommonResult<T>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMsg(), data); |
| | | } |
| | | |
| | | /** |
| | | * 成功返回结果 |
| | | * |
| | | * @param data 获取的数据 |
| | | * @param msg 提示信息 |
| | | */ |
| | | public static <T> CommonResult<T> success(T data, String msg) { |
| | | return new CommonResult<T>(ResultCode.SUCCESS.getCode(), msg, data); |
| | | } |
| | | |
| | | /** |
| | | * 失败返回结果 |
| | | * |
| | | * @param errorCode 错误码 |
| | | */ |
| | | public static <T> CommonResult<T> failed(IErrorCode errorCode) { |
| | | return new CommonResult<T>(errorCode.getCode(), errorCode.getMsg(), null); |
| | | } |
| | | |
| | | /** |
| | | * 失败返回结果 |
| | | * |
| | | * @param msg 提示信息 |
| | | */ |
| | | public static <T> CommonResult<T> failed(String msg) { |
| | | return new CommonResult<T>(ResultCode.FAILED.getCode(), msg, null); |
| | | } |
| | | |
| | | /** |
| | | * 失败返回结果 |
| | | */ |
| | | public static <T> CommonResult<T> failed() { |
| | | return failed(ResultCode.FAILED); |
| | | } |
| | | |
| | | /** |
| | | * 参数验证失败返回结果 |
| | | */ |
| | | public static <T> CommonResult<T> validateFailed() { |
| | | return failed(ResultCode.VALIDATE_FAILED); |
| | | } |
| | | |
| | | /** |
| | | * 参数验证失败返回结果 |
| | | * |
| | | * @param msg 提示信息 |
| | | */ |
| | | public static <T> CommonResult<T> validateFailed(String msg) { |
| | | return new CommonResult<T>(ResultCode.VALIDATE_FAILED.getCode(), msg, null); |
| | | } |
| | | |
| | | /** |
| | | * 未登录返回结果 |
| | | */ |
| | | public static <T> CommonResult<T> unauthorized(T data) { |
| | | return new CommonResult<T>(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMsg(), data); |
| | | } |
| | | |
| | | /** |
| | | * 未授权返回结果 |
| | | */ |
| | | public static <T> CommonResult<T> forbidden(T data) { |
| | | return new CommonResult<T>(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMsg(), data); |
| | | } |
| | | |
| | | /** |
| | | * 数据未找到返回结果 |
| | | */ |
| | | public static <T> CommonResult<T> notFound() { |
| | | return new CommonResult<T>(ResultCode.NOTFOUND.getCode(), ResultCode.NOTFOUND.getMsg(), null); |
| | | } |
| | | |
| | | /** |
| | | * 数据未找到返回结果 |
| | | */ |
| | | public static <T> CommonResult<T> notFound(String msg) { |
| | | return new CommonResult<T>(ResultCode.NOTFOUND.getCode(), msg, null); |
| | | } |
| | | |
| | | public long getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(long 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; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.api; |
| | | |
| | | /** |
| | | * 封装API的错误码 |
| | | * Created by gf on 2019/4/19. |
| | | */ |
| | | public interface IErrorCode { |
| | | int getCode(); |
| | | |
| | | String getMsg(); |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.api; |
| | | |
| | | /** |
| | | * 枚举了一些常用API操作码 |
| | | * Created by gf on 2020/4/19. |
| | | */ |
| | | public enum ResultCode implements IErrorCode { |
| | | SUCCESS(200, "操作成功"), FAILED(500, "操作失败"), VALIDATE_FAILED(400, "参数检验失败"), UNAUTHORIZED(401, "暂未登录或token已经过期"), FORBIDDEN(403, "没有相关权限"), NOTFOUND(404, "数据未找到"); |
| | | |
| | | |
| | | private int code; |
| | | private String msg; |
| | | |
| | | ResultCode(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | @Override |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | @Override |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.controller; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.zzg.common.constant.HttpStatus; |
| | | import com.zzg.common.core.domain.AjaxResult; |
| | | import com.zzg.common.core.domain.model.LoginUser; |
| | | import com.zzg.common.core.page.PageDomain; |
| | | import com.zzg.common.core.page.TableDataInfo; |
| | | import com.zzg.common.core.page.TableSupport; |
| | | import com.zzg.common.utils.DateUtils; |
| | | import com.zzg.common.utils.PageUtils; |
| | | import com.zzg.common.utils.SecurityUtils; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.common.utils.sql.SqlUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.web.bind.WebDataBinder; |
| | | import org.springframework.web.bind.annotation.InitBinder; |
| | | |
| | | import java.beans.PropertyEditorSupport; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * web层通用数据处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | 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 String getUserId() { |
| | | return getLoginUser().getUserId(); |
| | | } |
| | | |
| | | /** |
| | | * 获取登录部门id |
| | | */ |
| | | public String getDeptId() { |
| | | return getLoginUser().getDeptId(); |
| | | } |
| | | |
| | | /** |
| | | * 获取登录用户名 |
| | | */ |
| | | public String getUsername() { |
| | | return getLoginUser().getUsername(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Objects; |
| | | import com.zzg.common.constant.HttpStatus; |
| | | import com.zzg.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 操作消息提醒 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | import java.util.HashMap; |
| | | import java.util.Objects; |
| | | |
| | | public class AjaxResult<T> extends HashMap<String, Object> { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 状态码 */ |
| | | public static final String CODE_TAG = "code"; |
| | | |
| | | /** 返回内容 */ |
| | | public static final String MSG_TAG = "msg"; |
| | | |
| | | /** 数据对象 */ |
| | | public static final String DATA_TAG = "data"; |
| | | |
| | | /** |
| | | * 初始化一个新创建的 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, T data) { |
| | | super.put(CODE_TAG, code); |
| | | super.put(MSG_TAG, msg); |
| | | if (data != null) { |
| | | super.put(DATA_TAG, data); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 返回成功消息 |
| | | * |
| | | * @return 成功消息 |
| | | */ |
| | | public static <T> AjaxResult<T> success() { |
| | | return AjaxResult.success("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 返回成功数据 |
| | | * |
| | | * @return 成功消息 |
| | | */ |
| | | public static <T> AjaxResult<T> success(T data) { |
| | | return AjaxResult.success("操作成功", data); |
| | | } |
| | | |
| | | /** |
| | | * 返回成功消息 |
| | | * |
| | | * @param msg 返回内容 |
| | | * @return 成功消息 |
| | | */ |
| | | public static <T> AjaxResult<T> success(String msg) { |
| | | return AjaxResult.success(msg, null); |
| | | } |
| | | |
| | | /** |
| | | * 返回成功消息 |
| | | * |
| | | * @param msg 返回内容 |
| | | * @param data 数据对象 |
| | | * @return 成功消息 |
| | | */ |
| | | public static <T> AjaxResult<T> success(String msg, T data) { |
| | | return new AjaxResult<>(HttpStatus.SUCCESS, msg, data); |
| | | } |
| | | |
| | | /** |
| | | * 返回警告消息 |
| | | * |
| | | * @param msg 返回内容 |
| | | * @return 警告消息 |
| | | */ |
| | | public static <T> AjaxResult<T> warn(String msg) { |
| | | return AjaxResult.warn(msg, null); |
| | | } |
| | | |
| | | /** |
| | | * 返回警告消息 |
| | | * |
| | | * @param msg 返回内容 |
| | | * @param data 数据对象 |
| | | * @return 警告消息 |
| | | */ |
| | | public static <T> AjaxResult<T> warn(String msg, T data) { |
| | | return new AjaxResult<>(HttpStatus.WARN, msg, data); |
| | | } |
| | | |
| | | /** |
| | | * 返回错误消息 |
| | | * |
| | | * @return 错误消息 |
| | | */ |
| | | public static <T> AjaxResult<T> error() { |
| | | return AjaxResult.error("操作失败"); |
| | | } |
| | | |
| | | /** |
| | | * 返回错误消息 |
| | | * |
| | | * @param msg 返回内容 |
| | | * @return 错误消息 |
| | | */ |
| | | public static <T> AjaxResult<T> error(String msg) { |
| | | return AjaxResult.error(msg, null); |
| | | } |
| | | |
| | | /** |
| | | * 返回错误消息 |
| | | * |
| | | * @param msg 返回内容 |
| | | * @param data 数据对象 |
| | | * @return 错误消息 |
| | | */ |
| | | public static <T> AjaxResult<T> error(String msg, T data) { |
| | | return new AjaxResult<>(HttpStatus.ERROR, msg, data); |
| | | } |
| | | |
| | | /** |
| | | * 返回错误消息 |
| | | * |
| | | * @param code 状态码 |
| | | * @param msg 返回内容 |
| | | * @return 错误消息 |
| | | */ |
| | | public static <T> AjaxResult<T> 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<T> put(String key, Object value) { |
| | | super.put(key, value); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 获取数据对象 |
| | | * |
| | | * @return 数据对象 |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public T getData() { |
| | | return (T) super.get(DATA_TAG); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Entity基类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Data |
| | | public class BaseEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 搜索值 |
| | | */ |
| | | @JsonIgnore |
| | | @TableField(exist = false) |
| | | private String searchValue; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(value = "create_by",fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(value = "create_time",fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(value = "update_by",fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @TableField(exist = false) |
| | | private String remark; |
| | | @TableField(exist = false) |
| | | private Integer page; |
| | | @TableField(exist = false) |
| | | private Integer limit; |
| | | |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params; |
| | | |
| | | public Map<String, Object> getParams() { |
| | | if (params == null) { |
| | | params = new HashMap<>(); |
| | | } |
| | | return params; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 通用id集合类 |
| | | * |
| | | * @author gf |
| | | * @date 2024-03-08 15:11 |
| | | */ |
| | | @Data |
| | | public class IdListRequest { |
| | | private List<String> ids; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 通用id类 |
| | | * |
| | | * @author gf |
| | | * @date 2024-03-08 15:11 |
| | | */ |
| | | @Data |
| | | public class IdRequest { |
| | | private String id; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class PageRequest { |
| | | |
| | | /** |
| | | * 页码 |
| | | */ |
| | | @ApiModelProperty("页码") |
| | | private Integer pageNum = 1; |
| | | /** |
| | | * 每页显示数 |
| | | */ |
| | | @ApiModelProperty("页数") |
| | | private Integer pageSize = 10; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import com.zzg.common.constant.HttpStatus; |
| | | |
| | | /** |
| | | * 响应信息主体 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class R<T> implements Serializable |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 成功 */ |
| | | public static final int SUCCESS = HttpStatus.SUCCESS; |
| | | |
| | | /** 失败 */ |
| | | public static final int FAIL = HttpStatus.ERROR; |
| | | |
| | | 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 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; |
| | | } |
| | | |
| | | public static <T> Boolean isError(R<T> ret) |
| | | { |
| | | return !isSuccess(ret); |
| | | } |
| | | |
| | | public static <T> Boolean isSuccess(R<T> ret) |
| | | { |
| | | return R.SUCCESS == ret.getCode(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Entity基类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SuperEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 搜索值 |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | 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; |
| | | @TableField(exist = false) |
| | | private Integer pageNum; |
| | | @TableField(exist = false) |
| | | private Integer pageSize; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params; |
| | | |
| | | 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; |
| | | } |
| | | |
| | | public Integer getPageNum() { |
| | | return pageNum; |
| | | } |
| | | |
| | | public void setPageNum(Integer pageNum) { |
| | | this.pageNum = pageNum; |
| | | } |
| | | |
| | | public Integer getPageSize() { |
| | | return pageSize; |
| | | } |
| | | |
| | | public void setPageSize(Integer pageSize) { |
| | | this.pageSize = pageSize; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Tree基类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Data |
| | | public class TreeEntity extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 父菜单名称 |
| | | */ |
| | | private String parentName; |
| | | |
| | | /** |
| | | * 父菜单ID |
| | | */ |
| | | private String parentId; |
| | | |
| | | /** |
| | | * 显示顺序 |
| | | */ |
| | | private Integer orderNum; |
| | | |
| | | /** |
| | | * 祖级列表 |
| | | */ |
| | | private String ancestors; |
| | | /** |
| | | * 当前节点名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 当前节点Id |
| | | */ |
| | | private String id; |
| | | |
| | | |
| | | /** |
| | | * 子部门 |
| | | */ |
| | | private List<?> children = new ArrayList<>(); |
| | | |
| | | /** 其他 */ |
| | | private Object other; |
| | | |
| | | /** 其他 */ |
| | | private Object elseParam; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.zzg.common.core.domain.entity.system.SysDept; |
| | | import com.zzg.common.core.domain.entity.system.SysMenu; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Treeselect树结构实体类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TreeSelect implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 节点ID |
| | | */ |
| | | private String 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 String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String 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; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("state_agreement") |
| | | public class StateAgreement extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | |
| | | private String stateHouseholdId; |
| | | |
| | | private String appendFileName; |
| | | |
| | | //协议类型 |
| | | private Integer agreementFileType; |
| | | |
| | | //类型为模拟的时候为模拟金额/为合同的是时候为合同金额 |
| | | private Double money; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date effectiveDate; |
| | | |
| | | @TableField("agreement_number") |
| | | private String agreementNumber; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date signAt; |
| | | @TableLogic(value = "0", delval = "1") |
| | | private Integer delFlag = 0; |
| | | |
| | | private Integer auditStatus; |
| | | |
| | | private String workflowId; |
| | | |
| | | private String fileUrl; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("state_apply_record") // Specify the table name |
| | | public class StateApplyRecord extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | @TableLogic(value = "0", delval = "1") |
| | | private Integer delFlag = 0; |
| | | private String projectId; |
| | | private String recordNo; |
| | | private Integer householdCount = 0; |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "##0.0000") |
| | | private BigDecimal amount = new BigDecimal("0"); |
| | | private Integer applyStatus; |
| | | private String applyUser; |
| | | private String applyDepartment; |
| | | private Integer applyType; |
| | | private String fileUrl; |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date transitionFeeEndDate; |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date transitionFeeStartDate; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("state_apply_record_item") |
| | | public class StateApplyRecordItem extends BaseEntity { |
| | | |
| | | @ApiModelProperty(value = "主键ID", example = "12345") |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "删除标志(0: 未删除, 1: 已删除)", example = "0") |
| | | @TableLogic(value = "0", delval = "1") |
| | | private Integer delFlag = 0; |
| | | |
| | | @ApiModelProperty(value = "权利人ID", example = "Owner123") |
| | | private String stateHouseholdOwner; |
| | | @TableField(exist = false) |
| | | private String stateHouseholdOwnerId; |
| | | |
| | | private String stateHouseholdId; |
| | | |
| | | @ApiModelProperty(value = "开始发放时间", example = "2024-01-01T12:00:00") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date startDistributionTime; |
| | | |
| | | @ApiModelProperty(value = "预计结束发放时间", example = "2024-12-31") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date estimatedEndDistributionTime; |
| | | |
| | | @ApiModelProperty(value = "发放月数", example = "12") |
| | | private String distributionMonths; |
| | | |
| | | @ApiModelProperty(value = "额外发放天数", example = "5") |
| | | private String additionalDistributionDays; |
| | | |
| | | @ApiModelProperty(value = "发放金额", example = "10000.50") |
| | | private String distributionAmount; |
| | | |
| | | @ApiModelProperty(value = "请账记录ID", example = "ApplyID123") |
| | | private String applyId; |
| | | |
| | | @ApiModelProperty(value = "过渡费标准", example = "Standard100") |
| | | private String transitionFee; |
| | | @TableField(exist = false) |
| | | private String realEstateCertificateNumber; |
| | | @TableField(exist = false) |
| | | private String street; |
| | | @TableField(exist = false) |
| | | private String ownerName; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @TableName("state_asset") |
| | | public class StateAsset extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | |
| | | private String stateProjectId; |
| | | |
| | | //预算 |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "##0.0000") |
| | | private BigDecimal virtualMoney; |
| | | |
| | | //货币赔偿比例 |
| | | private Double moneyCompensationRate; |
| | | |
| | | //产权置换 |
| | | private Double goodsCompensationRate; |
| | | |
| | | private String appendFileName; |
| | | |
| | | private Integer status; |
| | | |
| | | //上报人 |
| | | private String submittedBy; |
| | | |
| | | @TableLogic(value = "0", delval = "1") |
| | | private Integer delFlag = 0; |
| | | |
| | | private String fileUrl; |
| | | |
| | | private Integer workflowId; |
| | | |
| | | private String street; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | //入户调查 |
| | | |
| | | @Data |
| | | @TableName("state_household") |
| | | public class StateHousehold extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | |
| | | private String stateProjectId; |
| | | |
| | | private String workFlowId; |
| | | |
| | | //房屋使用用途 HouseUsingTypeEnum |
| | | private Integer houseUsingType; |
| | | |
| | | //街道 |
| | | private String street; |
| | | |
| | | //门牌 |
| | | private String doorNumber; |
| | | |
| | | //附号 |
| | | private String apartmentNumber; |
| | | |
| | | //栋号 |
| | | private String buildingNumber; |
| | | |
| | | //单元 |
| | | private String unit; |
| | | |
| | | //楼层 |
| | | private String floor; |
| | | |
| | | //房号 |
| | | private String roomNumber; |
| | | |
| | | //最终地址 |
| | | private String householdLocation; |
| | | private String appHouseholdLocation; |
| | | |
| | | //不动产权 |
| | | private String realEstateCertificateNumber; |
| | | |
| | | //国土土地使用证号 |
| | | private String usingAreaCertificateNumber; |
| | | |
| | | //产别 |
| | | private Integer productionType; |
| | | @TableField(exist = false) |
| | | private String productionTypeStr; |
| | | |
| | | //建筑面积 |
| | | private Double houseHoldArea; |
| | | |
| | | //套内面积 |
| | | private Double buildingInnerArea; |
| | | |
| | | //公摊面积 |
| | | private Double publicUsingArea; |
| | | |
| | | //以下数据是移动端导入 只需要进行新增即可 |
| | | //补偿方式 |
| | | private Integer compensationType; |
| | | |
| | | //赔偿总额 |
| | | private Double compensationMoney; |
| | | |
| | | //是否同意搬迁 新建时为0 |
| | | private Integer agreeMove; |
| | | |
| | | @TableField(exist = false) |
| | | private String agreeMoveStr; |
| | | |
| | | //政府援助 |
| | | private Integer isGovernmentHelp; |
| | | |
| | | //救助类型 |
| | | private Integer helpType; |
| | | @TableLogic(value = "0", delval = "1") |
| | | private Integer delFlag = 0; |
| | | private String appendData; |
| | | private String fileUrl; |
| | | |
| | | //审核状态 |
| | | private Integer status; |
| | | |
| | | //调查装状态 |
| | | private Integer searchStatus = 0; |
| | | |
| | | @TableField(value = "work_flow_id") |
| | | private String workflowId; |
| | | |
| | | @TableField(updateStrategy = FieldStrategy.ALWAYS) |
| | | private Integer agreementStatus; |
| | | private String deptId; |
| | | private String belongingStreetTown; |
| | | private Integer stage = 1; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @TableName("state_household_owner") |
| | | public class StateHouseholdOwner extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | |
| | | private String stateHouseholdId; |
| | | |
| | | private String ownerName; |
| | | |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private String personIdCard; |
| | | |
| | | private String companyAgent; |
| | | |
| | | private String companySocialCode; |
| | | |
| | | private String connectedPerson; |
| | | |
| | | private String phoneNumber; |
| | | //备注信息 |
| | | private String appendData; |
| | | |
| | | private Integer ownerType; |
| | | |
| | | @TableLogic(value = "0", delval = "1") |
| | | private Integer delFlag = 0; |
| | | |
| | | @NotNull |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private Integer isHelp; |
| | | |
| | | @NotNull |
| | | private String helpType; |
| | | private String remark; |
| | | |
| | | private Integer compensationType; |
| | | //1 男 2女 |
| | | private String sex; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName(value = "state_process_ext_instance") |
| | | public class StateProcessExtInstance { |
| | | |
| | | @TableId(type = IdType.NONE) |
| | | private String id; |
| | | private String templateId; |
| | | private String processId; |
| | | private Integer processVersion; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName(value = "state_process_instance_action") |
| | | public class StateProcessInstanceAction { |
| | | |
| | | @TableId(type = IdType.NONE) |
| | | private String id; |
| | | private String instanceId; |
| | | private boolean robot; |
| | | private String auditorId; |
| | | private Integer actionType; |
| | | private String userIds; |
| | | private String assigneeId; |
| | | private String nodeId; |
| | | private String remark; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName(value = "state_process_module") |
| | | public class StateProcessModule extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.NONE) |
| | | private String id; |
| | | /** |
| | | * 1=入户调查 |
| | | * 2=价格评估 |
| | | * 3=协议签订 |
| | | * 4=资金管理-预算资金 |
| | | * 5=住宅临时安置补助费 |
| | | * 6=停产停业经济损失补助费 |
| | | * 7=安置情况 |
| | | */ |
| | | private String category; |
| | | private String name; |
| | | private String templateName; |
| | | private String templateId; |
| | | private String remark; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName(value = "state_process_template") |
| | | public class StateProcessTemplate extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.NONE) |
| | | private String id; |
| | | private String templateKey; |
| | | private Integer templateVersion; |
| | | private String templateName; |
| | | private String settings; |
| | | private String process; |
| | | private String remark; |
| | | private Integer status; |
| | | private Long workFlowId; |
| | | private Integer workflowVersion; |
| | | private Integer delFlag; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("state_project") |
| | | public class StateProject extends BaseEntity { |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | @TableLogic(value = "0", delval = "1") |
| | | private Integer delFlag = 0; |
| | | @TableField(value = "project_no") |
| | | private String projectNo; |
| | | @TableField(value = "project_name") |
| | | private String projectName; |
| | | @TableField(value = "status") |
| | | private Integer status; |
| | | @TableField(value = "street") |
| | | private String street; |
| | | @TableField(value = "department") |
| | | private String department; |
| | | |
| | | @TableField(value = "start_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date startTime; |
| | | private String workflowId; |
| | | private String fileUrl; |
| | | |
| | | //征收转模拟时间 |
| | | private Date simulatedTime; |
| | | private Date levyTime; |
| | | //作废时间 |
| | | private Date cancelTime; |
| | | |
| | | //完成时间 |
| | | private Date finishedTime; |
| | | /** |
| | | * 需要评估 是否需要二次评估 0 不需要 1需要 |
| | | */ |
| | | @TableField(value = "is_need_evaluate") |
| | | private Integer isNeedEvaluate; |
| | | private Integer auditStatus; |
| | | private Integer priceStatus; |
| | | //实施单位 |
| | | @TableField(exist = false) |
| | | private String collectionEnforcementDepartment; |
| | | private Integer preStatusByCancel; |
| | | private Integer stage; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | @Data |
| | | @TableName("state_project_collection_file") |
| | | public class StateProjectCollectionFile extends BaseEntity { |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | @TableField(value = "del_flag") |
| | | @TableLogic(value = "0",delval = "1") |
| | | private Integer delFlag = 0; |
| | | private Integer fileType; |
| | | private String fileUrl; |
| | | private String fileName; |
| | | private String projectId; |
| | | private Integer parentId = 0; |
| | | |
| | | // Getters and Setters |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("state_project_compensate_standard") |
| | | public class StateProjectCompensateStandard extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | |
| | | private Integer category; |
| | | |
| | | private Integer compensateType; |
| | | @TableLogic(value = "0",delval = "1") |
| | | private Integer delFlag = 0; |
| | | |
| | | private String unit; |
| | | |
| | | private String compensateStandard; |
| | | |
| | | private String specification; |
| | | |
| | | private String standardName; |
| | | @TableField(exist = false) |
| | | private String oldStandardName; |
| | | |
| | | private String remake; |
| | | // 0 停用 1启用 |
| | | private Integer stopFlag = 1; |
| | | //1单价,2区间 |
| | | private Integer subType; |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | @Data |
| | | @TableName("state_project_compensation") |
| | | public class StateProjectCompensation extends BaseEntity { |
| | | |
| | | @TableId |
| | | private String projectId; |
| | | @TableLogic(value = "0",delval = "1") |
| | | private Integer delFlag = 0; |
| | | //赔偿标准 |
| | | private String compensationType; |
| | | //政策补偿 |
| | | private String policyCompensationType; |
| | | //政策补助 |
| | | private String policySubsidy; |
| | | //政策补贴 |
| | | private String policySupplement; |
| | | //奖励 |
| | | private String award; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | @Data |
| | | @TableName("state_project_info") |
| | | public class StateProjectInfo extends BaseEntity { |
| | | |
| | | @TableId |
| | | private String projectId; |
| | | @TableLogic(value = "0",delval = "1") |
| | | private Integer delFlag = 0; |
| | | private String resettlementType; |
| | | private String departmentAddress; |
| | | private String scopeCollection; |
| | | private String agentPhone; |
| | | private String projectRemake; |
| | | private String projectType; |
| | | private String houseCollectionDepartment; |
| | | private String legalPerson; |
| | | //征收实施单位 |
| | | private String collectionEnforcementDepartment; |
| | | private String chargePerson; |
| | | |
| | | // Getters and Setters |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("state_project_notice") |
| | | public class StateProjectNotice extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | |
| | | @TableField(value = "del_flag") |
| | | @TableLogic(value = "0", delval = "1") |
| | | private Integer delFlag = 0; |
| | | |
| | | @TableField(value = "project_id") |
| | | private String projectId; |
| | | |
| | | @TableField(value = "notice_no") |
| | | private String noticeNo; |
| | | |
| | | @TableField(value = "notice_name") |
| | | private String noticeName; |
| | | |
| | | @TableField(value = "publishing_department") |
| | | private String publishingDepartment; |
| | | |
| | | @TableField(value = "start_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date startTime; |
| | | |
| | | @TableField(value = "end_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date endTime; |
| | | |
| | | @TableField(value = "notice_web") |
| | | private String noticeWeb; |
| | | |
| | | @TableField(value = "notice_content") |
| | | private String noticeContent; |
| | | @TableField(value = "file_url", updateStrategy = FieldStrategy.IGNORED) |
| | | private String fileUrl; |
| | | @TableField(value = "img_url", updateStrategy = FieldStrategy.IGNORED) |
| | | private String imgUrl; |
| | | //1 正常公告 2转征收的公告 |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("state_settlement") |
| | | public class StateSettlement extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | |
| | | private String stateHouseholdId; |
| | | |
| | | //置换赔偿参数 |
| | | //置换后街道 |
| | | private String exchangeStreet; |
| | | |
| | | //置换后位置 |
| | | private String exchangeLocation; |
| | | |
| | | //置换后面积 |
| | | private Double exchangeArea; |
| | | |
| | | //置换后金额 |
| | | private Double exchangeMoney; |
| | | |
| | | //货币赔偿参数 |
| | | //结算面积 |
| | | private Double settlementArea; |
| | | |
| | | //结算金额 |
| | | private Double settlementMoney; |
| | | |
| | | //付款时间 |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date paidTime; |
| | | |
| | | //备注 |
| | | private String append; |
| | | |
| | | //安置批次 |
| | | private String settleName; |
| | | |
| | | @TableLogic(value = "0", delval = "1") |
| | | private Integer delFlag = 0; |
| | | |
| | | //安置时间 取默认的createdTime |
| | | |
| | | //附件url; |
| | | private String fileUrl; |
| | | |
| | | private Integer auditStatus; |
| | | |
| | | private String workflowId; |
| | | private String taskId; |
| | | |
| | | private String settleDepartment; |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.state; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import io.github.classgraph.json.Id; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName(value = "state_task_center" ) |
| | | public class StateTaskCenter extends BaseEntity { |
| | | |
| | | @TableId(type = IdType.NONE) |
| | | private String id; |
| | | private String name; |
| | | private Integer type; |
| | | private String moduleName; |
| | | private String remark; |
| | | private String category; |
| | | private String flowId; |
| | | private String variable; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.system; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import javax.validation.constraints.Email; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 部门表 sys_dept |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysDept extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 部门ID |
| | | */ |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String deptId; |
| | | |
| | | /** |
| | | * 父部门ID |
| | | */ |
| | | private String 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; |
| | | |
| | | /** |
| | | * 父部门名称 |
| | | */ |
| | | @TableField(exist=false) |
| | | private String parentName; |
| | | |
| | | private String cityId; |
| | | |
| | | public String getCityId() { |
| | | return cityId; |
| | | } |
| | | |
| | | public void setCityId(String cityId) { |
| | | this.cityId = cityId; |
| | | } |
| | | |
| | | /** |
| | | * 子部门 |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<SysDept> children = new ArrayList<SysDept>(); |
| | | |
| | | public String getDeptId() { |
| | | return deptId; |
| | | } |
| | | |
| | | public void setDeptId(String deptId) { |
| | | this.deptId = deptId; |
| | | } |
| | | |
| | | public String getParentId() { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(String parentId) { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public String getAncestors() { |
| | | return ancestors; |
| | | } |
| | | |
| | | public void setAncestors(String ancestors) { |
| | | this.ancestors = ancestors; |
| | | } |
| | | |
| | | @TableField(exist = false) |
| | | private String towns; |
| | | |
| | | public void setTowns(String towns) { |
| | | this.towns = towns; |
| | | } |
| | | |
| | | public String getTowns() { |
| | | return towns; |
| | | } |
| | | |
| | | @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()) |
| | | .append("cityId", getCityId()) |
| | | .toString(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.system; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zzg.common.annotation.Excel; |
| | | import com.zzg.common.annotation.Excel.ColumnType; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 字典数据表 sys_dict_data |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | |
| | | @TableName(value = "sys_dict_data", autoResultMap = true) |
| | | public class SysDictData extends BaseEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 字典编码 |
| | | */ |
| | | @Excel(name = "字典编码") |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String 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; |
| | | |
| | | private String parentCode; |
| | | |
| | | /** |
| | | * 是否默认(Y是 N否) |
| | | */ |
| | | @Excel(name = "是否默认", readConverterExp = "Y=是,N=否") |
| | | private String isDefault; |
| | | |
| | | /** |
| | | * 状态(0正常 1停用) |
| | | */ |
| | | @Excel(name = "状态", readConverterExp = "0=正常,1=停用") |
| | | private String status; |
| | | |
| | | @NotBlank(message = "字典标签不能为空") |
| | | @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") |
| | | public String getDictLabel() { |
| | | return dictLabel; |
| | | } |
| | | |
| | | @NotBlank(message = "字典键值不能为空") |
| | | @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") |
| | | public String getDictValue() { |
| | | return dictValue; |
| | | } |
| | | |
| | | @NotBlank(message = "字典类型不能为空") |
| | | @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") |
| | | public String getDictType() { |
| | | return dictType; |
| | | } |
| | | |
| | | @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") |
| | | public String getCssClass() { |
| | | return cssClass; |
| | | } |
| | | |
| | | @TableField(exist = false) |
| | | private List<SysDictData> childList; |
| | | |
| | | public String getDictCode() { |
| | | return dictCode; |
| | | } |
| | | |
| | | public void setDictCode(String dictCode) { |
| | | this.dictCode = dictCode; |
| | | } |
| | | |
| | | public Long getDictSort() { |
| | | return dictSort; |
| | | } |
| | | |
| | | public void setDictSort(Long dictSort) { |
| | | this.dictSort = dictSort; |
| | | } |
| | | |
| | | public void setDictLabel(String dictLabel) { |
| | | this.dictLabel = dictLabel; |
| | | } |
| | | |
| | | public void setDictValue(String dictValue) { |
| | | this.dictValue = dictValue; |
| | | } |
| | | |
| | | public void setDictType(String dictType) { |
| | | this.dictType = dictType; |
| | | } |
| | | |
| | | public void setCssClass(String cssClass) { |
| | | this.cssClass = cssClass; |
| | | } |
| | | |
| | | public String getListClass() { |
| | | return listClass; |
| | | } |
| | | |
| | | public void setListClass(String listClass) { |
| | | this.listClass = listClass; |
| | | } |
| | | |
| | | public String getParentCode() { |
| | | return parentCode; |
| | | } |
| | | |
| | | public void setParentCode(String parentCode) { |
| | | this.parentCode = parentCode; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | public List<SysDictData> getChildList() { |
| | | return childList; |
| | | } |
| | | |
| | | public void setChildList(List<SysDictData> childList) { |
| | | this.childList = childList; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.system; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.zzg.common.annotation.Excel; |
| | | import com.zzg.common.annotation.Excel.ColumnType; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Pattern; |
| | | import javax.validation.constraints.Size; |
| | | |
| | | /** |
| | | * 字典类型表 sys_dict_type |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysDictType extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 字典主键 |
| | | */ |
| | | @Excel(name = "字典主键") |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String dictId; |
| | | |
| | | /** |
| | | * 字典名称 |
| | | */ |
| | | @Excel(name = "字典名称") |
| | | private String dictName; |
| | | |
| | | /** |
| | | * 字典类型 |
| | | */ |
| | | @Excel(name = "字典类型") |
| | | private String dictType; |
| | | |
| | | /** |
| | | * 状态(0正常 1停用) |
| | | */ |
| | | @Excel(name = "状态", readConverterExp = "0=正常,1=停用") |
| | | private String status; |
| | | |
| | | public String getDictId() { |
| | | return dictId; |
| | | } |
| | | |
| | | public void setDictId(String dictId) { |
| | | this.dictId = dictId; |
| | | } |
| | | |
| | | @NotBlank(message = "字典名称不能为空") |
| | | @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") |
| | | public String getDictName() { |
| | | return dictName; |
| | | } |
| | | |
| | | public void setDictName(String dictName) { |
| | | this.dictName = dictName; |
| | | } |
| | | |
| | | @NotBlank(message = "字典类型不能为空") |
| | | @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") |
| | | @Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)") |
| | | public String getDictType() { |
| | | return dictType; |
| | | } |
| | | |
| | | public void setDictType(String dictType) { |
| | | this.dictType = dictType; |
| | | } |
| | | |
| | | 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("dictId", getDictId()) |
| | | .append("dictName", getDictName()) |
| | | .append("dictType", getDictType()) |
| | | .append("status", getStatus()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.system; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 菜单权限表 sys_menu |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysMenu extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 菜单ID |
| | | */ |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String menuId; |
| | | |
| | | /** |
| | | * 菜单名称 |
| | | */ |
| | | private String menuName; |
| | | |
| | | /** |
| | | * 父菜单名称 |
| | | */ |
| | | private String parentName; |
| | | |
| | | /** |
| | | * 父菜单ID |
| | | */ |
| | | private String parentId; |
| | | |
| | | /** |
| | | * 显示顺序 |
| | | */ |
| | | private Integer orderNum; |
| | | |
| | | /** |
| | | * 路由地址 |
| | | */ |
| | | private String path; |
| | | |
| | | /** |
| | | * 组件路径 |
| | | */ |
| | | private String component; |
| | | |
| | | /** |
| | | * 路由参数 |
| | | */ |
| | | private String query; |
| | | |
| | | /** |
| | | * 是否为外链(0是 1否) |
| | | */ |
| | | private String isFrame; |
| | | |
| | | /** |
| | | * 是否缓存(0缓存 1不缓存) |
| | | */ |
| | | private String isCache; |
| | | |
| | | /** |
| | | * 类型(M目录 C菜单 F按钮) |
| | | */ |
| | | private String menuType; |
| | | |
| | | /** |
| | | * 显示状态(0显示 1隐藏) |
| | | */ |
| | | private String visible; |
| | | |
| | | /** |
| | | * 菜单状态(0正常 1停用) |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 权限字符串 |
| | | */ |
| | | private String perms; |
| | | |
| | | /** |
| | | * 菜单图标 |
| | | */ |
| | | private String icon; |
| | | |
| | | /** |
| | | * 子菜单 |
| | | */ |
| | | private List<SysMenu> children = new ArrayList<SysMenu>(); |
| | | |
| | | public String getMenuId() { |
| | | return menuId; |
| | | } |
| | | |
| | | public void setMenuId(String menuId) { |
| | | this.menuId = menuId; |
| | | } |
| | | |
| | | @NotBlank(message = "菜单名称不能为空") |
| | | @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") |
| | | public String getMenuName() { |
| | | return menuName; |
| | | } |
| | | |
| | | public void setMenuName(String menuName) { |
| | | this.menuName = menuName; |
| | | } |
| | | |
| | | public String getParentName() { |
| | | return parentName; |
| | | } |
| | | |
| | | public void setParentName(String parentName) { |
| | | this.parentName = parentName; |
| | | } |
| | | |
| | | public String getParentId() { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(String parentId) { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | @NotNull(message = "显示顺序不能为空") |
| | | public Integer getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(Integer orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") |
| | | public String getPath() { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) { |
| | | this.path = path; |
| | | } |
| | | |
| | | @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") |
| | | public String getComponent() { |
| | | return component; |
| | | } |
| | | |
| | | public void setComponent(String component) { |
| | | this.component = component; |
| | | } |
| | | |
| | | public String getQuery() { |
| | | return query; |
| | | } |
| | | |
| | | public void setQuery(String query) { |
| | | this.query = query; |
| | | } |
| | | |
| | | public String getIsFrame() { |
| | | return isFrame; |
| | | } |
| | | |
| | | public void setIsFrame(String isFrame) { |
| | | this.isFrame = isFrame; |
| | | } |
| | | |
| | | public String getIsCache() { |
| | | return isCache; |
| | | } |
| | | |
| | | public void setIsCache(String isCache) { |
| | | this.isCache = isCache; |
| | | } |
| | | |
| | | @NotBlank(message = "菜单类型不能为空") |
| | | public String getMenuType() { |
| | | return menuType; |
| | | } |
| | | |
| | | public void setMenuType(String menuType) { |
| | | this.menuType = menuType; |
| | | } |
| | | |
| | | public String getVisible() { |
| | | return visible; |
| | | } |
| | | |
| | | public void setVisible(String visible) { |
| | | this.visible = visible; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") |
| | | public String getPerms() { |
| | | return perms; |
| | | } |
| | | |
| | | public void setPerms(String perms) { |
| | | this.perms = perms; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public List<SysMenu> getChildren() { |
| | | return children; |
| | | } |
| | | |
| | | public void setChildren(List<SysMenu> children) { |
| | | this.children = children; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("menuId", getMenuId()) |
| | | .append("menuName", getMenuName()) |
| | | .append("parentId", getParentId()) |
| | | .append("orderNum", getOrderNum()) |
| | | .append("path", getPath()) |
| | | .append("component", getComponent()) |
| | | .append("isFrame", getIsFrame()) |
| | | .append("IsCache", getIsCache()) |
| | | .append("menuType", getMenuType()) |
| | | .append("visible", getVisible()) |
| | | .append("status ", getStatus()) |
| | | .append("perms", getPerms()) |
| | | .append("icon", getIcon()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.system; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.zzg.common.annotation.Excel; |
| | | import com.zzg.common.annotation.Excel.ColumnType; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 角色表 sys_role |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysRole extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @Excel(name = "角色序号", cellType = ColumnType.NUMERIC) |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String roleId; |
| | | |
| | | /** |
| | | * 角色名称 |
| | | */ |
| | | @Excel(name = "角色名称") |
| | | private String roleName; |
| | | |
| | | /** |
| | | * 角色权限 |
| | | */ |
| | | @Excel(name = "角色权限") |
| | | private String roleKey; |
| | | |
| | | /** |
| | | * 角色排序 |
| | | */ |
| | | @Excel(name = "角色排序") |
| | | private Integer roleSort; |
| | | |
| | | /** |
| | | * 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) |
| | | */ |
| | | @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") |
| | | private String dataScope; |
| | | |
| | | /** |
| | | * 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) |
| | | */ |
| | | private Integer menuCheckStrictly; |
| | | |
| | | /** |
| | | * 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) |
| | | */ |
| | | private Integer deptCheckStrictly; |
| | | |
| | | /** |
| | | * 角色状态(0正常 1停用) |
| | | */ |
| | | @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") |
| | | private String status; |
| | | |
| | | /** |
| | | * 删除标志(0代表存在 2代表删除) |
| | | */ |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * 用户是否存在此角色标识 默认不存在 |
| | | */ |
| | | private boolean flag = false; |
| | | |
| | | /** |
| | | * 菜单组 |
| | | */ |
| | | private String[] menuIds; |
| | | |
| | | /** |
| | | * 部门组(数据权限) |
| | | */ |
| | | private String[] deptIds; |
| | | |
| | | /** |
| | | * 角色菜单权限 |
| | | */ |
| | | private Set<String> permissions; |
| | | |
| | | public SysRole() { |
| | | |
| | | } |
| | | |
| | | public SysRole(String roleId) { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | public String getRoleId() { |
| | | return roleId; |
| | | } |
| | | |
| | | public void setRoleId(String roleId) { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | public boolean isAdmin() { |
| | | return isAdmin(this.roleId); |
| | | } |
| | | |
| | | public static boolean isAdmin(String roleId) { |
| | | return roleId != null && "1".equals(roleId); |
| | | } |
| | | |
| | | @NotBlank(message = "角色名称不能为空") |
| | | @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") |
| | | public String getRoleName() { |
| | | return roleName; |
| | | } |
| | | |
| | | public void setRoleName(String roleName) { |
| | | this.roleName = roleName; |
| | | } |
| | | |
| | | @NotBlank(message = "权限字符不能为空") |
| | | @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") |
| | | public String getRoleKey() { |
| | | return roleKey; |
| | | } |
| | | |
| | | public void setRoleKey(String roleKey) { |
| | | this.roleKey = roleKey; |
| | | } |
| | | |
| | | @NotNull(message = "显示顺序不能为空") |
| | | public Integer getRoleSort() { |
| | | return roleSort; |
| | | } |
| | | |
| | | public void setRoleSort(Integer roleSort) { |
| | | this.roleSort = roleSort; |
| | | } |
| | | |
| | | public String getDataScope() { |
| | | return dataScope; |
| | | } |
| | | |
| | | public void setDataScope(String dataScope) { |
| | | this.dataScope = dataScope; |
| | | } |
| | | |
| | | public Integer getMenuCheckStrictly() { |
| | | return menuCheckStrictly; |
| | | } |
| | | |
| | | public void setMenuCheckStrictly(Integer menuCheckStrictly) { |
| | | this.menuCheckStrictly = menuCheckStrictly; |
| | | } |
| | | |
| | | public Integer getDeptCheckStrictly() { |
| | | return deptCheckStrictly; |
| | | } |
| | | |
| | | public void setDeptCheckStrictly(Integer deptCheckStrictly) { |
| | | this.deptCheckStrictly = deptCheckStrictly; |
| | | } |
| | | |
| | | 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 boolean isFlag() { |
| | | return flag; |
| | | } |
| | | |
| | | public void setFlag(boolean flag) { |
| | | this.flag = flag; |
| | | } |
| | | |
| | | public String[] getMenuIds() { |
| | | return menuIds; |
| | | } |
| | | |
| | | public void setMenuIds(String[] menuIds) { |
| | | this.menuIds = menuIds; |
| | | } |
| | | |
| | | public String[] getDeptIds() { |
| | | return deptIds; |
| | | } |
| | | |
| | | public void setDeptIds(String[] deptIds) { |
| | | this.deptIds = deptIds; |
| | | } |
| | | |
| | | public Set<String> getPermissions() { |
| | | return permissions; |
| | | } |
| | | |
| | | public void setPermissions(Set<String> permissions) { |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("roleId", getRoleId()) |
| | | .append("roleName", getRoleName()) |
| | | .append("roleKey", getRoleKey()) |
| | | .append("roleSort", getRoleSort()) |
| | | .append("dataScope", getDataScope()) |
| | | .append("menuCheckStrictly", getMenuCheckStrictly()) |
| | | .append("deptCheckStrictly", getDeptCheckStrictly()) |
| | | .append("status", getStatus()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.entity.system; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.zzg.common.annotation.Excel; |
| | | import com.zzg.common.annotation.Excel.Type; |
| | | import com.zzg.common.annotation.Excels; |
| | | import com.zzg.common.core.domain.BaseEntity; |
| | | import com.zzg.common.xss.Xss; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import javax.validation.constraints.Email; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户对象 sys_user |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Data |
| | | public class SysUser extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @Excel(name = "用户序号", prompt = "用户编号") |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String userId; |
| | | |
| | | /** |
| | | * 部门ID |
| | | */ |
| | | @Excel(name = "部门编号", type = Type.IMPORT) |
| | | private String deptId; |
| | | |
| | | @TableField(exist = false) |
| | | private String searchDeptId; |
| | | |
| | | /** |
| | | * 关联的乡镇ID |
| | | */ |
| | | private String cityId; |
| | | |
| | | /** |
| | | * 用户账号 |
| | | */ |
| | | @Excel(name = "登录名称") |
| | | private String userName; |
| | | |
| | | /** |
| | | * 用户昵称 |
| | | */ |
| | | @Excel(name = "用户名称") |
| | | private String nickName; |
| | | |
| | | /** |
| | | * 用户邮箱 |
| | | */ |
| | | @Excel(name = "用户邮箱") |
| | | private String email; |
| | | |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | @Excel(name = "手机号码") |
| | | private String phonenumber; |
| | | |
| | | /** |
| | | * 用户性别 |
| | | */ |
| | | @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") |
| | | private String sex; |
| | | |
| | | /** |
| | | * 用户头像 |
| | | */ |
| | | private String avatar; |
| | | |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String password; |
| | | |
| | | /** |
| | | * 帐号状态(0正常 1停用) |
| | | */ |
| | | @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") |
| | | private String status; |
| | | |
| | | /** |
| | | * 删除标志(0代表存在 2代表删除) |
| | | */ |
| | | private Integer delFlag; |
| | | |
| | | /** |
| | | * 最后登录IP |
| | | */ |
| | | @Excel(name = "最后登录IP", type = Type.EXPORT) |
| | | private String loginIp; |
| | | |
| | | /** |
| | | * 最后登录时间 |
| | | */ |
| | | @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) |
| | | private Date loginDate; |
| | | |
| | | /** |
| | | * 部门对象 |
| | | */ |
| | | @Excels({ |
| | | @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), |
| | | @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) |
| | | }) |
| | | @TableField(exist = false) |
| | | private SysDept dept; |
| | | |
| | | /** |
| | | * 角色对象 |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<SysRole> roles; |
| | | |
| | | /** |
| | | * 角色组 |
| | | */ |
| | | @TableField(exist = false) |
| | | private String[] roleIds; |
| | | |
| | | /** |
| | | * 岗位组 |
| | | */ |
| | | @TableField(exist = false) |
| | | private String[] postIds; |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @TableField(exist = false) |
| | | private String roleId; |
| | | |
| | | /** |
| | | * 角色 |
| | | */ |
| | | @TableField(exist = false) |
| | | private SysRole role; |
| | | |
| | | public SysUser() { |
| | | |
| | | } |
| | | |
| | | public SysUser(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public boolean isAdmin() { |
| | | return isAdmin(this.userId); |
| | | } |
| | | |
| | | public static boolean isAdmin(String userId) { |
| | | return userId != null && "1".equals(userId); |
| | | } |
| | | |
| | | public String getDeptId() { |
| | | return deptId; |
| | | } |
| | | |
| | | public void setDeptId(String deptId) { |
| | | this.deptId = deptId; |
| | | } |
| | | |
| | | public String getCityId() { |
| | | return cityId; |
| | | } |
| | | |
| | | public void setCityId(String cityId) { |
| | | this.cityId = cityId; |
| | | } |
| | | |
| | | @Xss(message = "用户昵称不能包含脚本字符") |
| | | @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") |
| | | public String getNickName() { |
| | | return nickName; |
| | | } |
| | | |
| | | public void setNickName(String nickName) { |
| | | this.nickName = nickName; |
| | | } |
| | | |
| | | @Xss(message = "用户账号不能包含脚本字符") |
| | | @NotBlank(message = "用户账号不能为空") |
| | | @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | @Email(message = "邮箱格式不正确") |
| | | @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") |
| | | public String getPhonenumber() { |
| | | return phonenumber; |
| | | } |
| | | |
| | | public void setPhonenumber(String phonenumber) { |
| | | this.phonenumber = phonenumber; |
| | | } |
| | | |
| | | public String getSex() { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(String sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getAvatar() { |
| | | return avatar; |
| | | } |
| | | |
| | | public void setAvatar(String avatar) { |
| | | this.avatar = avatar; |
| | | } |
| | | |
| | | public String getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Integer getDelFlag() { |
| | | return delFlag; |
| | | } |
| | | |
| | | public void setDelFlag(Integer delFlag) { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public String getLoginIp() { |
| | | return loginIp; |
| | | } |
| | | |
| | | public void setLoginIp(String loginIp) { |
| | | this.loginIp = loginIp; |
| | | } |
| | | |
| | | public Date getLoginDate() { |
| | | return loginDate; |
| | | } |
| | | |
| | | public void setLoginDate(Date loginDate) { |
| | | this.loginDate = loginDate; |
| | | } |
| | | |
| | | public SysDept getDept() { |
| | | return dept; |
| | | } |
| | | |
| | | public void setDept(SysDept dept) { |
| | | this.dept = dept; |
| | | } |
| | | |
| | | public List<SysRole> getRoles() { |
| | | return roles; |
| | | } |
| | | |
| | | public void setRoles(List<SysRole> roles) { |
| | | this.roles = roles; |
| | | } |
| | | |
| | | public String[] getRoleIds() { |
| | | return roleIds; |
| | | } |
| | | |
| | | public void setRoleIds(String[] roleIds) { |
| | | this.roleIds = roleIds; |
| | | } |
| | | |
| | | public String[] getPostIds() { |
| | | return postIds; |
| | | } |
| | | |
| | | public void setPostIds(String[] postIds) { |
| | | this.postIds = postIds; |
| | | } |
| | | |
| | | public String getRoleId() { |
| | | return roleId; |
| | | } |
| | | |
| | | public void setRoleId(String roleId) { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("userId", getUserId()) |
| | | .append("deptId", getDeptId()) |
| | | .append("userName", getUserName()) |
| | | .append("nickName", getNickName()) |
| | | .append("email", getEmail()) |
| | | .append("phonenumber", getPhonenumber()) |
| | | .append("sex", getSex()) |
| | | .append("avatar", getAvatar()) |
| | | .append("password", getPassword()) |
| | | .append("status", getStatus()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("loginIp", getLoginIp()) |
| | | .append("loginDate", getLoginDate()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .append("dept", getDept()) |
| | | .toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.model; |
| | | |
| | | /** |
| | | * 用户登录对象 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class LoginBody |
| | | { |
| | | /** |
| | | * 用户名 |
| | | */ |
| | | private String username; |
| | | |
| | | /** |
| | | * 用户密码 |
| | | */ |
| | | private String password; |
| | | |
| | | /** |
| | | * 验证码 |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * 唯一标识 |
| | | */ |
| | | private String uuid; |
| | | |
| | | 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 getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) |
| | | { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getUuid() |
| | | { |
| | | return uuid; |
| | | } |
| | | |
| | | public void setUuid(String uuid) |
| | | { |
| | | this.uuid = uuid; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.model; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.zzg.common.core.domain.entity.system.SysUser; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 登录用户身份权限 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class LoginUser implements UserDetails { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | private String userId; |
| | | |
| | | /** |
| | | * 部门ID |
| | | */ |
| | | private String deptId; |
| | | private String cityId; |
| | | |
| | | /** |
| | | * 用户唯一标识 |
| | | */ |
| | | private String token; |
| | | |
| | | /** |
| | | * 登录时间 |
| | | */ |
| | | private Long loginTime; |
| | | |
| | | /** |
| | | * 过期时间 |
| | | */ |
| | | private Long expireTime; |
| | | |
| | | /** |
| | | * 登录IP地址 |
| | | */ |
| | | private String ipaddr; |
| | | |
| | | /** |
| | | * 登录地点 |
| | | */ |
| | | private String loginLocation; |
| | | |
| | | /** |
| | | * 浏览器类型 |
| | | */ |
| | | private String browser; |
| | | |
| | | /** |
| | | * 操作系统 |
| | | */ |
| | | private String os; |
| | | |
| | | /** |
| | | * 权限列表 |
| | | */ |
| | | private Set<String> permissions; |
| | | |
| | | /** |
| | | * 用户信息 |
| | | */ |
| | | private SysUser user; |
| | | |
| | | |
| | | public LoginUser() { |
| | | } |
| | | |
| | | public LoginUser(SysUser user, Set<String> permissions) { |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | public LoginUser(String userId, String deptId, String cityId, SysUser user, Set<String> permissions) { |
| | | this.userId = userId; |
| | | this.deptId = deptId; |
| | | this.cityId = cityId; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getDeptId() { |
| | | return deptId; |
| | | } |
| | | |
| | | public void setDeptId(String deptId) { |
| | | this.deptId = deptId; |
| | | } |
| | | |
| | | public String getCityId() { |
| | | return cityId; |
| | | } |
| | | |
| | | public void setCityId(String cityId) { |
| | | this.cityId = cityId; |
| | | } |
| | | |
| | | public String getToken() { |
| | | return token; |
| | | } |
| | | |
| | | public void setToken(String token) { |
| | | this.token = token; |
| | | } |
| | | |
| | | @JSONField(serialize = false) |
| | | @Override |
| | | public String getPassword() { |
| | | return user.getPassword(); |
| | | } |
| | | |
| | | @Override |
| | | public String getUsername() { |
| | | return user.getUserName(); |
| | | } |
| | | |
| | | /** |
| | | * 账户是否未过期,过期无法验证 |
| | | */ |
| | | @JSONField(serialize = false) |
| | | @Override |
| | | public boolean isAccountNonExpired() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 指定用户是否解锁,锁定的用户无法进行身份验证 |
| | | * |
| | | * @return |
| | | */ |
| | | @JSONField(serialize = false) |
| | | @Override |
| | | public boolean isAccountNonLocked() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 |
| | | * |
| | | * @return |
| | | */ |
| | | @JSONField(serialize = false) |
| | | @Override |
| | | public boolean isCredentialsNonExpired() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 是否可用 ,禁用的用户不能身份验证 |
| | | * |
| | | * @return |
| | | */ |
| | | @JSONField(serialize = false) |
| | | @Override |
| | | public boolean isEnabled() { |
| | | return true; |
| | | } |
| | | |
| | | public Long getLoginTime() { |
| | | return loginTime; |
| | | } |
| | | |
| | | public void setLoginTime(Long loginTime) { |
| | | this.loginTime = loginTime; |
| | | } |
| | | |
| | | public String getIpaddr() { |
| | | return ipaddr; |
| | | } |
| | | |
| | | public void setIpaddr(String ipaddr) { |
| | | this.ipaddr = ipaddr; |
| | | } |
| | | |
| | | public String getLoginLocation() { |
| | | return loginLocation; |
| | | } |
| | | |
| | | public void setLoginLocation(String loginLocation) { |
| | | this.loginLocation = loginLocation; |
| | | } |
| | | |
| | | public String getBrowser() { |
| | | return browser; |
| | | } |
| | | |
| | | public void setBrowser(String browser) { |
| | | this.browser = browser; |
| | | } |
| | | |
| | | public String getOs() { |
| | | return os; |
| | | } |
| | | |
| | | public void setOs(String os) { |
| | | this.os = os; |
| | | } |
| | | |
| | | public Long getExpireTime() { |
| | | return expireTime; |
| | | } |
| | | |
| | | public void setExpireTime(Long expireTime) { |
| | | this.expireTime = expireTime; |
| | | } |
| | | |
| | | public Set<String> getPermissions() { |
| | | return permissions; |
| | | } |
| | | |
| | | public void setPermissions(Set<String> permissions) { |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | public SysUser getUser() { |
| | | return user; |
| | | } |
| | | |
| | | public void setUser(SysUser user) { |
| | | this.user = user; |
| | | } |
| | | |
| | | @Override |
| | | public Collection<? extends GrantedAuthority> getAuthorities() { |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.domain.model; |
| | | |
| | | /** |
| | | * 用户注册对象 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RegisterBody extends LoginBody |
| | | { |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.page; |
| | | |
| | | import com.zzg.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 分页数据 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class PageDomain |
| | | { |
| | | /** 当前记录起始索引 */ |
| | | private Integer pageNum; |
| | | |
| | | /** 每页显示记录数 */ |
| | | private Integer pageSize; |
| | | |
| | | /** 排序列 */ |
| | | private String orderByColumn; |
| | | |
| | | /** 排序的方向desc或者asc */ |
| | | private String isAsc = "asc"; |
| | | |
| | | /** 分页参数合理化 */ |
| | | private Boolean reasonable = true; |
| | | |
| | | public String getOrderBy() |
| | | { |
| | | if (StringUtils.isEmpty(orderByColumn)) |
| | | { |
| | | return ""; |
| | | } |
| | | return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; |
| | | } |
| | | |
| | | public Integer getPageNum() |
| | | { |
| | | return pageNum; |
| | | } |
| | | |
| | | public void setPageNum(Integer pageNum) |
| | | { |
| | | this.pageNum = pageNum; |
| | | } |
| | | |
| | | public Integer getPageSize() |
| | | { |
| | | return pageSize; |
| | | } |
| | | |
| | | public void setPageSize(Integer pageSize) |
| | | { |
| | | this.pageSize = pageSize; |
| | | } |
| | | |
| | | public String getOrderByColumn() |
| | | { |
| | | return orderByColumn; |
| | | } |
| | | |
| | | public void setOrderByColumn(String orderByColumn) |
| | | { |
| | | this.orderByColumn = orderByColumn; |
| | | } |
| | | |
| | | public String getIsAsc() |
| | | { |
| | | return isAsc; |
| | | } |
| | | |
| | | public void setIsAsc(String isAsc) |
| | | { |
| | | if (StringUtils.isNotEmpty(isAsc)) |
| | | { |
| | | // 兼容前端排序类型 |
| | | if ("ascending".equals(isAsc)) |
| | | { |
| | | isAsc = "asc"; |
| | | } |
| | | else if ("descending".equals(isAsc)) |
| | | { |
| | | isAsc = "desc"; |
| | | } |
| | | this.isAsc = isAsc; |
| | | } |
| | | } |
| | | |
| | | public Boolean getReasonable() |
| | | { |
| | | if (StringUtils.isNull(reasonable)) |
| | | { |
| | | return Boolean.TRUE; |
| | | } |
| | | return reasonable; |
| | | } |
| | | |
| | | public void setReasonable(Boolean reasonable) |
| | | { |
| | | this.reasonable = reasonable; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.page; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 表格分页数据对象 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TableDataInfo implements Serializable |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 总记录数 */ |
| | | private long total; |
| | | |
| | | /** 列表数据 */ |
| | | private List<?> rows; |
| | | |
| | | /** 消息状态码 */ |
| | | private int code; |
| | | |
| | | /** 消息内容 */ |
| | | private String msg; |
| | | |
| | | /** |
| | | * 表格数据对象 |
| | | */ |
| | | public TableDataInfo() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * 分页 |
| | | * |
| | | * @param list 列表数据 |
| | | * @param total 总记录数 |
| | | */ |
| | | public TableDataInfo(List<?> list, int total) |
| | | { |
| | | this.rows = list; |
| | | this.total = total; |
| | | } |
| | | |
| | | public long getTotal() |
| | | { |
| | | return total; |
| | | } |
| | | |
| | | public void setTotal(long total) |
| | | { |
| | | this.total = total; |
| | | } |
| | | |
| | | public List<?> getRows() |
| | | { |
| | | return rows; |
| | | } |
| | | |
| | | public void setRows(List<?> rows) |
| | | { |
| | | this.rows = rows; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.page; |
| | | |
| | | import com.zzg.common.core.text.Convert; |
| | | import com.zzg.common.utils.ServletUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | /** |
| | | * 表格数据处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TableSupport |
| | | { |
| | | /** |
| | | * 当前记录起始索引 |
| | | */ |
| | | public static final String PAGE_NUM = "pageNum"; |
| | | |
| | | /** |
| | | * 每页显示记录数 |
| | | */ |
| | | public static final String PAGE_SIZE = "pageSize"; |
| | | |
| | | /** |
| | | * 排序列 |
| | | */ |
| | | public static final String ORDER_BY_COLUMN = "orderByColumn"; |
| | | |
| | | /** |
| | | * 排序的方向 "desc" 或者 "asc". |
| | | */ |
| | | public static final String IS_ASC = "isAsc"; |
| | | |
| | | /** |
| | | * 分页参数合理化 |
| | | */ |
| | | public static final String REASONABLE = "reasonable"; |
| | | |
| | | /** |
| | | * 封装分页对象 |
| | | */ |
| | | public static PageDomain getPageDomain() { |
| | | PageDomain pageDomain = new PageDomain(); |
| | | String pageNum = ServletUtils.getParameter(PAGE_NUM); |
| | | String pageSize = ServletUtils.getParameter(PAGE_SIZE); |
| | | if (StringUtils.isBlank(pageNum)) { |
| | | pageNum = ServletUtils.getRequestBodyParameter(PAGE_NUM); |
| | | } |
| | | if (StringUtils.isBlank(pageSize)) { |
| | | pageSize = ServletUtils.getRequestBodyParameter(PAGE_SIZE); |
| | | } |
| | | |
| | | pageDomain.setPageNum(Convert.toInt(pageNum, 1)); |
| | | pageDomain.setPageSize(Convert.toInt(pageSize, 10)); |
| | | |
| | | pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); |
| | | pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); |
| | | pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE)); |
| | | return pageDomain; |
| | | } |
| | | |
| | | public static PageDomain buildPageRequest() |
| | | { |
| | | return getPageDomain(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.redis; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.TimeUnit; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.BoundSetOperations; |
| | | import org.springframework.data.redis.core.HashOperations; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * spring redis 工具类 |
| | | * |
| | | * @author ruoyi |
| | | **/ |
| | | @SuppressWarnings(value = { "unchecked", "rawtypes" }) |
| | | @Component |
| | | public class RedisCache |
| | | { |
| | | @Autowired |
| | | public RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * 缓存基本的对象,Integer、String、实体类等 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param value 缓存的值 |
| | | */ |
| | | public <T> void setCacheObject(final String key, final T value) |
| | | { |
| | | redisTemplate.opsForValue().set(key, value); |
| | | } |
| | | |
| | | /** |
| | | * 缓存基本的对象,Integer、String、实体类等 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param value 缓存的值 |
| | | * @param timeout 时间 |
| | | * @param timeUnit 时间颗粒度 |
| | | */ |
| | | public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) |
| | | { |
| | | redisTemplate.opsForValue().set(key, value, timeout, timeUnit); |
| | | } |
| | | |
| | | /** |
| | | * 设置有效时间 |
| | | * |
| | | * @param key Redis键 |
| | | * @param timeout 超时时间 |
| | | * @return true=设置成功;false=设置失败 |
| | | */ |
| | | public boolean expire(final String key, final long timeout) |
| | | { |
| | | return expire(key, timeout, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | /** |
| | | * 设置有效时间 |
| | | * |
| | | * @param key Redis键 |
| | | * @param timeout 超时时间 |
| | | * @param unit 时间单位 |
| | | * @return true=设置成功;false=设置失败 |
| | | */ |
| | | public boolean expire(final String key, final long timeout, final TimeUnit unit) |
| | | { |
| | | return redisTemplate.expire(key, timeout, unit); |
| | | } |
| | | |
| | | /** |
| | | * 获取有效时间 |
| | | * |
| | | * @param key Redis键 |
| | | * @return 有效时间 |
| | | */ |
| | | public long getExpire(final String key) |
| | | { |
| | | return redisTemplate.getExpire(key); |
| | | } |
| | | |
| | | /** |
| | | * 判断 key是否存在 |
| | | * |
| | | * @param key 键 |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public Boolean hasKey(String key) |
| | | { |
| | | return redisTemplate.hasKey(key); |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的基本对象。 |
| | | * |
| | | * @param key 缓存键值 |
| | | * @return 缓存键值对应的数据 |
| | | */ |
| | | public <T> T getCacheObject(final String key) |
| | | { |
| | | ValueOperations<String, T> operation = redisTemplate.opsForValue(); |
| | | return operation.get(key); |
| | | } |
| | | |
| | | /** |
| | | * 删除单个对象 |
| | | * |
| | | * @param key |
| | | */ |
| | | public boolean deleteObject(final String key) |
| | | { |
| | | return redisTemplate.delete(key); |
| | | } |
| | | |
| | | /** |
| | | * 删除集合对象 |
| | | * |
| | | * @param collection 多个对象 |
| | | * @return |
| | | */ |
| | | public boolean deleteObject(final Collection collection) |
| | | { |
| | | return redisTemplate.delete(collection) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 缓存List数据 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param dataList 待缓存的List数据 |
| | | * @return 缓存的对象 |
| | | */ |
| | | public <T> long setCacheList(final String key, final List<T> dataList) |
| | | { |
| | | Long count = redisTemplate.opsForList().rightPushAll(key, dataList); |
| | | return count == null ? 0 : count; |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的list对象 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @return 缓存键值对应的数据 |
| | | */ |
| | | public <T> List<T> getCacheList(final String key) |
| | | { |
| | | return redisTemplate.opsForList().range(key, 0, -1); |
| | | } |
| | | |
| | | /** |
| | | * 缓存Set |
| | | * |
| | | * @param key 缓存键值 |
| | | * @param dataSet 缓存的数据 |
| | | * @return 缓存数据的对象 |
| | | */ |
| | | public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) |
| | | { |
| | | BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key); |
| | | Iterator<T> it = dataSet.iterator(); |
| | | while (it.hasNext()) |
| | | { |
| | | setOperation.add(it.next()); |
| | | } |
| | | return setOperation; |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的set |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public <T> Set<T> getCacheSet(final String key) |
| | | { |
| | | return redisTemplate.opsForSet().members(key); |
| | | } |
| | | |
| | | /** |
| | | * 缓存Map |
| | | * |
| | | * @param key |
| | | * @param dataMap |
| | | */ |
| | | public <T> void setCacheMap(final String key, final Map<String, T> dataMap) |
| | | { |
| | | if (dataMap != null) { |
| | | redisTemplate.opsForHash().putAll(key, dataMap); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的Map |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public <T> Map<String, T> getCacheMap(final String key) |
| | | { |
| | | return redisTemplate.opsForHash().entries(key); |
| | | } |
| | | |
| | | /** |
| | | * 往Hash中存入数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKey Hash键 |
| | | * @param value 值 |
| | | */ |
| | | public <T> void setCacheMapValue(final String key, final String hKey, final T value) |
| | | { |
| | | redisTemplate.opsForHash().put(key, hKey, value); |
| | | } |
| | | |
| | | /** |
| | | * 获取Hash中的数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKey Hash键 |
| | | * @return Hash中的对象 |
| | | */ |
| | | public <T> T getCacheMapValue(final String key, final String hKey) |
| | | { |
| | | HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash(); |
| | | return opsForHash.get(key, hKey); |
| | | } |
| | | |
| | | /** |
| | | * 获取多个Hash中的数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKeys Hash键集合 |
| | | * @return Hash对象集合 |
| | | */ |
| | | public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) |
| | | { |
| | | return redisTemplate.opsForHash().multiGet(key, hKeys); |
| | | } |
| | | |
| | | /** |
| | | * 删除Hash中的某条数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKey Hash键 |
| | | * @return 是否成功 |
| | | */ |
| | | public boolean deleteCacheMapValue(final String key, final String hKey) |
| | | { |
| | | return redisTemplate.opsForHash().delete(key, hKey) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的基本对象列表 |
| | | * |
| | | * @param pattern 字符串前缀 |
| | | * @return 对象列表 |
| | | */ |
| | | public Collection<String> keys(final String pattern) |
| | | { |
| | | return redisTemplate.keys(pattern); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.redis; |
| | | |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | |
| | | /** |
| | | * redis工具类 |
| | | * |
| | | * @author gaofan@youngbai.com |
| | | * @date Created in 2020/9/21 9:49 |
| | | */ |
| | | @Component |
| | | public final class RedisUtil { |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | // =============================common============================ |
| | | |
| | | |
| | | /** |
| | | * 指定缓存失效时间 |
| | | * |
| | | * @param key 键 |
| | | * @param time 时间(秒) |
| | | */ |
| | | public boolean expire(String key, long time) { |
| | | try { |
| | | if (time > 0) { |
| | | redisTemplate.expire(key, time, TimeUnit.MILLISECONDS); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 对指定键进行自增操作 |
| | | * |
| | | * @param key 要自增的键 |
| | | * @return 自增后的值 |
| | | */ |
| | | public Long incr(String key) { |
| | | try { |
| | | return redisTemplate.opsForValue().increment(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | /** |
| | | * 根据key 获取过期时间 |
| | | * |
| | | * @param key 键 不能为null |
| | | * @return 时间(秒) 返回0代表为永久有效 |
| | | */ |
| | | public long getExpire(String key) { |
| | | return redisTemplate.getExpire(key, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断key是否存在 |
| | | * |
| | | * @param key 键 |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public boolean hasKey(String key) { |
| | | try { |
| | | return redisTemplate.hasKey(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除缓存 |
| | | * |
| | | * @param key 可以传一个值 或多个 |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public void del(String... key) { |
| | | if (key != null && key.length > 0) { |
| | | if (key.length == 1) { |
| | | redisTemplate.delete(key[0]); |
| | | } else { |
| | | redisTemplate.delete((Collection<String>) CollectionUtils.arrayToList(key)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // ============================String============================= |
| | | |
| | | /** |
| | | * 字符串getAndSet方法 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @return * @return java.lang.Object |
| | | * @date 2020/9/24 0024 15:16 |
| | | */ |
| | | public Object getAndSet(String key, Object value) { |
| | | return key == null ? null : redisTemplate.opsForValue().getAndSet(key, value); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 普通缓存获取 |
| | | * |
| | | * @param key 键 |
| | | * @return 值 |
| | | */ |
| | | public Object get(String key) { |
| | | return key == null ? null : redisTemplate.opsForValue().get(key); |
| | | } |
| | | |
| | | /** |
| | | * 普通缓存放入 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @return true成功 false失败 |
| | | */ |
| | | |
| | | public boolean set(String key, Object value) { |
| | | try { |
| | | redisTemplate.opsForValue().set(key, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 移除N个值为value |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * timeout SHIJIAN |
| | | * @return 移除的个数 |
| | | */ |
| | | public void set(String key, String value, long timeout, TimeUnit unit) { |
| | | redisTemplate.opsForValue().set(key, value, timeout, unit); |
| | | } |
| | | |
| | | public Long increment(String key, long val) { |
| | | return redisTemplate.opsForValue().increment(key, val); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 普通缓存放入并设置时间 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 |
| | | * @return true成功 false 失败 |
| | | */ |
| | | |
| | | public boolean set(String key, Object value, long time) { |
| | | try { |
| | | if (time > 0) { |
| | | redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); |
| | | } else { |
| | | set(key, value); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 递增 |
| | | * |
| | | * @param key 键 |
| | | * @param delta 要增加几(大于0) |
| | | */ |
| | | public long incr(String key, long delta) { |
| | | if (delta < 0) { |
| | | throw new RuntimeException("递增因子必须大于0"); |
| | | } |
| | | return redisTemplate.opsForValue().increment(key, delta); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 递减 |
| | | * |
| | | * @param key 键 |
| | | * @param delta 要减少几(小于0) |
| | | */ |
| | | public long decr(String key, long delta) { |
| | | if (delta < 0) { |
| | | throw new RuntimeException("递减因子必须大于0"); |
| | | } |
| | | return redisTemplate.opsForValue().increment(key, -delta); |
| | | } |
| | | |
| | | |
| | | // ================================Map================================= |
| | | |
| | | /** |
| | | * HashGet |
| | | * |
| | | * @param key 键 不能为null |
| | | * @param item 项 不能为null |
| | | */ |
| | | public Object hget(String key, String item) { |
| | | return redisTemplate.opsForHash().get(key, item); |
| | | } |
| | | |
| | | /** |
| | | * 获取hashKey对应的所有键值 |
| | | * |
| | | * @param key 键 |
| | | * @return 对应的多个键值 |
| | | */ |
| | | public Map<Object, Object> hmget(String key) { |
| | | return redisTemplate.opsForHash().entries(key); |
| | | } |
| | | |
| | | /** |
| | | * HashSet |
| | | * |
| | | * @param key 键 |
| | | * @param map 对应多个键值 |
| | | */ |
| | | public boolean hmset(String key, Map<String, Object> map) { |
| | | try { |
| | | redisTemplate.opsForHash().putAll(key, map); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * HashSet 并设置时间 |
| | | * |
| | | * @param key 键 |
| | | * @param map 对应多个键值 |
| | | * @param time 时间(秒) |
| | | * @return true成功 false失败 |
| | | */ |
| | | public boolean hmset(String key, Map<String, Object> map, long time) { |
| | | try { |
| | | redisTemplate.opsForHash().putAll(key, map); |
| | | if (time > 0) { |
| | | expire(key, time); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 向一张hash表中放入数据,如果不存在将创建 |
| | | * |
| | | * @param key 键 |
| | | * @param item 项 |
| | | * @param value 值 |
| | | * @return true 成功 false失败 |
| | | */ |
| | | public boolean hset(String key, String item, Object value) { |
| | | try { |
| | | redisTemplate.opsForHash().put(key, item, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 向一张hash表中放入数据,如果不存在将创建 |
| | | * |
| | | * @param key 键 |
| | | * @param item 项 |
| | | * @param value 值 |
| | | * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 |
| | | * @return true 成功 false失败 |
| | | */ |
| | | public boolean hset(String key, String item, Object value, long time) { |
| | | try { |
| | | redisTemplate.opsForHash().put(key, item, value); |
| | | if (time > 0) { |
| | | expire(key, time); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除hash表中的值 |
| | | * |
| | | * @param key 键 不能为null |
| | | * @param item 项 可以使多个 不能为null |
| | | */ |
| | | public void hdel(String key, Object... item) { |
| | | redisTemplate.opsForHash().delete(key, item); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断hash表中是否有该项的值 |
| | | * |
| | | * @param key 键 不能为null |
| | | * @param item 项 不能为null |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public boolean hHasKey(String key, String item) { |
| | | return redisTemplate.opsForHash().hasKey(key, item); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * hash递增 如果不存在,就会创建一个 并把新增后的值返回 |
| | | * |
| | | * @param key 键 |
| | | * @param item 项 |
| | | * @param by 要增加几(大于0) |
| | | */ |
| | | public double hincr(String key, String item, double by) { |
| | | return redisTemplate.opsForHash().increment(key, item, by); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * hash递减 |
| | | * |
| | | * @param key 键 |
| | | * @param item 项 |
| | | * @param by 要减少记(小于0) |
| | | */ |
| | | public double hdecr(String key, String item, double by) { |
| | | return redisTemplate.opsForHash().increment(key, item, -by); |
| | | } |
| | | |
| | | |
| | | // ============================set============================= |
| | | |
| | | /** |
| | | * 根据key获取Set中的所有值 |
| | | * |
| | | * @param key 键 |
| | | */ |
| | | public Set<Object> sGet(String key) { |
| | | try { |
| | | return redisTemplate.opsForSet().members(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 随机获取set中的值 |
| | | * |
| | | * @param key |
| | | * @return * @return java.util.Set<java.lang.Object> |
| | | * @date 2020/9/21 0021 21:01 |
| | | */ |
| | | public Object sRandMember(String key) { |
| | | try { |
| | | return redisTemplate.opsForSet().randomMember(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 随机删除set中的值 |
| | | * |
| | | * @param key |
| | | * @return * @return java.util.Set<java.lang.Object> |
| | | * @date 2020/9/21 0021 21:01 |
| | | */ |
| | | public Object sPop(String key) { |
| | | try { |
| | | return redisTemplate.opsForSet().pop(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据value从一个set中查询,是否存在 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public boolean sHasKey(String key, Object value) { |
| | | try { |
| | | return redisTemplate.opsForSet().isMember(key, value); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将数据放入set缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param values 值 可以是多个 |
| | | * @return 成功个数 |
| | | */ |
| | | public long sSet(String key, Object... values) { |
| | | try { |
| | | return redisTemplate.opsForSet().add(key, values); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将set数据放入缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param time 时间(秒) |
| | | * @param values 值 可以是多个 |
| | | * @return 成功个数 |
| | | */ |
| | | public long sSetAndTime(String key, long time, Object... values) { |
| | | try { |
| | | Long count = redisTemplate.opsForSet().add(key, values); |
| | | if (time > 0) { |
| | | expire(key, time); |
| | | } |
| | | return count; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取set缓存的长度 |
| | | * |
| | | * @param key 键 |
| | | */ |
| | | public long sGetSetSize(String key) { |
| | | try { |
| | | return redisTemplate.opsForSet().size(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 移除值为value的 |
| | | * |
| | | * @param key 键 |
| | | * @param values 值 可以是多个 |
| | | * @return 移除的个数 |
| | | */ |
| | | |
| | | public long setRemove(String key, Object... values) { |
| | | try { |
| | | return redisTemplate.opsForSet().remove(key, values); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | // ===============================list================================= |
| | | |
| | | /** |
| | | * 获取list缓存的内容 |
| | | * |
| | | * @param key 键 |
| | | * @param start 开始 |
| | | * @param end 结束 0 到 -1代表所有值 |
| | | */ |
| | | public List<Object> lGet(String key, long start, long end) { |
| | | try { |
| | | return redisTemplate.opsForList().range(key, start, end); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取list缓存的长度 |
| | | * |
| | | * @param key 键 |
| | | */ |
| | | public long lGetListSize(String key) { |
| | | try { |
| | | return redisTemplate.opsForList().size(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过索引 获取list中的值 |
| | | * |
| | | * @param key 键 |
| | | * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 |
| | | */ |
| | | public Object lGetIndex(String key, long index) { |
| | | try { |
| | | return redisTemplate.opsForList().index(key, index); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将list放入缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | */ |
| | | public boolean lSet(String key, Object value) { |
| | | try { |
| | | redisTemplate.opsForList().rightPush(key, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将list放入缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @param time 时间(秒) |
| | | */ |
| | | public boolean lSet(String key, Object value, long time) { |
| | | try { |
| | | redisTemplate.opsForList().rightPush(key, value); |
| | | if (time > 0) { |
| | | expire(key, time); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将list放入缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @return |
| | | */ |
| | | public boolean lSet(String key, List<Object> value) { |
| | | try { |
| | | redisTemplate.opsForList().rightPushAll(key, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将list放入缓存 |
| | | * |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @param time 时间(秒) |
| | | * @return |
| | | */ |
| | | public boolean lSet(String key, List<Object> value, long time) { |
| | | try { |
| | | redisTemplate.opsForList().rightPushAll(key, value); |
| | | if (time > 0) |
| | | expire(key, time); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据索引修改list中的某条数据 |
| | | * |
| | | * @param key 键 |
| | | * @param index 索引 |
| | | * @param value 值 |
| | | * @return |
| | | */ |
| | | |
| | | public boolean lUpdateIndex(String key, long index, Object value) { |
| | | try { |
| | | redisTemplate.opsForList().set(key, index, value); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 移除N个值为value |
| | | * |
| | | * @param key 键 |
| | | * @param count 移除多少个 |
| | | * @param value 值 |
| | | * @return 移除的个数 |
| | | */ |
| | | |
| | | public long lRemove(String key, long count, Object value) { |
| | | try { |
| | | return redisTemplate.opsForList().remove(key, count, value); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.text; |
| | | |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import com.zzg.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 字符集工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CharsetKit |
| | | { |
| | | /** ISO-8859-1 */ |
| | | public static final String ISO_8859_1 = "ISO-8859-1"; |
| | | /** UTF-8 */ |
| | | public static final String UTF_8 = "UTF-8"; |
| | | /** GBK */ |
| | | public static final String GBK = "GBK"; |
| | | |
| | | /** ISO-8859-1 */ |
| | | public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); |
| | | /** UTF-8 */ |
| | | public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); |
| | | /** GBK */ |
| | | public static final Charset CHARSET_GBK = Charset.forName(GBK); |
| | | |
| | | /** |
| | | * 转换为Charset对象 |
| | | * |
| | | * @param charset 字符集,为空则返回默认字符集 |
| | | * @return Charset |
| | | */ |
| | | public static Charset charset(String charset) |
| | | { |
| | | return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); |
| | | } |
| | | |
| | | /** |
| | | * 转换字符串的字符集编码 |
| | | * |
| | | * @param source 字符串 |
| | | * @param srcCharset 源字符集,默认ISO-8859-1 |
| | | * @param destCharset 目标字符集,默认UTF-8 |
| | | * @return 转换后的字符集 |
| | | */ |
| | | public static String convert(String source, String srcCharset, String destCharset) |
| | | { |
| | | return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); |
| | | } |
| | | |
| | | /** |
| | | * 转换字符串的字符集编码 |
| | | * |
| | | * @param source 字符串 |
| | | * @param srcCharset 源字符集,默认ISO-8859-1 |
| | | * @param destCharset 目标字符集,默认UTF-8 |
| | | * @return 转换后的字符集 |
| | | */ |
| | | public static String convert(String source, Charset srcCharset, Charset destCharset) |
| | | { |
| | | if (null == srcCharset) |
| | | { |
| | | srcCharset = StandardCharsets.ISO_8859_1; |
| | | } |
| | | |
| | | if (null == destCharset) |
| | | { |
| | | destCharset = StandardCharsets.UTF_8; |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) |
| | | { |
| | | return source; |
| | | } |
| | | return new String(source.getBytes(srcCharset), destCharset); |
| | | } |
| | | |
| | | /** |
| | | * @return 系统字符集编码 |
| | | */ |
| | | public static String systemCharset() |
| | | { |
| | | return Charset.defaultCharset().name(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.text; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.math.RoundingMode; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.charset.Charset; |
| | | import java.text.NumberFormat; |
| | | import java.util.Set; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | |
| | | /** |
| | | * 类型转换器 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class Convert |
| | | { |
| | | /** |
| | | * 转换为字符串<br> |
| | | * 如果给定的值为null,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static String toStr(Object value, String defaultValue) |
| | | { |
| | | if (null == value) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof String) |
| | | { |
| | | return (String) value; |
| | | } |
| | | return value.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 转换为字符串<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static String toStr(Object value) |
| | | { |
| | | return toStr(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为字符<br> |
| | | * 如果给定的值为null,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Character toChar(Object value, Character defaultValue) |
| | | { |
| | | if (null == value) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Character) |
| | | { |
| | | return (Character) value; |
| | | } |
| | | |
| | | final String valueStr = toStr(value, null); |
| | | return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); |
| | | } |
| | | |
| | | /** |
| | | * 转换为字符<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Character toChar(Object value) |
| | | { |
| | | return toChar(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为byte<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Byte toByte(Object value, Byte defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Byte) |
| | | { |
| | | return (Byte) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).byteValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Byte.parseByte(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为byte<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Byte toByte(Object value) |
| | | { |
| | | return toByte(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Short<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Short toShort(Object value, Short defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Short) |
| | | { |
| | | return (Short) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).shortValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Short.parseShort(valueStr.trim()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为Short<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Short toShort(Object value) |
| | | { |
| | | return toShort(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Number<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Number toNumber(Object value, Number defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return (Number) value; |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return NumberFormat.getInstance().parse(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为Number<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Number toNumber(Object value) |
| | | { |
| | | return toNumber(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为int<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Integer toInt(Object value, Integer defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Integer) |
| | | { |
| | | return (Integer) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).intValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Integer.parseInt(valueStr.trim()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为int<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Integer toInt(Object value) |
| | | { |
| | | return toInt(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Integer数组<br> |
| | | * |
| | | * @param str 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Integer[] toIntArray(String str) |
| | | { |
| | | return toIntArray(",", str); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Long数组<br> |
| | | * |
| | | * @param str 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Long[] toLongArray(String str) |
| | | { |
| | | return toLongArray(",", str); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Integer数组<br> |
| | | * |
| | | * @param split 分隔符 |
| | | * @param split 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Integer[] toIntArray(String split, String str) |
| | | { |
| | | if (StringUtils.isEmpty(str)) |
| | | { |
| | | return new Integer[] {}; |
| | | } |
| | | String[] arr = str.split(split); |
| | | final Integer[] ints = new Integer[arr.length]; |
| | | for (int i = 0; i < arr.length; i++) |
| | | { |
| | | final Integer v = toInt(arr[i], 0); |
| | | ints[i] = v; |
| | | } |
| | | return ints; |
| | | } |
| | | |
| | | /** |
| | | * 转换为Long数组<br> |
| | | * |
| | | * @param split 分隔符 |
| | | * @param str 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Long[] toLongArray(String split, String str) |
| | | { |
| | | if (StringUtils.isEmpty(str)) |
| | | { |
| | | return new Long[] {}; |
| | | } |
| | | String[] arr = str.split(split); |
| | | final Long[] longs = new Long[arr.length]; |
| | | for (int i = 0; i < arr.length; i++) |
| | | { |
| | | final Long v = toLong(arr[i], null); |
| | | longs[i] = v; |
| | | } |
| | | return longs; |
| | | } |
| | | |
| | | /** |
| | | * 转换为String数组<br> |
| | | * |
| | | * @param str 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static String[] toStrArray(String str) |
| | | { |
| | | return toStrArray(",", str); |
| | | } |
| | | |
| | | /** |
| | | * 转换为String数组<br> |
| | | * |
| | | * @param split 分隔符 |
| | | * @param split 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static String[] toStrArray(String split, String str) |
| | | { |
| | | return str.split(split); |
| | | } |
| | | |
| | | /** |
| | | * 转换为long<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Long toLong(Object value, Long defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Long) |
| | | { |
| | | return (Long) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).longValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | // 支持科学计数法 |
| | | return new BigDecimal(valueStr.trim()).longValue(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为long<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Long toLong(Object value) |
| | | { |
| | | return toLong(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为double<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Double toDouble(Object value, Double defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Double) |
| | | { |
| | | return (Double) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).doubleValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | // 支持科学计数法 |
| | | return new BigDecimal(valueStr.trim()).doubleValue(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为double<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Double toDouble(Object value) |
| | | { |
| | | return toDouble(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Float<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Float toFloat(Object value, Float defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Float) |
| | | { |
| | | return (Float) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).floatValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Float.parseFloat(valueStr.trim()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为Float<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Float toFloat(Object value) |
| | | { |
| | | return toFloat(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为boolean<br> |
| | | * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Boolean toBool(Object value, Boolean defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Boolean) |
| | | { |
| | | return (Boolean) value; |
| | | } |
| | | String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | valueStr = valueStr.trim().toLowerCase(); |
| | | switch (valueStr) |
| | | { |
| | | case "true": |
| | | case "yes": |
| | | case "ok": |
| | | case "1": |
| | | return true; |
| | | case "false": |
| | | case "no": |
| | | case "0": |
| | | return false; |
| | | default: |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为boolean<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Boolean toBool(Object value) |
| | | { |
| | | return toBool(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Enum对象<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * |
| | | * @param clazz Enum的Class |
| | | * @param value 值 |
| | | * @param defaultValue 默认值 |
| | | * @return Enum |
| | | */ |
| | | public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (clazz.isAssignableFrom(value.getClass())) |
| | | { |
| | | @SuppressWarnings("unchecked") |
| | | E myE = (E) value; |
| | | return myE; |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Enum.valueOf(clazz, valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为Enum对象<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * |
| | | * @param clazz Enum的Class |
| | | * @param value 值 |
| | | * @return Enum |
| | | */ |
| | | public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) |
| | | { |
| | | return toEnum(clazz, value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为BigInteger<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static BigInteger toBigInteger(Object value, BigInteger defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof BigInteger) |
| | | { |
| | | return (BigInteger) value; |
| | | } |
| | | if (value instanceof Long) |
| | | { |
| | | return BigInteger.valueOf((Long) value); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return new BigInteger(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为BigInteger<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static BigInteger toBigInteger(Object value) |
| | | { |
| | | return toBigInteger(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为BigDecimal<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof BigDecimal) |
| | | { |
| | | return (BigDecimal) value; |
| | | } |
| | | if (value instanceof Long) |
| | | { |
| | | return new BigDecimal((Long) value); |
| | | } |
| | | if (value instanceof Double) |
| | | { |
| | | return BigDecimal.valueOf((Double) value); |
| | | } |
| | | if (value instanceof Integer) |
| | | { |
| | | return new BigDecimal((Integer) value); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return new BigDecimal(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为BigDecimal<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static BigDecimal toBigDecimal(Object value) |
| | | { |
| | | return toBigDecimal(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 将对象转为字符串<br> |
| | | * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 |
| | | * |
| | | * @param obj 对象 |
| | | * @return 字符串 |
| | | */ |
| | | public static String utf8Str(Object obj) |
| | | { |
| | | return str(obj, CharsetKit.CHARSET_UTF_8); |
| | | } |
| | | |
| | | /** |
| | | * 将对象转为字符串<br> |
| | | * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 |
| | | * |
| | | * @param obj 对象 |
| | | * @param charsetName 字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(Object obj, String charsetName) |
| | | { |
| | | return str(obj, Charset.forName(charsetName)); |
| | | } |
| | | |
| | | /** |
| | | * 将对象转为字符串<br> |
| | | * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 |
| | | * |
| | | * @param obj 对象 |
| | | * @param charset 字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(Object obj, Charset charset) |
| | | { |
| | | if (null == obj) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | if (obj instanceof String) |
| | | { |
| | | return (String) obj; |
| | | } |
| | | else if (obj instanceof byte[]) |
| | | { |
| | | return str((byte[]) obj, charset); |
| | | } |
| | | else if (obj instanceof Byte[]) |
| | | { |
| | | byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj); |
| | | return str(bytes, charset); |
| | | } |
| | | else if (obj instanceof ByteBuffer) |
| | | { |
| | | return str((ByteBuffer) obj, charset); |
| | | } |
| | | return obj.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 将byte数组转为字符串 |
| | | * |
| | | * @param bytes byte数组 |
| | | * @param charset 字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(byte[] bytes, String charset) |
| | | { |
| | | return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * 解码字节码 |
| | | * |
| | | * @param data 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 解码后的字符串 |
| | | */ |
| | | public static String str(byte[] data, Charset charset) |
| | | { |
| | | if (data == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | if (null == charset) |
| | | { |
| | | return new String(data); |
| | | } |
| | | return new String(data, charset); |
| | | } |
| | | |
| | | /** |
| | | * 将编码的byteBuffer数据转换为字符串 |
| | | * |
| | | * @param data 数据 |
| | | * @param charset 字符集,如果为空使用当前系统字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(ByteBuffer data, String charset) |
| | | { |
| | | if (data == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | return str(data, Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * 将编码的byteBuffer数据转换为字符串 |
| | | * |
| | | * @param data 数据 |
| | | * @param charset 字符集,如果为空使用当前系统字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(ByteBuffer data, Charset charset) |
| | | { |
| | | if (null == charset) |
| | | { |
| | | charset = Charset.defaultCharset(); |
| | | } |
| | | return charset.decode(data).toString(); |
| | | } |
| | | |
| | | // ----------------------------------------------------------------------- 全角半角转换 |
| | | /** |
| | | * 半角转全角 |
| | | * |
| | | * @param input String. |
| | | * @return 全角字符串. |
| | | */ |
| | | public static String toSBC(String input) |
| | | { |
| | | return toSBC(input, null); |
| | | } |
| | | |
| | | /** |
| | | * 半角转全角 |
| | | * |
| | | * @param input String |
| | | * @param notConvertSet 不替换的字符集合 |
| | | * @return 全角字符串. |
| | | */ |
| | | public static String toSBC(String input, Set<Character> notConvertSet) |
| | | { |
| | | char[] c = input.toCharArray(); |
| | | for (int i = 0; i < c.length; i++) |
| | | { |
| | | if (null != notConvertSet && notConvertSet.contains(c[i])) |
| | | { |
| | | // 跳过不替换的字符 |
| | | continue; |
| | | } |
| | | |
| | | if (c[i] == ' ') |
| | | { |
| | | c[i] = '\u3000'; |
| | | } |
| | | else if (c[i] < '\177') |
| | | { |
| | | c[i] = (char) (c[i] + 65248); |
| | | |
| | | } |
| | | } |
| | | return new String(c); |
| | | } |
| | | |
| | | /** |
| | | * 全角转半角 |
| | | * |
| | | * @param input String. |
| | | * @return 半角字符串 |
| | | */ |
| | | public static String toDBC(String input) |
| | | { |
| | | return toDBC(input, null); |
| | | } |
| | | |
| | | /** |
| | | * 替换全角为半角 |
| | | * |
| | | * @param text 文本 |
| | | * @param notConvertSet 不替换的字符集合 |
| | | * @return 替换后的字符 |
| | | */ |
| | | public static String toDBC(String text, Set<Character> notConvertSet) |
| | | { |
| | | char[] c = text.toCharArray(); |
| | | for (int i = 0; i < c.length; i++) |
| | | { |
| | | if (null != notConvertSet && notConvertSet.contains(c[i])) |
| | | { |
| | | // 跳过不替换的字符 |
| | | continue; |
| | | } |
| | | |
| | | if (c[i] == '\u3000') |
| | | { |
| | | c[i] = ' '; |
| | | } |
| | | else if (c[i] > '\uFF00' && c[i] < '\uFF5F') |
| | | { |
| | | c[i] = (char) (c[i] - 65248); |
| | | } |
| | | } |
| | | String returnString = new String(c); |
| | | |
| | | return returnString; |
| | | } |
| | | |
| | | /** |
| | | * 数字金额大写转换 先写个完整的然后将如零拾替换成零 |
| | | * |
| | | * @param n 数字 |
| | | * @return 中文大写数字 |
| | | */ |
| | | public static String digitUppercase(double n) |
| | | { |
| | | String[] fraction = { "角", "分" }; |
| | | String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; |
| | | String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; |
| | | |
| | | String head = n < 0 ? "负" : ""; |
| | | n = Math.abs(n); |
| | | |
| | | String s = ""; |
| | | for (int i = 0; i < fraction.length; i++) |
| | | { |
| | | // 优化double计算精度丢失问题 |
| | | BigDecimal nNum = new BigDecimal(n); |
| | | BigDecimal decimal = new BigDecimal(10); |
| | | BigDecimal scale = nNum.multiply(decimal).setScale(2, RoundingMode.HALF_EVEN); |
| | | double d = scale.doubleValue(); |
| | | s += (digit[(int) (Math.floor(d * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); |
| | | } |
| | | if (s.length() < 1) |
| | | { |
| | | s = "整"; |
| | | } |
| | | int integerPart = (int) Math.floor(n); |
| | | |
| | | for (int i = 0; i < unit[0].length && integerPart > 0; i++) |
| | | { |
| | | String p = ""; |
| | | for (int j = 0; j < unit[1].length && n > 0; j++) |
| | | { |
| | | p = digit[integerPart % 10] + unit[1][j] + p; |
| | | integerPart = integerPart / 10; |
| | | } |
| | | s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; |
| | | } |
| | | return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.core.text; |
| | | |
| | | import com.zzg.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 字符串格式化 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class StrFormatter |
| | | { |
| | | public static final String EMPTY_JSON = "{}"; |
| | | public static final char C_BACKSLASH = '\\'; |
| | | public static final char C_DELIM_START = '{'; |
| | | public static final char C_DELIM_END = '}'; |
| | | |
| | | /** |
| | | * 格式化字符串<br> |
| | | * 此方法只是简单将占位符 {} 按照顺序替换为参数<br> |
| | | * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br> |
| | | * 例:<br> |
| | | * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br> |
| | | * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> |
| | | * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> |
| | | * |
| | | * @param strPattern 字符串模板 |
| | | * @param argArray 参数列表 |
| | | * @return 结果 |
| | | */ |
| | | public static String format(final String strPattern, final Object... argArray) |
| | | { |
| | | if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) |
| | | { |
| | | return strPattern; |
| | | } |
| | | final int strPatternLength = strPattern.length(); |
| | | |
| | | // 初始化定义好的长度以获得更好的性能 |
| | | StringBuilder sbuf = new StringBuilder(strPatternLength + 50); |
| | | |
| | | int handledPosition = 0; |
| | | int delimIndex;// 占位符所在位置 |
| | | for (int argIndex = 0; argIndex < argArray.length; argIndex++) |
| | | { |
| | | delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); |
| | | if (delimIndex == -1) |
| | | { |
| | | if (handledPosition == 0) |
| | | { |
| | | return strPattern; |
| | | } |
| | | else |
| | | { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果 |
| | | sbuf.append(strPattern, handledPosition, strPatternLength); |
| | | return sbuf.toString(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) |
| | | { |
| | | if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) |
| | | { |
| | | // 转义符之前还有一个转义符,占位符依旧有效 |
| | | sbuf.append(strPattern, handledPosition, delimIndex - 1); |
| | | sbuf.append(Convert.utf8Str(argArray[argIndex])); |
| | | handledPosition = delimIndex + 2; |
| | | } |
| | | else |
| | | { |
| | | // 占位符被转义 |
| | | argIndex--; |
| | | sbuf.append(strPattern, handledPosition, delimIndex - 1); |
| | | sbuf.append(C_DELIM_START); |
| | | handledPosition = delimIndex + 1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // 正常占位符 |
| | | sbuf.append(strPattern, handledPosition, delimIndex); |
| | | sbuf.append(Convert.utf8Str(argArray[argIndex])); |
| | | handledPosition = delimIndex + 2; |
| | | } |
| | | } |
| | | } |
| | | // 加入最后一个占位符后所有的字符 |
| | | sbuf.append(strPattern, handledPosition, strPattern.length()); |
| | | |
| | | return sbuf.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum AgreementTypeEnum { |
| | | STATE_AGREEMENT(1, "国有土地上房屋征收补偿协议", "stateAgreement"), |
| | | VIRTUAL_STATE_AGREEMENT(2, "国有土地上房屋模拟搬迁补偿协议(房屋征收)", "virtualStateAgreement"), |
| | | VIRTUAL_STATE_MOVE_AGREEMENT(3, "国有土地上房屋模拟搬迁补偿协议(协议搬迁)", "virtualStateMoveAgreement"), |
| | | CHECK_STATE_AGREEMENT(4, "房屋价值评估转实地评估报告", "checkStateAgreement"), |
| | | OTHER_AGREEMENT(5, "其他协议", "otherAgreement"); |
| | | |
| | | private final Integer value; |
| | | private final String text; |
| | | private final String jsonKey; |
| | | |
| | | public static AgreementTypeEnum getEnumByValue(Integer key) { |
| | | for (AgreementTypeEnum v : AgreementTypeEnum.values()) { |
| | | if (v.getValue().equals(key)) { |
| | | return v; |
| | | } |
| | | } |
| | | return OTHER_AGREEMENT; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum ApplyStatusEnum { |
| | | PENDING_RECEIPT(1, "待接收"), |
| | | RECEIVED(2, "已接收"), |
| | | RETURNED(3, "被退回"), |
| | | ; |
| | | |
| | | public static String getTextByValue(Integer value) { |
| | | for (ApplyStatusEnum v : ApplyStatusEnum.values()) { |
| | | if (v.getValue().equals(value)) { |
| | | return v.getText(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | private final Integer value; |
| | | |
| | | private final String text; |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum ApplyTypeEnum { |
| | | |
| | | TEMPORARY_RESIDENTIAL_SUBSIDY(1, "住宅临时安置补助费户详情"), |
| | | BUSINESS_SHUTDOWN_SUBSIDY(2, "停产停业补助费请款"), |
| | | ; |
| | | |
| | | public static String getTextByValue(Integer Value) { |
| | | for (ApplyTypeEnum v : ApplyTypeEnum.values()) { |
| | | if (v.getValue().equals(Value)) { |
| | | return v.getText(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | private final Integer value; |
| | | |
| | | private final String text; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | /** |
| | | * 操作状态 |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | public enum BusinessStatus |
| | | { |
| | | /** |
| | | * 成功 |
| | | */ |
| | | SUCCESS, |
| | | |
| | | /** |
| | | * 失败 |
| | | */ |
| | | FAIL, |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | /** |
| | | * 业务操作类型 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum BusinessType { |
| | | /** |
| | | * 其它 |
| | | */ |
| | | OTHER, |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | INSERT, |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | UPDATE, |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | DELETE, |
| | | |
| | | /** |
| | | * 授权 |
| | | */ |
| | | GRANT, |
| | | |
| | | /** |
| | | * 导出 |
| | | */ |
| | | EXPORT, |
| | | |
| | | /** |
| | | * 导入 |
| | | */ |
| | | IMPORT, |
| | | |
| | | /** |
| | | * 强退 |
| | | */ |
| | | FORCE, |
| | | |
| | | /** |
| | | * 生成代码 |
| | | */ |
| | | GENCODE, |
| | | |
| | | /** |
| | | * 清空数据 |
| | | */ |
| | | CLEAN, |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | /** |
| | | * @date 2024/08/26 |
| | | */ |
| | | public enum CollectionFileEnum { |
| | | APPLICATION(0, "房屋征收申请书"), |
| | | ECONOMIC_PLAN_APPROVAL(1, "建设项目符合国民经济和社会发展规划的证明文件"), |
| | | LAND_USE_APPROVAL(2, "建设项目符合土地利用总体规划证明文件"), |
| | | URBAN_PLAN_APPROVAL(3, "建设项目符合城乡总体规划和专项规划的证明文件"), |
| | | SOCIAL_PLAN_APPROVAL(4, "保障性安居工程建设、旧城区改建项目纳入国民经济和社会发展年度计划的证明文件"), |
| | | OWNER_APPROVAL(5, "房屋所有权总面积超过三分之二且总户数超过三分之二的房屋所有权人明确同意改建的证明材料"), |
| | | COMPENSATION_PLAN(6, "经征求公众意见后确定的房屋征收补偿方案"), |
| | | RISK_ASSESSMENT_REPORT(7, "社会稳定风险评估报告"), |
| | | COMPENSATION_FUNDS_PROOF(8, "征收补偿费用到位资金证明"), |
| | | RESETTLEMENT_HOUSING_PROOF(9, "安置房房源相关材料证明"), |
| | | COMPENSATION_AGREEMENT_PROOF(10, "房屋征收部门组织被征收人签订附生效条件的补偿协议户数达到规定比例的证明材料"), |
| | | ACQUISITION_APPLICATION_FORM(11, "国有土地上房屋征收申报审批表"), |
| | | OTHER_DOCUMENTS(12, "其他资料"), |
| | | |
| | | |
| | | //征后 |
| | | URBAN_RENEWAL_APPROVAL(13, "旧城改造批准文件"), |
| | | GOVERNMENT_PURCHASE_APPROVAL(14, "政府同意收购相关文件或收购协议"), |
| | | AUTHORITY_APPROVAL(15, "有权批准机关批复文件"), |
| | | DEMOLITION_PERMIT(16, "房屋拆迁许可证"), |
| | | DEMOLITION_NOTICE(17, "拆迁公告"), |
| | | DEMOLITION_MAP(18, "1:500比例拆迁地形红线图"), |
| | | LAND_CERTIFICATE_CANCEL(19, "原存量国有建设用地土地使用证和房产证注销手续"), |
| | | COMPENSATION_WORK_DESC(20, "拆迁补偿安置工作完成情况的说明"), |
| | | DEMOLITION_COMPENSATION_AGREEMENT(21, "拆迁补赔偿协议(挂在户上)"), |
| | | PURCHASE_COMPENSATION_AGREEMENT(22, "收购补赔偿协议"), |
| | | MORTGAGE_DISPOSITION(23, "抵押权人出具的处置意见(挂在户上)"), |
| | | HEARING_DOCUMENTS(24, "听证资料管理"), |
| | | FUND_AUDIT_DOCUMENTS(25, "资金审计资料"), |
| | | |
| | | ; |
| | | public static String getDescription(Integer key) { |
| | | for (CollectionFileEnum v : CollectionFileEnum.values()) { |
| | | if (key.equals(v.getCode())) { |
| | | return v.getDescription(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | private final int code; |
| | | private final String description; |
| | | |
| | | CollectionFileEnum(int code, String description) { |
| | | this.code = code; |
| | | this.description = description; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | public enum CompensateTypeEnum { |
| | | HOUSE_ACQUISITION_COMPENSATION_FEE(1, "征收房屋补偿费"), |
| | | POLICY_COMPENSATION_FEE(2, "政策性补偿费"), |
| | | POLICY_SUBSIDY_FEE(3, "政策性补助费"), |
| | | POLICY_ALLOWANCE(4, "政策性补贴"), |
| | | EARLY_RELOCATION_REWARD(5, "提前搬迁奖励"); |
| | | |
| | | private final int code; |
| | | private final String description; |
| | | |
| | | CompensateTypeEnum(int code, String description) { |
| | | this.code = code; |
| | | this.description = description; |
| | | } |
| | | public static int getCode(String description) { |
| | | for (CompensateTypeEnum type : CompensateTypeEnum.values()) { |
| | | if (type.getDescription().equalsIgnoreCase(description)) { |
| | | return type.getCode(); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | public static String getDescription(Integer key) { |
| | | for (CompensateTypeEnum v : CompensateTypeEnum.values()) { |
| | | if (key.equals(v.getCode())) { |
| | | return v.getDescription(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.description; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | /** |
| | | * @date 2024/08/29 |
| | | */ |
| | | public enum CompensationCategoryEnum { |
| | | // 货币补偿类型 |
| | | MONEY_COMPENSATION(101, "货币补偿", "平方米/元"), |
| | | PROPERTY_SWAP(102, "产权置换", "平方米/元"), |
| | | MONEY_COMPENSATION_1(1, "货币补偿", "平方米/元"), |
| | | PROPERTY_SWAP_2(2, "产权置换", "平方米/元"), |
| | | |
| | | // 搬迁类补偿 |
| | | PHONE_RELOCATION(201, "电话移机", "元/部"), |
| | | CABLE_TV_RELOCATION(202, "有线电视迁装", "元/户"), |
| | | BROADBAND_RELOCATION(203, "宽带迁装", "元/户"), |
| | | AIR_CONDITIONER_RELOCATION(204, "空调移机", "元/户"), |
| | | ONE_HOUSE_ONE_METER(205, "一户一表", "元/户"), |
| | | GAS_INITIAL_INSTALLATION(206, "天然气初装", "元/户"), |
| | | |
| | | // 补助费类型 |
| | | TEMPORARY_HOUSING_ALLOWANCE(301, "住宅临时安置补助费", "元/平方米·月"), |
| | | NON_RESIDENTIAL_ECONOMIC_LOSS_ALLOWANCE(302, "非住宅停产、停业经济损失补助费", "元/户"), |
| | | MOVING_ALLOWANCE(303, "搬家补助费", "元/户"), |
| | | |
| | | // 补贴类型 |
| | | HOUSE_PURCHASE_SUBSIDY(401, "购房补贴", "元/户"), |
| | | PROPERTY_MANAGEMENT_SUBSIDY(402, "物管费补贴", "元/平方米·月"), |
| | | |
| | | // 奖励类型 |
| | | EARLY_RELOCATION_BONUS(501, "提前搬迁奖励", "元/户"); |
| | | |
| | | private final int code; |
| | | private final String description; |
| | | private final String unit; |
| | | |
| | | CompensationCategoryEnum(int code, String description, String unit) { |
| | | this.code = code; |
| | | this.description = description; |
| | | this.unit = unit; |
| | | } |
| | | public static String getDescription(Integer key) { |
| | | for (CompensationCategoryEnum v : CompensationCategoryEnum.values()) { |
| | | if (key.equals(v.getCode())) { |
| | | return v.getDescription(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static int getCode(String description) { |
| | | for (CompensationCategoryEnum category : CompensationCategoryEnum.values()) { |
| | | if (category.getDescription().equalsIgnoreCase(description)) { |
| | | return category.getCode(); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.code + " - " + this.description; |
| | | } |
| | | |
| | | public String getUnit() { |
| | | return unit; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum CompensationSubTypeEnum { |
| | | |
| | | PRICE(1, "单价"), |
| | | RANGE(2, "区间"), |
| | | |
| | | |
| | | ; |
| | | private final int code; |
| | | private final String description; |
| | | |
| | | public static int getCode(String description) { |
| | | for (CompensationSubTypeEnum type : CompensationSubTypeEnum.values()) { |
| | | if (type.getDescription().equalsIgnoreCase(description)) { |
| | | return type.getCode(); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | public static String getDescription(Integer key) { |
| | | if (Objects.isNull(key)) { |
| | | return ""; |
| | | } |
| | | for (CompensationSubTypeEnum v : CompensationSubTypeEnum.values()) { |
| | | if (v.getCode() == key) { |
| | | return v.getDescription(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | /** |
| | | * 数据源 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum DataSourceType |
| | | { |
| | | /** |
| | | * 主库 |
| | | */ |
| | | MASTER, |
| | | |
| | | /** |
| | | * 从库 |
| | | */ |
| | | SLAVE |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * DeleteFlagEnum |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum DeleteFlagEnum { |
| | | |
| | | NOT_DELETED(0, "正常"), |
| | | DELETED(1, "删除"), |
| | | ; |
| | | |
| | | |
| | | public static String getValue(Integer key) { |
| | | for (DeleteFlagEnum v : DeleteFlagEnum.values()) { |
| | | if (key.equals(v.key)) { |
| | | return v.value; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | private final Integer key; |
| | | private final String value; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum HelpTypeEnum { |
| | | NOT_HELP_PERSON("不是救助对象",0), |
| | | IS_HELP_PERSON("是救助对象",1); |
| | | private final String text; |
| | | |
| | | private final Integer value; |
| | | |
| | | HelpTypeEnum(String text, Integer value) { |
| | | this.text = text; |
| | | this.value = value; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum HouseMoveEnum { |
| | | REFUSE_MOVE("拒绝搬迁",0), |
| | | AGREE_MOVE("同意搬迁",1); |
| | | |
| | | |
| | | private final String text; |
| | | |
| | | private final Integer value; |
| | | |
| | | HouseMoveEnum(String text, Integer value) { |
| | | this.text = text; |
| | | this.value = value; |
| | | } |
| | | |
| | | public static String getText(Integer key) { |
| | | for (HouseMoveEnum v : HouseMoveEnum.values()) { |
| | | if (key.equals(v.value)) { |
| | | return v.text; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | public static Integer getValue(String text) { |
| | | for (HouseMoveEnum v : HouseMoveEnum.values()) { |
| | | if (v.text.equals(text)) { |
| | | return v.value; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | public enum HouseOwnerTyeEnum { |
| | | PERSONAL(1, "私人"), |
| | | COMPANY(2, "公司"); |
| | | |
| | | private final Integer value; |
| | | |
| | | private final String text; |
| | | public static String getValueByKey(Integer key) { |
| | | for (HouseOwnerTyeEnum v : HouseOwnerTyeEnum.values()) { |
| | | if (v.getValue().equals(key)) { |
| | | return v.getText(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | HouseOwnerTyeEnum(Integer value, String text) { |
| | | this.value = value; |
| | | this.text = text; |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public String getText() { |
| | | return text; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum HouseProductionTypeEnum { |
| | | PRIVATE_USE(1, "私产"), |
| | | PUBLIC_USE(2, "公产"); |
| | | private final Integer value; |
| | | |
| | | private final String text; |
| | | |
| | | public static String getValueByKey(Integer key) { |
| | | for (HouseProductionTypeEnum v : HouseProductionTypeEnum.values()) { |
| | | if (v.getValue().equals(key)) { |
| | | return v.getText(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static String getText(Integer key) { |
| | | for (HouseProductionTypeEnum v : HouseProductionTypeEnum.values()) { |
| | | if (key.equals(v.getValue())) { |
| | | return v.getText(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | public static Integer getValue(String text) { |
| | | for (HouseProductionTypeEnum v : HouseProductionTypeEnum.values()) { |
| | | if (v.getText().equals(text)) { |
| | | return v.getValue(); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum HouseSearchStatusEnum { |
| | | NOT_SEARCH("未调查",0), |
| | | SEARCHED("调查过",1), |
| | | COMPLETE_ASSESSMENT("完成评估",2), |
| | | ; |
| | | private final String text; |
| | | |
| | | private final int value; |
| | | |
| | | HouseSearchStatusEnum(String text, int value) { |
| | | this.text = text; |
| | | this.value = value; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | public enum HouseUsingTypeEnum { |
| | | |
| | | PERSONAL_HOUSE(1, "住宅"), |
| | | BUSINESS_HOUSE(2, "商业"), |
| | | OFFICE_HOUSE(3, "办公用房"), |
| | | PRODUCTION_HOUSE(4, "生产用房"), |
| | | OTHER_HOUSE(5, "其他用房"); |
| | | |
| | | private final Integer value; |
| | | |
| | | private final String text; |
| | | |
| | | HouseUsingTypeEnum(Integer value, String text) { |
| | | this.value = value; |
| | | this.text = text; |
| | | } |
| | | public static String getText(Integer key) { |
| | | for (HouseUsingTypeEnum v : HouseUsingTypeEnum.values()) { |
| | | if (key.equals(v.value)) { |
| | | return v.text; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | public static Integer getValue(String text) { |
| | | for (HouseUsingTypeEnum v : HouseUsingTypeEnum.values()) { |
| | | if (v.text.equals(text)) { |
| | | return v.value; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public String getText() { |
| | | return text; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import org.springframework.lang.Nullable; |
| | | |
| | | /** |
| | | * 请求方式 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum HttpMethod |
| | | { |
| | | GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; |
| | | |
| | | private static final Map<String, HttpMethod> mappings = new HashMap<>(16); |
| | | |
| | | static |
| | | { |
| | | for (HttpMethod httpMethod : values()) |
| | | { |
| | | mappings.put(httpMethod.name(), httpMethod); |
| | | } |
| | | } |
| | | |
| | | @Nullable |
| | | public static HttpMethod resolve(@Nullable String method) |
| | | { |
| | | return (method != null ? mappings.get(method) : null); |
| | | } |
| | | |
| | | public boolean matches(String method) |
| | | { |
| | | return (this == resolve(method)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | /** |
| | | * 限流类型 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | |
| | | public enum LimitType |
| | | { |
| | | /** |
| | | * 默认策略全局限流 |
| | | */ |
| | | DEFAULT, |
| | | |
| | | /** |
| | | * 根据请求者IP进行限流 |
| | | */ |
| | | IP |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum MoveTypeEnum { |
| | | AGREE(0, "agree to move"), |
| | | REFUSE(1, "refuse to move"), |
| | | ; |
| | | private final Integer value; |
| | | |
| | | private final String text; |
| | | |
| | | MoveTypeEnum(Integer value, String text) { |
| | | this.value = value; |
| | | this.text = text; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | public enum NoticeTypeEnum { |
| | | |
| | | NOTICE(1, "征收土地公告"), |
| | | NOTICE_PLACEMENT(2, "征地补偿安置公告"), |
| | | NOTICE_START(3, "土地征收预公告"), |
| | | LAND_COMPENSATE_POLICY(4, "土地补偿政策"), |
| | | PLACEMENT_COMPENSATE_POLICY(5, "安置补偿政策"), |
| | | CITY_COMPENSATE_POLICY(6, "城镇安置政策"), |
| | | SOCIAL_INSURANCE_COMPENSATE_POLICY(7, "社保政策"), |
| | | CROP_COMPENSATE_POLICY(8, "青苗政策"), |
| | | HOUSE_COMPENSATE_POLICY(9, "住房政策"); |
| | | |
| | | Integer type; |
| | | String name; |
| | | |
| | | /** |
| | | * 根据公告(政策)类型,获得对应的名称 |
| | | * |
| | | * @param type |
| | | * @return |
| | | */ |
| | | public static String getNoticeNameByType(Integer type) { |
| | | for (NoticeTypeEnum e : NoticeTypeEnum.values()) { |
| | | if (type.equals(e.type)) { |
| | | return e.name; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | NoticeTypeEnum(Integer type, String name) { |
| | | this.type = type; |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | /** |
| | | * 操作人类别 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum OperatorType |
| | | { |
| | | /** |
| | | * 其它 |
| | | */ |
| | | OTHER, |
| | | |
| | | /** |
| | | * 后台用户 |
| | | */ |
| | | MANAGE, |
| | | |
| | | /** |
| | | * 手机端用户 |
| | | */ |
| | | MOBILE |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 1. 入户调查 |
| | | * 2. 价格评估 |
| | | * 3. 协议签订 |
| | | * 4. 实施明细 |
| | | * 5. 住宅临时安置补助费 |
| | | * 6. 录入货币补偿金额信息 |
| | | * 7. 安置情况(流程图中叫做录入货币补偿金额信息) |
| | | * 固定对应表 state_process_module |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum ProcessCategoryEnum { |
| | | CATEGORY0(0, "错误分类"), |
| | | CATEGORY1(1, "入户调查"), |
| | | CATEGORY2(2, "价格评估"), |
| | | CATEGORY3(3, "协议签订"), |
| | | CATEGORY4(4, "资金管理-预算资金"), |
| | | CATEGORY5(5, "住宅临时安置补助费"), |
| | | CATEGORY6(6, "停产停业经济损失补助费"), |
| | | CATEGORY7(7, "安置情况"), |
| | | FAMILY_AUDIT(10, "现场调查农户"), |
| | | ENTERPRISE_AUDIT(11, "现场调查企业"), |
| | | INVESTIGATION_PUBLICITY_REVIEW(12, "结果调查公示"), |
| | | BUDGETED_AMOUNT(13, "整体资金预算金额"), |
| | | AMOUNT_ALLOCATED(14, "整体资金拨付金额"), |
| | | FAMILY_COLLECTIVE_RESETTLEMENT_AGREEMENT(15, "农户集体安置协议"), |
| | | ENTERPRISE_COLLECTIVE_RESETTLEMENT_AGREEMENT(16, "企业集体安置协议"), |
| | | PERSONNEL_PLACEMENT(17, "人员安置"), |
| | | PAYMENT_REQUEST_LEDGER(18, "过渡费请款台账"), |
| | | HOUSING_PLACEMENT_APPLICATION(19, "房源安置申请"), |
| | | CARPORT_PLACEMENT_APPLICATION(20, "车位安置申请"), |
| | | PROPERTY_SUBSIDY_LEDGER(21, "物业补贴台账" ), |
| | | ; |
| | | |
| | | |
| | | private final Integer value; |
| | | private final String text; |
| | | |
| | | public static Integer getValue(String text) { |
| | | for (ProcessCategoryEnum v : ProcessCategoryEnum.values()) { |
| | | if (v.text.equals(text)) { |
| | | return v.value; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public static String getValueByKey(Integer key) { |
| | | for (ProcessCategoryEnum v : ProcessCategoryEnum.values()) { |
| | | if (v.getValue().equals(key)) { |
| | | return v.getText(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static ProcessCategoryEnum getEnumByKey(Integer key) { |
| | | for (ProcessCategoryEnum v : ProcessCategoryEnum.values()) { |
| | | if (v.getValue().equals(key)) { |
| | | return v; |
| | | } |
| | | } |
| | | return CATEGORY0; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | public enum ProgressAttachmentEnum { |
| | | |
| | | ZFHZFWTDWCJSCSQH("1", "政府或政府委托单位出具审查申请函", "镇(街道)提交(代拟)", ""), |
| | | ZDSJCZZDPW("2", "宗地涉及村组征地批文", "管制科", ""), |
| | | TDZSQKSMB("3", "土地征收情况明细表", "管制科", ""), |
| | | TDZSKCDJT("4", "土地征收勘测定界图", "管制科", "CAD版本,PDF版本"), |
| | | TDZSGG("5", "征收土地公告(新法只上传此项)", "征安科", ""), |
| | | TDBCAZFAGG("6", "征地补偿安置方案公告(新法无需上传资料)", "征安科", ""), |
| | | TDBCAZFADPW("7", "征地补偿安置方案的批文(新法征收土地公告)", "征安科", "有水印"), |
| | | CRZDKCDJT("8", "出让宗地勘测定界图", "利用科", "CAD版本,PDF版本"), |
| | | CRZDZDHX_CZJX_CRHXTHT("9", "出让宗地征地红线、村组界限、出让红线套合图", "勘测队", "CAD版本,PDF版本;套合图名字为“XXX三合一套合图”;村组界限村组名字清晰"), |
| | | SBJGCJBZDRYSBBLWJZM("10", "社保机构出具被征地人员社保办理完结证明", "社保、医保局", "部门复函"), |
| | | ZDSZCZSFSJJTZCYQYPCDSM("11", "宗地所在村组是否涉及集体资产与企业赔偿的说明(拆迁补偿情况说明)", "镇(街道)", "若有,需提供协议和支付凭证;若不涉及拆迁,由村组社区出具说明(组长签字捺手印盖章,组上无章盖社区公章)"), |
| | | ZDSZCZAZFJSYDZSDPWHCLGYJSYDTDSYZ("12", "宗地涉及村组安置房建设用地征地批文或存量国有建设用地土地使用证", "管制科-批文;利用科、镇(街道)-划拨决定书", "提供批文或者划拨决定书等"), |
| | | ZFCJAZFQKSM("13", "政府出具安置房情况说明", "镇(街道)", "由乡镇政府出具情况说明(若清册等资料已显示与住房安置无关,说明情况为“无安置”相关内容)"), |
| | | ANFYDHXTHKCDJT("14", "安置房用地红线图或勘测定界图", "管制科", ""), |
| | | TDBCFZFXY_ZFPZ("15", "土地补偿费支付协议、支付凭证", "镇(街道)", "提供预征地协议和收条(或实际发放的凭证)"), |
| | | AZBZFFFQD_ZFPZ("16", "安置补助费发放清单、支付凭证", "镇(街道)", "由村组社区打收条(组长签字捺手印盖章,组上无章盖社区公章)(2020年以前提供安补情况说明,2020年以后提供收条)"), |
| | | SHBZFZFXY_ZFPZ("17", "生活补助费支付协议、支付凭证", "镇(街道)", ""), |
| | | JYBZJZFXY_ZFPZ("18", "就业补助金支付协议、支付凭证", "镇(街道)", ""), |
| | | QMJDSFZWBCFFQD("19", "青苗及地上附着物补偿发放清单", "镇(街道)", "村组社区打收条,若无分配具体名单,由村组社区出具说明(组长签字捺手印盖章,组上无章盖社区公章)"), |
| | | JTZCBCXY_ZFPZ("20", "集体资产补偿协议、支付凭证", "镇(街道)", "若不涉及,由乡镇出具情况说明"), |
| | | QYBCXY_BCFZFPZ("21", "企业补偿协议、补偿费支付凭证", "镇(街道)", ""), |
| | | GDFFFQD("22", "过渡费发放清单(正在过渡提供)", "镇(街道)", "不涉及过渡或已安置的不再提供"), |
| | | ZDXCYJZBPTSSWSQKSM("23", "宗地现场以及周边配套设施完善情况说明", "征安科", "局上出具情况说明"), |
| | | ZDXCZP("24", "宗地现场照片", "信息科", "卫星图、现场俯视图"), |
| | | JCGZPZWJ("25", "旧城改造批准文件", "利用科", "国有部分"), |
| | | ZFTYSGXGWJHSGXY("26", "政府同意收购相关文件或收购协议", "利用科", "国有部分"), |
| | | YQPZJGPFWJ("27", "有权批准机关批复文件", "利用科", "国有部分"), |
| | | FWCQXKZ("28", "房屋拆迁许可证", "利用科", "国有部分"), |
| | | CQGG("29", "拆迁公告", "利用科", "国有部分"), |
| | | GTZYJJCCQH("30", "国土资源局旧城拆迁函", "利用科", "国有部分"), |
| | | CQDXHXT("31", "1:500比例拆迁地形红线图", "利用科", "国有部分"), |
| | | YCLGYJSYDTDSYZHFCZZXSX("32", "原存量国有建设用地土地使用证和房产证注销手续", "利用科", "国有部分"), |
| | | CQBCAZGZWCQKDSM("33", "拆迁补偿安置工作完成情况的说明", "利用科", "国有部分"), |
| | | CQBPCXY("34", "拆迁补赔偿协议", "利用科", "国有部分"), |
| | | SGBPCXY("35", "收购补赔偿协议", "利用科", "国有部分"), |
| | | DYQRCJDCZYJ("36", "抵押权人出具的处置意见", "利用科", "国有部分"), |
| | | XCBL("37", "现场笔录", "镇(街道)", "涉及大龄人员的安置补助费,办理社保剩余安补费是否支付勾选“否”"), |
| | | OTHER("38", "其他", "/", "小组调整等"), |
| | | QXSCYJCBB("39", "区县审查意见呈报表", "征安科", "PDF版本"), |
| | | qxyjh("40", "区县意见函", "征安科", "加“保密”水印;最终上传PDF版本"), |
| | | QXTKB("41", "区县踏勘表", "征安科", "复审、抽查需与市局踏勘表一致"), |
| | | ZZYDYJCCDDSYYDXTGHXTSGS("42", "住宅用地以及抽查到的商业用地需提供红线图shape格式", "信息", ""), |
| | | ; |
| | | String type; |
| | | String name; |
| | | String provider; |
| | | String desc; |
| | | |
| | | /** |
| | | * 根据附件类型,获得对应的名称 |
| | | * |
| | | * @param type |
| | | * @return |
| | | */ |
| | | public static String getNameByType(String type) { |
| | | for (ProgressAttachmentEnum e : ProgressAttachmentEnum.values()) { |
| | | if (type.equals(e.type)) { |
| | | return e.name; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static List<Map<String, Object>> getKeyValues() { |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | for (ProgressAttachmentEnum e : ProgressAttachmentEnum.values()) { |
| | | Map<String, Object> kv = new HashMap<>(); |
| | | kv.put("type", e.type); |
| | | kv.put("name", e.name); |
| | | kv.put("provider", e.provider); |
| | | kv.put("desc", e.desc); |
| | | maps.add(kv); |
| | | } |
| | | return maps; |
| | | } |
| | | |
| | | public static List<String> getTypes() { |
| | | List<String> types = new ArrayList<>(); |
| | | for (ProgressAttachmentEnum e : ProgressAttachmentEnum.values()) { |
| | | types.add(e.type); |
| | | } |
| | | return types; |
| | | } |
| | | |
| | | public static List<String> getNames() { |
| | | List<String> types = new ArrayList<>(); |
| | | for (ProgressAttachmentEnum e : ProgressAttachmentEnum.values()) { |
| | | types.add(e.name); |
| | | } |
| | | return types; |
| | | } |
| | | |
| | | ProgressAttachmentEnum(String type, String name, String provider, String desc) { |
| | | this.type = type; |
| | | this.name = name; |
| | | this.provider = provider; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | public enum ResettlementTypeEnum { |
| | | MONKEY(1, "货币赔偿"), |
| | | GOODS(2, "房屋产权置换"); |
| | | private final Integer value; |
| | | |
| | | private final String text; |
| | | public static String getDescription(Integer key) { |
| | | for (ResettlementTypeEnum v : ResettlementTypeEnum.values()) { |
| | | if (key.equals(v.getValue())) { |
| | | return v.getText(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static int getValue(String description) { |
| | | for (ResettlementTypeEnum category : ResettlementTypeEnum.values()) { |
| | | if (category.getText().equalsIgnoreCase(description)) { |
| | | return category.getValue(); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | ResettlementTypeEnum(Integer value, String text) { |
| | | this.value = value; |
| | | this.text = text; |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public String getText() { |
| | | return text; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum SettledProcessEnum { |
| | | NOT_SETTLE(0,"未安置"), |
| | | SETTLE(1,"安置"); |
| | | |
| | | private final Integer value; |
| | | |
| | | private final String text; |
| | | |
| | | SettledProcessEnum(Integer value, String text) { |
| | | this.value = value; |
| | | this.text = text; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum StateHouseholdStageEnums { |
| | | SIMULATE(1,"房产是模拟阶段"), |
| | | SIMULATE_SUCCESS(2,"房产是模拟调查完成阶段"), |
| | | LEVY(3,"房产是征收阶段"), |
| | | LEVY_SUCCESS(4,"房产是征收阶段"), |
| | | ; |
| | | |
| | | private final Integer value; |
| | | |
| | | private final String text; |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 流程动作枚举 |
| | | * |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum StateProcessActionType { |
| | | |
| | | START(0), // "发起" |
| | | REJECTED(3), // "拒绝" |
| | | APPROVED(4), // "通过" |
| | | CANCELED(5), // "撤销" |
| | | BACK(7), // "回退" |
| | | COPY(12), // "抄送" |
| | | FORWARD(13), // "转发" |
| | | COMMENT(14), // "评论" |
| | | TRANSACT(15); // "办理" |
| | | |
| | | private final int value; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * DeleteFlagEnum |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum StateProjectStatusEnum { |
| | | CANCELLATION(-1, "作废", "cancellation"), |
| | | SIMULATE(0, "模拟", "simulate"), |
| | | LEVY(1, "征收", "signed"), |
| | | HOUSEHOLD_SURVEY(2, "入户调查", "house"), |
| | | SUCCESS(3, "完成", "settled"), |
| | | ; |
| | | |
| | | public static String getValueByKey(Integer key) { |
| | | for (StateProjectStatusEnum v : StateProjectStatusEnum.values()) { |
| | | if (key.equals(v.getKey())) { |
| | | return v.getValue(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static String getValue(Integer key) { |
| | | for (StateProjectStatusEnum v : StateProjectStatusEnum.values()) { |
| | | if (key.equals(v.key)) { |
| | | return v.value; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static StateProjectStatusEnum getEnumByKey(Integer key) { |
| | | for (StateProjectStatusEnum v : StateProjectStatusEnum.values()) { |
| | | if (key.equals(v.key)) { |
| | | return v; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private final Integer key; |
| | | private final String value; |
| | | private final String jsonKey; |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | @Getter |
| | | public enum SubmitStatusEnum { |
| | | SUBMITTED(-1, ""), |
| | | REJECT(0, "已退回"), |
| | | PENDING_REVIEW(1, "待审核"), |
| | | // REVIEWING(2, "审核中"), |
| | | ACCEPT(3, "已接收"); |
| | | |
| | | private final int value; |
| | | private final String text; |
| | | |
| | | public static String getTextByValue(Integer value) { |
| | | if (Objects.isNull(value)) { |
| | | return ""; |
| | | } |
| | | for (SubmitStatusEnum v : SubmitStatusEnum.values()) { |
| | | if (v.getValue() == (value)) { |
| | | return v.getText(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | SubmitStatusEnum(int value, String text) { |
| | | this.text = text; |
| | | this.value = value; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * 过渡费新增原因 |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public enum TransitionFeeAddEnum { |
| | | |
| | | 结婚享受安置(1,"结婚(享受安置)"), |
| | | 结婚申请购买(2,"结婚(申请购买)"), |
| | | 新生享受安置(3,"新生(享受安置)"), |
| | | 新生申请购买(4,"新生(申请购买)"), |
| | | 拆迁满1年(5,"拆迁满1年"), |
| | | 错报更正(6,"错报更正"), |
| | | 其他(7,"其他(备注栏写原因)"), |
| | | 补漏(8,"补漏"), |
| | | 收养(9,"收养"), |
| | | 子女投靠随迁(10,"子女投靠/随迁"), |
| | | 抵扣完毕(11,"抵扣完毕"), |
| | | 完善资料(12,"完善资料"), |
| | | 未成年人监护人(13,"未成年人监护人"), |
| | | 结婚(14,"结婚"), |
| | | 新生(15,"新生"), |
| | | ; |
| | | |
| | | public static String getValue(Integer key) { |
| | | for (TransitionFeeAddEnum v : TransitionFeeAddEnum.values()) { |
| | | if (key.equals(v.key)) { |
| | | return v.value; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | Integer key; |
| | | String value; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * 过渡费减少原因 |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public enum TransitionFeeSubEnum { |
| | | |
| | | 离婚(1,"离婚"), |
| | | 已安置(2,"已安置"), |
| | | 死亡(3,"死亡"), |
| | | 复核信息(4,"复核信息"), |
| | | 报增错误(5,"报增错误"), |
| | | 抵扣过渡费(6,"抵扣过渡费"), |
| | | 无抚养权(7,"无抚养权"), |
| | | 放弃申请购买(8,"放弃申请购买"), |
| | | 其他(9,"其他(备注栏写原因)"), |
| | | ; |
| | | |
| | | public static String getValue(Integer key) { |
| | | for (TransitionFeeSubEnum v : TransitionFeeSubEnum.values()) { |
| | | if (key.equals(v.key)) { |
| | | return v.value; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | Integer key; |
| | | String value; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.enums; |
| | | |
| | | /** |
| | | * 用户状态 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum UserStatus |
| | | { |
| | | OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); |
| | | |
| | | private final String code; |
| | | private final String info; |
| | | |
| | | UserStatus(String code, String info) |
| | | { |
| | | this.code = code; |
| | | this.info = info; |
| | | } |
| | | |
| | | public String getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public String getInfo() |
| | | { |
| | | return info; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception; |
| | | |
| | | |
| | | import com.zzg.common.utils.enums.CustomExceptionEnums; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * 自定义异常 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CustomException extends RuntimeException { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Integer code; |
| | | |
| | | private String message; |
| | | |
| | | public CustomException(@NotNull CustomExceptionEnums customExceptionEnums) { |
| | | throw new CustomException(customExceptionEnums.getMsg(), customExceptionEnums.getCode()); |
| | | } |
| | | |
| | | public CustomException(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public CustomException(String message, Integer code) { |
| | | this.message = message; |
| | | this.code = code; |
| | | } |
| | | |
| | | public CustomException(String message, Throwable e) { |
| | | super(message, e); |
| | | this.message = message; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public Integer getCode() { |
| | | return code; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception; |
| | | |
| | | /** |
| | | * 演示模式异常 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class DemoModeException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public DemoModeException() |
| | | { |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception; |
| | | |
| | | /** |
| | | * 全局异常 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class GlobalException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 错误提示 |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * 错误明细,内部调试错误 |
| | | * |
| | | * 和 {@link CommonResult#getDetailMessage()} 一致的设计 |
| | | */ |
| | | private String detailMessage; |
| | | |
| | | /** |
| | | * 空构造方法,避免反序列化问题 |
| | | */ |
| | | public GlobalException() |
| | | { |
| | | } |
| | | |
| | | public GlobalException(String message) |
| | | { |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getDetailMessage() |
| | | { |
| | | return detailMessage; |
| | | } |
| | | |
| | | public GlobalException setDetailMessage(String detailMessage) |
| | | { |
| | | this.detailMessage = detailMessage; |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() |
| | | { |
| | | return message; |
| | | } |
| | | |
| | | public GlobalException setMessage(String message) |
| | | { |
| | | this.message = message; |
| | | return this; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception; |
| | | |
| | | /** |
| | | * 业务异常 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public final class ServiceException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 错误码 |
| | | */ |
| | | private Integer code; |
| | | |
| | | /** |
| | | * 错误提示 |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * 错误明细,内部调试错误 |
| | | * |
| | | * 和 {@link CommonResult#getDetailMessage()} 一致的设计 |
| | | */ |
| | | private String detailMessage; |
| | | |
| | | /** |
| | | * 空构造方法,避免反序列化问题 |
| | | */ |
| | | public ServiceException() |
| | | { |
| | | } |
| | | |
| | | public ServiceException(String message) |
| | | { |
| | | this.message = message; |
| | | } |
| | | |
| | | public ServiceException(String message, Integer code) |
| | | { |
| | | this.message = message; |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getDetailMessage() |
| | | { |
| | | return detailMessage; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() |
| | | { |
| | | return message; |
| | | } |
| | | |
| | | public Integer getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public ServiceException setMessage(String message) |
| | | { |
| | | this.message = message; |
| | | return this; |
| | | } |
| | | |
| | | public ServiceException setDetailMessage(String detailMessage) |
| | | { |
| | | this.detailMessage = detailMessage; |
| | | return this; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception; |
| | | |
| | | /** |
| | | * 工具类异常 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UtilException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 8247610319171014183L; |
| | | |
| | | public UtilException(Throwable e) |
| | | { |
| | | super(e.getMessage(), e); |
| | | } |
| | | |
| | | public UtilException(String message) |
| | | { |
| | | super(message); |
| | | } |
| | | |
| | | public UtilException(String message, Throwable throwable) |
| | | { |
| | | super(message, throwable); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.base; |
| | | |
| | | import com.zzg.common.utils.MessageUtils; |
| | | import com.zzg.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 基础异常 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class BaseException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 所属模块 |
| | | */ |
| | | private String module; |
| | | |
| | | /** |
| | | * 错误码 |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * 错误码对应的参数 |
| | | */ |
| | | private Object[] args; |
| | | |
| | | /** |
| | | * 错误消息 |
| | | */ |
| | | private String defaultMessage; |
| | | |
| | | public BaseException(String module, String code, Object[] args, String defaultMessage) |
| | | { |
| | | this.module = module; |
| | | this.code = code; |
| | | this.args = args; |
| | | this.defaultMessage = defaultMessage; |
| | | } |
| | | |
| | | public BaseException(String module, String code, Object[] args) |
| | | { |
| | | this(module, code, args, null); |
| | | } |
| | | |
| | | public BaseException(String module, String defaultMessage) |
| | | { |
| | | this(module, null, null, defaultMessage); |
| | | } |
| | | |
| | | public BaseException(String code, Object[] args) |
| | | { |
| | | this(null, code, args, null); |
| | | } |
| | | |
| | | public BaseException(String defaultMessage) |
| | | { |
| | | this(null, null, null, defaultMessage); |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() |
| | | { |
| | | String message = null; |
| | | if (!StringUtils.isEmpty(code)) |
| | | { |
| | | message = MessageUtils.message(code, args); |
| | | } |
| | | if (message == null) |
| | | { |
| | | message = defaultMessage; |
| | | } |
| | | return message; |
| | | } |
| | | |
| | | public String getModule() |
| | | { |
| | | return module; |
| | | } |
| | | |
| | | public String getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public Object[] getArgs() |
| | | { |
| | | return args; |
| | | } |
| | | |
| | | public String getDefaultMessage() |
| | | { |
| | | return defaultMessage; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.file; |
| | | |
| | | import com.zzg.common.exception.base.BaseException; |
| | | |
| | | /** |
| | | * 文件信息异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileException extends BaseException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public FileException(String code, Object[] args) |
| | | { |
| | | super("file", code, args, null); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.file; |
| | | |
| | | /** |
| | | * 文件名称超长限制异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileNameLengthLimitExceededException extends FileException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public FileNameLengthLimitExceededException(int defaultFileNameLength) |
| | | { |
| | | super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.file; |
| | | |
| | | /** |
| | | * 文件名大小限制异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileSizeLimitExceededException extends FileException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public FileSizeLimitExceededException(long defaultMaxSize) |
| | | { |
| | | super("upload.exceed.maxSize", new Object[] { defaultMaxSize }); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.file; |
| | | |
| | | import java.io.PrintStream; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * 文件上传异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileUploadException extends Exception |
| | | { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private final Throwable cause; |
| | | |
| | | public FileUploadException() |
| | | { |
| | | this(null, null); |
| | | } |
| | | |
| | | public FileUploadException(final String msg) |
| | | { |
| | | this(msg, null); |
| | | } |
| | | |
| | | public FileUploadException(String msg, Throwable cause) |
| | | { |
| | | super(msg); |
| | | this.cause = cause; |
| | | } |
| | | |
| | | @Override |
| | | public void printStackTrace(PrintStream stream) |
| | | { |
| | | super.printStackTrace(stream); |
| | | if (cause != null) |
| | | { |
| | | stream.println("Caused by:"); |
| | | cause.printStackTrace(stream); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void printStackTrace(PrintWriter writer) |
| | | { |
| | | super.printStackTrace(writer); |
| | | if (cause != null) |
| | | { |
| | | writer.println("Caused by:"); |
| | | cause.printStackTrace(writer); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Throwable getCause() |
| | | { |
| | | return cause; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.file; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 文件上传 误异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class InvalidExtensionException extends FileUploadException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String[] allowedExtension; |
| | | private String extension; |
| | | private String filename; |
| | | |
| | | public InvalidExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super("文件[" + filename + "]后缀[" + extension + "]不正确,请上传" + Arrays.toString(allowedExtension) + "格式"); |
| | | this.allowedExtension = allowedExtension; |
| | | this.extension = extension; |
| | | this.filename = filename; |
| | | } |
| | | |
| | | public String[] getAllowedExtension() |
| | | { |
| | | return allowedExtension; |
| | | } |
| | | |
| | | public String getExtension() |
| | | { |
| | | return extension; |
| | | } |
| | | |
| | | public String getFilename() |
| | | { |
| | | return filename; |
| | | } |
| | | |
| | | public static class InvalidImageExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | |
| | | public static class InvalidFlashExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | |
| | | public static class InvalidMediaExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | |
| | | public static class InvalidVideoExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.job; |
| | | |
| | | /** |
| | | * 计划策略异常 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TaskException extends Exception |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Code code; |
| | | |
| | | public TaskException(String msg, Code code) |
| | | { |
| | | this(msg, code, null); |
| | | } |
| | | |
| | | public TaskException(String msg, Code code, Exception nestedEx) |
| | | { |
| | | super(msg, nestedEx); |
| | | this.code = code; |
| | | } |
| | | |
| | | public Code getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public enum Code |
| | | { |
| | | TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.state; |
| | | |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum StateErrorCode { |
| | | |
| | | PROCESS_TEMPLATE_KEY_EXISTS("已经存在此名称的模版了!"), |
| | | PROCESS_TEMPLATE_NOT_EXISTS("流程模版不存在!"), |
| | | PROCESS_NOT_DEPLOY("模版尚未部署成功"), |
| | | PROCESS_VERSION_ERROR("流程引擎版本不一致"), |
| | | ; |
| | | |
| | | private final String value; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.user; |
| | | |
| | | /** |
| | | * 黑名单IP异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class BlackListException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public BlackListException() |
| | | { |
| | | super("login.blocked", null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.user; |
| | | |
| | | /** |
| | | * 验证码错误异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CaptchaException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public CaptchaException() |
| | | { |
| | | super("user.jcaptcha.error", null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.user; |
| | | |
| | | /** |
| | | * 验证码失效异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CaptchaExpireException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public CaptchaExpireException() |
| | | { |
| | | super("user.jcaptcha.expire", null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.user; |
| | | |
| | | import com.zzg.common.exception.base.BaseException; |
| | | |
| | | /** |
| | | * 用户信息异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserException extends BaseException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public UserException(String code, Object[] args) |
| | | { |
| | | super("user", code, args, null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.user; |
| | | |
| | | /** |
| | | * 用户不存在异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserNotExistsException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public UserNotExistsException() |
| | | { |
| | | super("user.not.exists", null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.user; |
| | | |
| | | /** |
| | | * 用户密码不正确或不符合规范异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserPasswordNotMatchException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public UserPasswordNotMatchException() |
| | | { |
| | | super("user.password.not.match", null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.exception.user; |
| | | |
| | | /** |
| | | * 用户错误最大次数异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserPasswordRetryLimitExceedException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public UserPasswordRetryLimitExceedException(int retryLimitCount, int lockTime) |
| | | { |
| | | super("user.password.retry.limit.exceed", new Object[] { retryLimitCount, lockTime }); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.filter; |
| | | |
| | | import com.alibaba.fastjson2.filter.SimplePropertyPreFilter; |
| | | |
| | | /** |
| | | * 排除JSON敏感属性 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class PropertyPreExcludeFilter extends SimplePropertyPreFilter |
| | | { |
| | | public PropertyPreExcludeFilter() |
| | | { |
| | | } |
| | | |
| | | public PropertyPreExcludeFilter addExcludes(String... filters) |
| | | { |
| | | for (int i = 0; i < filters.length; i++) |
| | | { |
| | | this.getExcludes().add(filters[i]); |
| | | } |
| | | return this; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.filter; |
| | | |
| | | import java.io.IOException; |
| | | import javax.servlet.Filter; |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.FilterConfig; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletRequest; |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import org.springframework.http.MediaType; |
| | | import com.zzg.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * Repeatable 过滤器 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RepeatableFilter implements Filter |
| | | { |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException |
| | | { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
| | | throws IOException, ServletException |
| | | { |
| | | ServletRequest requestWrapper = null; |
| | | if (request instanceof HttpServletRequest |
| | | && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) |
| | | { |
| | | requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); |
| | | } |
| | | if (null == requestWrapper) |
| | | { |
| | | chain.doFilter(request, response); |
| | | } |
| | | else |
| | | { |
| | | chain.doFilter(requestWrapper, response); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() |
| | | { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.filter; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import javax.servlet.ReadListener; |
| | | import javax.servlet.ServletInputStream; |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletRequestWrapper; |
| | | import com.zzg.common.utils.http.HttpHelper; |
| | | import com.zzg.common.constant.Constants; |
| | | |
| | | /** |
| | | * 构建可重复读取inputStream的request |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper |
| | | { |
| | | private final byte[] body; |
| | | |
| | | public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException |
| | | { |
| | | super(request); |
| | | request.setCharacterEncoding(Constants.UTF8); |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | |
| | | body = HttpHelper.getBodyString(request).getBytes(Constants.UTF8); |
| | | } |
| | | |
| | | @Override |
| | | public BufferedReader getReader() throws IOException |
| | | { |
| | | return new BufferedReader(new InputStreamReader(getInputStream())); |
| | | } |
| | | |
| | | @Override |
| | | public ServletInputStream getInputStream() throws IOException |
| | | { |
| | | final ByteArrayInputStream bais = new ByteArrayInputStream(body); |
| | | return new ServletInputStream() |
| | | { |
| | | @Override |
| | | public int read() throws IOException |
| | | { |
| | | return bais.read(); |
| | | } |
| | | |
| | | @Override |
| | | public int available() throws IOException |
| | | { |
| | | return body.length; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isFinished() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isReady() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public void setReadListener(ReadListener readListener) |
| | | { |
| | | |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.filter; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.servlet.Filter; |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.FilterConfig; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletRequest; |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.common.enums.HttpMethod; |
| | | |
| | | /** |
| | | * 防止XSS攻击的过滤器 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class XssFilter implements Filter |
| | | { |
| | | /** |
| | | * 排除链接 |
| | | */ |
| | | public List<String> excludes = new ArrayList<>(); |
| | | |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException |
| | | { |
| | | String tempExcludes = filterConfig.getInitParameter("excludes"); |
| | | if (StringUtils.isNotEmpty(tempExcludes)) |
| | | { |
| | | String[] url = tempExcludes.split(","); |
| | | for (int i = 0; url != null && i < url.length; i++) |
| | | { |
| | | excludes.add(url[i]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
| | | throws IOException, ServletException |
| | | { |
| | | HttpServletRequest req = (HttpServletRequest) request; |
| | | HttpServletResponse resp = (HttpServletResponse) response; |
| | | if (handleExcludeURL(req, resp)) |
| | | { |
| | | chain.doFilter(request, response); |
| | | return; |
| | | } |
| | | XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request); |
| | | chain.doFilter(xssRequest, response); |
| | | } |
| | | |
| | | private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) |
| | | { |
| | | String url = request.getServletPath(); |
| | | String method = request.getMethod(); |
| | | // GET DELETE 不过滤 |
| | | if (method == null || HttpMethod.GET.matches(method) || HttpMethod.DELETE.matches(method)) |
| | | { |
| | | return true; |
| | | } |
| | | return StringUtils.matches(url, excludes); |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() |
| | | { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.filter; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import javax.servlet.ReadListener; |
| | | import javax.servlet.ServletInputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletRequestWrapper; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import com.zzg.common.utils.StringUtils; |
| | | import com.zzg.common.utils.html.EscapeUtil; |
| | | |
| | | /** |
| | | * XSS过滤处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper |
| | | { |
| | | /** |
| | | * @param request |
| | | */ |
| | | public XssHttpServletRequestWrapper(HttpServletRequest request) |
| | | { |
| | | super(request); |
| | | } |
| | | |
| | | @Override |
| | | public String[] getParameterValues(String name) |
| | | { |
| | | String[] values = super.getParameterValues(name); |
| | | if (values != null) |
| | | { |
| | | int length = values.length; |
| | | String[] escapesValues = new String[length]; |
| | | for (int i = 0; i < length; i++) |
| | | { |
| | | // 防xss攻击和过滤前后空格 |
| | | escapesValues[i] = EscapeUtil.clean(values[i]).trim(); |
| | | } |
| | | return escapesValues; |
| | | } |
| | | return super.getParameterValues(name); |
| | | } |
| | | |
| | | @Override |
| | | public ServletInputStream getInputStream() throws IOException |
| | | { |
| | | // 非json类型,直接返回 |
| | | if (!isJsonRequest()) |
| | | { |
| | | return super.getInputStream(); |
| | | } |
| | | |
| | | // 为空,直接返回 |
| | | String json = IOUtils.toString(super.getInputStream(), "utf-8"); |
| | | if (StringUtils.isEmpty(json)) |
| | | { |
| | | return super.getInputStream(); |
| | | } |
| | | |
| | | // xss过滤 |
| | | json = EscapeUtil.clean(json).trim(); |
| | | byte[] jsonBytes = json.getBytes("utf-8"); |
| | | final ByteArrayInputStream bis = new ByteArrayInputStream(jsonBytes); |
| | | return new ServletInputStream() |
| | | { |
| | | @Override |
| | | public boolean isFinished() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isReady() |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int available() throws IOException |
| | | { |
| | | return jsonBytes.length; |
| | | } |
| | | |
| | | @Override |
| | | public void setReadListener(ReadListener readListener) |
| | | { |
| | | } |
| | | |
| | | @Override |
| | | public int read() throws IOException |
| | | { |
| | | return bis.read(); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * 是否是Json请求 |
| | | * |
| | | * @param request |
| | | */ |
| | | public boolean isJsonRequest() |
| | | { |
| | | String header = super.getHeader(HttpHeaders.CONTENT_TYPE); |
| | | return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import org.apache.ibatis.type.BaseTypeHandler; |
| | | import org.apache.ibatis.type.JdbcType; |
| | | |
| | | import java.sql.CallableStatement; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | |
| | | //AES 是工具方法类,按加密需求设置 |
| | | public class AESEncryptHandler extends BaseTypeHandler { |
| | | |
| | | @Override |
| | | public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException { |
| | | ps.setString(i, AESUtil.encrypt((String) parameter)); |
| | | } |
| | | |
| | | @Override |
| | | public String getNullableResult(ResultSet rs, String columnName) throws SQLException { |
| | | String columnValue = rs.getString(columnName); |
| | | return AESUtil.decrypt(columnValue); |
| | | } |
| | | |
| | | @Override |
| | | public String getNullableResult(ResultSet rs, int columnIndex) throws SQLException { |
| | | String columnValue = rs.getString(columnIndex); |
| | | return AESUtil.decrypt(columnValue); |
| | | } |
| | | |
| | | @Override |
| | | public String getNullableResult(CallableStatement cs, int columnIndex) |
| | | throws SQLException { |
| | | String columnValue = cs.getString(columnIndex); |
| | | return AESUtil.decrypt(columnValue); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.spec.IvParameterSpec; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | |
| | | |
| | | /** |
| | | * aes 加密的工具类 |
| | | * 1.存储 加密的秘钥key |
| | | * 2.实现 aes 加密 |
| | | * 3.实现aes解密的功能 |
| | | */ |
| | | public class AESUtil { |
| | | |
| | | // 定义 aes 加密的key |
| | | // 密钥 必须是16位, 自定义, |
| | | // 如果不是16位, 则会出现InvalidKeyException: Illegal key size |
| | | // 解决方案有两种: |
| | | //1.需要安装Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files(可以在Oracle下载). |
| | | //2.设置设置key的长度为16个字母和数字的字符窜(128 Bit/8=16字符)就不报错了。 |
| | | private static String key = "congzhouland8088"; |
| | | |
| | | //定义加密的编码 |
| | | private static String charset = "utf-8"; |
| | | |
| | | // 偏移量 |
| | | private static int offset = 16; |
| | | private static String transformation = "AES/CBC/PKCS5Padding"; |
| | | private static String algorithm = "AES"; |
| | | |
| | | /** |
| | | * 加密 |
| | | * |
| | | * @param content |
| | | * @return |
| | | */ |
| | | public static String encrypt(String content) { |
| | | return encrypt(content, key); |
| | | } |
| | | |
| | | /** |
| | | * 解密 |
| | | * |
| | | * @param content |
| | | * @return |
| | | */ |
| | | public static String decrypt(String content) { |
| | | return decrypt(content, key); |
| | | } |
| | | |
| | | /** |
| | | * 加密 |
| | | * |
| | | * @param content 需要加密的内容 |
| | | * @param key 加密密码 |
| | | * @return |
| | | */ |
| | | public static String encrypt(String content, String key) { |
| | | if (StringUtils.isEmpty(content)) { |
| | | return ""; |
| | | } |
| | | try { |
| | | SecretKeySpec skey = new SecretKeySpec(key.getBytes(), algorithm); |
| | | IvParameterSpec iv = new IvParameterSpec(key.getBytes(), 0, offset); |
| | | Cipher cipher = Cipher.getInstance(transformation); |
| | | byte[] byteContent = content.getBytes(charset); |
| | | cipher.init(Cipher.ENCRYPT_MODE, skey, iv);// 初始化 |
| | | byte[] result = cipher.doFinal(byteContent); |
| | | return new Base64().encodeToString(result); // 加密 |
| | | } catch (Exception e) { |
| | | // LogUtil.exception(e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * AES(256)解密 |
| | | * |
| | | * @param content 待解密内容 |
| | | * @param key 解密密钥 |
| | | * @return 解密之后 |
| | | * @throws Exception |
| | | */ |
| | | public static String decrypt(String content, String key) { |
| | | try { |
| | | SecretKeySpec skey = new SecretKeySpec(key.getBytes(), algorithm); |
| | | IvParameterSpec iv = new IvParameterSpec(key.getBytes(), 0, offset); |
| | | Cipher cipher = Cipher.getInstance(transformation); |
| | | cipher.init(Cipher.DECRYPT_MODE, skey, iv);// 初始化 |
| | | byte[] result = cipher.doFinal(new Base64().decode(content)); |
| | | return new String(result); // 解密 |
| | | } catch (Exception e) { |
| | | //LogUtil.exception(e); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(encrypt("431222199408086874")); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | |
| | | /** |
| | | * 精确的浮点数运算 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class Arith |
| | | { |
| | | |
| | | /** 默认除法运算精度 */ |
| | | private static final int DEF_DIV_SCALE = 10; |
| | | |
| | | /** 这个类不能实例化 */ |
| | | private Arith() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * 提供精确的加法运算。 |
| | | * @param v1 被加数 |
| | | * @param v2 加数 |
| | | * @return 两个参数的和 |
| | | */ |
| | | public static double add(double v1, double v2) |
| | | { |
| | | BigDecimal b1 = new BigDecimal(Double.toString(v1)); |
| | | BigDecimal b2 = new BigDecimal(Double.toString(v2)); |
| | | return b1.add(b2).doubleValue(); |
| | | } |
| | | |
| | | /** |
| | | * 提供精确的减法运算。 |
| | | * @param v1 被减数 |
| | | * @param v2 减数 |
| | | * @return 两个参数的差 |
| | | */ |
| | | public static double sub(double v1, double v2) |
| | | { |
| | | BigDecimal b1 = new BigDecimal(Double.toString(v1)); |
| | | BigDecimal b2 = new BigDecimal(Double.toString(v2)); |
| | | return b1.subtract(b2).doubleValue(); |
| | | } |
| | | |
| | | /** |
| | | * 提供精确的乘法运算。 |
| | | * @param v1 被乘数 |
| | | * @param v2 乘数 |
| | | * @return 两个参数的积 |
| | | */ |
| | | public static double mul(double v1, double v2) |
| | | { |
| | | BigDecimal b1 = new BigDecimal(Double.toString(v1)); |
| | | BigDecimal b2 = new BigDecimal(Double.toString(v2)); |
| | | return b1.multiply(b2).doubleValue(); |
| | | } |
| | | |
| | | /** |
| | | * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 |
| | | * 小数点以后10位,以后的数字四舍五入。 |
| | | * @param v1 被除数 |
| | | * @param v2 除数 |
| | | * @return 两个参数的商 |
| | | */ |
| | | public static double div(double v1, double v2) |
| | | { |
| | | return div(v1, v2, DEF_DIV_SCALE); |
| | | } |
| | | |
| | | /** |
| | | * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 |
| | | * 定精度,以后的数字四舍五入。 |
| | | * @param v1 被除数 |
| | | * @param v2 除数 |
| | | * @param scale 表示表示需要精确到小数点以后几位。 |
| | | * @return 两个参数的商 |
| | | */ |
| | | public static double div(double v1, double v2, int scale) |
| | | { |
| | | if (scale < 0) |
| | | { |
| | | throw new IllegalArgumentException( |
| | | "The scale must be a positive integer or zero"); |
| | | } |
| | | BigDecimal b1 = new BigDecimal(Double.toString(v1)); |
| | | BigDecimal b2 = new BigDecimal(Double.toString(v2)); |
| | | if (b1.compareTo(BigDecimal.ZERO) == 0) |
| | | { |
| | | return BigDecimal.ZERO.doubleValue(); |
| | | } |
| | | return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | /** |
| | | * 提供精确的小数位四舍五入处理。 |
| | | * @param v 需要四舍五入的数字 |
| | | * @param scale 小数点后保留几位 |
| | | * @return 四舍五入后的结果 |
| | | */ |
| | | public static double round(double v, int scale) |
| | | { |
| | | if (scale < 0) |
| | | { |
| | | throw new IllegalArgumentException( |
| | | "The scale must be a positive integer or zero"); |
| | | } |
| | | BigDecimal b = new BigDecimal(Double.toString(v)); |
| | | BigDecimal one = BigDecimal.ONE; |
| | | return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | |
| | | import org.apache.commons.beanutils.BeanUtils; |
| | | import org.springframework.beans.BeanWrapper; |
| | | import org.springframework.beans.BeanWrapperImpl; |
| | | |
| | | import java.beans.BeanInfo; |
| | | import java.beans.Introspector; |
| | | import java.beans.PropertyDescriptor; |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.lang.reflect.Modifier; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author: xxxg |
| | | * @date: 2022/2/7 17:18 |
| | | */ |
| | | public class BeanUtil { |
| | | /** |
| | | * 使用org.apache.commons.beanutils进行转换 |
| | | * <p> |
| | | * 注意:org.springframework.beans.BeanUtils与org.apache.commons.beanutils.BeanUtils都有copyProperties方法,但前者支持忽略个别属性的方法,即copyProperties(source, target, ignoreProperties) |
| | | */ |
| | | public static Object mapToObject1(Map<String, Object> map, Class<?> beanClass) throws Exception { |
| | | if (map == null) { |
| | | return null; |
| | | } |
| | | Object obj = beanClass.newInstance(); |
| | | BeanUtils.populate(obj, map); |
| | | return obj; |
| | | } |
| | | |
| | | public static Map<?, ?> objectToMap1(Object obj) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { |
| | | if (obj == null) { |
| | | return null; |
| | | } |
| | | return BeanUtils.describe(obj); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用Introspector进行转换 |
| | | */ |
| | | public static Object mapToObject2(Map<String, Object> map, Class<?> beanClass) throws Exception { |
| | | if (map == null) { |
| | | return null; |
| | | } |
| | | |
| | | Object obj = beanClass.newInstance(); |
| | | |
| | | BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); |
| | | PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); |
| | | for (PropertyDescriptor property : propertyDescriptors) { |
| | | Method setter = property.getWriteMethod(); |
| | | if (setter != null) { |
| | | setter.invoke(obj, map.get(property.getName())); |
| | | } |
| | | } |
| | | |
| | | return obj; |
| | | } |
| | | |
| | | public static Map<String, Object> objectToMap2(Object obj) throws Exception { |
| | | if (obj == null) { |
| | | return null; |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | |
| | | BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); |
| | | PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); |
| | | for (PropertyDescriptor property : propertyDescriptors) { |
| | | String key = property.getName(); |
| | | if (key.compareToIgnoreCase("class") == 0) { |
| | | continue; |
| | | } |
| | | Method getter = property.getReadMethod(); |
| | | Object value = getter != null ? getter.invoke(obj) : null; |
| | | map.put(key, value); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 使用reflect进行转换 |
| | | */ |
| | | public static Object mapToObject3(Map<String, Object> map, Class<?> beanClass) throws Exception { |
| | | if (map == null) { |
| | | return null; |
| | | } |
| | | |
| | | Object obj = beanClass.newInstance(); |
| | | |
| | | Field[] fields = obj.getClass().getDeclaredFields(); |
| | | for (Field field : fields) { |
| | | int mod = field.getModifiers(); |
| | | if (Modifier.isStatic(mod) || Modifier.isFinal(mod)) { |
| | | continue; |
| | | } |
| | | |
| | | field.setAccessible(true); |
| | | field.set(obj, map.get(field.getName())); |
| | | } |
| | | |
| | | return obj; |
| | | } |
| | | |
| | | public static Map<String, Object> objectToMap3(Object obj) throws Exception { |
| | | if (obj == null) { |
| | | return null; |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | |
| | | Field[] declaredFields = obj.getClass().getDeclaredFields(); |
| | | for (Field field : declaredFields) { |
| | | field.setAccessible(true); |
| | | map.put(field.getName(), field.get(obj)); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 判断实体中是否包含某个属性 |
| | | * |
| | | * @param clazz |
| | | * @param propertyName |
| | | * @return |
| | | */ |
| | | public static boolean containField(Class<?> clazz, String propertyName) { |
| | | /** |
| | | * 循环遍历所有的元素,检测有没有这个名字 |
| | | */ |
| | | Field[] fields = clazz.getDeclaredFields(); |
| | | boolean b = false; |
| | | for (int i = 0; i < fields.length; i++) { |
| | | if (fields[i].getName().equals(propertyName)) { |
| | | b = true; |
| | | break; |
| | | } |
| | | } |
| | | return b; |
| | | } |
| | | |
| | | public static String[] getNullPropertyNames(Object source) { |
| | | final BeanWrapper src = new BeanWrapperImpl(source); |
| | | PropertyDescriptor[] pds = src.getPropertyDescriptors(); |
| | | |
| | | Set<String> emptyNames = new HashSet<>(); |
| | | for (PropertyDescriptor pd : pds) { |
| | | Object srcValue = src.getPropertyValue(pd.getName()); |
| | | if (srcValue == null) { |
| | | emptyNames.add(pd.getName()); |
| | | } |
| | | } |
| | | String[] result = new String[emptyNames.size()]; |
| | | return emptyNames.toArray(result); |
| | | } |
| | | |
| | | /** |
| | | * 非空拷贝 |
| | | * |
| | | * @param source |
| | | * @param target |
| | | */ |
| | | public static void copyNotNullBean(Object source, Object target) { |
| | | org.springframework.beans.BeanUtils.copyProperties(source, target, getNullPropertyNames(source)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | public interface ConstantUtils { |
| | | public final static String DEFAULT_SRID = "4523"; |
| | | public final static Integer YES = 1; |
| | | /** |
| | | * 公告类型 |
| | | */ |
| | | //征地信息公告 |
| | | public final static Integer NOTICE = 1; |
| | | //补偿安置公告 |
| | | public final static Integer NOTICE_PLACEMENT = 2; |
| | | //征地启动公告(预公告) |
| | | public final static Integer NOTICE_START = 3; |
| | | //土地补偿政策 |
| | | public final static Integer LAND_COMPENSATE_POLICY = 4; |
| | | //安置补偿政策 |
| | | public final static Integer PLACEMENT_COMPENSATE_POLICY = 5; |
| | | //城镇安置政策 |
| | | public final static Integer CITY_COMPENSATE_POLICY = 6; |
| | | //社保政策 |
| | | public final static Integer SOCIAL_INSURANCE_COMPENSATE_POLICY = 7; |
| | | //青苗政策 |
| | | public final static Integer CROP_COMPENSATE_POLICY = 8; |
| | | //住房政策 |
| | | public final static Integer HOUSE_COMPENSATE_POLICY = 9; |
| | | |
| | | public final static List<Integer> NOTICE_LIST = new ArrayList<>(Arrays.asList(1, 2, 3)); |
| | | /** |
| | | * 征地信息公告和关联的土地补偿执行政策、安置补助费执行政策、 |
| | | * 城镇安置执行政策、社保执行政策、青苗和地上附着物补偿执行政策、住房安置执行政策 |
| | | */ |
| | | public final static List<Integer> NOTICE_POLICY_LIST = new ArrayList<>(Arrays.asList(1, 4, 5, 6, 7, 8, 9)); |
| | | |
| | | //备案已审核 |
| | | public final static Integer CHECKED = 1; |
| | | |
| | | public final static String DRAWING_NOTICE = "公告"; |
| | | |
| | | //户主id |
| | | public final static String PID = "0"; |
| | | public final static Integer DEFAULT_LEVEl = 1; |
| | | |
| | | public final static String SOCIAL_RISK_REPORT = "社会风险评估报告"; |
| | | public final static String STABILITY_RISK_REPORT = "社会稳定风险评估报告"; |
| | | public final static String SOCIAL_RISK_ATTACH = "备案资料附件"; |
| | | |
| | | public final static Integer TEN_THOUSAND = 10000; |
| | | public final static Integer HUNDRED = 100; |
| | | public final static Integer TRANSFER_FEE_MONTH = 160; |
| | | public final static Integer MONTHS = 12; |
| | | //搬家补助 |
| | | public final static Integer MOVING_ALLOWANCE = 500; |
| | | //安置住房面积 |
| | | public final static Integer PLACEMENT_HOUSE_AREA = 35; |
| | | |
| | | /** |
| | | * 数据库 类型 |
| | | */ |
| | | String DB_POSTGRESQL = "postgre"; |
| | | String DB_MYSQL = "mysql"; |
| | | String DB_SQLITE = "sqlite"; |
| | | |
| | | /** |
| | | * JDBC 类型 |
| | | */ |
| | | String JDBC_POSTGRESQL = "jdbc:postgresql"; |
| | | String JDBC_MYSQL = "jdbc:mysql"; |
| | | String JDBC_SQLITE = "jdbc:sqlite"; |
| | | |
| | | /** |
| | | * postgresql 数据库geometry 字段类型 |
| | | */ |
| | | String GEOM_TYPE_POLYGON = "POLYGON"; |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | /** |
| | | * 通用常量信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class Constants { |
| | | /** |
| | | * UTF-8 字符集 |
| | | */ |
| | | public static final String UTF8 = "UTF-8"; |
| | | |
| | | /** |
| | | * GBK 字符集 |
| | | */ |
| | | public static final String GBK = "GBK"; |
| | | |
| | | /** |
| | | * 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 long MIN_PAGE = 0; |
| | | /** |
| | | * 最大显示条数 |
| | | */ |
| | | public static final long MAX_LIMIT = 1000; |
| | | /** |
| | | * 默认页码 |
| | | */ |
| | | public static final long DEFAULT_PAGE = 1; |
| | | /** |
| | | * 默认显示条数 |
| | | */ |
| | | public static final long DEFAULT_LIMIT = 10; |
| | | /** |
| | | * 页码 KEY |
| | | */ |
| | | public static final String PAGE_KEY = "page"; |
| | | /** |
| | | * 显示条数 KEY |
| | | */ |
| | | public static final String PAGE_LIMIT_KEY = "limit"; |
| | | /** |
| | | * 排序字段 KEY |
| | | */ |
| | | public static final String PAGE_SORT_KEY = "sort"; |
| | | /** |
| | | * 排序方向 KEY |
| | | */ |
| | | public static final String PAGE_ORDER_KEY = "order"; |
| | | |
| | | /** |
| | | * 逻辑删除 del_flag |
| | | */ |
| | | public static final String DEL_FLAG = "1"; |
| | | |
| | | /** |
| | | * 系统管理员名称 |
| | | */ |
| | | public static final String SUPER_ADMIN_NAME = "admin"; |
| | | |
| | | /** |
| | | * 创建图层矢量数据前缀 |
| | | */ |
| | | public static final String COVERAGE_LAYER_PREFIX = "natural_layer_"; |
| | | |
| | | /** |
| | | * 创建图层属性数据前缀 |
| | | */ |
| | | public static final String COVERAGE_ATTRIBUTE_PREFIX = "natural_attribute_"; |
| | | |
| | | /** |
| | | * 创建图层视图数据前缀 |
| | | */ |
| | | public static final String COVERAGE_VIEW_PREFIX = "natural_view_"; |
| | | |
| | | /** |
| | | * 图层矢量数据表关联图层属性数据表id |
| | | */ |
| | | public static final String COVERAGE_LAYER_ATTRIBUTE_ID = "lay_att_id"; |
| | | |
| | | /** |
| | | * 图层属性数据表id |
| | | */ |
| | | public static final String COVERAGE_ATTRIBUTE_ID = "att_id"; |
| | | |
| | | /** |
| | | * 创建图层属性数据前缀 |
| | | */ |
| | | public static final String COVERAGE_Pk_PREFIX = "_pk"; |
| | | |
| | | /** |
| | | * 中文-其他 |
| | | */ |
| | | public static final String CHINA_ELSE = "其他"; |
| | | |
| | | /** |
| | | * 柱状图图表类型 |
| | | */ |
| | | public static final String CHART_BAR = "bar"; |
| | | |
| | | /** |
| | | * 柱状图图表类型 |
| | | */ |
| | | public static final String CHART_CATEGORY = "category"; |
| | | |
| | | /** |
| | | * postgis 坐标系 4326 4523 |
| | | */ |
| | | public static final Integer GEO_SRID_DEFAULT = 4523; |
| | | |
| | | /** |
| | | * postgis 合规审查类型 成分分析 |
| | | */ |
| | | public static final String GEO_CONSTITUENT = "constituent"; |
| | | |
| | | /** |
| | | * postgis 合规审查类型 冲突检查 |
| | | */ |
| | | public static final String GEO_CONFLICT = "conflict"; |
| | | |
| | | /** |
| | | * postgis 合规审查类型 缝隙监测 |
| | | */ |
| | | public static final String GEO_APERTURE = "aperture"; |
| | | |
| | | public static final String TWO = "2"; |
| | | /** |
| | | * 图形 |
| | | */ |
| | | public static final String GRAPH = "graph"; |
| | | /** |
| | | * 缓冲区 |
| | | */ |
| | | public static final String BUFFER_ZONE = "bufferZone"; |
| | | /** |
| | | * 点 |
| | | */ |
| | | public static final String POINT = "Point"; |
| | | /** |
| | | * 多点 |
| | | */ |
| | | public static final String MULTIPOINT = "MultiPoint"; |
| | | /** |
| | | * 线 |
| | | */ |
| | | public static final String LINESTRING = "LineString"; |
| | | /** |
| | | * 多线 |
| | | */ |
| | | public static final String MULTILINESTRING = "MultiLineString"; |
| | | /** |
| | | * 面 |
| | | */ |
| | | public static final String POLYGON = "Polygon"; |
| | | /** |
| | | * 多面 |
| | | */ |
| | | public static final String MULTIPOLYGON = "MultiPolygon"; |
| | | |
| | | /** |
| | | * WMSLayer图层类型 |
| | | */ |
| | | public static final String WMS_LAYER = "WMSLayer"; |
| | | |
| | | /** |
| | | * WMTSLayer图层类型 |
| | | */ |
| | | public static final String WMTS_LAYER = "WMTSLayer"; |
| | | |
| | | /** |
| | | * FeatureLayer图层类型 |
| | | */ |
| | | public static final String FEATURE_LAYER = "FeatureLayer"; |
| | | |
| | | /** |
| | | * SceneLayer图层类型 |
| | | */ |
| | | public static final String SCENE_LAYER = "SceneLayer"; |
| | | |
| | | /** |
| | | * arcgis登录缓存key |
| | | */ |
| | | public static final String ARCGIS_LOGIN_KEY = "arcgisLoginInfo"; |
| | | |
| | | /** |
| | | * 资源映射路径 前缀 |
| | | */ |
| | | public static final String RESOURCE_PREFIX = "/profile"; |
| | | |
| | | /** |
| | | * 乡镇地块编号 |
| | | */ |
| | | public static final String LANDMASS_NUMBER = "编号"; |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | /** |
| | | * @author wangjiang |
| | | * @date 2018/11/01 |
| | | * @email 952305047@qq.com |
| | | * 获取上下文 |
| | | */ |
| | | public class ContextUtil { |
| | | |
| | | public static HttpServletRequest getServletRequest() { |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | return request; |
| | | } |
| | | |
| | | public static HttpServletResponse getServletResponse() { |
| | | HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse(); |
| | | return response; |
| | | } |
| | | |
| | | public static HttpSession getSession() { |
| | | return getServletRequest().getSession(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class CountUtils { |
| | | public static boolean Count(List<Integer> list, Integer lay) { |
| | | int count = 0; |
| | | for (Integer o : list) { |
| | | if (o == lay) { |
| | | count++; |
| | | } |
| | | } |
| | | if (count == list.size()) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 获取当前月份时间 |
| | | */ |
| | | public class CurrentMonthUtils { |
| | | |
| | | /** |
| | | * 获取当前月份的1号 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getCurrentMoth() { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 获取当月第一天 |
| | | calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.MONTH, 0); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | String firstday = format.format(calendar.getTime()); |
| | | return firstday; |
| | | } |
| | | |
| | | public static String getYearAgo() { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.add(Calendar.YEAR, -1); |
| | | Date y = calendar.getTime(); |
| | | String year = format.format(y); |
| | | return year; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * Description:日期工具类 |
| | | * |
| | | * @author lihaipeng |
| | | * @create 2020-08-12 |
| | | */ |
| | | public class DateUtil { |
| | | |
| | | /** |
| | | * 仅显示年月日,例如 2015-08-11. |
| | | */ |
| | | public static final String DATE_FORMAT = "yyyy-MM-dd"; |
| | | /** |
| | | * 显示年月日时分秒,例如 2015-08-11 09:51:53. |
| | | */ |
| | | public static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; |
| | | |
| | | /** |
| | | * 仅显示时分秒,例如 09:51:53. |
| | | */ |
| | | public static final String TIME_FORMAT = "HH:mm:ss"; |
| | | |
| | | /** |
| | | * 每天的毫秒数 8640000. |
| | | */ |
| | | public static final long MILLISECONDS_PER_DAY = 86400000L; |
| | | |
| | | /** |
| | | * 每周的天数. |
| | | */ |
| | | public static final long DAYS_PER_WEEK = 7L; |
| | | |
| | | /** |
| | | * 每小时毫秒数. |
| | | */ |
| | | public static final long MILLISECONDS_PER_HOUR = 3600000L; |
| | | |
| | | /** |
| | | * 每分钟秒数. |
| | | */ |
| | | public static final long SECONDS_PER_MINUTE = 60L; |
| | | |
| | | /** |
| | | * 每小时秒数. |
| | | */ |
| | | public static final long SECONDS_PER_HOUR = 3600L; |
| | | |
| | | /** |
| | | * 每天秒数. |
| | | */ |
| | | public static final long SECONDS_PER_DAY = 86400L; |
| | | |
| | | /** |
| | | * 每个月秒数,默认每月30天. |
| | | */ |
| | | public static final long SECONDS_PER_MONTH = 2592000L; |
| | | |
| | | /** |
| | | * 每年秒数,默认每年365天. |
| | | */ |
| | | public static final long SECONDS_PER_YEAR = 31536000L; |
| | | |
| | | /** |
| | | * 常用的时间格式. |
| | | */ |
| | | public static String[] parsePatterns = {"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm"}; |
| | | |
| | | /** |
| | | * 得到当前日期字符串. |
| | | * |
| | | * @return String 日期字符串,例如2015-08-11 |
| | | * @since 1.0 |
| | | */ |
| | | public static String getDateByParseOne() { |
| | | return getDate(parsePatterns[0]); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前时间指定格式下的字符串. |
| | | * |
| | | * @param pattern 转化后时间展示的格式,例如"yyyy-MM-dd","yyyy-MM-dd HH:mm:ss"等 |
| | | * @return String 格式转换之后的时间字符串. |
| | | * @since 1.0 |
| | | */ |
| | | public static String getDate(String pattern) { |
| | | return DateFormatUtils.format(new Date(), pattern); |
| | | } |
| | | |
| | | /** |
| | | * 获取日期时间字符串 |
| | | * |
| | | * @param date 需要转化的日期时间 |
| | | * @param pattern 时间格式,例如"yyyy-MM-dd" "HH:mm:ss" "E"等 |
| | | * @return String 格式转换后的时间字符串 |
| | | * @since 1.0 |
| | | */ |
| | | public static String formatDate(Date date, String pattern) { |
| | | return DateFormatUtils.format(date, pattern); |
| | | } |
| | | |
| | | /** |
| | | * 将日期型字符串转换为日期格式. |
| | | * 支持的日期字符串格式包括"yyyy-MM-dd","yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", |
| | | * "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm" |
| | | * |
| | | * @param dataStr |
| | | * @return Date |
| | | * @since 1.0 |
| | | */ |
| | | public static Date formatDate(String dataStr, String pattern) { |
| | | if (dataStr == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | return DateUtils.parseDate(dataStr, pattern); |
| | | } catch (ParseException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将日期型字符串转换为日期格式. |
| | | * 支持的日期字符串格式包括"yyyy-MM-dd","yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", |
| | | * "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm" |
| | | * |
| | | * @param str |
| | | * @return Date |
| | | * @since 1.0 |
| | | */ |
| | | public static Date parseDate(Object str) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | return DateUtils.parseDate(str.toString(), parsePatterns); |
| | | } catch (ParseException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 计算两个日期之间相差天数. |
| | | * |
| | | * @param start 计算开始日期 |
| | | * @param end 计算结束日期 |
| | | * @return long 相隔天数 |
| | | * @since 1.0 |
| | | */ |
| | | public static long getDaysBetween(Date start, Date end) { |
| | | // 将指定日期转换为yyyy-MM-dd格式 |
| | | start = DateUtil.parseDate(DateUtil.formatDate(start, DateUtil.DATE_FORMAT)); |
| | | // 当前日期转换为yyyy-MM-dd格式 |
| | | end = DateUtil.parseDate(DateUtil.formatDate(end, DateUtil.DATE_FORMAT)); |
| | | long diff = 0; |
| | | if (null != start && null != end) { |
| | | diff = (end.getTime() - start.getTime()) / DateUtil.MILLISECONDS_PER_DAY; |
| | | } |
| | | return diff; |
| | | } |
| | | public static long getDaysBetween(String start, Date end) { |
| | | // 将指定日期转换为yyyy-MM-dd格式 |
| | | Date startDate = parseDate(start); |
| | | // 当前日期转换为yyyy-MM-dd格式 |
| | | end = DateUtil.parseDate(DateUtil.formatDate(end, DateUtil.DATE_FORMAT)); |
| | | long diff = 0; |
| | | if (null != start && null != end) { |
| | | diff = (end.getTime() - startDate.getTime()) / DateUtil.MILLISECONDS_PER_DAY; |
| | | } |
| | | return diff; |
| | | } |
| | | |
| | | /** |
| | | * 将时间戳转换为时间 |
| | | * |
| | | * @param s |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String stampToTime(String s) { |
| | | String res; |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | long lt = new Long(s); |
| | | //将时间戳转换为时间 |
| | | Date date = new Date(lt); |
| | | //将时间调整为yyyy-MM-dd HH:mm:ss时间样式 |
| | | res = simpleDateFormat.format(date); |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * 将字符串时间转换为long类型时间戳 |
| | | */ |
| | | |
| | | public static long dateToStamp(String s, String pattern) throws ParseException { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); |
| | | Date date = simpleDateFormat.parse(s); |
| | | long ts = date.getTime(); |
| | | return date.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 判断当前时间是否在指定时间5分钟内 |
| | | * |
| | | * @param isDate |
| | | * @return |
| | | */ |
| | | public static boolean judgeDate(Date isDate) { |
| | | Calendar c1 = Calendar.getInstance(); |
| | | Calendar c2 = Calendar.getInstance(); |
| | | Calendar c3 = Calendar.getInstance(); |
| | | c1.setTime(isDate);//要判断的日期 |
| | | c2.setTime(new Date());//初始日期 |
| | | c3.setTime(new Date());//也给初始日期 把分钟加五 |
| | | c3.add(Calendar.MINUTE, 5); |
| | | c2.add(Calendar.MINUTE, -5);//减去五分钟 |
| | | if (c1.after(c2) && c1.before(c3)) { |
| | | //5分钟内 |
| | | return false; |
| | | } else { |
| | | //5分钟外 |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | private static final SimpleDateFormat YYYY_MM_DD = new SimpleDateFormat("yyyy-MM-dd"); |
| | | private static final SimpleDateFormat YYYY_MM_DD_TO_CHINESE = new SimpleDateFormat("yyyy年MM月dd日"); |
| | | |
| | | /** |
| | | * 获得该月第一天 |
| | | * |
| | | * @param year |
| | | * @param month |
| | | * @return |
| | | */ |
| | | public static String getFirstDayOfMonth(int year, int month) { |
| | | Calendar cal = Calendar.getInstance(); |
| | | // 设置年份 |
| | | cal.set(Calendar.YEAR, year); |
| | | // 设置月份 |
| | | cal.set(Calendar.MONTH, month - 1); |
| | | // 获取某月最小天数 |
| | | int firstDay = cal.getActualMinimum(Calendar.DAY_OF_MONTH); |
| | | // 设置日历中月份的最小天数 |
| | | cal.set(Calendar.DAY_OF_MONTH, firstDay); |
| | | // 格式化日期 |
| | | String firstDayOfMonth = YYYY_MM_DD.format(cal.getTime()); |
| | | return firstDayOfMonth; |
| | | } |
| | | |
| | | /** |
| | | * 获得该月最后一天 |
| | | * |
| | | * @param year |
| | | * @param month |
| | | * @return |
| | | */ |
| | | public static String getLastDayOfMonth(int year, int month) { |
| | | Calendar cal = Calendar.getInstance(); |
| | | // 设置年份 |
| | | cal.set(Calendar.YEAR, year); |
| | | // 设置月份 |
| | | cal.set(Calendar.MONTH, month - 1); |
| | | // 获取某月最大天数 |
| | | int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH); |
| | | // 设置日历中月份的最大天数 |
| | | cal.set(Calendar.DAY_OF_MONTH, lastDay); |
| | | // 格式化日期 |
| | | String lastDayOfMonth = YYYY_MM_DD.format(cal.getTime()); |
| | | return lastDayOfMonth; |
| | | } |
| | | |
| | | /** |
| | | * 日期转换成字符串(yyyy-MM-dd) |
| | | * |
| | | * @param date |
| | | * @return str |
| | | */ |
| | | public static String transDateToStr(Date date) { |
| | | String str = YYYY_MM_DD.format(date); |
| | | return str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 日期转换成字符串(yyyy年MM月dd日) |
| | | * |
| | | * @param date |
| | | * @return str |
| | | */ |
| | | public static String transDateToChineseStr(Date date) { |
| | | return YYYY_MM_DD_TO_CHINESE.format(date); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 日期转换成字符串(自定义转换格式) |
| | | * |
| | | * @param date |
| | | * @return str |
| | | */ |
| | | public static String transDateToStr(String pattern, Date date) { |
| | | SimpleDateFormat format = new SimpleDateFormat(pattern); |
| | | return format.format(date); |
| | | } |
| | | |
| | | /** |
| | | * 字符串转换成日期(yyyy-MM-dd) |
| | | * |
| | | * @param str |
| | | * @return date |
| | | */ |
| | | public static Date transStrToDate(String str) { |
| | | Date date = null; |
| | | try { |
| | | date = YYYY_MM_DD.parse(str); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * 字符串转换成日期(自定义转换格式) |
| | | * |
| | | * @param pattern |
| | | * @param str |
| | | */ |
| | | public static Date transStrToDate(String pattern, String str) { |
| | | SimpleDateFormat format = new SimpleDateFormat(pattern); |
| | | Date date = null; |
| | | try { |
| | | date = format.parse(str); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * 获取某日期区间的所有日期 日期倒序 |
| | | * |
| | | * @param startDate 开始日期 |
| | | * @param endDate 结束日期 |
| | | * @param dateFormat 日期格式 |
| | | * @return 区间内所有日期 |
| | | */ |
| | | public static List<String> getPerDaysByStartAndEndDate(String startDate, String endDate, String dateFormat) { |
| | | SimpleDateFormat format = new SimpleDateFormat(dateFormat); |
| | | try { |
| | | Date sDate = format.parse(startDate); |
| | | Date eDate = format.parse(endDate); |
| | | long start = sDate.getTime(); |
| | | long end = eDate.getTime(); |
| | | if (start > end) { |
| | | return null; |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(eDate); |
| | | List<String> res = new ArrayList<String>(); |
| | | while (end >= start) { |
| | | res.add(format.format(calendar.getTime())); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -1); |
| | | end = calendar.getTimeInMillis(); |
| | | } |
| | | return res; |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 日期转星期 |
| | | * |
| | | * @param datetime |
| | | * @return |
| | | */ |
| | | public static String dateToWeek(String datetime) { |
| | | String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; |
| | | // 获得一个日历 |
| | | Calendar cal = Calendar.getInstance(); |
| | | Date datet = null; |
| | | try { |
| | | datet = YYYY_MM_DD.parse(datetime); |
| | | cal.setTime(datet); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // 指示一个星期中的某天。 |
| | | int w = cal.get(Calendar.DAY_OF_WEEK) - 1; |
| | | if (w < 0) { |
| | | w = 0; |
| | | } |
| | | return weekDays[w]; |
| | | } |
| | | |
| | | /*** |
| | | * 日期转换cron表达式 |
| | | * |
| | | * convert Date to cron ,eg. "00 07 10 15 01 ? 2016" |
| | | * |
| | | * @param date |
| | | * : 时间点 |
| | | * @return |
| | | */ |
| | | public static String getCron(Date date) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("ss mm HH dd MM ? yyyy"); |
| | | String formatTimeStr = null; |
| | | if (date != null) { |
| | | formatTimeStr = sdf.format(date); |
| | | } |
| | | return formatTimeStr; |
| | | } |
| | | |
| | | /** |
| | | * 计算两个日期相差几个月 |
| | | * |
| | | * @param date1 <String> |
| | | * @param date2 <String> |
| | | * @return int |
| | | * @throws ParseException |
| | | */ |
| | | public static int getMonthSpace(String date1, String date2) throws ParseException { |
| | | |
| | | int result = 0; |
| | | |
| | | Calendar c1 = Calendar.getInstance(); |
| | | Calendar c2 = Calendar.getInstance(); |
| | | |
| | | c1.setTime(YYYY_MM_DD.parse(date1)); |
| | | c2.setTime(YYYY_MM_DD.parse(date2)); |
| | | |
| | | result = c2.get(Calendar.MONTH) - c1.get(Calendar.MONTH); |
| | | |
| | | return result == 0 ? 1 : Math.abs(result); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 计算两个日期相差天数 |
| | | * |
| | | * @param early <Date> |
| | | * @param late <Date> |
| | | * @return |
| | | */ |
| | | public static final int daysBetween(Date early, Date late) { |
| | | Calendar calst = Calendar.getInstance(); |
| | | Calendar caled = Calendar.getInstance(); |
| | | calst.setTime(early); |
| | | caled.setTime(late); |
| | | // 设置时间为0时 |
| | | calst.set(Calendar.HOUR_OF_DAY, 0); |
| | | calst.set(Calendar.MINUTE, 0); |
| | | calst.set(Calendar.SECOND, 0); |
| | | caled.set(Calendar.HOUR_OF_DAY, 0); |
| | | caled.set(Calendar.MINUTE, 0); |
| | | caled.set(Calendar.SECOND, 0); |
| | | // 得到两个日期相差的天数 |
| | | int days = ((int) (caled.getTime().getTime() / 1000) - (int) (calst.getTime().getTime() / 1000)) / 3600 / 24; |
| | | return days; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前时间年度 |
| | | * @return |
| | | */ |
| | | public static String getNowYear(){ |
| | | return String.valueOf(Calendar.getInstance().get(Calendar.YEAR)); |
| | | } |
| | | |
| | | /** |
| | | * 计算两个日期相差多少分钟 |
| | | * |
| | | * @param early <Date> |
| | | * @param late <Date> |
| | | * @return |
| | | */ |
| | | public static final int minutesBetween(Date early, Date late){ |
| | | /*Calendar calst = Calendar.getInstance(); |
| | | Calendar caled = Calendar.getInstance(); |
| | | calst.setTime(early); |
| | | caled.setTime(late); |
| | | return (int) ((caled.getTime().getTime() - calst.getTime().getTime())/1000/60);*/ |
| | | return (daysBetween(early,late)+1)*24*60; |
| | | } |
| | | /** |
| | | * 获取当前日期,日期秒设置为0 |
| | | * @return |
| | | */ |
| | | public static Date getNewDate(){ |
| | | Date date = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 计算与当前日期相差给定天数的日期,例如:differ = 1,则返回一天后的日期;differ = -1,则返回昨天的日期 |
| | | * |
| | | * @param differ 天数 |
| | | * @return |
| | | */ |
| | | public static Date calculateDate(int differ) { |
| | | Date date = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.add(Calendar.DAY_OF_MONTH, differ); |
| | | date = calendar.getTime(); |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * 计算与给定日期相差给定天数的日期,例如:differ = 1,则返回给定日期一天后的日期;differ = -1,则返回给定日期的一天前的日期 |
| | | * |
| | | * @param differ 天数 |
| | | * @return |
| | | */ |
| | | public static Date calculateDate(Date date, int differ) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.add(Calendar.DAY_OF_MONTH, differ); |
| | | date = calendar.getTime(); |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * 日期格式化 |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static String getYearByDate(Date date) { |
| | | try { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | int year = calendar.get(Calendar.YEAR); |
| | | return year + ""; |
| | | } catch (Exception e) { |
| | | return "未知"; |
| | | } |
| | | } |
| | | /** |
| | | * 加一分钟 |
| | | */ |
| | | public static Date addMinutes(final Date date, int amount) { |
| | | return DateUtils.addMinutes(date, amount); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.lang.management.ManagementFactory; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.ZonedDateTime; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | |
| | | /** |
| | | * 时间工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class DateUtils extends org.apache.commons.lang3.time.DateUtils |
| | | { |
| | | public static String YYYY = "yyyy"; |
| | | |
| | | public static String YYYY_MM = "yyyy-MM"; |
| | | |
| | | public static String YYYY_MM_DD = "yyyy-MM-dd"; |
| | | |
| | | public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; |
| | | |
| | | public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; |
| | | |
| | | private static String[] parsePatterns = { |
| | | "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", |
| | | "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", |
| | | "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; |
| | | |
| | | /** |
| | | * 获取当前Date型日期 |
| | | * |
| | | * @return Date() 当前日期 |
| | | */ |
| | | public static Date getNowDate() |
| | | { |
| | | return new Date(); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前日期, 默认格式为yyyy-MM-dd |
| | | * |
| | | * @return String |
| | | */ |
| | | public static String getDate() |
| | | { |
| | | return dateTimeNow(YYYY_MM_DD); |
| | | } |
| | | |
| | | public static final String getTime() |
| | | { |
| | | return dateTimeNow(YYYY_MM_DD_HH_MM_SS); |
| | | } |
| | | |
| | | public static final String dateTimeNow() |
| | | { |
| | | return dateTimeNow(YYYYMMDDHHMMSS); |
| | | } |
| | | |
| | | public static final String dateTimeNow(final String format) |
| | | { |
| | | return parseDateToStr(format, new Date()); |
| | | } |
| | | |
| | | public static final String dateTime(final Date date) |
| | | { |
| | | return parseDateToStr(YYYY_MM_DD, date); |
| | | } |
| | | |
| | | public static final String parseDateToStr(final String format, final Date date) |
| | | { |
| | | return new SimpleDateFormat(format).format(date); |
| | | } |
| | | |
| | | public static final Date dateTime(final String format, final String ts) |
| | | { |
| | | try |
| | | { |
| | | return new SimpleDateFormat(format).parse(ts); |
| | | } |
| | | catch (ParseException e) |
| | | { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 日期路径 即年/月/日 如2018/08/08 |
| | | */ |
| | | public static final String datePath() |
| | | { |
| | | Date now = new Date(); |
| | | return DateFormatUtils.format(now, "yyyy/MM/dd"); |
| | | } |
| | | |
| | | /** |
| | | * 日期路径 即年/月/日 如20180808 |
| | | */ |
| | | public static final String dateTime() |
| | | { |
| | | Date now = new Date(); |
| | | return DateFormatUtils.format(now, "yyyyMMdd"); |
| | | } |
| | | |
| | | /** |
| | | * 日期型字符串转化为日期 格式 |
| | | */ |
| | | public static Date parseDate(Object str) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return null; |
| | | } |
| | | try |
| | | { |
| | | return parseDate(str.toString(), parsePatterns); |
| | | } |
| | | catch (ParseException e) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取服务器启动时间 |
| | | */ |
| | | public static Date getServerStartDate() |
| | | { |
| | | long time = ManagementFactory.getRuntimeMXBean().getStartTime(); |
| | | return new Date(time); |
| | | } |
| | | |
| | | /** |
| | | * 计算相差天数 |
| | | */ |
| | | public static int differentDaysByMillisecond(Date date1, Date date2) |
| | | { |
| | | return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); |
| | | } |
| | | |
| | | /** |
| | | * 计算两个日期之间相差的月份数 |
| | | * 月份差不满一个月时也按照一个月来计算 |
| | | * @param date1 起始日期 |
| | | * @param date2 结束日期 |
| | | * @return 相差的月份数 |
| | | */ |
| | | public static int differentMonthsByDate(Date date1, Date date2) { |
| | | Calendar cal1 = Calendar.getInstance(); |
| | | Calendar cal2 = Calendar.getInstance(); |
| | | cal1.setTime(date1); |
| | | cal2.setTime(date2); |
| | | |
| | | // 获取年份和月份的差值 |
| | | int yearDiff = cal2.get(Calendar.YEAR) - cal1.get(Calendar.YEAR); |
| | | int monthDiff = cal2.get(Calendar.MONTH) - cal1.get(Calendar.MONTH); |
| | | |
| | | // 计算总的月份差 |
| | | int totalMonths = yearDiff * 12 + monthDiff; |
| | | |
| | | // 判断天数,如果 cal2 的日期部分大于 cal1 的日期部分,则不足一个月算作一个月 |
| | | if (cal2.get(Calendar.DAY_OF_MONTH) > cal1.get(Calendar.DAY_OF_MONTH)) { |
| | | totalMonths++; |
| | | } |
| | | |
| | | return Math.abs(totalMonths); |
| | | } |
| | | /** |
| | | * 计算时间差 |
| | | * |
| | | * @param endDate 最后时间 |
| | | * @param startTime 开始时间 |
| | | * @return 时间差(天/小时/分钟) |
| | | */ |
| | | public static String timeDistance(Date endDate, Date startTime) |
| | | { |
| | | long nd = 1000 * 24 * 60 * 60; |
| | | long nh = 1000 * 60 * 60; |
| | | long nm = 1000 * 60; |
| | | // long ns = 1000; |
| | | // 获得两个时间的毫秒时间差异 |
| | | long diff = endDate.getTime() - startTime.getTime(); |
| | | // 计算差多少天 |
| | | long day = diff / nd; |
| | | // 计算差多少小时 |
| | | long hour = diff % nd / nh; |
| | | // 计算差多少分钟 |
| | | long min = diff % nd % nh / nm; |
| | | // 计算差多少秒//输出结果 |
| | | // long sec = diff % nd % nh % nm / ns; |
| | | return day + "天" + hour + "小时" + min + "分钟"; |
| | | } |
| | | |
| | | /** |
| | | * 增加 LocalDateTime ==> Date |
| | | */ |
| | | public static Date toDate(LocalDateTime temporalAccessor) |
| | | { |
| | | ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); |
| | | return Date.from(zdt.toInstant()); |
| | | } |
| | | |
| | | /** |
| | | * 增加 LocalDate ==> Date |
| | | */ |
| | | public static Date toDate(LocalDate temporalAccessor) |
| | | { |
| | | LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); |
| | | ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); |
| | | return Date.from(zdt.toInstant()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.zzg.common.constant.CacheConstants; |
| | | import com.zzg.common.core.domain.entity.system.SysDictData; |
| | | import com.zzg.common.core.redis.RedisCache; |
| | | import com.zzg.common.utils.spring.SpringUtils; |
| | | |
| | | /** |
| | | * 字典工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class DictUtils |
| | | { |
| | | /** |
| | | * 分隔符 |
| | | */ |
| | | public static final String SEPARATOR = ","; |
| | | |
| | | /** |
| | | * 设置字典缓存 |
| | | * |
| | | * @param key 参数键 |
| | | * @param dictDatas 字典数据列表 |
| | | */ |
| | | public static void setDictCache(String key, List<SysDictData> dictDatas) |
| | | { |
| | | SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas); |
| | | } |
| | | |
| | | /** |
| | | * 获取字典缓存 |
| | | * |
| | | * @param key 参数键 |
| | | * @return dictDatas 字典数据列表 |
| | | */ |
| | | public static List<SysDictData> getDictCache(String key) |
| | | { |
| | | JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); |
| | | if (StringUtils.isNotNull(arrayCache)) |
| | | { |
| | | return arrayCache.toList(SysDictData.class); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型和字典值获取字典标签 |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @param dictValue 字典值 |
| | | * @return 字典标签 |
| | | */ |
| | | public static String getDictLabel(String dictType, String dictValue) |
| | | { |
| | | return getDictLabel(dictType, dictValue, SEPARATOR); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型和字典标签获取字典值 |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @param dictLabel 字典标签 |
| | | * @return 字典值 |
| | | */ |
| | | public static String getDictValue(String dictType, String dictLabel) |
| | | { |
| | | return getDictValue(dictType, dictLabel, SEPARATOR); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型和字典值获取字典标签 |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @param dictValue 字典值 |
| | | * @param separator 分隔符 |
| | | * @return 字典标签 |
| | | */ |
| | | public static String getDictLabel(String dictType, String dictValue, String separator) |
| | | { |
| | | StringBuilder propertyString = new StringBuilder(); |
| | | List<SysDictData> datas = getDictCache(dictType); |
| | | |
| | | if (StringUtils.isNotNull(datas)) |
| | | { |
| | | if (StringUtils.containsAny(separator, dictValue)) |
| | | { |
| | | for (SysDictData dict : datas) |
| | | { |
| | | for (String value : dictValue.split(separator)) |
| | | { |
| | | if (value.equals(dict.getDictValue())) |
| | | { |
| | | propertyString.append(dict.getDictLabel()).append(separator); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (SysDictData dict : datas) |
| | | { |
| | | if (dictValue.equals(dict.getDictValue())) |
| | | { |
| | | return dict.getDictLabel(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return StringUtils.stripEnd(propertyString.toString(), separator); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型和字典标签获取字典值 |
| | | * |
| | | * @param dictType 字典类型 |
| | | * @param dictLabel 字典标签 |
| | | * @param separator 分隔符 |
| | | * @return 字典值 |
| | | */ |
| | | public static String getDictValue(String dictType, String dictLabel, String separator) |
| | | { |
| | | StringBuilder propertyString = new StringBuilder(); |
| | | List<SysDictData> datas = getDictCache(dictType); |
| | | |
| | | if (StringUtils.containsAny(separator, dictLabel) && StringUtils.isNotEmpty(datas)) |
| | | { |
| | | for (SysDictData dict : datas) |
| | | { |
| | | for (String label : dictLabel.split(separator)) |
| | | { |
| | | if (label.equals(dict.getDictLabel())) |
| | | { |
| | | propertyString.append(dict.getDictValue()).append(separator); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (SysDictData dict : datas) |
| | | { |
| | | if (dictLabel.equals(dict.getDictLabel())) |
| | | { |
| | | return dict.getDictValue(); |
| | | } |
| | | } |
| | | } |
| | | return StringUtils.stripEnd(propertyString.toString(), separator); |
| | | } |
| | | |
| | | /** |
| | | * 删除指定字典缓存 |
| | | * |
| | | * @param key 字典键 |
| | | */ |
| | | public static void removeDictCache(String key) |
| | | { |
| | | SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key)); |
| | | } |
| | | |
| | | /** |
| | | * 清空字典缓存 |
| | | */ |
| | | public static void clearDictCache() |
| | | { |
| | | Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_DICT_KEY + "*"); |
| | | SpringUtils.getBean(RedisCache.class).deleteObject(keys); |
| | | } |
| | | |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * @param configKey 参数键 |
| | | * @return 缓存键key |
| | | */ |
| | | public static String getCacheKey(String configKey) |
| | | { |
| | | return CacheConstants.SYS_DICT_KEY + configKey; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.ss.util.CellRangeAddress; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public class ExcelStyleUtils { |
| | | |
| | | /** |
| | | * 设置字体 |
| | | * |
| | | * @param font |
| | | * @param fontName |
| | | * @param fontHeightInPoints |
| | | */ |
| | | public static void setFont(Font font, String fontName, short fontHeightInPoints) { |
| | | font.setFontName(fontName); |
| | | font.setFontHeightInPoints(fontHeightInPoints); |
| | | } |
| | | |
| | | public static void setFontStyle(CellStyle style, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, FillPatternType fillPatternType) { |
| | | // 设置水平居中 |
| | | style.setAlignment(horizontalAlignment); |
| | | // 设置垂直居中 |
| | | style.setVerticalAlignment(verticalAlignment); |
| | | style.setFillPattern(fillPatternType); |
| | | } |
| | | |
| | | |
| | | public static void setBorder(CellStyle style, BorderStyle border) { |
| | | setBorder(style, border, border, border, border); |
| | | } |
| | | |
| | | /** |
| | | * 设置边框样式 |
| | | * |
| | | * @param style |
| | | * @param borderTop |
| | | * @param borderBottom |
| | | * @param borderLeft |
| | | * @param borderRight |
| | | */ |
| | | public static void setBorder(CellStyle style, BorderStyle borderTop, BorderStyle borderBottom, BorderStyle borderLeft, BorderStyle borderRight) { |
| | | style.setBorderTop(borderTop); |
| | | style.setBorderBottom(borderBottom); |
| | | style.setBorderLeft(borderLeft); |
| | | style.setBorderRight(borderRight); |
| | | } |
| | | |
| | | public static void setBorderColor(CellStyle style, short color) { |
| | | setBorderColor(style, color, color, color, color); |
| | | } |
| | | |
| | | /** |
| | | * 设置边框颜色 |
| | | * |
| | | * @param style |
| | | * @param borderTop |
| | | * @param borderBottom |
| | | * @param borderLeft |
| | | * @param borderRight |
| | | */ |
| | | public static void setBorderColor(CellStyle style, short borderTop, short borderBottom, short borderLeft, short borderRight) { |
| | | style.setTopBorderColor(borderTop); |
| | | style.setBottomBorderColor(borderBottom); |
| | | style.setLeftBorderColor(borderLeft); |
| | | style.setRightBorderColor(borderRight); |
| | | } |
| | | |
| | | /** |
| | | * 设置样式 |
| | | */ |
| | | public static void setStyle(Sheet sheet, CellRangeAddress range, CellStyle style) { |
| | | for (int row = range.getFirstRow(); row <= range.getLastRow(); row++) { |
| | | Row r = sheet.getRow(row); |
| | | if (r == null) { |
| | | r = sheet.createRow(row); |
| | | } |
| | | for (int col = range.getFirstColumn(); col <= range.getLastColumn(); col++) { |
| | | Cell cell = r.getCell(col); |
| | | if (cell == null) { |
| | | cell = r.createCell(col); |
| | | } |
| | | cell.setCellStyle(style); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import cn.afterturn.easypoi.cache.manager.POICacheManager; |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.ExcelImportUtil; |
| | | import cn.afterturn.easypoi.excel.ExcelXorHtmlUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExcelToHtmlParams; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import cn.afterturn.easypoi.excel.entity.ImportParams; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; |
| | | import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
| | | import cn.afterturn.easypoi.util.PoiMergeCellUtil; |
| | | import cn.afterturn.easypoi.word.WordExportUtil; |
| | | import cn.afterturn.easypoi.word.parse.ParseWord07; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.apache.poi.xwpf.usermodel.XWPFDocument; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.NoSuchElementException; |
| | | |
| | | /** |
| | | * Excel导入导出工具类 |
| | | */ |
| | | |
| | | public class ExcelUtils { |
| | | |
| | | /** |
| | | * excel 导出 |
| | | * |
| | | * @param list 数据列表 |
| | | * @param fileName 导出时的excel名称 |
| | | * @param response |
| | | */ |
| | | public static void exportExcel(List<Map<String, Object>> list, String fileName, HttpServletResponse response) throws IOException { |
| | | defaultExport(list, fileName, response); |
| | | } |
| | | |
| | | /** |
| | | * 默认的 excel 导出 |
| | | * |
| | | * @param list 数据列表 |
| | | * @param fileName 导出时的excel名称 |
| | | * @param response |
| | | */ |
| | | private static void defaultExport(List<Map<String, Object>> list, String fileName, HttpServletResponse response) throws IOException { |
| | | //把数据添加到excel表格中 |
| | | Workbook workbook = ExcelExportUtil.exportExcel(list, ExcelType.HSSF); |
| | | downLoadExcel(fileName, response, workbook); |
| | | } |
| | | |
| | | /** |
| | | * excel 导出 |
| | | * |
| | | * @param list 数据列表 |
| | | * @param pojoClass pojo类型 |
| | | * @param fileName 导出时的excel名称 |
| | | * @param response |
| | | * @param exportParams 导出参数(标题、sheet名称、是否创建表头,表格类型) |
| | | */ |
| | | private static void defaultExport(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams) throws IOException { |
| | | //把数据添加到excel表格中 |
| | | Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, list); |
| | | downLoadExcel(fileName, response, workbook); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 合并指定列单元格并导出(合并行) |
| | | * @Date: 2021/5/24 9:42 |
| | | * @Param templatePath: 模板路径 |
| | | * @Param map: 需要导出的数据map |
| | | * @Param fileName: 导出文件名称 |
| | | * @Param response: response |
| | | * @Param sheetMergeParamList: sheet参数集合 |
| | | * @return: void |
| | | * @Version: 1.0 |
| | | **/ |
| | | public static void exportMergeExcel(TemplateExportParams templatePath, Map<String, Object> map, String fileName, HttpServletResponse response, List<SheetMergeParam> sheetMergeParamList) throws IOException { |
| | | Workbook workbook = ExcelExportUtil.exportExcel(templatePath, map); |
| | | //合并单元格 |
| | | mergeExcel(workbook, sheetMergeParamList); |
| | | downLoadExcel(fileName, response, workbook); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 合并单元格具体执行方法 |
| | | * @Date: 2021/5/24 14:58 |
| | | * @Param workbook: 工作薄 |
| | | * @Param sheetMergeParamList: sheet集合 |
| | | * @return: void |
| | | * @Version: 1.0 |
| | | **/ |
| | | private static void mergeExcel(Workbook workbook, List<SheetMergeParam> sheetMergeParamList) { |
| | | for (SheetMergeParam sheetMergeParam : sheetMergeParamList) { |
| | | Sheet sheet = workbook.getSheetAt(sheetMergeParam.getSheetIndex()); |
| | | int lastRowNum = sheet.getLastRowNum(); |
| | | int i; |
| | | for (i = 0; i < lastRowNum; i++) { |
| | | //获取每行第一个单元格 |
| | | if (null == sheet.getRow(i) || null == sheet.getRow(i).getCell(0)) { |
| | | continue; |
| | | } |
| | | Cell cell = sheet.getRow(i).getCell(0); |
| | | if (sheetMergeParam.getIgnoreCellValues().contains(cell.getStringCellValue()) || StringUtils.isEmpty(cell.getStringCellValue())) { |
| | | continue; |
| | | } |
| | | //定义合并终止行数 |
| | | int endRowNum = 0; |
| | | for (int j = i + 1; j < lastRowNum; j++) { |
| | | Cell desColumn = sheet.getRow(i).getCell(sheetMergeParam.getDesColumnIndex()); |
| | | Cell nextDesColumn = sheet.getRow(j).getCell(sheetMergeParam.getDesColumnIndex()); |
| | | if (!desColumn.getStringCellValue().equals(nextDesColumn.getStringCellValue())) { |
| | | //值不同,终止此层循环 |
| | | break; |
| | | } |
| | | endRowNum++; |
| | | } |
| | | |
| | | //判断是否有合并项 |
| | | if (endRowNum == 0) { |
| | | continue; |
| | | } |
| | | //合并单元格操作 |
| | | for (int z = 0; z < sheetMergeParam.getMergeColumnIndexs().length; z++) { |
| | | //合并起始行,终止行,起始列,终止列 |
| | | int firstRow = i; |
| | | int lastRow = i + endRowNum; |
| | | int firstCol = sheetMergeParam.getMergeColumnIndexs()[z]; |
| | | int lastCol = sheetMergeParam.getMergeColumnIndexs()[z]; |
| | | PoiMergeCellUtil.addMergedRegion(sheet, firstRow, lastRow, firstCol, lastCol); |
| | | } |
| | | |
| | | //合并后行号下移 |
| | | i = i + endRowNum; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * excel 导出 |
| | | * |
| | | * @param list 数据列表 |
| | | * @param pojoClass pojo类型 |
| | | * @param fileName 导出时的excel名称 |
| | | * @param exportParams 导出参数(标题、sheet名称、是否创建表头,表格类型) |
| | | * @param response |
| | | */ |
| | | public static void exportExcel(List<?> list, Class<?> pojoClass, String fileName, ExportParams exportParams, HttpServletResponse response) throws IOException { |
| | | defaultExport(list, pojoClass, fileName, response, exportParams); |
| | | } |
| | | |
| | | /** |
| | | * excel 导出 |
| | | * |
| | | * @param list 数据列表 |
| | | * @param title 表格内数据标题 |
| | | * @param sheetName sheet名称 |
| | | * @param pojoClass pojo类型 |
| | | * @param fileName 导出时的excel名称 |
| | | * @param response |
| | | */ |
| | | public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, HttpServletResponse response) throws IOException { |
| | | defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName, ExcelType.XSSF)); |
| | | } |
| | | |
| | | /** |
| | | * 根据模板生成excel后导出 |
| | | * |
| | | * @param templatePath 模板路径 |
| | | * @param map 数据集合 |
| | | * @param fileName 文件名 |
| | | * @param response |
| | | * @throws IOException |
| | | */ |
| | | public static void exportExcel(TemplateExportParams templatePath, Map<String, Object> map, String fileName, HttpServletResponse response) throws IOException { |
| | | Workbook workbook = ExcelExportUtil.exportExcel(templatePath, map); |
| | | downLoadExcel(fileName, response, workbook); |
| | | } |
| | | |
| | | /** |
| | | * excel 导出 |
| | | * |
| | | * @param list 数据列表 |
| | | * @param title 表格内数据标题 |
| | | * @param sheetName sheet名称 |
| | | * @param pojoClass pojo类型 |
| | | * @param fileName 导出时的excel名称 |
| | | * @param isCreateHeader 是否创建表头 |
| | | * @param response |
| | | */ |
| | | public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, boolean isCreateHeader, HttpServletResponse response) throws IOException { |
| | | ExportParams exportParams = new ExportParams(title, sheetName, ExcelType.XSSF); |
| | | exportParams.setCreateHeadRows(isCreateHeader); |
| | | defaultExport(list, pojoClass, fileName, response, exportParams); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * excel下载 |
| | | * |
| | | * @param fileName 下载时的文件名称 |
| | | * @param response |
| | | * @param workbook excel数据 |
| | | */ |
| | | private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException { |
| | | try { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xlsx", "UTF-8")); |
| | | workbook.write(response.getOutputStream()); |
| | | } catch (Exception e) { |
| | | throw new IOException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * word下载 |
| | | * |
| | | * @param fileName 下载时的文件名称 |
| | | * @param response |
| | | * @param doc |
| | | */ |
| | | private static void downLoadWord(String fileName, HttpServletResponse response, XWPFDocument doc) throws IOException { |
| | | try { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/msword"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".docx", "UTF-8")); |
| | | doc.write(response.getOutputStream()); |
| | | } catch (Exception e) { |
| | | throw new IOException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * excel 导入 |
| | | * |
| | | * @param file excel文件 |
| | | * @param pojoClass pojo类型 |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> List<T> importExcel(MultipartFile file, Class<T> pojoClass) throws IOException { |
| | | return importExcel(file, 1, 1, pojoClass); |
| | | } |
| | | |
| | | /** |
| | | * excel 导入 |
| | | * |
| | | * @param filePath excel文件路径 |
| | | * @param titleRows 表格内数据标题行 |
| | | * @param headerRows 表头行 |
| | | * @param pojoClass pojo类型 |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> List<T> importExcel(String filePath, Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException { |
| | | if (StringUtils.isBlank(filePath)) { |
| | | return null; |
| | | } |
| | | ImportParams params = new ImportParams(); |
| | | params.setTitleRows(titleRows); |
| | | params.setHeadRows(headerRows); |
| | | params.setNeedSave(true); |
| | | params.setSaveUrl("/excel/"); |
| | | try { |
| | | return ExcelImportUtil.importExcel(new File(filePath), pojoClass, params); |
| | | } catch (NoSuchElementException e) { |
| | | throw new IOException("模板不能为空"); |
| | | } catch (Exception e) { |
| | | throw new IOException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * excel 导入 |
| | | * |
| | | * @param file 上传的文件 |
| | | * @param titleRows 表格内数据标题行 索引从1开始 |
| | | * @param headerRows 表头行 索引从1开始 |
| | | * @param pojoClass pojo类型 |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> List<T> importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException { |
| | | if (file == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | return importExcel(file.getInputStream(), titleRows, headerRows, pojoClass); |
| | | } catch (Exception e) { |
| | | throw new IOException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * excel 导入 |
| | | * |
| | | * @param inputStream 文件输入流 |
| | | * @param titleRows 表格内数据标题行 |
| | | * @param headerRows 表头行 |
| | | * @param pojoClass pojo类型 |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> List<T> importExcel(InputStream inputStream, Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException { |
| | | if (inputStream == null) { |
| | | return null; |
| | | } |
| | | ImportParams params = new ImportParams(); |
| | | params.setTitleRows(titleRows); |
| | | params.setHeadRows(headerRows); |
| | | params.setSaveUrl("/excel/"); |
| | | params.setNeedSave(true); |
| | | try { |
| | | return ExcelImportUtil.importExcel(inputStream, pojoClass, params); |
| | | } catch (NoSuchElementException e) { |
| | | throw new IOException("excel文件不能为空"); |
| | | } catch (Exception e) { |
| | | throw new IOException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * excel转html预览 |
| | | * |
| | | * @param filePath 文件路径 |
| | | * @param response |
| | | * @throws Exception |
| | | */ |
| | | public static void excelToHtml(String filePath, HttpServletResponse response) throws Exception { |
| | | ExcelToHtmlParams params = new ExcelToHtmlParams(WorkbookFactory.create(POICacheManager.getFile(filePath)), true); |
| | | response.getOutputStream().write(ExcelXorHtmlUtil.excelToHtml(params).getBytes()); |
| | | } |
| | | |
| | | /** |
| | | * word模板导出 |
| | | * |
| | | * @param map |
| | | * @param templatePath |
| | | * @param fileName |
| | | * @param response |
| | | * @throws Exception |
| | | */ |
| | | public static void WordTemplateExport(Map<String, Object> map, String templatePath, String fileName, HttpServletResponse response) throws Exception { |
| | | XWPFDocument doc = WordExportUtil.exportWord07(templatePath, map); |
| | | downLoadWord(fileName, response, doc); |
| | | } |
| | | |
| | | /** |
| | | * word模板导出多页 |
| | | * |
| | | * @param list |
| | | * @param templatePath |
| | | * @param fileName |
| | | * @param response |
| | | * @throws Exception |
| | | */ |
| | | public static void WordTemplateExportMorePage(List<Map<String, Object>> list, String templatePath, String fileName, HttpServletResponse response) throws Exception { |
| | | XWPFDocument doc = new ParseWord07().parseWord(templatePath, list); |
| | | downLoadWord(fileName, response, doc); |
| | | } |
| | | |
| | | /** |
| | | * excel 导入,有错误信息 |
| | | * |
| | | * @param file 上传的文件 |
| | | * @param pojoClass pojo类型 |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> ExcelImportResult<T> importExcelMore(MultipartFile file, Class<T> pojoClass) throws IOException { |
| | | if (file == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | return importExcelMore(file.getInputStream(), pojoClass); |
| | | } catch (Exception e) { |
| | | throw new IOException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * excel 导入 |
| | | * |
| | | * @param inputStream 文件输入流 |
| | | * @param pojoClass pojo类型 |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | private static <T> ExcelImportResult<T> importExcelMore(InputStream inputStream, Class<T> pojoClass) throws IOException { |
| | | if (inputStream == null) { |
| | | return null; |
| | | } |
| | | ImportParams params = new ImportParams(); |
| | | params.setTitleRows(1);//表格内数据标题行 |
| | | params.setHeadRows(1);//表头行 |
| | | params.setSaveUrl("/excel/"); |
| | | params.setNeedSave(true); |
| | | params.setNeedVerify(true); |
| | | try { |
| | | return ExcelImportUtil.importExcelMore(inputStream, pojoClass, params); |
| | | } catch (NoSuchElementException e) { |
| | | throw new IOException("excel文件不能为空"); |
| | | } catch (Exception e) { |
| | | throw new IOException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param response |
| | | * @param fileName |
| | | * @param inStream |
| | | * @throws UnsupportedEncodingException |
| | | */ |
| | | public static void exportByLocal(HttpServletResponse response, String fileName, InputStream inStream) throws UnsupportedEncodingException { |
| | | String fileNameURL = URLEncoder.encode(fileName, "UTF-8"); |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + fileNameURL + ";" + "filename*=utf-8''" + fileNameURL); |
| | | response.setHeader("Content-disposition", "attachment;" + "filename*=" + fileNameURL); |
| | | if (fileName.endsWith("xls")) { |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | } else if (fileName.endsWith("xlsx")) { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | } |
| | | // 循环取出流中的数据 |
| | | byte[] b = new byte[100]; |
| | | int len; |
| | | try { |
| | | while ((len = inStream.read(b)) > 0) |
| | | response.getOutputStream().write(b, 0, len); |
| | | inStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param response |
| | | * @param path |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static HttpServletResponse exportByInstream(HttpServletResponse response, String path) throws IOException { |
| | | // path是指欲下载的文件的路径。 |
| | | File file = new File(path); |
| | | // 取得文件名。 |
| | | String filename = file.getName(); |
| | | // 取得文件的后缀名。 |
| | | String ext = filename.substring(filename.lastIndexOf(".") + 1); |
| | | // 以流的形式下载文件。 |
| | | InputStream fis = new BufferedInputStream(new FileInputStream(path)); |
| | | byte[] buffer = new byte[fis.available()]; |
| | | fis.read(buffer); |
| | | fis.close(); |
| | | // 清空response |
| | | response.reset(); |
| | | // 设置response的Header |
| | | response.addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes())); |
| | | response.addHeader("Content-Length", "" + file.length()); |
| | | OutputStream toClient = new BufferedOutputStream(response.getOutputStream()); |
| | | if (ext.equals("xls")) { |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | } else if (ext.equals("xlsx")) { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | } |
| | | toClient.write(buffer); |
| | | toClient.flush(); |
| | | toClient.close(); |
| | | |
| | | return response; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 在EXCEL(含表头)模板中插入数据 |
| | | * @param sheetName 表名 |
| | | * @param body 主体数据 |
| | | * @param response response |
| | | * @param file 模板文件 |
| | | * @param startRow 从第几行开始,excel第一行下标为0 |
| | | */ |
| | | public static void insertBodyData(String sheetName, List<List<String>> body, HttpServletResponse response, String file, int startRow) throws IOException { |
| | | File file1 = new File(file); |
| | | if (!file1.exists()){ |
| | | throw new IOException("模板文件不存在"); |
| | | } |
| | | /*FileInputStream fileS = new FileInputStream(file); |
| | | POIFSFileSystem poifsFileSystem = new POIFSFileSystem(fileS); |
| | | // HSSFWorkbook wb = new HSSFWorkbook(poifsFileSystem); |
| | | XSSFWorkbook wb = new XSSFWorkbook(fileS); |
| | | XSSFSheet hssfSheet = wb.getSheet(sheetName); |
| | | XSSFCellStyle cellStyle= wb.createCellStyle(); |
| | | cellStyle.setBorderTop(BorderStyle.THIN);//上边框-单线 |
| | | cellStyle.setBorderBottom(BorderStyle.THIN);//下边框-双线 |
| | | cellStyle.setBorderLeft(BorderStyle.THIN);//左边框-无边框 |
| | | cellStyle.setBorderRight(BorderStyle.THIN);//右边框-虚线 |
| | | cellStyle.setAlignment(HorizontalAlignment.CENTER);*/ |
| | | FileInputStream inputStream = new FileInputStream(file); |
| | | |
| | | Workbook workbook = null; |
| | | if(file.endsWith(".xls")) { |
| | | workbook = new HSSFWorkbook(inputStream); // 2003版Excel |
| | | } else if (file.endsWith(".xlsx")) { |
| | | workbook = new XSSFWorkbook(inputStream); // 2007版Excel |
| | | } else { |
| | | throw new IllegalArgumentException("Invalid Excel file format"); |
| | | } |
| | | CellStyle cellStyle= workbook.createCellStyle(); |
| | | cellStyle.setBorderTop(BorderStyle.THIN);//上边框-单线 |
| | | cellStyle.setBorderBottom(BorderStyle.THIN);//下边框-双线 |
| | | cellStyle.setBorderLeft(BorderStyle.THIN);//左边框-无边框 |
| | | cellStyle.setBorderRight(BorderStyle.THIN);//右边框-虚线 |
| | | cellStyle.setAlignment(HorizontalAlignment.CENTER); |
| | | Sheet hssfSheet = workbook.getSheetAt(0); |
| | | // 设置主体数据 |
| | | for (int rowNum = 0; rowNum < body.size(); rowNum++) { |
| | | int rowIndex = rowNum + startRow; |
| | | // 往excel表格创建一行,excel的行号是从0开始的 |
| | | Row hssfRow = hssfSheet.createRow(rowIndex); |
| | | List<String> data = body.get(rowNum); |
| | | for (int columnNum = 0; columnNum < data.size(); columnNum++) { |
| | | // 创建单元格 |
| | | Cell hssfCell = hssfRow.createCell(columnNum); |
| | | hssfCell.setCellStyle(cellStyle); |
| | | // 设置单元格的值 |
| | | hssfCell.setCellValue(data.size() < columnNum ? "-" : data.get(columnNum)); |
| | | } |
| | | } |
| | | try { |
| | | // response.setContentType("application/octet-stream"); |
| | | // response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(sheetName, "UTF-8")); |
| | | |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(sheetName + ".xlsx", "UTF-8")); |
| | | workbook.write(response.getOutputStream()); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | try { |
| | | // poifsFileSystem.close(); |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.io.StringWriter; |
| | | import org.apache.commons.lang3.exception.ExceptionUtils; |
| | | |
| | | /** |
| | | * 错误信息处理类。 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class ExceptionUtil |
| | | { |
| | | /** |
| | | * 获取exception的详细错误信息。 |
| | | */ |
| | | public static String getExceptionMessage(Throwable e) |
| | | { |
| | | StringWriter sw = new StringWriter(); |
| | | e.printStackTrace(new PrintWriter(sw, true)); |
| | | return sw.toString(); |
| | | } |
| | | |
| | | public static String getRootErrorMessage(Exception e) |
| | | { |
| | | Throwable root = ExceptionUtils.getRootCause(e); |
| | | root = (root == null ? e : root); |
| | | if (root == null) |
| | | { |
| | | return ""; |
| | | } |
| | | String msg = root.getMessage(); |
| | | if (msg == null) |
| | | { |
| | | return "null"; |
| | | } |
| | | return StringUtils.defaultString(msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import com.zzg.common.utils.enums.FileHeadEnum; |
| | | import org.apache.commons.io.FileUtils; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import java.util.zip.ZipEntry; |
| | | import java.util.zip.ZipOutputStream; |
| | | |
| | | /** |
| | | * Description: 文件处理工具类 |
| | | * |
| | | * @author wangjiang |
| | | * @date 2018/11/12 |
| | | */ |
| | | public class FileUtil { |
| | | |
| | | private FileUtil() { |
| | | throw new IllegalStateException("Utility class"); |
| | | } |
| | | |
| | | private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(FileUtil.class); |
| | | |
| | | /** |
| | | * 后缀名与文件名的分隔符 |
| | | */ |
| | | public static final String FILE_PUF = "."; |
| | | |
| | | public static final long KB = 1024L; |
| | | |
| | | /** |
| | | * 文件大小单位转换 |
| | | * |
| | | * @param size |
| | | * @return |
| | | */ |
| | | public static String getSize(long size) { |
| | | if (size >= KB * KB * KB) { |
| | | return size / KB * KB * KB + " GB"; |
| | | } else if (size >= KB * KB) { |
| | | return size / KB * KB + " MB"; |
| | | } else if (size >= KB) { |
| | | return size / KB + " KB"; |
| | | } else { |
| | | return size + " B"; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将 MultipartFile 转换为 File |
| | | * |
| | | * @param multipartFile 要转换的 MultipartFile 对象 |
| | | * @return 转换后的 File 对象 |
| | | * @throws IOException 如果文件处理过程中出现错误 |
| | | */ |
| | | public static File convertToFile(MultipartFile multipartFile) throws IOException { |
| | | // 创建临时文件 |
| | | File file = File.createTempFile("temp", multipartFile.getOriginalFilename()); |
| | | |
| | | try (FileOutputStream fos = new FileOutputStream(file)) { |
| | | // 将 MultipartFile 的内容写入到 File 中 |
| | | fos.write(multipartFile.getBytes()); |
| | | } |
| | | |
| | | // 返回 File 对象 |
| | | return file; |
| | | } |
| | | |
| | | /** |
| | | * 获取文件后缀名 |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static String getSuffix(String fileName) { |
| | | return fileName.substring(fileName.lastIndexOf(FILE_PUF) + 1); |
| | | } |
| | | |
| | | /** |
| | | * 去掉文件后缀名 |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public static String removeSuffix(String fileName) { |
| | | return fileName.substring(0, fileName.lastIndexOf(FILE_PUF)); |
| | | } |
| | | |
| | | /** |
| | | * 保存文件 |
| | | * |
| | | * @param inputStream 输入流 |
| | | * @param pathName 要保存的文件名 |
| | | * @see #saveFile(InputStream, File) |
| | | */ |
| | | public static void saveFile(InputStream inputStream, String pathName) { |
| | | saveFile(inputStream, new File(pathName)); |
| | | } |
| | | |
| | | /** |
| | | * 保存文件 |
| | | * |
| | | * @param inputStream 输入流 |
| | | * @param file 要保存的文件 |
| | | */ |
| | | public static void saveFile(InputStream inputStream, File file) { |
| | | try { |
| | | FileUtils.copyInputStreamToFile(inputStream, file); |
| | | } catch (IOException e) { |
| | | log.error("保存文件失败", e); |
| | | throw new RuntimeException("文件保存失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param file 要输出的文件 |
| | | * @param fileName 下载时的文件名 |
| | | * @see #outFile(InputStream, String, String) |
| | | */ |
| | | public static void outFile(File file, String fileName) { |
| | | try (InputStream inputStream = FileUtils.openInputStream(file)) { |
| | | outFile(inputStream, fileName, String.valueOf(file.length())); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("打开服务器文件失败" + e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 实现文件下载 |
| | | * |
| | | * @param input 输入流 |
| | | * @param fileName 文件名 |
| | | * @see #setOutFileHeader(HttpServletResponse, String, String) |
| | | */ |
| | | public static void outFile(InputStream input, String fileName, String length) throws IOException { |
| | | try { |
| | | HttpServletResponse response = ContextUtil.getServletResponse(); |
| | | setOutFileHeader(response, fileName, length); |
| | | OutputStream output = response.getOutputStream(); |
| | | IOUtils.copyLarge(input, output); |
| | | output.close(); |
| | | input.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("文件输出失败", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 拷贝文件到指定目录 |
| | | * |
| | | * @param fileNames |
| | | * @param destDir |
| | | * @throws IOException |
| | | */ |
| | | public static void synFiles(List<String> fileNames, String destDir) throws IOException { |
| | | List<File> files = fileNames.stream().map(File::new).collect(Collectors.toList()); |
| | | File destFile = new File(destDir); |
| | | if (!destFile.exists()) { |
| | | boolean bool = destFile.mkdirs(); |
| | | if (!destFile.isDirectory() || !bool) { |
| | | throw new IllegalAccessError("目录:" + destDir + "创建失败"); |
| | | } |
| | | } |
| | | FileUtils.copyToDirectory(files, destFile); |
| | | } |
| | | |
| | | /** |
| | | * @param response 响应请求 |
| | | * @param fileName 下载的文件名字 |
| | | * @param length 下载文件的长度 |
| | | */ |
| | | public static void setOutFileHeader(HttpServletResponse response, String fileName, String length) { |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| | | try { |
| | | String encode = URLEncoder.encode(fileName, "UTF-8"); |
| | | response.addHeader("Content-Disposition", "attachment; filename=\"" + encode + "\""); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException("设置下载文件响应头失败!", e); |
| | | } |
| | | if (StringUtils.isNotBlank(length)) { |
| | | response.addHeader("Content-Length", length); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @see #copyZipOut(ZipOutputStream, InputStream, ZipEntry) |
| | | */ |
| | | public static void copyZipOut(ZipOutputStream outputStream, File... files) { |
| | | for (File file : files) { |
| | | try (InputStream inputStream = FileUtils.openInputStream(file)) { |
| | | copyZipOut(outputStream, inputStream, new ZipEntry(file.getName())); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("打开服务器文件失败" + e.getMessage(), e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将一个输入流数据 输出到压缩包里 |
| | | * |
| | | * @param outputStream 输出流 |
| | | * @param inputStream 输入流 |
| | | * @param zipEntry 压缩对象 |
| | | */ |
| | | public static void copyZipOut(ZipOutputStream outputStream, InputStream inputStream, ZipEntry zipEntry) { |
| | | try { |
| | | outputStream.putNextEntry(zipEntry); |
| | | IOUtils.copyLarge(inputStream, outputStream); |
| | | outputStream.closeEntry(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("zip压缩输出文件:" + zipEntry.getName() + "时失败", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param folder 文件夹 |
| | | * @param response |
| | | */ |
| | | public static void copyZipOut(String folder, HttpServletResponse response) { |
| | | ZipOutputStream out = null; |
| | | BufferedOutputStream bos = null; |
| | | try { |
| | | File sourceFile = new File(folder); |
| | | //将zip以流的形式输出到前台 |
| | | response.setHeader("content-type", "application/octet-stream"); |
| | | // long size = FileUtils.sizeOf(sourceFile); |
| | | // response.setHeader("Content-Length", String.valueOf(size)); |
| | | // 设置浏览器响应头对应的Content-disposition |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("档案管理.zip", "UTF-8")); |
| | | response.setCharacterEncoding("utf-8"); |
| | | //创建zip输出流 |
| | | out = new ZipOutputStream(response.getOutputStream()); |
| | | //创建缓冲输出流 |
| | | bos = new BufferedOutputStream(out); |
| | | //调用压缩函数 |
| | | compress(out, bos, sourceFile, sourceFile.getName()); |
| | | out.flush(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | IOCloseUtil.close(bos, out); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 文件压缩 |
| | | * |
| | | * @param out |
| | | * @param bos |
| | | * @param sourceFile |
| | | * @param base |
| | | */ |
| | | public static void compress(ZipOutputStream out, BufferedOutputStream bos, File sourceFile, String base) { |
| | | FileInputStream fos = null; |
| | | BufferedInputStream bis = null; |
| | | try { |
| | | //如果路径为目录(文件夹) |
| | | if (sourceFile.isDirectory()) { |
| | | //取出文件夹中的文件(或子文件夹) |
| | | File[] flist = sourceFile.listFiles(); |
| | | if (flist.length == 0) {//如果文件夹为空,则只需在目的地zip文件中写入一个目录进入点 |
| | | out.putNextEntry(new ZipEntry(base + "/")); |
| | | } else {//如果文件夹不为空,则递归调用compress,文件夹中的每一个文件(或文件夹)进行压缩 |
| | | for (int i = 0; i < flist.length; i++) { |
| | | compress(out, bos, flist[i], base + "/" + flist[i].getName()); |
| | | } |
| | | } |
| | | } else {//如果不是目录(文件夹),即为文件,则先写入目录进入点,之后将文件写入zip文件中 |
| | | out.putNextEntry(new ZipEntry(base)); |
| | | fos = new FileInputStream(sourceFile); |
| | | bis = new BufferedInputStream(fos); |
| | | int tag; |
| | | //将源文件写入到zip文件中 |
| | | while ((tag = bis.read()) != -1) { |
| | | out.write(tag); |
| | | } |
| | | bis.close(); |
| | | fos.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | IOCloseUtil.close(bis, fos); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param file 要输出的文件 |
| | | * @param fileName 下载时的文件名 |
| | | * @param token 要传输的token |
| | | * @see #outFileAndToken(InputStream, String, String, String) |
| | | */ |
| | | public static void outFileAndToken(File file, String fileName, String token) { |
| | | try (InputStream inputStream = FileUtils.openInputStream(file)) { |
| | | outFileAndToken(inputStream, fileName, String.valueOf(file.length()), token); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("打开服务器文件失败" + e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 实现文件下载 |
| | | * |
| | | * @param input 输入流 |
| | | * @param fileName 文件名 |
| | | * @param token 要传输的token |
| | | * @see #setOutFileHeader(HttpServletResponse, String, String) |
| | | */ |
| | | public static void outFileAndToken(InputStream input, String fileName, String length, String token) { |
| | | try { |
| | | HttpServletResponse response = ContextUtil.getServletResponse(); |
| | | response.addHeader("token", token); |
| | | setOutFileHeader(response, fileName, length); |
| | | OutputStream output = response.getOutputStream(); |
| | | IOUtils.copyLarge(input, output); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("文件输出失败", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 输出图片 |
| | | */ |
| | | public static void outImg(HttpServletResponse response, String path) { |
| | | FileInputStream fis = null; |
| | | response.setContentType("image/gif"); |
| | | try { |
| | | OutputStream out = response.getOutputStream(); |
| | | File file = new File(path); |
| | | fis = new FileInputStream(file); |
| | | byte[] b = new byte[fis.available()]; |
| | | fis.read(b); |
| | | out.write(b); |
| | | out.flush(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (fis != null) { |
| | | try { |
| | | fis.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 输出图片 |
| | | */ |
| | | public static void outArcgisNode(HttpServletResponse response, String path) { |
| | | FileInputStream fis = null; |
| | | try { |
| | | OutputStream out = response.getOutputStream(); |
| | | File file = new File(path); |
| | | fis = new FileInputStream(file); |
| | | byte[] b = new byte[fis.available()]; |
| | | fis.read(b); |
| | | out.write(b); |
| | | out.flush(); |
| | | } catch (Exception e) { |
| | | log.error("outArcgisNode error: {}", e.getMessage()); |
| | | } finally { |
| | | if (fis != null) { |
| | | try { |
| | | fis.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 图片转base64 |
| | | */ |
| | | public static String transformPictureToBase64Data(String LoadPath, String DataName, String fileType) { |
| | | Base64.Encoder encoder = Base64.getEncoder(); //获取Base64编码器 |
| | | byte[] ImgContainer; //数据集缓存器 |
| | | FileInputStream fileInputStream = null; //文件输入流 |
| | | try { |
| | | fileInputStream = new FileInputStream(LoadPath + DataName); //到指定路径寻找文件 |
| | | ImgContainer = new byte[fileInputStream.available()]; //设置图片字节数据缓冲区大小 |
| | | fileInputStream.read(ImgContainer); //将数据流中的图片数据读进缓冲区 |
| | | String Base64ImgData = String.format("data:image/%s;base64,%s", fileType, encoder.encodeToString(ImgContainer)); //将图片编码转换成Base64格式的数据集 |
| | | fileInputStream.close(); //关闭数据流 |
| | | return Base64ImgData; //将缓冲区数据转换成字符数据返回 |
| | | } catch (FileNotFoundException e) { |
| | | return "找不到指定文件!"; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return "null"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取文件的原始头信息 |
| | | * 判断文件后缀 |
| | | * |
| | | * @param fis |
| | | * @return true:格式无异常 false:格式异常 |
| | | */ |
| | | public static boolean CheckFileHead(FileInputStream fis) { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | try { |
| | | //大小不同,获取的文件头长度也不一样 |
| | | byte[] b = new byte[4]; |
| | | fis.read(b, 0, b.length); |
| | | if (b == null || b.length <= 0) { |
| | | return false; |
| | | } |
| | | for (int i = 0; i < b.length; i++) { |
| | | // 以十六进制(基数 16)无符号整数形式返回一个整数参数的字符串表示形式 |
| | | int v = b[i] & 0xFF; |
| | | String hv = Integer.toHexString(v); |
| | | if (hv.length() < 2) { |
| | | stringBuilder.append(0); |
| | | } |
| | | stringBuilder.append(hv); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String head = stringBuilder.toString(); |
| | | String code = FileHeadEnum.getSuffixByCode(head); |
| | | |
| | | return org.apache.commons.lang3.StringUtils.isNotEmpty(code); |
| | | } |
| | | |
| | | /** |
| | | * 获取下载路径 |
| | | * |
| | | * @param uploadDir 文件夹 |
| | | * @param fileName 文件名称 |
| | | */ |
| | | public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException { |
| | | File desc = new File(uploadDir + File.separator + fileName); |
| | | |
| | | if (!desc.getParentFile().exists()) { |
| | | desc.getParentFile().mkdirs(); |
| | | } |
| | | if (!desc.exists()) { |
| | | desc.createNewFile(); |
| | | } |
| | | return desc; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 复制文件 |
| | | * |
| | | * @param sourcePath 源文件绝对路径 |
| | | * @param targetPath 目标文件绝对路径 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static void copy(String sourcePath, String targetPath) throws Exception { |
| | | //字节输入流,用来读取文件 |
| | | FileInputStream in = new FileInputStream(new File(sourcePath)); |
| | | //字节输出流,用来写文件 |
| | | FileOutputStream out = new FileOutputStream(new File(targetPath)); |
| | | byte[] buff = new byte[512]; |
| | | int n = 0; |
| | | while ((n = in.read(buff)) != -1) { |
| | | out.write(buff, 0, n); |
| | | } |
| | | out.flush(); |
| | | in.close(); |
| | | out.close(); |
| | | System.out.println("复制完成"); |
| | | } |
| | | |
| | | /** |
| | | * 根据路径删除指定的目录或文件,无论存在与否 |
| | | * |
| | | * @param sPath 要删除的目录或文件 |
| | | * @return 删除成功返回 true,否则返回 false。 |
| | | */ |
| | | public static boolean deleteFolder(String sPath) { |
| | | boolean flag = false; |
| | | File file = new File(sPath); |
| | | // 判断目录或文件是否存在 |
| | | if (!file.exists()) { // 不存在返回 false |
| | | return flag; |
| | | } else { |
| | | // 判断是否为文件 |
| | | if (file.isFile()) { // 为文件时调用删除文件方法 |
| | | return deleteFile(sPath); |
| | | } else { // 为目录时调用删除目录方法 |
| | | return deleteDirectory(sPath); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除单个文件 |
| | | * |
| | | * @param sPath 被删除文件的文件名 |
| | | * @return 单个文件删除成功返回true,否则返回false |
| | | */ |
| | | public static boolean deleteFile(String sPath) { |
| | | boolean flag = false; |
| | | File file = new File(sPath); |
| | | // 路径为文件且不为空则进行删除 |
| | | if (file.isFile() && file.exists()) { |
| | | file.delete(); |
| | | flag = true; |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 删除目录(文件夹)以及目录下的文件 |
| | | * |
| | | * @param sPath 被删除目录的文件路径 |
| | | * @return 目录删除成功返回true,否则返回false |
| | | */ |
| | | public static boolean deleteDirectory(String sPath) { |
| | | //如果sPath不以文件分隔符结尾,自动添加文件分隔符 |
| | | if (!sPath.endsWith(File.separator)) { |
| | | sPath = sPath + File.separator; |
| | | } |
| | | File dirFile = new File(sPath); |
| | | //如果dir对应的文件不存在,或者不是一个目录,则退出 |
| | | if (!dirFile.exists() || !dirFile.isDirectory()) { |
| | | return false; |
| | | } |
| | | boolean flag = true; |
| | | //删除文件夹下的所有文件(包括子目录) |
| | | File[] files = dirFile.listFiles(); |
| | | for (int i = 0; i < files.length; i++) { |
| | | //删除子文件 |
| | | if (files[i].isFile()) { |
| | | flag = deleteFile(files[i].getAbsolutePath()); |
| | | if (!flag) break; |
| | | } //删除子目录 |
| | | else { |
| | | flag = deleteDirectory(files[i].getAbsolutePath()); |
| | | if (!flag) break; |
| | | } |
| | | } |
| | | if (!flag) return false; |
| | | //删除当前目录 |
| | | if (dirFile.delete()) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | |
| | | import java.io.Closeable; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @description: IO流关闭工具Utils |
| | | */ |
| | | public class IOCloseUtil { |
| | | |
| | | /** |
| | | * IO流关闭工具类 |
| | | */ |
| | | public static void close(Closeable... io) { |
| | | for (Closeable temp : io) { |
| | | try { |
| | | if (null != temp) |
| | | temp.close(); |
| | | } catch (IOException e) { |
| | | System.out.println("" + e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static <T extends Closeable> void closeAll(T... io) { |
| | | for (Closeable temp : io) { |
| | | try { |
| | | if (null != temp) |
| | | temp.close(); |
| | | } catch (IOException e) { |
| | | System.out.println("" + e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | public class IdCardUtils { |
| | | /** |
| | | * 验证身份证号合法性 |
| | | * |
| | | * @param idCardNumber |
| | | * @return |
| | | */ |
| | | public static boolean validateIDCardNumber(String idCardNumber) { |
| | | if (idCardNumber.trim().length() == 15) { |
| | | String regex = "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$"; |
| | | Pattern pattern = Pattern.compile(regex); |
| | | Matcher matcher = pattern.matcher(idCardNumber); |
| | | return matcher.matches(); |
| | | } else { |
| | | String regex = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}(\\d|X|x)$"; |
| | | // 匹配身份证号 |
| | | if (idCardNumber.matches(regex)) { |
| | | // 计算校验位 |
| | | char[] chars = idCardNumber.toCharArray(); |
| | | int sum = 0; |
| | | for (int i = 0; i < 17; i++) { |
| | | int num = Character.getNumericValue(chars[i]); |
| | | sum += num * Math.pow(2, 17 - i); |
| | | } |
| | | int mod = sum % 11; |
| | | char[] checkBits = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'}; |
| | | char checkBit = checkBits[mod]; |
| | | |
| | | // 检查校验位 |
| | | return checkBit == Character.toUpperCase(chars[17]); |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(validateIDCardNumber("510781501006355")); |
| | | System.out.println(validateIDCardNumber("510113700501001")); |
| | | System.out.println(validateIDCardNumber("510802199405285649")); |
| | | System.out.println(validateIDCardNumber("210113196802287424")); |
| | | System.out.println(validateIDCardNumber("510113199212205310")); |
| | | System.out.println(validateIDCardNumber("51011319950201042X")); |
| | | System.out.println(validateIDCardNumber("510113197012275049")); |
| | | System.out.println(validateIDCardNumber("510113990700032866")); |
| | | System.out.println(validateIDCardNumber("5107221973042345588")); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.Period; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class LocalDateUtils { |
| | | |
| | | /** |
| | | * 年月日格式化方式 |
| | | */ |
| | | public static String YYYY = "yyyy"; |
| | | public static String YYYYY = "yyyy年"; |
| | | |
| | | public static String YYYY_MM = "yyyy-MM"; |
| | | public static String YYYYYMMM = "yyyy年MM月"; |
| | | |
| | | public static String YYYY_MM_DD = "yyyy-MM-dd"; |
| | | public static String YYYYYMMMDDD = "yyyy年MM月dd日"; |
| | | |
| | | public static String YYYYMMDD = "yyyyMMdd"; |
| | | |
| | | /** |
| | | * 获取时间差(月份数和天数) |
| | | * |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | public static Map<String, Integer> timeDifference(LocalDate startDate, LocalDate endDate) { |
| | | // 计算两个日期之间的差值 |
| | | Period period = Period.between(startDate, endDate); |
| | | |
| | | // 获取相差的月数和天数 |
| | | int diffMonths = period.getYears() * 12 + period.getMonths(); |
| | | int diffDays = period.getDays(); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | |
| | | map.put("month", diffMonths); |
| | | map.put("day", diffDays); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 时间格式转换 |
| | | * date转string(yyyy-MM-dd) |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static String localDateToString(LocalDate date) { |
| | | return localDateToString(date, YYYY_MM_DD); |
| | | } |
| | | |
| | | public static String localDateToString(LocalDate date, String formatter) { |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(formatter); |
| | | // 使用格式化器将 LocalDate 转换为字符串 |
| | | return date.format(dateTimeFormatter); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // 假设有两个日期 |
| | | LocalDate startDate = LocalDate.of(2021, 1, 1); |
| | | LocalDate endDate = LocalDate.of(2021, 5, 1); |
| | | System.out.println(localDateToString(startDate, "yyyy年MM月")); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | /** |
| | | * 处理并记录日志文件 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class LogUtils |
| | | { |
| | | public static String getBlock(Object msg) |
| | | { |
| | | if (msg == null) |
| | | { |
| | | msg = ""; |
| | | } |
| | | return "[" + msg.toString() + "]"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class MapUtil { |
| | | |
| | | public static Map<String, Object> objectToMap(Object obj) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | // 获取对象的所有字段 |
| | | Field[] fields = obj.getClass().getDeclaredFields(); |
| | | |
| | | // 遍历每个字段,将其添加到Map中 |
| | | for (Field field : fields) { |
| | | field.setAccessible(true); |
| | | String fieldName = field.getName(); |
| | | try { |
| | | Object fieldValue = field.get(obj); |
| | | map.put(fieldName, fieldValue); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import org.springframework.context.MessageSource; |
| | | import org.springframework.context.i18n.LocaleContextHolder; |
| | | import com.zzg.common.utils.spring.SpringUtils; |
| | | |
| | | /** |
| | | * 获取i18n资源文件 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class MessageUtils |
| | | { |
| | | /** |
| | | * 根据消息键和参数 获取消息 委托给spring messageSource |
| | | * |
| | | * @param code 消息键 |
| | | * @param args 参数 |
| | | * @return 获取国际化翻译值 |
| | | */ |
| | | public static String message(String code, Object... args) |
| | | { |
| | | MessageSource messageSource = SpringUtils.getBean(MessageSource.class); |
| | | return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | public class MoneyUtil { |
| | | |
| | | /** |
| | | * 大写数字 |
| | | */ |
| | | private static final String[] NUMBERS = {"零", "壹", "贰", "叁", "肆", "伍", "陆", |
| | | "柒", "捌", "玖"}; |
| | | /** |
| | | * 整数部分的单位 |
| | | */ |
| | | private static final String[] IUNIT = {"圆", "拾", "佰", "仟", "万", "拾", "佰", |
| | | "仟", "亿", "拾", "佰", "仟", "万", "拾", "佰", "仟"}; |
| | | /** |
| | | * 小数部分的单位 |
| | | */ |
| | | private static final String[] DUNIT = {"角", "分", "厘"}; |
| | | |
| | | /** |
| | | * 得到大写金额。 |
| | | */ |
| | | public static String toChinese(String str) { |
| | | str = str.replaceAll(",", "");// 去掉"," |
| | | String integerStr;// 整数部分数字 |
| | | String decimalStr;// 小数部分数字 |
| | | |
| | | // 初始化:分离整数部分和小数部分 |
| | | if (str.indexOf(".") > 0) { |
| | | integerStr = str.substring(0, str.indexOf(".")); |
| | | decimalStr = str.substring(str.indexOf(".") + 1); |
| | | } else if (str.indexOf(".") == 0) { |
| | | integerStr = ""; |
| | | decimalStr = str.substring(1); |
| | | } else { |
| | | integerStr = str; |
| | | decimalStr = ""; |
| | | } |
| | | // integerStr去掉首0,不必去掉decimalStr的尾0(超出部分舍去) |
| | | if (!integerStr.equals("")) { |
| | | integerStr = Long.toString(Long.parseLong(integerStr)); |
| | | if (integerStr.equals("0")) { |
| | | integerStr = ""; |
| | | } |
| | | } |
| | | // overflow超出处理能力,直接返回 |
| | | if (integerStr.length() > IUNIT.length) { |
| | | System.out.println(str + ":超出处理能力"); |
| | | return str; |
| | | } |
| | | |
| | | int[] integers = toArray(integerStr);// 整数部分数字 |
| | | boolean isMust5 = isMust5(integerStr);// 设置万单位 |
| | | int[] decimals = toArray(decimalStr);// 小数部分数字 |
| | | return getChineseInteger(integers, isMust5) + getChineseDecimal(decimals); |
| | | } |
| | | |
| | | /** |
| | | * 整数部分和小数部分转换为数组,从高位至低位 |
| | | */ |
| | | private static int[] toArray(String number) { |
| | | int[] array = new int[number.length()]; |
| | | for (int i = 0; i < number.length(); i++) { |
| | | array[i] = Integer.parseInt(number.substring(i, i + 1)); |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | /** |
| | | * 得到中文金额的整数部分。 |
| | | */ |
| | | private static String getChineseInteger(int[] integers, boolean isMust5) { |
| | | StringBuffer chineseInteger = new StringBuffer(""); |
| | | int length = integers.length; |
| | | for (int i = 0; i < length; i++) { |
| | | // 0出现在关键位置:1234(万)5678(亿)9012(万)3456(元) |
| | | // 特殊情况:10(拾元、壹拾元、壹拾万元、拾万元) |
| | | String key = ""; |
| | | if (integers[i] == 0) { |
| | | if ((length - i) == 13)// 万(亿)(必填) |
| | | key = IUNIT[4]; |
| | | else if ((length - i) == 9)// 亿(必填) |
| | | key = IUNIT[8]; |
| | | else if ((length - i) == 5 && isMust5)// 万(不必填) |
| | | key = IUNIT[4]; |
| | | else if ((length - i) == 1)// 元(必填) |
| | | key = IUNIT[0]; |
| | | // 0遇非0时补零,不包含最后一位 |
| | | if ((length - i) > 1 && integers[i + 1] != 0) |
| | | key += NUMBERS[0]; |
| | | } |
| | | chineseInteger.append(integers[i] == 0 ? key |
| | | : (NUMBERS[integers[i]] + IUNIT[length - i - 1])); |
| | | } |
| | | return chineseInteger.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 得到中文金额的小数部分。 |
| | | */ |
| | | private static String getChineseDecimal(int[] decimals) { |
| | | StringBuffer chineseDecimal = new StringBuffer(""); |
| | | for (int i = 0; i < decimals.length; i++) { |
| | | // 舍去3位小数之后的 |
| | | if (i == 3) |
| | | break; |
| | | chineseDecimal.append(decimals[i] == 0 ? "" |
| | | : (NUMBERS[decimals[i]] + DUNIT[i])); |
| | | } |
| | | return chineseDecimal.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 判断第5位数字的单位"万"是否应加。 |
| | | */ |
| | | private static boolean isMust5(String integerStr) { |
| | | int length = integerStr.length(); |
| | | if (length > 4) { |
| | | String subInteger = ""; |
| | | if (length > 8) { |
| | | // 取得从低位数,第5到第8位的字串 |
| | | subInteger = integerStr.substring(length - 8, length - 4); |
| | | } else { |
| | | subInteger = integerStr.substring(0, length - 4); |
| | | } |
| | | return Integer.parseInt(subInteger) > 0; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String number = "1.23"; |
| | | System.out.println(number + " " + MoneyUtil.toChinese(number)); |
| | | number = "1234567890123456.123"; |
| | | System.out.println(number + " " + MoneyUtil.toChinese(number)); |
| | | number = "0.0798"; |
| | | System.out.println(number + " " + MoneyUtil.toChinese(number)); |
| | | number = "10,001,000.09"; |
| | | System.out.println(number + " " + MoneyUtil.toChinese(number)); |
| | | number = "01.107700"; |
| | | System.out.println(number + " " + MoneyUtil.toChinese(number)); |
| | | number = "01.107700"; |
| | | System.out.println(number + " " + MoneyUtil.toChinese(number)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import com.zzg.common.exception.GlobalException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.io.*; |
| | | |
| | | /** |
| | | * office文件转pdf工具类 |
| | | */ |
| | | public class Office2PDFUtils { |
| | | private static final Logger log = LoggerFactory.getLogger(Office2PDFUtils.class); |
| | | |
| | | |
| | | /** |
| | | * 将office文档转成pdf文件 |
| | | * |
| | | * @param sourcePath |
| | | * @param targetPath |
| | | * @throws Exception |
| | | */ |
| | | public static boolean word2pdf(String sourcePath, String targetPath) throws Exception { |
| | | if (!new File(sourcePath).exists()) { |
| | | throw new FileNotFoundException(); |
| | | } |
| | | String command = String.format("soffice --convert-to pdf:writer_pdf_Export %s --outdir %s", sourcePath, targetPath); |
| | | boolean flag = executeCommand(command); |
| | | log.info("word2pdf: convert pdf complete. flag=" + flag); |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * linux下命令方式 word转PDF |
| | | * |
| | | * @param sourcePath /root/landexp-file/temp/青白江区人民政府土地征收预公告模板.docx |
| | | * @param targetPath /root/landexp-file/temp |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static boolean convert2Pdf(String sourcePath, String targetPath) throws Exception { |
| | | if (!new File(sourcePath).exists()) { |
| | | throw new FileNotFoundException(); |
| | | } |
| | | String os = System.getProperty("os.name"); |
| | | String command; |
| | | if (os.contains("Windows")) { |
| | | // command = String.format("soffice --convert-to pdf:writer_pdf_Export %s --outdir %s", sourcePath, targetPath); |
| | | command = "cmd /c start soffice --headless --invisible --convert-to pdf:writer_pdf_Export " + sourcePath + " --outdir " + targetPath; |
| | | } else { |
| | | // command="libreoffice --headless --invisible --convert-to pdf:writer_pdf_Export " + inputFile + " --outdir " + pdfFile; |
| | | command = String.format("/opt/libreoffice7.6/program/soffice --headless --invisible --convert-to pdf %s --outdir %s", sourcePath, targetPath); |
| | | } |
| | | log.info("command:" + command); |
| | | boolean flag = executeCommand(command); |
| | | // boolean flag = execute(command); |
| | | if (!flag) { |
| | | throw new GlobalException("转换PDF失败!"); |
| | | } |
| | | log.info("word2pdf: convert pdf complete. flag=" + flag); |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 执行libreoffice的转换命令 |
| | | * |
| | | * @param command |
| | | * @return |
| | | */ |
| | | public static boolean executeCommand(String command) { |
| | | try { |
| | | long start = System.currentTimeMillis(); |
| | | Process process = Runtime.getRuntime().exec(command); |
| | | // Process process = new ProcessBuilder(command).directory(new File("C:\\Program Files\\LibreOffice\\program")).start(); |
| | | // 返回值是子线程执行完毕的返回值,返回0表示正常结束 |
| | | int exitStatus = process.waitFor(); |
| | | log.info("executeCommand: convert pdf exitStatus= " + exitStatus); |
| | | |
| | | // 销毁子进程 |
| | | process.destroy(); |
| | | long end = System.currentTimeMillis(); |
| | | log.info("executeCommand: convert pdf cost time " + (end - start) + "ms"); |
| | | return exitStatus == 0; |
| | | } catch (Exception e) { |
| | | log.error("executeCommand: runtime exec error", e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 执行DOS命令 |
| | | * |
| | | * @param command |
| | | * @return |
| | | */ |
| | | public static boolean execute(String command) { |
| | | try { |
| | | Process process = Runtime.getRuntime().exec(command, null, new File("C:\\Program Files\\LibreOffice\\program")); |
| | | |
| | | // 获取命令执行的输入流 |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); |
| | | String line; |
| | | while ((line = reader.readLine()) != null) { |
| | | System.out.println(line); |
| | | } |
| | | // 等待命令执行完成 |
| | | int exitCode = process.waitFor(); |
| | | System.out.println("命令执行完成,退出码:" + exitCode); |
| | | return exitCode == 0; |
| | | } catch (IOException | InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * linux下 word转PDF |
| | | * |
| | | * @param fromPath 初始文件的路径,例:C:\Users\...\Desktop\test\1.doc |
| | | * @param toPath 转换后的存储路径,例:C:\Users\...\Desktop\test\ |
| | | * @param name 转换后的文件保存名字 |
| | | */ |
| | | public static void convert2Pdf(String fromPath, String toPath, String name) { |
| | | /*File fromFile = new File(fromPath); |
| | | if (!fromFile.exists()) { |
| | | System.out.println("源文件不存在"); |
| | | return; |
| | | } |
| | | File toFile = new File(toPath + name + ".pdf"); |
| | | |
| | | SocketOpenOfficeConnection connection = new SocketOpenOfficeConnection("192.168.163.236", 8100); |
| | | // 注:8100是openoffice的服务端口,8101是libreoffice的服务端口 |
| | | try { |
| | | connection.connect(); |
| | | System.out.println("获取连接成功!"); |
| | | } catch (ConnectException e) { |
| | | System.out.println("获取连接失败!"); |
| | | e.printStackTrace(); |
| | | return; |
| | | } |
| | | StreamOpenOfficeDocumentConverter converter = new StreamOpenOfficeDocumentConverter(connection); |
| | | System.out.println("开始转换!"); |
| | | converter.convert(fromFile, toFile); |
| | | System.out.println("转换成功!"); |
| | | System.out.println("关闭连接!"); |
| | | connection.disconnect();*/ |
| | | } |
| | | |
| | | /** |
| | | * word转PDF方法(仅限windows) |
| | | * |
| | | * @param sourcePath |
| | | * @param targetPath |
| | | * @return |
| | | */ |
| | | /*public static boolean word2pdf2(String sourcePath, String targetPath) { |
| | | // File inputWord = new File("D:/temp/青白江区人民政府土地征收预公告模板.docx"); |
| | | // File outputFile = new File("D:/temp/pdf/temp.pdf"); |
| | | File inputWord = new File(sourcePath); |
| | | File outputFile = new File(targetPath); |
| | | try { |
| | | InputStream docxInputStream = new FileInputStream(inputWord); |
| | | OutputStream outputStream = new FileOutputStream(outputFile); |
| | | IConverter converter = LocalConverter.builder().build(); |
| | | converter.convert(docxInputStream).as(DocumentType.DOCX).to(outputStream).as(DocumentType.PDF).execute(); |
| | | outputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new GlobalException("WORD文档转换PDF失败!"); |
| | | } |
| | | return true; |
| | | }*/ |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.zzg.common.core.page.PageDomain; |
| | | import com.zzg.common.core.page.TableSupport; |
| | | import com.zzg.common.utils.sql.SqlUtil; |
| | | |
| | | /** |
| | | * 分页工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class PageUtils extends PageHelper |
| | | { |
| | | /** |
| | | * 设置请求分页数据 |
| | | */ |
| | | public static void startPage() |
| | | { |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | Integer pageNum = pageDomain.getPageNum(); |
| | | Integer pageSize = pageDomain.getPageSize(); |
| | | String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); |
| | | Boolean reasonable = pageDomain.getReasonable(); |
| | | PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); |
| | | } |
| | | |
| | | /** |
| | | * 清理分页的线程变量 |
| | | */ |
| | | public static void clearPage() |
| | | { |
| | | PageHelper.clearPage(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | public class RoundingUtil { |
| | | |
| | | /** |
| | | * 对象中所有的 Double 类型字段进行四舍五入保留两位小数。 |
| | | * @param obj 目标对象 |
| | | */ |
| | | public static void roundDoubleFields(Object obj) { |
| | | if (obj == null) { |
| | | return; |
| | | } |
| | | |
| | | Field[] fields = obj.getClass().getDeclaredFields(); |
| | | for (Field field : fields) { |
| | | field.setAccessible(true); |
| | | try { |
| | | Object value = field.get(obj); |
| | | |
| | | // 处理 Double 类型字段 |
| | | if (value instanceof Double) { |
| | | field.set(obj, round((Double) value)); |
| | | } |
| | | |
| | | // 如果是其他的自定义对象,则递归处理 |
| | | else if (isCustomObject(value)) { |
| | | roundDoubleFields(value); |
| | | } |
| | | |
| | | // 如果是 List 类型,并且其中是自定义对象,也需要递归处理 |
| | | else if (value instanceof List) { |
| | | List<?> list = (List<?>) value; |
| | | for (Object item : list) { |
| | | if (isCustomObject(item)) { |
| | | roundDoubleFields(item); |
| | | } |
| | | } |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断对象是否是自定义类,而非基本类型或库类型。 |
| | | * @param obj 被判断的对象 |
| | | * @return 是否是自定义对象 |
| | | */ |
| | | private static boolean isCustomObject(Object obj) { |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | String className = obj.getClass().getName(); |
| | | return !className.startsWith("java.") && !className.startsWith("javax.") && !className.startsWith("org.") && !className.startsWith("com.alibaba.fastjson."); |
| | | } |
| | | |
| | | /** |
| | | * 将 Double 类型进行四舍五入,保留两位小数。 |
| | | * @param value 要四舍五入的值 |
| | | * @return 处理后的值 |
| | | */ |
| | | private static Double round(Double value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | return BigDecimal.valueOf(value) |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP) |
| | | .doubleValue(); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import com.zzg.common.constant.Constants; |
| | | import com.zzg.common.constant.HttpStatus; |
| | | import com.zzg.common.core.domain.entity.system.SysRole; |
| | | import com.zzg.common.core.domain.model.LoginUser; |
| | | import com.zzg.common.exception.ServiceException; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.util.PatternMatchUtils; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 安全服务工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SecurityUtils { |
| | | |
| | | /** |
| | | * 用户ID |
| | | **/ |
| | | public static String getUserId() { |
| | | try { |
| | | return getLoginUser().getUserId(); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取部门ID |
| | | **/ |
| | | public static String getDeptId() { |
| | | try { |
| | | return getLoginUser().getDeptId(); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("获取部门ID异常", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取乡镇ID |
| | | **/ |
| | | public static String getCityId() { |
| | | try { |
| | | return getLoginUser().getCityId(); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("获取乡镇ID异常", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取用户账户 |
| | | **/ |
| | | public static String getUsername() { |
| | | try { |
| | | return getLoginUser().getUsername(); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取用户 |
| | | **/ |
| | | public static LoginUser getLoginUser() { |
| | | try { |
| | | return (LoginUser) getAuthentication().getPrincipal(); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("获取用户信息异常", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取Authentication |
| | | */ |
| | | public static Authentication getAuthentication() { |
| | | return SecurityContextHolder.getContext().getAuthentication(); |
| | | } |
| | | |
| | | /** |
| | | * 生成BCryptPasswordEncoder密码 |
| | | * |
| | | * @param password 密码 |
| | | * @return 加密字符串 |
| | | */ |
| | | public static String encryptPassword(String password) { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | return passwordEncoder.encode(password); |
| | | } |
| | | |
| | | /** |
| | | * 判断密码是否相同 |
| | | * |
| | | * @param rawPassword 真实密码 |
| | | * @param encodedPassword 加密后字符 |
| | | * @return 结果 |
| | | */ |
| | | public static boolean matchesPassword(String rawPassword, String encodedPassword) { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | return passwordEncoder.matches(rawPassword, encodedPassword); |
| | | } |
| | | |
| | | /** |
| | | * 是否为管理员 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 结果 |
| | | */ |
| | | public static boolean isAdmin(String userId) { |
| | | return userId != null && "1".equals(userId); |
| | | } |
| | | |
| | | /** |
| | | * 验证用户是否具备某权限 |
| | | * |
| | | * @param permission 权限字符串 |
| | | * @return 用户是否具备某权限 |
| | | */ |
| | | public static boolean hasPermi(String permission) { |
| | | return hasPermi(getLoginUser().getPermissions(), permission); |
| | | } |
| | | |
| | | /** |
| | | * 判断是否包含权限 |
| | | * |
| | | * @param authorities 权限列表 |
| | | * @param permission 权限字符串 |
| | | * @return 用户是否具备某权限 |
| | | */ |
| | | public static boolean hasPermi(Collection<String> authorities, String permission) { |
| | | return authorities.stream().filter(StringUtils::hasText) |
| | | .anyMatch(x -> Constants.ALL_PERMISSION.equals(x) || PatternMatchUtils.simpleMatch(x, permission)); |
| | | } |
| | | |
| | | /** |
| | | * 验证用户是否拥有某个角色 |
| | | * |
| | | * @param role 角色标识 |
| | | * @return 用户是否具备某角色 |
| | | */ |
| | | public static boolean hasRole(String role) { |
| | | List<SysRole> roleList = getLoginUser().getUser().getRoles(); |
| | | Collection<String> roles = roleList.stream().map(SysRole::getRoleKey).collect(Collectors.toSet()); |
| | | return hasRole(roles, role); |
| | | } |
| | | |
| | | /** |
| | | * 判断是否包含角色 |
| | | * |
| | | * @param roles 角色列表 |
| | | * @param role 角色 |
| | | * @return 用户是否具备某角色权限 |
| | | */ |
| | | public static boolean hasRole(Collection<String> roles, String role) { |
| | | return roles.stream().filter(StringUtils::hasText) |
| | | .anyMatch(x -> Constants.SUPER_ADMIN.equals(x) || PatternMatchUtils.simpleMatch(x, role)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import javax.servlet.ServletRequest; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.web.context.request.RequestAttributes; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | import com.zzg.common.constant.Constants; |
| | | import com.zzg.common.core.text.Convert; |
| | | |
| | | /** |
| | | * 客户端工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class ServletUtils |
| | | { |
| | | /** |
| | | * 获取String参数 |
| | | */ |
| | | public static String getParameter(String name) |
| | | { |
| | | return getRequest().getParameter(name); |
| | | } |
| | | |
| | | /** |
| | | * 获取String参数 |
| | | */ |
| | | public static String getParameter(String name, String defaultValue) |
| | | { |
| | | return Convert.toStr(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * 获取Integer参数 |
| | | */ |
| | | public static Integer getParameterToInt(String name) |
| | | { |
| | | return Convert.toInt(getRequest().getParameter(name)); |
| | | } |
| | | |
| | | /** |
| | | * 获取Integer参数 |
| | | */ |
| | | public static Integer getParameterToInt(String name, Integer defaultValue) |
| | | { |
| | | return Convert.toInt(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * 获取Boolean参数 |
| | | */ |
| | | public static Boolean getParameterToBool(String name) |
| | | { |
| | | return Convert.toBool(getRequest().getParameter(name)); |
| | | } |
| | | |
| | | /** |
| | | * 获取Boolean参数 |
| | | */ |
| | | public static Boolean getParameterToBool(String name, Boolean defaultValue) |
| | | { |
| | | return Convert.toBool(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * 获得所有请求参数 |
| | | * |
| | | * @param request 请求对象{@link ServletRequest} |
| | | * @return Map |
| | | */ |
| | | public static Map<String, String[]> getParams(ServletRequest request) |
| | | { |
| | | final Map<String, String[]> map = request.getParameterMap(); |
| | | return Collections.unmodifiableMap(map); |
| | | } |
| | | |
| | | /** |
| | | * 获得所有请求参数 |
| | | * |
| | | * @param request 请求对象{@link ServletRequest} |
| | | * @return Map |
| | | */ |
| | | public static Map<String, String> getParamMap(ServletRequest request) |
| | | { |
| | | Map<String, String> params = new HashMap<>(); |
| | | for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) |
| | | { |
| | | params.put(entry.getKey(), StringUtils.join(entry.getValue(), ",")); |
| | | } |
| | | return params; |
| | | } |
| | | |
| | | /** |
| | | * 获取request |
| | | */ |
| | | public static HttpServletRequest getRequest() |
| | | { |
| | | return getRequestAttributes().getRequest(); |
| | | } |
| | | |
| | | /** |
| | | * 获取response |
| | | */ |
| | | public static HttpServletResponse getResponse() |
| | | { |
| | | return getRequestAttributes().getResponse(); |
| | | } |
| | | |
| | | /** |
| | | * 获取session |
| | | */ |
| | | public static HttpSession getSession() |
| | | { |
| | | return getRequest().getSession(); |
| | | } |
| | | |
| | | public static ServletRequestAttributes getRequestAttributes() |
| | | { |
| | | RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); |
| | | return (ServletRequestAttributes) attributes; |
| | | } |
| | | |
| | | public static String getRequestBodyParameter(String paramName) { |
| | | RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); |
| | | ServletRequestAttributes servletAttributes = (ServletRequestAttributes) attributes; |
| | | HttpServletRequest request = servletAttributes.getRequest(); |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | try (BufferedReader reader = request.getReader()) { |
| | | String line; |
| | | while ((line = reader.readLine()) != null) { |
| | | sb.append(line); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | String requestBody = sb.toString(); |
| | | try { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | Map<String, Object> map = objectMapper.readValue(requestBody, Map.class); |
| | | return map.get(paramName) != null ? map.get(paramName).toString() : null; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 将字符串渲染到客户端 |
| | | * |
| | | * @param response 渲染对象 |
| | | * @param string 待渲染的字符串 |
| | | */ |
| | | public static void renderString(HttpServletResponse response, String string) |
| | | { |
| | | try |
| | | { |
| | | response.setStatus(200); |
| | | response.setContentType("application/json"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.getWriter().print(string); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 是否是Ajax异步请求 |
| | | * |
| | | * @param request |
| | | */ |
| | | public static boolean isAjaxRequest(HttpServletRequest request) |
| | | { |
| | | String accept = request.getHeader("accept"); |
| | | if (accept != null && accept.contains("application/json")) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | String xRequestedWith = request.getHeader("X-Requested-With"); |
| | | if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest")) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | String uri = request.getRequestURI(); |
| | | if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | String ajax = request.getParameter("__ajax"); |
| | | return StringUtils.inStringIgnoreCase(ajax, "json", "xml"); |
| | | } |
| | | |
| | | /** |
| | | * 内容编码 |
| | | * |
| | | * @param str 内容 |
| | | * @return 编码后的内容 |
| | | */ |
| | | public static String urlEncode(String str) |
| | | { |
| | | try |
| | | { |
| | | return URLEncoder.encode(str, Constants.UTF8); |
| | | } |
| | | catch (UnsupportedEncodingException e) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 内容解码 |
| | | * |
| | | * @param str 内容 |
| | | * @return 解码后的内容 |
| | | */ |
| | | public static String urlDecode(String str) |
| | | { |
| | | try |
| | | { |
| | | return URLDecoder.decode(str, Constants.UTF8); |
| | | } |
| | | catch (UnsupportedEncodingException e) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zzg.common.utils; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class SheetMergeParam implements Serializable { |
| | | /*** |
| | | * sheet下标 |
| | | */ |
| | | private int sheetIndex; |
| | | /*** |
| | | * 合并参考列列号 |
| | | */ |
| | | private int desColumnIndex; |
| | | /*** |
| | | * 合并单元格列列号数组 |
| | | */ |
| | | private int[] mergeColumnIndexs; |
| | | /*** |
| | | * 忽略行内容(如标题行,合计行等) |
| | | */ |
| | | private List<String> ignoreCellValues; |
| | | } |
land-common/src/main/java/com/zzg/common/utils/ShpUtils.java
land-common/src/main/java/com/zzg/common/utils/StatusConstant.java
land-common/src/main/java/com/zzg/common/utils/StringUtils.java
land-common/src/main/java/com/zzg/common/utils/Threads.java
land-common/src/main/java/com/zzg/common/utils/ZZGFileUtil.java
land-common/src/main/java/com/zzg/common/utils/ZipUtil.java
land-common/src/main/java/com/zzg/common/utils/bean/BeanUtils.java
land-common/src/main/java/com/zzg/common/utils/bean/BeanValidators.java
land-common/src/main/java/com/zzg/common/utils/enums/CustomExceptionEnums.java
land-common/src/main/java/com/zzg/common/utils/enums/FileHeadEnum.java
land-common/src/main/java/com/zzg/common/utils/enums/FileTypeEnum.java
land-common/src/main/java/com/zzg/common/utils/file/FileTypeUtils.java
land-common/src/main/java/com/zzg/common/utils/file/FileUploadUtils.java
land-common/src/main/java/com/zzg/common/utils/file/FileUtils.java
land-common/src/main/java/com/zzg/common/utils/file/ImageUtils.java
land-common/src/main/java/com/zzg/common/utils/file/MimeTypeUtils.java
land-common/src/main/java/com/zzg/common/utils/html/EscapeUtil.java
land-common/src/main/java/com/zzg/common/utils/html/HTMLFilter.java
land-common/src/main/java/com/zzg/common/utils/http/HttpHelper.java
land-common/src/main/java/com/zzg/common/utils/http/HttpUtils.java
land-common/src/main/java/com/zzg/common/utils/ip/AddressUtils.java
land-common/src/main/java/com/zzg/common/utils/ip/IpUtils.java
land-common/src/main/java/com/zzg/common/utils/poi/ExcelHandlerAdapter.java
land-common/src/main/java/com/zzg/common/utils/poi/ExcelUtil.java
land-common/src/main/java/com/zzg/common/utils/reflect/ReflectUtils.java
land-common/src/main/java/com/zzg/common/utils/sign/Base64.java
land-common/src/main/java/com/zzg/common/utils/sign/Md5Utils.java
land-common/src/main/java/com/zzg/common/utils/spring/SpringUtils.java
land-common/src/main/java/com/zzg/common/utils/sql/SqlUtil.java
land-common/src/main/java/com/zzg/common/utils/uuid/IdUtils.java
land-common/src/main/java/com/zzg/common/utils/uuid/Seq.java
land-common/src/main/java/com/zzg/common/utils/uuid/UUID.java
land-common/src/main/java/com/zzg/common/xss/Xss.java
land-common/src/main/java/com/zzg/common/xss/XssValidator.java
land-framework/pom.xml
land-framework/src/main/java/com/zzg/framework/aspectj/DataScopeAspect.java
land-framework/src/main/java/com/zzg/framework/aspectj/DataSourceAspect.java
land-framework/src/main/java/com/zzg/framework/aspectj/LogAspect.java
land-framework/src/main/java/com/zzg/framework/aspectj/RateLimiterAspect.java
land-framework/src/main/java/com/zzg/framework/config/ApplicationConfig.java
land-framework/src/main/java/com/zzg/framework/config/CaptchaConfig.java
land-framework/src/main/java/com/zzg/framework/config/DruidConfig.java
land-framework/src/main/java/com/zzg/framework/config/FastJson2JsonRedisSerializer.java
land-framework/src/main/java/com/zzg/framework/config/FilterConfig.java
land-framework/src/main/java/com/zzg/framework/config/KaptchaTextCreator.java
land-framework/src/main/java/com/zzg/framework/config/MyBatisConfig.java
land-framework/src/main/java/com/zzg/framework/config/RedisConfig.java
land-framework/src/main/java/com/zzg/framework/config/ResourcesConfig.java
land-framework/src/main/java/com/zzg/framework/config/SecurityConfig.java
land-framework/src/main/java/com/zzg/framework/config/ServerConfig.java
land-framework/src/main/java/com/zzg/framework/config/ThreadPoolConfig.java
land-framework/src/main/java/com/zzg/framework/config/properties/DruidProperties.java
land-framework/src/main/java/com/zzg/framework/config/properties/PermitAllUrlProperties.java
land-framework/src/main/java/com/zzg/framework/datasource/DynamicDataSource.java
land-framework/src/main/java/com/zzg/framework/datasource/DynamicDataSourceContextHolder.java
land-framework/src/main/java/com/zzg/framework/interceptor/RepeatSubmitInterceptor.java
land-framework/src/main/java/com/zzg/framework/interceptor/impl/SameUrlDataInterceptor.java
land-framework/src/main/java/com/zzg/framework/manager/AsyncManager.java
land-framework/src/main/java/com/zzg/framework/manager/ShutdownManager.java
land-framework/src/main/java/com/zzg/framework/manager/factory/AsyncFactory.java
land-framework/src/main/java/com/zzg/framework/security/context/AuthenticationContextHolder.java
land-framework/src/main/java/com/zzg/framework/security/context/PermissionContextHolder.java
land-framework/src/main/java/com/zzg/framework/security/filter/JwtAuthenticationTokenFilter.java
land-framework/src/main/java/com/zzg/framework/security/handle/AuthenticationEntryPointImpl.java
land-framework/src/main/java/com/zzg/framework/security/handle/LogoutSuccessHandlerImpl.java
land-framework/src/main/java/com/zzg/framework/web/domain/Server.java
land-framework/src/main/java/com/zzg/framework/web/domain/server/Cpu.java
land-framework/src/main/java/com/zzg/framework/web/domain/server/Jvm.java
land-framework/src/main/java/com/zzg/framework/web/domain/server/Mem.java
land-framework/src/main/java/com/zzg/framework/web/domain/server/Sys.java
land-framework/src/main/java/com/zzg/framework/web/domain/server/SysFile.java
land-framework/src/main/java/com/zzg/framework/web/exception/GlobalExceptionHandler.java
land-framework/src/main/java/com/zzg/framework/web/service/PermissionService.java
land-framework/src/main/java/com/zzg/framework/web/service/SysLoginService.java
land-framework/src/main/java/com/zzg/framework/web/service/SysPasswordService.java
land-framework/src/main/java/com/zzg/framework/web/service/SysPermissionService.java
land-framework/src/main/java/com/zzg/framework/web/service/SysRegisterService.java
land-framework/src/main/java/com/zzg/framework/web/service/TokenService.java
land-framework/src/main/java/com/zzg/framework/web/service/UserDetailsServiceImpl.java
land-system/pom.xml
land-system/src/main/java/com/zzg/system/convert/StateProjectConvert.java
land-system/src/main/java/com/zzg/system/convert/easyExcel/DateConverter.java
land-system/src/main/java/com/zzg/system/convert/easyExcel/MultiDropdownWriteHandler.java
land-system/src/main/java/com/zzg/system/convert/easyExcel/NumberConverter.java
land-system/src/main/java/com/zzg/system/convert/easyExcel/StringConverter.java
land-system/src/main/java/com/zzg/system/domain/AttachFile.java
land-system/src/main/java/com/zzg/system/domain/InternalDate.java
land-system/src/main/java/com/zzg/system/domain/SysCache.java
land-system/src/main/java/com/zzg/system/domain/SysCity.java
land-system/src/main/java/com/zzg/system/domain/SysConfig.java
land-system/src/main/java/com/zzg/system/domain/SysFiles.java
land-system/src/main/java/com/zzg/system/domain/SysLayer.java
land-system/src/main/java/com/zzg/system/domain/SysLogininfor.java
land-system/src/main/java/com/zzg/system/domain/SysNotice.java
land-system/src/main/java/com/zzg/system/domain/SysOperLog.java
land-system/src/main/java/com/zzg/system/domain/SysPost.java
land-system/src/main/java/com/zzg/system/domain/SysRoleDept.java
land-system/src/main/java/com/zzg/system/domain/SysRoleMenu.java
land-system/src/main/java/com/zzg/system/domain/SysUserOnline.java
land-system/src/main/java/com/zzg/system/domain/SysUserPost.java
land-system/src/main/java/com/zzg/system/domain/SysUserRole.java
land-system/src/main/java/com/zzg/system/domain/bo/ApplyBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ApplyOwnerBO.java
land-system/src/main/java/com/zzg/system/domain/bo/AssetDetailBO.java
land-system/src/main/java/com/zzg/system/domain/bo/AttachmentBuildBO.java
land-system/src/main/java/com/zzg/system/domain/bo/AwardBO.java
land-system/src/main/java/com/zzg/system/domain/bo/CalculateCompensationBO.java
land-system/src/main/java/com/zzg/system/domain/bo/CompensationBO.java
land-system/src/main/java/com/zzg/system/domain/bo/DeployBO.java
land-system/src/main/java/com/zzg/system/domain/bo/FileBO.java
land-system/src/main/java/com/zzg/system/domain/bo/GetApplyHouseholdOwnerBO.java
land-system/src/main/java/com/zzg/system/domain/bo/GetProjectPageBO.java
land-system/src/main/java/com/zzg/system/domain/bo/HomeCompensationBO.java
land-system/src/main/java/com/zzg/system/domain/bo/HouseAgreeMoveRateBO.java
land-system/src/main/java/com/zzg/system/domain/bo/HouseQueryBO.java
land-system/src/main/java/com/zzg/system/domain/bo/HouseholdBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ImportApplyRecordBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ImportSettlementBO.java
land-system/src/main/java/com/zzg/system/domain/bo/PlacementStatisticsBO.java
land-system/src/main/java/com/zzg/system/domain/bo/PolicyCompensationBO.java
land-system/src/main/java/com/zzg/system/domain/bo/PolicySubsidyBO.java
land-system/src/main/java/com/zzg/system/domain/bo/PolicySupplementBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ProcessAgreeBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ProcessCreateBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ProcessModuleUpdateBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ProcessRefuseBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ProcessStartBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ProcessTaskListBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ProcessTemplatePageBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ProcessUpdateBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ProcessVariableBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ProjectStatisticsBO.java
land-system/src/main/java/com/zzg/system/domain/bo/RemarkBO.java
land-system/src/main/java/com/zzg/system/domain/bo/SaveRecordAndItemBO.java
land-system/src/main/java/com/zzg/system/domain/bo/ScopeCollectionBO.java
land-system/src/main/java/com/zzg/system/domain/bo/SettlementBO.java
land-system/src/main/java/com/zzg/system/domain/bo/SettlementDetailBO.java
land-system/src/main/java/com/zzg/system/domain/bo/StateAgreementBO.java
land-system/src/main/java/com/zzg/system/domain/bo/StateAgreementSaveBO.java
land-system/src/main/java/com/zzg/system/domain/bo/StateApplyRecordPageBO.java
land-system/src/main/java/com/zzg/system/domain/bo/StateApplyRecordPageInfoLevelBO.java
land-system/src/main/java/com/zzg/system/domain/bo/StateAssetBO.java
land-system/src/main/java/com/zzg/system/domain/bo/StateExecutionBO.java
land-system/src/main/java/com/zzg/system/domain/bo/StateHouseholdBO.java
land-system/src/main/java/com/zzg/system/domain/bo/StateHouseholdOwnerBO.java
land-system/src/main/java/com/zzg/system/domain/bo/StateProjectBO.java
land-system/src/main/java/com/zzg/system/domain/bo/StructureBO.java
land-system/src/main/java/com/zzg/system/domain/bo/SurveyResultRegistrationBO.java
land-system/src/main/java/com/zzg/system/domain/bo/UpdateAgreementBO.java
land-system/src/main/java/com/zzg/system/domain/bo/UpdateProjectAndAddNoticeBO.java
land-system/src/main/java/com/zzg/system/domain/bo/UploadFileBO.java
land-system/src/main/java/com/zzg/system/domain/bo/WorkFlowSubmitBO.java
land-system/src/main/java/com/zzg/system/domain/vo/AgreementDetailVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ApplyHouseholdOwnerVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ApplyOwnerVO.java
land-system/src/main/java/com/zzg/system/domain/vo/AssetGraphVO.java
land-system/src/main/java/com/zzg/system/domain/vo/AssetMoneyVO.java
land-system/src/main/java/com/zzg/system/domain/vo/CalculateCompensationVO.java
land-system/src/main/java/com/zzg/system/domain/vo/City.java
land-system/src/main/java/com/zzg/system/domain/vo/CompleteCityData.java
land-system/src/main/java/com/zzg/system/domain/vo/HouseQueryVO.java
land-system/src/main/java/com/zzg/system/domain/vo/HouseUsingTypeVO.java
land-system/src/main/java/com/zzg/system/domain/vo/HouseholdDetailPageVO.java
land-system/src/main/java/com/zzg/system/domain/vo/HouseholdDetailVO.java
land-system/src/main/java/com/zzg/system/domain/vo/HouseholdSum.java
land-system/src/main/java/com/zzg/system/domain/vo/HouseholdVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ImportSettlementTemplateCurrencyVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ImportSettlementTemplatePropertyVO.java
land-system/src/main/java/com/zzg/system/domain/vo/MetaVo.java
land-system/src/main/java/com/zzg/system/domain/vo/NotResettlementHouseholdExportVO.java
land-system/src/main/java/com/zzg/system/domain/vo/OtherCompensationBO.java
land-system/src/main/java/com/zzg/system/domain/vo/ParentCollectionFileVO.java
land-system/src/main/java/com/zzg/system/domain/vo/PlacementStatisticsVO.java
land-system/src/main/java/com/zzg/system/domain/vo/PlacementStreetAreaVO.java
land-system/src/main/java/com/zzg/system/domain/vo/PlacementStreetMoneyVO.java
land-system/src/main/java/com/zzg/system/domain/vo/PlacementStreetVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ProcessTaskListVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ProjectAnalysisSumVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ProjectDataCenterStreetVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ProjectDataCenterTypeVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ProjectExecutionSumVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ProjectImplPageVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ProjectStatusExpiredVO.java
land-system/src/main/java/com/zzg/system/domain/vo/ResettlementHouseholdExportVO.java
land-system/src/main/java/com/zzg/system/domain/vo/RouterVo.java
land-system/src/main/java/com/zzg/system/domain/vo/SettleDetailExportVO.java
land-system/src/main/java/com/zzg/system/domain/vo/SettlementDetailPageVO.java
land-system/src/main/java/com/zzg/system/domain/vo/SettlementDetailVO.java
land-system/src/main/java/com/zzg/system/domain/vo/SettlementSumVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateAgreementVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateApplyRecordPageInfoLevelVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateApplyRecordVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateAssetDetailVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateExecutionDetailExportVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateExecutionDetailVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateHouseholdExportVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateHouseholdImportVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateHouseholdOwnerVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateHouseholdVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateProjectCompensateStandardVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateProjectNoticeVO.java
land-system/src/main/java/com/zzg/system/domain/vo/StateProjectVO.java
land-system/src/main/java/com/zzg/system/domain/vo/SysLayerVo.java
land-system/src/main/java/com/zzg/system/domain/vo/TransitionPageVO.java
land-system/src/main/java/com/zzg/system/mapper/state/StateAgreementMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateApplyRecordItemMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateApplyRecordMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateAssetMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateHouseholdMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateHouseholdOwnerMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateProcessExtInstanceMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateProcessInstanceActionMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateProcessModuleMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateProcessTemplateMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateProjectCollectionFileMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateProjectCompensateStandardMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateProjectCompensationMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateProjectInfoMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateProjectMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateProjectNoticeMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateSettlementMapper.java
land-system/src/main/java/com/zzg/system/mapper/state/StateTaskCenterMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/AttachFileMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/InternalDateMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysCityMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysConfigMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysDeptMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysDictDataMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysDictTypeMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysFilesMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysLayerMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysLogininforMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysMenuMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysNoticeMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysOperLogMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysPostMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysRoleDeptMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysRoleMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysRoleMenuMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysUserMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysUserPostMapper.java
land-system/src/main/java/com/zzg/system/mapper/system/SysUserRoleMapper.java
land-system/src/main/java/com/zzg/system/service/state/StateAgreementService.java
land-system/src/main/java/com/zzg/system/service/state/StateApplyRecordItemService.java
land-system/src/main/java/com/zzg/system/service/state/StateApplyRecordService.java
land-system/src/main/java/com/zzg/system/service/state/StateAssetService.java
land-system/src/main/java/com/zzg/system/service/state/StateDateCenterService.java
land-system/src/main/java/com/zzg/system/service/state/StateHouseholdOwnerService.java
land-system/src/main/java/com/zzg/system/service/state/StateHouseholdService.java
land-system/src/main/java/com/zzg/system/service/state/StateProcessExtInstanceService.java
land-system/src/main/java/com/zzg/system/service/state/StateProcessInstanceActionService.java
land-system/src/main/java/com/zzg/system/service/state/StateProcessModuleService.java
land-system/src/main/java/com/zzg/system/service/state/StateProcessTemplateService.java
land-system/src/main/java/com/zzg/system/service/state/StateProjectCollectionFileService.java
land-system/src/main/java/com/zzg/system/service/state/StateProjectCompensateStandardService.java
land-system/src/main/java/com/zzg/system/service/state/StateProjectCompensationService.java
land-system/src/main/java/com/zzg/system/service/state/StateProjectInfoService.java
land-system/src/main/java/com/zzg/system/service/state/StateProjectNoticeService.java
land-system/src/main/java/com/zzg/system/service/state/StateProjectService.java
land-system/src/main/java/com/zzg/system/service/state/StateSettlementService.java
land-system/src/main/java/com/zzg/system/service/state/StateTaskCenterService.java
land-system/src/main/java/com/zzg/system/service/state/impl/DeptTaskService.java
land-system/src/main/java/com/zzg/system/service/state/impl/FlowListenerService.java
land-system/src/main/java/com/zzg/system/service/state/impl/ProcessActorProvider.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateAgreementServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateApplyRecordItemServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateApplyRecordServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateAssetServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateDataCenterServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateHouseholdOwnerServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateHouseholdServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateProcessExtInstanceServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateProcessInstanceActionServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateProcessModuleServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateProcessTemplateServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateProjectCollectionFileServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateProjectCompensateStandardServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateProjectCompensationServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateProjectInfoServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateProjectNoticeServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateProjectServiceImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateSettlementImpl.java
land-system/src/main/java/com/zzg/system/service/state/impl/StateTaskCenterServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/IAttachFileService.java
land-system/src/main/java/com/zzg/system/service/system/IFileService.java
land-system/src/main/java/com/zzg/system/service/system/IInternalDateService.java
land-system/src/main/java/com/zzg/system/service/system/ISysCityService.java
land-system/src/main/java/com/zzg/system/service/system/ISysConfigService.java
land-system/src/main/java/com/zzg/system/service/system/ISysDeptService.java
land-system/src/main/java/com/zzg/system/service/system/ISysDictDataService.java
land-system/src/main/java/com/zzg/system/service/system/ISysDictTypeService.java
land-system/src/main/java/com/zzg/system/service/system/ISysFilesService.java
land-system/src/main/java/com/zzg/system/service/system/ISysLayerService.java
land-system/src/main/java/com/zzg/system/service/system/ISysLogininforService.java
land-system/src/main/java/com/zzg/system/service/system/ISysMenuService.java
land-system/src/main/java/com/zzg/system/service/system/ISysNoticeService.java
land-system/src/main/java/com/zzg/system/service/system/ISysOperLogService.java
land-system/src/main/java/com/zzg/system/service/system/ISysPostService.java
land-system/src/main/java/com/zzg/system/service/system/ISysRoleService.java
land-system/src/main/java/com/zzg/system/service/system/ISysUserOnlineService.java
land-system/src/main/java/com/zzg/system/service/system/ISysUserService.java
land-system/src/main/java/com/zzg/system/service/system/impl/AttachFileServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/FileServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/InternalDateServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysCityServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysConfigServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysDeptServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysDictDataServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysDictTypeServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysFilesServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysLayerServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysLogininforServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysMenuServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysNoticeServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysOperLogServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysPostServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysRoleServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysUserOnlineServiceImpl.java
land-system/src/main/java/com/zzg/system/service/system/impl/SysUserServiceImpl.java
land-system/src/main/java/com/zzg/utils/WordUtils.java
land-system/src/main/resources/mapper/state/StateAgreementMapper.xml
land-system/src/main/resources/mapper/state/StateApplyRecordMapper.xml
land-system/src/main/resources/mapper/state/StateAssetMapper.xml
land-system/src/main/resources/mapper/state/StateHouseholdMapper.xml
land-system/src/main/resources/mapper/state/StateProcessTemplateMapper.xml
land-system/src/main/resources/mapper/state/StateProjectMapper.xml
land-system/src/main/resources/mapper/state/StateSettlementMapper.xml
land-system/src/main/resources/mapper/system/AttachFileMapper.xml
land-system/src/main/resources/mapper/system/SysConfigMapper.xml
land-system/src/main/resources/mapper/system/SysDeptMapper.xml
land-system/src/main/resources/mapper/system/SysDictDataMapper.xml
land-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
land-system/src/main/resources/mapper/system/SysFilesMapper.xml
land-system/src/main/resources/mapper/system/SysLayerMapper.xml
land-system/src/main/resources/mapper/system/SysLogininforMapper.xml
land-system/src/main/resources/mapper/system/SysMenuMapper.xml
land-system/src/main/resources/mapper/system/SysNoticeMapper.xml
land-system/src/main/resources/mapper/system/SysOperLogMapper.xml
land-system/src/main/resources/mapper/system/SysPostMapper.xml
land-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml
land-system/src/main/resources/mapper/system/SysRoleMapper.xml
land-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
land-system/src/main/resources/mapper/system/SysUserMapper.xml
land-system/src/main/resources/mapper/system/SysUserPostMapper.xml
land-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
pom.xml |