20241015登录优化前代码上传

master
李冬阳 8 months ago
commit 341ceb0e36

@ -0,0 +1,37 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Custom ###
/logs/
/gen/

@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

Binary file not shown.

@ -0,0 +1,507 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
APACHE POI SUBCOMPONENTS:
Apache POI includes subcomponents with separate copyright notices and
license terms. Your use of these subcomponents is subject to the terms
and conditions of the following licenses:
Office Open XML schemas (ooxml-schemas-1.1.jar)
The Office Open XML schema definitions used by Apache POI are
a part of the Office Open XML ECMA Specification (ECMA-376, [1]).
As defined in section 9.4 of the ECMA bylaws [2], this specification
is available to all interested parties without restriction:
9.4 All documents when approved shall be made available to
all interested parties without restriction.
Furthermore, both Microsoft and Adobe have granted patent licenses
to this work [3,4,5].
[1] http://www.ecma-international.org/publications/standards/Ecma-376.htm
[2] http://www.ecma-international.org/memento/Ecmabylaws.htm
[3] http://www.microsoft.com/interop/osp/
[4] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma%20PATENT/ECMA-376%20Edition%201%20Microsoft%20Patent%20Declaration.pdf
[5] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma%20PATENT/ga-2006-191.pdf
DOM4J library (dom4j-1.6.1.jar)
Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
Redistribution and use of this software and associated documentation
("Software"), with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain copyright
statements and notices. Redistributions must also contain a
copy of this document.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
3. The name "DOM4J" must not be used to endorse or promote
products derived from this Software without prior written
permission of MetaStuff, Ltd. For written permission,
please contact dom4j-info@metastuff.com.
4. Products derived from this Software may not be called "DOM4J"
nor may "DOM4J" appear in their names without prior written
permission of MetaStuff, Ltd. DOM4J is a registered
trademark of MetaStuff, Ltd.
5. Due credit should be given to the DOM4J Project -
http://www.dom4j.org
THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
JUnit test library (junit-3.8.1.jar)
Common Public License - v 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and
documentation distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from
and are distributed by that particular Contributor. A Contribution
'originates' from a Contributor if it was added to the Program by
such Contributor itself or anyone acting on such Contributor's behalf.
Contributions do not include additions to the Program which: (i) are
separate modules of software distributed in conjunction with the
Program under their own license agreement, and (ii) are not derivative
works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents " mean patent claims licensable by a Contributor which
are necessarily infringed by the use or sale of its Contribution alone
or when combined with the Program.
"Program" means the Contributions distributed in accordance with this
Agreement.
"Recipient" means anyone who receives the Program under this Agreement,
including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free copyright license
to reproduce, prepare derivative works of, publicly display, publicly
perform, distribute and sublicense the Contribution of such
Contributor, if any, and such derivative works, in source code and
object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free patent license under
Licensed Patents to make, use, sell, offer to sell, import and
otherwise transfer the Contribution of such Contributor, if any, in
source code and object code form. This patent license shall apply to
the combination of the Contribution and the Program if, at the time
the Contribution is added by the Contributor, such addition of the
Contribution causes such combination to be covered by the Licensed
Patents. The patent license shall not apply to any other combinations
which include the Contribution. No hardware per se is licensed
hereunder.
c) Recipient understands that although each Contributor grants the
licenses to its Contributions set forth herein, no assurances are
provided by any Contributor that the Program does not infringe the
patent or other intellectual property rights of any other entity.
Each Contributor disclaims any liability to Recipient for claims
brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the rights
and licenses granted hereunder, each Recipient hereby assumes sole
responsibility to secure any other intellectual property rights
needed, if any. For example, if a third party patent license is
required to allow Recipient to distribute the Program, it is
Recipient's responsibility to acquire that license before
distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient
copyright rights in its Contribution, if any, to grant the copyright
license set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form
under its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties
and conditions, express and implied, including warranties or
conditions of title and non-infringement, and implied warranties
or conditions of merchantability and fitness for a particular
purpose;
ii) effectively excludes on behalf of all Contributors all liability
for damages, including direct, indirect, special, incidental and
consequential damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are
offered by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such
Contributor, and informs licensees how to obtain it in a
reasonable manner on or through a medium customarily used for
software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of
the Program.
Contributors may not remove or alter any copyright notices contained
within the Program.
Each Contributor must identify itself as the originator of its
Contribution, if any, in a manner that reasonably allows subsequent
Recipients to identify the originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities
with respect to end users, business partners and the like. While this
license is intended to facilitate the commercial use of the Program,
the Contributor who includes the Program in a commercial product offering
should do so in a manner which does not create potential liability for
other Contributors. Therefore, if a Contributor includes the Program
in a commercial product offering, such Contributor ("Commercial
Contributor") hereby agrees to defend and indemnify every other
Contributor ("Indemnified Contributor") against any losses, damages
and costs (collectively "Losses") arising from claims, lawsuits and
other legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such
Commercial Contributor in connection with its distribution of the
Program in a commercial product offering. The obligations in this
section do not apply to any claims or Losses relating to any actual
or alleged intellectual property infringement. In order to qualify,
an Indemnified Contributor must: a) promptly notify the Commercial
Contributor in writing of such claim, and b) allow the Commercial
Contributor to control, and cooperate with the Commercial Contributor
in, the defense and any related settlement negotiations. The Indemnified
Contributor may participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial
product offering, Product X. That Contributor is then a Commercial
Contributor. If that Commercial Contributor then makes performance
claims, or offers warranties related to Product X, those performance
claims and warranties are such Commercial Contributor's responsibility
alone. Under this section, the Commercial Contributor would have to
defend claims against the other Contributors related to those
performance claims and warranties, and if a court requires any other
Contributor to pay any damages as a result, the Commercial Contributor
must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED
ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR
A PARTICULAR PURPOSE. Each Recipient is solely responsible for
determining the appropriateness of using and distributing the Program
and assumes all risks associated with its exercise of rights under this
Agreement, including but not limited to the risks and costs of program
errors, compliance with applicable laws, damage to or loss of data,
programs or equipment, and unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this Agreement, and without further
action by the parties hereto, such provision shall be reformed to the
minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against a Contributor with
respect to a patent applicable to software (including a cross-claim or
counterclaim in a lawsuit), then any patent licenses granted by that
Contributor to such Recipient under this Agreement shall terminate as of
the date such litigation is filed. In addition, if Recipient institutes
patent litigation against any entity (including a cross-claim or
counterclaim in a lawsuit) alleging that the Program itself (excluding
combinations of the Program with other software or hardware) infringes
such Recipient's patent(s), then such Recipient's rights granted under
Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails
to comply with any of the material terms or conditions of this Agreement
and does not cure such failure in a reasonable period of time after
becoming aware of such noncompliance. If all Recipient's rights under
this Agreement terminate, Recipient agrees to cease use and distribution
of the Program as soon as reasonably practicable. However, Recipient's
obligations under this Agreement and any licenses granted by Recipient
relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement,
but in order to avoid inconsistency the Agreement is copyrighted and may
only be modified in the following manner. The Agreement Steward reserves
the right to publish new versions (including revisions) of this Agreement
from time to time. No one other than the Agreement Steward has the right
to modify this Agreement. IBM is the initial Agreement Steward. IBM may
assign the responsibility to serve as the Agreement Steward to a suitable
separate entity. Each new version of the Agreement will be given a
distinguishing version number. The Program (including Contributions) may
always be distributed subject to the version of the Agreement under which
it was received. In addition, after a new version of the Agreement is
published, Contributor may elect to distribute the Program (including
its Contributions) under the new version. Except as expressly stated in
Sections 2(a) and 2(b) above, Recipient receives no rights or licenses
to the intellectual property of any Contributor under this Agreement,
whether expressly, by implication, estoppel or otherwise. All rights in
the Program not expressly granted under this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the
intellectual property laws of the United States of America. No party to
this Agreement will bring a legal action under this Agreement more than
one year after the cause of action arose. Each party waives its rights
to a jury trial in any resulting litigation.

@ -0,0 +1,256 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.apache.poi.39
Bundle-SymbolicName: org.apache.poi.39
Bundle-Version: 3.9
Bundle-ClassPath: poi-3.9-20121203.jar,
poi-examples-3.9-20121203.jar,
poi-excelant-3.9-20121203.jar,
poi-ooxml-3.9-20121203.jar,
poi-ooxml-schemas-3.9-20121203.jar,
poi-scratchpad-3.9-20121203.jar,
dom4j-1.6.1.jar,
xmlbeans-2.3.0.jar
Bundle-Vendor: org.apache.poi
Export-Package: org.apache.poi,
org.apache.poi.common.usermodel,
org.apache.poi.ddf,
org.apache.poi.dev,
org.apache.poi.extractor,
org.apache.poi.hdf.event,
org.apache.poi.hdf.extractor,
org.apache.poi.hdf.extractor.data,
org.apache.poi.hdf.extractor.util,
org.apache.poi.hdf.model,
org.apache.poi.hdf.model.hdftypes,
org.apache.poi.hdf.model.hdftypes.definitions,
org.apache.poi.hdf.model.util,
org.apache.poi.hdgf,
org.apache.poi.hdgf.chunks,
org.apache.poi.hdgf.dev,
org.apache.poi.hdgf.exceptions,
org.apache.poi.hdgf.extractor,
org.apache.poi.hdgf.pointers,
org.apache.poi.hdgf.streams,
org.apache.poi.hmef,
org.apache.poi.hmef.attribute,
org.apache.poi.hmef.dev,
org.apache.poi.hmef.extractor,
org.apache.poi.hpbf,
org.apache.poi.hpbf.dev,
org.apache.poi.hpbf.extractor,
org.apache.poi.hpbf.model,
org.apache.poi.hpbf.model.qcbits,
org.apache.poi.hpsf,
org.apache.poi.hpsf.examples,
org.apache.poi.hpsf.extractor,
org.apache.poi.hpsf.wellknown,
org.apache.poi.hslf,
org.apache.poi.hslf.blip,
org.apache.poi.hslf.dev,
org.apache.poi.hslf.examples,
org.apache.poi.hslf.exceptions,
org.apache.poi.hslf.extractor,
org.apache.poi.hslf.model,
org.apache.poi.hslf.model.textproperties,
org.apache.poi.hslf.record,
org.apache.poi.hslf.usermodel,
org.apache.poi.hslf.util,
org.apache.poi.hsmf,
org.apache.poi.hsmf.datatypes,
org.apache.poi.hsmf.dev,
org.apache.poi.hsmf.examples,
org.apache.poi.hsmf.exceptions,
org.apache.poi.hsmf.extractor,
org.apache.poi.hsmf.parsers,
org.apache.poi.hssf,
org.apache.poi.hssf.converter,
org.apache.poi.hssf.dev,
org.apache.poi.hssf.eventmodel,
org.apache.poi.hssf.eventusermodel,
org.apache.poi.hssf.eventusermodel.dummyrecord,
org.apache.poi.hssf.eventusermodel.examples,
org.apache.poi.hssf.extractor,
org.apache.poi.hssf.model,
org.apache.poi.hssf.record,
org.apache.poi.hssf.record.aggregates,
org.apache.poi.hssf.record.cf,
org.apache.poi.hssf.record.chart,
org.apache.poi.hssf.record.common,
org.apache.poi.hssf.record.cont,
org.apache.poi.hssf.record.crypto,
org.apache.poi.hssf.record.pivottable,
org.apache.poi.hssf.usermodel,
org.apache.poi.hssf.usermodel.examples,
org.apache.poi.hssf.util,
org.apache.poi.hssf.view,
org.apache.poi.hssf.view.brush,
org.apache.poi.hwpf,
org.apache.poi.hwpf.converter,
org.apache.poi.hwpf.dev,
org.apache.poi.hwpf.extractor,
org.apache.poi.hwpf.model,
org.apache.poi.hwpf.model.io,
org.apache.poi.hwpf.model.types,
org.apache.poi.hwpf.sprm,
org.apache.poi.hwpf.usermodel,
org.apache.poi.openxml4j.exceptions,
org.apache.poi.openxml4j.opc,
org.apache.poi.openxml4j.opc.internal,
org.apache.poi.openxml4j.opc.internal.marshallers,
org.apache.poi.openxml4j.opc.internal.signature,
org.apache.poi.openxml4j.opc.internal.unmarshallers,
org.apache.poi.openxml4j.opc.signature,
org.apache.poi.openxml4j.util,
org.apache.poi.poifs.common,
org.apache.poi.poifs.crypt,
org.apache.poi.poifs.dev,
org.apache.poi.poifs.eventfilesystem,
org.apache.poi.poifs.filesystem,
org.apache.poi.poifs.nio,
org.apache.poi.poifs.poibrowser,
org.apache.poi.poifs.property,
org.apache.poi.poifs.storage,
org.apache.poi.sl.usermodel,
org.apache.poi.ss,
org.apache.poi.ss.examples,
org.apache.poi.ss.examples.formula,
org.apache.poi.ss.examples.html,
org.apache.poi.ss.excelant,
org.apache.poi.ss.excelant.util,
org.apache.poi.ss.extractor,
org.apache.poi.ss.format,
org.apache.poi.ss.formula,
org.apache.poi.ss.formula.atp,
org.apache.poi.ss.formula.constant,
org.apache.poi.ss.formula.eval,
org.apache.poi.ss.formula.eval.forked,
org.apache.poi.ss.formula.function,
org.apache.poi.ss.formula.functions,
org.apache.poi.ss.formula.ptg,
org.apache.poi.ss.formula.udf,
org.apache.poi.ss.usermodel,
org.apache.poi.ss.usermodel.charts,
org.apache.poi.ss.util,
org.apache.poi.ss.util.cellwalk,
org.apache.poi.util,
org.apache.poi.xslf,
org.apache.poi.xslf.extractor,
org.apache.poi.xslf.model,
org.apache.poi.xslf.model.geom,
org.apache.poi.xslf.usermodel,
org.apache.poi.xslf.usermodel.tutorial,
org.apache.poi.xslf.util,
org.apache.poi.xssf.dev,
org.apache.poi.xssf.eventusermodel,
org.apache.poi.xssf.eventusermodel.examples,
org.apache.poi.xssf.extractor,
org.apache.poi.xssf.model,
org.apache.poi.xssf.streaming,
org.apache.poi.xssf.usermodel,
org.apache.poi.xssf.usermodel.charts,
org.apache.poi.xssf.usermodel.examples,
org.apache.poi.xssf.usermodel.extensions,
org.apache.poi.xssf.usermodel.helpers,
org.apache.poi.xssf.util,
org.apache.poi.xwpf.extractor,
org.apache.poi.xwpf.model,
org.apache.poi.xwpf.usermodel,
org.apache.xmlbeans,
org.apache.xmlbeans.impl.common,
org.apache.xmlbeans.impl.config,
org.apache.xmlbeans.impl.inst2xsd,
org.apache.xmlbeans.impl.inst2xsd.util,
org.apache.xmlbeans.impl.jam,
org.apache.xmlbeans.impl.jam.annotation,
org.apache.xmlbeans.impl.jam.internal,
org.apache.xmlbeans.impl.jam.internal.classrefs,
org.apache.xmlbeans.impl.jam.internal.elements,
org.apache.xmlbeans.impl.jam.internal.javadoc,
org.apache.xmlbeans.impl.jam.internal.parser,
org.apache.xmlbeans.impl.jam.internal.reflect,
org.apache.xmlbeans.impl.jam.mutable,
org.apache.xmlbeans.impl.jam.provider,
org.apache.xmlbeans.impl.jam.visitor,
org.apache.xmlbeans.impl.jam.xml,
org.apache.xmlbeans.impl.piccolo.io,
org.apache.xmlbeans.impl.piccolo.util,
org.apache.xmlbeans.impl.piccolo.xml,
org.apache.xmlbeans.impl.regex,
org.apache.xmlbeans.impl.richParser,
org.apache.xmlbeans.impl.schema,
org.apache.xmlbeans.impl.soap,
org.apache.xmlbeans.impl.store,
org.apache.xmlbeans.impl.tool,
org.apache.xmlbeans.impl.util,
org.apache.xmlbeans.impl.validator,
org.apache.xmlbeans.impl.values,
org.apache.xmlbeans.impl.xb.ltgfmt,
org.apache.xmlbeans.impl.xb.ltgfmt.impl,
org.apache.xmlbeans.impl.xb.substwsdl,
org.apache.xmlbeans.impl.xb.substwsdl.impl,
org.apache.xmlbeans.impl.xb.xmlconfig,
org.apache.xmlbeans.impl.xb.xmlconfig.impl,
org.apache.xmlbeans.impl.xb.xmlschema,
org.apache.xmlbeans.impl.xb.xmlschema.impl,
org.apache.xmlbeans.impl.xb.xsdownload,
org.apache.xmlbeans.impl.xb.xsdownload.impl,
org.apache.xmlbeans.impl.xb.xsdschema,
org.apache.xmlbeans.impl.xb.xsdschema.impl,
org.apache.xmlbeans.impl.xsd2inst,
org.apache.xmlbeans.soap,
org.apache.xmlbeans.xml.stream,
org.apache.xmlbeans.xml.stream.events,
org.apache.xmlbeans.xml.stream.utils,
org.dom4j,
org.dom4j.bean,
org.dom4j.datatype,
org.dom4j.dom,
org.dom4j.dtd,
org.dom4j.io,
org.dom4j.jaxb,
org.dom4j.rule,
org.dom4j.rule.pattern,
org.dom4j.swing,
org.dom4j.tree,
org.dom4j.util,
org.dom4j.xpath,
org.dom4j.xpp,
org.openxmlformats.schemas.drawingml.x2006.chart,
org.openxmlformats.schemas.drawingml.x2006.chart.impl,
org.openxmlformats.schemas.drawingml.x2006.main,
org.openxmlformats.schemas.drawingml.x2006.main.impl,
org.openxmlformats.schemas.drawingml.x2006.picture,
org.openxmlformats.schemas.drawingml.x2006.picture.impl,
org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing,
org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.impl,
org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing,
org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.impl,
org.openxmlformats.schemas.officeDocument.x2006.customProperties,
org.openxmlformats.schemas.officeDocument.x2006.customProperties.impl,
org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes,
org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes.impl,
org.openxmlformats.schemas.officeDocument.x2006.extendedProperties,
org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.impl,
org.openxmlformats.schemas.officeDocument.x2006.relationships,
org.openxmlformats.schemas.officeDocument.x2006.relationships.impl,
org.openxmlformats.schemas.presentationml.x2006.main,
org.openxmlformats.schemas.presentationml.x2006.main.impl,
org.openxmlformats.schemas.spreadsheetml.x2006.main,
org.openxmlformats.schemas.spreadsheetml.x2006.main.impl,
org.openxmlformats.schemas.wordprocessingml.x2006.main,
org.openxmlformats.schemas.wordprocessingml.x2006.main.impl,
org.w3c.dom,
repackage,
schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707,
schemaorg_apache_xmlbeans.system.sXMLCONFIG,
schemaorg_apache_xmlbeans.system.sXMLLANG,
schemaorg_apache_xmlbeans.system.sXMLSCHEMA,
schemaorg_apache_xmlbeans.system.sXMLTOOLS,
schemasMicrosoftComOfficeExcel,
schemasMicrosoftComOfficeExcel.impl,
schemasMicrosoftComOfficeOffice,
schemasMicrosoftComOfficeOffice.impl,
schemasMicrosoftComVml,
schemasMicrosoftComVml.impl
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

@ -0,0 +1,21 @@
Apache POI
Copyright 2009 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
This product contains the DOM4J library (http://www.dom4j.org).
Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
This product contains parts that were originally based on software from BEA.
Copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/>.
This product contains W3C XML Schema documents. Copyright 2001-2003 (c)
World Wide Web Consortium (Massachusetts Institute of Technology, European
Research Consortium for Informatics and Mathematics, Keio University)
This product contains the Piccolo XML Parser for Java
(http://piccolo.sourceforge.net/). Copyright 2002 Yuval Oren.
This product contains the chunks_parse_cmds.tbl file from the vsdump program.
Copyright (C) 2006-2007 Valek Filippov (frob@df.ru)

@ -0,0 +1,316 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /usr/local/etc/mavenrc ] ; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`\\unset -f command; \\command -v java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

@ -0,0 +1,188 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

@ -0,0 +1,390 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.connor</groupId>
<artifactId>connor_cpzc_service</artifactId>
<version>0.0.1</version>
<name>connor_cpzc_service</name>
<description>connor_cpzc_service</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>forms</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.6</version>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.0.3</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>no.tornado</groupId>
<artifactId>tornadofx-controls</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- soa 依赖-->
<dependency>
<groupId>teamcenter</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>commons-logging</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>fccclient</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>fscclient</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>httpclient</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>httpcore</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>httpmime</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>log4j</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaAdministrationStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaAiStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaAllocationsStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaBomStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaBusinessModelerStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaCadBomAlignmentStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaCadStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaCaeStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaCalendarManagementStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaChangeManagementStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaClassificationStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaClient</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaCommon</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaConfigurationStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaCoreLoose</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaCoreStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaDocumentManagementStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaImportExportStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaQueryStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaStrongModel</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaWorkflowLoose</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>TcSoaWorkflowStrong</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>xercesImpl</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
</dependency>
<dependency>
<groupId>teamcenter</groupId>
<artifactId>xml-apis</artifactId>
<version>12.3.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.66</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.s8.services.strong.bypass</groupId>
<artifactId>S8SoaBypassLoose</artifactId>
<version>11000.2.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/S8SoaBypassLoose_11000.2.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.s8.services.strong.bypass</groupId>
<artifactId>S8SoaBypassStrong</artifactId>
<version>11000.2.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/S8SoaBypassStrong_11000.2.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.s8.services.strong.bypass</groupId>
<artifactId>S8SoaBypassTypes</artifactId>
<version>11000.2.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/S8SoaBypassTypes_11000.2.0.jar</systemPath>
</dependency>
<dependency>
<groupId>poi</groupId>
<artifactId>poi</artifactId>
<version>3.9-20121203</version>
<scope>system</scope>
<systemPath>D:/TC_install/ZhengTai/chint/canshuhua8089/connor_cpzc_service/lib/org.apache.poi.39/poi-3.9-20121203.jar</systemPath>
</dependency>
<dependency>
<groupId>poi</groupId>
<artifactId>poi-examples</artifactId>
<version>3.9-20121203</version>
<scope>system</scope>
<systemPath>D:/TC_install/ZhengTai/chint/canshuhua8089/connor_cpzc_service/lib/org.apache.poi.39/poi-examples-3.9-20121203.jar</systemPath>
</dependency>
<dependency>
<groupId>poi</groupId>
<artifactId>poi-excelant</artifactId>
<version>3.9-20121203</version>
<scope>system</scope>
<systemPath>D:/TC_install/ZhengTai/chint/canshuhua8089/connor_cpzc_service/lib/org.apache.poi.39/poi-excelant-3.9-20121203.jar</systemPath>
</dependency>
<dependency>
<groupId>poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9-20121203</version>
<scope>system</scope>
<systemPath>D:/TC_install/ZhengTai/chint/canshuhua8089/connor_cpzc_service/lib/org.apache.poi.39/poi-ooxml-3.9-20121203.jar</systemPath>
</dependency>
<dependency>
<groupId>poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9-20121203</version>
<scope>system</scope>
<systemPath>D:/TC_install/ZhengTai/chint/canshuhua8089/connor_cpzc_service/lib/org.apache.poi.39/poi-ooxml-schemas-3.9-20121203.jar</systemPath>
</dependency>
<dependency>
<groupId>poi</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
<scope>system</scope>
<systemPath>D:/TC_install/ZhengTai/chint/canshuhua8089/connor_cpzc_service/lib/org.apache.poi.39/xmlbeans-2.3.0.jar</systemPath>
</dependency>
<dependency>
<groupId>poi</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<scope>system</scope>
<systemPath>D:/TC_install/ZhengTai/chint/canshuhua8089/connor_cpzc_service/lib/org.apache.poi.39/dom4j-1.6.1.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,35 @@
package com.chint.plm.modules.controller;
import com.chint.plm.tcclient.SessionContext;
import com.chint.plm.tcclient.helper.BypassHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class TestController {
private static final Logger logger = LoggerFactory.getLogger(ZtRestController.class);
public static void main(String[] args) {
String host = "http://10.128.10.203:7001/tc";
String username = "dcproxy";
String password = "dcproxy";
SessionContext session = new SessionContext(host, username, password);
BypassHelper.open();
try {
} catch (Exception e) {
logger.error("操作异常", e);
} finally {
BypassHelper.close();
session.logout();
}
}
}

@ -0,0 +1,284 @@
package com.chint.plm.modules.controller;
import com.alibaba.fastjson.JSONObject;
import com.chint.plm.tcclient.SessionContext;
import com.chint.plm.tcclient.enums.ObjectTypeEnum;
import com.chint.plm.tcclient.helper.*;
import com.connor.connor_cpzc_service.controller.DownLoadController;
import com.connor.connor_cpzc_service.info.DesignInfoBean;
import com.connor.connor_cpzc_service.info.FileInfoBean;
import com.teamcenter.services.strong.core.DataManagementService;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.client.model.Property;
import com.teamcenter.soa.client.model.strong.*;
import com.teamcenter.soa.exceptions.NotLoadedException;
import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
/**
* ZT
*
* @author Yudy
*/
@RestController
@RequestMapping(value = "/plm")
public class ZtRestController {
private static final Logger logger = LoggerFactory.getLogger(ZtRestController.class);
@Value("${tc.server}")
private String host;
@Value("${tc.user}")
private String username;
@Value("${tc.password}")
private String password;
@Autowired
private DownLoadController designController;
@GetMapping("/getAttachment")
public DesignInfoBean getAttachment(String item, String wbsno, String factoryNo, String factory, String folderNames, String objectTypes, String fileTypes) {
SessionContext session = new SessionContext(host, username, password);
BypassHelper.open();
List<FileInfoBean> fileInfoBeans = new ArrayList<>();
StringBuilder message = new StringBuilder();
try {
DataManagementService dataManagementService = ServiceHelper.getDataManagementService();
List<String> fTypes = new ArrayList<>();
if (fileTypes != null) {
fTypes = Arrays.asList(fileTypes.split(","));
}
if (StringUtils.isNotBlank(factoryNo)) {
if (StringUtils.isNotBlank(folderNames) && StringUtils.isNotBlank(objectTypes)) {
List<String> dirs = Arrays.asList(folderNames.split(","));
List<String> objTypes = Arrays.asList(objectTypes.split(","));
fileInfoBeans = getByFactoryNo(dataManagementService, factoryNo, factory, dirs, objTypes, fTypes, message);
} else {
message.append("按出厂编号查询时,文件夹目录和对象类型不能为空");
}
} else {
if (StringUtils.isNotBlank(item) && StringUtils.isNotBlank(wbsno)) {
fileInfoBeans = getByMaterialNoAdnWbsno(dataManagementService, item, wbsno, fTypes, message);
} else {
// 调用图纸接口
String result = designController.getDesign(item, wbsno, factoryNo);
if (StringUtils.isNotBlank(result)) {
try {
DesignInfoBean designInfoBean = JSONObject.parseObject(result, DesignInfoBean.class);
if (designInfoBean != null) {
fileInfoBeans = designInfoBean.getFile();
if (StringUtils.isNotBlank(designInfoBean.getDesc())) {
message.append(designInfoBean.getDesc());
}
}
} catch (Exception e) {
message.append(result);
}
} else {
message.append("出厂编号为空时物料编码和WBS号不能为空");
}
}
}
} catch (Exception e) {
logger.error("操作异常", e);
} finally {
BypassHelper.close();
session.logout();
}
// 返回数据
return new DesignInfoBean(fileInfoBeans, message.toString());
}
private List<FileInfoBean> getByFactoryNo(DataManagementService dataManagementService, String factoryNo, String factory, List<String> dirs, List<String> objTypes, List<String> types, StringBuilder message) throws Exception {
// 附件信息
List<FileInfoBean> fileInfoBeans = new ArrayList<>();
// 查询出厂编号
Map<String, String> queryCondition = new HashMap<>();
queryCondition.put("fid", factoryNo);
ModelObject[] modelObjects = QueryHelper.query("chint_query_FactoryNo", queryCondition);
if (modelObjects != null && modelObjects.length > 0) {
// 找到对象
ModelObject modelObject = modelObjects[0];
logger.debug("找到模型对象uid={} ", modelObject.getUid());
// ## 直接引用的版本对象,正好符合查找的类型
List<String> objVevTypes = new ArrayList<>();
for (String objType : objTypes) {
objVevTypes.add(objType + "Revision");
}
List<WorkspaceObject> directObjects = RevisionHelper.getItemRevisionObjects(dataManagementService, (WorkspaceObject) modelObject, objVevTypes);
// 模型版本对象
List<WorkspaceObject> revisionObjects = new ArrayList<>(directObjects);
// ## 先找到项目,再通过项目去查询
// 反向查询项目零组件 <出厂编号-项目启动-项目零组件>
List<WorkspaceObject> projectItemObjects = getProjectItemObjects(dataManagementService, (WorkspaceObject) modelObject, factory);
for (String dir : dirs) {
// 正向查询项目零组件下的模型版本对象 例如:
// 正向查询项目零组件下的图纸模型 <项目零组件-项目执行-电气图纸-图纸模型>
// 正向查询项目零组件下的文档 <项目零组件-项目执行-电气图纸-文档>
List<String> projectFolders = Arrays.asList(dir.split("/"));
List<WorkspaceObject> targetObjects = ItemHelper.getReferenceObjects(dataManagementService, projectItemObjects, projectFolders, objTypes);
revisionObjects.addAll(RevisionHelper.getItemRevisionObjects(dataManagementService, targetObjects));
}
// 规范与附件
List<ModelObject> specsAttaches = RevisionHelper.getSpecsAttaches(dataManagementService, revisionObjects);
fileInfoBeans = getFileInfoBeans(dataManagementService, specsAttaches, types);
} else {
logger.debug("使用出厂编号进行查询未找到对象");
message.append("使用出厂编号进行查询未找到对象");
}
return fileInfoBeans;
}
private List<FileInfoBean> getByMaterialNoAdnWbsno(DataManagementService dataManagementService, String materialNo, String wbsno, List<String> types, StringBuilder message) throws Exception {
// 附件信息
List<FileInfoBean> fileInfoBeans = new ArrayList<>();
// 查询物料零件
Map<String, String> queryCondition = new HashMap<>();
queryCondition.put("materialno", materialNo + "*");
queryCondition.put("WBS No", wbsno);
ModelObject[] modelObjects = QueryHelper.query("chint_query_material", queryCondition);
if (modelObjects == null || modelObjects.length == 0) {
// 按物料号查询
queryCondition.remove("WBS No");
modelObjects = QueryHelper.query("chint_query_material", queryCondition);
}
if (modelObjects != null && modelObjects.length > 0) {
List<ModelObject> specsAttaches = new ArrayList<>();
for (ModelObject modelObject : modelObjects) {
// 零件版本
if (modelObject instanceof Part_Revision) {
Part_Revision partRevision = (Part_Revision) modelObject;
ModelObject[] partRevisions = new ModelObject[]{partRevision};
// 零件版本-图纸[TC_Is_Represented_By]
dataManagementService.refreshObjects(partRevisions);
dataManagementService.getProperties(partRevisions, new String[]{"TC_Is_Represented_By"});
ModelObject[] reps = partRevision.get_TC_Is_Represented_By();
dataManagementService.refreshObjects(reps);
if (reps != null) {
for (ModelObject rep : reps) {
if (rep instanceof ItemRevision) {
ItemRevision itemRevision = (ItemRevision) rep;
specsAttaches.addAll(RevisionHelper.getSpecsAttaches(dataManagementService, itemRevision));
}
}
}
}
}
fileInfoBeans = getFileInfoBeans(dataManagementService, specsAttaches, types);
} else {
logger.debug("使用物料号和WBS号进行查询未找到对象");
message.append("使用物料号和WBS号进行查询未找到对象");
}
return fileInfoBeans;
}
private List<FileInfoBean> getFileInfoBeans(DataManagementService dataManagementService, List<ModelObject> specsAttaches, List<String> types) throws NotLoadedException {
List<FileInfoBean> fileInfoBeans = new ArrayList<>();
for (ModelObject fileObject : specsAttaches) {
if (fileObject instanceof Dataset) {
Dataset dataset = (Dataset) fileObject;
String type = dataset.get_object_type();
if (types.isEmpty() || types.contains(type)) {
String name = BaseHelper.getDatasetName(dataManagementService, dataset);
fileInfoBeans.add(new FileInfoBean(dataset.getUid(), name));
logger.debug("uid: {}, type: {}, name: {}", dataset.getUid(), type, name);
}
}
}
return fileInfoBeans;
}
private List<WorkspaceObject> getProjectItemObjects(DataManagementService dataManagementService, WorkspaceObject currentObject, String factory) throws NotLoadedException {
// 反向查询项目零组件 <出厂编号-项目启动-项目零组件>
List<WorkspaceObject> projectItemObjects = ItemHelper.getWhereReferencedObjects(dataManagementService, currentObject, Arrays.asList("出厂编号", "项目启动"), ObjectTypeEnum.PROJECT_ITEM.value());
// 只保留查询工厂下的项目
Iterator<WorkspaceObject> iterator = projectItemObjects.iterator();
while (iterator.hasNext()) {
WorkspaceObject object = iterator.next();
String name = BaseHelper.getOwningGroupName(dataManagementService, (Item) object);
if (StringUtils.isNotBlank(factory)) {
if (!factory.equals(name)) {
iterator.remove();
}
}
}
return projectItemObjects;
}
@GetMapping("/getProjectFactoryNo")
public JSONObject getProjectFactoryNo(String factoryNo, String factory) {
SessionContext session = new SessionContext(host, username, password);
BypassHelper.open();
StringBuilder message = new StringBuilder();
String projectId = "";
List<String> factoryNoList = new ArrayList<>();
try {
DataManagementService dataManagementService = ServiceHelper.getDataManagementService();
// 查询出厂编号
Map<String, String> queryCondition = new HashMap<>();
queryCondition.put("fid", factoryNo);
ModelObject[] modelObjects = QueryHelper.query("chint_query_FactoryNo", queryCondition);
if (modelObjects != null && modelObjects.length > 0) {
// 找到对象
ModelObject modelObject = modelObjects[0];
logger.debug("找到模型对象uid={} ", modelObject.getUid());
// ## 直接引用的版本对象,正好符合查找的类型
List<String> objVevTypes = new ArrayList<>();
// 公共文件夹 - 出厂编号
objVevTypes.add("ZT2_ProjectFolder");
List<WorkspaceObject> directObjects = RevisionHelper.getItemRevisionObjects(dataManagementService, (WorkspaceObject) modelObject, objVevTypes);
if (!CollectionUtils.isEmpty(directObjects)) {
for (WorkspaceObject object : directObjects) {
WorkspaceObject[] contents = ItemHelper.getContentObjects(dataManagementService, object, "ZT2_ProjectFolder");
if (contents != null) {
for (WorkspaceObject content : contents) {
dataManagementService.refreshObjects(new ModelObject[]{content});
dataManagementService.getProperties(new ModelObject[]{content}, new String[]{"item_id"});
Item item = (Item) content;
String itemId = item.get_item_id();
factoryNoList.add(itemId);
}
}
}
}
// 项目
List<WorkspaceObject> projectItemObjects = getProjectItemObjects(dataManagementService, (WorkspaceObject) modelObject, factory);
if (!CollectionUtils.isEmpty(projectItemObjects)) {
WorkspaceObject projectItemObject = projectItemObjects.get(0);
// 获取属性
dataManagementService.refreshObjects(new ModelObject[]{projectItemObject});
dataManagementService.getProperties(new ModelObject[]{projectItemObject}, new String[]{"zt2_ProjectNo"});
Item projectItem = (Item) projectItemObject;
Property prop = projectItem.getPropertyObject("zt2_ProjectNo");
projectId = prop.toNeutralString();
}
}
} catch (Exception e) {
logger.error("操作异常", e);
message.append("操作异常,").append(e.getMessage());
} finally {
BypassHelper.close();
session.logout();
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("projectId", projectId);
jsonObject.put("factoryNo", factoryNo);
jsonObject.put("factoryNoList", factoryNoList);
if (message.length() > 0) {
jsonObject.put("message", message.toString());
}
return jsonObject;
}
}

@ -0,0 +1,38 @@
package com.chint.plm.modules.pojo;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/**
* @author Admin
*/
public class DesignInfoBean {
private List<FileInfoBean> file;
@JsonProperty("Desc")
private String desc;
public DesignInfoBean(List<FileInfoBean> file,String desc) {
this.file = file;
this.desc = desc;
}
public List<FileInfoBean> getFile() {
return file;
}
public void setFile(List<FileInfoBean> file) {
this.file = file;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
desc = desc;
}
}

@ -0,0 +1,31 @@
package com.chint.plm.modules.pojo;
/**
* Created by K on 2019/8/13.
* @author Admin
*/
public class FileInfoBean {
private String id;
private String name;
public FileInfoBean(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,65 @@
package com.chint.plm.tcclient;
import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException;
import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException;
import com.teamcenter.soa.client.CredentialManager;
import com.teamcenter.soa.exceptions.CanceledOperationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.UUID;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class ClientCredentialManager implements CredentialManager {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private String username = null;
private String password = null;
private String group = ""; // default group
private String role = ""; // default role
private String discriminator = "SoaAppX"; // always connect same user to same instance of server
@Override
public int getCredentialType() {
return CredentialManager.CLIENT_CREDENTIAL_TYPE_STD;
}
@Override
public String[] getCredentials(InvalidCredentialsException e) throws CanceledOperationException {
logger.error("无效的凭据", e);
return promptForCredentials(username, password);
}
@Override
public String[] getCredentials(InvalidUserException e) throws CanceledOperationException {
logger.error("无效的用户", e);
return promptForCredentials(username, password);
}
@Override
public void setUserPassword(String username, String password, String discriminator) {
this.username = username;
this.password = password;
this.discriminator = discriminator;
}
@Override
public void setGroupRole(String group, String role) {
this.group = group;
this.role = role;
}
public String[] promptForCredentials(String username, String password) {
this.username = username;
this.password = password;
return new String[]{username, password, group, role, UUID.randomUUID().toString()};
}
}

@ -0,0 +1,33 @@
package com.chint.plm.tcclient;
import com.teamcenter.schemas.soa._2006_03.exceptions.ConnectionException;
import com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException;
import com.teamcenter.schemas.soa._2006_03.exceptions.ProtocolException;
import com.teamcenter.soa.client.ExceptionHandler;
import com.teamcenter.soa.exceptions.CanceledOperationException;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class ClientExceptionHandler implements ExceptionHandler {
@Override
public void handleException(InternalServerException e) {
if (e instanceof ConnectionException) {
throw new RuntimeException("soa connection failed", e);
} else if (e instanceof ProtocolException) {
throw new RuntimeException("soa connection failed", e);
}
throw new RuntimeException("内部服务器异常", e);
}
@Override
public void handleException(CanceledOperationException e) {
throw new RuntimeException("取消操作异常", e);
}
}

@ -0,0 +1,123 @@
package com.chint.plm.tcclient;
import com.chint.plm.tcclient.listener.ClientChangeListener;
import com.chint.plm.tcclient.listener.ClientDeleteListener;
import com.chint.plm.tcclient.listener.ClientPartialErrorListener;
import com.chint.plm.tcclient.listener.ClientRequestListener;
import com.teamcenter.clientx.AppXExceptionHandler;
import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException;
import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException;
import com.teamcenter.services.strong.core.SessionService;
import com.teamcenter.services.strong.core._2006_03.Session.LoginResponse;
import com.teamcenter.soa.SoaConstants;
import com.teamcenter.soa.client.Connection;
import com.teamcenter.soa.client.model.strong.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class SessionContext {
private static final Logger logger = LoggerFactory.getLogger(SessionContext.class);
private static Connection connection;
private static ClientCredentialManager credentialManager;
private static User user;
public SessionContext(String host) {
// Create an instance of the CredentialManager, this is used
// by the SOA Framework to get the user's credentials when
// challanged by the server (sesioin timeout on the web tier).
credentialManager = new ClientCredentialManager();
String protocol = (host.startsWith("http")) ? SoaConstants.HTTP : SoaConstants.IIOP;
// Create the Connection object, no contact is made with the server
// until a service request is made
connection = new Connection(host, credentialManager, SoaConstants.REST, protocol);
// Add an ExceptionHandler to the Connection, this will handle any
// InternalServerException, communication errors, xml marshalling errors
// .etc
connection.setExceptionHandler(new AppXExceptionHandler());
// While the above ExceptionHandler is required, all of the following
// Listeners are optional. Client application can add as many or as few Listeners
// of each type that they want.
// Add a Partial Error Listener, this will be notified when ever a
// a service returns partial errors.
connection.getModelManager().addPartialErrorListener(new ClientPartialErrorListener());
// Add a Change Listener, this will be notified when ever a
// a service returns model objects that have been updated.
connection.getModelManager().addChangeListener(new ClientChangeListener());
// Add a Delete Listener, this will be notified when ever a
// a service returns objects that have been deleted.
connection.getModelManager().addDeleteListener(new ClientDeleteListener());
// Add a Request Listener, this will be notified before and after each
// service request is sent to the server.
Connection.addRequestListener(new ClientRequestListener());
}
public SessionContext(String host, String username, String password) {
this(host);
User user = login(username, password);
logger.info("登录成功,{}", user.getUid());
}
public static Connection getConnection() {
if (connection == null) {
throw new RuntimeException("请先创建连接");
}
return connection;
}
public static User getUser() {
if (user == null) {
throw new RuntimeException("请先登录");
}
return user;
}
public User login(String username, String password) {
SessionService sessionService = SessionService.getService(connection);
String[] credentials = credentialManager.promptForCredentials(username, password);
try {
LoginResponse response = sessionService.login(
credentials[0],
credentials[1],
credentials[2],
credentials[3],
credentials[4]);
if (response != null) {
user = response.user;
return user;
} else {
return null;
}
} catch (InvalidCredentialsException e) {
throw new RuntimeException("登录失败", e);
}
}
public void logout() {
SessionService sessionService = SessionService.getService(connection);
try {
sessionService.logout();
} catch (ServiceException e) {
logger.error("服务异常", e);
}
}
}

@ -0,0 +1,38 @@
package com.chint.plm.tcclient.enums;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public enum ObjectTypeEnum {
PROJECT_ITEM("ZT2_ProjectItem", "项目零组件"),
PROJECT_FOLDER("ZT2_ProjectFolder", "公共文件夹"),
DESIGN("ZT2_Design3D", "图纸模型"),
DESIGN_REVISION("ZT2_Design3DRevision", "图纸模型版本"),
DOCUMENT("Document", "文档"),
DOCUMENT_REVISION("DocumentRevision", "文档版本"),
FACTORY_NO("ZT2_FactoryNo", "出厂编号"),
;
private final String code;
private final String name;
ObjectTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public String value() {
return code;
}
public String display() {
return name;
}
}

@ -0,0 +1,91 @@
package com.chint.plm.tcclient.helper;
import com.teamcenter.services.strong.core.DataManagementService;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.client.model.ServiceData;
import com.teamcenter.soa.client.model.strong.Dataset;
import com.teamcenter.soa.client.model.strong.Item;
import com.teamcenter.soa.exceptions.NotLoadedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class BaseHelper {
protected static final Logger logger = LoggerFactory.getLogger(BaseHelper.class);
/**
*
*
* @param serviceData
*/
public static void throwServiceDataError(ServiceData serviceData) {
if (serviceData != null && serviceData.sizeOfPartialErrors() > 0) {
StringBuilder errInfo = new StringBuilder();
for (int i = 0; i < serviceData.sizeOfPartialErrors(); i++) {
for (String message : serviceData.getPartialError(i).getMessages()) {
errInfo.append(message).append("\n\r");
}
}
throw new RuntimeException(errInfo.toString());
}
}
/**
*
*
* @param dataManagementService
* @param dataset
* @return
* @throws NotLoadedException
*/
public static String getDatasetName(DataManagementService dataManagementService, Dataset dataset) throws NotLoadedException {
dataManagementService.refreshObjects(new ModelObject[]{dataset});
dataManagementService.getProperties(new ModelObject[]{dataset}, new String[]{"object_name"});
return dataset.get_object_name();
}
/**
*
*
* @param dataManagementService
* @param item Item
* @return
* @throws NotLoadedException
*/
public static String getOwningGroupName(DataManagementService dataManagementService, Item item) throws NotLoadedException {
dataManagementService.getProperties(new ModelObject[]{item}, new String[]{"owning_group"});
ModelObject owningGroup = item.get_owning_group();
/*
// 等效于
// Property prop = projectItem.getPropertyObject("owning_group");
// ModelObject owningGroup = prop.getModelObjectValue();
*/
dataManagementService.refreshObjects(new ModelObject[]{owningGroup});
dataManagementService.getProperties(new ModelObject[]{owningGroup}, new String[]{"name"});
return owningGroup.getPropertyObject("name").getStringValue();
}
/**
*
*
* @param dataManagementService
* @param item Item
* @return
* @throws NotLoadedException
*/
public static String getOwningUserName(DataManagementService dataManagementService, Item item) throws NotLoadedException {
dataManagementService.getProperties(new ModelObject[]{item}, new String[]{"owning_user"});
ModelObject owningUser = item.get_owning_user();
dataManagementService.refreshObjects(new ModelObject[]{owningUser});
dataManagementService.getProperties(new ModelObject[]{owningUser}, new String[]{"user_name"});
return owningUser.getPropertyObject("user_name").getStringValue();
}
}

@ -0,0 +1,37 @@
package com.chint.plm.tcclient.helper;
import com.s8.services.strong.bypass._2016_05.S8SoaBypassService;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class BypassHelper {
/**
*
* @param flag
*/
public static void bypass(boolean flag) {
S8SoaBypassService service = ServiceHelper.getS8SoaBypassService();
service.setBypass(flag);
}
/**
*
*/
public static void open() {
bypass(true);
}
/**
*
*/
public static void close() {
bypass(false);
}
}

@ -0,0 +1,313 @@
package com.chint.plm.tcclient.helper;
import com.chint.plm.tcclient.enums.ObjectTypeEnum;
import com.teamcenter.services.strong.core.DataManagementService;
import com.teamcenter.services.strong.core._2007_01.DataManagement;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.client.model.strong.Folder;
import com.teamcenter.soa.client.model.strong.Item;
import com.teamcenter.soa.client.model.strong.WorkspaceObject;
import com.teamcenter.soa.exceptions.NotLoadedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* Item
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class ItemHelper extends BaseHelper {
private static final Logger logger = LoggerFactory.getLogger(ItemHelper.class);
/**
*
*
* @param dataManagementService
* @param currentObject
* @return
* @throws NotLoadedException
*/
public static WorkspaceObject[] getContentObjects(DataManagementService dataManagementService, WorkspaceObject currentObject) throws NotLoadedException {
Folder folder = (Folder) currentObject;
dataManagementService.refreshObjects(new ModelObject[]{folder});
dataManagementService.getProperties(new ModelObject[]{folder}, new String[]{"contents"});
return folder.get_contents();
}
/**
*
*
* @param dataManagementService
* @param currentObject
* @param objectType
* @return
* @throws NotLoadedException
*/
public static WorkspaceObject[] getContentObjects(DataManagementService dataManagementService, WorkspaceObject currentObject, String objectType) throws NotLoadedException {
dataManagementService.getProperties(
new ModelObject[]{currentObject},
new String[]{"object_type", "object_string"});
logger.debug("找到内容对象 类型:<{}>,名称:<{}>", currentObject.get_object_type(), currentObject.get_object_string());
if (objectType.equals(currentObject.get_object_type())) {
return getContentObjects(dataManagementService, currentObject);
} else {
return new WorkspaceObject[0];
}
}
/**
*
*
* @param dataManagementService
* @param currentObject
* @param objectType
* @param objectName
* @return
* @throws NotLoadedException
*/
public static WorkspaceObject[] getContentObjects(DataManagementService dataManagementService, WorkspaceObject currentObject, String objectType, String objectName) throws NotLoadedException {
dataManagementService.getProperties(
new ModelObject[]{currentObject},
new String[]{"object_type", "object_string"});
logger.debug("找到内容对象 类型:<{}>,名称:<{}>", currentObject.get_object_type(), currentObject.get_object_string());
if (objectType.equals(currentObject.get_object_type()) && objectName.equals(currentObject.get_object_string())) {
return getContentObjects(dataManagementService, currentObject);
} else {
return new WorkspaceObject[0];
}
}
/**
*
*
* @param dataManagementService
* @param currentObject
* @return
* @throws NotLoadedException
*/
public static ModelObject[] getReferenceObjects(DataManagementService dataManagementService, WorkspaceObject currentObject) throws NotLoadedException {
Item item = (Item) currentObject;
dataManagementService.getProperties(new ModelObject[]{item}, new String[]{"IMAN_reference"});
return item.get_IMAN_reference();
}
/**
*
*
* @param dataManagementService
* @param currentObjects
* @param projectFolders
* @param targetObjectTypes
* @return
* @throws NotLoadedException
*/
public static List<WorkspaceObject> getReferenceObjects(DataManagementService dataManagementService, List<WorkspaceObject> currentObjects, List<String> projectFolders, List<String> targetObjectTypes) throws NotLoadedException {
List<WorkspaceObject> resultObjects = new ArrayList<>();
if (!currentObjects.isEmpty()) {
for (WorkspaceObject currentObject : currentObjects) {
resultObjects.addAll(ItemHelper.getReferenceObjects(dataManagementService, currentObject, projectFolders, targetObjectTypes));
}
}
return resultObjects;
}
/**
*
*
* @param dataManagementService
* @param currentObject
* @param projectFolders
* @param targetObjectTypes
* @return
* @throws NotLoadedException
*/
public static List<WorkspaceObject> getReferenceObjects(DataManagementService dataManagementService, WorkspaceObject currentObject, List<String> projectFolders, List<String> targetObjectTypes) throws NotLoadedException {
List<WorkspaceObject> resultObjects = new ArrayList<>();
// 引用对象集合
ModelObject[] referenceObjects = ItemHelper.getReferenceObjects(dataManagementService, currentObject);
if (referenceObjects != null) {
for (ModelObject modelObject : referenceObjects) {
WorkspaceObject referenceObject = (WorkspaceObject) modelObject;
String type = referenceObject.get_object_type();
String name = referenceObject.get_object_string();
logger.debug("找到引用对象 类型:<{}>,名称:<{}>", type, name);
List<WorkspaceObject> contentObjects = getReferenceContentObjects(dataManagementService, referenceObject, projectFolders, targetObjectTypes);
resultObjects.addAll(contentObjects);
}
}
return resultObjects;
}
/**
*
*
* @param dataManagementService
* @param referenceObject
* @param projectFolders
* @param targetObjectTypes
* @return
* @throws NotLoadedException
*/
private static List<WorkspaceObject> getReferenceContentObjects(DataManagementService dataManagementService, WorkspaceObject referenceObject, List<String> projectFolders, List<String> targetObjectTypes) throws NotLoadedException {
return getReferenceContentObjects(dataManagementService, referenceObject, projectFolders, 0, targetObjectTypes);
}
/**
*
*
* @param dataManagementService
* @param referenceObject
* @param projectFolders
* @param findIndex
* @param targetObjectTypes
* @return
* @throws NotLoadedException
*/
private static List<WorkspaceObject> getReferenceContentObjects(DataManagementService dataManagementService, WorkspaceObject referenceObject, List<String> projectFolders, int findIndex, List<String> targetObjectTypes) throws NotLoadedException {
List<WorkspaceObject> resultObjects = new ArrayList<>();
String type = referenceObject.get_object_type();
String name = referenceObject.get_object_string();
if (ObjectTypeEnum.PROJECT_FOLDER.value().equals(type)) {
// 公共文件夹
if (projectFolders != null && projectFolders.size() > findIndex) {
String projectFolder = projectFolders.get(findIndex);
if (name.equals(projectFolder)) {
WorkspaceObject[] contentObjects = getContentObjects(dataManagementService, referenceObject);
if (contentObjects != null) {
for (WorkspaceObject contentObject : contentObjects) {
logger.debug("找到内容对象 类型:<{}>,名称:<{}>", contentObject.get_object_type(), contentObject.get_object_string());
List<WorkspaceObject> subContentObjects = getReferenceContentObjects(dataManagementService, contentObject, projectFolders, findIndex + 1, targetObjectTypes);
resultObjects.addAll(subContentObjects);
}
}
}
}
} else if (targetObjectTypes.contains(type)) {
// 目标对象
resultObjects.add(referenceObject);
}
return resultObjects;
}
/**
*
*
* @param dataManagementService
* @param currentObject
* @return
* @throws NotLoadedException
*/
public static List<DataManagement.WhereReferencedInfo> getWhereReferencedInfos(DataManagementService dataManagementService, WorkspaceObject currentObject) throws NotLoadedException {
List<DataManagement.WhereReferencedInfo> referencedInfos = new ArrayList<>();
// 何处引用响应
DataManagement.WhereReferencedResponse referencedResponse = dataManagementService.whereReferenced(new WorkspaceObject[]{currentObject}, 1);
throwServiceDataError(referencedResponse.serviceData);
int outputSize = referencedResponse.output.length;
logger.debug("找到引用输出 {} 项", outputSize);
for (int i = 0; i < outputSize; i++) {
// 何处引用输出
DataManagement.WhereReferencedOutput referencedOutput = referencedResponse.output[i];
int infoSize = referencedOutput.info.length;
logger.debug("找到引用信息 {} 项", infoSize);
for (int j = 0; j < infoSize; j++) {
// 何处引用信息
DataManagement.WhereReferencedInfo referencedInfo = referencedOutput.info[j];
// 当前引用对象
WorkspaceObject referencedObject = referencedInfo.referencer;
if (referencedObject != null) {
referencedInfos.add(referencedInfo);
}
}
}
return referencedInfos;
}
/**
*
*
* @param dataManagementService
* @param currentObject
* @return
* @throws NotLoadedException
*/
public static List<WorkspaceObject> getWhereReferencedObjects(DataManagementService dataManagementService, WorkspaceObject currentObject) throws NotLoadedException {
List<WorkspaceObject> referencedObjects = new ArrayList<>();
List<DataManagement.WhereReferencedInfo> referencedInfos = getWhereReferencedInfos(dataManagementService, currentObject);
if (!referencedInfos.isEmpty()) {
for (DataManagement.WhereReferencedInfo referencedInfo : referencedInfos) {
// 当前引用对象
WorkspaceObject referencedObject = referencedInfo.referencer;
if (referencedObject != null) {
referencedObjects.add(referencedObject);
}
}
}
return referencedObjects;
}
/**
*
*
* @param dataManagementService
* @param currentObject
* @param projectFolders
* @param targetObjectType
* @return
* @throws NotLoadedException
*/
public static List<WorkspaceObject> getWhereReferencedObjects(DataManagementService dataManagementService, WorkspaceObject currentObject, List<String> projectFolders, String targetObjectType) throws NotLoadedException {
return getWhereReferencedObjects(dataManagementService, currentObject, projectFolders, 0, targetObjectType);
}
/**
*
*
* @param dataManagementService
* @param currentObject
* @param projectFolders
* @param findIndex
* @param targetObjectType
* @return
* @throws NotLoadedException
*/
private static List<WorkspaceObject> getWhereReferencedObjects(DataManagementService dataManagementService, WorkspaceObject currentObject, List<String> projectFolders, int findIndex, String targetObjectType) throws NotLoadedException {
List<WorkspaceObject> resultObjects = new ArrayList<>();
List<DataManagement.WhereReferencedInfo> referencedInfos = getWhereReferencedInfos(dataManagementService, currentObject);
if (!referencedInfos.isEmpty()) {
for (DataManagement.WhereReferencedInfo referencedInfo : referencedInfos) {
WorkspaceObject referencedObject = referencedInfo.referencer;
if (referencedObject != null) {
// 刷新对象(设置属性)
dataManagementService.refreshObjects(new ModelObject[]{currentObject});
// 获取属性
dataManagementService.getProperties(
new ModelObject[]{referencedObject},
new String[]{"object_type", "object_string"});
String type = referencedObject.get_object_type();
String name = referencedObject.get_object_string();
logger.debug("找到引用对象 类型:<{}>,名称:<{}>,关系:<{}>", type, name, referencedInfo.relation);
if (ObjectTypeEnum.PROJECT_FOLDER.value().equals(type)) {
// 公共文件夹
if (projectFolders != null && projectFolders.size() > findIndex) {
String projectFolder = projectFolders.get(findIndex);
if (name.equals(projectFolder)) {
resultObjects.addAll(getWhereReferencedObjects(dataManagementService, referencedObject, projectFolders, findIndex + 1, targetObjectType));
}
}
} else if (targetObjectType.equals(type)) {
// 目标对象
resultObjects.add(referencedObject);
}
}
}
}
return resultObjects;
}
}

@ -0,0 +1,69 @@
package com.chint.plm.tcclient.helper;
import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException;
import com.teamcenter.services.strong.query.SavedQueryService;
import com.teamcenter.services.strong.query._2006_03.SavedQuery;
import com.teamcenter.soa.client.model.ModelObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class QueryHelper extends BaseHelper {
private static final Logger logger = LoggerFactory.getLogger(QueryHelper.class);
private static Map<String, SavedQuery.SavedQueryObject> getSavedQueryObjectMap(SavedQueryService queryService) throws ServiceException {
Map<String, SavedQuery.SavedQueryObject> map = new LinkedHashMap<>();
// 获取保存的查询
SavedQuery.GetSavedQueriesResponse savedQueries = queryService.getSavedQueries();
SavedQuery.SavedQueryObject[] savedQueryObjects = savedQueries.queries;
if (savedQueryObjects != null && savedQueryObjects.length > 0) {
for (SavedQuery.SavedQueryObject savedQueryObject : savedQueryObjects) {
map.put(savedQueryObject.name, savedQueryObject);
}
} else {
throw new RuntimeException("没有找到任何保存的查询");
}
return map;
}
public static ModelObject[] query(String queryName, Map<String, String> queryCondition) throws Exception {
if (queryName != null && !"".equals(queryName) && queryCondition != null && !queryCondition.isEmpty()) {
// 保存的查询服务
SavedQueryService queryService = ServiceHelper.getSavedQueryService();
Map<String, SavedQuery.SavedQueryObject> queryObjectMap = getSavedQueryObjectMap(queryService);
SavedQuery.SavedQueryObject queryObject = queryObjectMap.get(queryName);
if (queryObject != null) {
logger.info("执行查询:{}", queryName);
logger.info("查询键:{}", queryCondition.keySet());
logger.info("查询值:{}", queryCondition.values());
// 新建查询输入
com.teamcenter.services.strong.query._2007_06.SavedQuery.SavedQueryInput savedQueryInput = new com.teamcenter.services.strong.query._2007_06.SavedQuery.SavedQueryInput();
savedQueryInput.query = queryObject.query;
savedQueryInput.entries = queryCondition.keySet().toArray(new String[]{});// new String[]{"Item ID"};
savedQueryInput.values = queryCondition.values().toArray(new String[]{}); // new String[]{itemID};
// 执行查询
com.teamcenter.services.strong.query._2007_06.SavedQuery.ExecuteSavedQueriesResponse response = queryService.executeSavedQueries(new com.teamcenter.services.strong.query._2007_06.SavedQuery.SavedQueryInput[]{savedQueryInput});
// 错误处理
throwServiceDataError(response.serviceData);
// 查询结果
com.teamcenter.services.strong.query._2007_06.SavedQuery.SavedQueryResults queryResults = response.arrayOfResults[0];
return queryResults.objects;
} else {
throw new RuntimeException("查询名称不存在:" + queryName);
}
} else {
return null;
}
}
}

@ -0,0 +1,176 @@
package com.chint.plm.tcclient.helper;
import com.teamcenter.services.strong.core.DataManagementService;
import com.teamcenter.services.strong.core._2007_01.DataManagement;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.client.model.strong.Item;
import com.teamcenter.soa.client.model.strong.ItemRevision;
import com.teamcenter.soa.client.model.strong.ReleaseStatus;
import com.teamcenter.soa.client.model.strong.WorkspaceObject;
import com.teamcenter.soa.exceptions.NotLoadedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class RevisionHelper extends BaseHelper {
private static final Logger logger = LoggerFactory.getLogger(RevisionHelper.class);
/**
*
*
* @param dataManagementService
* @param currentObjects
* @return
* @throws NotLoadedException
*/
public static List<WorkspaceObject> getItemRevisionObjects(DataManagementService dataManagementService, List<WorkspaceObject> currentObjects) throws NotLoadedException {
List<WorkspaceObject> resultObjects = new ArrayList<>();
if (currentObjects != null) {
for (WorkspaceObject currentObject : currentObjects) {
resultObjects.addAll(getItemRevisionObjects(dataManagementService, currentObject));
}
}
return resultObjects;
}
/**
* -
*
* @param dataManagementService
* @param currentObject
* @return
* @throws NotLoadedException
*/
public static List<WorkspaceObject> getItemRevisionObjects(DataManagementService dataManagementService, WorkspaceObject currentObject) throws NotLoadedException {
List<WorkspaceObject> resultObjects = new ArrayList<>();
Item item = (Item) currentObject;
dataManagementService.getProperties(new ModelObject[]{item}, new String[]{"revision_list"});
// 所有版本
ModelObject[] modelObjects = item.get_revision_list();
if (modelObjects != null) {
int lastRevisionNo = -1;
// 最新版本
ItemRevision lastRevisionObject = null;
// 循环所有版本
for (ModelObject modelObject : modelObjects) {
ItemRevision revisionObject = (ItemRevision) modelObject;
dataManagementService.getProperties(
new ModelObject[]{revisionObject},
new String[]{"release_status_list"});
// 发布状态
ReleaseStatus[] releaseStatuses = revisionObject.get_release_status_list();
if (releaseStatuses.length == 0) {
continue;
}
// 最新版本
dataManagementService.getProperties(new ModelObject[]{revisionObject}, new String[]{"item_revision_id"});
String uid = revisionObject.getUid();
String name = revisionObject.get_object_string();
String revisionId = revisionObject.get_item_revision_id();
int currRevisionNo = 0;
try {
currRevisionNo = Integer.parseInt(revisionId.replace("V", ""));
} catch (Exception e) {
logger.error("获取最新版本异常," + uid + " - " + name, e);
// throw new RuntimeException("获取最新版本异常," + uid + " - " + name, e);
}
// 比较版本大小
if (currRevisionNo > lastRevisionNo) {
lastRevisionNo = currRevisionNo;
lastRevisionObject = revisionObject;
}
}
if (lastRevisionObject != null) {
dataManagementService.getProperties(
new ModelObject[]{lastRevisionObject},
new String[]{"object_type", "object_string"});
logger.debug("找到模型版本 类型:<{}>,名称:<{}>", lastRevisionObject.get_object_type(), lastRevisionObject.get_object_string());
resultObjects.add(lastRevisionObject);
}
}
return resultObjects;
}
/**
* -
*
* @param dataManagementService
* @param currentObject
* @param targetObjectTypes
* @return
* @throws NotLoadedException
*/
public static List<WorkspaceObject> getItemRevisionObjects(DataManagementService dataManagementService, WorkspaceObject currentObject, List<String> targetObjectTypes) throws NotLoadedException {
List<WorkspaceObject> resultObjects = new ArrayList<>();
List<DataManagement.WhereReferencedInfo> referencedInfos = ItemHelper.getWhereReferencedInfos(dataManagementService, currentObject);
if (!referencedInfos.isEmpty()) {
for (DataManagement.WhereReferencedInfo referencedInfo : referencedInfos) {
WorkspaceObject referencedObject = referencedInfo.referencer;
if (referencedObject != null) {
// 获取属性
dataManagementService.getProperties(
new ModelObject[]{referencedObject},
new String[]{"object_type", "object_string", "IMAN_specification"});
String type = referencedObject.get_object_type();
String name = referencedObject.get_object_string();
logger.warn("找到引用对象 类型:<{}>,名称:<{}>,关系:<{}>", type, name, referencedInfo.relation);
if (targetObjectTypes.contains(type)) {
resultObjects.add(referencedObject);
}
}
}
}
return resultObjects;
}
/**
*
*
* @param dataManagementService
* @param itemRevisionObjects
* @return
* @throws NotLoadedException
*/
public static List<ModelObject> getSpecsAttaches(DataManagementService dataManagementService, List<WorkspaceObject> itemRevisionObjects) throws NotLoadedException {
List<ModelObject> specsAttaches = new ArrayList<>();
if (itemRevisionObjects != null && itemRevisionObjects.size() > 0) {
for (WorkspaceObject itemRevisionObject : itemRevisionObjects) {
specsAttaches.addAll(getSpecsAttaches(dataManagementService, itemRevisionObject));
}
}
return specsAttaches;
}
/**
*
*
* @param dataManagementService
* @param itemRevisionObject
* @return
* @throws NotLoadedException
*/
public static List<ModelObject> getSpecsAttaches(DataManagementService dataManagementService, WorkspaceObject itemRevisionObject) throws NotLoadedException {
List<ModelObject> specsAttaches = new ArrayList<>();
ItemRevision revision = (ItemRevision) itemRevisionObject;
dataManagementService.getProperties(new ModelObject[]{revision}, new String[]{"IMAN_specification", "TC_Attaches"});
// 规范[IMAN_specification]
ModelObject[] specs = revision.get_IMAN_specification();
// 附加[TC_Attaches]
ModelObject[] attaches = revision.get_TC_Attaches();
specsAttaches.addAll(new ArrayList<>(Arrays.asList(specs)));
specsAttaches.addAll(new ArrayList<>(Arrays.asList(attaches)));
return specsAttaches;
}
}

@ -0,0 +1,35 @@
package com.chint.plm.tcclient.helper;
import com.chint.plm.tcclient.SessionContext;
import com.s8.services.strong.bypass.S8SoaBypassServiceService;
import com.s8.services.strong.bypass._2016_05.S8SoaBypassService;
import com.teamcenter.services.strong.core.DataManagementService;
import com.teamcenter.services.strong.query.SavedQueryService;
import com.teamcenter.soa.client.Connection;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class ServiceHelper {
public static Connection getConnection() {
return SessionContext.getConnection();
}
public static S8SoaBypassService getS8SoaBypassService() {
return S8SoaBypassServiceService.getService(getConnection());
}
public static DataManagementService getDataManagementService() {
return DataManagementService.getService(getConnection());
}
public static SavedQueryService getSavedQueryService() {
return SavedQueryService.getService(getConnection());
}
}

@ -0,0 +1,39 @@
package com.chint.plm.tcclient.listener;
import com.teamcenter.soa.client.model.ChangeListener;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.exceptions.NotLoadedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class ClientChangeListener implements ChangeListener {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public void modelObjectChange(ModelObject[] modelObjects) {
if (modelObjects != null) {
for (ModelObject modelObject : modelObjects) {
String uid = modelObject.getUid();
String type = modelObject.getTypeObject().getName();
String name = "";
if (modelObject.getTypeObject().isInstanceOf("WorkspaceObject")) {
try {
name = modelObject.getPropertyObject("object_string").getStringValue();
} catch (NotLoadedException e) {
throw new RuntimeException("没有载入", e);
}
}
logger.info("模型对象改变监听:{} | {} | {}", uid, type, name);
}
}
}
}

@ -0,0 +1,27 @@
package com.chint.plm.tcclient.listener;
import com.teamcenter.soa.client.model.DeleteListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class ClientDeleteListener implements DeleteListener {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public void modelObjectDelete(String[] uids) {
if (uids != null) {
for (String string : uids) {
logger.info("模型对象删除监听:{}", string);
}
}
}
}

@ -0,0 +1,43 @@
package com.chint.plm.tcclient.listener;
import com.teamcenter.soa.client.model.ErrorStack;
import com.teamcenter.soa.client.model.ErrorValue;
import com.teamcenter.soa.client.model.PartialErrorListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class ClientPartialErrorListener implements PartialErrorListener {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public void handlePartialError(ErrorStack[] errorStacks) {
if (errorStacks != null) {
for (ErrorStack errorStack : errorStacks) {
if (errorStack.hasClientId()) {
logger.error("局部错误监听clientId - {} ", errorStack.getClientId());
}
if (errorStack.hasClientIndex()) {
logger.error("局部错误监听clientIndex - {} ", errorStack.getClientIndex());
}
if (errorStack.hasAssociatedObject()) {
logger.error("局部错误监听associatedObjectUid - {} ", errorStack.getAssociatedObject().getUid());
}
ErrorValue[] errorValues = errorStack.getErrorValues();
if (errorValues != null) {
for (ErrorValue errorValue : errorValues) {
logger.error("错误信息:{} - {} - {}", errorValue.getLevel(), errorValue.getCode(), errorValue.getMessage());
}
}
}
}
}
}

@ -0,0 +1,28 @@
package com.chint.plm.tcclient.listener;
import com.teamcenter.soa.client.RequestListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class ClientRequestListener implements RequestListener {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public void serviceRequest(final Info info) {
logger.info("服务请求监听:{} - {}.{}", info.id, info.service, info.operation);
}
@Override
public void serviceResponse(final Info info) {
logger.info("服务响应监听:{} - {}.{}", info.id, info.service, info.operation);
}
}

@ -0,0 +1,38 @@
package com.chint.plm.tcclient.pojo;
/**
* <p>
*
* </p>
*
* @author Yudy
* @since 2024-03-24
*/
public class FindObjectInfo {
private String objectType;
private String objectName;
public static FindObjectInfo newInstance(String objectType, String objectName) {
FindObjectInfo objectInfo = new FindObjectInfo();
objectInfo.setObjectType(objectType);
objectInfo.setObjectName(objectName);
return objectInfo;
}
public String getObjectType() {
return objectType;
}
public void setObjectType(String objectType) {
this.objectType = objectType;
}
public String getObjectName() {
return objectName;
}
public void setObjectName(String objectName) {
this.objectName = objectName;
}
}

@ -0,0 +1,17 @@
package com.connor.connor_cpzc_service;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan(basePackages = {"com.connor.connor_cpzc_service", "com.chint.plm"})
@MapperScan("com.connor.connor_cpzc_service.mapper")
public class ConnorCpzcServiceApplication {
public static void main(String[] args) {
ConfigurableApplicationContext run = SpringApplication.run(ConnorCpzcServiceApplication.class, args);
}
}

@ -0,0 +1,283 @@
package com.connor.connor_cpzc_service;
// import com.connor.overtime.hs.mapper.EPMMapper;
import com.connor.connor_cpzc_service.bean.MdmDs.ErrorTimeBean;
import com.connor.connor_cpzc_service.bean.SapSumBean;
import com.connor.connor_cpzc_service.controller.DefineUtil;
import com.connor.connor_cpzc_service.info.LoginInfo;
import com.connor.connor_cpzc_service.mapper.EPMMapper;
import com.connor.connor_cpzc_service.util.KUtil;
import com.teamcenter.services.strong.core.DataManagementService;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.client.model.ServiceData;
import com.teamcenter.soa.client.model.strong.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.PostConstruct;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// @Service
// @ConfigurationProperties(prefix = "tc")
@Configuration // 1.主要用于标记配置类兼备Component的效果。
@EnableScheduling // 2.开启定时任务
@EnableAsync
public class SaticScheduleTask {
// 3.添加定时任务
@Autowired
LoginInfo loginInfo;
@PostConstruct
@Async
@Scheduled(cron = "${update.cron}") // 30 18 17 * * ?"${update.cron}"
public void configureTasks() {
System.err.println("执行静态定时任务时间: " + LocalDateTime.now());
// String property = run.getEnvironment().getProperty("tc.server");
// String property1 = run.getEnvironment().getProperty("tc.password");
// String property2 = run.getEnvironment().getProperty("tc.user");
try {
if (KUtil.getLoginUser() != null) {
KUtil.logoutAndClearCache2();
}
KUtil.login(loginInfo.getServer(), loginInfo.getUser(), loginInfo.getPassword());
} catch (Exception e) {
e.printStackTrace();
}
}
@PostConstruct
@Async
@Scheduled(cron = "0 0/5 * * * ?") // 30 18 17 * * ?"${update.cron}"
public void configureTasks2() {
System.err.println("执行静态定时任务时间: " + LocalDateTime.now());
try {
String cmd = "D:\\updateMantr2.bat";
System.out.println(cmd);
executeCmdCommand(cmd);
} catch (Exception e) {
e.printStackTrace();
}
}
@Autowired
private EPMMapper dataMapper;
/**
* SAPBOM
*/
@PostConstruct
@Async
@Scheduled(cron = "${updateSAP.cron}") // 30 18 17 * * ?"${update.cron}"
public void sendBomSap() { //发送BOM到SAP的定时任务
try {
//读取数据库的信息一次10个
System.out.println(loginInfo.getExeSize());
List<SapSumBean> sendMessage = dataMapper.findSendMessage();
//查询exe数量根据配置项执行bat
int num = getProcessCount(DefineUtil.EXENAME);
if (num < loginInfo.getExeSize()) {
int threadCnt = Math.min(loginInfo.getExeSize() - num, sendMessage.size());
System.out.println("启动线程数量===>" + threadCnt);
if (threadCnt <= 0) {
return;
}
ExecutorService executor = Executors.newFixedThreadPool(threadCnt);
for (int i = 0; i < threadCnt; i++) {
SapSumBean sapSumBean = sendMessage.get(i);
executor.submit(new Runnable() {
@Override
public void run() {
try {
String cmd = DefineUtil.BATPATH +
sapSumBean.getCode() + DefineUtil.CMDSPLIT + sapSumBean.getFactory() +
DefineUtil.CMDSPLIT + sapSumBean.getProjectUid() + DefineUtil.CMDSPLIT +
sapSumBean.getKeyMsg() + DefineUtil.CMDSPLIT + sapSumBean.getUser(); //D:\参数化集成
dataMapper.updateTaskStatus(sapSumBean.getCode().toString());
executeCmdCommand(cmd);
KUtil.log("sendBomXB cmd ====> " + cmd);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
executor.shutdown();
}
} catch (Exception e) {
e.printStackTrace();
}
}
// /**
// * 定时执行传递SAPBOM 异常机制
// */
// @PostConstruct
// @Async
// @Scheduled(cron = "${updateSAP.cron}") // 30 18 17 * * ?"${update.cron}"
// public void sendErrorBomSap() { //发送BOM到SAP的定时任务
// try {
//
//// SELECT * FROM CHINT_BOM_TO_SAP_SUM WHERE taskstauts = '组织中' and
//// PLMFINISHTIME is NULL and PLMSTARTTIME < SYSDATE - INTERVAL '30' MINUTE
//// order by CODE desc
// //读取数据库的信息一次10个 异常机制 错误数据再推一次
// List<SapSumBean> sendMessages = dataMapper.findErrorMessage();
// List<SapSumBean> sendMessage = new ArrayList<>();
// for (SapSumBean sapSumBean : sendMessages) {
// String oldtaskcode = sapSumBean.getOldtaskcode();
// //第一次异常处理
// if (oldtaskcode == null || oldtaskcode.isEmpty()) {
// //记录原始ID和上一次任务的ID
// sapSumBean.setOldtaskcode(sapSumBean.getCode().toString());
// sapSumBean.setLasttaskcode(sapSumBean.getCode().toString());
// sendMessage.add(sapSumBean);
// } else {
// //已经有原始ID的情况
// ErrorTimeBean compensation = getCompensation(sapSumBean.getFactory());
// int integer = Integer.parseInt(compensation.getNumber());
// //判断异常处理次数是否到配置的数量
// int numOfError = dataMapper.getNumOfError(sapSumBean.getCode().toString());
// if (numOfError < integer) {
// sapSumBean.setLasttaskcode(sapSumBean.getCode().toString());
// sendMessage.add(sapSumBean);
// }
//
// }
// }
// //查询exe数量根据配置项执行bat
// int num = getProcessCount(DefineUtil.ERR_EXENAME);
// if (num < loginInfo.getErrorExeSize()) {
// int threadCnt = Math.min(loginInfo.getErrorExeSize() - num, sendMessage.size());
// System.out.println("启动线程数量===>" + threadCnt);
// if (threadCnt <= 0) {
// return;
// }
// ExecutorService executor = Executors.newFixedThreadPool(threadCnt);
// for (int i = 0; i < threadCnt; i++) {
// SapSumBean sapSumBean = sendMessage.get(i);
// executor.submit(new Runnable() {
// @Override
// public void run() {
// try {
// Integer code = getCode();
// System.out.println("======" + code + "======");
// String cmd = DefineUtil.BATPATH_ERROR +
// code + DefineUtil.CMDSPLIT + sapSumBean.getFactory() +
// DefineUtil.CMDSPLIT + sapSumBean.getProjectUid() + DefineUtil.CMDSPLIT +
// sapSumBean.getKeyMsg() + DefineUtil.CMDSPLIT + sapSumBean.getUser(); //D:\参数化集成
// dataMapper.updateTaskError(sapSumBean.getCode().toString());
// SimpleDateFormat formatTemp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Date date = formatTemp.parse(sapSumBean.getStarttime());
// String format = formatTemp.format(date);
// sapSumBean.setStarttime(format);
// sapSumBean.setCode(code);
// System.out.println(format);
// dataMapper.insertErrorTask(sapSumBean);
// executeCmdCommand(cmd);
// KUtil.log("sendBomXB cmd ====> " + cmd);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// });
// }
// executor.shutdown();
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
public static void executeCmdCommand(String cmdCommand) {
StringBuilder stringBuilder = new StringBuilder();
Process process = null;
try {
process = Runtime.getRuntime().exec(cmdCommand);
BufferedReader bufferedReader =
new BufferedReader(new InputStreamReader(process.getInputStream(), "GBK"));
String line = null;
while ((line = bufferedReader.readLine()) != null) {
KUtil.log("cmd ==>" + line);
}
//return stringBuilder.toString();
} catch (Exception e) {
e.printStackTrace();
return;
}
}
/**
* exe
*
* @param exeName exe
* @return
*/
public static int getProcessCount(String exeName) {
int count = 0;
try {
Process process = Runtime.getRuntime().exec("tasklist");
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
Pattern pattern = Pattern.compile(exeName);
while ((line = reader.readLine()) != null) {
Matcher matcher = pattern.matcher(line);
if (matcher.find()) {
count++;
}
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
return count;
}
/**
* overtime=30min:3|M040:30min:3;M046:20min:2
* ID
*
* @return
*/
public ErrorTimeBean getCompensation(String groupId) {
String overtime = loginInfo.getOvertime();
String[] split = overtime.split("\\|");
if (overtime.contains(groupId)) {
String[] split1 = split[1].split(";");
for (String val : split1) {
if (val.contains(groupId)) {
String[] vals = val.split(":");
return new ErrorTimeBean(vals[1], vals[2]);
}
}
return null;
} else {
String[] vals = split[0].split(":");
return new ErrorTimeBean(vals[0], vals[1]);
}
}
/**
* SUMcode
*
* @return
*/
public Integer getCode() {
int code = dataMapper.getCode();
return code;
}
}

@ -0,0 +1,23 @@
package com.connor.connor_cpzc_service.bean;
public class CoreBean {
private String productno;
private String wbsno;
public String getProductno() {
return productno;
}
public void setProductno(String productno) {
this.productno = productno;
}
public String getWbsno() {
return wbsno;
}
public void setWbsno(String wbsno) {
this.wbsno = wbsno;
}
}

@ -0,0 +1,48 @@
package com.connor.connor_cpzc_service.bean;
public class CoreBeanReturn {
private String productno;
private String wbsno;
private String weight;
private String code;
public CoreBeanReturn(String productno, String wbsno, String weight, String code) {
this.productno = productno;
this.wbsno = wbsno;
this.weight = weight;
this.code = code;
}
public String getProductno() {
return productno;
}
public String getWeight() {
return weight;
}
public void setWeight(String weight) {
this.weight = weight;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public void setProductno(String productno) {
this.productno = productno;
}
public String getWbsno() {
return wbsno;
}
public void setWbsno(String wbsno) {
this.wbsno = wbsno;
}
}

@ -0,0 +1,28 @@
package com.connor.connor_cpzc_service.bean;
import com.connor.connor_cpzc_service.controller.BomPropBean;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class CshXlsxBean {
@JsonProperty("code")
private String code;
@JsonProperty("desc")
private String desc;
@JsonProperty("uid")
private String uidName;
public CshXlsxBean(String code, String desc, String uidName, String fileName,String revisionId) {
this.code = code;
this.desc = desc;
this.uidName = uidName;
this.fileName = fileName;
this.revisionId = revisionId;
}
@JsonProperty("revId")
private String revisionId;
@JsonProperty("fileName")
private String fileName;
}

@ -0,0 +1,34 @@
package com.connor.connor_cpzc_service.bean;
import com.fasterxml.jackson.annotation.JsonProperty;
public class CswjBean {
@JsonProperty("code")
private String code = "200";
@JsonProperty("desc")
private String desc = "参数化文件已上传";
@JsonProperty("item_id")
private String item_id;
@JsonProperty("object_name")
private String object_name;
@JsonProperty("Save_time")
private String Save_time;
@JsonProperty("item_revision_id")
private String item_revision_id;
@JsonProperty("create_time")
private String create_time;
@JsonProperty("Release_time")
private String Release_time;
@JsonProperty("responsible_user")
private String responsible_user;
public CswjBean(String item_id, String object_name, String save_time, String item_revision_id, String create_time, String release_time, String responsible_user) {
this.item_id = item_id;
this.object_name = object_name;
Save_time = save_time;
this.item_revision_id = item_revision_id;
this.create_time = create_time;
Release_time = release_time;
this.responsible_user = responsible_user;
}
}

@ -0,0 +1,16 @@
package com.connor.connor_cpzc_service.bean;
import com.fasterxml.jackson.annotation.JsonProperty;
public class CswjErrBean {
@JsonProperty("code")
private String code = "500";
@JsonProperty("reason")
private String reason = "PLM系统中无此通用件请联系通用件管理员";
public CswjErrBean() {
}
public CswjErrBean(String code, String reason) {
this.code = code;
this.reason = reason;
}
}

@ -0,0 +1,36 @@
package com.connor.connor_cpzc_service.bean;
public class ECNBean {
private String creationdatebefore;//创建时间早于
private String factory;//所属组织
private String creationdateafter;//创建时间晚于
public String getCreationdatebefore() {
return creationdatebefore;
}
public void setCreationdatebefore(String creationdatebefore) {
this.creationdatebefore = creationdatebefore;
}
public String getFactory() {
return factory;
}
public void setFactory(String factory) {
this.factory = factory;
}
public String getCreationdateafter() {
return creationdateafter;
}
public void setCreationdateafter(String creationdateafter) {
this.creationdateafter = creationdateafter;
}
public String toString(){
return "{\"factory\":\"" + factory + "\",\"creationdatebefore\":\"" + creationdatebefore + "\",\"creationdateafter\":\"" + creationdateafter + "\"}";
}
}

@ -0,0 +1,33 @@
package com.connor.connor_cpzc_service.bean;
public class ECNBeanReturn {
private String owninguser;
private int counts;
public ECNBeanReturn(String owninguser, int counts) {
this.owninguser = owninguser;
this.counts = counts;
}
public String getOwninguser() {
return owninguser;
}
public void setOwninguser(String owninguser) {
this.owninguser = owninguser;
}
public int getCounts() {
return counts;
}
public void setCounts(int counts) {
this.counts = counts;
}
public void add(){
counts ++;
}
public String toString(){
return "{\"owninguser\":\"" + owninguser + "\",\"counts\":\"" + counts + "\"}";
}
}

@ -0,0 +1,17 @@
package com.connor.connor_cpzc_service.bean;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class GetCoilBean {
private String materialno;
public String getMaterialno() {
return materialno;
}
public void setMaterialno(String materialno) {
this.materialno = materialno;
}
}

@ -0,0 +1,19 @@
package com.connor.connor_cpzc_service.bean;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class HistoryBean {
@JsonProperty("code")
private String code="200";
@JsonProperty("desc")
private String desc = "找到对应对象";
@JsonProperty("detail")
private List<ItemBean> items;
public HistoryBean(List<ItemBean> items) {
this.items = items;
}
}

@ -0,0 +1,25 @@
package com.connor.connor_cpzc_service.bean;
import com.fasterxml.jackson.annotation.JsonProperty;
public class HistoryErrBean {
public HistoryErrBean(String nuff_Properties) {
this.nuff_Properties = nuff_Properties;
}
@JsonProperty("code")
private String code = "500";
@JsonProperty("desc")
private String desc = "未找到到对应图纸对象,请检查数据重新查询";
@JsonProperty("nuff_Properties")
private String nuff_Properties;
public String getNuff_Properties() {
return nuff_Properties;
}
public void setNuff_Properties(String nuff_Properties) {
this.nuff_Properties = nuff_Properties;
}
}

@ -0,0 +1,16 @@
package com.connor.connor_cpzc_service.bean;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ItemBean {
@JsonProperty("item_id")
private String itemId;
@JsonProperty("revision")
private String object_name;
public ItemBean(String itemId, String object_name) {
this.itemId = itemId;
this.object_name = object_name;
}
}

@ -0,0 +1,26 @@
package com.connor.connor_cpzc_service.bean.MdmDs;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DesignBean {
@JSONField(name = "drawingno")
String drawingNo;
@JSONField(name = "drawingname")
String drawingName;
@JSONField(name = "materialcode")
String materialCode; //暂时为空
@JSONField(name = "version")
String version;
@JSONField(name = "files")
List<FileBean> fileBeans; //暂时为空
}

@ -0,0 +1,13 @@
package com.connor.connor_cpzc_service.bean.MdmDs;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ErrorTimeBean {
private String overTime;
private String number;
}

@ -0,0 +1,20 @@
package com.connor.connor_cpzc_service.bean.MdmDs;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FileBean {
@JSONField(name = "no")
String no;
@JSONField(name = "fileuid")
String fileUid;
@JSONField(name = "filename")
String fileName;
}

@ -0,0 +1,18 @@
package com.connor.connor_cpzc_service.bean.MdmDs;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MomRuleBean {
String psmcode ;
String no ;
String drawingno ;
String list ;
String elsedrawingno ;
}

@ -0,0 +1,16 @@
package com.connor.connor_cpzc_service.bean.MdmDs;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OaReferenceBean {
private String principal;
private String file;
private String pctime;
}

@ -0,0 +1,22 @@
package com.connor.connor_cpzc_service.bean.MdmDs;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SapMsg {
private String starttime;
private String wbsno;
private String projectno;
private String puid;
private String productmaterialno;
private String transfer;
private String sapresult;
private String userid;
private String user;
private String factory;
}

@ -0,0 +1,20 @@
package com.connor.connor_cpzc_service.bean;
import com.connor.connor_cpzc_service.controller.BomPropBean;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class PartBean {
@JsonProperty("code")
private String code="200";
@JsonProperty("desc")
private String desc = "找到对应部件";
@JsonProperty("detail")
private List<BomPropBean> items;
public PartBean(List<BomPropBean> items) {
this.items = items;
}
}

@ -0,0 +1,18 @@
package com.connor.connor_cpzc_service.bean;
import com.fasterxml.jackson.annotation.JsonProperty;
public class PartErrBean {
@JsonProperty("code")
private String code="500";
@JsonProperty("desc")
private String desc = "查询结果为空,未找到到对应部件对象,请联系通用件管理员";
public PartErrBean(String itemId) {
this.itemId = itemId;
}
@JsonProperty("item_id")
private String itemId;
}

@ -0,0 +1,222 @@
package com.connor.connor_cpzc_service.bean;
import java.util.Date;
public class QMSBean {
private Integer code;
private String factory; // 工厂
private String qmsinspectioncode; // QMS检验项编码
private String qmsinspectionname; // QMS检验项名称
private String qmssuperiorinspectioncode; // QMS上级检验项编码
private String qmssuperiorinspectionname; // QMS上级检验项名称
private String qmspushuser; // QMS推送人员
private Date qmspushtime; // QMS推送时间
private String qmsremark; // QMS备注
private String plminspectioncode; // PLM检验项编码
private String plmvaluetype; // 取值类型
private String plmdesignation; // 参数代号
private String plmsequence; // 规格位数(顺序)
private String status; // 是否同步QMS成功/失败)
private String plmchangeuser; // 修改人员
private Date plmchangetime; // 修改时间
private String plmremark; // PLM备注
private Date synctime; // 同步时间
private String syncuser; // 同步账号
private String qmsinspectionschemename; // QMS检验方案名称
private String qmsinspectionschemecode; // QMS检验方案编码
private String result; // 结果
// 构造函数、getter 和 setter 方法
public QMSBean() {
}
public QMSBean(String factory, String qmsinspectioncode, String qmsinspectionname, String qmspushuser, Date qmspushtime, String qmsremark,String qmssuperiorinspectionname, String qmssuperiorinspectioncode, String qmsinspectionschemename, String qmsinspectionschemecode) {
this.factory = factory;
this.qmsinspectioncode = qmsinspectioncode;
this.qmsinspectionname = qmsinspectionname;
this.qmssuperiorinspectioncode = qmssuperiorinspectioncode;
this.qmssuperiorinspectionname = qmssuperiorinspectionname;
this.qmspushuser = qmspushuser;
this.qmspushtime = qmspushtime;
this.qmsremark = qmsremark;
this.qmsinspectionschemename = qmsinspectionschemename;
this.qmsinspectionschemecode = qmsinspectionschemecode;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getFactory() {
return factory;
}
public void setFactory(String factory) {
this.factory = factory;
}
public String getQmsinspectioncode() {
return qmsinspectioncode;
}
public void setQmsinspectioncode(String qmsinspectioncode) {
this.qmsinspectioncode = qmsinspectioncode;
}
public String getQmsinspectionname() {
return qmsinspectionname;
}
public void setQmsinspectionname(String qmsinspectionname) {
this.qmsinspectionname = qmsinspectionname;
}
public String getQmssuperiorinspectioncode() {
return qmssuperiorinspectioncode;
}
public void setQmssuperiorinspectioncode(String qmssuperiorinspectioncode) {
this.qmssuperiorinspectioncode = qmssuperiorinspectioncode;
}
public String getQmssuperiorinspectionname() {
return qmssuperiorinspectionname;
}
public void setQmssuperiorinspectionname(String qmssuperiorinspectionname) {
this.qmssuperiorinspectionname = qmssuperiorinspectionname;
}
public String getQmspushuser() {
return qmspushuser;
}
public void setQmspushuser(String qmspushuser) {
this.qmspushuser = qmspushuser;
}
public Date getQmspushtime() {
return qmspushtime;
}
public void setQmspushtime(Date qmspushtime) {
this.qmspushtime = qmspushtime;
}
public String getQmsremark() {
return qmsremark;
}
public void setQmsremark(String qmsremark) {
this.qmsremark = qmsremark;
}
public String getPlminspectioncode() {
return plminspectioncode;
}
public void setPlminspectioncode(String plminspectioncode) {
this.plminspectioncode = plminspectioncode;
}
public String getPlmvaluetype() {
return plmvaluetype;
}
public void setPlmvaluetype(String plmvaluetype) {
this.plmvaluetype = plmvaluetype;
}
public String getPlmdesignation() {
return plmdesignation;
}
public void setPlmdesignation(String plmdesignation) {
this.plmdesignation = plmdesignation;
}
public String getPlmsequence() {
return plmsequence;
}
public void setPlmsequence(String plmsequence) {
this.plmsequence = plmsequence;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getPlmchangeuser() {
return plmchangeuser;
}
public void setPlmchangeuser(String plmchangeuser) {
this.plmchangeuser = plmchangeuser;
}
public Date getPlmchangetime() {
return plmchangetime;
}
public void setPlmchangetime(Date plmchangetime) {
this.plmchangetime = plmchangetime;
}
public String getPlmremark() {
return plmremark;
}
public void setPlmremark(String plmremark) {
this.plmremark = plmremark;
}
public Date getSynctime() {
return synctime;
}
public void setSynctime(Date synctime) {
this.synctime = synctime;
}
public String getSyncuser() {
return syncuser;
}
public void setSyncuser(String syncuser) {
this.syncuser = syncuser;
}
public String getQmsinspectionschemename() {
return qmsinspectionschemename;
}
public void setQmsinspectionschemename(String qmsinspectionschemename) {
this.qmsinspectionschemename = qmsinspectionschemename;
}
public String getQmsinspectionschemecode() {
return qmsinspectionschemecode;
}
public void setQmsinspectionschemecode(String qmsinspectionschemecode) {
this.qmsinspectionschemecode = qmsinspectionschemecode;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
}

@ -0,0 +1,58 @@
package com.connor.connor_cpzc_service.bean;
public class ReturnBean1 {
private String code;
private String weight;
private String drawingno;
private String materialno;
private String name;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getWeight() {
return weight;
}
public void setWeight(String weight) {
this.weight = weight;
}
public String getDrawingno() {
return drawingno;
}
public void setDrawingno(String drawingno) {
this.drawingno = drawingno;
}
public String getMaterialno() {
return materialno;
}
public void setMaterialno(String materialno) {
this.materialno = materialno;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ReturnBean1(String code, String weight, String drawingno, String materialno, String name) {
this.code = code;
this.weight = weight;
this.drawingno = drawingno;
this.materialno = materialno;
this.name = name;
}
}

@ -0,0 +1,132 @@
package com.connor.connor_cpzc_service.bean;
public class SapResult {
private String factory;
private String wbsno;
private String materialno;
private String batchnumber;
private String puid;
private String status;
private String message;
private String createdate;
private String createtime;
private String returndate;
private String returntime;
public String getFactory() {
return factory;
}
public void setFactory(String factory) {
this.factory = factory;
}
public String getWbsno() {
return wbsno;
}
public void setWbsno(String wbsno) {
this.wbsno = wbsno;
}
public String getMaterialno() {
return materialno;
}
public void setMaterialno(String materialno) {
this.materialno = materialno;
}
public String getBatchnumber() {
return batchnumber;
}
public void setBatchnumber(String batchnumber) {
this.batchnumber = batchnumber;
}
public String getPuid() {
return puid;
}
public void setPuid(String puid) {
this.puid = puid;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getCreatedate() {
return createdate;
}
public void setCreatedate(String createdate) {
this.createdate = createdate;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
public String getReturndate() {
return returndate;
}
public void setReturndate(String returndate) {
this.returndate = returndate;
}
public String getReturntime() {
return returntime;
}
public void setReturntime(String returntime) {
this.returntime = returntime;
}
@Override
public String toString() {
return "SapResult{" +
"factory='" + factory + '\'' +
", wbsno='" + wbsno + '\'' +
", materialno='" + materialno + '\'' +
", batchnumber='" + batchnumber + '\'' +
", puid='" + puid + '\'' +
", status='" + status + '\'' +
", message='" + message + '\'' +
", createdate='" + createdate + '\'' +
", createtime='" + createtime + '\'' +
", returndate='" + returndate + '\'' +
", returntime='" + returntime + '\'' +
'}';
}
// "factory":"工厂",
// "wbsno":"项目wbs号可为空",
// "materialno":"父物料编码1",
// "batchnumber":"批次号",
// "puid":"PLM中的物料item_uid",
// "status":"处理结果状态",
// "message":"具体返回的信息内容",
// "createdate":"BOM创建日期",
// "createtime":"BOM创建时间",
// "returndate":"BOM同步日期",
// "returntime":"BOM同步时间"
}

@ -0,0 +1,23 @@
package com.connor.connor_cpzc_service.bean;
import java.util.List;
public class SapReturn {
private List<SapResult> result;
public List<SapResult> getResult() {
return result;
}
public void setResult(List<SapResult> result) {
this.result = result;
}
@Override
public String toString() {
return "SapReturn{" +
"result=" + result +
'}';
}
}

@ -0,0 +1,25 @@
package com.connor.connor_cpzc_service.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SapSumBean {
private String keyMsg;
private Integer code;
private String factory;
private String projectUid;
private String user;
private String starttime;
private String wbsno;
private String projectno;
private String sapresult;
private String transfer;
private String oldtaskcode;//记录原始的任务ID
private String lasttaskcode;//记录上一个任务
private String serverhost;
private String userid;
}

@ -0,0 +1,62 @@
package com.connor.connor_cpzc_service.controller;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class BomPropBean {
// 图号、名称、描述 创建时间,发布时间,版本,责任人
@JsonProperty("item_id")
private String itemId;
@JsonProperty("Creationtime")
private String createDate;
@JsonProperty("Releasetime")
private String releaseDate;
@JsonProperty("revision")
private String revision;
@JsonProperty("user")
private String assignee;
// @JsonProperty("children")
// private List<BomPropBean> children;
public String getItemId() {
return itemId;
}
public void setItemId(String itemId) {
this.itemId = itemId;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getReleaseDate() {
return releaseDate;
}
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate;
}
public String getRevision() {
return revision;
}
public void setRevision(String revision) {
this.revision = revision;
}
public String getAssignee() {
return assignee;
}
public void setAssignee(String assignee) {
this.assignee = assignee;
}
}

@ -0,0 +1,18 @@
package com.connor.connor_cpzc_service.controller;
import java.text.SimpleDateFormat;
public class DefineUtil {
public static final String DRAWNO = "zt2_DrawingNo";
public static final String ITEMID = "item_id";
public static final String SEARCHDRAW = "参数化查询图纸";
public static final String PATTERNCODE = "图样代号";
public static final String EXENAME = "BOMToSapOpt.exe";
public static final String ERR_EXENAME = "BOMToSapOptError.exe";
//D:\参数化集成\BOMToSapOpt.bat D:\server\CshTest\BOMToSapOpt.bat D:\参数化集成\BOMToSapOpt.bat
public static final String BATPATH = "D:\\server\\参数化-8089\\BOMToSapOpt.bat ";
public static final String BATPATH_ERROR = "D:\\参数化集成\\BOMToSapOptError.bat ";
public static final String CMDSPLIT = " ";
public static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
}

@ -0,0 +1,927 @@
package com.connor.connor_cpzc_service.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.chint.plm.tcclient.SessionContext;
import com.chint.plm.tcclient.helper.ItemHelper;
import com.chint.plm.tcclient.helper.ServiceHelper;
import com.connor.connor_cpzc_service.bean.ECNBean;
import com.connor.connor_cpzc_service.bean.ECNBeanReturn;
import com.connor.connor_cpzc_service.bean.MdmDs.DesignBean;
import com.connor.connor_cpzc_service.bean.MdmDs.FileBean;
import com.connor.connor_cpzc_service.bean.MdmDs.MomRuleBean;
import com.connor.connor_cpzc_service.bean.SapResult;
import com.connor.connor_cpzc_service.bean.SapReturn;
import com.connor.connor_cpzc_service.info.LoginInfo;
import com.connor.connor_cpzc_service.mapper.EPMMapper;
import com.connor.connor_cpzc_service.service.BomResultService;
import com.connor.connor_cpzc_service.util.JsonResult;
import com.connor.connor_cpzc_service.util.KUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.teamcenter.clientx.AppXSession;
import com.teamcenter.services.strong.cad.StructureManagementService;
import com.teamcenter.services.strong.cad._2007_01.StructureManagement;
import com.teamcenter.services.strong.core.DataManagementService;
import com.teamcenter.services.strong.core._2007_01.DataManagement;
import com.teamcenter.services.strong.workflow.WorkflowService;
import com.teamcenter.soa.client.Connection;
import com.teamcenter.soa.client.FileManagementUtility;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.client.model.Property;
import com.teamcenter.soa.client.model.ServiceData;
import com.teamcenter.soa.client.model.strong.*;
import org.apache.http.HttpRequest;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Pattern;
@RestController
@RequestMapping(value = "/plm")
public class GetDesignController {
@Autowired EPMMapper mapper;
@Autowired BomResultService service;
// private static final org.apache.log4j.Logger logger =
// org.apache.log4j.Logger.getLogger(GetDesignController.class);
@Autowired protected LoginInfo loginInfo;
@PostMapping("/getBOMResult")
public String getBOMResult(@RequestBody SapReturn sapReturn) {
JSONObject result = new JSONObject();
new Thread(
new Runnable() {
@Override
public void run() {
try {
ObjectMapper objectMapper = new ObjectMapper();
String data = objectMapper.writeValueAsString(sapReturn);
KUtil.log("START: getBOMResult01 解析SAP回传信息 ====> " + data);
List<SapResult> result1 = sapReturn.getResult();
service.saveSapResult(result1);
KUtil.log("End: 解析完成");
} catch (Exception e) {
e.printStackTrace();
}
}
})
.start();
try {
result.put("code", "S");
result.put("msg", "成功接收");
} catch (Exception e) {
e.printStackTrace();
}
return result.toString();
}
// MDM获取TC图纸
/**
* BOM
*
* @param parentItemRev BOM
* @param conn
* @return 0 BOMWindow 1 BOMLine
*/
public ArrayList<Object> openBOMWindow(ItemRevision parentItemRev, Connection conn) {
ArrayList<Object> bomWindowandParentLine = new ArrayList<>();
com.teamcenter.services.strong.cad._2007_01.StructureManagement.CreateBOMWindowsInfo[] createBOMWindowsInfo = new com.teamcenter.services.strong.cad._2007_01.StructureManagement.CreateBOMWindowsInfo[1];
createBOMWindowsInfo[0] = new com.teamcenter.services.strong.cad._2007_01.StructureManagement.CreateBOMWindowsInfo();
createBOMWindowsInfo[0].itemRev = parentItemRev;
com.teamcenter.services.strong.cad.StructureManagementService cadSMService =
com.teamcenter.services.strong.cad.StructureManagementService
.getService(conn);
com.teamcenter.services.strong.cad._2007_01.StructureManagement.CreateBOMWindowsResponse createBOMWindowsResponse =
cadSMService.createBOMWindows(createBOMWindowsInfo);
// cadSMService.
// cadSMService.d
if (createBOMWindowsResponse.serviceData.sizeOfPartialErrors() > 0) {
for (int i = 0; i < createBOMWindowsResponse.serviceData
.sizeOfPartialErrors(); i++) {
System.out.println("Partial Error in Open BOMWindow = " + createBOMWindowsResponse.serviceData
.getPartialError(i).getMessages()[0]);
}
}
bomWindowandParentLine.add(createBOMWindowsResponse.output[0].bomWindow);//BOMWindow
BOMLine bomLine = createBOMWindowsResponse.output[0].bomLine;
bomWindowandParentLine.add(bomLine);
return bomWindowandParentLine;
}
@Value("${tc.server}")
private String host;
@Value("${tc.user}")
private String username;
@Value("${tc.password}")
private String password;
@PostMapping("/getDesignlist")
public String getDesignList(@RequestBody JSONObject designJson ) {
// logger.
//
KUtil.log("getDesignList MDM入参:" + designJson.toJSONString());
// SessionContext session = new SessionContext(host, username, password);
Connection conn = AppXSession.getConnection();
// DataManagementService dataManagementService = ServiceHelper.getDataManagementService();
DataManagementService dataManagementService = DataManagementService.getService(conn);
String wbsNo = designJson.getString("wbsno"); // WBS号
String materialNo = designJson.getString("materialno"); // 生产订单的物料编码
JSONArray processList = designJson.getJSONArray("processlist"); // 一级工序编码清单
String factory = designJson.getString("factory"); // 工厂
String factoryno = designJson.getString("factoryno"); // 出厂编号
System.out.println("factory==="+factory+"factoryno==="+factoryno);
List<String> psmCodes = new ArrayList<>(); // 记录一级工序编码
for (int i = 0; i < processList.size(); i++) {
psmCodes.add(processList.getJSONObject(i).getString("process"));
}
// 查询图纸,物料分为产成品和非产成品
// 查询 chint_search_material_mom 先带WBS 再不带WBS查
Map<String, String> searchMap = new HashMap<>();
searchMap.put("WBS号", wbsNo);
searchMap.put("materialno", materialNo);
String errMsg = "";
try {
ItemRevision designRev = null;
Map<String,WorkspaceObject> referencedObjectMap = new HashMap<>();
String projectCode = ""; // 工程图号
if(factoryno != null && !factoryno.isEmpty()){
Map<String, String> searchCCBHMap = new HashMap<>();
searchCCBHMap.put("fid", factoryno);
ModelObject[] ccbh = KUtil.query("chint_query_FactoryNo", searchCCBHMap);//查询出场编号
System.out.println("ccbh。size============="+ccbh.length);
if(ccbh.length > 0){
List<DataManagement.WhereReferencedInfo> referencedInfos = ItemHelper.getWhereReferencedInfos(dataManagementService, (Item)ccbh[0]);
if (!referencedInfos.isEmpty()) {
for (DataManagement.WhereReferencedInfo referencedInfo : referencedInfos) {
WorkspaceObject referencedObject = referencedInfo.referencer;
if (referencedObject != null) {
dataManagementService.getProperties(
new ModelObject[]{referencedObject},
new String[]{"object_type", "object_name","item_id"});
String type = referencedObject.get_object_type();
String name = referencedObject.get_object_name();
System.out.println("type==="+type+"name==="+name);
if(type.equals("ZT2_Design3DRevision")){
referencedObjectMap.put(name,referencedObject);
}
}
}
System.out.println("referencedObjectMap========="+referencedObjectMap.toString());
if(referencedObjectMap.size() > 1){
for (Map.Entry<String, WorkspaceObject> map :referencedObjectMap.entrySet()
) {
if(map.getKey().contains("总装") || map.getKey().contains("变压器")){
designRev = (ItemRevision) map.getValue();
break;
}
}
}else if(referencedObjectMap.size() == 1){
for (Map.Entry<String, WorkspaceObject> map :referencedObjectMap.entrySet()
) {
designRev = (ItemRevision) map.getValue();
break;
}
}
}
if(designRev != null){
// 获取属性
//dataManagementService.getProperties(new ModelObject[]{designRev}, new String[]{"item_id"});
// KUtil.refreshAndGetProperties(designRev, "item_id");
String item_id = designRev.get_item_id();
projectCode = item_id.split("-")[1];
System.out.println("projectCode========"+projectCode);
}
}
}
ItemRevision material = null;
if(projectCode == null || projectCode.isEmpty()) {
ModelObject[] designs = KUtil.query("chint_query_material_test", searchMap); // 查询物料
if (designs.length == 0) {
// 再不带wbs查询 并且判断多个物料且存在不同的wbs
searchMap.clear();
searchMap.put("materialno", materialNo);
designs = KUtil.query("chint_query_material_test", searchMap);
if (designs.length == 0) {
errMsg = "查询不到物料,请输入准确的物料编码.";
return JSONObject.toJSONString(JsonResult.error(errMsg));
// } else if (designs.length == 1) {
// material = (ItemRevision) designs[0];
} else {
material = (ItemRevision) designs[0];
/*List<String> wbsList = new ArrayList<>();
for (ModelObject design : designs) {
KUtil.refreshAndGetProperties(design, "zt2_WBSNo");
String ztWbsNo = design.getPropertyObject("zt2_WBSNo").getStringValue();
if (wbsList.contains(ztWbsNo)) {
errMsg = "找到多个物料且存在不同的wbs请输入准确的数据信息.";
} else {
wbsList.add(ztWbsNo);
}
}
if (errMsg.equals("")) {
material = (ItemRevision) designs[0];
} else {
KUtil.log("getDesignList TC回传:找到多个物料且存在不同的wbs");
return JSONObject.toJSONString(JsonResult.error(errMsg));
}*/
}
} else {
material = (ItemRevision) designs[0];
}
}
// 找到物料后判断是不是产成品 获取图纸找到工程图号
if (material != null || (projectCode != null && !projectCode.isEmpty())) {
String coreCode = ""; // 线圈id
if(material != null) {
KUtil.refreshAndGetProperties(
material, "object_name", "TC_Is_Represented_By", "object_desc","ZT2_FactoryNumber");
String objectName = material.get_object_name();
System.out.println(objectName);
if (objectName.contains("变压器")) {
// 获取产成品关联的图纸
ModelObject[] designRevs =
material.getPropertyObject("TC_Is_Represented_By").getModelObjectArrayValue();
if (designRevs.length > 0) {
designRev = (ItemRevision) designRevs[0];
KUtil.refreshAndGetProperties(designRev, "item_id");
String item_id = designRev.get_item_id();
projectCode = item_id.split("-")[1];
}else{//如果没有图纸 20240820
Map<String, String> searchMap1 = new HashMap<>();
//获取出产编号
String ccbh = "";
String[] CHINT_Search_Drawing_ID = KUtil.GetPrefValues("CHINT_Search_Drawing_ID");
System.out.println("CHINT_Search_Drawing_ID====================="+CHINT_Search_Drawing_ID.length);
//dataManagementService.getProperties(new ModelObject[]{material}, new String[]{"ZT2_FactoryNumber"});
Property zt2_factoryNumber = material.getPropertyObject("ZT2_FactoryNumber");
ModelObject[] modelObjectArrayValue = zt2_factoryNumber.getModelObjectArrayValue();
System.out.println("modelObjectArrayValue================================"+modelObjectArrayValue.length);
if(modelObjectArrayValue.length > 0){
ModelObject modelObject = modelObjectArrayValue[0];
Item ccbhItem = (Item)modelObject;
KUtil.refreshAndGetProperties(ccbhItem, "item_id");
ccbh = ccbhItem.get_item_id();
}
System.out.println("ccbh==============================="+ccbh);
if(ccbh != null && !ccbh.isEmpty()){
searchMap1.put("fid", ccbh);
ModelObject[] designs = KUtil.query("chint_query_search_drawing", searchMap1);
System.out.println("designs============================"+designs.length);
for (int i = 0; i < designs.length; i++) {
designRev = (ItemRevision) designs[i];
//dataManagementService.getProperties(new ModelObject[]{designRev}, new String[]{"item_id"});
KUtil.refreshAndGetProperties(designRev, "item_id");
String item_id = designRev.get_item_id();
System.out.println("design_item_id==================================="+item_id);
for (int j = 0; j < CHINT_Search_Drawing_ID.length; j++) {
if(item_id.contains(CHINT_Search_Drawing_ID[j])) {
projectCode = item_id.split("-")[1];
}
}
}
}
}
} else {
// 非产成品直接获取物料描述
String object_desc = material.get_object_desc();
String[] splitBak = object_desc.split(" ");
System.out.println(object_desc);
if (splitBak.length >= 2) {
String itemId = splitBak[1];
projectCode = itemId.substring(itemId.lastIndexOf("-") + 1);
// if (objectName.contains("压线圈")) { // 5种线圈特殊处理ID
// coreCode = itemId.substring(0, itemId.indexOf("-"));
// }
}
}
}
List<MomRuleBean> momRuleBeans = null;
// 查询数据表规则
if (coreCode.equals("")) {
System.out.println("psmCodes====================="+psmCodes.toString());
System.out.println("factory====================="+factory);
momRuleBeans = mapper.selectRuleBean(psmCodes,factory);
} else {
//momRuleBeans = mapper.selectRuleBean2(psmCodes, coreCode,factory);
}
System.out.println(momRuleBeans.toString());
// 遍历BOM获取PDF数据集信息
Map<String, List<DesignBean>> designBeanMap = new HashMap<>(); // 记录图纸信息
for (MomRuleBean momRuleBean : momRuleBeans) {
String drawingNo = momRuleBean.getDrawingno(); // 图号拼接工程图号
String type = momRuleBean.getList(); // ALL全部BOM 0本身 1单层
String elseDrawingNo = momRuleBean.getElsedrawingno(); // 排除的图号
String designId = drawingNo + "-" + projectCode;
System.out.println(designId);
String psmCode = momRuleBean.getPsmcode();
ModelObject[] modelObjects = KUtil.queryItemByID(designId); // 根据数据表中的1ZDB40000T拼接工程图号获取图纸
for (ModelObject modelObject : modelObjects) {
ItemRevision revision = (ItemRevision) modelObject;
KUtil.refreshAndGetProperties(
revision, "item_id", "object_name", "item_revision_id", "ps_children");
List<FileBean> dsList = getPdfByRevision(revision);
if (dsList.size() > 0) {
DesignBean bean =
new DesignBean(
revision.get_item_id(),
revision.get_object_name(),
getMaterialNo(revision),
revision.get_item_revision_id(),
dsList);
// designBeans.add(bean);
if (designBeanMap.containsKey(psmCode)) {
designBeanMap.get(psmCode).add(bean);
} else {
List<DesignBean> designBeans = new ArrayList<>();
designBeans.add(bean);
designBeanMap.put(psmCode, designBeans);
}
}
if (!type.equals("0")) {
// System.out.println("revision.get_item_id()===================="+ revision.get_item_id());
KUtil.log("revision.get_item_id()===================="+ revision.get_item_id());
// ArrayList arrayList = KUtil.openBOMWindow(revision); // 打开BOM
ModelObject[] psChildren = revision.get_ps_children();
//遍历bom 获取bl_is_occ_suppressed
ArrayList<String> list = new ArrayList<>();
//BOM全展开
StructureManagementService service = StructureManagementService.getService(conn);
ArrayList<Object> arrayList;
arrayList = openBOMWindow(revision, conn);
BOMLine procTopLine = (BOMLine) arrayList.get(1);
// StructureManagement structureService = (StructureManagement)StructureManagementService.getService(connection);
com.teamcenter.services.strong.cad._2007_01.StructureManagement.ExpandPSAllLevelsInfo levelInfo = new com.teamcenter.services.strong.cad._2007_01.StructureManagement.ExpandPSAllLevelsInfo();
com.teamcenter.services.strong.cad._2007_01.StructureManagement.ExpandPSAllLevelsPref levelPref = new StructureManagement.ExpandPSAllLevelsPref();
levelInfo.parentBomLines = new BOMLine[] { procTopLine }; //输入顶层BOMLine对象
levelInfo.excludeFilter = "None";
levelPref.expItemRev = false;
levelPref.info = new StructureManagement.RelationAndTypesFilter[0];
com.teamcenter.services.strong.cad._2007_01.StructureManagement.ExpandPSAllLevelsResponse levelResp = service.expandPSAllLevels(levelInfo, levelPref);
List<BOMLine> bomlineList = new ArrayList<BOMLine>();
List<ItemRevision> itemRevList = new ArrayList<ItemRevision>();
for (int i = 0; i < levelResp.serviceData.sizeOfPlainObjects(); i++)
{
ModelObject obj = levelResp.serviceData.getPlainObject(i);
BOMLine bomline = null;
ItemRevision itemrev = null;
//获取所有的BOMLine对象
if (obj instanceof BOMLine)
{
bomline = (BOMLine)obj;
bomlineList.add(bomline);
}
else if (obj instanceof ItemRevision)
{
//获取当前BOM窗口中所有的版本对象
itemrev = (ItemRevision)obj;
itemRevList.add(itemrev);
}
}
//属性批量预读
JSONArray array = new JSONArray();
ArrayList<String> judgeList = new ArrayList<>();//判断是否重复id
// ServiceData resp = dataManagementService.getProperties(bomlineList.toArray(new BOMLine[0]), new String[]{"bl_item_item_id","bl_is_occ_suppressed"});
for (int i = 0; i < bomlineList.size(); i++) {
try{
BOMLine tempBomline = bomlineList.get(i);
// KUtil.log("uid================"+tempBomline.getUid());
KUtil.refreshAndGetProperties(
tempBomline, "bl_item_item_id", "bl_is_occ_suppressed");
boolean bl_is_occ_suppressed = tempBomline.get_bl_is_occ_suppressed();
String bl_item_item_id = tempBomline.get_bl_item_item_id();
KUtil.log("id=================="+bl_item_item_id+"bl_is_occ_suppressed==== "+bl_is_occ_suppressed);
if(bl_is_occ_suppressed){
list.add(bl_item_item_id);
}
}catch (Exception e){
//e.printStackTrace();
// KUtil.log("ffffffffffffffffffffffffffffffffffffffffffffff");
continue;
}
}
// for (int i = 0; i < resp.sizeOfPlainObjects(); i++) {
//
// BOMLine loadPropObj = (BOMLine) resp.getPlainObject(i);
// boolean bl_is_occ_suppressed = loadPropObj.get_bl_is_occ_suppressed();
// String bl_item_item_id = loadPropObj.get_bl_item_item_id();
// System.out.println("id=================="+bl_item_item_id+"bl_is_occ_suppressed==== "+bl_is_occ_suppressed);
// if(bl_is_occ_suppressed){
// list.add(bl_item_item_id);
// }
//
// }
// KUtil.log("list=========================="+list.size());
KUtil.log("list=========================="+list.toString());
getAllDs(psChildren, elseDrawingNo, type, designBeanMap, psmCode,list);
// KUtil.closeBOMWindow((BOMWindow) arrayList.get(0));
}
}
}
JSONArray array = new JSONArray();
for (String key : designBeanMap.keySet()) {
List<DesignBean> designBeans = designBeanMap.get(key);
JSONObject jsonObject =
new JSONObject().fluentPut("process", key).fluentPut("list", designBeans);
array.add(jsonObject);
}
JSONObject jsonObject =
new JSONObject()
.fluentPut("wbsno", wbsNo)
.fluentPut("materialno", materialNo)
.fluentPut("processlist", array);
KUtil.log("getDesignList TC回传:" + jsonObject.toJSONString());
return jsonObject.toJSONString();
} else {
errMsg = "当前物料没有关联图纸.";
return JSONObject.toJSONString(JsonResult.error(errMsg));
}
} catch (Exception e) {
KUtil.log(e);
e.printStackTrace();
}
return JSONObject.toJSONString(JsonResult.error(errMsg));
}
// 获取版本下的PDF
public List<FileBean> getPdfByRevision(ItemRevision revision) throws Exception {
List<FileBean> dsList = new ArrayList<>();
KUtil.refreshAndGetProperties(revision, "IMAN_specification");
ModelObject[] specifications = revision.get_IMAN_specification();
int no = 1;
for (ModelObject specification : specifications) {
if (specification instanceof Dataset) {
Dataset ds = (Dataset) specification;
KUtil.refreshAndGetProperties(ds, "object_type", "object_name");
String object_type = ds.get_object_type();
if (object_type.equals("PDF")) {
String objectName = ds.get_object_name();
String uid = ds.getUid();
dsList.add(new FileBean(no + "", uid, objectName));
no++;
}
}
}
return dsList;
}
String getMaterialNo(ItemRevision revision) {
String materialNo = "";
try {
String item_id = revision.get_item_id();
if (item_id.startsWith("1ZD")) {
KUtil.refreshAndGetProperties(revision, "representation_for");
ModelObject[] materials = revision.get_representation_for();
if (materials.length > 0) {
ItemRevision material = (ItemRevision) materials[0];
KUtil.refreshAndGetProperties(material, "zt2_MaterialNo");
materialNo = material.getPropertyObject("zt2_MaterialNo").getStringValue();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return materialNo;
}
// 遍历BOM获取图纸下的pdf文件
private void getAllDs(
ModelObject[] psChildren,
String elseDrawingNo,
String type,
Map<String, List<DesignBean>> designBeanMap,
String psmCode,
ArrayList list
) {
try {
String pattern = elseDrawingNo == null ? "" : elseDrawingNo.replaceAll("\\*", ".*");
for (ModelObject psChild : psChildren) {
ItemRevision revision = (ItemRevision) psChild;
KUtil.refreshAndGetProperties(revision, "item_id", "ps_children");
String itemId = revision.get_item_id();
ModelObject[] psRevChildren = revision.get_ps_children();
if (Pattern.matches(pattern, itemId.split("-")[0])) {
continue;
}
List<FileBean> dsList = getPdfByRevision(revision);
System.out.println("item_id========================="+itemId);
if (dsList.size() > 0 && (!list.contains(itemId))) {
DesignBean bean =
new DesignBean(
revision.get_item_id(),
revision.get_object_name(),
getMaterialNo(revision),
revision.get_item_revision_id(),
dsList);
if (designBeanMap.containsKey(psmCode)) {
designBeanMap.get(psmCode).add(bean);
} else {
List<DesignBean> designBeans = new ArrayList<>();
designBeans.add(bean);
designBeanMap.put(psmCode, designBeans);
}
}
if (type.equals("ALL")) {
getAllDs(psRevChildren, elseDrawingNo, type, designBeanMap, psmCode,list);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
// 变更申请单信息推送至TC
@PostMapping("/getECNResult")
public String getECNResult(@RequestBody JSONObject designJson) {
// org.springframework.boot.configurationprocessor.json.JSONObject result = new
// org.springframework.boot.configurationprocessor.json.JSONObject();
KUtil.log("getECNResult json ====> " + designJson.toJSONString());
JSONObject result = new JSONObject();
FileInputStream fis = null;
FileOutputStream fos = null;
try {
// 根据提供的流程UID完成审核节点
saveECRResult(designJson);
// 更新数据库
JSONObject changeExecution = designJson.getJSONObject("changeexecution");
// 技术部
String ecnCode = designJson.getString("ecncode");
KUtil.log("ecnCode ====> " + ecnCode);
if(!designJson.containsKey("ecncode")|| ecnCode.isEmpty()){
return JSONObject.toJSONString(JsonResult.error("ecncode不存在请检查JSON......", 500));
}
//TODO OA回传会签信息时将回传信息中的“计划完成时间数据库字段pctime”与“备注数据库字段remark”写入Excel并更新Excel
HashMap<String, int[]> map = new HashMap<>();
// XSSFSheet sheet = null;
/**/
List<ModelObject> ecns = KUtil.query("Item...", new String[] { "零组件 ID" }, new String[] { ecnCode });
if(ecns == null || ecns.size() == 0){
return JSONObject.toJSONString(JsonResult.error("ecncode在TC中不存在请检查JSON......", 500));
}
ModelObject ecn = ecns.get(0);
DataManagementService dataManagementService = DataManagementService.getService(AppXSession.getConnection());
dataManagementService.getProperties(new ModelObject[]{ ecn }, new String[]{ "IMAN_reference" });
ModelObject[] refs = ecn.getPropertyObject("IMAN_reference").getModelObjectArrayValue();
FileManagementUtility fmu = new FileManagementUtility(AppXSession.getConnection(), null,
new String[] { loginInfo.getFmsUrl() }, new String[] { loginInfo.getFmsUrl() }, loginInfo.getFmstemp());
Dataset excel = null;
dataManagementService.getProperties(refs, new String[]{ "object_type" });
for(ModelObject ref : refs){
if(ref.getPropertyObject("object_type").getStringValue().equals("MSExcelX")){
excel = (Dataset) ref;
break;
}
}
if(excel == null){
return JSONObject.toJSONString(JsonResult.error("TC变更申请单未找到Excel请检查", 500));
}
File file = new File(KUtil.TCFileToFile(fmu, excel));
KUtil.log("file ====> " + file.getPath());
fis = new FileInputStream(file);
XSSFWorkbook workbook = new XSSFWorkbook(fis);
XSSFSheet sheet = workbook.getSheetAt(0);
map.put("产品图样、目录、铭牌等", new int[]{ 10, 7 });
map.put("技术方案、DFMEA、产品质量特性重要度分级表", new int[]{ 11, 7 });
map.put("BOM物料更改", new int[]{ 12, 7 });
map.put("包装图样/规范", new int[]{ 13, 7 });
map.put("发货标签更改", new int[]{ 14, 7 });
map.put("客户承诺相关设计文件", new int[]{ 15, 7 });
map.put("环保要求更改", new int[]{ 16, 7 });
map.put("工艺流程图、PFMEA、工艺守则", new int[]{ 17, 7 });
map.put("作业指导书、包装指导书", new int[]{ 18, 7 });
map.put("客户承诺相关工艺文件", new int[]{ 19, 7 });
map.put("模具、工装、设备更改", new int[]{ 20, 7 });
map.put("控制计划", new int[]{ 21, 7 });
map.put("进货/过程/成品检验文件", new int[]{ 22, 7 });
map.put("供应商产品质量检验报告", new int[]{ 23, 7 });
map.put("客户承诺相关质量文件", new int[]{ 24, 7 });
map.put("断点标识(物料切换)", new int[]{ 10, 17 });
map.put("在制品确认及处理", new int[]{ 11, 17 });
map.put("成品确认及处理", new int[]{ 12, 17 });
map.put("计划确认及调整", new int[]{ 13, 17 });
map.put("采购价格变化", new int[]{ 14, 17 });
map.put("更改信息(资料、价格)传递", new int[]{ 15, 17 });
map.put("合格供方评价(新增时)", new int[]{ 16, 17 });
map.put("供应商合同修改", new int[]{ 17, 17 });
map.put("供应商处产品确认", new int[]{ 18, 17 });
map.put("通知客户", new int[]{ 19, 17 });
map.put("客户批准", new int[]{ 20, 17 });
map.put("修改客户协议", new int[]{ 21, 17 });
map.put("销售价格变化", new int[]{ 22, 17 });
getJsonMessage("design", changeExecution.getJSONObject("design"), ecnCode, sheet, map);
getJsonMessage("tech", changeExecution.getJSONObject("tech"), ecnCode, sheet, map);
getJsonMessage("quality", changeExecution.getJSONObject("quality"), ecnCode, sheet, map);
getJsonMessage("produce", changeExecution.getJSONObject("produce"), ecnCode, sheet, map);
getJsonMessage("purchase", changeExecution.getJSONObject("purchase"), ecnCode, sheet, map);
getJsonMessage("customnotice", changeExecution.getJSONObject("customnotice"), ecnCode, sheet, map);
getJsonMessage("finaprice", changeExecution.getJSONObject("finaprice"), ecnCode, sheet, map);
result.put("code", "200");
result.put("msc", "接收成功");
fos = new FileOutputStream(file);
workbook.write(fos);
KUtil.uploadFileToTc(file, excel, "excel", fmu);
} catch (Exception e) {
try {
result.put("code", "500");
result.put("msc", "接收失败" + e.getMessage());
} catch (Exception jsonException) {
jsonException.printStackTrace();
}
e.printStackTrace();
KUtil.log(KUtil.getStackTrace(e));
}finally{
if(fis != null) {
try {
fis.close();
} catch (Exception e) {
e.printStackTrace();
}
}
if(fos != null) {
try {
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
KUtil.log("result ====> " + result);
return result.toString();
}
void getJsonMessage(String depart, JSONObject departJson, String ecnCode, XSSFSheet sheet, HashMap<String, int[]> map) {
if(departJson == null){
return;
}
String principal = departJson.getString(depart + "principal").replaceAll(":", ";");
String coudata = departJson.getString(depart + "date");
JSONArray files = departJson.getJSONArray(depart + "files");
XSSFRow row;
XSSFCell cell;
for (int i = 0; i < files.size(); i++) {
JSONObject file = files.getJSONObject(i);
String fileVal = file.getString(depart + "file"); // pctime
String pctimeVal = file.getString(depart + "pctime");
String remarkVal = file.getString(depart + "remark");
mapper.updateRefMethod(fileVal, principal, coudata, pctimeVal, remarkVal, ecnCode);
int[] w = map.get(fileVal);
row = sheet.getRow(w[0]);
cell = row.getCell(w[1]);
cell.setCellValue(pctimeVal);
cell = row.getCell(w[1] + 2);
cell.setCellValue(remarkVal);
}
}
// 存储变更申请单信息
public void saveECRResult(JSONObject jsonObject) throws Exception {
// 登录
// Session session = new Session(config.getTc_url());
try {
DataManagementService dmService =
DataManagementService.getService(AppXSession.getConnection());
// User user = session.login2(config.getTc_user(), config.getTc_pwd());
// 根据UID查询流程对象
String uuid = jsonObject.getString("uuid");
ServiceData serverData = dmService.loadObjects(new String[] {uuid});
if (serverData.sizeOfPlainObjects() > 0) {
assignOATask(serverData.getPlainObject(0));
}
} catch (Exception e) {
e.printStackTrace();
KUtil.log(KUtil.getStackTrace(e));
} finally {
// 登出
// session.logout();
}
}
public void assignOATask(ModelObject childTaskMo) throws Exception {
WorkflowService wfService = WorkflowService.getService(AppXSession.getConnection());
DataManagementService dmService = DataManagementService.getService(AppXSession.getConnection());
EPMTask childTask = (EPMTask) childTaskMo;
dmService.refreshObjects(new ModelObject[] {childTask});
dmService.getProperties(
new ModelObject[] {childTask}, new String[] {"object_type", "object_name"});
String taskType = childTask.get_object_type();
KUtil.log("taskType ====>" + taskType);
if(taskType.compareTo("EPMPerformSignoffTask") == 0){
dmService.getProperties(
new ModelObject[] {childTask},
new String[] {"parent_task"});
childTask = childTask.get_parent_task();
dmService.refreshObjects(new ModelObject[] {childTask});
dmService.getProperties(
new ModelObject[] {childTask}, new String[] {"object_type", "object_name"});
}
if (childTask.get_object_type().compareTo("EPMReviewTask") == 0) {
dmService.getProperties(
new ModelObject[] {(EPMTask) childTask},
new String[] {"fnd0TaskPathName", "child_tasks", "user_all_signoffs"});
// 获取审核任务的子任务
ModelObject[] childReviewTasks = childTask.get_child_tasks();
dmService.refreshObjects(childReviewTasks);
dmService.getProperties(
childReviewTasks,
new String[] {
"signoff_profiles", "user_all_signoffs", "valid_signoffs", "signoff_attachments"
});
// 审核人
ModelObject signOff = null;
// 审批子任务
EPMTask childReview = null;
for (ModelObject childReviewTask : childReviewTasks) {
// 如果是选人子任务
if (childReviewTask instanceof EPMSelectSignoffTask) {
EPMSelectSignoffTask childSelectReview = (EPMSelectSignoffTask) childReviewTask;
dmService.refreshObjects(new ModelObject[] { childSelectReview });
ModelObject[] signOffs = childSelectReview.get_valid_signoffs();
dmService.refreshObjects(signOffs);
if (signOffs.length > 0) {
for (ModelObject off : signOffs) {
Signoff center = (Signoff) off;
dmService.getProperties(new ModelObject[]{center}, new String[]{"object_string"});
System.out.println("当前的值为:" + center.get_object_string());
if (center.get_object_string().contains("dcproxy")) {
signOff = off;
dmService.refreshObjects(new ModelObject[]{signOff});
break;
}
}
}
}
// 如果是审批子任务
else if (childReviewTask instanceof EPMPerformSignoffTask) {
childReview = (EPMTask) childReviewTask;
// dmService.refreshObjects(new ModelObject[]{childReview});
}
}
dmService.refreshObjects(new ModelObject[] {signOff, childReview});
KUtil.log("批准OA审批节点 ====>" + childReview);
System.out.println("批准OA审批节点 ====>" + childReview.getUid());
ServiceData sData1 =
wfService.performAction(
childReview, "SOA_EPM_perform_action", "", null, "SOA_EPM_approve", signOff);
// Workflow.PerformActionInputInfo info = new Workflow.PerformActionInputInfo();
// info.actionableObject = childReview;
// info.action = "SOA_EPM_perform_action";
// wfService.performAction3(new Workflow.PerformActionInputInfo[] { info });
serviceDataError(sData1);
}
}
//TODO 云派调用TC接口查询更改通知单对象
@RequestMapping(value = "/getECN", method = {RequestMethod.GET, RequestMethod.POST})
public String getECN(@RequestBody ECNBean ecnBean) throws Exception {
KUtil.log(">> 开始执行getECN");
KUtil.log("jSONObject = " + ecnBean);
/*Session session = new Session(config.getTc_url());
User user = session.login2(config.getTc_user(), config.getTc_pwd());
if (user == null) {
throw new Exception("Teamcenter SOA登录失败");
}*/
HashMap<String, ECNBeanReturn> counts = new HashMap<>();
try{
// DataManagementService dataManagementService = DataManagementService.getService(Session.getConnection());
DataManagementService dataManagementService = DataManagementService.getService(AppXSession.getConnection());
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("dd-MMM-yyyy", Locale.US);
// sdf2.applyLocalizedPattern();
String[] vals = new String[]{ sdf2.format(sdf1.parse(ecnBean.getCreationdatebefore())) + " 23:59", "*" + ecnBean.getFactory() + "*",
sdf2.format(sdf1.parse(ecnBean.getCreationdateafter())) + " 00:00" };
KUtil.log("query = " + Arrays.toString(vals));
// ModelObject[] results = queryItems("chint_query_change", new String[]{ "创建时间早于", "所有权组", "创建时间晚于" }, vals);
// ModelObject[] results = queryItems("chint_query_change", new String[]{ "CreatedBefore", "OwningGroup", "CreatedAfter" }, vals);
// ModelObject[] results = queryItems("chint_query_change", new String[]{ "before", "groupname", "after" }, vals);
HashMap<String, String> searchMap = new HashMap<>();
searchMap.put("before", vals[0]);
searchMap.put("groupname", vals[1]);
searchMap.put("after", vals[2]);
ModelObject[] results = KUtil.query("chint_query_material_test", searchMap);
if (results != null) {
for(ModelObject result : results){
dataManagementService.getProperties(new ModelObject[] { result }, new String[]{ "owning_user" });
com.teamcenter.soa.client.model.Property prop = result.getPropertyObject("owning_user");
ModelObject owning_user = prop.getModelObjectValue();
dataManagementService.getProperties(new ModelObject[] { owning_user }, new String[]{ "user_name" });
String user_name = owning_user.getPropertyDisplayableValue("user_name");
if(counts.containsKey(user_name)){
counts.get(user_name).add();
}else {
counts.put(user_name, new ECNBeanReturn(user_name, 1));
}
}
}else{
KUtil.log("chint_query_change查询未返回有效结果");
}
}catch(Exception e){
e.printStackTrace();
KUtil.log("getECN 异常===>" + KUtil.getStackTrace(e));
throw e;
}
ArrayList<ECNBeanReturn> returns = new ArrayList<>(counts.values());
ObjectMapper objectMapper = new ObjectMapper();
String data = "{\"code\": \"200\",\"msg\": \"\",\"results\":" + objectMapper.writeValueAsString(returns) + "}";
KUtil.log("返回数据:" + data + "\n");
// session.logout();
return data;
}
public static boolean serviceDataError(ServiceData data) {
if (data.sizeOfPartialErrors() > 0) {
for (int i = 0; i < data.sizeOfPartialErrors(); i++) {
String[] msgs = data.getPartialError(i).getMessages();
for(String msg : msgs){
System.out.println(msg);
KUtil.log(msg);
}
//System.out.println(data.getPartialError(i).getMessages()[0]);
// TDefaultLogger.CreateInstance().LogAgent.DebugFormat("错误{0}",
// data.getPartialError(i).getMessages());
}
return false;
}
return true;
}
}

@ -0,0 +1,146 @@
//package com.connor.connor_cpzc_service.controller;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.connor.connor_cpzc_service.info.JFWEntry;
//import com.connor.connor_cpzc_service.info.JFWMesEntry;
//import com.connor.connor_cpzc_service.info.LoginInfo;
//import com.connor.connor_cpzc_service.info.RiskEntry;
//import com.connor.connor_cpzc_service.util.KUtil;
//import com.teamcenter.services.strong.core.DataManagementService;
//import com.teamcenter.soa.client.model.ModelObject;
//import com.teamcenter.soa.client.model.ServiceData;
//import com.teamcenter.soa.client.model.strong.*;
//import org.apache.log4j.Logger;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.ArrayList;
//import java.util.List;
//
//@Component
//@RestController
//@RequestMapping(value = "/connor/jfw")
//public class JfwController {
// private static final Logger log = Logger.getLogger(WBSController.class);
//
// @Autowired
// protected LoginInfo loginInfo;
//
// @RequestMapping(value = "/{projectId}", method = RequestMethod.POST)
// public String updateStatus(@PathVariable String projectId) {
// log.error(String.format("收到请求交付物项目ID【%s】",projectId));
// String json ="";
// List<JFWEntry> wbsInfos=new ArrayList<>();
// try {
//// DataManagementService dmService = KUtil.login(loginInfo.getServer(), loginInfo.getUser(), loginInfo.getPassword());
// KUtil.setByPass(true);
// String projectFind = "Projects...";
// String[] proId = new String[]{"项目 ID"};
// String[] proVal = new String[]{"*"};
// List<ModelObject> projects = KUtil.query(projectFind, proId, proVal);
// System.out.println("projects数量"+projects.size());
//
//
//
// for (ModelObject pro:projects){
// JFWEntry wbsInfo=new JFWEntry();
// wbsInfos.add(wbsInfo);
// TC_Project project = (TC_Project)pro;
//// ItemRevision rev = (ItemRevision) revs.get(0);
// KUtil.refreshAndGetProperties(project, "project_id", "project_name","project_data","xa2_ProjectState");
// wbsInfo.setProjectstatus(project.getPropertyObject("xa2_ProjectState").getStringValue());
// log.error("找到项目:"+project.get_object_string());
// wbsInfo.setProjectname(project.get_project_name());
// wbsInfo.setProjectid(project.get_project_id());
// ModelObject[] project_data = project.get_project_data();
// if(project_data.length==0){
// throw new Exception(String.format("未找到时间表\"%s\"", projectId));
// }
// List<JFWMesEntry> jfwMesEntries=new ArrayList<>();
// Schedule schedule=null;
// for(ModelObject modelObject :project_data){
// KUtil.refreshAndGetProperties(modelObject, "object_type");
// String object_type = modelObject.getPropertyObject("object_type").getStringValue();
// if(object_type.equals("Schedule")){
// schedule =(Schedule)modelObject;
// }
// }
// if(schedule==null){
// throw new Exception(String.format("没有找到时间表\"%s\"", projectId));
// }
// KUtil.refreshAndGetProperties(schedule, "object_type");
// String object_type = schedule.get_object_type();
//// if(object_type.equals("xa2.ScheduleType") || true){
// KUtil.refreshAndGetProperties(schedule, "fnd0SummaryTask");
// ScheduleTask fnd0SummaryTask = (ScheduleTask)schedule.get_fnd0SummaryTask();
// KUtil.refreshAndGetProperties(fnd0SummaryTask, "fnd0TaskTypeString","child_task_taglist");
// ArrayList<ScheduleTask> child_tasks=new ArrayList<>();
// KUtil.getChildTask(fnd0SummaryTask,child_tasks);
//// ScheduleTask[] child_task_taglist = fnd0SummaryTask.get_child_task_taglist();
// for(int j=0;j<child_tasks.size();j++){
// ScheduleTask scheduleTask = child_tasks.get(j);
// KUtil.refreshAndGetProperties(scheduleTask, "sch_task_deliverable_list","fnd0TaskTypeString");
// if(scheduleTask.get_fnd0TaskTypeString().contains("汇总")){
// continue;
// }
//// scheduleTask.get()
// SchTaskDeliverable[] sch_task_deliverable_list = scheduleTask.get_sch_task_deliverable_list();
// for(int i=0;i<sch_task_deliverable_list.length;i++){
// JFWMesEntry jfwMes=new JFWMesEntry();
// SchTaskDeliverable schTaskDeliverable = sch_task_deliverable_list[0];
// KUtil.refreshAndGetProperties(schTaskDeliverable, "object_name","owning_user",
// "fnd0InstanceReleaseStatus","fnd0DeliverableInstance","object_type");
// User owning_user = (User) schTaskDeliverable.get_owning_user();
// String object_type1 = schTaskDeliverable.get_object_type();
// KUtil.refreshAndGetProperties(owning_user, "user_name");
// jfwMes.setDeliverowner(owning_user.get_user_name());
// jfwMes.setDelivername(schTaskDeliverable.get_object_name());
// WorkspaceObject dataSet =schTaskDeliverable.get_fnd0DeliverableInstance();
// try {
// KUtil.refreshAndGetProperties(dataSet, "fnd0AllWorkflows","item_id","object_type");
//// if(dataSet.getPropertyObject("object_type").getStringValue().equals(object_type1)){
// jfwMes.setDeliverid(dataSet.getPropertyObject("item_id").getStringValue());
// if(schTaskDeliverable.get_fnd0InstanceReleaseStatus().length>0){
// jfwMes.setDeliverstatus("完成");
// }else if(dataSet.get_fnd0AllWorkflows().length>0){
// jfwMes.setDeliverstatus("进行中");
// }else {
// jfwMes.setDeliverstatus("未开始");
// }
//// }
// }catch (Exception e){
// e.printStackTrace();
// KUtil.refreshAndGetProperties(dataSet, "fnd0AllWorkflows");
// if(schTaskDeliverable.get_fnd0InstanceReleaseStatus().length>0){
// jfwMes.setDeliverstatus("完成");
// }else if(dataSet.get_fnd0AllWorkflows().length>0){
// jfwMes.setDeliverstatus("进行中");
// }else {
// jfwMes.setDeliverstatus("未开始");
// }
// }
//
// jfwMesEntries.add(jfwMes);
// }
// }
//
//// }
// wbsInfo.setEntry(jfwMesEntries);
// }
//
//
// }catch (Exception e){
// e.printStackTrace();
// }finally {
//// KUtil.logoutAndClearCache2();
// }
//// wbsInfo.setMessage(new Message());
// json= JSON.toJSONString(wbsInfos);
// return json;
// }
//}

@ -0,0 +1,46 @@
package com.connor.connor_cpzc_service.controller;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class JgjBean {
@JsonProperty("downFile")
private List<String> downFile;
@JsonProperty("errFile")
private List<String> errFile;
@JsonProperty("desc")
private String desc;
@JsonProperty("code")
private String code;
@JsonProperty("user")
private String userId;
@JsonProperty("zt2_Specifications")
private String zt2_Specifications;
@JsonProperty("item_id")
private String itemId;
@JsonProperty("fileNames")
private List<String> fileNames;
@JsonProperty("objName")
private String objName;
@JsonProperty("jgjIds")
List<String> jgjList;
public JgjBean(List<String> downFile, List<String> errFile, String desc, String code,
String itemId, List<String> fileNames, List<String> uids, String document,List<String> jgjList) {
this.downFile = downFile;
this.errFile = errFile;
this.desc = desc;
this.code = code;
this.itemId = itemId;
this.fileNames = fileNames;
this.uids = uids;
this.document = document;
this.jgjList = jgjList;
}
@JsonProperty("uids")
private List<String> uids;
@JsonProperty("document")
private String document;
}

@ -0,0 +1,358 @@
package com.connor.connor_cpzc_service.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.connor.connor_cpzc_service.bean.MdmDs.DesignBean;
import com.connor.connor_cpzc_service.bean.MdmDs.FileBean;
import com.connor.connor_cpzc_service.bean.MdmDs.MomRuleBean;
import com.connor.connor_cpzc_service.bean.QMSBean;
import com.connor.connor_cpzc_service.bean.SapResult;
import com.connor.connor_cpzc_service.bean.SapReturn;
import com.connor.connor_cpzc_service.mapper.EPMMapper;
import com.connor.connor_cpzc_service.service.BomResultService;
import com.connor.connor_cpzc_service.service.RDMService;
import com.connor.connor_cpzc_service.util.JsonResult;
import com.connor.connor_cpzc_service.util.KUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.teamcenter.clientx.AppXSession;
import com.teamcenter.services.strong.core.DataManagementService;
import com.teamcenter.services.strong.workflow.WorkflowService;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.client.model.ServiceData;
import com.teamcenter.soa.client.model.strong.*;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Pattern;
@RestController
@RequestMapping(value = "/plm")
public class RDMController {
@Autowired RDMService service;
private static org.apache.log4j.Logger logger =
org.apache.log4j.Logger.getLogger(RDMController.class);
@PostMapping("/getFileList")
public String getBOMResult(@RequestBody String json) throws Exception {
JSONObject parse = (JSONObject) JSON.parse(json);
JSONObject errorResult = new JSONObject();
// 遍历lists数组
HashMap<String,String> map = new HashMap<String,String>();
LinkedHashMap<String, JSONObject> stringJSONObjectLinkedHashMap = new LinkedHashMap<>();
String queryID = "";
JSONArray lists = parse.getJSONArray("drawlist");
for (int i = 0; i < lists.size(); i++) {
JSONObject listObject = lists.getJSONObject(i);
// 获取listObject中的属性
String drawNo = listObject.getString("drawNo");
String no = listObject.getString("no");
//参数非空判断
if (drawNo == null || drawNo.isEmpty()) {
errorResult.put("code", "500");
errorResult.put("msg", "drawNo不能为空");
return errorResult.toString();
}
if (no == null || no.isEmpty()) {
errorResult.put("code", "500");
errorResult.put("msg", "no不能为空");
return errorResult.toString();
}
map.put(drawNo,no);
queryID = queryID+drawNo+";";
}
return service.GetDrawing(map,queryID,stringJSONObjectLinkedHashMap);
}
@PostMapping("/GetRDMProject")
public String getRDMProject(@RequestBody String json){
return service.getRDMProject(json);
}
@PostMapping("/getProjectFinish")
public String getProjectFinish(@RequestBody String json){
return service.getProjectFinish(json);
}
@PostMapping("/getInspection")
public String getInspection(@RequestBody String json){
JSONObject errorResult = new JSONObject();
JSONObject result = new JSONObject();
// 解析JSON字符串
JSONObject jsonObject = JSON.parseObject(json);
String factory = jsonObject.getString("factory");
//参数非空判断
if(factory == null || factory.isEmpty()){
errorResult.put("code",400);
errorResult.put("msg","factory不能为空");
return errorResult.toString();
}
// 获取lists对象
JSONArray lists = jsonObject.getJSONArray("lists");
if(lists == null || lists.size() == 0){
errorResult.put("code",400);
errorResult.put("msg","lists不能为空");
return errorResult.toString();
}
try {
for (int i = 0; i < lists.size(); i++) {
JSONObject listObject = lists.getJSONObject(i);
// 获取listObject中的属性
String qmsinspectioncode = listObject.getString("qmsinspectioncode");
String qmsinspectionname = listObject.getString("qmsinspectionname");
String qmspushuser = listObject.getString("qmspushuser");
String qmspushtime = listObject.getString("qmspushtime");
String qmsremark = listObject.getString("qmsremark");
String qmssuperiorinspectionname = listObject.getString("qmssuperiorinspectionname");
String qmssuperiorinspectioncode = listObject.getString("qmssuperiorinspectioncode");
String qmsinspectionschemename = listObject.getString("qmsinspectionschemename");
String qmsinspectionschemecode = listObject.getString("qmsinspectionschemecode");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date qmspushtimeDate = sdf.parse(qmspushtime);
QMSBean qmsBean = new QMSBean(factory,qmsinspectioncode,qmsinspectionname,qmspushuser,qmspushtimeDate,qmsremark,qmssuperiorinspectionname,qmssuperiorinspectioncode,qmsinspectionschemename,qmsinspectionschemecode);
//service.getInspection(factory, qmsinspectioncode, qmsinspectionname, qmssuperiorinspection, qmspushuser, qmspushtime, qmsremark);
service.getInspection(qmsBean);
}
}catch (Exception e){
e.printStackTrace();
errorResult.put("code",500);
errorResult.put("msg","失败!");
return errorResult.toString();
}
result.put("code",200);
result.put("msg","成功接收");
return result.toJSONString();
}
@PostMapping("/getInspectionResult")
public String getInspectionResult(@RequestBody String json){
JSONObject errorResult = new JSONObject();
JSONObject result = new JSONObject();
HashMap<String, JSONObject> enptyMap = new HashMap<>();
List<QMSBean> lastBeans = new ArrayList<QMSBean>();
// 解析JSON字符串
JSONObject jsonObject = JSON.parseObject(json);
String factory = jsonObject.getString("factory");
//参数非空判断
if(factory == null || factory.isEmpty()){
errorResult.put("code",400);
errorResult.put("msg","factory不能为空");
return errorResult.toString();
}
// 获取lists对象
JSONArray lists = jsonObject.getJSONArray("lists");
if(lists == null || lists.size() == 0){
errorResult.put("code",400);
errorResult.put("msg","lists不能为空");
return errorResult.toString();
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
for (int i = 0; i < lists.size(); i++) {
JSONObject listObject = lists.getJSONObject(i);
// 获取listObject中的属性
String qmsinspectioncode = listObject.getString("qmsinspectioncode");
// String qmsinspectionname = listObject.getString("qmsinspectionname");
// String qmspushuser = listObject.getString("qmspushuser");
// String qmspushtime = listObject.getString("qmspushtime");
// String qmsremark = listObject.getString("qmsremark");
// String qmssuperiorinspectionname = listObject.getString("qmssuperiorinspectionname");
// String qmssuperiorinspectioncode = listObject.getString("qmssuperiorinspectioncode");
// String qmsinspectionschemename = listObject.getString("qmsinspectionschemename");
String qmsinspectionschemecode = listObject.getString("qmsinspectionschemecode");
if(qmsinspectioncode == null || qmsinspectioncode.isEmpty()){
errorResult.put("code",400);
errorResult.put("msg","qmsinspectioncode不能为空");
return errorResult.toString();
}
if(qmsinspectionschemecode == null || qmsinspectionschemecode.isEmpty()){
errorResult.put("code",400);
errorResult.put("msg","qmsinspectionschemecode不能为空");
return errorResult.toString();
}
List<QMSBean> qmsBeans = service.getInspectionResult(factory,qmsinspectioncode,qmsinspectionschemecode);
if(qmsBeans != null && qmsBeans.size() > 0){
for (QMSBean qmsBean : qmsBeans) {
lastBeans.add(qmsBean);
}
}else{
JSONObject tempJsonObject = new JSONObject();
tempJsonObject.put("qmsinspectioncode",listObject.getString("qmsinspectioncode"));
tempJsonObject.put("qmsinspectionname",listObject.getString("qmsinspectionname"));
tempJsonObject.put("qmssuperiorinspectionname",listObject.getString("qmssuperiorinspectionname"));
tempJsonObject.put("qmssuperiorinspectioncode",listObject.getString("qmssuperiorinspectioncode"));
tempJsonObject.put("qmsinspectionschemename",listObject.getString("qmsinspectionschemename"));
tempJsonObject.put("qmsinspectionschemecode",listObject.getString("qmsinspectionschemecode"));
tempJsonObject.put("qmspushuser",listObject.getString("qmspushuser"));
tempJsonObject.put("qmspushtime",listObject.getString("qmspushtime"));
tempJsonObject.put("qmsremark",listObject.getString("qmsremark"));
tempJsonObject.put("plminspectioncode","");
tempJsonObject.put("plmremark","");
tempJsonObject.put("result","");
tempJsonObject.put("synctime","");
tempJsonObject.put("syncuser","");
enptyMap.put(listObject.getString("qmsinspectioncode")+listObject.getString("qmsinspectionschemecode"),tempJsonObject);
}
}
}catch (Exception e){
e.printStackTrace();
errorResult.put("code",500);
errorResult.put("msg","失败!");
return errorResult.toString();
}
result.put("code",200);
result.put("msg","成功接收");
result.put("factory",factory);
JSONArray jsonArray = new JSONArray();
System.out.println("lastBean============"+ lastBeans.size());
for (QMSBean lastBean : lastBeans) {
JSONObject tempJsonObject = new JSONObject();
tempJsonObject.put("qmsinspectioncode",lastBean.getQmsinspectioncode() == null ? "" : lastBean.getQmsinspectioncode());
tempJsonObject.put("qmsinspectionname",lastBean.getQmsinspectionname() == null ? "" : lastBean.getQmsinspectionname());
tempJsonObject.put("qmssuperiorinspectionname",lastBean.getQmssuperiorinspectionname() == null ? "" : lastBean.getQmssuperiorinspectionname());
tempJsonObject.put("qmssuperiorinspectioncode",lastBean.getQmssuperiorinspectioncode() == null ? "" : lastBean.getQmssuperiorinspectioncode());
tempJsonObject.put("qmsinspectionschemename",lastBean.getQmsinspectionschemename() == null ? "" : lastBean.getQmsinspectionschemename());
tempJsonObject.put("qmsinspectionschemecode",lastBean.getQmsinspectionschemecode() == null ? "" : lastBean.getQmsinspectionschemecode());
tempJsonObject.put("qmspushuser",lastBean.getQmspushuser() == null ? "" : lastBean.getQmspushuser());
tempJsonObject.put("qmspushtime",lastBean.getQmspushtime() == null ? "" :sdf.format(lastBean.getQmspushtime()));
tempJsonObject.put("qmsremark",lastBean.getQmsremark() == null ? "" : lastBean.getQmsremark());
tempJsonObject.put("plminspectioncode",lastBean.getPlminspectioncode() == null ? "" : lastBean.getPlminspectioncode());
tempJsonObject.put("plmremark",lastBean.getPlmremark() == null ? "" : lastBean.getPlmremark());
tempJsonObject.put("result",lastBean.getResult() == null ? "" : lastBean.getResult());
tempJsonObject.put("synctime",lastBean.getSynctime() == null ? "" :sdf.format(lastBean.getSynctime()));
tempJsonObject.put("syncuser",lastBean.getSyncuser() == null ? "" : lastBean.getSyncuser());
jsonArray.add(tempJsonObject);
}
for (Map.Entry<String, JSONObject> entryMap : enptyMap.entrySet()
) {
JSONObject value = entryMap.getValue();
jsonArray.add(value);
}
result.put("lists",jsonArray);
return result.toJSONString();
}
@PostMapping("/getProjectInspection")
public String getProjectInspection(@RequestBody String json){
JSONObject errorResult = new JSONObject();
HashMap<String, JSONObject> enptyMap = new HashMap<>();
List<QMSBean> lastBeans = new ArrayList<QMSBean>();
// 解析JSON字符串
JSONObject jsonObject = JSON.parseObject(json);
String factory = jsonObject.getString("factory");
// //参数非空判断
// if(factory == null || factory.isEmpty()){
// errorResult.put("code",400);
// errorResult.put("msg","factory不能为空");
// return errorResult.toString();
// }
//
// // 获取lists对象
// JSONArray lists = jsonObject.getJSONArray("lists");
// if(lists == null || lists.size() == 0){
// errorResult.put("code",400);
// errorResult.put("msg","lists不能为空");
// return errorResult.toString();
// }
String wbsno = jsonObject.getString("wbsno");
String drawingno = jsonObject.getString("drawingno");
String factoryno = jsonObject.getString("factoryno");
JSONArray materialnolists = jsonObject.getJSONArray("materialnolists");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
for (int i = 0; i < materialnolists.size(); i++) {
JSONObject materialnolistsObject = materialnolists.getJSONObject(i);
// 获取listObject中的属性
String materialno = materialnolistsObject.getString("materialno");
JSONArray inspectionlists = materialnolistsObject.getJSONArray("inspectionlists");
for (int j = 0; j < inspectionlists.size(); j++) {
JSONObject inspectionlistsObject = inspectionlists.getJSONObject(j);
String plminspectioncode = inspectionlistsObject.getString("plminspectioncode");
String value = service.getProjectInspection(wbsno,drawingno,factoryno,materialno,plminspectioncode);
inspectionlistsObject.put("value",value);
}
}
jsonObject.put("code","200");
jsonObject.put("msg","成功");
}catch (Exception e){
e.printStackTrace();
errorResult.put("code",500);
errorResult.put("msg","失败!");
return errorResult.toString();
}
return jsonObject.toJSONString();
}
}

@ -0,0 +1,15 @@
package com.connor.connor_cpzc_service.controller;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class ReBean {
public ReBean(List<String> zztQd) {
this.zztQd = zztQd;
}
private String code;
@JsonProperty("zztQd")
private List<String> zztQd;
}

@ -0,0 +1,66 @@
package com.connor.connor_cpzc_service.controller;
import com.connor.connor_cpzc_service.info.FileInfoBean;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
public class ReturnBean {
@JsonProperty("downFile")
private List<String> downFile;
@JsonProperty("errFile")
private List<String> errFile;
@JsonProperty("desc")
private String desc;
@JsonProperty("code")
private String code;
@JsonProperty("user")
private String userId;
@JsonProperty("zt2_Specifications")
private String zt2_Specifications;
@JsonProperty("item_id")
private String itemId;
@JsonProperty("fileNames")
private List<String> fileNames;
@JsonProperty("objName")
private String objName;
public ReturnBean(List<String> downFile, List<String> errFile, String desc, String code,
String itemId, List<String> fileNames, List<String> uids, String document) {
this.downFile = downFile;
this.errFile = errFile;
this.desc = desc;
this.code = code;
this.itemId = itemId;
this.fileNames = fileNames;
this.uids = uids;
this.document = document;
}
@JsonProperty("uids")
private List<String> uids;
@JsonProperty("document")
private String document;
public ReturnBean(String userId, String zt2_Specifications, String itemId,List<String> fileNames) {
this.userId = userId;
this.zt2_Specifications = zt2_Specifications;
this.itemId = itemId;
this.fileNames = fileNames;
}
public ReturnBean(List<String> downFile, List<String> errFile, String desc, String code,
String userId, String zt2_Specifications, String itemId,List<String> fileNames,
List<String> uids,String document,String objName) {
this.downFile = downFile;
this.errFile = errFile;
this.desc = desc;
this.code = code;
this.userId = userId;
this.zt2_Specifications = zt2_Specifications;
this.itemId = itemId;
this.fileNames = fileNames;
this.uids = uids;
this.document = document;
this.objName = objName;
}
}

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

Loading…
Cancel
Save